[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BOUNCE rtl@rtlinux.org: Approval required: (fwd)



>From owner-rtl Fri Aug 10 08:59:54 2001
Received: from mail.space2u.com (sendmail@mail.space2u.com [62.20.1.135])
	by hq.fsmlabs.com (8.11.2/8.11.2) with ESMTP id f7AExrs14336
	for <rtl@fsmlabs.com>; Fri, 10 Aug 2001 08:59:53 -0600
Received: from cutangle.admeo.se ([212.162.175.15])
	by mail.space2u.com (8.11.4/8.11.4) with SMTP id f7AF25Q21908
	for <rtl@fsmlabs.com>; Fri, 10 Aug 2001 17:02:05 +0200
Content-Type: text/plain;
  charset="iso-8859-1"
From: David Olofson <david.olofson@reologica.se>
Reply-To: david.olofson@reologica.se
Organization: Reologica Instruments AB
To: rtl@fsmlabs.com
Subject: Re: [rtl] FW: Device driver in rtlinux
Date: Fri, 10 Aug 2001 17:00:15 +0200
X-Mailer: KMail [version 1.2]
References: <Pine.LNX.4.33L2.0108100912200.4099-100000@ajvar.ajvar.org>
In-Reply-To: <Pine.LNX.4.33L2.0108100912200.4099-100000@ajvar.ajvar.org>
MIME-Version: 1.0
Message-Id: <0108101700150M.30055@cutangle.admeo.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by hq.fsmlabs.com id f7AExss14338

On Friday 10 August 2001 15:14, Calin Culianu wrote:
> On Wed, 8 Aug 2001, yeshayahu, Liat wrote:
> > > Hi,
> > > I'm using RTLinux 2.2.18 ,
> > > I wrote a device driver for device called pctio10 which is sitting
> > > on isa bus on address 1a0.(the device has counters mechanism that
> > > can create interupts to isa bus ).
> > > using the book "linux device driver" I'm trying to pass parameter
> > > from user application, simple c program to my device ( which is in
> > > kernel module).
> > > In the user application I'm using :
> > > the open function to get file descriptor , which I use for the
> > > read/write functions.
> > > I can see by dmesg and debug prints that I'm getting into to the
> > > appropriate function
> > > in my device module.
> > > the problem is that I can't pass void *buf, size_t nbyte  
> > > parameters in read and write functions
> > >   ssize_t write(int fildes, const void *buf, size_t nbyte);
> > >   ssize_t read(int fildes, void *buf, size_t nbyte);
> > > from user application  to the appropriate functions in the device
> > > driver code because the information doesn't  seems to beat
> > > the read/write  parameters interface at the read/write function.
> > > later on I attend to use the function copy_to_user, and
> > > copy_from_user. Does anyone know why I can't pass the parameters to
> > > the device driver ?
>
> I am not really well versed with Kernel internals (yet!  I plan on
> exploring them more in depth one day).. but how is that size
> information lost by the read/write functions?  Is it that the
> read/write functions interface with device drivers on different terms?

This seems a bit weird... All there is to it is the usual address space 
thing. The arguments are passed as they are - pointers included - so your 
driver code can do what it wants with them. To touch user space 
addresses, you should use the *_user macros, as the address spaces are 
different, but that's about it...

Did you get the function prototypes right? (Try compiling with -Wall. 
Personally, I always do, and I make sure to get rid of *all* warnings 
right away, even if they seem harmless. Eliminates many kinds of obscure 
bugs...)


//David Olofson --- Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
|      Multimedia Application Integration Architecture      |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------------> http://www.linuxdj.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> david@linuxdj.com -'

----- End of forwarded message from owner-rtl@fsmlabs.com -----