coding style format.

pull/4356/head
Andrzej Puzdrowski 2017-04-28 13:13:27 +02:00 committed by adbridge
parent 053ccd023b
commit a8f4d2a0f5
2 changed files with 36 additions and 28 deletions

View File

@ -311,7 +311,9 @@ static uint32_t previous_tick_cc_value = 0;
*/ */
MBED_WEAK uint32_t const os_trv; MBED_WEAK uint32_t const os_trv;
MBED_WEAK uint32_t const os_clockrate; MBED_WEAK uint32_t const os_clockrate;
MBED_WEAK void OS_Tick_Handler() { } MBED_WEAK void OS_Tick_Handler(void)
{
}
#if defined (__CC_ARM) /* ARMCC Compiler */ #if defined (__CC_ARM) /* ARMCC Compiler */
@ -452,7 +454,8 @@ __stackless __task void COMMON_RTC_IRQ_HANDLER(void)
* Return the next number of clock cycle needed for the next tick. * Return the next number of clock cycle needed for the next tick.
* @note This function has been carrefuly optimized for a systick occuring every 1000us. * @note This function has been carrefuly optimized for a systick occuring every 1000us.
*/ */
static uint32_t get_next_tick_cc_delta() { static uint32_t get_next_tick_cc_delta()
{
uint32_t delta = 0; uint32_t delta = 0;
if (os_clockrate != 1000) { if (os_clockrate != 1000) {
@ -488,7 +491,8 @@ static uint32_t get_next_tick_cc_delta() {
return delta; return delta;
} }
static inline void clear_tick_interrupt() { static inline void clear_tick_interrupt()
{
nrf_rtc_event_clear(COMMON_RTC_INSTANCE, OS_TICK_EVENT); nrf_rtc_event_clear(COMMON_RTC_INSTANCE, OS_TICK_EVENT);
nrf_rtc_event_disable(COMMON_RTC_INSTANCE, OS_TICK_INT_MASK); nrf_rtc_event_disable(COMMON_RTC_INSTANCE, OS_TICK_INT_MASK);
} }
@ -500,7 +504,8 @@ static inline void clear_tick_interrupt() {
* @param val value to check * @param val value to check
* @return true if the value is included in the range and false otherwise. * @return true if the value is included in the range and false otherwise.
*/ */
static inline bool is_in_wrapped_range(uint32_t begin, uint32_t end, uint32_t val) { static inline bool is_in_wrapped_range(uint32_t begin, uint32_t end, uint32_t val)
{
// regular case, begin < end // regular case, begin < end
// return true if begin <= val < end // return true if begin <= val < end
if (begin < end) { if (begin < end) {
@ -524,7 +529,8 @@ static inline bool is_in_wrapped_range(uint32_t begin, uint32_t end, uint32_t va
/** /**
* Register the next tick. * Register the next tick.
*/ */
static void register_next_tick() { static void register_next_tick()
{
previous_tick_cc_value = nrf_rtc_cc_get(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL); previous_tick_cc_value = nrf_rtc_cc_get(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL);
uint32_t delta = get_next_tick_cc_delta(); uint32_t delta = get_next_tick_cc_delta();
uint32_t new_compare_value = (previous_tick_cc_value + delta) & MAX_RTC_COUNTER_VAL; uint32_t new_compare_value = (previous_tick_cc_value + delta) & MAX_RTC_COUNTER_VAL;
@ -583,7 +589,8 @@ void os_tick_irqack(void)
* @note This function is exposed by RTX kernel. * @note This function is exposed by RTX kernel.
* @return 1 if the timer has overflowed and 0 otherwise. * @return 1 if the timer has overflowed and 0 otherwise.
*/ */
uint32_t os_tick_ovf(void) { uint32_t os_tick_ovf(void)
{
uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE); uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE);
uint32_t next_tick_cc_value = nrf_rtc_cc_get(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL); uint32_t next_tick_cc_value = nrf_rtc_cc_get(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL);
@ -599,7 +606,8 @@ uint32_t os_tick_ovf(void) {
* descending order, even if the internal counter used is an ascending one. * descending order, even if the internal counter used is an ascending one.
* @return the value of the alternative hardware timer. * @return the value of the alternative hardware timer.
*/ */
uint32_t os_tick_val(void) { uint32_t os_tick_val(void)
{
uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE); uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE);
uint32_t next_tick_cc_value = nrf_rtc_cc_get(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL); uint32_t next_tick_cc_value = nrf_rtc_cc_get(COMMON_RTC_INSTANCE, OS_TICK_CC_CHANNEL);