Subject: Driver development question
To: 'port-sparc@netbsd.org' <port-sparc@netbsd.org>
From: Steven Grunza <steven.grunza@dgms.com>
List: port-sparc
Date: 07/01/1999 13:57:54
I've gone through the following steps in order to create a
pseudo-device driver and now I'm stuck. If any one has any ideas, I
would appreciate hearing them....
The driver is called testdata and is based on the test data
pseudo-driver from "Writing Unix Device Drivers" by George Pajari.
Step 1) Modified /sys/conf/files to add the following two lines:
pseudo-device td
file dev/testdata.c td
Step 2) Modified /sys/arch/sparc/conf/{my_machine} to add the
following line:
pseudo-device td
Step 3) Ran config {my_machine} in the /sys/arch/sparc/conf
directory
Step 4) Added the following lines to the appropriate places in
/sys/arch/sparc/sparc/conf.c:
#include "td.h"
cdev_td_init(NTD,td), /* 122: test data pseudo-device */
Step 5) Added the following line to /sys/sys/conf.h:
#define cdev_td_init(c,n) cdev__ocrwip_init(c,n)
Step 6) Created /sys/arch/sparc/compile/{my_machine}/td.h which
contains the following line:
#define NTD 0
Step 7) Created a symlink from {my_directory}/testdata.c to
/sys/dev/testdata.c
Step 8) Changed to the /sys/arch/sparc/compile/{my_machine}
directory and ran make >& make.log
Step 9) Failed at figuring out where I went wrong.
root@hw-ss1# more make.log
cc -g -O2 -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wpointer-arith -Wno-main -mno-fpu -I. -I.
./../../../arch -I../../../.. -nostdinc -DSUN4C -DRASTERCONSOLE -DLKM
-DDIAGNOSTIC -DDEBUG -DMAXUSERS=32 -D_
KERNEL -c ../../../../arch/sparc/sparc/conf.c
../../../../arch/sparc/sparc/conf.c:254: `tdopen' undeclared here
(not in a function)
../../../../arch/sparc/sparc/conf.c:254: initializer element for
`cdevsw[122].d_open' is not constant
../../../../arch/sparc/sparc/conf.c:254: `tdclose' undeclared here
(not in a function)
../../../../arch/sparc/sparc/conf.c:254: initializer element for
`cdevsw[122].d_close' is not constant
../../../../arch/sparc/sparc/conf.c:254: `tdread' undeclared here
(not in a function)
../../../../arch/sparc/sparc/conf.c:254: initializer element for
`cdevsw[122].d_read' is not constant
../../../../arch/sparc/sparc/conf.c:254: `tdwrite' undeclared here
(not in a function)
../../../../arch/sparc/sparc/conf.c:254: initializer element for
`cdevsw[122].d_write' is not constant
../../../../arch/sparc/sparc/conf.c:254: `tdioctl' undeclared here
(not in a function)
../../../../arch/sparc/sparc/conf.c:254: initializer element for
`cdevsw[122].d_ioctl' is not constant
../../../../arch/sparc/sparc/conf.c:254: `tdpoll' undeclared here
(not in a function)
../../../../arch/sparc/sparc/conf.c:254: initializer element for
`cdevsw[122].d_poll' is not constant
*** Error code 1
Stop.
The source code to this "driver" is available if anyone wants it.
This whole exercise is a pre-cursor to doing a real simplistic
driver to talk to a network board.
=======================================================
Steven Grunza Hardware Engineer
------------------------------------------------------------------
--------------------------------------------
mailto:grunza@ulticom.com Ulticom
voice: (856) 787 - 2759 1020 Briggs Road
fax: (856) 866 - 2033 Mt. Laurel, NJ 08054
flames: /dev/null
------------------------------------------------------------------
--------------------------------------------
Unix is user friendly, it's just particular about with whom it makes
friends.