From owner-freebsd-drivers@FreeBSD.ORG Wed Oct 12 21:04:15 2005 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 D613516A422 for ; Wed, 12 Oct 2005 21:04:15 +0000 (GMT) (envelope-from michael@endace.com) Received: from www.endace.com (endace.smrn.com [209.234.97.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4749743D64 for ; Wed, 12 Oct 2005 21:04:13 +0000 (GMT) (envelope-from michael@endace.com) Received: from et.endace.com (203-97-51-114.dsl.clear.net.nz [203.97.51.114]) by www.endace.com (8.13.4/8.12.10) with ESMTP id j9CL4Djf041952 for ; Wed, 12 Oct 2005 14:04:13 -0700 (PDT) Received: from [192.168.64.174] (nemausa.et.endace.com [192.168.64.174]) by et.endace.com (8.13.4/8.12.11) with ESMTP id j9CL47UL015419 for ; Thu, 13 Oct 2005 10:04:07 +1300 (NZDT) Message-ID: <434D7A42.1080005@endace.com> Date: Thu, 13 Oct 2005 10:04:02 +1300 From: Michael Honeyfield User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-drivers@freebsd.org References: <434983A6.8040403@endace.com> <200510121532.54474.jhb@freebsd.org> In-Reply-To: <200510121532.54474.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamd / ClamAV version devel-20040621, clamav-milter version 0.72a on www.endace.com X-Virus-Status: Clean Subject: Re: reference drivers 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: Wed, 12 Oct 2005 21:04:16 -0000 John Baldwin wrote: >On Sunday 09 October 2005 04:55 pm, Michael Honeyfield wrote: > > >>Hello all, >> >>I have been working on a small project that involes writting a drver for >>FreeBSD. I have used this link as my reference for my driver: >> >>http://www.ben.com/minipci/driver.php >> >>Now, after my modifications, I can load the kernel module fine. However, >>the mmap function is not even called. Is the mmap function used inside >>this diver the correct way map registers from kernel space to user space? >> >> > >Yes. It should be called when an application does an mmap() on an fd returned >by open()'ing the file in /dev. > > > Ok, good to know I am on the right path. Where is a good place to look if the foo_mmap() is not actually called? I use this routine as a test for mapping a register into user space: fd = open( "/dev/bar0", O_RDWR ); reg = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if( reg == MAP_FAILED) { fprintf( stderr, "can't mmap bar!\n" ); exit(1); } the code takes an arg, and the register I am selecting is there. The above code snippet works on Linux. Cheers -- Michael Honeyfield TECHNICAL SUPPORT ____________________________________________________ Endace Technology michael@endace.com http://www.endace.com