Miscellaneous > Programming & Networking

dos.h

(1/5) > >>

TheQuirk:
I need to find a unix equal of outp() (dos.h). I remember reading it in some source code that was designed for BSD, but I don't know what header it used. Until now I used dos.h, but it only works in DOS and windows 9x.

voidmain:
That appears to be an x86 specific instruction. What do you need the function for? Maybe I can help find a way to do what you need.

I see a few places in a couple of drivers in the Linux kernel where it is defined and used. Don't know if it performs the same thing as the DOS version.  For an example look at a couple of these kernel driver files which are a few places I spotted it:

/usr/src/linux/drivers/net/skfp/h/types.h
/usr/src/linux/drivers/net/skfp/h/skfbi.h

[ July 31, 2002: Message edited by: VoidMain ]

TheQuirk:
I need that function so I could control some electronics.

It's just for an after school experiment to see if  I could do something intresting with my computer and, well, home made elecronic devices   .

Here's a fast example: (if you run it in dos and hook up an oscilloscope to the second hole in your parallel port, you'll see a pattern that looks like this: _-_-_-)


--- Code: ---
--- End code ---

voidmain:
Take a look at this:

http://www.hut.fi/Misc/Electronics/circuits/parallel_output.html

There is a Linux example in it. ioperm() and outb() are your functions.

[ July 31, 2002: Message edited by: VoidMain ]

voidmain:
I just rewrote your code for x86 Linux:


--- Code: ---
--- End code ---

I put the code in a file called "scope.c" and to compile it I use the command:

gcc -lm -O scope.c -o scope

Then you will either have to run it as "root" or set the owner of the program to "root" and set the SUID bit.

Also, in your calculation "u=255*(1+pow(-1,i))/2" you had an "l" (lower case "L") before the plus sign.  I assume that was a typo and should have been a "1" (one) so I changed it. I can think of much easier ways to alternate between 1 and 255 though, and it wouldn't require the math library.     Also, instead of the "delay(1000)" I used "sleep(1)".

I just tested it on my Linux laptop with a multimeter and it works just fine...

[ August 01, 2002: Message edited by: VoidMain ]

Navigation

[0] Message Index

[#] Next page

Go to full version