ModusToolbox Safety Test Library
Loading...
Searching...
No Matches
STL return status codes

General Description

Return status codes used by the mtb-stl self-test APIs.

Only OK_STATUS and ERROR_STATUS are global to the whole library. Every other code is module-scoped: several codes deliberately reuse the same numeric value because they belong to different self-tests and are never returned by the same API. For example, SHORT_TO_VCC and ERROR_STACK_OVERFLOW are both 1, and SHORT_TO_GND, ERROR_STACK_UNDERFLOW, CRC_SAVED_STATUS and PASS_STILL_TESTING_STATUS are all 2. Always compare a returned value only against the constants documented for the specific API that produced it; never compare status codes across modules.

Macros

#define OK_STATUS   (0u)
 Test passed / operation completed successfully.
#define ERROR_STATUS   (1u)
 Test failed or a generic error occurred.
#define PWM_INIT_ERROR_STATUS   (255u)
 PWM init: initialization failed before the self-test could run.
#define UART_SLAVE_RESPOND_STARTED_STATUS   (0u)
 UART slave respond: background response started successfully.
#define UART_SLAVE_RESPOND_NOT_STARTED_STATUS   (1u)
 UART slave respond: response was not started because the unit is idle or input is invalid.
#define UART_MASTER_MESSAGE_STARTED_STATUS   (0u)
 UART master transfer: background message process started successfully.
#define UART_MASTER_MESSAGE_NOT_STARTED_STATUS   (1u)
 UART master transfer: message process did not start because the unit is busy or input is invalid.
#define ERROR_UART_NOT_ENABLE   (6u)
 UART self-test: the UART block is not enabled.
#define UNKNOWN_ERROR   (8u)
 UART self-test: an unexpected or unclassified error occurred.
#define ERROR_TX_NOT_EMPTY   (4u)
 UART/SPI self-test: the transmit buffer did not drain as expected.
#define ERROR_RX_NOT_EMPTY   (5u)
 UART/SPI self-test: the receive buffer was not empty as expected.
#define ERROR_STACK_OVERFLOW   (1u)
 Stack range bitmask flag: bottom guard corrupted (stack overflow).
#define ERROR_STACK_UNDERFLOW   (2u)
 Stack range bitmask flag: top guard corrupted (stack underflow).
#define I2C_MASTER_BUSY_STATUS   (4u)
 I2C self-test: the I2C master is busy.
#define SHORT_TO_VCC   (1u)
 Digital I/O self-test: the tested pin is shorted to VCC.
#define SHORT_TO_GND   (2u)
 Digital I/O self-test: the tested pin is shorted to ground.
#define ERROR_INCORRECT_USAGE_STATUS   (4u)
 An API was called in an incorrect sequence, state, or execution context.
#define ERROR_BAD_PARAM   (9u)
 A bad input parameter was passed to a self-test API.
#define MTB_STL_ERROR_TIMEOUT   (10u)
 Timeout return status - waiting for hardware event exceeded timeout.
#define CRC_SAVED_STATUS   (2u)
 Startup Configuration Registers self-test (CRC mode): the CRC baseline was just stored on the first run.
#define PASS_STILL_TESTING_STATUS   (2u)
 Multi-call self-test (Flash, Clock, Configuration Registers, I2C, UART, SPI): the test is still running and has not yet produced a final result.
#define PASS_COMPLETE_STATUS   (3u)
 Multi-call self-test: the test completed and the final result is available.
#define ERROR_ADC_CONFIG_SNAPSHOT_INVALID   (7u)
 ADC Configuration Protection self-test: the stored snapshot failed its own CRC integrity check.

Macro Definition Documentation

◆ OK_STATUS

#define OK_STATUS   (0u)

Test passed / operation completed successfully.

Returned by every self-test.

◆ ERROR_STATUS

#define ERROR_STATUS   (1u)

Test failed or a generic error occurred.

Returned by every self-test.

◆ UART_SLAVE_RESPOND_STARTED_STATUS

#define UART_SLAVE_RESPOND_STARTED_STATUS   (0u)

UART slave respond: background response started successfully.

Module-scoped: aliases OK_STATUS for the UART slave respond API.

◆ UART_SLAVE_RESPOND_NOT_STARTED_STATUS

#define UART_SLAVE_RESPOND_NOT_STARTED_STATUS   (1u)

UART slave respond: response was not started because the unit is idle or input is invalid.

Module-scoped: shares the value 1 with ERROR_STATUS and other module-specific failures.

◆ UART_MASTER_MESSAGE_STARTED_STATUS

#define UART_MASTER_MESSAGE_STARTED_STATUS   (0u)

UART master transfer: background message process started successfully.

Module-scoped: aliases OK_STATUS for the UART master transfer API.

◆ UART_MASTER_MESSAGE_NOT_STARTED_STATUS

#define UART_MASTER_MESSAGE_NOT_STARTED_STATUS   (1u)

UART master transfer: message process did not start because the unit is busy or input is invalid.

Module-scoped: shares the value 1 with ERROR_STATUS and other module-specific failures.

◆ ERROR_STACK_OVERFLOW

#define ERROR_STACK_OVERFLOW   (1u)

Stack range bitmask flag: bottom guard corrupted (stack overflow).

Module-scoped: shares the value 1 with SHORT_TO_VCC.

◆ ERROR_STACK_UNDERFLOW

#define ERROR_STACK_UNDERFLOW   (2u)

Stack range bitmask flag: top guard corrupted (stack underflow).

Module-scoped: shares the value 2 with SHORT_TO_GND, CRC_SAVED_STATUS and PASS_STILL_TESTING_STATUS.

◆ SHORT_TO_VCC

#define SHORT_TO_VCC   (1u)

Digital I/O self-test: the tested pin is shorted to VCC.

Module-scoped: shares the value 1 with ERROR_STACK_OVERFLOW.

◆ SHORT_TO_GND

#define SHORT_TO_GND   (2u)

Digital I/O self-test: the tested pin is shorted to ground.

Module-scoped: shares the value 2 with ERROR_STACK_UNDERFLOW, CRC_SAVED_STATUS and PASS_STILL_TESTING_STATUS.

◆ CRC_SAVED_STATUS

#define CRC_SAVED_STATUS   (2u)

Startup Configuration Registers self-test (CRC mode): the CRC baseline was just stored on the first run.

Module-scoped: shares the value 2 with ERROR_STACK_UNDERFLOW, SHORT_TO_GND and PASS_STILL_TESTING_STATUS.

◆ PASS_STILL_TESTING_STATUS

#define PASS_STILL_TESTING_STATUS   (2u)

Multi-call self-test (Flash, Clock, Configuration Registers, I2C, UART, SPI): the test is still running and has not yet produced a final result.

Module-scoped: shares the value 2 with ERROR_STACK_UNDERFLOW, SHORT_TO_GND and CRC_SAVED_STATUS.

◆ ERROR_ADC_CONFIG_SNAPSHOT_INVALID

#define ERROR_ADC_CONFIG_SNAPSHOT_INVALID   (7u)

ADC Configuration Protection self-test: the stored snapshot failed its own CRC integrity check.

The snapshot itself is untrustworthy, so no register comparison was performed.