@@ -54,17 +54,43 @@ macro_rules! bus {
5454 }
5555}
5656
57+ macro_rules! dbgstop {
58+ ( $( $PER: ident => ( $bit: literal) , ) +) => {
59+ $(
60+ impl StopInDebug for crate :: pac:: $PER {
61+ #[ inline( always) ]
62+ fn stop_in_debug( & mut self , dbg: & mut DBGMCU , state: bool ) {
63+ unsafe {
64+ bb:: write( dbg. cr( ) , $bit, state) ;
65+ }
66+ }
67+ }
68+ ) +
69+ }
70+ }
71+
5772#[ cfg( feature = "stm32f103" ) ]
5873bus ! {
5974 ADC2 => ( APB2 , 10 ) ,
6075 CAN => ( APB1 , 25 ) ,
6176}
77+ #[ cfg( feature = "stm32f103" ) ]
78+ dbgstop ! {
79+ CAN => ( 14 ) , // dbg_can1_stop
80+ }
81+
6282#[ cfg( feature = "connectivity" ) ]
6383bus ! {
6484 ADC2 => ( APB2 , 10 ) ,
6585 CAN1 => ( APB1 , 25 ) ,
6686 CAN2 => ( APB1 , 26 ) ,
6787}
88+ #[ cfg( feature = "connectivity" ) ]
89+ dbgstop ! {
90+ CAN1 => ( 14 ) , // dbg_can1_stop
91+ CAN2 => ( 21 ) , // dbg_can2_stop
92+ }
93+
6894#[ cfg( feature = "has-dac" ) ]
6995bus ! {
7096 DAC => ( APB1 , 29 ) ,
@@ -94,6 +120,12 @@ bus! {
94120 USART3 => ( APB1 , 18 ) ,
95121 WWDG => ( APB1 , 11 ) ,
96122}
123+ dbgstop ! {
124+ IWDG => ( 8 ) , // dbg_iwdg_stop
125+ WWDG => ( 9 ) , // dbg_wwdg_stop
126+ I2C1 => ( 15 ) , // dbg_i2c1_smbus_timeout
127+ I2C2 => ( 16 ) , // dbg_i2c2_smbus_timeout
128+ }
97129
98130#[ cfg( any( feature = "xl" , feature = "high" ) ) ]
99131bus ! {
@@ -130,16 +162,28 @@ bus! {
130162 TIM2 => ( APB1 , 0 ) ,
131163 TIM3 => ( APB1 , 1 ) ,
132164}
165+ dbgstop ! {
166+ TIM2 => ( 11 ) , // dbg_tim2_stop
167+ TIM3 => ( 12 ) , // dbg_tim3_stop
168+ }
133169
134170#[ cfg( any( feature = "stm32f100" , feature = "stm32f103" , feature = "connectivity" ) ) ]
135171bus ! {
136172 TIM1 => ( APB2 , 11 ) ,
137173}
174+ #[ cfg( any( feature = "stm32f100" , feature = "stm32f103" , feature = "connectivity" ) ) ]
175+ dbgstop ! {
176+ TIM1 => ( 10 ) , // dbg_tim1_stop
177+ }
138178
139179#[ cfg( any( feature = "stm32f100" , feature = "high" , feature = "connectivity" ) ) ]
140180bus ! {
141181 TIM6 => ( APB1 , 4 ) ,
142182}
183+ #[ cfg( any( feature = "stm32f100" , feature = "high" , feature = "connectivity" ) ) ]
184+ dbgstop ! {
185+ TIM6 => ( 19 ) , // dbg_tim6_stop
186+ }
143187
144188#[ cfg( any(
145189 all( feature = "high" , any( feature = "stm32f101" , feature = "stm32f103" ) ) ,
@@ -148,42 +192,79 @@ bus! {
148192bus ! {
149193 TIM7 => ( APB1 , 5 ) ,
150194}
195+ #[ cfg( any(
196+ all( feature = "high" , any( feature = "stm32f101" , feature = "stm32f103" ) ) ,
197+ any( feature = "stm32f100" , feature = "connectivity" )
198+ ) ) ]
199+ dbgstop ! {
200+ TIM7 => ( 20 ) , // dbg_tim7_stop
201+ }
151202
152203#[ cfg( feature = "stm32f100" ) ]
153204bus ! {
154205 TIM15 => ( APB2 , 16 ) ,
155206 TIM16 => ( APB2 , 17 ) ,
156207 TIM17 => ( APB2 , 18 ) ,
157208}
209+ #[ cfg( feature = "stm32f100" ) ]
210+ dbgstop ! {
211+ TIM15 => ( 22 ) , // dbg_tim15_stop
212+ TIM16 => ( 23 ) , // dbg_tim16_stop
213+ TIM17 => ( 24 ) , // dbg_tim17_stop
214+ }
158215
159216#[ cfg( feature = "medium" ) ]
160217bus ! {
161218 TIM4 => ( APB1 , 2 ) ,
162219}
220+ #[ cfg( feature = "medium" ) ]
221+ dbgstop ! {
222+ TIM4 => ( 13 ) , // dbg_tim4_stop
223+ }
163224
164225#[ cfg( any( feature = "high" , feature = "connectivity" ) ) ]
165226bus ! {
166227 TIM5 => ( APB1 , 3 ) ,
167228}
229+ #[ cfg( any( feature = "high" , feature = "connectivity" ) ) ]
230+ dbgstop ! {
231+ TIM5 => ( 18 ) , // dbg_tim5_stop
232+ }
168233
169234#[ cfg( any( feature = "xl" , all( feature = "stm32f100" , feature = "high" ) ) ) ]
170235bus ! {
171236 TIM12 => ( APB1 , 6 ) ,
172237 TIM13 => ( APB1 , 7 ) ,
173238 TIM14 => ( APB1 , 8 ) ,
174239}
240+ #[ cfg( any( feature = "xl" , all( feature = "stm32f100" , feature = "high" ) ) ) ]
241+ dbgstop ! {
242+ TIM12 => ( 25 ) , // dbg_tim12_stop
243+ TIM13 => ( 26 ) , // dbg_tim13_stop
244+ TIM14 => ( 27 ) , // dbg_tim14_stop
245+ }
175246
176247#[ cfg( all( feature = "stm32f103" , feature = "high" ) ) ]
177248bus ! {
178249 TIM8 => ( APB2 , 13 ) ,
179250}
251+ #[ cfg( all( feature = "stm32f103" , feature = "high" ) ) ]
252+ dbgstop ! {
253+ TIM8 => ( 17 ) , // dbg_tim8_stop
254+ }
180255
181256#[ cfg( feature = "xl" ) ]
182257bus ! {
183258 TIM9 => ( APB2 , 19 ) ,
184259 TIM10 => ( APB2 , 20 ) ,
185260 TIM11 => ( APB2 , 21 ) ,
186261}
262+ #[ cfg( feature = "xl" ) ]
263+ dbgstop ! {
264+ TIM9 => ( 28 ) , // dbg_tim9_stop
265+ TIM10 => ( 29 ) , // dbg_tim10_stop
266+ TIM11 => ( 30 ) , // dbg_tim11_stop
267+ }
187268
188269#[ cfg( feature = "stm32f103" ) ] // feature = "stm32f102"
189270bus ! {
0 commit comments