How to write drivers?

2008-05-01 Thread Sviatoslav Chagaev
Hello! I need to write a driver for a primitive device which connects to the LPT port, so I was wondering, are there any manuals/tutorials/HOWTOs/... on this subject? I could probably just read the source code of OpenBSD and learn from there, but I'm a beginner programmer, so this probably

Re: How to write drivers?

2008-05-01 Thread Jonathan Schleifer
Sviatoslav Chagaev [EMAIL PROTECTED] wrote: I need to write a driver for a primitive device which connects to the LPT port, so I was wondering, are there any manuals/tutorials/HOWTOs/... on this subject? You don't even need a driver in the kernel for that, you can just access the lpt device

Re: How to write drivers?

2008-05-01 Thread Bret Lambert
On Thu, 2008-05-01 at 20:15 +0300, Sviatoslav Chagaev wrote: Hello! I need to write a driver for a primitive device which connects to the LPT port, so I was wondering, are there any manuals/tutorials/HOWTOs/... on this subject? I could probably just read the source code of OpenBSD and

Re: How to write drivers?

2008-05-01 Thread Sviatoslav Chagaev
Yes, I even wrote a program which talks with the device directly, with the help of inb()/outb(). But now I want to learn how to write drivers =) On Thu, 1 May 2008 19:22:10 +0200 Jonathan Schleifer [EMAIL PROTECTED] wrote: Sviatoslav Chagaev [EMAIL PROTECTED] wrote: I need to write

Re: How to write drivers?

2008-05-01 Thread Sviatoslav Chagaev
Thanks! On Thu, 01 May 2008 13:33:18 -0400 Bret Lambert [EMAIL PROTECTED] wrote: On Thu, 2008-05-01 at 20:15 +0300, Sviatoslav Chagaev wrote: Hello! I need to write a driver for a primitive device which connects to the LPT port, so I was wondering, are there any

Re: How to write drivers?

2008-05-01 Thread Jonathan Schleifer
Sviatoslav Chagaev [EMAIL PROTECTED] wrote: Yes, I even wrote a program which talks with the device directly, with the help of inb()/outb(). I doubt you could use inb/outb in OpenBSD. The kernel will prevent that. Just talk with the device in /dev directly - there is really no need to write a

Re: How to write drivers?

2008-05-01 Thread Sviatoslav Chagaev
Yes, by default these are blocked. But there are two ways in which you can gain access to I/O ports: 1) Enable access to all I/O ports for all processes with i386_iopl(2) 2) Enable access to individual I/O ports for the current process with i386_set_ioperm(2) Both calls must be called with

Re: How to write drivers?

2008-05-01 Thread Predrag Punosevac
Sviatoslav Chagaev wrote: Yes, I even wrote a program which talks with the device directly, with the help of inb()/outb(). But now I want to learn how to write drivers =) http://www.netbsd.org/docs/kernel/ddwg.html On Thu, 1 May 2008 19:22:10 +0200 Jonathan Schleifer [EMAIL PROTECTED

Re: How to write drivers?

2008-05-01 Thread Sviatoslav Chagaev
Thanks! On Thu, 01 May 2008 11:57:02 -0700 Predrag Punosevac [EMAIL PROTECTED] wrote: Sviatoslav Chagaev wrote: Yes, I even wrote a program which talks with the device directly, with the help of inb()/outb(). But now I want to learn how to write drivers =) http://www.netbsd.org

Re: How to write drivers?

2008-05-01 Thread Marco Peereboom
On Thu, May 01, 2008 at 08:00:38PM +0200, Jonathan Schleifer wrote: Sviatoslav Chagaev [EMAIL PROTECTED] wrote: Yes, I even wrote a program which talks with the device directly, with the help of inb()/outb(). I doubt you could use inb/outb in OpenBSD. The kernel will prevent that. Just