inc/bf52xI2cMaster.h File Reference

#include "tll_config.h"
#include "bf52x_uart.h"

Include dependency graph for bf52xI2cMaster.h:

This graph shows which files directly or indirectly include this file:


Data Structures

struct  _bf52x_i2c_cmd_data_t

Defines

#define I2C_TX_TIMEOUT   (16*(( ((*pTWI_CLKDIV)&0xF) + ((*pTWI_CLKDIV*0xF0)>>8))/10000000)*CORE_CLK + 2000)
 <bf52xI2cMaster.h> Contains declarations for BF52X I2C driver.
#define I2C_MSG_SIZE_MAX   (0xFF)
#define PASS   (0)
#define FAIL   (!PASS)
#define TWI_MASTER_ENABLE   *pTWI_MASTER_CTL |= MEN
#define TWI_MASTER_DISABLE   *pTWI_MASTER_CTL &= ~MEN
#define TWI_MASTER_MODE_ADDR(slave_addr)   *pTWI_MASTER_ADDR = (0x007f & slave_addr)
#define TWI_MASTER_CLK(dclk)
#define TWI_MASTER_TX_COMPLETE   (*pTWI_INT_STAT & MCOMP)

Typedefs

typedef _bf52x_i2c_cmd_data_t bf52x_i2c_cmd_data_t

Enumerations

enum  repeat_start { RS_DISABLE = 0, RS_ENABLE = 1 }
 Enumeration of the repeat start states. More...

Functions

int bf52xI2cMaster_init (unsigned char is_sccb, int clock)
 Initializes the I2C interface as master.
int bf52x_i2c_master_probe (unsigned char addr)
 Probes for the I2C slave device.
int bf52xI2cMaster_receive (bf52x_i2c_cmd_data_t *i2c_trans_p)
 Receive data.
int bf52xI2cMaster_send (bf52x_i2c_cmd_data_t *i2c_trans_p)
 Send data.

Define Documentation

#define FAIL   (!PASS)

#define I2C_MSG_SIZE_MAX   (0xFF)

#define I2C_TX_TIMEOUT   (16*(( ((*pTWI_CLKDIV)&0xF) + ((*pTWI_CLKDIV*0xF0)>>8))/10000000)*CORE_CLK + 2000)

<bf52xI2cMaster.h> Contains declarations for BF52X I2C driver.

#define PASS   (0)

#define TWI_MASTER_CLK ( dclk   ) 

Value:

do { \
    *pTWI_CLKDIV = CLKLOW(10000000/dclk/2); \
    *pTWI_CLKDIV |= CLKHI(10000000/dclk/2); \
} while (0);

#define TWI_MASTER_DISABLE   *pTWI_MASTER_CTL &= ~MEN

#define TWI_MASTER_ENABLE   *pTWI_MASTER_CTL |= MEN

#define TWI_MASTER_MODE_ADDR ( slave_addr   )     *pTWI_MASTER_ADDR = (0x007f & slave_addr)

#define TWI_MASTER_TX_COMPLETE   (*pTWI_INT_STAT & MCOMP)


Typedef Documentation

typedef struct _bf52x_i2c_cmd_data_t bf52x_i2c_cmd_data_t


Enumeration Type Documentation

enum repeat_start

Enumeration of the repeat start states.

Enumerator:
RS_DISABLE 
RS_ENABLE 


Function Documentation

int bf52x_i2c_master_probe ( unsigned char  addr  ) 

Probes for the I2C slave device.

This function probes and checks if the specified slave device is present or not.

Pre-conditions:

Post condtions:

Parameters:

Parameters:
sccb - Should be non-zero to configure the interface as SCCB interface. Zero for normal I2C interface.
Returns:
Zero if the device is probed and available. Else negative value.

int bf52xI2cMaster_init ( unsigned char  is_sccb,
int  clock 
)

Initializes the I2C interface as master.

This function initializes the TWI interface as master.

Pre-conditions:

Post condtions:

Parameters:

Parameters:
sccb - 0 to use standard I2C interface 1 to use standard SCCB interface.
Returns:
TLL_STATUS_SUCCESS or TLL_STATUS_INVALID

int bf52xI2cMaster_receive ( bf52x_i2c_cmd_data_t i2c_trans_p  ) 

Receive data.

This function receives the data specified into the bf52x_i2c_cmd_data_t data structure.

Pre-conditions:

Post condtions:

Parameters:

Parameters:
i2c_trans - Holds the transaction information.
Returns:
Zero if the device data transfer was successful. Else negative value.

int bf52xI2cMaster_send ( bf52x_i2c_cmd_data_t i2c_trans_p  ) 

Send data.

This function sends the data specified in the bf52x_i2c_cmd_data_t data structure.

Pre-conditions:

Post condtions:

Parameters:

Parameters:
i2c_trans - Holds the transaction information.
Returns:
Zero if the device data transfer was successful. Else negative value.


Generated on 3 Mar 2014 for PAL bare-c Library by  doxygen 1.4.7