ODeV framework  v2
Data Structures | Macros | Typedefs | Functions | Variables
syserror.h File Reference

Define the global error management API. More...

#include <assert.h>
#include <stdint.h>
#include "sysevent.h"
#include "apperror.h"
+ Include dependency graph for syserror.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  sys_error_t
 

Macros

#define SYS_ERR_EVT_SRC_IAED   0x1U
 Event generated from the IApplicationErrorDelegate.
 
#define SYS_ERR_EVT_PARAM_CHECK_TASKS   0x1U
 Event parameter: check is tasks are still running.
 
#define SYS_ERR_EVT_PARAM_EFT   0x2U
 Event parameter: EFT error detected.
 
#define SYS_ERR_EVT_PARAM_EFT_TIMEOUT   0x3U
 Event parameter: EFT error timeout.
 
#define SYS_ERR_EVT_PARAM_NOP   0x4U
 Event parameter: EFT IRQ to be ignored.
 
#define SYS_ERR_MAKE_EVENT(src, params)   ((((src) & 0X7U) | (((params)<<3) & 0xF8U) | (0x1U<<31)) & 0x800000FF)
 
#define SYS_IS_ERROR_EVENT(evt)   ((evt).xEvent.nEventType == 1)
 
#define APP_BASE_ERROR_CODE   SYS_LAST_ERROR_CODE + 1
 < Initial value for the application defined error codes.
 

Typedefs

typedef unsigned short sys_error_code_t
 

Functions

sys_error_code_t SysPostErrorEvent (SysEvent xEvent)
 
void SysResetAEDCounter ()
 
void sys_error_handler (void)
 

Variables

sys_error_t g_nSysError
 

Detailed Description

Define the global error management API.

Author
STMicroelectronics - ST-Korea - MCD Team
Version
1.0.0
Date
Sep 5, 2016 The system uses a single 32 bits global variable to track the last runtime error. This variable stores in the last significant 16 bits (bit [0,15]) the last error occurred in the Low Level API layer. The last error occurred in the Service Layer level is stored in the most significant 16 bits (bit [16, 31]). The application uses the SYS_GET_LAST_ERROR() macro to retrieve the last error.
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.

Macro Definition Documentation

◆ SYS_ERR_MAKE_EVENT

#define SYS_ERR_MAKE_EVENT (   src,
  params 
)    ((((src) & 0X7U) | (((params)<<3) & 0xF8U) | (0x1U<<31)) & 0x800000FF)

Macro to make system error event.

Parameters
src[IN] specifies the source of the event
params[IN] specifies a parameter. Its value depend on the event source.

◆ SYS_IS_ERROR_EVENT

#define SYS_IS_ERROR_EVENT (   evt)    ((evt).xEvent.nEventType == 1)

Macro to check the .nEventType of a system event.

Parameters
evt[IN] specifies an event
Returns
TRUE if the evt is an error system event, FALSE otherwise

Typedef Documentation

◆ sys_error_code_t

typedef unsigned short sys_error_code_t

Create type name for sys_error_code_t.

Function Documentation

◆ sys_error_handler()

void sys_error_handler ( void  )

This function is executed in case of error occurrence. If the application is in Debug configuration it inserts a dynamic breakpoint.

◆ SysPostErrorEvent()

sys_error_code_t SysPostErrorEvent ( SysEvent  xEvent)

Notify the system about an event related to the error management. This function can be called also from an ISR.

Parameters
xEvent[IN] specifies a error event.
Returns
SYS_NO_ERROR_CODE if the event has been posted in the system queue with success, an error code otherwise.

◆ 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:

Variable Documentation

◆ g_nSysError

sys_error_t g_nSysError

This is the global variable that store the last low level and the last service level error code.