From owner-freebsd-drivers@FreeBSD.ORG Thu Aug 17 17:30:08 2006 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B577316A4DA for ; Thu, 17 Aug 2006 17:30:08 +0000 (UTC) (envelope-from herriojr@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.176]) by mx1.FreeBSD.org (Postfix) with ESMTP id 06ADA43D4C for ; Thu, 17 Aug 2006 17:30:07 +0000 (GMT) (envelope-from herriojr@gmail.com) Received: by py-out-1112.google.com with SMTP id c59so889682pyc for ; Thu, 17 Aug 2006 10:30:07 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ch431VzW5zDPTpBebfnZn1oV/zwcYkhNBPEBreyB67d4bXPe1x51BilEFKz9g4tz1MLwaVi1r7Q75aERR6ouByYvTiNF3MxyujiykbdXRk5cVgK/TqIlUUFJ6uirMdXPLZmOI/RtLPNZgryp6G9lXnA/mGx+Z4bGREid/CzIilQ= Received: by 10.35.22.17 with SMTP id z17mr3977736pyi; Thu, 17 Aug 2006 10:30:07 -0700 (PDT) Received: by 10.35.67.2 with HTTP; Thu, 17 Aug 2006 10:30:06 -0700 (PDT) Message-ID: <6a56d69c0608171030o4c37ec37k54de2b99b5071c72@mail.gmail.com> Date: Thu, 17 Aug 2006 10:30:07 -0700 From: "Jonathan Herriott" To: "Intron is my alias on the Internet" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <6a56d69c0608162129h9e3e085i4ad1f4034833724f@mail.gmail.com> Cc: freebsd-drivers@freebsd.org Subject: Re: Newbie Question to Device driver writing 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: Thu, 17 Aug 2006 17:30:09 -0000 Intron- Unfortunately, I have nothing specific in mind as all my hardware works on FreeBSD. I've almost come to the point where I'm going to go to Fry's and buy a bunch of stuff and make a simple USB device which may turn on or off a light (actually hook it up to a light in my home) just to get some experience with writing drivers. Overall, I'd really love to do an opengl driver for a graphics card, but I figured before I get into something that complex, I might try something simpler. Any suggestion would be great. I'll look into -hackers@ as I would really like to learn the actual internals of FreeBSD. Jon On 8/17/06, Intron is my alias on the Internet wrote: > Jonathan Herriott wrote: > > > Hi! > > > > I've been interested in learning how to write device drivers for quite > > some time, but I had never had the time to devote to it until now. > > > > I was reading through the FreeBSD architecture handbook and came > > across the example echo character driver. To make sure I understand > > all that's going on, I'm searching though all the header files to > > understand what each thing is such as the cdevsw structure and cdev > > structure. > > > > I've come to the conclusion that the cdev structure is what is used to > > store the information about the actual device I open with make_dev. I > > was wondering if there is a place in which I can find a good > > explanation of the different attributes of the structure. The header > > files don't provide much insight for a newbie, so I was wondering if > > there might be some other location. > > > > On a side note, is there a good irc channel for FreeBSD driver writing > > discussion? > > > > Thanks in advance! > > > > Jon > > _______________________________________________ > > freebsd-drivers@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers > > To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org" > > In my opinion, any hardware driver has two interfaces, one user side > interface and one kernel side interface. > > User side interface is created by make_dev(9). The structure cdevsw > mainly contains a table of operations upon this device (i.e. "method" > in object-oriented model) and permission of the device file node > to be created under /dev/. We are familiar with the operations for > read(2), write(2) and so on, but "strategy", "dump", "kqfilter" and others > are relatively strange to us. > > Kernel side interface is used to access PCI bus, USB and other hardware > resource, and to obtain memory space, shared/exclusive lock and module > management support and other function sets. > > To be honest, you need to hack FreeBSD source code yourself if you > would master FreeBSD kernel really. > > The mailing list -drivers@ lacks discussants. And you may send your > question to -hackers@. > > What driver would you contribute to FreeBSD? > I have interests to contribute something concerning hardware to FreeBSD. > > ------------------------------------------------------------------------ > From Beijing, China > >