OpenCores
URL https://opencores.org/ocsvn/minsoc/minsoc/trunk

Subversion Repositories minsoc

[/] [minsoc/] [trunk/] [sw/] [drivers/] [i2c.h] - Diff between revs 36 and 53

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 36 Rev 53
Line 1... Line 1...
 
 
struct i2c_type
struct i2c_type
{
{
    unsigned char address;
    unsigned char address;
    unsigned char pointer;
    unsigned char pointer;
    unsigned short data;
    unsigned short data;
Line 14... Line 13...
};
};
 
 
typedef struct i2c_type i2c_type;
typedef struct i2c_type i2c_type;
typedef struct i2c_mode i2c_mode;
typedef struct i2c_mode i2c_mode;
 
 
#define I2C_BUF_LEN     10
 
 
 
void i2c_init(void);
void i2c_init(void);
void i2c_irq(void);
void i2c_irq(void);
 
 
i2c_type * i2c_get(void);                           //return pointer to first non read received data
i2c_type * i2c_get(void);                           //return pointer to first non read received data
 
 
void i2c_set_ack_lvl(int ack_lvl, int final_ack_lvl);
void i2c_set_ack_lvl(int ack_lvl, int final_ack_lvl);
int i2c_trans(i2c_mode * mode, i2c_type * data);   //return (-1) or length (still processing previous) or asserted
int i2c_trans(i2c_mode * mode, i2c_type * data);   //return (-1) or length (still processing previous) or asserted
 
 
 
#define I2C_BUF_LEN             10
#define I2C_PRESC_LO     0x00
#define I2C_PRESC_LO     0x00
#define I2C_PRESC_HI     0x01
#define I2C_PRESC_HI     0x01
 
 
#define I2C_CTR          0x02
#define I2C_CTR          0x02
 
 
Line 35... Line 35...
#define I2C_RXR          0x03
#define I2C_RXR          0x03
 
 
#define I2C_CR           0x04
#define I2C_CR           0x04
#define I2C_SR           0x04
#define I2C_SR           0x04
 
 
 
 
//BITS
//BITS
#define I2C_CTR_EN        0x80
#define I2C_CTR_EN        0x80
#define I2C_CTR_IRQ_EN    0x40
#define I2C_CTR_IRQ_EN    0x40
 
 
#define I2C_TXR_ADR      0xFE
#define I2C_TXR_ADR      0xFE
Line 58... Line 57...
#define I2C_SR_BUSY      0x40
#define I2C_SR_BUSY      0x40
#define I2C_SR_ARB_LOST  0x20
#define I2C_SR_ARB_LOST  0x20
#define I2C_SR_TX_BUSY   0x02
#define I2C_SR_TX_BUSY   0x02
#define I2C_SR_IRQ_FLAG  0x01
#define I2C_SR_IRQ_FLAG  0x01
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.