diff options
author | Uros Majstorovic <majstor@majstor.org> | 2021-02-24 19:50:20 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2021-02-24 19:50:20 +0100 |
commit | 3050565531af2b3a09f2213893f10c64cf9fe43f (patch) | |
tree | 689d10ca064dba4480a85b6ec14a4eb8305d5c89 /fw/fe310/bsp/include/sifive/devices/i2c.h | |
parent | d0a0fee0571be63f023f8f6a49a0b76b89871e56 (diff) |
added test app with voice, wifi/cellular data connectivity examples
Diffstat (limited to 'fw/fe310/bsp/include/sifive/devices/i2c.h')
-rw-r--r-- | fw/fe310/bsp/include/sifive/devices/i2c.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/fw/fe310/bsp/include/sifive/devices/i2c.h b/fw/fe310/bsp/include/sifive/devices/i2c.h new file mode 100644 index 0000000..900e238 --- /dev/null +++ b/fw/fe310/bsp/include/sifive/devices/i2c.h @@ -0,0 +1,34 @@ +// See LICENSE for license details. + +#ifndef _SIFIVE_I2C_H +#define _SIFIVE_I2C_H + +/* Register offsets */ + +#define I2C_PRESCALE_LOW 0x00 +#define I2C_PRESCALE_HIGH 0x04 +#define I2C_CONTROL 0x08 +#define I2C_TRANSMIT 0x0c +#define I2C_RECEIVE 0x0c +#define I2C_COMMAND 0x10 +#define I2C_STATUS 0x10 + +/* Constants */ + +#define I2C_CONTROL_EN (1UL << 7) +#define I2C_CONTROL_IE (1UL << 6) +#define I2C_WRITE (0UL << 0) +#define I2C_READ (1UL << 0) +#define I2C_CMD_START (1UL << 7) +#define I2C_CMD_STOP (1UL << 6) +#define I2C_CMD_READ (1UL << 5) +#define I2C_CMD_WRITE (1UL << 4) +#define I2C_CMD_ACK (1UL << 3) +#define I2C_CMD_IACK (1UL << 0) +#define I2C_STATUS_RXACK (1UL << 7) +#define I2C_STATUS_BUSY (1UL << 6) +#define I2C_STATUS_AL (1UL << 5) +#define I2C_STATUS_TIP (1UL << 1) +#define I2C_STATUS_IP (1UL << 0) + +#endif /* _SIFIVE_I2C_H */ |