Find the answer to your Linux question:
Results 1 to 5 of 5
Hi, sorry if the question seems trivial for some of you, it is not for me. Here is my problem : the linux i use (embedded linux 2.4.27 for arm) ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2005
    Posts
    3

    accessing a driver


    Hi,

    sorry if the question seems trivial for some of you, it is not for me. Here is my problem :
    the linux i use (embedded linux 2.4.27 for arm) has a driver for the spi bus that exports three functions (you can see them in the /proc/ksyms) which i want to access. It is obviously possible to do that by writing a module and then loading it in the kernel. But how can i access them from the user space ?

    Thanks in advance for any help !

    bye

    Thomas

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    which functions are they? Certain userspace functions ultimately end up invoking a set of standard kernelspace functions.

  3. #3
    Just Joined!
    Join Date
    May 2005
    Posts
    3
    The functions are :
    - spi_access
    - spi_transfer
    - spi_release

    They are really hardware specific (when you look into the code) and the problem is : which user space instruction would call these kernel space functions ?

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    They would probably be covered by open(), read()/write(), and close(), depending on how the driver was written.
    Let's say that the device structure was called "spi". If spi's open was set to spi_access(), then the open() system call would call spi_access().
    Catch my drift?

  6. #5
    Just Joined!
    Join Date
    May 2005
    Posts
    3
    Hi,

    Ok, i understand now that the driver should implement the system calls that would make the link between the open(), ... syscalls and the spi_access, ... functions. But here is my misfortune : it doesn't. There is no implementation of any system calls in the code.

    So here is what i am thinking at this point :
    - do you think it would be a good solution to write my own module that would implement the system calls ?
    - i still don't understand how this "driver" works : it seems to be registered as a classic driver (major number 153, as a good spi driver should be) with it's entry in /dev, but i don't get where and when this is done
    - i know my question must seem quite clumbsy : sorry, i'm a kind of newcomer to linux !

    Thanks in advance if you can help me, and thanks anyway for pointing me the system call mecanism.

    Thomas

Posting Permissions

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