Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 May 2001 18:45:18 +0200
From:      Gary Jennejohn <garyj@jennejohn.org>
To:        robert@mpe.mpg.de, Robert Suetterlin <sutter@robert2.mpe-garching.mpg.de>, freebsd-hackers@freebsd.org
Subject:   Re: Q: porting a driver from linux to freebsd.
Message-ID:  <01050318451803.00815@peedub.muc.de>
In-Reply-To: <200105031453.f43ErXS31356@robert2.mpe-garching.mpg.de>
References:  <200105031453.f43ErXS31356@robert2.mpe-garching.mpg.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 03 May 2001 16:53, Robert Suetterlin wrote:
> Hello!
>
> I asked this already on freebsd-questions and was suggested to ask on this
> list, too.
>
> 	I have a linux driver for a video grabber card (dfg/bw1 from 'the imaging
> source').  This card does not use a well bt848 or similar chip.  I would
> like to transfer this driver to freebsd.
>
[snip]
> Under Linux the driver is just an empty shell that links into the kernel,
> then allocates some memory and provides rather general access to the
> pci-bus and the allocated memory using ioctl and mmap. There is a
> 'lowlevel' library that translates the ioctl and mmap calls to a struct
> based API. This API is then used by a binary only library to do all the
> work.  I.e. find the hardware on the pci-bus.  Read and write the device
> memory.  Transfer data to main memory.  Set grabbing specifics, etc.
>
[snip]
> My question:  If you (as very experienced driver / kernel programmer) would
> face this task.  And if You were not allowed to question /sidestep the task
> itself.  Haw would You implement this under Freebsd? I even do not know
> enough keywords to ask more specific.  I could ask: Would You do a pseudo
> device?  But I do not know if this could be done by a pseudeo device.  Etc.
> ...

I suspect that this thing uses libpci under Linux, which allows one to do all 
the nasty stuff in userland which is normally done in the probe and attach 
routines in the kernel. AFAIK libpci is very general und should work under 
FreeBSD too.

However, if libpci does not work (I've never tried to use it with FreeBSD), 
then there's probably no way around writing a driver which at least does the 
basic probe/attach stuff to get the card mapped into the kernel. Beyond that 
you can probably get away with just providing mmap/ioctl support a la Linux.

I personally would write a full-fledged driver. I don't think that this is 
something for which a pseudo-device is appropriate.

I see that you're in Garching. I live in Munich and could maybe give you 
some help. Look me up in the phonebook, my name is unique.

-- 
Gary Jennejohn garyj@jennejohn.org gj@freebsd.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?01050318451803.00815>