linux kernel - Accessing Platform Device from Userpace -


from general standpoint, trying figure out how access platform device userspace. more specific, have emif controller on , soc of have added device tree , believe correctly bound pre-written emif platform device driver. trying figure out how can access emif device userspace application. have come accross couple different topics seem have connection issue cannot quite find out how relate.

1) read seems i/o done through use of device nodes created mknod(), need create device node in order access device?

2) have read couple threads talk writting kernel module (character?, block?) can interface both userspace , platform device driver, , use intermediary.

3) have read possibility of using mmap() map memory of platform device virtual memory space. possible?

4) seems when emif driver instantiated, calls probe() fucntion. functions userpace application call in driver?

it's not clear you're needing (and should caveat have no experience emif or "platform devices" specifically), here's overview started:

  1. yes, usual way of providing access device via device node. access provided character device driver unless there's more specific way of providing it. of time if application talking "directly" driver, it's character device. other types of devices used in interfacing other kernel subsystems: example, block device typically used provide access file system driver (say) underlying disk drive; network driver provides access network in-kernel tcp/ip stack, etc.

    there several char device methods or entry points can supported driver, common "read" (i.e. if user-space program opens device , read(2) it), "write" (analogous write(2)) , "ioctl" (often used configuration/administrative tasks don't fall naturally either read or write). note mknod(2) creates user-space side of device. there needs corresponding device driver in kernel (the "major device number" given in mknod call links user-space node driver).

    for creating device node in file system, can automated (i.e. node automatically show in /dev) if call right kernel functions while setting device. there's special daemon gets notifications kernel , responds executing mknod(2) system call.

  2. a kernel module merely dynamically loadable way of creating driver or other kernel extension. can create character, block or network device (et al.), can statically linked module. there differences in capability because not kernel functions might want use "exported" (i.e. visible to) dynamically loaded modules.

  3. it's possible support mapping of device memory user virtual memory space. implemented yet driver entry point (mmap). see struct file_operations entry points char driver can support.

  4. this pretty you: depends on application needs able do. there many drivers in kernel provide no direct function user-space, other kernel code. "probe", there many probe functions defined in various interfaces. in cases, these called kernel (or perhaps 'higher level "class" driver') allow specific driver discover, identify , "claim" individual devices. (probe functions) don't have directly providing access user-space might missing in particular interface.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -