Split USBRAM from USB, add 32bit USBRAM support, fix some sizes/versions.

This commit is contained in:
Dario Nieuwenhuis 2023-04-06 18:25:26 +02:00
parent 42eec07973
commit f5a068eab6
11 changed files with 61 additions and 301 deletions

View File

@ -30,13 +30,6 @@ block/USB:
description: Buffer table address description: Buffer table address
byte_offset: 80 byte_offset: 80
fieldset: BTABLE fieldset: BTABLE
- name: EP_MEM
description: USB Endpoint memory
array:
len: 512
stride: 4
byte_offset: 1024
bit_size: 16
fieldset/BTABLE: fieldset/BTABLE:
description: Buffer table address description: Buffer table address
fields: fields:

View File

@ -1,264 +0,0 @@
---
block/USB:
description: Universal serial bus full-speed device interface
items:
- name: EPR
description: endpoint register
array:
len: 8
stride: 4
byte_offset: 0
fieldset: EPR
- name: CNTR
description: control register
byte_offset: 64
fieldset: CNTR
- name: ISTR
description: interrupt status register
byte_offset: 68
fieldset: ISTR
- name: FNR
description: frame number register
byte_offset: 72
access: Read
fieldset: FNR
- name: DADDR
description: device address
byte_offset: 76
fieldset: DADDR
- name: BTABLE
description: Buffer table address
byte_offset: 80
fieldset: BTABLE
- name: EP_MEM
description: USB Endpoint memory
array:
len: 512
stride: 2
byte_offset: 1024
bit_size: 16
fieldset/BTABLE:
description: Buffer table address
fields:
- name: BTABLE
description: BTABLE
bit_offset: 3
bit_size: 13
fieldset/CNTR:
description: control register
fields:
- name: FRES
description: "Force a reset of the USB peripheral, exactly like a RESET signaling on the USB"
bit_offset: 0
bit_size: 1
- name: PDWN
description: Enter power down mode
bit_offset: 1
bit_size: 1
- name: LPMODE
description: Enter low-power mode
bit_offset: 2
bit_size: 1
- name: FSUSP
description: Enter suspend mode. Clocks and static power dissipation in the analog transceiver are left unaffected
bit_offset: 3
bit_size: 1
- name: RESUME
description: Resume request
bit_offset: 4
bit_size: 1
- name: ESOFM
description: "ESOF Interrupt enabled, an interrupt request is generated when the corresponding bit in the USB_ISTR register is set"
bit_offset: 8
bit_size: 1
- name: SOFM
description: "SOF Interrupt enabled, an interrupt request is generated when the corresponding bit in the USB_ISTR register is set"
bit_offset: 9
bit_size: 1
- name: RESETM
description: "RESET Interrupt enabled, an interrupt request is generated when the corresponding bit in the USB_ISTR register is set"
bit_offset: 10
bit_size: 1
- name: SUSPM
description: "SUSP Interrupt enabled, an interrupt request is generated when the corresponding bit in the USB_ISTR register is set"
bit_offset: 11
bit_size: 1
- name: WKUPM
description: "WKUP Interrupt enabled, an interrupt request is generated when the corresponding bit in the USB_ISTR register is set"
bit_offset: 12
bit_size: 1
- name: ERRM
description: "ERR Interrupt enabled, an interrupt request is generated when the corresponding bit in the USB_ISTR register is set"
bit_offset: 13
bit_size: 1
- name: PMAOVRM
description: "PMAOVR Interrupt enabled, an interrupt request is generated when the corresponding bit in the USB_ISTR register is set"
bit_offset: 14
bit_size: 1
- name: CTRM
description: "CTR Interrupt enabled, an interrupt request is generated when the corresponding bit in the USB_ISTR register is set"
bit_offset: 15
bit_size: 1
fieldset/DADDR:
description: device address
fields:
- name: ADD
description: device address
bit_offset: 0
bit_size: 7
- name: EF
description: USB device enabled
bit_offset: 7
bit_size: 1
fieldset/EPR:
description: endpoint register
fields:
- name: EA
description: EA
bit_offset: 0
bit_size: 4
- name: STAT_TX
description: STAT_TX
bit_offset: 4
bit_size: 2
enum: STAT
- name: DTOG_TX
description: DTOG_TX
bit_offset: 6
bit_size: 1
- name: CTR_TX
description: CTR_TX
bit_offset: 7
bit_size: 1
- name: EP_KIND
description: EP_KIND
bit_offset: 8
bit_size: 1
- name: EP_TYPE
description: EPTYPE
bit_offset: 9
bit_size: 2
enum: EP_TYPE
- name: SETUP
description: SETUP
bit_offset: 11
bit_size: 1
- name: STAT_RX
description: STAT_RX
bit_offset: 12
bit_size: 2
enum: STAT
- name: DTOG_RX
description: DTOG_RX
bit_offset: 14
bit_size: 1
- name: CTR_RX
description: CTR_RX
bit_offset: 15
bit_size: 1
fieldset/FNR:
description: frame number register
fields:
- name: FN
description: FN
bit_offset: 0
bit_size: 11
- name: LSOF
description: LSOF
bit_offset: 11
bit_size: 2
- name: LCK
description: the frame timer remains in this state until an USB reset or USB suspend event occurs
bit_offset: 13
bit_size: 1
- name: RXDM
description: received data minus upstream port data line
bit_offset: 14
bit_size: 1
- name: RXDP
description: received data plus upstream port data line
bit_offset: 15
bit_size: 1
fieldset/ISTR:
description: interrupt status register
fields:
- name: EP_ID
description: EP_ID
bit_offset: 0
bit_size: 4
- name: DIR
description: DIR
bit_offset: 4
bit_size: 1
enum: DIR
- name: ESOF
description: an SOF packet is expected but not received
bit_offset: 8
bit_size: 1
- name: SOF
description: beginning of a new USB frame and it is set when a SOF packet arrives through the USB bus
bit_offset: 9
bit_size: 1
- name: RESET
description: peripheral detects an active USB RESET signal at its inputs
bit_offset: 10
bit_size: 1
- name: SUSP
description: "no traffic has been received for 3 ms, indicating a suspend mode request from the USB bus"
bit_offset: 11
bit_size: 1
- name: WKUP
description: activity is detected that wakes up the USB peripheral
bit_offset: 12
bit_size: 1
- name: ERR
description: "One of No ANSwer, Cyclic Redundancy Check, Bit Stuffing or Framing format Violation error occurred"
bit_offset: 13
bit_size: 1
- name: PMAOVR
description: microcontroller has not been able to respond in time to an USB memory request
bit_offset: 14
bit_size: 1
- name: CTR
description: endpoint has successfully completed a transaction
bit_offset: 15
bit_size: 1
enum/DIR:
bit_size: 1
variants:
- name: To
description: data transmitted by the USB peripheral to the host PC
value: 0
- name: From
description: data received by the USB peripheral from the host PC
value: 1
enum/EP_TYPE:
bit_size: 2
variants:
- name: Bulk
description: Bulk endpoint
value: 0
- name: Control
description: Control endpoint
value: 1
- name: Iso
description: Iso endpoint
value: 2
- name: Interrupt
description: Interrupt endpoint
value: 3
enum/STAT:
bit_size: 2
variants:
- name: Disabled
description: all requests addressed to this endpoint are ignored
value: 0
- name: Stall
description: the endpoint is stalled and all requests result in a STALL handshake
value: 1
- name: Nak
description: the endpoint is naked and all requests result in a NAK handshake
value: 2
- name: Valid
description: "this endpoint is enabled, requests are ACKed"
value: 3

View File

@ -34,13 +34,6 @@ block/USB:
description: LPM control and status register description: LPM control and status register
byte_offset: 84 byte_offset: 84
fieldset: LPMCSR fieldset: LPMCSR
- name: EP_MEM
description: USB Endpoint memory
array:
len: 1024
stride: 2
byte_offset: 1024
bit_size: 16
fieldset/BTABLE: fieldset/BTABLE:
description: Buffer table address description: Buffer table address
fields: fields:

View File

@ -38,13 +38,6 @@ block/USB:
description: Battery Charging Detector description: Battery Charging Detector
byte_offset: 88 byte_offset: 88
fieldset: BCDR fieldset: BCDR
- name: EP_MEM
description: USB Endpoint memory
array:
len: 1024
stride: 2
byte_offset: 1024
bit_size: 16
fieldset/BCDR: fieldset/BCDR:
description: Battery Charging Detector description: Battery Charging Detector
fields: fields:

View File

@ -34,13 +34,6 @@ block/USB:
description: Battery charging detector description: Battery charging detector
byte_offset: 88 byte_offset: 88
fieldset: BCDR fieldset: BCDR
- name: EP_MEM
description: Endpoint memory
array:
len: 1024
stride: 2
byte_offset: 15360
bit_size: 16
fieldset/BCDR: fieldset/BCDR:
description: Battery charging detector description: Battery charging detector
fields: fields:

View File

@ -0,0 +1,11 @@
---
block/USBRAM:
description: USB Endpoint memory
items:
- name: MEM
description: USB Endpoint memory
array:
len: 256
stride: 4
byte_offset: 0
bit_size: 16

View File

@ -0,0 +1,11 @@
---
block/USBRAM:
description: USB Endpoint memory
items:
- name: MEM
description: USB Endpoint memory
array:
len: 512
stride: 2
byte_offset: 0
bit_size: 16

View File

@ -0,0 +1,11 @@
---
block/USBRAM:
description: USB Endpoint memory
items:
- name: MEM
description: USB Endpoint memory
array:
len: 256
stride: 2
byte_offset: 0
bit_size: 16

View File

@ -0,0 +1,11 @@
---
block/USBRAM:
description: USB Endpoint memory
items:
- name: MEM
description: USB Endpoint memory
array:
len: 512
stride: 4
byte_offset: 0
bit_size: 32

View File

@ -218,14 +218,18 @@ impl PeriMatcher {
(".*:SDMMC:sdmmc_v1_3", ("sdmmc", "v1", "SDMMC")), (".*:SDMMC:sdmmc_v1_3", ("sdmmc", "v1", "SDMMC")),
(".*:SPDIFRX:spdifrx1_v1_0", ("spdifrx", "v1", "SPDIFRX")), (".*:SPDIFRX:spdifrx1_v1_0", ("spdifrx", "v1", "SPDIFRX")),
// # USB // # USB
("STM32F302.[BC].*:USB:.*", ("usb", "v1_x1", "USB")), ("STM32(F1|L1).*:USB:.*", ("usb", "v1", "USB")),
("STM32F302.[68DE].*:USB:.*", ("usb", "v2", "USB")), ("STM32(F1|L1).*:USBRAM:.*", ("usbram", "16x1_512", "USBRAM")),
("STM32F303.[BC].*:USB:.*", ("usb", "v1_x1", "USB")), ("STM32F30[23].[BC].*:USB:.*", ("usb", "v1", "USB")),
("STM32F303.[DE].*:USB:.*", ("usb", "v2", "USB")), ("STM32F30[23].[BC].*:USBRAM:.*", ("usbram", "16x1_512", "USBRAM")),
("STM32F373.*:USB:.*", ("usb", "v1_x2", "USB")), ("STM32F30[23].[68DE].*:USB:.*", ("usb", "v2", "USB")),
("STM32(F1|L1).*:USB:.*", ("usb", "v1_x1", "USB")), ("STM32F30[23].[68DE].*:USBRAM:.*", ("usbram", "16x2_1024", "USBRAM")),
("STM32G0[BC]1.*:USB:.*", ("usb", "v4", "USB")), ("STM32F373.*:USB:.*", ("usb", "v1", "USB")),
(".*:USB:.*", ("usb", "v3", "USB")), ("STM32F373.*:USBRAM:.*", ("usbram", "16x2_512", "USBRAM")),
("STM32(F0|L[045]|G4|WB).*:USB:.*", ("usb", "v3", "USB")),
("STM32(F0|L[045]|G4|WB).*:USBRAM:.*", ("usbram", "16x2_1024", "USBRAM")),
("STM32(G0|H5|U5).*:USB:.*", ("usb", "v4", "USB")),
("STM32(G0|H5|U5).*:USBRAM:.*", ("usbram", "32_2048", "USBRAM")),
// # USB OTG // # USB OTG
(".*:USB_OTG_FS:otgfs1_.*", ("otg", "v1", "OTG")), (".*:USB_OTG_FS:otgfs1_.*", ("otg", "v1", "OTG")),
(".*:USB_OTG_HS:otghs1_.*", ("otg", "v1", "OTG")), (".*:USB_OTG_HS:otghs1_.*", ("otg", "v1", "OTG")),
@ -806,7 +810,7 @@ fn process_core(
const GHOST_PERIS: &[&str] = &[ const GHOST_PERIS: &[&str] = &[
"GPIOA", "GPIOB", "GPIOC", "GPIOD", "GPIOE", "GPIOF", "GPIOG", "GPIOH", "GPIOI", "GPIOJ", "GPIOK", "GPIOL", "GPIOA", "GPIOB", "GPIOC", "GPIOD", "GPIOE", "GPIOF", "GPIOG", "GPIOH", "GPIOI", "GPIOJ", "GPIOK", "GPIOL",
"GPIOM", "GPION", "GPIOO", "GPIOP", "GPIOQ", "GPIOR", "GPIOS", "GPIOT", "DMA1", "DMA2", "BDMA", "DMAMUX", "GPIOM", "GPION", "GPIOO", "GPIOP", "GPIOQ", "GPIOR", "GPIOS", "GPIOT", "DMA1", "DMA2", "BDMA", "DMAMUX",
"DMAMUX1", "DMAMUX2", "SBS", "SYSCFG", "EXTI", "FLASH", "DBGMCU", "CRS", "PWR", "AFIO", "BKP", "DMAMUX1", "DMAMUX2", "SBS", "SYSCFG", "EXTI", "FLASH", "DBGMCU", "CRS", "PWR", "AFIO", "BKP", "USBRAM",
]; ];
for pname in GHOST_PERIS { for pname in GHOST_PERIS {
if let Entry::Vacant(entry) = peri_kinds.entry(pname.to_string()) { if let Entry::Vacant(entry) = peri_kinds.entry(pname.to_string()) {

View File

@ -169,6 +169,10 @@ impl Defines {
("FMC", &["FMC_BASE", "FMC_R_BASE"]), ("FMC", &["FMC_BASE", "FMC_R_BASE"]),
("FSMC", &["FSMC_R_BASE"]), ("FSMC", &["FSMC_R_BASE"]),
("USB", &["USB_BASE", "USB_DRD_BASE", "USB_BASE_NS", "USB_DRD_BASE_NS"]), ("USB", &["USB_BASE", "USB_DRD_BASE", "USB_BASE_NS", "USB_DRD_BASE_NS"]),
(
"USBRAM",
&["USB_PMAADDR", "USB_DRD_PMAADDR", "USB_PMAADDR_NS", "USB_DRD_PMAADDR_NS"],
),
]; ];
let alt_peri_defines: HashMap<_, _> = ALT_PERI_DEFINES.iter().copied().collect(); let alt_peri_defines: HashMap<_, _> = ALT_PERI_DEFINES.iter().copied().collect();