Find the answer to your Linux question:
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.
  1. #1
    Just 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.)

  2. #2
    Just 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...?

  3. #3
    Just Joined!
    Join Date
    May 2008
    Posts
    55
    how about copy_from_user and copy_to_user function use ?!!

  4. #4
    Just Joined!
    Join Date
    Sep 2008
    Posts
    25
    ...never use copy_from_user and copy_to_user in interrupt context

  5. #5
    Just 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 ?

  6. #6
    Just Joined!
    Join Date
    Sep 2008
    Posts
    25
    ... approved

  7. #7
    Just 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.

  8. #8
    Just Joined!
    Join Date
    Oct 2008
    Posts
    3
    Use softirq/tasklet, and in the bottom half, do the copy_to_user.

  9. #9
    Just Joined!
    Join Date
    May 2008
    Posts
    55
    and how about get_user_pages !! ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •