Skip to content

Commit

Permalink
RTOS2/RTX5: Update SysTick implementation for OS Tick (initial count …
Browse files Browse the repository at this point in the history
…value)
  • Loading branch information
RobertRostohar committed Jan 25, 2023
1 parent bbfbe18 commit 2e02216
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions CMSIS/DoxyGen/RTOS2/src/history.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
<td>V5.5.5</td>
<td>
- Added de-allocation of Arm C library thread data (libspace) when thread is terminated.
- Updated SysTick implementation for OS Tick (initial count value).
</td>
</tr>
<tr>
Expand Down
19 changes: 14 additions & 5 deletions CMSIS/RTOS2/Source/os_systick.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**************************************************************************//**
* @file os_systick.c
* @brief CMSIS OS Tick SysTick implementation
* @version V1.0.3
* @date 19. March 2021
* @version V1.0.4
* @date 20. January 2023
******************************************************************************/
/*
* Copyright (c) 2017-2021 ARM Limited. All rights reserved.
* Copyright (c) 2017-2023 ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -121,8 +121,17 @@ __WEAK uint32_t OS_Tick_GetInterval (void) {

// Get OS Tick count value.
__WEAK 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);
}

// Get OS Tick overflow status.
Expand Down

0 comments on commit 2e02216

Please sign in to comment.