From owner-freebsd-drivers@FreeBSD.ORG Sun Jan 22 11:41:14 2012 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C98B3106564A for ; Sun, 22 Jan 2012 11:41:14 +0000 (UTC) (envelope-from g.s@arcor.de) Received: from mail-in-18.arcor-online.net (mail-in-18.arcor-online.net [151.189.21.58]) by mx1.freebsd.org (Postfix) with ESMTP id 81D148FC12 for ; Sun, 22 Jan 2012 11:41:14 +0000 (UTC) Received: from mail-in-20-z2.arcor-online.net (mail-in-20-z2.arcor-online.net [151.189.8.85]) by mx.arcor.de (Postfix) with ESMTP id 29FB43DCC09 for ; Sun, 22 Jan 2012 12:10:00 +0100 (CET) Received: from mail-in-18.arcor-online.net (mail-in-18.arcor-online.net [151.189.21.58]) by mail-in-20-z2.arcor-online.net (Postfix) with ESMTP id 25D4BE9ABA for ; Sun, 22 Jan 2012 12:10:00 +0100 (CET) Received: from [192.168.0.95] (178-27-25-16-dynip.superkabel.de [178.27.25.16]) (Authenticated sender: g.s@arcor.de) by mail-in-18.arcor-online.net (Postfix) with ESMTPSA id C71773DD443 for ; Sun, 22 Jan 2012 12:09:59 +0100 (CET) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-18.arcor-online.net C71773DD443 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arcor.de; s=mail-in; t=1327230600; bh=E0nUGAOFdHqDbIWSviuRNnp9xogd/Pl+h/wmM+Dbnlo=; h=Message-ID:Date:From:MIME-Version:To:Subject:Content-Type: Content-Transfer-Encoding; b=SoUpj0bEGyso+OvTkiBueH97E2WZmX9zgFF4mF0i22ETaxOWkKw91VfXqE4gbzV8W cPBeqGwN308cBTEo/w3yZ+Fl3EhNjHUeqsKTq0LV6vz98viRbFX8QRP7F0LHvogkop Cq590mDh1wUpX/Ble4ppk5wXfBZDLl3Hkt/NwWGA= Message-ID: <4F1BEE87.6080303@arcor.de> Date: Sun, 22 Jan 2012 12:09:59 +0100 From: Gerhard Strangar User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1.24) Gecko/20100228 MIME-Version: 1.0 To: freebsd-drivers@freebsd.org X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Introduction to writing kernel modules X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 11:41:14 -0000 Hello, I'm trying to write a driver for my watchdog card. However I don't know anything about kernel modules in FreeBSD. I'm running 8.2 Release and I found /usr/src/share/examples/drivers/, but there are lines like struct ${1}_softc { [...] char buffer[BUFFERSIZE]; /* If we need to buffer something. */ }; Does it mean that it's for internal use of the example module only or does an other component use it? My card is PCI-based and all I need to do is write a byte via port-based IO, no Interrupts, no DMA or other stuff. I'm planning to use a character device for triggering the timer reset or disabling the card. But I don't need to copy the input to kernel space before checking if it was 0 or 1, do I? Later on, the example uses: static struct _pcsid { u_int32_t type; const char *desc; } pci_ids[] = { { 0x1234abcd, "ACME PCI Widgetplus" }, { 0x1243fedc, "Happy moon brand RIPOFFplus" }, { 0x00000000, NULL } }; What's the meaning of those? Is the driver looking for two cards and 0x0 and NULL terminate the list or is it looking for one card only and the abcd matches the "class" of "pcilist -lv" and fedc matches "card"?