diff options
| author | Wolfram Schneider <wosch@FreeBSD.org> | 1997-10-03 20:53:38 +0000 |
|---|---|---|
| committer | Wolfram Schneider <wosch@FreeBSD.org> | 1997-10-03 20:53:38 +0000 |
| commit | bea9d4e38c5eebb1471e71a81f91acd6d6487bb4 (patch) | |
| tree | 32057a4d3f65058c1d4cfc2a02afbf2bcb5e5102 /en/tutorials | |
| parent | e46f484ad4a67674a4b95790fcd69dfbd05544b7 (diff) | |
Notes
Diffstat (limited to 'en/tutorials')
| -rw-r--r-- | en/tutorials/ddwg/ddwg.sgml | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/en/tutorials/ddwg/ddwg.sgml b/en/tutorials/ddwg/ddwg.sgml index 41cbbafa64..9cb25739aa 100644 --- a/en/tutorials/ddwg/ddwg.sgml +++ b/en/tutorials/ddwg/ddwg.sgml @@ -6,7 +6,7 @@ ++ ++ Copyright Eric L. Hernes - Wednesday, August 2, 1995 ++ - ++ $Id: ddwg.sgml,v 1.3 1996-12-28 23:36:51 mpp Exp $ + ++ $Id: ddwg.sgml,v 1.4 1997-10-03 20:53:38 wosch Exp $ ++ ++ Sgml doc for something --> @@ -58,7 +58,8 @@ device opened. These are available through the macros <tt/major()/ and <tt/minor()/ <p> -The <tt/flag/ and <tt/mode/ arguments are as described in the open(2) +The <tt/flag/ and <tt/mode/ arguments are as described in the +<htmlurl url="http://www.freebsd.org/cgi/man.cgi?open(2)" name="open(2)"> manual page. It is recommended that you check these for access modes in <sys/fcntl.h> and do what is required. For example if <tt/flag/ is (O_NONBLOCK | O_EXLOCK) the open should fail if either it would @@ -106,8 +107,10 @@ int d_write(dev_t dev, struct uio *uio, int flat) </code> -The d_read() and d_write() entry points are called when read(2) and -write(2) are called on your device from user-space. The transfer +The d_read() and d_write() entry points are called when +<htmlurl url="http://www.freebsd.org/cgi/man.cgi?read(2)" name="read(2)"> and +<htmlurl url="http://www.freebsd.org/cgi/man.cgi?write(2)" name="write(2)"> +are called on your device from user-space. The transfer of data can be handled through the kernel support routine uiomove(). <sect3> d_ioctl() @@ -120,7 +123,9 @@ d_ioctl(dev_t dev, int cmd, caddr_t arg, int flag, struct proc *p) d_ioctl() is a catch-all for operations which don't make sense in a read/write paradigm. Probably the most famous of all ioctl's is on -tty devices, through stty(1). The ioctl entry point is called from +tty devices, through +<htmlurl url="http://www.freebsd.org/cgi/man.cgi?stty(1)" name="stty(1)">. +The ioctl entry point is called from ioctl() in sys/kern/sys_generic.c<p> There are four different types of ioctl's which can be implemented. @@ -228,7 +233,8 @@ scatter-gather io via the readv() and writev() system calls. <sect3> <tt/struct isa_device/ Structure <p> -This structure is required, but generally it is created by config(8) +This structure is required, but generally it is created by +<htmlurl url="http://www.freebsd.org/cgi/man.cgi?config(8)" name="config(8)"> from the kernel configuration file. It is required on a per-device basis, meaning that if you have a driver which controls two serial boards, you will have two isa_device structures. If you build a @@ -281,7 +287,8 @@ initialize your device. The <tt/probe/ member is a pointer to your device probe function; the <tt/attach/ member is a pointer to your attach function. The <tt/name/ member is a character pointer to the two or three letter name for your driver. This is the name reported -during the probe/attach process (and probably also in lsdev(8)). The +during the probe/attach process (and probably also in +<htmlurl url="http://www.freebsd.org/cgi/man.cgi?lsdev(8)" name="lsdev(8)">). The <tt/sensitive_hw/ member is a flag which helps the probe code determine probing order. @@ -422,7 +429,8 @@ public device register declarations, macros, and other driver specific declarations. Some drivers call this devvar.h instead. Some drivers, such as the dgb (for the Digiboard PC/Xe), require microcode to be loaded onto the board. For the dgb driver -the microcode is compiled and dumped into a header file ala file2c(1). +the microcode is compiled and dumped into a header file ala +<htmlurl url="http://www.freebsd.org/cgi/man.cgi?file2c(1)" name="file2c(1)">. <p> If the driver has data structures and ioctl's which are specific to @@ -455,7 +463,8 @@ The steps required to add your driver to the standard FreeBSD kernel are <item> Add to the driver list <item> Add an entry to the [bc]devsw <item> Add the driver entry to the kernel config file -<item> config(8), compile, and install the kernel +<item> <htmlurl url="http://www.freebsd.org/cgi/man.cgi?config(8)" name="config(8)">, +compile, and install the kernel <item> make required nodes. <item> reboot. </itemize> @@ -476,7 +485,9 @@ The first field is the pathname of the driver module relative to /usr/src/sys. For the case of a binary driver the path would be something like ``i386/OBJ/joy.o''. -The second field tells config(8) that this is an optional driver. Some +The second field tells +<htmlurl url="http://www.freebsd.org/cgi/man.cgi?config(8)" name="config(8)"> +that this is an optional driver. Some devices are required for the kernel to even be built. The third field is the name of the device. @@ -512,7 +523,8 @@ d_ioctl_t joyioctl; This either defines your entry points, or null entry points which will return ENXIO when called (the #else clause). -The include file ``joy.h'' is automatically generated by config(8) when +The include file ``joy.h'' is automatically generated by +<htmlurl url="http://www.freebsd.org/cgi/man.cgi?config(8)" name="config(8)"> when the kernel build tree is created. This usually has only one line like: <code> #define NJOY 1 @@ -569,7 +581,8 @@ the network class. It uses interrupt 10. It uses 32k of shared memory at physical address 0xd0000. It also defines it's interrupt handler to be ``ixintr()'' -<sect2>config(8) the kernel. +<sect2><htmlurl url="http://www.freebsd.org/cgi/man.cgi?config(8)" name="config(8)"> +the kernel. <p> Now with our config file in hand, we can create a kernel compile directory. This is done by simply typing: @@ -632,7 +645,8 @@ Lines 17 - 26 -- This includes the file ``pca.h'' and conditionally compiles the rest of the LKM on whether or not we have a pcaudio device defined. This -mimics the behavior of config. In a standard device driver, config(8) +mimics the behavior of config. In a standard device driver, +<htmlurl url="http://www.freebsd.org/cgi/man.cgi?config(8)" name="config(8)"> generates the pca.h file from the number pca devices in the config file. <code> 17 /* |
