Skip to content

Commit

Permalink
RTOS2: Update documentation for OS Tick
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertRostohar committed Apr 17, 2023
1 parent 0b8634e commit 61464e8
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions CMSIS/DoxyGen/RTOS2/src/cmsis_os2_tick.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@
The <b>OS Tick API</b> is an interface to a system timer that generates the Kernel Ticks.

All Cortex-M processors provide an unified System Tick Timer that is typically used to generate the RTOS Kernel Tick.

\if ARMCA
The Cortex-A processors do not implement an unified system timer and required a device specific implementation.
\endif

CMSIS-RTOS2 provides in the directory \ref directory "CMSIS/RTOS2/Source" the several OS Tick implementations that can be used by any RTOS kernel.
CMSIS-RTOS2 provides in the directory \ref directory "CMSIS/RTOS2/Source" several OS Tick implementations that can be used by any RTOS kernel.

Filename | OS Tick Implementation for...
:------------------------|:-----------------------------------------------------------------------
\b %os_systick.c | Cortex-M SysTick timer
\if ARMCA
\b %os_tick_gtim.c | Cortex-A Generic Timer (available in some devices)
\b %os_tick_ptim.c | Cortex-A Private Timer (available in some devices)
\endif

\note The above OS Tick source files implement \c weak functions which may be overwritten by user-specific implementations.

Expand Down Expand Up @@ -47,25 +52,25 @@ static uint8_t PendST;
int32_t OS_Tick_Setup (uint32_t freq, IRQHandler_t handler) {
(void)handler;
uint32_t load;

if (freq == 0U) {
return -1;
return (-1);
}

load = (SystemCoreClock / freq) - 1U;
if (load > 0x00FFFFFFU) {
return -1;
return (-1);
}

NVIC_SetPriority(SysTick_IRQn, SYSTICK_IRQ_PRIORITY);

SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk;
SysTick->LOAD = load;
SysTick->VAL = 0U;

PendST = 0U;

return 0;
return (0);
}
\endcode
*/
Expand Down Expand Up @@ -147,7 +152,7 @@ Return the numeric value that identifies the interrupt called by the OS Tick tim

\code
int32_t OS_Tick_GetIRQn (void) {
return SysTick_IRQn;
return ((int32_t)SysTick_IRQn);
}
\endcode
*/
Expand All @@ -165,7 +170,7 @@ This function is used to by the function \ref osKernelGetSysTimerFreq.

\code
uint32_t OS_Tick_GetClock (void) {
return SystemCoreClock;
return (SystemCoreClock);
}
\endcode
*/
Expand All @@ -182,7 +187,7 @@ Return the number of counter ticks between to periodic OS Tick timer interrupts.

\code
uint32_t OS_Tick_GetInterval (void) {
return SysTick->LOAD + 1U;
return (SysTick->LOAD + 1U);
}
\endcode
*/
Expand All @@ -201,8 +206,17 @@ The OS Tick timer counter value is used to by the function \ref osKernelGetSysTi

\code
uint32_t OS_Tick_GetCount (void) {
uint32_t load = SysTick->LOAD;
return load - SysTick->VAL;
uint32_t val;
uint32_t count;

val = SysTick->VAL;
if (val != 0U) {
count = (SysTick->LOAD - val) + 1U;
} else {
count = 0U;
}

return (count);
}
\endcode
*/
Expand All @@ -219,7 +233,7 @@ Return the state of OS Tick timer interrupt pending bit that indicates timer ove

\code
uint32_t OS_Tick_GetOverflow (void) {
return (SCB->ICSR & SCB_ICSR_PENDSTSET_Msk) >> SCB_ICSR_PENDSTSET_Pos;
return ((SCB->ICSR & SCB_ICSR_PENDSTSET_Msk) >> SCB_ICSR_PENDSTSET_Pos);
}
\endcode
*/
Expand Down

0 comments on commit 61464e8

Please sign in to comment.