Skip to content

Instantly share code, notes, and snippets.

@esden
Created November 20, 2021 20:29
Show Gist options
  • Select an option

  • Save esden/f98e46011af131e4826f834e8f93655f to your computer and use it in GitHub Desktop.

Select an option

Save esden/f98e46011af131e4826f834e8f93655f to your computer and use it in GitHub Desktop.
A potential svd yaml file with field enum.
# Path to the SVD template file
_svd: svdtemplate.svd
# Include other YAML files if needed.
# Path is relative to this file location.
#_include:
# - "xyz.yaml"
_modify:
vendor: 1BitSquared
name: iCETwang-SOC
version: 0.1
description: iCETwang 1D Dungeon SOC
addressUnitBits: 8
width: 32
access: read-write
size: 0x20
resetValue: 0x0
resetMask: 0xFFFFFFFF
# Start adding peripherals
# UART 0x81000000
# SPI 0x82000000
# LED 0x83000000
# USB_CORE 0x84000000
# USB_DATA 0x85000000
# KEYSCAN 0x86000000 (icekeeb)
_add:
UART:
description: UART interface
groupName: UART
baseAddress: 0x81000000
addressBlock:
offset: 0x0
size: 0x01000000
usage: registers
registers:
DATA:
description: UART data in/out register. HSB 0 indicates pending data.
addressOffset: 0x0
access: read-write
resetValue: 0x00000000
fields:
DATABYTE:
description: The actual data input and output.
bitOffset: 0
bitWidth: 8
RFEMPTY:
description: Receive FIFO empty flag
bitOffset: 31
bitWidth: 1
CSR:
description: UART Config and Status Register
addressOffset: 0x4
access: read-write
resetValue: 0x00000000
fields:
DIV:
description: Baud rate clock divider
bitOffset: 0
bitWidth: 12
TFFULL:
description: Transmit FIFO full flag
bitOffset: 28
bitWidth: 1
TFEMPTY:
description: Transmit FIFO empty flag
bitOffset: 29
bitWidth: 1
RFOVERFLOW:
description: Receive FIFO overflow flag
bitOffset: 30
bitWidth: 1
RFEMPTY:
description: Receive FIFO empty flag
bitOffset: 31
bitWidth: 1
RGBLED:
description: RGBLED control
groupName: RGBLED
baseAddress: 0x83000000
addressBlock:
offset: 0x0
size: 0x01000000
usage: registers
registers:
CSR:
description: Control and Status Register
addressOffset: 0x0
access: read-write
resetValue: 0x00000000
fields:
LEDDEXE:
description: Enable the IP to run the blinking sequence. When low, the sequence stops at the nearest OFF state
bitOffset: 1
bitWidth: 1
RGBLEDEN:
description: Enable control of the RGB LED
bitOffset: 2
bitWidth: 1
CURREN:
description: Power up
bitOffset: 3
bitWidth: 1
PWRR:
description: Pulse Width Register Red
addressOffset: 0x44
access: read-write
resetValue: 0x00000000
PWRG:
description: Pulse Width Register Green
addressOffset: 0x48
access: read-write
resetValue: 0x00000000
PWRB:
description: Pulse Width Register Blue
addressOffset: 0x4C
access: read-write
resetValue: 0x00000000
BCRR:
description: Breathe Control Rise Register
addressOffset: 0x54
access: read-write
resetValue: 0x00000000
fields:
BRATE:
description: Breathe ON Rate
bitOffset: 0
bitWidth: 4
BMODE:
description: Breathe Mode Select 0= Breathe with local rate, 1= Modulate rate based on color setting
bitOffset: 5
bitWidth: 1
BEDGE:
description: Breathe Edge 0= Breathe control only for ON ramp, 1= Breathe control for ON and OFF ramp
bitOffset: 6
bitWidth: 1
BON:
description: Breathe ON Enable
bitOffset: 7
bitWidth: 1
BCFR:
description: Breathe Control Fall Register
addressOffset: 0x58
access: read-write
resetValue: 0x00000000
fields:
BRATE:
description: Breathe OFF Rate
bitOffset: 0
bitWidth: 4
BMODE:
description: Breathe Mode Select 0= Breathe with local rate, 1= Modulate rate based on color setting
bitOffset: 5
bitWidth: 1
BRANGE:
description: Breathe Range extend for linear mode
bitOffset: 6
bitWidth: 1
BON:
description: Breathe OFF Enable
bitOffset: 7
bitWidth: 1
CR0:
description: Control Register 0
addressOffset: 0x60
access: read-write
resetValue: 0x00000000
fields:
BRMSBEXT:
description: Pre-scale register MSB extension
bitOffset: 0
bitWidth: 2
PWM_MODE:
description: 0= Linear, 1= LFSR
bitOffset: 2
bitWidth: 1
QUICK_STOP:
description: 0= Stop the blinking sequence wheen current ON period finishes, 1= Stop blinking immediately
bitOffset: 3
bitWidth: 1
OUTSKEW:
description: Enable PWM slew to reduce simultaneous switching noise, based on BRMSBEXT
bitOffset: 4
bitWidth: 1
OUTPOL:
description: PWM output polarity. 0= Active high, 1= Active low
bitOffset: 5
bitWidth: 1
FR250:
description: PWM flick rate. 0= 125Hz, 1= 250Hz
bitOffset: 6
bitWidth: 1
LEDDEN:
description: LED Driver Enable
bitOffset: 7
bitWidth: 1
BR:
description: Pre-scale Register
addressOffset: 0x64
access: read-write
resetValue: 0x00000000
ONR:
description: ON Time Register
addressOffset: 0x68
access: read-write
resetValue: 0x00000000
OFR:
description: OFF Time Register
addressOffset: 0x6C
access: read-write
resetValue: 0x00000000
LEDSTR:
description: RGB LED string interface
groupName: LEDSTR
baseAddress: 0x86000000
addressBlock:
offset: 0x0
size: 0x01000000
usage: registers
registers:
CSR:
description: Control and Status Register
addressOffset: 0x0
access: read-write
resetValue: 0x00000000
fields:
DIV:
description: Clock divider
bitOffset: 0
bitWidth: 16
LEN:
description: LED String Length
bitOffset: 16
bitWidth: 9
BSY:
description: Reads 0 when idle and 1 when transmitting LED data
bitOffset: 30
bitWidth: 1
STRT:
description: Write 1 to start LED string data transmission
bitOffset: 31
bitWidth: 1
GLOB:
description: Global LED string brightness
addressOffset: 0x4
access: read-write
resetValue: 0x0000001F
fields:
GLOB:
description: Global LED string brightness
bitOffset: 0
bitWidth: 5
TIMER:
description: TIMER
groupName: TIMER
baseAddress: 0x87000000
addressBlock:
offset: 0x0
size: 0x01000000
usage: registers
registers:
CSR:
description: Control and Status Register
addressOffset: 0x0
access: read-write
resetValue: 0x00000000
fields:
EN:
description: Timer enable
bitOffset: 0
bitWidth: 1
ST:
description: Timer status, 1 while timer is != 0
bitOffset: 1
bitWidth: 1
EV:
description: Timer event, set to 1 when timer reaches 0 and EV_EN is set
bitOffset: 2
bitWidth: 1
EV_EN:
description: Timer event enable
bitOffset: 3
bitWidth: 1
LOAD:
description: Value loaded into the timer counter when EN goes high
addressOffset: 0x4
access: read-write
resetValue: 0x00000000
RELOAD:
description: Value loaded into the timer counter when timer reaches 0
addressOffset: 0x8
access: read-write
resetValue: 0x00000000
COUNTER:
description: Live timer counter value
addressOffset: 0xC
access: read-only
resetValue: 0x00000000
JOY:
description: JOY
groupName: JOY
baseAddress: 0x88000000
addressBlock:
offset: 0x0
size: 0x01000000
usage: registers
registers:
JOY:
description: Joystick button state
addressOffset: 0x0
access: read-write
resetValue: 0x00000000
fields:
UP:
description: Joystick Up
bitOffset: 0
bitWidth: 1
DOWN:
description: Joystick Down
bitOffset: 1
bitWidth: 1
LEFT:
description: Joystick Left
bitOffset: 2
bitWidth: 1
RIGHT:
description: Joystick Right
bitOffset: 3
bitWidth: 1
I2C:
description: I2C
groupName: I2C
baseAddress: 0x89000000
addressBlock:
offset: 0x0
size: 0x01000000
usage: registers
registers:
DAT:
description: Readwrite register
addressOffset: 0x0
access: read-write
resetValue: 0x00000000
fields:
DATA:
description: Write data to send, read received data.
bitOffset: 0
bitWidth: 8
ACK:
description: Write ack out, read ack in.
bitOffset: 8
bitWidth: 1
CMD:
description: Set command type.
bitOffset: 12
bitWidth: 2
enum:
START: [0, "Start condition"]
STOP: [1, "Stop condition"]
WRITE: [2, "Write access"]
READ: [3, "Read access"]
READY:
description: I2C peripheral ready
bitOffset: 31
bitWidth: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment