Document API IEC60730 Library
Classes | Macros | Typedefs | Enumerations | Functions | Variables
sl_iec60730.h File Reference

Library definitions. More...

#include "sl_iec60730_config.h"
#include "sl_iec60730_toolchain.h"
#include "em_device.h"
#include "em_core.h"
#include "em_gpcrc.h"

Go to the source code of this file.

Classes

struct  sl_iec60730_library_version_t
 
struct  sl_iec60730_safety_check_t
 
struct  sl_iec60730_irq_execution_bounds_t
 
struct  sl_iec60730_irq_fail_t
 
struct  sl_iec60730_irq_cfg_t
 
struct  sl_iec60730_imc_params_t
 This structure is used as configuration for IMC testing, that holds GPCRC Register. More...
 
struct  sl_iec60730_update_crc_params_t
 
struct  sl_iec60730_imc_test_region_t
 This structure is used as configuration for IMC testing. The variable contains information about the starting and ending address of the region you want to check. More...
 
struct  sl_iec60730_imc_test_multiple_regions_t
 
struct  sl_iec60730_vmc_test_region_t
 This structure is used as configuration for VMC testing. More...
 
struct  sl_iec60730_vmc_test_multiple_regions_t
 This structure is used as multiple test regions for VMC testing. More...
 

Macros

#define IE60730_LIBRARY_VERSION   { 2, 0, 0 }
 
#define SL_IEC60730_BOARD_HEADER
 
#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)))
 
#define sl_iec60730_crc_t
 
#define SL_IEC60730_INVAR_BLOCKS_PER_BIST
 
#define SL_IEC60730_ROM_SIZE   ((uint32_t) SL_IEC60730_ROM_END - (uint32_t) SL_IEC60730_ROM_START)
 
#define STEPS_NUMBER   ((uint32_t) SL_IEC60730_ROM_SIZE / SL_IEC60730_FLASH_BLOCK)
 
#define SL_IEC60730_ROM_SIZE_INWORDS   ((uint32_t) SL_IEC60730_ROM_SIZE / 4U)
 
#define SL_IEC60730_FLASH_BLOCK_WORDS   ((uint32_t) (SL_IEC60730_ROM_SIZE_INWORDS / STEPS_NUMBER))
 
#define SL_IEC60730_ROM_SIZE_TEST(start, end)   ((uint32_t) end - (uint32_t) start)
 
#define STEPS_NUMBER_TEST(start, end)   ((uint32_t) SL_IEC60730_ROM_SIZE_TEST(start, end) / SL_IEC60730_FLASH_BLOCK)
 
#define SL_IEC60730_ROM_SIZE_INWORDS_TEST(start, end)   ((uint32_t) SL_IEC60730_ROM_SIZE_TEST(start, end) / 4U)
 
#define SL_IEC60730_FLASH_BLOCK_WORDS_TEST(start, end)   ((uint32_t) (SL_IEC60730_ROM_SIZE_INWORDS_TEST(start, end) / STEPS_NUMBER_TEST(start, end)))
 
#define SL_IEC60730_REF_CRC   (check_sum)
 
#define BLOCKSIZE   (4)
 
#define RT_BLOCK_OVERLAP   (1)
 
#define RT_BLOCKSIZE   (BLOCKSIZE + (RT_BLOCK_OVERLAP << 1))
 
#define BACKGROUND   ((uint32_t) 0x00000000uL)
 
#define IEC60730_VMC_COMPLETE   (1 << 0)
 Mask bit used for Variable Memory Checks completed.
 
#define IEC60730_IMC_COMPLETE   (1 << 1)
 Mask bit used for Invariable Memory Checks completed.
 
#define IEC60730_CPU_CLOCKS_COMPLETE   (1 << 2)
 Mask bit used for CPU Clocks Checks completed.
 
#define IEC60730_CPU_REGS_COMPLETE   (1 << 3)
 Mask bit used for CPU Register Checks completed.
 
#define IEC60730_INTERRUPT_COMPLETE   (1 << 4)
 Mask bit used for Interrupt Checks completed.
 
#define IEC60730_GPIO_COMPLETE   (1 << 5)
 Mask bit used for GPIO Plausibility Checks completed.
 
#define IEC60730_ANALOG_COMPLETE   (1 << 6)
 Mask bit used for Analog Plausibility Checks completed.
 
#define IEC60730_COMMS_COMPLETE   (1 << 7)
 Mask bit used for Communications Plausibility Checks completed.
 
#define IEC60730_OEM0_COMPLETE   (1 << 8)
 Mask bit used for OEM Check 0 completed.
 
#define IEC60730_OEM1_COMPLETE   (1 << 9)
 Mask bit used for OEM Check 1 completed.
 
#define IEC60730_OEM2_COMPLETE   (1 << 10)
 Mask bit used for OEM Check 2 completed.
 
#define IEC60730_OEM3_COMPLETE   (1 << 11)
 Mask bit used for OEM Check 3 completed.
 
#define IEC60730_OEM4_COMPLETE   (1 << 12)
 Mask bit used for OEM Check 4 completed.
 
#define IEC60730_OEM5_COMPLETE   (1 << 13)
 Mask bit used for OEM Check 5 completed.
 
#define IEC60730_OEM6_COMPLETE   (1 << 14)
 Mask bit used for OEM Check 6 completed.
 
#define IEC60730_OEM7_COMPLETE   (1 << 15)
 Mask bit used for OEM Check 7 completed.
 
#define IEC60730_ALL_COMPLETE_BITS
 Mask used for checking that all bits are set. More...
 
#define IEC60730_MAX_IRQ_CHECK   32
 
#define SL_IEC60370_ENTER_ATOMIC()   CORE_ENTER_ATOMIC()
 Enter ATOMIC section.
 
#define SL_IEC60370_EXIT_ATOMIC()   CORE_EXIT_ATOMIC()
 Exit ATOMIC section.
 
#define SL_IEC60370_DECLARE_IRQ_STATE   CORE_DECLARE_IRQ_STATE;
 Declare irq state.
 
#define SL_IEC60730_IMC_POST_ENTER_ATOMIC()
 Enter ATOMIC section of IMC Post. More...
 
#define SL_IEC60730_IMC_POST_EXIT_ATOMIC()   CORE_EXIT_ATOMIC()
 Exit ATOMIC section of IMC Post.
 
#define SL_IEC60730_IMC_BIST_ENTER_ATOMIC()
 Enter ATOMIC section of IMC Bist. More...
 
#define SL_IEC60730_IMC_BIST_EXIT_ATOMIC()   CORE_EXIT_ATOMIC()
 Exit ATOMIC section of IMC Bist.
 
#define SL_IEC60730_CRC_INIT(crc, init)   GPCRC_Init(crc, init)
 Initialize the General Purpose Cyclic Redundancy Check (GPCRC) module.
 
#define SL_IEC60730_CRC_RESET(crc)   GPCRC_Reset(crc)
 Reset GPCRC registers to the hardware reset state.
 
#define SL_IEC60730_CRC_START(crc)   GPCRC_Start(crc)
 Issues a command to initialize CRC calculation.
 
#define SL_IEC60730_CRC_INPUTU32(crc, d)   GPCRC_InputU32(crc, d)
 Writes a 32-bit value to the input data register of the CRC.
 
#define SL_IEC60730_CRC_INPUTU16(crc, d)   GPCRC_InputU16(crc, d)
 Writes a 32-bit value to the input data register of the CRC.
 
#define SL_IEC60730_CRC_INPUTU8(crc, d)   GPCRC_InputU8(crc, d)
 Writes a 8-bit value to the input data register of the CRC.
 
#define SL_IEC60730_CRC_DATA_READ(crc)   GPCRC_DataRead(crc)
 Reads the data register of the CRC.
 
#define SL_IEC60730_CRC_DATA_READ_BIT_REVERSED(crc)   GPCRC_DataReadBitReversed(crc)
 Reads the data register of the CRC.
 
#define SL_IEC60730_CRC_DATA_READ_BYTE_REVERSED(crc)   GPCRC_DataReadByteReversed(crc)
 Reads the data register of the CRC.
 
#define SL_IEC60730_DEFAULT_GPRC
 
#define SL_IEC60730_IMC_CRC_BUFFER_SAMPLE_TEST   "123456789"
 
#define SL_IEC60730_IMC_CRC_BUFFER_INIT_VALUE
 
#define SL_IEC60730_IMC_CRC_BUFFER_XOR_OUTPUT
 
#define SL_IEC60730_IMC_CRC_BUFFER_SAMPLE_RESULT
 
#define SL_IEC60730_IMC_CRC_BUFFER_UPDATE_DEFAULT
 
#define SL_IEC60730_VMC_POST_ENTER_CRITICAL()
 Enter ATOMIC section of VMC Post. More...
 
#define SL_IEC60730_VMC_POST_EXIT_CRITICAL()   CORE_EXIT_CRITICAL()
 Exit ATOMIC section of VMC Post.
 
#define SL_IEC60730_VMC_BIST_ENTER_CRITICAL()
 Enter ATOMIC section of VMC Bist. More...
 
#define SL_IEC60730_VMC_BIST_EXIT_CRITICAL()   CORE_EXIT_CRITICAL()
 Exit ATOMIC section of VMC Bist.
 

Typedefs

typedef GPCRC_TypeDef sl_iec60730_crc_typedef
 the General Purpose Cyclic Redundancy Check (GPCRC) module
 
typedef GPCRC_Init_TypeDef sl_iec60730_crc_init_typedef
 CRC initialization structure.
 
typedef uint8_t sl_iec60730_read_type_t
 The way to read CRC value when using function sl_iec60730_update_crc_with_data_buffer.
 

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...
 
enum  sl_iec60730_timer_test_control_t { SL_IEC60730_TIMER_TEST_DISABLE = 0, SL_IEC60730_TIMER_TEST_ENABLE = 1 }
 Enable/disable switch for system timer test. More...
 
enum  { SL_IEC60730_IMC_DATA_READ = 0, SL_IEC60730_IMC_DATA_READ_BIT_REVERSED, SL_IEC60730_IMC_DATA_READ_BYTE_REVERSED }
 The way to read CRC value when using function sl_iec60730_update_crc_with_data_buffer. More...
 

Functions

void sl_iec60730_safe_state (sl_iec60730_test_failure_t failure)
 
void sl_iec60730_post (void)
 
void sl_iec60730_safety_check_error_occur (sl_iec60730_test_failure_t failure)
 
void sl_iec60730_safety_check_reset_error (void)
 
sl_iec60730_safety_check_tsl_iec60730_safety_check_get_error (void)
 
void sl_iec60730_bist (void)
 
void sl_iec60730_restart_watchdogs (void)
 
void sl_iec60730_sys_clock_count_tick (void)
 
void sl_iec60730_test_clock_tick (void)
 
void sl_iec60730_sys_clock_count_reset (void)
 
void sl_iec60730_imc_init (sl_iec60730_imc_params_t *params, sl_iec60730_imc_test_multiple_regions_t *test_config)
 
sl_iec60730_test_result_t sl_iec60730_update_crc_with_data_buffer (sl_iec60730_update_crc_params_t *params, sl_iec60730_crc_t *crc, uint8_t *buffer, uint32_t size)
 
void sl_iec60730_vmc_init (sl_iec60730_vmc_test_multiple_regions_t *test_config)
 

Variables

const sl_iec60730_library_version_t SL_IEC60730_LIBRARY_VERSION
 Global variable which holds the IEC60370 library version.
 
sl_iec60730_crc_t check_sum
 
uint16_t sl_iec60730_program_counter_check
 

Detailed Description

Library definitions.

License

Copyright 2023 Silicon Laboratories Inc. www.silabs.com

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

Macro Definition Documentation

◆ SL_IEC60730_BOARD_HEADER

#define SL_IEC60730_BOARD_HEADER

User SHOULD define SL_IEC60730_BOARD_HEADER definition for using IMC and VMC modules. This definition SHOULD be a header file. In this header file SHOULD be definitions listed in IMC and VMC modules. In our example we defined the SL_IEC60730_BOARD_HEADER definition is sl_iec60730_board.h. Our definitions in SL_IEC60730_BOARD_HEADER is an example that you can reference. Of course, user CAN redefine the SL_IEC60730_BOARD_HEADER definition to any header file.