From 6d0865711f890782d3692dd31b13765925146efa Mon Sep 17 00:00:00 2001 From: eZio Pan Date: Thu, 22 Feb 2024 00:20:11 +0800 Subject: [PATCH 1/3] extract --- data/registers/iwdg_v3.yaml | 93 +++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 data/registers/iwdg_v3.yaml diff --git a/data/registers/iwdg_v3.yaml b/data/registers/iwdg_v3.yaml new file mode 100644 index 0000000..af8a18a --- /dev/null +++ b/data/registers/iwdg_v3.yaml @@ -0,0 +1,93 @@ +block/IWDG: + description: Independent watchdog. + items: + - name: KR + description: IWDG key register. + byte_offset: 0 + fieldset: KR + - name: PR + description: IWDG prescaler register. + byte_offset: 4 + fieldset: PR + - name: RLR + description: IWDG reload register. + byte_offset: 8 + fieldset: RLR + - name: SR + description: IWDG status register. + byte_offset: 12 + fieldset: SR + - name: WINR + description: IWDG window register. + byte_offset: 16 + fieldset: WINR + - name: EWCR + description: IWDG early wakeup interrupt register. + byte_offset: 20 + fieldset: EWCR +fieldset/EWCR: + description: IWDG early wakeup interrupt register. + fields: + - name: EWIT + description: 'Watchdog counter window value These bits are write access protected (see ). They are written by software to define at which position of the IWDCNT down-counter the early wakeup interrupt must be generated. The early interrupt is generated when the IWDCNT is lower or equal to EWIT[11:0] - 1. EWIT[11:0] must be bigger than 1. An interrupt is generated only if EWIE = 1. The EWU bit in the must be reset to be able to change the reload value. Note: Reading this register returns the Early wakeup comparator value and the Interrupt enable bit from the VDD voltage domain. This value may not be up to date/valid if a write operation to this register is ongoing, hence the value read from this register is valid only when the EWU bit in the is reset.' + bit_offset: 0 + bit_size: 12 + - name: EWIC + description: Watchdog early interrupt acknowledge The software must write a 1 into this bit in order to acknowledge the early wakeup interrupt and to clear the EWIF flag. Writing 0 has not effect, reading this flag returns a 0. + bit_offset: 14 + bit_size: 1 + - name: EWIE + description: Watchdog early interrupt enable Set and reset by software. The EWU bit in the must be reset to be able to change the value of this bit. + bit_offset: 15 + bit_size: 1 +fieldset/KR: + description: IWDG key register. + fields: + - name: KEY + description: Key value (write only, read 0x0000) These bits must be written by software at regular intervals with the key value 0xAAAA, otherwise the watchdog generates a reset when the counter reaches 0. Writing the key value 0x5555 to enable access to the IWDG_PR, IWDG_RLR and IWDG_WINR registers (see ) Writing the key value 0xCCCC starts the watchdog (except if the hardware watchdog option is selected). + bit_offset: 0 + bit_size: 16 +fieldset/PR: + description: IWDG prescaler register. + fields: + - name: PR + description: 'Prescaler divider These bits are write access protected see . They are written by software to select the prescaler divider feeding the counter clock. PVU bit of the must be reset in order to be able to change the prescaler divider. Others: divider / 1024 Note: Reading this register returns the prescaler value from the VDD voltage domain. This value may not be up to date/valid if a write operation to this register is ongoing. For this reason the value read from this register is valid only when the PVU bit in the status register (IWDG_SR) is reset.' + bit_offset: 0 + bit_size: 4 +fieldset/RLR: + description: IWDG reload register. + fields: + - name: RL + description: 'Watchdog counter reload value These bits are write access protected see . They are written by software to define the value to be loaded in the watchdog counter each time the value 0xAAAA is written in the . The watchdog counter counts down from this value. The timeout period is a function of this value and the prescaler.clock. It is not recommended to set RL[11:0] to a value lower than 2. The RVU bit in the must be reset to be able to change the reload value. Note: Reading this register returns the reload value from the VDD voltage domain. This value may not be up to date/valid if a write operation to this register is ongoing on it. For this reason the value read from this register is valid only when the RVU bit in the status register (IWDG_SR) is reset.' + bit_offset: 0 + bit_size: 12 +fieldset/SR: + description: IWDG status register. + fields: + - name: PVU + description: Watchdog prescaler value update This bit is set by hardware to indicate that an update of the prescaler value is ongoing. It is reset by hardware when the prescaler update operation is completed in the VDD voltage domain (takes up to three periods of the IWDG kernel clock iwdg_ker_ck). The prescaler value can be updated only when PVU bit is reset. + bit_offset: 0 + bit_size: 1 + - name: RVU + description: Watchdog counter reload value update This bit is set by hardware to indicate that an update of the reload value is ongoing. It is reset by hardware when the reload value update operation is completed in the VDD voltage domain (takes up to three periods of the IWDG kernel clock iwdg_ker_ck). The reload value can be updated only when RVU bit is reset. + bit_offset: 1 + bit_size: 1 + - name: WVU + description: Watchdog counter window value update This bit is set by hardware to indicate that an update of the window value is ongoing. It is reset by hardware when the reload value update operation is completed in the VDD voltage domain (takes up to three periods of the IWDG kernel clock iwdg_ker_ck). The window value can be updated only when WVU bit is reset. This bit is generated only if generic “window” = 1. + bit_offset: 2 + bit_size: 1 + - name: EWU + description: Watchdog interrupt comparator value update This bit is set by hardware to indicate that an update of the interrupt comparator value (EWIT[11:0]) or an update of the EWIE is ongoing. It is reset by hardware when the update operation is completed in the VDD voltage domain (takes up to three periods of the IWDG kernel clock iwdg_ker_ck). The EWIT[11:0] and EWIE fields can be updated only when EWU bit is reset. + bit_offset: 3 + bit_size: 1 + - name: EWIF + description: Watchdog early interrupt flag This bit is set to ‘1’ by hardware in order to indicate that an early interrupt is pending. This bit must be cleared by the software by writing the bit EWIC of IWDG_EWCR register to ‘1’. + bit_offset: 14 + bit_size: 1 +fieldset/WINR: + description: IWDG window register. + fields: + - name: WIN + description: 'Watchdog counter window value These bits are write access protected, see , they contain the high limit of the window value to be compared with the downcounter. To prevent a reset, the IWDCNT downcounter must be reloaded when its value is lower than WIN[11:0]+1 and greater than 1. The WVU bit in the must be reset to be able to change the reload value. Note: Reading this register returns the reload value from the VDD voltage domain. This value may not be valid if a write operation to this register is ongoing. For this reason the value read from this register is valid only when the WVU bit in the (IWDG_SR) is reset.' + bit_offset: 0 + bit_size: 12 From 9ea25e944dae38d725c36bd5ed5c0dd81a7b36bb Mon Sep 17 00:00:00 2001 From: eZio Pan Date: Thu, 22 Feb 2024 00:21:28 +0800 Subject: [PATCH 2/3] copy and check desc and variant from v2 --- data/registers/iwdg_v3.yaml | 80 ++++++++++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 18 deletions(-) diff --git a/data/registers/iwdg_v3.yaml b/data/registers/iwdg_v3.yaml index af8a18a..c959d5e 100644 --- a/data/registers/iwdg_v3.yaml +++ b/data/registers/iwdg_v3.yaml @@ -1,24 +1,24 @@ block/IWDG: - description: Independent watchdog. + description: Independent watchdog items: - name: KR - description: IWDG key register. + description: Key register byte_offset: 0 fieldset: KR - name: PR - description: IWDG prescaler register. + description: Prescaler register byte_offset: 4 fieldset: PR - name: RLR - description: IWDG reload register. + description: Reload register byte_offset: 8 fieldset: RLR - name: SR - description: IWDG status register. + description: Status register byte_offset: 12 fieldset: SR - name: WINR - description: IWDG window register. + description: Window register byte_offset: 16 fieldset: WINR - name: EWCR @@ -41,39 +41,41 @@ fieldset/EWCR: bit_offset: 15 bit_size: 1 fieldset/KR: - description: IWDG key register. + description: Key register fields: - name: KEY - description: Key value (write only, read 0x0000) These bits must be written by software at regular intervals with the key value 0xAAAA, otherwise the watchdog generates a reset when the counter reaches 0. Writing the key value 0x5555 to enable access to the IWDG_PR, IWDG_RLR and IWDG_WINR registers (see ) Writing the key value 0xCCCC starts the watchdog (except if the hardware watchdog option is selected). + description: Key value (write only, read 0000h) bit_offset: 0 bit_size: 16 + enum: KEY fieldset/PR: - description: IWDG prescaler register. + description: Prescaler register fields: - name: PR - description: 'Prescaler divider These bits are write access protected see . They are written by software to select the prescaler divider feeding the counter clock. PVU bit of the must be reset in order to be able to change the prescaler divider. Others: divider / 1024 Note: Reading this register returns the prescaler value from the VDD voltage domain. This value may not be up to date/valid if a write operation to this register is ongoing. For this reason the value read from this register is valid only when the PVU bit in the status register (IWDG_SR) is reset.' + description: Prescaler divider bit_offset: 0 bit_size: 4 + enum: PR fieldset/RLR: - description: IWDG reload register. + description: Reload register fields: - name: RL - description: 'Watchdog counter reload value These bits are write access protected see . They are written by software to define the value to be loaded in the watchdog counter each time the value 0xAAAA is written in the . The watchdog counter counts down from this value. The timeout period is a function of this value and the prescaler.clock. It is not recommended to set RL[11:0] to a value lower than 2. The RVU bit in the must be reset to be able to change the reload value. Note: Reading this register returns the reload value from the VDD voltage domain. This value may not be up to date/valid if a write operation to this register is ongoing on it. For this reason the value read from this register is valid only when the RVU bit in the status register (IWDG_SR) is reset.' + description: Watchdog counter reload value bit_offset: 0 bit_size: 12 fieldset/SR: - description: IWDG status register. + description: Status register fields: - name: PVU - description: Watchdog prescaler value update This bit is set by hardware to indicate that an update of the prescaler value is ongoing. It is reset by hardware when the prescaler update operation is completed in the VDD voltage domain (takes up to three periods of the IWDG kernel clock iwdg_ker_ck). The prescaler value can be updated only when PVU bit is reset. + description: Watchdog prescaler value update bit_offset: 0 bit_size: 1 - name: RVU - description: Watchdog counter reload value update This bit is set by hardware to indicate that an update of the reload value is ongoing. It is reset by hardware when the reload value update operation is completed in the VDD voltage domain (takes up to three periods of the IWDG kernel clock iwdg_ker_ck). The reload value can be updated only when RVU bit is reset. + description: Watchdog counter reload value update bit_offset: 1 bit_size: 1 - name: WVU - description: Watchdog counter window value update This bit is set by hardware to indicate that an update of the window value is ongoing. It is reset by hardware when the reload value update operation is completed in the VDD voltage domain (takes up to three periods of the IWDG kernel clock iwdg_ker_ck). The window value can be updated only when WVU bit is reset. This bit is generated only if generic “window” = 1. + description: Watchdog counter window value update bit_offset: 2 bit_size: 1 - name: EWU @@ -85,9 +87,51 @@ fieldset/SR: bit_offset: 14 bit_size: 1 fieldset/WINR: - description: IWDG window register. + description: Window register fields: - name: WIN - description: 'Watchdog counter window value These bits are write access protected, see , they contain the high limit of the window value to be compared with the downcounter. To prevent a reset, the IWDCNT downcounter must be reloaded when its value is lower than WIN[11:0]+1 and greater than 1. The WVU bit in the must be reset to be able to change the reload value. Note: Reading this register returns the reload value from the VDD voltage domain. This value may not be valid if a write operation to this register is ongoing. For this reason the value read from this register is valid only when the WVU bit in the (IWDG_SR) is reset.' + description: Watchdog counter window value bit_offset: 0 bit_size: 12 +enum/KEY: + bit_size: 16 + variants: + - name: Enable + description: Enable access to PR, RLR and WINR registers (0x5555) + value: 21845 + - name: Reset + description: Reset the watchdog value (0xAAAA) + value: 43690 + - name: Start + description: Start the watchdog (0xCCCC) + value: 52428 +enum/PR: + bit_size: 4 + variants: + - name: DivideBy4 + description: Divider /4 + value: 0 + - name: DivideBy8 + description: Divider /8 + value: 1 + - name: DivideBy16 + description: Divider /16 + value: 2 + - name: DivideBy32 + description: Divider /32 + value: 3 + - name: DivideBy64 + description: Divider /64 + value: 4 + - name: DivideBy128 + description: Divider /128 + value: 5 + - name: DivideBy256 + description: Divider /256 + value: 6 + - name: DivideBy512 + description: Divider /512 + value: 7 + - name: DivideBy1024 + description: Divider /1024 + value: 8 From 76f2e02ea8042ebca9cdef18411f5289dc7d1157 Mon Sep 17 00:00:00 2001 From: eZio Pan Date: Thu, 22 Feb 2024 00:23:24 +0800 Subject: [PATCH 3/3] add to chips.rs --- stm32-data-gen/src/chips.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/stm32-data-gen/src/chips.rs b/stm32-data-gen/src/chips.rs index b1c9b17..f700caa 100644 --- a/stm32-data-gen/src/chips.rs +++ b/stm32-data-gen/src/chips.rs @@ -244,6 +244,7 @@ impl PeriMatcher { ("STM32H5.*:SBS:.*", ("syscfg", "h5", "SYSCFG")), (".*:IWDG:iwdg1_v1_1", ("iwdg", "v1", "IWDG")), (".*:IWDG:iwdg1_v2_0", ("iwdg", "v2", "IWDG")), + (".*:IWDG:iwdg1_v3_0", ("iwdg", "v3", "IWDG")), (".*:WWDG:wwdg1_v1_0", ("wwdg", "v1", "WWDG")), (".*:WWDG:wwdg1_v2_0", ("wwdg", "v2", "WWDG")), (".*:JPEG:jpeg1_v1_0", ("jpeg", "v1", "JPEG")),