Changeset d2ff24c2 in rtems for cpukit/libi2c/libi2c.h


Ignore:
Timestamp:
Nov 21, 2007, 6:20:49 AM (12 years ago)
Author:
Till Straumann <strauman@…>
Branches:
4.10, 4.11, 4.9, master
Children:
d371a97
Parents:
381a2f18
Message:

2007-11-17 Till Straumann <strauman@…>

  • libi2c/libi2c.c, libi2c/libi2c.h, libi2c/README_libi2c: Added checks so that use of 'stdio' is avoided (falling back to 'printk') before the system is up. Publish driver entry points so that the libi2c driver could be added to the applications 'device driver table'. This is not fully implemented yet, though, since in addition to initializing libi2c the low-level i2c bus drivers as well as high-level i2c device drivers need to be registered with the library. Updated README_libi2c accordingly.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libi2c/libi2c.h

    r381a2f18 rd2ff24c2  
    6060/* Initialize the libary - may fail if no semaphore or no driver slot is available */
    6161int rtems_libi2c_initialize ();
     62
     63/* Alternatively to rtems_libi2c_initialize() the library can also be
     64 * initialized by means of a traditional driver table entry containing
     65 * the following entry points:
     66 */
     67rtems_status_code
     68rtems_i2c_init (
     69        rtems_device_major_number major,
     70        rtems_device_minor_number minor,
     71    void *arg);
     72
     73rtems_status_code
     74rtems_i2c_open (
     75        rtems_device_major_number major,
     76        rtems_device_minor_number minor,
     77    void *arg);
     78
     79rtems_status_code
     80rtems_i2c_close (
     81        rtems_device_major_number major,
     82        rtems_device_minor_number minor,
     83    void *arg);
     84
     85rtems_status_code
     86rtems_i2c_read (
     87        rtems_device_major_number major,
     88        rtems_device_minor_number minor,
     89    void *arg);
     90
     91rtems_status_code
     92rtems_i2c_write (
     93        rtems_device_major_number major,
     94        rtems_device_minor_number minor,
     95    void *arg);
     96
     97rtems_status_code
     98rtems_i2c_ioctl (
     99        rtems_device_major_number major,
     100        rtems_device_minor_number minor,
     101    void *arg);
     102
     103extern rtems_driver_address_table rtems_libi2c_io_ops;
     104
     105/* Unfortunately, if you want to add this driver to
     106 * a RTEMS configuration table then you need all the
     107 * members explicitly :-( (Device_driver_table should
     108 * hold pointers to rtems_driver_address_tables rather
     109 * than full structs).
     110 *
     111 * The difficulty is that adding this driver to the
     112 * configuration table is not enough; you still need
     113 * to populate the framework with low-level bus-driver(s)
     114 * and high-level drivers and/or device-files...
     115 *
     116 * Currently the preferred way is having the BSP
     117 * call 'rtems_libi2c_initialize' followed by
     118 * 'rtems_libi2c_register_bus' and
     119 * 'rtems_libi2c_register_drv' and/or
     120 * 'mknod' (for 'raw' device nodes)
     121 * from the 'pretasking_hook'.
     122 */
     123#define RTEMS_LIBI2C_DRIVER_TABLE_ENTRY   \
     124{                                         \
     125  initialization_entry:  rtems_i2c_init,  \
     126  open_entry:            rtems_i2c_open,  \
     127  close_entry:           rtems_i2c_close, \
     128  read_entry:            rtems_i2c_read,  \
     129  write_entry:           rtems_i2c_write, \
     130  control_entry:         rtems_i2c_ioctl, \
     131}
    62132
    63133/* Bus Driver API
Note: See TracChangeset for help on using the changeset viewer.