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/aon.h | 1 + fw/fe310/bsp/include/sifive/devices/clint.h | 12 +++++----- fw/fe310/bsp/include/sifive/devices/gpio.h | 2 +- fw/fe310/bsp/include/sifive/devices/i2c.h | 34 +++++++++++++++++++++++++++++ fw/fe310/bsp/include/sifive/devices/prci.h | 8 +++---- 5 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 fw/fe310/bsp/include/sifive/devices/i2c.h (limited to 'fw/fe310/bsp/include/sifive/devices') diff --git a/fw/fe310/bsp/include/sifive/devices/aon.h b/fw/fe310/bsp/include/sifive/devices/aon.h index 63f1db3..4a3332c 100644 --- a/fw/fe310/bsp/include/sifive/devices/aon.h +++ b/fw/fe310/bsp/include/sifive/devices/aon.h @@ -57,6 +57,7 @@ #define AON_PMUKEY 0x14C #define AON_LFROSC 0x070 + /* Constants */ #define AON_WDOGKEY_VALUE 0x51F15E diff --git a/fw/fe310/bsp/include/sifive/devices/clint.h b/fw/fe310/bsp/include/sifive/devices/clint.h index cd3e0c7..617b657 100644 --- a/fw/fe310/bsp/include/sifive/devices/clint.h +++ b/fw/fe310/bsp/include/sifive/devices/clint.h @@ -4,11 +4,11 @@ #define _SIFIVE_CLINT_H -#define CLINT_MSIP 0x0000 -#define CLINT_MSIP_size 0x4 -#define CLINT_MTIMECMP 0x4000 +#define CLINT_MSIP 0x0000 +#define CLINT_MSIP_size 0x4 +#define CLINT_MTIMECMP 0x4000 #define CLINT_MTIMECMP_size 0x8 -#define CLINT_MTIME 0xBFF8 -#define CLINT_MTIME_size 0x8 +#define CLINT_MTIME 0xBFF8 +#define CLINT_MTIME_size 0x8 -#endif /* _SIFIVE_CLINT_H */ +#endif /* _SIFIVE_CLINT_H */ diff --git a/fw/fe310/bsp/include/sifive/devices/gpio.h b/fw/fe310/bsp/include/sifive/devices/gpio.h index f7f0acb..835ac83 100644 --- a/fw/fe310/bsp/include/sifive/devices/gpio.h +++ b/fw/fe310/bsp/include/sifive/devices/gpio.h @@ -19,6 +19,6 @@ #define GPIO_LOW_IP (0x34) #define GPIO_IOF_EN (0x38) #define GPIO_IOF_SEL (0x3C) -#define GPIO_OUTPUT_XOR (0x40) +#define GPIO_OUTPUT_XOR (0x40) #endif /* _SIFIVE_GPIO_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 */ diff --git a/fw/fe310/bsp/include/sifive/devices/prci.h b/fw/fe310/bsp/include/sifive/devices/prci.h index 1a3de58..d46da08 100644 --- a/fw/fe310/bsp/include/sifive/devices/prci.h +++ b/fw/fe310/bsp/include/sifive/devices/prci.h @@ -12,13 +12,13 @@ #define PRCI_PROCMONCFG (0x00F0) /* Fields */ -#define ROSC_DIV(x) (((x) & 0x2F) << 0 ) +#define ROSC_DIV(x) (((x) & 0x2F) << 0 ) #define ROSC_TRIM(x) (((x) & 0x1F) << 16) -#define ROSC_EN(x) (((x) & 0x1 ) << 30) +#define ROSC_EN(x) (((x) & 0x1 ) << 30) #define ROSC_RDY(x) (((x) & 0x1 ) << 31) -#define XOSC_EN(x) (((x) & 0x1) << 30) -#define XOSC_RDY(x) (((x) & 0x1) << 31) +#define XOSC_EN(x) (((x) & 0x1) << 30) +#define XOSC_RDY(x) (((x) & 0x1) << 31) #define PLL_R(x) (((x) & 0x7) << 0) // single reserved bit for F LSB. -- cgit v1.2.3