Results 1 to 9 of 9
I'm writing a custom serial port char driver, and I'm still not quite sure how to implement one of the extra features I need.
The driver has to be able ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-30-2008 #1Just Joined!
- Join Date
- Sep 2008
- Posts
- 2
Writing into user memory
I'm writing a custom serial port char driver, and I'm still not quite sure how to implement one of the extra features I need.
The driver has to be able to read a certain amount of bytes from the serial port and store them in a file in user-space memory. This must be done on an interrupt routine, and not requested by a user process. The device then functions as a normal char driver, and lets user processes access it through a device. I can think of several hacky ways that this could probably be done, but I think I'm probably missing out on a standard procedure that would be the most efficient way.
Does anyone have any suggestions on the best way to implement the write to user-space memory? I can figure out the rest easily enough myself (ie. the hardware control, driver states, interrupts, etc.)
- 09-30-2008 #2Just Joined!
- Join Date
- Sep 2008
- Posts
- 2
alternatively - Is there a way that my driver could just alert a perpetually-running user process to handle the read, and only allow access to that process for the first little while?
Would this be better or worse...?
- 10-05-2008 #3Just Joined!
- Join Date
- May 2008
- Posts
- 55
how about copy_from_user and copy_to_user function use ?!!
- 10-08-2008 #4Just Joined!
- Join Date
- Sep 2008
- Posts
- 25
...never use copy_from_user and copy_to_user in interrupt context
- 10-09-2008 #5Just Joined!
- Join Date
- May 2008
- Posts
- 55
yeah, because can it sleep ! we do not use it in the inteupt handler but we can use it in driver, isnt it ?
- 10-10-2008 #6Just Joined!
- Join Date
- Sep 2008
- Posts
- 25
... approved
- 10-10-2008 #7Just Joined!
- Join Date
- May 2008
- Posts
- 55
Hi ndlevel,
can you please reply to the thread created by me named "kernel address space" ?
if possible.
- 10-11-2008 #8Just Joined!
- Join Date
- Oct 2008
- Posts
- 3
Use softirq/tasklet, and in the bottom half, do the copy_to_user.
- 10-12-2008 #9Just Joined!
- Join Date
- May 2008
- Posts
- 55
and how about get_user_pages !! ?


Reply With Quote
