ODeV framework  v2
Data Structures | Typedefs | Functions | Variables
sysinit.c File Reference

System global initialization. More...

#include "sysinit.h"
#include "syslowpower.h"
#include "sysdebug.h"
#include "NullErrorDelegate.h"
#include "SysDefPowerModeHelper.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "string.h"
+ Include dependency graph for sysinit.c:

Data Structures

struct  _System
 

Typedefs

typedef struct _System System
 

Functions

void SystemClock_Config (void)
 
void SysPowerConfig ()
 
static void InitTaskRun (void *pParams)
 
__weak sys_error_code_t SysLoadApplicationContext (ApplicationContext *pAppContext)
 
__weak sys_error_code_t SysOnStartApplication (ApplicationContext *pAppContext)
 
sys_error_code_t SysInit (boolean_t bEnableBootIF)
 
EPowerMode SysGetPowerMode ()
 
sys_error_code_t SysTaskErrorHandler (AManagedTask *pxTask)
 
SysPowerStatus SysGetPowerStatus ()
 
void SysResetAEDCounter ()
 
boolean_t SysEventsPending ()
 
__weak IApplicationErrorDelegateSysGetErrorDelegate ()
 
__weak IBootSysGetBootIF ()
 
__weak IAppPowerModeHelperSysGetPowerModeHelper ()
 

Variables

static System s_xTheSystem
 

Detailed Description

System global initialization.

Author
STMicroelectronics - ST-Korea - MCD Team
Version
1.2.0
Date
Sep 6, 2016
Attention

© COPYRIGHT 2016 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

   http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Typedef Documentation

◆ System

typedef struct _System System

Create a type name for _System.

Function Documentation

◆ InitTaskRun()

static void InitTaskRun ( void *  pParams)
static

INIT task control loop. The INIT task is in charge of the system initialization.

Parameters
pParamsnot used.

INIT task control function. The INIT task is the first created and running task. It is responsible to complete the system initialization and to create all other system task.

Parameters
pParamsnot used

◆ SysEventsPending()

boolean_t SysEventsPending ( )

Check if there are pending SysEvent.

Returns
TRUE if there are SysEvent pending (that means to be served by the INIT task), FALSE otherwise.

◆ SysGetBootIF()

__weak IBoot* SysGetBootIF ( )

Get the Application defined Boot interface. A boot loader application should implement this interface. The default implementation is defined as weak so the application can provide its specific implementation. The default implementation does nothing.

Returns
a pointer to an IBoot object.

◆ SysGetErrorDelegate()

__weak IApplicationErrorDelegate* SysGetErrorDelegate ( )

Get the Application manager error delegate. This function is used by the system during the application startup in order to get an application specific object that implements the IApplicationErrorDelegate. The default implementation is defined as weak so the application can provide its specific implementation. The default implementation does nothing.

Returns
a pointer to an IApplicationErrorDelegate object.
+ Here is the call graph for this function:

◆ SysGetPowerMode()

EPowerMode SysGetPowerMode ( )

Get the current system power mode.

Returns
the current system power mode.
+ Here is the call graph for this function:

◆ SysGetPowerModeHelper()

__weak IAppPowerModeHelper* SysGetPowerModeHelper ( )

Get the Application Power Mode Helper. This function is used by the system during the application startup in order to get an application specific object that implements the IAppPowerModeHelper. The default implementation is defined as weak so the application can provide its specific implementation. For more information about the default implementation see TODO: STF ...

Returns
a pointer to an IAppPowerModeHelper object.
+ Here is the call graph for this function:

◆ SysGetPowerStatus()

SysPowerStatus SysGetPowerStatus ( )

Get a copy of the system status related to the power management.

Returns
copy of the system status related to the power management.
+ Here is the call graph for this function:

◆ SysInit()

sys_error_code_t SysInit ( boolean_t  bEnableBootIF)

It initialize the minimum set of resources, hardware and software, in order to start the scheduler, and create the INIT task. If bEnableBootIF == TRUE the system enable the Boot Interface. It is useful to develop a bootloader.

Parameters
bEnableBootIFspecifies if the system has to enable the Boot Interface.
Returns
SYS_NO_ERROR_CODE if success, SYS_OUT_OF_MEMORY_ERROR_CODE if it is not possible to instantiate the INIT task.

◆ SysLoadApplicationContext()

__weak sys_error_code_t SysLoadApplicationContext ( ApplicationContext pAppContext)

This function is used by the system in order to add all the managed tasks to the application context. It is defined as weak in order to allow the user application to redefine it.

Parameters
pAppContext[IN] specifies a pointer to the application context to load with the application specific managed tasks.
Returns
SYS_NO_ERROR_CODE if success, an error code otherwise.

◆ SysOnStartApplication()

__weak sys_error_code_t SysOnStartApplication ( ApplicationContext pAppContext)

This function is called by the framework at the end of the initialization process and before the Init task releases the control to the application tasks. At this point all managed task has been created and the hardware is initialized. The application has a chance to execute some other initialization code before the scheduler runs the first application task.

Parameters
pAppContext[IN] specifies a pointer to the application context to load with the application specific managed tasks.
Returns
SYS_NO_ERROR_CODE if success, an error code otherwise.

◆ SysPowerConfig()

void SysPowerConfig ( )

Configure the unused PIN in analog to minimize the power consumption, and enable the ultra low power mode.

◆ SysResetAEDCounter()

void SysResetAEDCounter ( )

Reset the counter of the AED. Usually an AED use some kind of timeout to check that all managed tasks are working fine. A task should call this method before a critical operation, that is for example a write operation in FLASH or EEPROM, or a long critical section. For convenience the managed task interface has a function IMTResetAEDCounter() that can be used by a task instead of call directly the system function.

+ Here is the call graph for this function:

◆ SysTaskErrorHandler()

sys_error_code_t SysTaskErrorHandler ( AManagedTask pxTask)

Not used yet.

Parameters
pxTask
Returns

◆ SystemClock_Config()

void SystemClock_Config ( void  )

System Clock configuration procedure. It is provided by the CubeMX project.

Variable Documentation

◆ s_xTheSystem

System s_xTheSystem
static

The only instance of System object.