foxBMS  1.0.0
The foxBMS Battery Management System API Documentation
ftask.c File Reference

Implementation of engine task driver. More...

#include "ftask.h"
#include "FreeRTOS.h"
#include "stream_buffer.h"
#include "database.h"
#include "sys_mon.h"
Include dependency graph for ftask.c:

Go to the source code of this file.

Functions

static void FTSK_TaskCreatorEngine (void)
 Database-Task. More...
 
static void FTSK_TaskCreatorCyclic1ms (void)
 Creation of cyclic 1 ms engine task. More...
 
static void FTSK_TaskCreatorCyclic10ms (void)
 Creation of cyclic 10 ms engine task. More...
 
static void FTSK_TaskCreatorCyclic100ms (void)
 Creation of cyclic 100 ms engine task. More...
 
static void FTSK_TaskCreatorCyclicAlgorithm100ms (void)
 Creation of cyclic 100 ms algorithm task. More...
 
void FTSK_CreateQueues (void)
 Creates all queues. More...
 
void FTSK_CreateMutexes (void)
 Creates all mutexes. More...
 
void FTSK_CreateEvents (void)
 Creates all events of the group. More...
 
void FTSK_CreateTasks (void)
 Creates all tasks of the group. More...
 

Variables

static TaskHandle_t ftsk_taskHandleEngine
 Definition of task handle of the engine task. More...
 
static StaticTask_t ftsk_taskStructEngine
 Task Struct for ftsk_taskHandleEngine. More...
 
static StackType_t ftsk_stackSizeEngine [FTSK_TSK_ENGINE_STACK_SIZE]
 Stack of ftsk_taskHandleEngine. More...
 
static TaskHandle_t ftsk_taskHandleCyclic1ms
 Definition of task handle for the cyclic 1 ms task. More...
 
static StaticTask_t ftsk_taskStructCyclic1ms
 Task Struct for ftsk_taskHandleCyclic1ms. More...
 
static StackType_t ftsk_stackSizeCyclic1ms [FTSK_TSK_CYCLIC_1MS_STACK_SIZE]
 Stack of ftsk_taskHandleCyclic1ms. More...
 
static TaskHandle_t ftsk_taskHandleCyclic10ms
 Definition of task handle for the cyclic 10 ms task. More...
 
static StaticTask_t ftsk_taskStructCyclic10ms
 Task Struct for ftsk_taskHandleCyclic10ms. More...
 
static StackType_t ftsk_stackSizeCyclic10ms [FTSK_TSK_CYCLIC_10MS_STACK_SIZE]
 Stack of ftsk_taskHandleCyclic10ms. More...
 
static TaskHandle_t ftsk_taskHandleCyclic100ms
 Definition of task handle for the cyclic 100 ms task. More...
 
static StaticTask_t ftsk_taskStructCyclic100ms
 Task Struct for ftsk_taskHandleCyclic100ms. More...
 
static StackType_t ftsk_stackSizeCyclic100ms [FTSK_TSK_CYCLIC_100MS_STACK_SIZE]
 Stack of ftsk_taskHandleCyclic100ms. More...
 
static TaskHandle_t ftsk_taskHandleCyclicAlgorithm100ms
 Definition of task handle for the cyclic 100 ms task for algorithms. More...
 
static StaticTask_t ftsk_taskStructCyclicAlgorithm100ms
 Task Struct for ftsk_taskHandleCyclicAlgorithm100ms. More...
 
static StackType_t ftsk_stackSizeCyclicAlgorithm100ms [FTSK_TSK_CYCLIC_ALGORITHM_100MS_STACKSIZE]
 Stack of ftsk_taskHandleCyclicAlgorithm100ms. More...
 

Detailed Description

Implementation of engine task driver.

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
2019-08-27 (date of creation)
Updated
2020-01-21 (date of last update)
Prefix
FTSK

TODO

Definition in file ftask.c.

Function Documentation

◆ FTSK_CreateEvents()

void FTSK_CreateEvents ( void  )

Creates all events of the group.

Creates all events. Is called after the hardware is initialized and before the scheduler starts. Queues, Mutexes and Events are already initialized.

Definition at line 135 of file ftask.c.

◆ FTSK_CreateMutexes()

void FTSK_CreateMutexes ( void  )

Creates all mutexes.

creates all mutexes needed for engine tasks and is called after the hardware is initialized and before the scheduler starts. Queues are already initialized.

Definition at line 132 of file ftask.c.

◆ FTSK_CreateQueues()

void FTSK_CreateQueues ( void  )

Creates all queues.

Creates all queues. Is called after the hardware is initialized and before the scheduler starts. Queues, Mutexes and Events are already initialized.

Definition at line 129 of file ftask.c.

◆ FTSK_CreateTasks()

void FTSK_CreateTasks ( void  )

Creates all tasks of the group.

Creates all tasks. Is called after the hardware is initialized and before the scheduler starts. Queues, Mutexes and Events are already initialized.

Definition at line 138 of file ftask.c.

Here is the call graph for this function:

◆ FTSK_TaskCreatorCyclic100ms()

void FTSK_TaskCreatorCyclic100ms ( void  )
static

Creation of cyclic 100 ms engine task.

Task is delayed by a phase as defined in ftsk_tskdef_cyclic_100ms.phase (in milliseconds). After the phase delay, the cyclic execution starts, the entry time is saved in current_time. After one cycle, the Task is set to sleep until entry time + ftsk_tskdef_cyclic_100ms.cycleTime (in milliseconds).

Definition at line 297 of file ftask.c.

Here is the call graph for this function:

◆ FTSK_TaskCreatorCyclic10ms()

void FTSK_TaskCreatorCyclic10ms ( void  )
static

Creation of cyclic 10 ms engine task.

Task is delayed by a phase as defined in ftsk_tskdef_cyclic_10ms.phase (in milliseconds). After the phase delay, the cyclic execution starts, the entry time is saved in current_time. After one cycle, the Task is set to sleep until entry time + ftsk_tskdef_cyclic_10ms.cycleTime (in milliseconds).

Definition at line 267 of file ftask.c.

Here is the call graph for this function:

◆ FTSK_TaskCreatorCyclic1ms()

void FTSK_TaskCreatorCyclic1ms ( void  )
static

Creation of cyclic 1 ms engine task.

The Task calls OsStartUp() in the very beginning, this is the first active Task. Then the Task is delayed by a phase as defined in ftsk_tskdef_cyclic_1ms.phase (in milliseconds). After the phase delay, the cyclic execution starts, the entry time is saved in current_time. After one cycle, the Task is set to sleep until entry time + ftsk_tskdef_cyclic_1ms.cycleTime (in milliseconds).

Definition at line 234 of file ftask.c.

Here is the call graph for this function:

◆ FTSK_TaskCreatorCyclicAlgorithm100ms()

void FTSK_TaskCreatorCyclicAlgorithm100ms ( void  )
static

Creation of cyclic 100 ms algorithm task.

Task is delayed by a phase as defined in ftsk_taskDefinitionCyclicAlgorithm100ms.Phase (in milliseconds). After the phase delay, the cyclic execution starts, the entry time is saved in current_time. After one cycle, the Task is set to sleep until entry time + ftsk_taskDefinitionCyclicAlgorithm100ms.CycleTime (in milliseconds).

Definition at line 328 of file ftask.c.

Here is the call graph for this function:

◆ FTSK_TaskCreatorEngine()

void FTSK_TaskCreatorEngine ( void  )
static

Database-Task.

The task manages the data exchange with the database and must have a higher task priority than any task using the database.

Definition at line 207 of file ftask.c.

Here is the call graph for this function:

Variable Documentation

◆ ftsk_stackSizeCyclic100ms

StackType_t ftsk_stackSizeCyclic100ms[FTSK_TSK_CYCLIC_100MS_STACK_SIZE]
static

Stack of ftsk_taskHandleCyclic100ms.

Definition at line 107 of file ftask.c.

◆ ftsk_stackSizeCyclic10ms

StackType_t ftsk_stackSizeCyclic10ms[FTSK_TSK_CYCLIC_10MS_STACK_SIZE]
static

Stack of ftsk_taskHandleCyclic10ms.

Definition at line 97 of file ftask.c.

◆ ftsk_stackSizeCyclic1ms

StackType_t ftsk_stackSizeCyclic1ms[FTSK_TSK_CYCLIC_1MS_STACK_SIZE]
static

Stack of ftsk_taskHandleCyclic1ms.

Definition at line 87 of file ftask.c.

◆ ftsk_stackSizeCyclicAlgorithm100ms

StackType_t ftsk_stackSizeCyclicAlgorithm100ms[FTSK_TSK_CYCLIC_ALGORITHM_100MS_STACKSIZE]
static

Stack of ftsk_taskHandleCyclicAlgorithm100ms.

Definition at line 117 of file ftask.c.

◆ ftsk_stackSizeEngine

StackType_t ftsk_stackSizeEngine[FTSK_TSK_ENGINE_STACK_SIZE]
static

Stack of ftsk_taskHandleEngine.

Definition at line 77 of file ftask.c.

◆ ftsk_taskHandleCyclic100ms

TaskHandle_t ftsk_taskHandleCyclic100ms
static

Definition of task handle for the cyclic 100 ms task.

Definition at line 101 of file ftask.c.

◆ ftsk_taskHandleCyclic10ms

TaskHandle_t ftsk_taskHandleCyclic10ms
static

Definition of task handle for the cyclic 10 ms task.

Definition at line 91 of file ftask.c.

◆ ftsk_taskHandleCyclic1ms

TaskHandle_t ftsk_taskHandleCyclic1ms
static

Definition of task handle for the cyclic 1 ms task.

Definition at line 81 of file ftask.c.

◆ ftsk_taskHandleCyclicAlgorithm100ms

TaskHandle_t ftsk_taskHandleCyclicAlgorithm100ms
static

Definition of task handle for the cyclic 100 ms task for algorithms.

Definition at line 111 of file ftask.c.

◆ ftsk_taskHandleEngine

TaskHandle_t ftsk_taskHandleEngine
static

Definition of task handle of the engine task.

Definition at line 71 of file ftask.c.

◆ ftsk_taskStructCyclic100ms

StaticTask_t ftsk_taskStructCyclic100ms
static

Task Struct for ftsk_taskHandleCyclic100ms.

Definition at line 104 of file ftask.c.

◆ ftsk_taskStructCyclic10ms

StaticTask_t ftsk_taskStructCyclic10ms
static

Task Struct for ftsk_taskHandleCyclic10ms.

Definition at line 94 of file ftask.c.

◆ ftsk_taskStructCyclic1ms

StaticTask_t ftsk_taskStructCyclic1ms
static

Task Struct for ftsk_taskHandleCyclic1ms.

Definition at line 84 of file ftask.c.

◆ ftsk_taskStructCyclicAlgorithm100ms

StaticTask_t ftsk_taskStructCyclicAlgorithm100ms
static

Task Struct for ftsk_taskHandleCyclicAlgorithm100ms.

Definition at line 114 of file ftask.c.

◆ ftsk_taskStructEngine

StaticTask_t ftsk_taskStructEngine
static

Task Struct for ftsk_taskHandleEngine.

Definition at line 74 of file ftask.c.