Logo SoCRocket

Transaction-Level Modeling Framework for Space Applications

Classes | Macros | Functions
i2c.c File Reference
#include "testmod.h"
Include dependency graph for i2c.c:

Classes

struct  i2cslv_regs
 
struct  i2cmst_regs
 

Macros

#define I2CSLV_SLVADDR_TBA   (1 << 31)
 
#define I2CSLV_CTRL_RMOD_POS   4
 
#define I2CSLV_CTRL_RMOD   (1 << 4)
 
#define I2CSLV_CTRL_TMOD_POS   3
 
#define I2CSLV_CTRL_TMOD   (1 << 3)
 
#define I2CSLV_CTRL_TV   (1 << 2)
 
#define I2CSLV_CTRL_TAV   (1 << 1)
 
#define I2CSLV_CTRL_EN   (1 << 0)
 
#define I2CSLV_STS_REC   (1 << 2)
 
#define I2CSLV_STS_TRA   (1 << 1)
 
#define I2CSLV_STS_NAK   (1 << 0)
 
#define I2CSLV_MSK_RECE   (1 << 2)
 
#define I2CSLV_MSK_TRAE   (1 << 1)
 
#define I2CSLV_MSK_NAKE   (1 << 0)
 
#define I2CMST_CTR_EN   (1 << 7) /* Enable core */
 
#define I2CMST_CTR_IEN   (1 << 6) /* Interrupt enable */
 
#define I2CMST_CR_STA   (1 << 7) /* Generate start condition */
 
#define I2CMST_CR_STO   (1 << 6) /* Generate stop condition */
 
#define I2CMST_CR_RD   (1 << 5) /* Read from slave */
 
#define I2CMST_CR_WR   (1 << 4) /* Write to slave */
 
#define I2CMST_CR_ACK
 
#define I2CMST_CR_IACK   (1 << 0) /* Interrupt acknowledge */
 
#define I2CMST_SR_RXACK   (1 << 7) /* Receibed acknowledge from slave */
 
#define I2CMST_SR_BUSY   (1 << 6) /* I2C bus busy */
 
#define I2CMST_SR_AL   (1 << 5) /* Arbitration lost */
 
#define I2CMST_SR_TIP   (1 << 1) /* Transfer in progress */
 
#define I2CMST_SR_IF   (1 << 0) /* Interrupt flag */
 
#define PRESCALER   0x000A
 
#define SLAVE_ADDRESS   0x33
 

Functions

int i2c_test (int mstaddr, int slvaddr)
 

Macro Definition Documentation

#define I2CMST_CR_ACK
Value:
(1 << 3) /* ACK, when a receiver send ACK (ACK = 0)
or NACK (ACK = 1) */

Referenced by i2c_test().

#define I2CMST_CR_IACK   (1 << 0) /* Interrupt acknowledge */
#define I2CMST_CR_RD   (1 << 5) /* Read from slave */

Referenced by i2c_test().

#define I2CMST_CR_STA   (1 << 7) /* Generate start condition */

Referenced by i2c_test().

#define I2CMST_CR_STO   (1 << 6) /* Generate stop condition */

Referenced by i2c_test().

#define I2CMST_CR_WR   (1 << 4) /* Write to slave */

Referenced by i2c_test().

#define I2CMST_CTR_EN   (1 << 7) /* Enable core */

Referenced by i2c_test().

#define I2CMST_CTR_IEN   (1 << 6) /* Interrupt enable */
#define I2CMST_SR_AL   (1 << 5) /* Arbitration lost */

Referenced by i2c_test().

#define I2CMST_SR_BUSY   (1 << 6) /* I2C bus busy */
#define I2CMST_SR_IF   (1 << 0) /* Interrupt flag */
#define I2CMST_SR_RXACK   (1 << 7) /* Receibed acknowledge from slave */

Referenced by i2c_test().

#define I2CMST_SR_TIP   (1 << 1) /* Transfer in progress */

Referenced by i2c_test().

#define I2CSLV_CTRL_EN   (1 << 0)

Referenced by i2c_test().

#define I2CSLV_CTRL_RMOD   (1 << 4)

Referenced by i2c_test().

#define I2CSLV_CTRL_RMOD_POS   4
#define I2CSLV_CTRL_TAV   (1 << 1)
#define I2CSLV_CTRL_TMOD   (1 << 3)

Referenced by i2c_test().

#define I2CSLV_CTRL_TMOD_POS   3
#define I2CSLV_CTRL_TV   (1 << 2)

Referenced by i2c_test().

#define I2CSLV_MSK_NAKE   (1 << 0)
#define I2CSLV_MSK_RECE   (1 << 2)
#define I2CSLV_MSK_TRAE   (1 << 1)
#define I2CSLV_SLVADDR_TBA   (1 << 31)
#define I2CSLV_STS_NAK   (1 << 0)
#define I2CSLV_STS_REC   (1 << 2)

Referenced by i2c_test().

#define I2CSLV_STS_TRA   (1 << 1)

Referenced by i2c_test().

#define PRESCALER   0x000A

Referenced by i2c_test().

#define SLAVE_ADDRESS   0x33

Referenced by i2c_test().

Function Documentation

int i2c_test ( int  mstaddr,
int  slvaddr 
)