Исследование драйвера ядра Linux для шины I2C

Автор работы: Пользователь скрыл имя, 17 Января 2012 в 14:29, курсовая работа

Краткое описание

В настоящее время только Philips производит более 150 наименований I2C-совместимых устройств, функционально предназначенных работы в электронном оборудовании различного назначения. В их числе ИС памяти, видеопроцессоров и модулей обработки аудио- и видео-сигналов, АЦП и ЦАП, драйверы ЖК-индикаторов, процессоры со встоенным аппаратным контроллером I2C шины и многое другое.

Содержание работы

Введение 5
1 Шина управления I2C 10
2 Исследование драйвера 14
Заключение 15
Список использованных источников 16

Содержимое работы - 1 файл

kyrsovik.doc

— 337.00 Кб (Скачать файл)

  394 #define I2C_M_NOSTART   0x4000

  395 #define I2C_M_REV_DIR_ADDR  0x2000

  396 #define I2C_M_IGNORE_NAK    0x1000

  397 #define I2C_M_NO_RD_ACK     0x0800

  398     __u16 len;      /* msg length               */

  399     __u8 *buf;      /* pointer to msg data          */

  400 };

  401

  402 /* To determine what functionality is present */

  403

  404 #define I2C_FUNC_I2C            0x00000001

  405 #define I2C_FUNC_10BIT_ADDR     0x00000002

  406 #define I2C_FUNC_PROTOCOL_MANGLING  0x00000004 /* I2C_M_{REV_DIR_ADDR,

  407                                                          NOSTART,..} */

  408 #define I2C_FUNC_SMBUS_HWPEC_CALC   0x00000008 /* SMBus 2.0 */

  409 #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL  0x00008000 /* SMBus 2.0 */

  410 #define I2C_FUNC_SMBUS_QUICK        0x00010000

  411 #define I2C_FUNC_SMBUS_READ_BYTE    0x00020000

  412 #define I2C_FUNC_SMBUS_WRITE_BYTE   0x00040000

  413 #define I2C_FUNC_SMBUS_READ_BYTE_DATA   0x00080000

  414 #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA  0x00100000

  415 #define I2C_FUNC_SMBUS_READ_WORD_DATA   0x00200000

  416 #define I2C_FUNC_SMBUS_WRITE_WORD_DATA  0x00400000

  417 #define I2C_FUNC_SMBUS_PROC_CALL    0x00800000

  418 #define I2C_FUNC_SMBUS_READ_BLOCK_DATA  0x01000000

  419 #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000

  420 #define I2C_FUNC_SMBUS_READ_I2C_BLOCK   0x04000000 /* I2C-like block xfer

  421 */

  422 #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK  0x08000000 /* w/ 1-byte reg. addr.

  423 */

  424 #define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2  0x10000000 /* I2C-like block xfer

  425 */

  426 #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 /* w/ 2-byte reg. addr.

  427 */

  428

  429 #define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \

  430                              I2C_FUNC_SMBUS_WRITE_BYTE)

  431 #define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \

  432                                   I2C_FUNC_SMBUS_WRITE_BYTE_DATA)

  433 #define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \

  434                                   I2C_FUNC_SMBUS_WRITE_WORD_DATA)

  435 #define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \

  436                                    I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)

  437 #define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \

  438                                   I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)

  439 #define I2C_FUNC_SMBUS_I2C_BLOCK_2 (I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \

  440                                     I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2)

  441

  442 #define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \

  443                              I2C_FUNC_SMBUS_BYTE | \

  444                              I2C_FUNC_SMBUS_BYTE_DATA | \

  445                              I2C_FUNC_SMBUS_WORD_DATA | \

  446                              I2C_FUNC_SMBUS_PROC_CALL | \

  447                              I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \

  448                              I2C_FUNC_SMBUS_I2C_BLOCK)

  449

  450 /*

  451 * Data for SMBus Messages

  452 */

  453 #define I2C_SMBUS_BLOCK_MAX 32  /* As specified in SMBus standard */

  454 union i2c_smbus_data {

  455     __u8 byte;

  456     __u16 word;

  457     __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */

  458                            /* and one more for user-space compatibility */

  459 };

  460

  461 /* smbus_access read or write markers */

  462 #define I2C_SMBUS_READ  1

  463 #define I2C_SMBUS_WRITE 0

  464

  465 /* SMBus transaction types (size parameter in the above functions)

  466    Note: these no longer correspond to the (arbitrary) PIIX4 internal

  467                                             codes! */

  468 #define I2C_SMBUS_QUICK         0

  469 #define I2C_SMBUS_BYTE          1

  470 #define I2C_SMBUS_BYTE_DATA     2

  471 #define I2C_SMBUS_WORD_DATA     3

  472 #define I2C_SMBUS_PROC_CALL     4

  473 #define I2C_SMBUS_BLOCK_DATA        5

  474 #define I2C_SMBUS_I2C_BLOCK_DATA    6

  475 #define I2C_SMBUS_BLOCK_PROC_CALL   7       /* SMBus 2.0 */

  476

  477

  478 /* ----- commands for the ioctl like i2c_command call:

  479 * note that additional calls are defined in the algorithm and hw

  480 *  dependent layers - these can be listed here, or see the

  481 * corresponding header files.

  482 */

  483                 /* -> bit-adapter specific ioctls   */

  484 #define I2C_RETRIES 0x0701  /* number of times a device address      */

  485                 /* should be polled when not            */

  486                                 /* acknowledging            */

  487 #define I2C_TIMEOUT 0x0702  /* set timeout - call with int      */

  488

  489

  490 /* this is for i2c-dev.c    */

  491 #define I2C_SLAVE   0x0703  /* Change slave address         */

  492                /* Attn.: Slave address is 7 or 10 bits */

  493 #define I2C_SLAVE_FORCE 0x0706  /* Change slave address         */

  494                 /* Attn.: Slave address is 7 or 10 bits */

  495                 /* This changes the address, even if it */

  496                 /* is already taken!            */

  497 #define I2C_TENBIT  0x0704  /* 0 for 7 bit addrs, != 0 for 10 bit   */

  498

  499 #define I2C_FUNCS   0x0705  /* Get the adapter functionality */

  500 #define I2C_RDWR    0x0707  /* Combined R/W transfer (one stop only)*/

  501 #define I2C_PEC     0x0708  /* != 0 for SMBus PEC                   */

  502

  503 #define I2C_SMBUS   0x0720  /* SMBus-level access */

  504

  505 /* ----- I2C-DEV: char device interface stuff ------------------------- */

  506

  507 #define I2C_MAJOR   89      /* Device major number      */

  508

  509 /* These defines are used for probing i2c client addresses */

  510 /* The length of the option lists */

  511 #define I2C_CLIENT_MAX_OPTS 48

  512

  513 /* Default fill of many variables */

  514 #define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END,

  515                              \

  516                           I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \

  517                           I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \

  518                           I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \

  519                           I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \

  520                          I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \

  521                           I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \

  522                           I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \

  523                           I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \

  524                           I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \

  525                           I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \

  526                           I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \

Информация о работе Исследование драйвера ядра Linux для шины I2C