RE: Basic question about device driver

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

 



okay, let me in detail tell you whatever my understanding is:

register_chrdev:
register_chrdev(major, name, fops) - here we specify that this is my device-driver name, the major number for it and fops pointer. (that is the device related functions to read/write.open/close the device).
so whenever kernel sees any device read/write request, it will look for the driver with matching major number and that is how it will select which function to call.

what i want to know is in the drivers read method , we will read data from the device memory and copy it to the buffer in user area. using function copy_to_user( user-buf-pointer, device-data-ptr, count)

where do i get the "device-data-ptr" from?

i'm very sorry if my question is too silly!! 

thanks for ur reply!


> -----Original Message-----
> From: karthick.sundararajan@xxxxxxxxx
> [mailto:karthick.sundararajan@xxxxxxxxx]
> Sent: Thursday, February 17, 2005 11:06 AM
> To: kernelnewbies@xxxxxxxxxxxx; Dhanashri Bhate
> Subject: RE: Basic question about device driver
> 
> 
> 
> Hi Dhanshri,
> 
> Can you be a bit more specific about the question: I am not able to
> understand if you are asking about how register_chrdev works 
> or just the
> usage of register_chrdev.
> 
> Rgds,
> Karthick S.
> 
> 
> -----Original Message-----
> From: kernelnewbies-bounce@xxxxxxxxxxxx
> [mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of 
> Dhanashri Bhate
> Sent: Thursday, February 17, 2005 10:42
> To: kernelnewbies@xxxxxxxxxxxx
> Subject: Basic question about device driver
> 
> 
> hi,
> i know unix fairly well and good at C, but new to the linux 
> environment.
> I'm studying device driver development(kernel space). i'm refering the
> linux device driver book by allessandro rubini.  which is 
> quite good...
> but still i'm having some problems in thoroghly understanding 
> the basic
> concepts!
> 
> someone pls answer this: how exactly a device address comes to the
> driver? ( which will be used by copy-to-user/copy-from-user)
> 
> 
> Thanks,
> Dhanshri
> 
> 
> 
> 
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 
> 
> Confidentiality Notice
> 
> 
> The information contained in this electronic message and any 
> attachments to this message are intended
> for the exclusive use of the addressee(s) and may contain 
> confidential or privileged information. If
> you are not the intended recipient, please notify the sender 
> at Wipro or Mailadmin@xxxxxxxxx immediately
> and destroy all copies of this message and any attachments.
> 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux