Skip to content

Commit

Permalink
feat: add rng_v3
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf committed Mar 31, 2024
1 parent f624450 commit 1cd56ff
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 48 deletions.
1 change: 1 addition & 0 deletions data/chips/CH32V303RCT6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ cores:
- "../peripherals/FV2x_V3x_SPI3.yaml"
- "../peripherals/FV2x_V3x_I2C1.yaml"
- "../peripherals/FV2x_V3x_I2C2.yaml"
- "../peripherals/F2x_V3x_RNG.yaml"

include_interrupts: "../interrupts/ch32v2_v3.yaml"
include_dma_channels:
Expand Down
1 change: 1 addition & 0 deletions data/chips/CH32V303VCT6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ cores:
- "../peripherals/FV2x_V3x_SPI3.yaml"
- "../peripherals/FV2x_V3x_I2C1.yaml"
- "../peripherals/FV2x_V3x_I2C2.yaml"
- "../peripherals/F2x_V3x_RNG.yaml"

include_interrupts: "../interrupts/ch32v2_v3.yaml"
include_dma_channels:
Expand Down
1 change: 1 addition & 0 deletions data/chips/CH32V305FBP6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ cores:
- "../peripherals/FV2x_V3x_SPI2.yaml"
- "../peripherals/FV2x_V3x_I2C1.yaml"
- "../peripherals/FV2x_V3x_I2C2.yaml"
- "../peripherals/F2x_V3x_RNG.yaml"

include_interrupts: "../interrupts/ch32v2_v3.yaml"
include_dma_channels:
Expand Down
1 change: 1 addition & 0 deletions data/chips/CH32V305GBU6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ cores:
- "../peripherals/FV2x_V3x_SPI3.yaml"
- "../peripherals/FV2x_V3x_I2C1.yaml"
- "../peripherals/FV2x_V3x_I2C2.yaml"
- "../peripherals/F2x_V3x_RNG.yaml"

include_interrupts: "../interrupts/ch32v2_v3.yaml"
include_dma_channels:
Expand Down
1 change: 1 addition & 0 deletions data/chips/CH32V305RBT6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ cores:
- "../peripherals/FV2x_V3x_SPI3.yaml"
- "../peripherals/FV2x_V3x_I2C1.yaml"
- "../peripherals/FV2x_V3x_I2C2.yaml"
- "../peripherals/F2x_V3x_RNG.yaml"

include_interrupts: "../interrupts/ch32v2_v3.yaml"
include_dma_channels:
Expand Down
1 change: 1 addition & 0 deletions data/chips/CH32V307RCT6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ cores:
- "../peripherals/FV2x_V3x_SPI3.yaml"
- "../peripherals/FV2x_V3x_I2C1.yaml"
- "../peripherals/FV2x_V3x_I2C2.yaml"
- "../peripherals/F2x_V3x_RNG.yaml"

include_interrupts: "../interrupts/ch32v2_v3.yaml"
include_dma_channels:
Expand Down
1 change: 1 addition & 0 deletions data/chips/CH32V307VCT6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ cores:
- "../peripherals/FV2x_V3x_SPI3.yaml"
- "../peripherals/FV2x_V3x_I2C1.yaml"
- "../peripherals/FV2x_V3x_I2C2.yaml"
- "../peripherals/F2x_V3x_RNG.yaml"

include_interrupts: "../interrupts/ch32v2_v3.yaml"
include_dma_channels:
Expand Down
1 change: 1 addition & 0 deletions data/chips/CH32V307WCU6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ cores:
- "../peripherals/FV2x_V3x_SPI3.yaml"
- "../peripherals/FV2x_V3x_I2C1.yaml"
- "../peripherals/FV2x_V3x_I2C2.yaml"
- "../peripherals/F2x_V3x_RNG.yaml"

include_interrupts: "../interrupts/ch32v2_v3.yaml"
include_dma_channels:
Expand Down
4 changes: 4 additions & 0 deletions data/interrupts/ch32v2_v3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ TIM8_UP: 60
TIM8_TRG_COM: 61
# 62 - TIM8 Capture Compare interrupt
TIM8_CC: 62
# 63
RNG: 63
# 65
SDIO: 65
# 66 - TIM5 global interrupt
TIM5: 66
# 67 - SPI3 global interrupt
Expand Down
15 changes: 15 additions & 0 deletions data/peripherals/F2x_V3x_RNG.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- name: RNG
address: 0x40023C00
registers:
kind: rng
version: v3
block: RNG
rcc:
bus_clock: HCLK
kernel_clock: HCLK
enable:
register: AHBPCENR
field: TRNG_EN
interrupts:
- signal: GLOBAL
interrupt: RNG
88 changes: 40 additions & 48 deletions data/registers/rng_v3.yaml
Original file line number Diff line number Diff line change
@@ -1,57 +1,49 @@
block/RNG:
description: Random number generator.
items:
- name: CR
description: control register.
byte_offset: 0
fieldset: CR
- name: SR
description: status register.
byte_offset: 4
fieldset: SR
- name: DR
description: data register.
byte_offset: 8
access: Read
fieldset: DR
- name: CR
description: control register.
byte_offset: 0
fieldset: CR
- name: SR
description: status register.
byte_offset: 4
fieldset: SR
- name: DR
description: data register.
byte_offset: 8
access: Read
fieldset/CR:
description: control register.
fields:
- name: RNGEN
description: Random number generator enable.
bit_offset: 2
bit_size: 1
- name: IE
description: Interrupt enable.
bit_offset: 3
bit_size: 1
fieldset/DR:
description: data register.
fields:
- name: RNDATA
description: Random data.
bit_offset: 0
bit_size: 32
- name: RNGEN
description: Random number generator enable.
bit_offset: 2
bit_size: 1
- name: IE
description: Interrupt enable.
bit_offset: 3
bit_size: 1
fieldset/SR:
description: status register.
fields:
- name: DRDY
description: Data ready.
bit_offset: 0
bit_size: 1
- name: CECS
description: Clock error current status.
bit_offset: 1
bit_size: 1
- name: SECS
description: Seed error current status.
bit_offset: 2
bit_size: 1
- name: CEIS
description: Clock error interrupt status.
bit_offset: 5
bit_size: 1
- name: SEIS
description: Seed error interrupt status.
bit_offset: 6
bit_size: 1
- name: DRDY
description: Data ready.
bit_offset: 0
bit_size: 1
- name: CECS
description: Clock error current status.
bit_offset: 1
bit_size: 1
- name: SECS
description: Seed error current status.
bit_offset: 2
bit_size: 1
- name: CEIS
description: Clock error interrupt status.
bit_offset: 5
bit_size: 1
- name: SEIS
description: Seed error interrupt status.
bit_offset: 6
bit_size: 1

0 comments on commit 1cd56ff

Please sign in to comment.