18.3.2.2 Use Model 2: 64-Bit Mode
To generate a 30 second delay with a 100 MHz clock using a 64-bit Timer in One-shot mode:
- Initialize the Timer for One-shot mode using MSS_TIM64_init(MSS_TIMER_ONE_SHOT_MODE).
- Use MSS_TIM64_load_immediate(load_value)
to load required time period.For 30 seconds delay load value calculation:
- For 100 MHz, clock period is 0.01 µs
- Number of counts for 30 second delay is 30/0.01 µs equal to 3000 x 106 (B2D05E00 in hexadecimal).
- MSS_TIM1_load_immediate(0x B2D05E00)
- Enable 64-bit Timer interrupt using MSS_TIM64_enable_irq().
- Start the Timer using MSS_TIM64_start().
- Whenever counter reaches zero, it generates an interrupt.
- Clear the interrupt using MSS_TIM64_clear_irq() and stop the Timer MSS_TIM64_stop().