From 3050565531af2b3a09f2213893f10c64cf9fe43f Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Wed, 24 Feb 2021 19:50:20 +0100 Subject: added test app with voice, wifi/cellular data connectivity examples --- fw/fe310/bsp/include/sifive/devices/i2c.h | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 fw/fe310/bsp/include/sifive/devices/i2c.h (limited to 'fw/fe310/bsp/include/sifive/devices/i2c.h') 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 */ -- cgit v1.2.3