Assembly examples for Red-V Thing Plus (SiFive FE310-G002)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

134 lines
3.7 KiB

#
# platform_regs.inc: FE310-G002 registers as ASM constants
#
# 2021 flabbergast@drak.xyz
# Unlicense: https://unlicense.org/
#
.equ GPIO_BASE, 0x10012000
.equ GPIO_INPUT_VAL, 0x00
.equ GPIO_INPUT_EN, 0x04
.equ GPIO_OUTPUT_EN, 0x08
.equ GPIO_OUTPUT_VAL, 0x0C
.equ GPIO_PUE, 0x10
.equ GPIO_DS, 0x14
.equ GPIO_RISE_IE, 0x18
.equ GPIO_RISE_IP, 0x1C
.equ GPIO_FALL_IE, 0x20
.equ GPIO_FALL_IP, 0x24
.equ GPIO_HIGH_IE, 0x28
.equ GPIO_HIGH_IP, 0x2C
.equ GPIO_LOW_IE, 0x30
.equ GPIO_LOW_IP, 0x34
.equ GPIO_IOF_EN, 0x38
.equ GPIO_IOF_SEL, 0x3C
.equ GPIO_OUTPUT_XOR, 0x40
.equ CLINT_BASE, 0x02000000
.equ CLINT_MSIP, 0x0000
.equ CLINT_MTIMECMP, 0x4000
.equ CLINT_MTIME, 0xBFF8
.equ PRCI_BASE, 0x10008000
.equ PRCI_HFROSCCFG, 0x00 # Ring osc config
.equ PRCI_HFXOSCCFG, 0x04 # XTAL osc config
.equ PRCI_PLLCFG, 0x08 # PLL config
.equ PRCI_PLLOUTDIV, 0x0C
.equ PRCI_PROCMONCFG, 0xF0
.equ PRCI_PLLCFG_PLLSEL, 1<<16 # PLL selected as clock source
.equ PRCI_PLLCFG_PLLREFSEL, 1<<17 # PLL to take XTAL as reference
.equ PRCI_PLLCFG_PLLBYPASS, 1<<18 # PLL bypassed and shut off
.equ UART0_BASE, 0x10013000
.equ UART0_TXDATA, 0x00
.equ UART0_RXDATA, 0x04
.equ UART0_TXCTRL, 0x08
.equ UART0_RXCTRL, 0x0C
.equ UART0_IE, 0x10
.equ UART0_IP, 0x14
.equ UART0_DIV, 0x18
.equ AON_BASE, 0x10000000
.equ AON_WDOGCFG, 0x000
.equ AON_WDOGCOUNT, 0x008
.equ AON_WDOGS, 0x010
.equ AON_WDOGFEED, 0x018
.equ AON_WDOGKEY, 0x01C
.equ AON_WDOGCMP0, 0x020
.equ AON_RTCCFG, 0x040
.equ AON_RTCCOUNTLO, 0x048
.equ AON_RTCCOUNTHI, 0x04C
.equ AON_RTCS, 0x050
.equ AON_RTCCMP0, 0x060
.equ AON_LFROSCCFG, 0x070
.equ AON_LFCLKMUX, 0x07C
.equ AON_BACKUP0, 0x080
.equ AON_BACKUP1, 0x084
.equ AON_BACKUP2, 0x088
.equ AON_BACKUP3, 0x0C8
.equ AON_BACKUP4, 0x090
.equ AON_BACKUP5, 0x094
.equ AON_BACKUP6, 0x098
.equ AON_BACKUP7, 0x09C
.equ AON_BACKUP8, 0x0A0
.equ AON_BACKUP9, 0x0A4
.equ AON_BACKUP10, 0x0A8
.equ AON_BACKUP11, 0x0AC
.equ AON_BACKUP12, 0x0B0
.equ AON_BACKUP13, 0x0B4
.equ AON_BACKUP14, 0x0B8
.equ AON_BACKUP15, 0x0BC
.equ AON_PMUWAKEUPI0, 0x100
.equ AON_PMUWAKEUPI1, 0x104
.equ AON_PMUWAKEUPI2, 0x108
.equ AON_PMUWAKEUPI3, 0x10C
.equ AON_PMUWAKEUPI4, 0x110
.equ AON_PMUWAKEUPI5, 0x114
.equ AON_PMUWAKEUPI6, 0x118
.equ AON_PMUWAKEUPI7, 0x11C
.equ AON_PMUSLEEPI0, 0x120
.equ AON_PMUSLEEPI1, 0x124
.equ AON_PMUSLEEPI2, 0x128
.equ AON_PMUSLEEPI3, 0x12C
.equ AON_PMUSLEEPI4, 0x130
.equ AON_PMUSLEEPI5, 0x134
.equ AON_PMUSLEEPI6, 0x138
.equ AON_PMUSLEEPI7, 0x13C
.equ AON_PMUIE, 0x140
.equ AON_PMUCAUSE, 0x144
.equ AON_PMUSLEEP, 0x148
.equ AON_PMUKEY, 0x14C
.equ AON_SiFiveBandgap, 0x210
.equ AON_AONCFG, 0x300
.equ AON_WDOGKEY_VALUE, 0x51F15E
.equ PLIC_BASE, 0x0C000000
.equ PLIC_PRIORITY, 0
.equ PLIC_PENDING1, 0x1000
.equ PLIC_PENDING2, 0x1004
.equ PLIC_ENABLE1, 0x2000
.equ PLIC_ENABLE2, 0x2004
.equ PLIC_THRESHOLD, 0x200000
.equ PLIC_CLAIM, 0x200004
.equ I2C0_BASE, 0x10016000
.equ I2C_PRERlo, 0x00
.equ I2C_PRERhi, 0x04
.equ I2C_CTR, 0x08
.equ I2C_TXR, 0x0C
.equ I2C_RXR, 0x0C
.equ I2C_CR, 0x10
.equ I2C_SR, 0x10
# Register fields
.equ I2C_CTR_EN, (1 << 7)
.equ I2C_CTR_IE, (1 << 6)
.equ I2C_CR_START, (1 << 7)
.equ I2C_CR_STOP, (1 << 6)
.equ I2C_CR_READ, (1 << 5)
.equ I2C_CR_WRITE, (1 << 4)
.equ I2C_CR_ACK, (1 << 3)
.equ I2C_CR_IACK, (1 << 0)
.equ I2C_SR_RXACK, (1 << 7)
.equ I2C_SR_BUSY, (1 << 6)
.equ I2C_SR_AL, (1 << 5)
.equ I2C_SR_TIP, (1 << 1)
.equ I2C_SR_IP, (1 << 0)