eLooM for STM32 application  v3.3.0
A framework for multitasking low power embedded applications powerd by STM32
Loading...
Searching...
No Matches
syserror.h File Reference

Define the global error management API. More...

#include <assert.h>
#include <stdint.h>
#include "events/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 == 1U)
 
#define APP_BASE_ERROR_CODE   SYS_LAST_ERROR_CODE + ((sys_error_code_t)1)
 < Initial value for the application defined error codes.
 

Typedefs

typedef uint16_t sys_error_code_t
 
typedef union _sys_error_t sys_error_t
 

Functions

sys_error_code_t SysPostErrorEvent (SysEvent xEvent)
 
void SysResetAEDCounter (void)
 
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
3.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 (c) 2016 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

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 == 1U)

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 uint16_t sys_error_code_t

Create type name for sys_error_code_t.

◆ sys_error_t

typedef union _sys_error_t sys_error_t

Specifies the format of the global error used by the system to track the last error occurred.

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 ( void  )

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
extern

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