ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

linux Drivers Weeder I/O Boards


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

LINUX DRIVES WEEDER I/O BOARDS

Applications
by Jack Dennon

Start ý Create the Device Driver ý Create the Device ý The Order of Things ý Load the Device Driver ý Call the Test Program ý Remove the Device Driver ý Sources and PDF

LOAD THE DEVICE DRIVER

To load the device driver into the kernel, you need to log in as root again, then use the command insmod wtdio2_0 to load the device driver into the kernel. After you exit the root shell, the command cat /proc/modules should now show that your kernel has registered a device driver named wtdio2_0.

The file named wtdio.c hows a program that provides a quick test of the Weeder Technology digital I/O board using your new device driver. Note that the I/O port and IRQ assignments are defined in the lines:

{ "com1", "com_dev", 120, 1, 0x3f8, 4 },
{ "com2", "com_dev", 120, 2, 0x2f8, 3 },

which appear near the top of this file. A standard arrangement is that com1 is at base port 0x3f8 and uses IRQ 4. You will have to modify these lines if your port or IRQ assignments are not the same as these.

Letýs create a pair of small shell scripts to facilitate testing. The first will compile the test program:

#! /bin/bash
gcc -g -o $1 $1.c

Save this script as comp.sh and then mark it executable with the command chmod +x comp.sh.

The second will be used to change the programýs owner to root and mark it "set user ID" (SUID):

chown root $1
chmod +s $1

Save this script as enable.sh and mark it executable with the command chmod +x enable.sh.

Compile your test program with the command comp.sh wtdio. Log in as root again, execute the command ./enable.sh wtdio, and then exit the root shell.

PREVIOUS NEXT


Circuit Cellar provides up-to-date information for engineers. Visit www.circuitcellar.com for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com or subscribe online. ýCircuit Cellar, the Magazine for Computer Applications. Posted with permission.
 
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ