Document API IEC60730 Library
Classes | Macros | Enumerations | Functions | Variables

Power On Self Test - Executed once during power up. More...

Classes

struct  sl_iec60730_library_version_t
 

Macros

#define UNUSED_VAR(x)   (void) (x)
 
#define __CONCAT(x, y)   x##y
 Macro merge separate words to be joined into a single word.
 
#define CONCAT(x, y)   __CONCAT(x, y)
 
#define STR(x)   #x
 Macro convert to string.
 
#define XSTR(x)   STR(x)
 
#define LABEL_DEF(NAME)   LB_ASM volatile(LB_XSTR(NAME))
 
#define __no_init
 
#define DEC_CLASSB_VARS(vartype, name)
 
#define EXTERN_DEC_CLASSB_VARS(vartype, name)
 
#define sl_static_dec_classb_vars(vartype, name)
 
#define INV_CLASSB_VAR(vartype, name)   CONCAT(name, _inv) = (vartype) (~(vartype) name)
 
#define INV_CLASSB_PVAR(vartype, name)   CONCAT(name, _inv) = (vartype *) (~(vartype) name)
 
#define CHECK_INTEGRITY(vartype, x)   ((vartype) - 1 == ((vartype) x ^ (vartype) CONCAT(x, _inv)))
 

Enumerations

enum  sl_iec60730_test_result_t { SL_IEC60730_TEST_FAILED = 0, SL_IEC60730_TEST_PASSED = 1, SL_IEC60730_TEST_IN_PROGRESS = 2 }
 The result of a test. More...
 
enum  sl_iec60730_test_failure_t {
  SL_IEC60730_NO_FAILURE = 0, SL_IEC60730_TEST_VERIFY = 1, SL_IEC60730_WATCHDOG_POST_FAIL = 2, SL_IEC60730_VMC_FAIL = 3,
  SL_IEC60730_IMC_FAIL = 4, SL_IEC60730_CPU_REGISTERS_FAIL = 5, SL_IEC60730_CLOCK_FAIL = 6, SL_IEC60730_INTERRUPT_FAIL = 7,
  SL_IEC60730_PROGRAM_COUNTER_FAIL = 8, SL_IEC60730_GPIO_FAIL = 9, SL_IEC60730_ANALOG_FAIL = 10, SL_IEC60730_CS0_FAIL = 11,
  SL_IEC60730_LESENSE0_FAIL = 12, SL_IEC60730_RADIO_FAIL = 13, SL_IEC60730_I2C0_FAIL = 14, SL_IEC60730_I2C1_FAIL = 15,
  SL_IEC60730_USART0_FAIL = 16, SL_IEC60730_USART1_FAIL = 17, SL_IEC60730_USART2_FAIL = 18, SL_IEC60730_USART3_FAIL = 19,
  SL_IEC60730_LEUART0_FAIL = 20, SL_IEC60730_EUART0_FAIL = 21, SL_IEC60730_PDM0_FAIL = 22, SL_IEC60730_OEM_FAIL_1 = 23,
  SL_IEC60730_OEM_FAIL_2 = 24, SL_IEC60730_OEM_FAIL_3 = 25, SL_IEC60730_OEM_FAIL_4 = 26, SL_IEC60730_SAFETY_CHECK_FAIL = 0XFF
}
 Cause of failure passed to Safe State function. More...
 

Functions

void sl_iec60730_post (void)
 

Variables

const sl_iec60730_library_version_t SL_IEC60730_LIBRARY_VERSION
 Global variable which holds the IEC60370 library version.
 

Detailed Description

Power On Self Test - Executed once during power up.

sl_iec60730_post() validates system health before starting execution of the main loop. It must be called first in the main() function. If the result of a test routine is a failure, sl_iec60730_safe_state() is called.

Figure 1 Post flowchart

Macro Definition Documentation

◆ __no_init

#define __no_init

The __no_init macro is used for compatibility between GCC and IAR compiler.

◆ CHECK_INTEGRITY

#define CHECK_INTEGRITY (   vartype,
 
)    ((vartype) - 1 == ((vartype) x ^ (vartype) CONCAT(x, _inv)))

The CHECK_INTEGRITY definition used for checking integrity of pair of variables stored in *.classb_ram* section.

◆ DEC_CLASSB_VARS

#define DEC_CLASSB_VARS (   vartype,
  name 
)
Value:
__no_init vartype name __CLASSB_RAM; \
__no_init vartype CONCAT(name, _inv) __CLASSB_RAM

The DEC_CLASSB_VARS definition is used for declaring pair of classsb_ram variables.

◆ EXTERN_DEC_CLASSB_VARS

#define EXTERN_DEC_CLASSB_VARS (   vartype,
  name 
)
Value:
extern __no_init vartype name __CLASSB_RAM; \
extern __no_init vartype CONCAT(name, _inv) __CLASSB_RAM

The EXTERN_DEC_CLASSB_VARS definition is extern of pair of DEC_CLASSB_VARS

◆ INV_CLASSB_PVAR

#define INV_CLASSB_PVAR (   vartype,
  name 
)    CONCAT(name, _inv) = (vartype *) (~(vartype) name)

The INV_CLASSB_PVAR macro is used to inverse a Inv value of pointer pair DEC_CLASSB_VARS

◆ INV_CLASSB_VAR

#define INV_CLASSB_VAR (   vartype,
  name 
)    CONCAT(name, _inv) = (vartype) (~(vartype) name)

The INV_CLASSB_VAR macro is used to inverse a Inv value of pair DEC_CLASSB_VARS

◆ LABEL_DEF

#define LABEL_DEF (   NAME)    LB_ASM volatile(LB_XSTR(NAME))

The LABEL_DEF macro is used to generate label for break points. Using this macro avoids label removal by the compiler's optimize levels.

◆ sl_static_dec_classb_vars

#define sl_static_dec_classb_vars (   vartype,
  name 
)
Value:
static __no_init vartype name __CLASSB_RAM; \
static __no_init vartype CONCAT(name, _inv) __CLASSB_RAM

The sl_static_dec_classb_vars definition used for declaring static pair DEC_CLASSB_VARS

◆ UNUSED_VAR

#define UNUSED_VAR (   x)    (void) (x)

Useful macro for avoiding compiler warnings related to unused function arguments or unused variables.

Enumeration Type Documentation

◆ sl_iec60730_test_failure_t

Cause of failure passed to Safe State function.

Enumerator
SL_IEC60730_NO_FAILURE 

No failure detected.

SL_IEC60730_TEST_VERIFY 

Special case used for automated verification testing.

SL_IEC60730_WATCHDOG_POST_FAIL 

Watchdog POST test failed.

SL_IEC60730_VMC_FAIL 

Variable Memory Check detected a failure.

SL_IEC60730_IMC_FAIL 

Invariable Memory Check detected a failure.

SL_IEC60730_CPU_REGISTERS_FAIL 

CPU Registers Check detected a failure.

SL_IEC60730_CLOCK_FAIL 

System Clock Check detected a failure.

SL_IEC60730_INTERRUPT_FAIL 

Interrupt Plausibility Check detected a failure.

SL_IEC60730_PROGRAM_COUNTER_FAIL 

Program Counter Check detected a failure.

SL_IEC60730_GPIO_FAIL 

GPIO Plausibility Check detected a failure.

SL_IEC60730_ANALOG_FAIL 

Analog Plausibility Check detected a failure.

SL_IEC60730_CS0_FAIL 

CSEN0 detected a failureLESENSE.

SL_IEC60730_LESENSE0_FAIL 

LESENSE0 detected a failure.

SL_IEC60730_RADIO_FAIL 

Radio comms detected a failure.

SL_IEC60730_I2C0_FAIL 

I2C0 comms channel detected a failure.

SL_IEC60730_I2C1_FAIL 

I2C1 comms channel detected a failure.

SL_IEC60730_USART0_FAIL 

USART0 comms channel detected a failure.

SL_IEC60730_USART1_FAIL 

USART1 comms channel detected a failure.

SL_IEC60730_USART2_FAIL 

USART2 comms channel detected a failure.

SL_IEC60730_USART3_FAIL 

USART3 comms channel detected a failure.

SL_IEC60730_LEUART0_FAIL 

LEUART comms channel detected a failure.

SL_IEC60730_EUART0_FAIL 

EUART comms channel detected a failure.

SL_IEC60730_PDM0_FAIL 

PDM comms channel detected a failure.

SL_IEC60730_OEM_FAIL_1 

OEM defined failure.

SL_IEC60730_OEM_FAIL_2 

OEM defined failure.

SL_IEC60730_OEM_FAIL_3 

OEM defined failure.

SL_IEC60730_OEM_FAIL_4 

OEM defined failure.

SL_IEC60730_SAFETY_CHECK_FAIL 

iec60730_safety_check detected some failure

◆ sl_iec60730_test_result_t

The result of a test.

Enumerator
SL_IEC60730_TEST_FAILED 

test result failed

SL_IEC60730_TEST_PASSED 

test result passed

SL_IEC60730_TEST_IN_PROGRESS 

test is still in progress

Function Documentation

◆ sl_iec60730_post()

void sl_iec60730_post ( void  )

public IEC60730 Power On Self Test

Returns
None.

Each module is tested to validate system health before starting the execution of the main loop, and if a failure is detected sl_iec60730_safe_state() is called.

__CLASSB_RAM
#define __CLASSB_RAM
Definition: sl_iec60730_toolchain.h:78
__no_init
#define __no_init
Definition: sl_iec60730.h:136