The foxBMS secondary mcu API documentation
os.c File Reference

Implementation of the tasks used by the system. More...

#include "os.h"
#include "enginetask.h"
#include "appltask.h"
Include dependency graph for os.c:

Macros

#define IDLE_TASK_SIZE   configMINIMAL_STACK_SIZE
 stack size of the idle task More...
 

Functions

void OS_TaskInit (void)
 Initialization the RTOS interface. More...
 
void vApplicationGetIdleTaskMemory (StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize)
 Supplies the memory for the idle task. More...
 
void vApplicationGetTimerTaskMemory (StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize)
 Supplies the memory for the timer task. More...
 
void vApplicationIdleHook (void)
 Hook function for the idle task. More...
 
void vApplicationStackOverflowHook (TaskHandle_t xTask, signed char *pcTaskName)
 Hook function for StackOverflowHandling. More...
 
void OS_TimerTrigger (volatile OS_TIMER_s *timer)
 increments the system timer os_timer More...
 
uint8_t OS_Check_Context (void)
 auxiliary function to distinguish OS Task from an ISR More...
 
void OS_TaskEnter_Critical (void)
 Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR. More...
 
void OS_TaskExit_Critical (void)
 Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR. More...
 
uint32_t OS_getOSSysTick (void)
 returns OS based system tick value. More...
 
void OS_taskDelay (uint32_t delay_ms)
 Delay in millisecond. More...
 
void OS_taskDelayUntil (uint32_t *PreviousWakeTime, uint32_t millisec)
 Delay a task until a specified time. More...
 
void OS_SysTickHandler (void)
 Handles the tick increment of operating systick timer. More...
 

Variables

volatile OS_BOOT_STATE_e os_boot
 
volatile OS_TIMER_s os_timer
 
uint8_t eng_init = FALSE
 
static StaticTask_t xIdleTaskTCBBuffer
 Buffer for the Idle Task's structure. More...
 
static StackType_t xIdleStack [IDLE_TASK_SIZE]
 Stack for the Idle task. More...
 
static StaticTask_t xTimerTaskTCBBuffer
 Buffer for the Timer Task's structure. More...
 
static StackType_t xTimerStack [configTIMER_TASK_STACK_DEPTH]
 Stack for the Timer Task. More...
 
uint32_t os_schedulerstarttime
 

Detailed Description

Implementation of the tasks used by the system.

BSD 3-Clause License Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:

″This product uses parts of foxBMS®″

″This product includes parts of foxBMS®″

″This product is derived from foxBMS®″

Author
foxBMS Team
Date
27.08.2015 (date of creation)
Module-prefix OS

Macro Definition Documentation

◆ IDLE_TASK_SIZE

#define IDLE_TASK_SIZE   configMINIMAL_STACK_SIZE

stack size of the idle task

Function Documentation

◆ OS_Check_Context()

uint8_t OS_Check_Context ( void  )

auxiliary function to distinguish OS Task from an ISR

checks the function context: task (thread) mode or interrupt (handler) mode

Returns
0 when OS-Task, 0x1 when ISR

◆ OS_getOSSysTick()

uint32_t OS_getOSSysTick ( void  )

returns OS based system tick value.

Returns
time stamp in ms, based on the OS time.

◆ OS_SysTickHandler()

void OS_SysTickHandler ( void  )

Handles the tick increment of operating systick timer.

Here is the call graph for this function:

◆ OS_taskDelay()

void OS_taskDelay ( uint32_t  delay_ms)

Delay in millisecond.

Parameters
millisectime delay value

◆ OS_taskDelayUntil()

void OS_taskDelayUntil ( uint32_t *  PreviousWakeTime,
uint32_t  delay 
)

Delay a task until a specified time.

Parameters
PreviousWakeTimePointer to a variable that holds the time at which the task was last unblocked. PreviousWakeTime must be initialized with the current time prior to its first use (PreviousWakeTime = OS_osSysTick())
millisectime delay value

◆ OS_TaskEnter_Critical()

void OS_TaskEnter_Critical ( void  )

Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.

checks the function context (task/thread mode or interrupt (handler) mode) and calls the corresponding enter-critical function

◆ OS_TaskExit_Critical()

void OS_TaskExit_Critical ( void  )

Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.

checks the function context (task/thread mode or interrupt (handler) mode) and calls the corresponding exit-critical function

◆ OS_TaskInit()

void OS_TaskInit ( )

Initialization the RTOS interface.

The initialization functions inits mutexes, eventgroups and tasks.

Here is the call graph for this function:

◆ OS_TimerTrigger()

void OS_TimerTrigger ( volatile OS_TIMER_s timer)

increments the system timer os_timer

The os_timer is a runtime-counter, counting the time since the last reset.

◆ vApplicationGetIdleTaskMemory()

void vApplicationGetIdleTaskMemory ( StaticTask_t **  ppxIdleTaskTCBBuffer,
StackType_t **  ppxIdleTaskStackBuffer,
uint32_t *  pulIdleTaskStackSize 
)

Supplies the memory for the idle task.

This is needed due to the usage of configSUPPORT_STATIC_ALLOCATION.

◆ vApplicationGetTimerTaskMemory()

void vApplicationGetTimerTaskMemory ( StaticTask_t **  ppxTimerTaskTCBBuffer,
StackType_t **  ppxTimerTaskStackBuffer,
uint32_t *  pulTimerTaskStackSize 
)

Supplies the memory for the timer task.

This is necessary for the combination of configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS.

◆ vApplicationIdleHook()

void vApplicationIdleHook ( void  )

Hook function for the idle task.

Here is the call graph for this function:

◆ vApplicationStackOverflowHook()

void vApplicationStackOverflowHook ( TaskHandle_t  xTask,
signed char *  pcTaskName 
)

Hook function for StackOverflowHandling.

This handler is used when the operation system encounters a stackoverflow in a task.

Here is the call graph for this function:

Variable Documentation

◆ eng_init

uint8_t eng_init = FALSE

◆ os_boot

volatile OS_BOOT_STATE_e os_boot

◆ os_schedulerstarttime

uint32_t os_schedulerstarttime

Scheduler "zero" time for task phase control

◆ os_timer

volatile OS_TIMER_s os_timer

◆ xIdleStack

StackType_t xIdleStack[IDLE_TASK_SIZE]
static

Stack for the Idle task.

◆ xIdleTaskTCBBuffer

StaticTask_t xIdleTaskTCBBuffer
static

Buffer for the Idle Task's structure.

◆ xTimerStack

StackType_t xTimerStack[configTIMER_TASK_STACK_DEPTH]
static

Stack for the Timer Task.

◆ xTimerTaskTCBBuffer

StaticTask_t xTimerTaskTCBBuffer
static

Buffer for the Timer Task's structure.