rtx idle: fix coding style

pull/8711/head
Martin Kojtal 2018-11-12 09:30:51 +00:00
parent 9a0651c7fb
commit 830f7464cc
1 changed files with 103 additions and 103 deletions

View File

@ -33,18 +33,18 @@
extern "C" {
#include "rtx_lib.h"
using namespace mbed;
using namespace mbed;
#if (defined(MBED_TICKLESS) && defined(DEVICE_LPTICKER))
#include "rtos/TARGET_CORTEX/SysTimer.h"
static rtos::internal::SysTimer *os_timer;
static uint64_t os_timer_data[sizeof(rtos::internal::SysTimer) / 8];
static rtos::internal::SysTimer *os_timer;
static uint64_t os_timer_data[sizeof(rtos::internal::SysTimer) / 8];
/// Enable System Timer.
void OS_Tick_Enable(void)
{
// Enable System Timer.
void OS_Tick_Enable(void)
{
// Do not use SingletonPtr since this relies on the RTOS
if (NULL == os_timer) {
os_timer = new (os_timer_data) rtos::internal::SysTimer();
@ -53,46 +53,46 @@ void OS_Tick_Enable(void)
// set to fire interrupt on next tick
os_timer->schedule_tick();
}
}
/// Disable System Timer.
void OS_Tick_Disable(void)
{
// Disable System Timer.
void OS_Tick_Disable(void)
{
os_timer->cancel_tick();
}
}
/// Acknowledge System Timer IRQ.
void OS_Tick_AcknowledgeIRQ(void)
{
// Acknowledge System Timer IRQ.
void OS_Tick_AcknowledgeIRQ(void)
{
}
}
/// Get System Timer count.
uint32_t OS_Tick_GetCount(void)
{
// Get System Timer count.
uint32_t OS_Tick_GetCount(void)
{
return os_timer->get_time() & 0xFFFFFFFF;
}
}
// Get OS Tick IRQ number.
int32_t OS_Tick_GetIRQn(void)
{
// Get OS Tick IRQ number.
int32_t OS_Tick_GetIRQn(void)
{
return -1;
}
}
// Get OS Tick overflow status.
uint32_t OS_Tick_GetOverflow(void)
{
// Get OS Tick overflow status.
uint32_t OS_Tick_GetOverflow(void)
{
return 0;
}
}
// Get OS Tick interval.
uint32_t OS_Tick_GetInterval(void)
{
// Get OS Tick interval.
uint32_t OS_Tick_GetInterval(void)
{
return 1000;
}
}
static void default_idle_hook(void)
{
static void default_idle_hook(void)
{
uint32_t ticks_to_sleep = osKernelSuspend();
const bool block_deep_sleep = ticks_to_sleep <= MBED_CONF_TARGET_DEEP_SLEEP_LATENCY;
@ -123,41 +123,41 @@ static void default_idle_hook(void)
}
osKernelResume(os_timer->resume());
}
}
#else
static void default_idle_hook(void)
{
static void default_idle_hook(void)
{
// critical section to complete sleep with locked deepsleep
core_util_critical_section_enter();
sleep_manager_lock_deep_sleep();
sleep();
sleep_manager_unlock_deep_sleep();
core_util_critical_section_exit();
}
}
#endif // (defined(MBED_TICKLESS) && defined(DEVICE_LPTICKER))
static void (*idle_hook_fptr)(void) = &default_idle_hook;
static void (*idle_hook_fptr)(void) = &default_idle_hook;
void rtos_attach_idle_hook(void (*fptr)(void))
{
void rtos_attach_idle_hook(void (*fptr)(void))
{
//Attach the specified idle hook, or the default idle hook in case of a NULL pointer
if (fptr != NULL) {
idle_hook_fptr = fptr;
} else {
idle_hook_fptr = default_idle_hook;
}
}
}
MBED_NORETURN void rtos_idle_loop(void)
{
MBED_NORETURN void rtos_idle_loop(void)
{
//Continuously call the idle hook function pointer
while (1) {
idle_hook_fptr();
}
}
}
} // extern "C"