Changeset 0893220 in rtems for cpukit/libi2c


Ignore:
Timestamp:
Nov 29, 2009, 12:12:39 PM (10 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.10, 4.11, master
Children:
0a7278e
Parents:
33c3b54d
Message:

Whitespace removal.

Location:
cpukit/libi2c
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libi2c/libi2c.c

    r33c3b54d r0893220  
    33/* libi2c Implementation */
    44
    5 /* 
     5/*
    66 * Authorship
    77 * ----------
     
    99 *     Till Straumann <strauman@slac.stanford.edu>, 2005,
    1010 *         Stanford Linear Accelerator Center, Stanford University.
    11  * 
     11 *
    1212 * Acknowledgement of sponsorship
    1313 * ------------------------------
     
    1515 *     the Stanford Linear Accelerator Center, Stanford University,
    1616 *         under Contract DE-AC03-76SFO0515 with the Department of Energy.
    17  * 
     17 *
    1818 * Government disclaimer of liability
    1919 * ----------------------------------
     
    2424 * disclosed, or represents that its use would not infringe privately owned
    2525 * rights.
    26  * 
     26 *
    2727 * Stanford disclaimer of liability
    2828 * --------------------------------
    2929 * Stanford University makes no representations or warranties, express or
    3030 * implied, nor assumes any liability for the use of this software.
    31  * 
     31 *
    3232 * Stanford disclaimer of copyright
    3333 * --------------------------------
    3434 * Stanford University, owner of the copyright, hereby disclaims its
    3535 * copyright and all other rights in this software.  Hence, anyone may
    36  * freely use it for any purpose without restriction. 
    37  * 
     36 * freely use it for any purpose without restriction.
     37 *
    3838 * Maintenance of notices
    3939 * ----------------------
     
    4444 * software made or distributed by the recipient that contains a copy or
    4545 * derivative of this software.
    46  * 
     46 *
    4747 * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
    48  */ 
     48 */
    4949/*
    50  * adaptations to also handle SPI devices 
     50 * adaptations to also handle SPI devices
    5151 * by Thomas Doerfler, embedded brains GmbH, Puchheim, Germany
    5252 */
     
    358358    return 0;
    359359  }
    360  
     360
    361361  /* rtems_io_register_driver does NOT currently check nor report back
    362362   * the return code of the 'init' operation, so we cannot
     
    535535
    536536int
    537 rtems_libi2c_read_bytes (rtems_device_minor_number minor, 
    538                          unsigned char *bytes, 
     537rtems_libi2c_read_bytes (rtems_device_minor_number minor,
     538                         unsigned char *bytes,
    539539                         int nbytes)
    540540{
     
    552552
    553553int
    554 rtems_libi2c_write_bytes (rtems_device_minor_number minor, 
    555                           const unsigned char *bytes, 
     554rtems_libi2c_write_bytes (rtems_device_minor_number minor,
     555                          const unsigned char *bytes,
    556556                          int nbytes)
    557557{
     
    569569
    570570int
    571 rtems_libi2c_ioctl (rtems_device_minor_number minor, 
     571rtems_libi2c_ioctl (rtems_device_minor_number minor,
    572572                    int cmd,
    573573                    ...)
     
    578578  bool is_started = false;
    579579  DECL_CHECKED_BH (busno, bush, minor, -)
    580    
     580
    581581  va_start(ap, cmd);
    582582  args = va_arg(ap, void *);
     
    584584  switch(cmd) {
    585585    /*
    586      * add ioctls defined for this level here:   
    587      */
    588    
     586     * add ioctls defined for this level here:
     587     */
     588
    589589  case RTEMS_LIBI2C_IOCTL_GET_DRV_T:
    590590    /*
     
    612612     */
    613613    if (sc == 0) {
    614       sc = bush->ops->ioctl 
    615         (bush, 
    616          RTEMS_LIBI2C_IOCTL_SET_TFRMODE, 
     614      sc = bush->ops->ioctl
     615        (bush,
     616         RTEMS_LIBI2C_IOCTL_SET_TFRMODE,
    617617         &((rtems_libi2c_tfm_read_write_t *)args)->tfr_mode);
    618618    }
     
    621621     */
    622622    if (sc == 0) {
    623       sc = bush->ops->ioctl 
    624         (bush, 
    625          RTEMS_LIBI2C_IOCTL_READ_WRITE, 
     623      sc = bush->ops->ioctl
     624        (bush,
     625         RTEMS_LIBI2C_IOCTL_READ_WRITE,
    626626         &((rtems_libi2c_tfm_read_write_t *)args)->rd_wr);
    627627    }
     
    638638
    639639static int
    640 do_s_rw (rtems_device_minor_number minor, 
    641          unsigned char *bytes, 
    642          int nbytes, 
     640do_s_rw (rtems_device_minor_number minor,
     641         unsigned char *bytes,
     642         int nbytes,
    643643         int rw)
    644644{
     
    670670
    671671int
    672 rtems_libi2c_start_read_bytes (rtems_device_minor_number minor, 
     672rtems_libi2c_start_read_bytes (rtems_device_minor_number minor,
    673673                               unsigned char *bytes,
    674674                               int nbytes)
     
    678678
    679679int
    680 rtems_libi2c_start_write_bytes (rtems_device_minor_number minor, 
     680rtems_libi2c_start_write_bytes (rtems_device_minor_number minor,
    681681                                const unsigned char *bytes,
    682682                                int nbytes)
  • cpukit/libi2c/libi2c.h

    r33c3b54d r0893220  
    1111/*$Id$*/
    1212
    13 /* 
     13/*
    1414 * Authorship
    1515 * ----------
     
    1717 *     Till Straumann <strauman@slac.stanford.edu>, 2005,
    1818 *         Stanford Linear Accelerator Center, Stanford University.
    19  * 
     19 *
    2020 * Acknowledgement of sponsorship
    2121 * ------------------------------
     
    2323 *     the Stanford Linear Accelerator Center, Stanford University,
    2424 *         under Contract DE-AC03-76SFO0515 with the Department of Energy.
    25  * 
     25 *
    2626 * Government disclaimer of liability
    2727 * ----------------------------------
     
    3232 * disclosed, or represents that its use would not infringe privately owned
    3333 * rights.
    34  * 
     34 *
    3535 * Stanford disclaimer of liability
    3636 * --------------------------------
    3737 * Stanford University makes no representations or warranties, express or
    3838 * implied, nor assumes any liability for the use of this software.
    39  * 
     39 *
    4040 * Stanford disclaimer of copyright
    4141 * --------------------------------
    4242 * Stanford University, owner of the copyright, hereby disclaims its
    4343 * copyright and all other rights in this software.  Hence, anyone may
    44  * freely use it for any purpose without restriction. 
    45  * 
     44 * freely use it for any purpose without restriction.
     45 *
    4646 * Maintenance of notices
    4747 * ----------------------
     
    5252 * software made or distributed by the recipient that contains a copy or
    5353 * derivative of this software.
    54  * 
     54 *
    5555 * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
    56  */ 
     56 */
    5757
    5858#include <rtems.h>
     
    119119extern const rtems_driver_address_table rtems_libi2c_io_ops;
    120120
    121 /* Unfortunately, if you want to add this driver to 
     121/* Unfortunately, if you want to add this driver to
    122122 * a RTEMS configuration table then you need all the
    123123 * members explicitly :-( (Device_driver_table should
     
    132132 * Currently the preferred way is having the BSP
    133133 * call 'rtems_libi2c_initialize' followed by
    134  * 'rtems_libi2c_register_bus' and 
     134 * 'rtems_libi2c_register_bus' and
    135135 * 'rtems_libi2c_register_drv' and/or
    136136 * 'mknod' (for 'raw' device nodes)
     
    166166
    167167/* Access functions a low level driver must provide;
    168  * 
     168 *
    169169 * All of these, except read_bytes and write_bytes
    170170 * return RTEMS_SUCCESSFUL on success and an error status
     
    190190                      int nbytes);
    191191  /* ioctl misc functions */
    192   int (*ioctl) (rtems_libi2c_bus_t * bushdl, 
     192  int (*ioctl) (rtems_libi2c_bus_t * bushdl,
    193193                int   cmd,
    194194                void *buffer
     
    206206 *
    207207 * The name will be registered in the filesystem (parent
    208  * directories must exist, also IMFS filesystem must exist see 
     208 * directories must exist, also IMFS filesystem must exist see
    209209 * CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM). It may be NULL in which case
    210210 * the library will pick a default.
     
    265265 * and following byte written to the device as data, i.e., the
    266266 * contents could easily be changed!).
    267  * The correct 'read-pointer offset' programming could be 
     267 * The correct 'read-pointer offset' programming could be
    268268 * implemented in 'open' and 'ioctl' of a high-level driver and
    269269 * the user would then only have to perform harmless read
    270  * operations, e.g., 
     270 * operations, e.g.,
    271271 *
    272272 *    fd = open("/dev/i2c.eeprom",O_RDONLY) / * opens and sets EEPROM read pointer * /
     
    279279/* struct provided at driver registration. The driver may store
    280280 * private data behind the mandatory first fields but the size
    281  * must be set to the size of the entire struct, e.g., 
     281 * must be set to the size of the entire struct, e.g.,
    282282 *
    283283 * struct driver_pvt {
     
    286286 * } my_driver = {
    287287 *              {  ops: my_ops,
    288  *                size: sizeof(my_driver) 
     288 *                size: sizeof(my_driver)
    289289 *              },
    290290 *              { ...};
     
    306306 * The registration procedure also creates a filesystem node,
    307307 * i.e., the returned minor number is not really needed.
    308  * 
     308 *
    309309 * If the 'name' argument is NULL, no filesystem node is
    310310 * created (but this can be done 'manually' using rtems_libi2c_major
     
    358358/* Send start, send address and read bytes */
    359359extern int
    360 rtems_libi2c_start_read_bytes (rtems_device_minor_number minor, 
     360rtems_libi2c_start_read_bytes (rtems_device_minor_number minor,
    361361                               unsigned char *bytes,
    362362                               int nbytes);
     
    364364/* Send start, send address and write bytes */
    365365extern int
    366 rtems_libi2c_start_write_bytes (rtems_device_minor_number minor, 
     366rtems_libi2c_start_write_bytes (rtems_device_minor_number minor,
    367367                                const unsigned char *bytes,
    368368                                int nbytes);
     
    386386 *                             RTEMS_LIBI2C_IOCTL_READ_WRITE,
    387387 *                              rtems_libi2c_read_write_t *arg);
    388  * 
    389  * This call performs a simultanous read/write transfer, 
     388 *
     389 * This call performs a simultanous read/write transfer,
    390390 * which is possible (and sometimes needed) for SPI devices
    391  * 
     391 *
    392392 *   arg is a pointer to a rd_wr info data structure
    393  * 
     393 *
    394394 * This call is only needed for SPI devices
    395395 */
     
    402402 *                             int byte_cnt,
    403403 *                             const rtems_libi2c_tfr_mode_t *tfr_mode_ptr);
    404  * 
     404 *
    405405 * This call addresses a slave and then:
    406406 * - sets the proper transfer mode,
    407  *  - performs a simultanous  read/write transfer, 
     407 *  - performs a simultanous  read/write transfer,
    408408 *    (which is possible and sometimes needed for SPI devices)
    409409 *    NOTE: - if rd_buffer is NULL, receive data will be dropped
    410410 *          - if wr_buffer is NULL, bytes with content 0 will transmitted
    411  * 
    412  *   rd_buffer is a pointer to a receive buffer (or NULL) 
     411 *
     412 *   rd_buffer is a pointer to a receive buffer (or NULL)
    413413 *   wr_buffer is a pointer to the data to be sent (or NULL)
    414  * 
     414 *
    415415 * This call is only needed for SPI devices
    416416 */
     
    421421 *                             RTEMS_LIBI2C_IOCTL_SET_TFRMODE,
    422422 *                             const rtems_libi2c_tfr_mode_t *tfr_mode_ptr);
    423  * 
     423 *
    424424 * This call sets an SPI device to the transfer mode needed (baudrate etc.)
    425  * 
     425 *
    426426 *   tfr_mode is a pointer to a structure defining the SPI transfer mode needed
    427  *   (see below). 
    428  * 
     427 *   (see below).
     428 *
    429429 * This call is only needed for SPI devices
    430430 */
     
    436436 *                             RTEMS_LIBI2C_IOCTL_GET_DRV_T,
    437437 *                             const rtems_libi2c_drv_t *drv_t_ptr);
    438  * 
     438 *
    439439 * This call allows the a high-level driver to query its driver table entry,
    440440 * including its private data appended to it during creation of the entry
    441  * 
     441 *
    442442 */
    443443
Note: See TracChangeset for help on using the changeset viewer.