📄 stm32f10x_tim1.lst
字号:
165 /* Alias word address of CC4E bit */
166 #define CC4E_BitNumber 0x0C
167 #define CCER_CC4E_BB (PERIPH_BB_BASE + (CCER_OFFSET * 32) + (CC4E_BitNumber * 4))
168
169 /* Alias word address of CC4P bit */
170 #define CC4P_BitNumber 0x0D
171 #define CCER_CC4P_BB (PERIPH_BB_BASE + (CCER_OFFSET * 32) + (CC4P_BitNumber * 4))
172
173 /* --- TIM1 BDTR Register --- */
174 /* Alias word address of MOE bit */
175 #define BDTR_OFFSET (TIM1_OFFSET + 0x44)
176 #define MOE_BitNumber 0x0F
177 #define BDTR_MOE_BB (PERIPH_BB_BASE + (BDTR_OFFSET * 32) + (MOE_BitNumber * 4))
178
179 /* --- TIM1 CCMR1 Register --- */
180 /* Alias word address of OC1FE bit */
181 #define CCMR1_OFFSET (TIM1_OFFSET + 0x18)
182 #define OC1FE_BitNumber 0x02
183 #define CCMR1_OC1FE_BB (PERIPH_BB_BASE + (CCMR1_OFFSET * 32) + (OC1FE_BitNumber * 4))
184
185 /* Alias word address of OC1PE bit */
186 #define OC1PE_BitNumber 0x03
187 #define CCMR1_OC1PE_BB (PERIPH_BB_BASE + (CCMR1_OFFSET * 32) + (OC1PE_BitNumber * 4))
188
189 /* Alias word address of OC1CE bit */
190 #define OC1CE_BitNumber 0x07
191 #define CCMR1_OC1CE_BB (PERIPH_BB_BASE + (CCMR1_OFFSET * 32) + (OC1CE_BitNumber * 4))
192
193 /* Alias word address of OC2FE bit */
194 #define OC2FE_BitNumber 0x0A
195 #define CCMR1_OC2FE_BB (PERIPH_BB_BASE + (CCMR1_OFFSET * 32) + (OC2FE_BitNumber * 4))
196
197 /* Alias word address of OC2PE bit */
198 #define OC2PE_BitNumber 0x0B
199 #define CCMR1_OC2PE_BB (PERIPH_BB_BASE + (CCMR1_OFFSET * 32) + (OC2PE_BitNumber * 4))
200
201 /* Alias word address of OC2CE bit */
202 #define OC2CE_BitNumber 0x0F
203 #define CCMR1_OC2CE_BB (PERIPH_BB_BASE + (CCMR1_OFFSET * 32) + (OC2CE_BitNumber * 4))
204
205 /* --- TIM1 CCMR2 Register ---- */
206 /* Alias word address of OC3FE bit */
207 #define CCMR2_OFFSET (TIM1_OFFSET + 0x1C)
208 #define OC3FE_BitNumber 0x02
209 #define CCMR2_OC3FE_BB (PERIPH_BB_BASE + (CCMR2_OFFSET * 32) + (OC3FE_BitNumber * 4))
210
211 /* Alias word address of OC3PE bit */
212 #define OC3PE_BitNumber 0x03
213 #define CCMR2_OC3PE_BB (PERIPH_BB_BASE + (CCMR2_OFFSET * 32) + (OC3PE_BitNumber * 4))
214
215 /* Alias word address of OC3CE bit */
216 #define OC3CE_BitNumber 0x07
217 #define CCMR2_OC3CE_BB (PERIPH_BB_BASE + (CCMR2_OFFSET * 32) + (OC3CE_BitNumber * 4))
218
219 /* Alias word address of OC4FE bit */
220 #define OC4FE_BitNumber 0x0A
221 #define CCMR2_OC4FE_BB (PERIPH_BB_BASE + (CCMR2_OFFSET * 32) + (OC4FE_BitNumber * 4))
222
223 /* Alias word address of OC4PE bit */
224 #define OC4PE_BitNumber 0x0B
225 #define CCMR2_OC4PE_BB (PERIPH_BB_BASE + (CCMR2_OFFSET * 32) + (OC4PE_BitNumber * 4))
226
227 /* Alias word address of OC4CE bit */
228 #define OC4CE_BitNumber 0x0F
229 #define CCMR2_OC4CE_BB (PERIPH_BB_BASE + (CCMR2_OFFSET * 32) + (OC4CE_BitNumber * 4))
230
231 /* --------------------- TIM1 registers bit mask ------------------------- */
232 /* TIM1 CR1 Mask */
233 #define CR1_CounterMode_Mask ((u16)0x039F)
234 #define CR1_CKD_Mask ((u16)0x00FF)
235
236 /* TIM1 CR2 Mask */
237 #define CR2_MMS_Mask ((u16)0x0080)
238
239 /* TIM1 SMCR Mask */
240 #define SMCR_SMS_Mask ((u16)0xFFF0)
241 #define SMCR_ETR_Mask ((u16)0x40F7)
242 #define SMCR_TS_Mask ((u16)0xFF87)
243 #define SMCR_ECE_Set ((u16)0x0001)
244
245 /* TIM1 CCMRx Mask */
246 #define CCMR_CC13S_Mask ((u16)0xFFFC)
247 #define CCMR_CC24S_Mask ((u16)0xFCFF)
248 #define CCMR_TI13Direct_Set ((u16)0x0001)
249 #define CCMR_TI24Direct_Set ((u16)0x0100)
250 #define CCMR_OCM13_Mask ((u16)0x7F0F)
251 #define CCMR_OCM24_Mask ((u16)0x0F7F)
252 #define CCMR_IC13PSC_Mask ((u16)0xFFF3)
253 #define CCMR_IC24PSC_Mask ((u16)0xF3FF)
254 #define CCMR_IC13F_Mask ((u16)0xFF0F)
255 #define CCMR_IC24F_Mask ((u16)0x0FFF)
256 #define OC13Mode_Mask ((u16)0xFF00)
257 #define OC24Mode_Mask ((u16)0x00FF)
258
259 /* TIM1 CCER Set/Reset Bit */
260 #define CCER_CCE_Set ((u16)0x0001)
261 #define CCER_CCE_Reset ((u16)0x0000)
262
263 /* TIM1 DMA Mask */
264 #define DCR_DMA_Mask ((u16)0x0000)
265
266 /* TIM1 private Masks */
267 #define TIM1_Period_Reset_Mask ((u16)0xFFFF)
268 #define TIM1_Prescaler_Reset_Mask ((u16)0x0000)
269 #define TIM1_RepetitionCounter_Reset_Mask ((u16)0x0000)
270 #define TIM1_Pulse_Reset_Mask ((u16)0x0000)
271 #define TIM1_ICFilter_Mask ((u8)0x00)
272 #define TIM1_DeadTime_Reset_Mask ((u16)0x0000)
273
274 /* Private macro -------------------------------------------------------------*/
275 /* Private variables ---------------------------------------------------------*/
276 /* Private function prototypes -----------------------------------------------*/
277 static void TI1_Config(u16 TIM1_ICPolarity, u16 TIM1_ICSelection,
278 u8 TIM1_ICFilter);
279 static void TI2_Config(u16 TIM1_ICPolarity, u16 TIM1_ICSelection,
280 u8 TIM1_ICFilter);
281 static void TI3_Config(u16 TIM1_ICPolarity, u16 TIM1_ICSelection,
282 u8 TIM1_ICFilter);
283 static void TI4_Config(u16 TIM1_ICPolarity, u16 TIM1_ICSelection,
284 u8 TIM1_ICFilter);
285
286 /*******************************************************************************
287 * Function Name : TIM1_DeInit
288 * Description : Deinitializes the TIM1 peripheral registers to their default
289 * reset values.
290 * Input : None
291 * Output : None
292 * Return : None
293 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
294 void TIM1_DeInit(void)
295 {
\ TIM1_DeInit:
\ 00000000 00B5 PUSH {LR}
296 RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, ENABLE);
\ 00000002 0121 MOVS R1,#+1
\ 00000004 C802 LSLS R0,R1,#+11
\ 00000006 ........ _BLF RCC_APB2PeriphResetCmd,??RCC_APB2PeriphResetCmd??rT
297 RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, DISABLE);
\ 0000000A 0021 MOVS R1,#+0
\ 0000000C 5FF40060 MOVS R0,#+2048
\ 00000010 ........ _BLF RCC_APB2PeriphResetCmd,??RCC_APB2PeriphResetCmd??rT
298 }
\ 00000014 00BD POP {PC} ;; return
299
300 /*******************************************************************************
301 * Function Name : TIM1_TimeBaseInit
302 * Description : Initializes the TIM1 Time Base Unit according to the specified
303 * parameters in the TIM1_TimeBaseInitStruct.
304 * Input : - TIM1_TimeBaseInitStruct: pointer to a TIM1_TimeBaseInitTypeDef
305 * structure that contains the configuration information for
306 * the specified TIM1 peripheral.
307 * Output : None
308 * Return : None
309 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
310 void TIM1_TimeBaseInit(TIM1_TimeBaseInitTypeDef* TIM1_TimeBaseInitStruct)
311 {
\ TIM1_TimeBaseInit:
\ 00000000 10B5 PUSH {R4,LR}
312 /* Check the parameters */
313 assert(IS_TIM1_COUNTER_MODE(TIM1_TimeBaseInitStruct->TIM1_CounterMode));
314 assert(IS_TIM1_CKD_DIV(TIM1_TimeBaseInitStruct->TIM1_ClockDivision));
315
316 /* Set the Autoreload value */
317 TIM1->ARR = TIM1_TimeBaseInitStruct->TIM1_Period ;
\ 00000002 .... LDR.N R1,??DataTable0 ;; 0x40012c2c
\ 00000004 8288 LDRH R2,[R0, #+4]
\ 00000006 0A80 STRH R2,[R1, #+0]
318
319 /* Set the Prescaler value */
320 TIM1->PSC = TIM1_TimeBaseInitStruct->TIM1_Prescaler;
\ 00000008 091F SUBS R1,R1,#+4
\ 0000000A 0288 LDRH R2,[R0, #+0]
\ 0000000C 0A80 STRH R2,[R1, #+0]
321
322 /* Select the Counter Mode and set the clock division */
323 TIM1->CR1 &= CR1_CKD_Mask & CR1_CounterMode_Mask;
\ 0000000E 2839 SUBS R1,R1,#+40
\ 00000010 0A88 LDRH R2,[R1, #+0]
\ 00000012 12F09F02 ANDS R2,R2,#0x9F
\ 00000016 0A80 STRH R2,[R1, #+0]
324 TIM1->CR1 |= (u32)TIM1_TimeBaseInitStruct->TIM1_ClockDivision |
325 TIM1_TimeBaseInitStruct->TIM1_CounterMode;
\ 00000018 0A88 LDRH R2,[R1, #+0]
\ 0000001A C388 LDRH R3,[R0, #+6]
\ 0000001C 4488 LDRH R4,[R0, #+2]
\ 0000001E 1C43 ORRS R4,R4,R3
\ 00000020 1443 ORRS R4,R4,R2
\ 00000022 0C80 STRH R4,[R1, #+0]
326
327 /* Set the Repetition Counter value */
328 TIM1->RCR = TIM1_TimeBaseInitStruct->TIM1_RepetitionCounter;
\ 00000024 3031 ADDS R1,R1,#+48
\ 00000026 007A LDRB R0,[R0, #+8]
\ 00000028 0880 STRH R0,[R1, #+0]
329 }
\ 0000002A 10BD POP {R4,PC} ;; return
330
331 /*******************************************************************************
332 * Function Name : TIM1_OC1Init
333 * Description : Initializes the TIM1 Channel1 according to the specified
334 * parameters in the TIM1_OCInitStruct.
335 * Input : - TIM1_OCInitStruct: pointer to a TIM1_OCInitTypeDef structure that
336 * contains the configuration information for the TIM1 peripheral.
337 * Output : None
338 * Return : None
339 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
340 void TIM1_OC1Init(TIM1_OCInitTypeDef* TIM1_OCInitStruct)
341 {
\ TIM1_OC1Init:
\ 00000000 10B5 PUSH {R4,LR}
342 u16 tmpccmr = 0;
343
344 /* Check the parameters */
345 assert(IS_TIM1_OC_MODE(TIM1_OCInitStruct->TIM1_OCMode));
346 assert(IS_TIM1_OUTPUT_STATE(TIM1_OCInitStruct->TIM1_OutputState));
347 assert(IS_TIM1_OUTPUTN_STATE(TIM1_OCInitStruct->TIM1_OutputNState));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -