Re: FreeBSD DRIVER DEVELOPMENT

2003-12-02 Thread rk47
 
> As with every device driver, the recommended (or at least proved)
> way is to take an existing, simple driver, and modify it to suit
> your needs.
The simplest driver is probably the puc (sys/dev/pci/puc.c) driver, it has a
lot of the elements that a driver can have.

> Kernel interfaces are documented in intro(9) and related section 9
> man pages (ls /usr/share/man/man9)
Some (one that I can think of) of the kernel interfaces are not given here.
The interface to the dma services (bus_dma) you can find at :
http://www.openbsd.org/cgi-bin/man.cgi

> http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/pci.html)
> 
You can also look at the ISA section, because of the NEWBUS architecture an
ISA driver is very similar to a PCI driver in many ways, e.g. allocating
bus resources, setting up interupt handlers etc. 

A few articles on www.daemonnews.org can also help:
NEWBUS intro (helped me a lot):
http://www.daemonnews.org/27/newbus-intro.html
KLD (loadable modules) :
http://www.daemonnews.org/200010/blueprints.html

Good Luck
Riaan



___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: FreeBSD DRIVER DEVELOPMENT

2003-12-02 Thread Cordula's Web
> > Dear Sir/Madam,
> > 
> > I have requirement to develop driver for the PCI based hardware interface
> > using FreeBSD Unix system. Would you please advise on the following:-
> > 
> > 1)What tools are available to develop driver for x86 machine using C?

Most drivers in FreeBSD are written in C. They are compiled by gcc
(2.95.4 in -STABLE, 3.x in -CURRENT), just like any other part of
the system sources (see: /usr/src).

> > 2)Suitable package including the operating system, tools and books etc?
> 
> Checking out the documentation on freebsd.org would probally be a good start.

Checking out some sample driver sources would be even better :)
For -STABLE (RELENG_4), [PCI-]drivers are located in the kernel source
tree, here:

  /usr/src/sys/pci (PCI drivers)
  /usr/src/sys/dev (mixed ISA and PCI drivers)

Reading the man page pci(4) [man 4 pci] won't hurt either.

As with every device driver, the recommended (or at least proved)
way is to take an existing, simple driver, and modify it to suit
your needs.

Kernel interfaces are documented in intro(9) and related section 9
man pages (ls /usr/share/man/man9)

A good introduction on writing device drivers for FreeBSD is in the
Documentation. Among others:

  * Developers' Handbook:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/index.html

  * FreeBSD Architecture Handbook (esp. Section II: Device Drivers):
http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/index.html

(You may want to play with a KLD module, which exercises the PCI API:
 http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/pci.html)

  * PCI Special Interest Group (specs etc... for PCI bus)
http://www.pcisig.com/   esp. this:
http://www.pcisig.com/specifications/conventional

> > 3)Can the driver developed for other unix operating system e.g. VxWorks
> > can be imported into the FreeBSD and compiled without major code change?
> 
> AFAIK this is something that is not really possible on any operating system.
> This is becuase changes to what header files and need to be made and ect. As to
> the extent of what changes are required, I guess that varies from what it is and
> whatever... but I never messed with this befor so I have no clue...

A device driver is always part of the kernel program. It runs in the
same address space as the kernel, and must interact with both the
kernel and the hardware in a very specific manner. A driver will
e.g. need to call some kernel functions to report data, or send
notifications. Or it may register a timer, etc... These kernel
functions (in FreeBSD, look at directory /usr/share/man/man9) differ
from OS to OS. FreeBSD's functions are completely different to, say,
Linux' functions or Win32s/Windows API calls. That's a reason why
writing device drivers is completely dependant upon a specific kernel.

Ah, and don't forget to use a development machine. Coding mistakes
in device drivers WILL almost always panic(9) the kernel, and under
unlucky circumstances trash the filesystem with it! [Same under Linux
or any other OS]

Good luck and happy hacking!

-- 
Cordula's Web. http://www.cordula.ws/

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: FreeBSD DRIVER DEVELOPMENT

2003-12-02 Thread kitsune
On Mon, 1 Dec 2003 18:04:16 -
"Admin" <[EMAIL PROTECTED]> wrote:

> Dear Sir/Madam,
> 
> I have requirement to develop driver for the PCI based hardware interface
> using FreeBSD Unix system. Would you please advise on the following:-
> 
> 1)What tools are available to develop driver for x86 machine using C?

FreeBSD 4stable uses GCC 2.94.4 There are lots of good IDEs and tools in the
ports trees...

http://www.freebsd.org/ports/index.html
 
> 2)Suitable package including the operating system, tools and books etc?

Checking out the documentation on freebsd.org would probally be a good start.

> 3)Can the driver developed for other unix operating system e.g. VxWorks
> can be imported into the FreeBSD and compiled without major code change?

AFAIK this is something that is not really possible on any operating system.
This is becuase changes to what header files and need to be made and ect. As to
the extent of what changes are required, I guess that varies from what it is and
whatever... but I never messed with this befor so I have no clue...
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: FreeBSD DRIVER DEVELOPMENT

2003-12-02 Thread Simon Barner
> >>I have requirement to develop driver for the PCI based hardware 
> >>interface using FreeBSD Unix system. Would you please advise on the 
> >>following:-
> >>
> >>1)What tools are available to develop driver for x86 machine using 
> >>C?
> >>
> >>2)Suitable package including the operating system, tools and books 
> >>etc?

A good start are the books available at, esp. the Developer's Handbook
and the Architecture Handbook.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/

In both of them you will find the following reference in the
bibliography:

   Marshall Kirk McKusick, Keith Bostic, Michael J Karels, and
   John S Quarterman, 1996, 0-201-54979-4, Addison-Wesley Publishing
   Company, Inc., The Design and Implementation of the 4.4 BSD
   Operating System, 1-2.
   
Simon


signature.asc
Description: Digital signature


FreeBSD DRIVER DEVELOPMENT

2003-12-02 Thread Admin
Dear Sir/Madam,

I have requirement to develop driver for the PCI based hardware interface using 
FreeBSD Unix system. Would you please advise on the following:-

1)What tools are available to develop driver for x86 machine using C?

2)Suitable package including the operating system, tools and books etc?

3)Can the driver developed for other unix operating system e.g. VxWorks can be 
imported into the FreeBSD and compiled without major code change?

Please advise a.s.a.p.

Kind Regards

Gurdial Chandra
Sycos AES
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"