From owner-freebsd-hackers Sat Dec 23 01:34:47 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id BAA28627 for hackers-outgoing; Sat, 23 Dec 1995 01:34:47 -0800 (PST) Received: from hda.com (hda.com [199.232.40.182]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id BAA28609 for ; Sat, 23 Dec 1995 01:34:42 -0800 (PST) Received: (from dufault@localhost) by hda.com (8.6.11/8.6.9) id EAA02713; Sat, 23 Dec 1995 04:44:42 -0500 From: Peter Dufault Message-Id: <199512230944.EAA02713@hda.com> Subject: Re: Help with lkm's please To: terry@lambert.org (Terry Lambert) Date: Sat, 23 Dec 1995 04:44:42 -0500 (EST) Cc: pc012@svcc.seqeb.gov.au, hackers@FreeBSD.org In-Reply-To: <199512230711.AAA21580@phaeton.artisoft.com> from "Terry Lambert" at Dec 23, 95 00:11:05 am X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-hackers@FreeBSD.org Precedence: bulk > > > I am writing an lkm device driver for a digital IO board. I have worked > > out how to move bytes from the user space to the kernel space but not > > vice-versa. Can anyone give me any clues on how I move data from the > > kernel space to the user space. Do I use the uiomove() function, if so how. > > Are you using uio structures in all cases? If you are not required to, > it would probably be simpler (and faster) to call copyin/copyout directly > if you know the source/destination to be in user space and the > destination/source to be in system space (if they are both in system space, > use bcopy instead). > > Look at the uiomove source in /sys/kern/kern_subr.c. ... Or use a strategy function and go through physio. The labpc driver does digital I/O to and from the board's digital port. That part of the driver is just a quick hack that copies all the bytes directly to the port. Look at "digital_in_strategy" and "digital_out_strategy". For something interrupt driven look at ad_strategy. -- Peter Dufault Real Time Machine Control and Simulation HD Associates, Inc. Voice: 508 433 6936 dufault@hda.com Fax: 508 433 5267