@@ -138,32 +138,32 @@ void common_rtc_init(void)
138
138
// events will be enabled or disabled as needed (such approach is more
139
139
// energy efficient).
140
140
nrf_rtc_int_enable (COMMON_RTC_INSTANCE ,
141
- #if DEVICE_LOWPOWERTIMER
142
- LP_TICKER_INT_MASK |
143
- #endif
144
- US_TICKER_INT_MASK |
145
- NRF_RTC_INT_OVERFLOW_MASK );
141
+ #if DEVICE_LOWPOWERTIMER
142
+ LP_TICKER_INT_MASK |
143
+ #endif
144
+ US_TICKER_INT_MASK |
145
+ NRF_RTC_INT_OVERFLOW_MASK );
146
146
147
147
// This event is enabled permanently, since overflow indications are needed
148
148
// continuously.
149
149
nrf_rtc_event_enable (COMMON_RTC_INSTANCE , NRF_RTC_INT_OVERFLOW_MASK );
150
150
// All other relevant events are initially disabled.
151
151
nrf_rtc_event_disable (COMMON_RTC_INSTANCE ,
152
- #if defined(TARGET_MCU_NRF51822 )
153
- OS_TICK_INT_MASK |
154
- #endif
155
- #if DEVICE_LOWPOWERTIMER
156
- LP_TICKER_INT_MASK |
157
- #endif
158
- US_TICKER_INT_MASK );
152
+ #if defined(TARGET_MCU_NRF51822 )
153
+ OS_TICK_INT_MASK |
154
+ #endif
155
+ #if DEVICE_LOWPOWERTIMER
156
+ LP_TICKER_INT_MASK |
157
+ #endif
158
+ US_TICKER_INT_MASK );
159
159
160
160
nrf_drv_common_irq_enable (nrf_drv_get_IRQn (COMMON_RTC_INSTANCE ),
161
161
#ifdef NRF51
162
- APP_IRQ_PRIORITY_LOW
162
+ APP_IRQ_PRIORITY_LOW
163
163
#elif defined(NRF52 ) || defined(NRF52840_XXAA )
164
- APP_IRQ_PRIORITY_LOWEST
164
+ APP_IRQ_PRIORITY_LOWEST
165
165
#endif
166
- );
166
+ );
167
167
168
168
nrf_rtc_task_trigger (COMMON_RTC_INSTANCE , NRF_RTC_TASK_START );
169
169
@@ -311,7 +311,9 @@ static uint32_t previous_tick_cc_value = 0;
311
311
*/
312
312
MBED_WEAK uint32_t const os_trv ;
313
313
MBED_WEAK uint32_t const os_clockrate ;
314
- MBED_WEAK void OS_Tick_Handler () { }
314
+ MBED_WEAK void OS_Tick_Handler (void )
315
+ {
316
+ }
315
317
316
318
317
319
#if defined (__CC_ARM ) /* ARMCC Compiler */
@@ -452,7 +454,8 @@ __stackless __task void COMMON_RTC_IRQ_HANDLER(void)
452
454
* Return the next number of clock cycle needed for the next tick.
453
455
* @note This function has been carrefuly optimized for a systick occuring every 1000us.
454
456
*/
455
- static uint32_t get_next_tick_cc_delta () {
457
+ static uint32_t get_next_tick_cc_delta ()
458
+ {
456
459
uint32_t delta = 0 ;
457
460
458
461
if (os_clockrate != 1000 ) {
@@ -488,7 +491,8 @@ static uint32_t get_next_tick_cc_delta() {
488
491
return delta ;
489
492
}
490
493
491
- static inline void clear_tick_interrupt () {
494
+ static inline void clear_tick_interrupt ()
495
+ {
492
496
nrf_rtc_event_clear (COMMON_RTC_INSTANCE , OS_TICK_EVENT );
493
497
nrf_rtc_event_disable (COMMON_RTC_INSTANCE , OS_TICK_INT_MASK );
494
498
}
@@ -500,7 +504,8 @@ static inline void clear_tick_interrupt() {
500
504
* @param val value to check
501
505
* @return true if the value is included in the range and false otherwise.
502
506
*/
503
- static inline bool is_in_wrapped_range (uint32_t begin , uint32_t end , uint32_t val ) {
507
+ static inline bool is_in_wrapped_range (uint32_t begin , uint32_t end , uint32_t val )
508
+ {
504
509
// regular case, begin < end
505
510
// return true if begin <= val < end
506
511
if (begin < end ) {
@@ -524,7 +529,8 @@ static inline bool is_in_wrapped_range(uint32_t begin, uint32_t end, uint32_t va
524
529
/**
525
530
* Register the next tick.
526
531
*/
527
- static void register_next_tick () {
532
+ static void register_next_tick ()
533
+ {
528
534
previous_tick_cc_value = nrf_rtc_cc_get (COMMON_RTC_INSTANCE , OS_TICK_CC_CHANNEL );
529
535
uint32_t delta = get_next_tick_cc_delta ();
530
536
uint32_t new_compare_value = (previous_tick_cc_value + delta ) & MAX_RTC_COUNTER_VAL ;
@@ -583,8 +589,9 @@ void os_tick_irqack(void)
583
589
* @note This function is exposed by RTX kernel.
584
590
* @return 1 if the timer has overflowed and 0 otherwise.
585
591
*/
586
- uint32_t os_tick_ovf (void ) {
587
- uint32_t current_counter = nrf_rtc_counter_get (COMMON_RTC_INSTANCE );
592
+ uint32_t os_tick_ovf (void )
593
+ {
594
+ uint32_t current_counter = nrf_rtc_counter_get (COMMON_RTC_INSTANCE );
588
595
uint32_t next_tick_cc_value = nrf_rtc_cc_get (COMMON_RTC_INSTANCE , OS_TICK_CC_CHANNEL );
589
596
590
597
return is_in_wrapped_range (previous_tick_cc_value , next_tick_cc_value , current_counter ) ? 0 : 1 ;
@@ -599,8 +606,9 @@ uint32_t os_tick_ovf(void) {
599
606
* descending order, even if the internal counter used is an ascending one.
600
607
* @return the value of the alternative hardware timer.
601
608
*/
602
- uint32_t os_tick_val (void ) {
603
- uint32_t current_counter = nrf_rtc_counter_get (COMMON_RTC_INSTANCE );
609
+ uint32_t os_tick_val (void )
610
+ {
611
+ uint32_t current_counter = nrf_rtc_counter_get (COMMON_RTC_INSTANCE );
604
612
uint32_t next_tick_cc_value = nrf_rtc_cc_get (COMMON_RTC_INSTANCE , OS_TICK_CC_CHANNEL );
605
613
606
614
// do not use os_tick_ovf because its counter value can be different
0 commit comments