hsw-nbt 1.2.0
OPTIGA Authenticate NBT Host Library for C
ifx-error.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2024-2026 Infineon Technologies AG
2// SPDX-License-Identifier: MIT
3
8#ifndef IFX_ERROR_H
9#define IFX_ERROR_H
10
11#include <stdbool.h>
12#include <stdint.h>
13#ifdef __cplusplus
14extern "C" {
15#endif
16
23#define IFX_MODULE(library_id, module_id) \
24 (uint16_t) (((library_id & 0x7F) << 8) | (module_id & 0xFF))
25
29#define IFX_SUCCESS ((ifx_status_t) 0x00000000)
30
34#define IFX_ERROR_INDICATOR ((ifx_status_t) 0x80000000u)
35
39#define IFX_UNSPECIFIED_ERROR ((uint8_t) 0xffu)
40
44#define IFX_OUT_OF_MEMORY ((uint8_t) 0xfeu)
45
49#define IFX_ILLEGAL_ARGUMENT ((uint8_t) 0xfdu)
50
54#define IFX_TOO_LITTLE_DATA ((uint8_t) 0xfcu)
55
60#define IFX_INVALID_STATE ((uint8_t) 0xfbu)
61
66#define IFX_PROGRAMMING_ERROR ((uint8_t) 0xfau)
67
83#define IFX_ERROR(module, function, reason) \
84 ((ifx_status_t) (IFX_ERROR_INDICATOR | (((module >> 8) & 0x7Fu) << 24) | \
85 (((module) & 0xFFu) << 16) | \
86 (((function) & 0xFFu) << 8) | ((reason) & 0xFFu)))
87
91typedef uint32_t ifx_status_t;
92
99bool ifx_error_check(ifx_status_t status_code);
100
111
122
133
144
145#ifdef __cplusplus
146}
147#endif
148
149#endif // IFX_ERROR_H
uint8_t ifx_error_get_reason(ifx_status_t error_code)
Extracts function specific reason from error code.
uint8_t ifx_error_get_module(ifx_status_t error_code)
Extracts module identifier from error code.
bool ifx_error_check(ifx_status_t status_code)
Checks if status code indicates error.
uint8_t ifx_error_get_library(ifx_status_t error_code)
Extracts library identifier from error code.
uint32_t ifx_status_t
Custom return code type used by all Infineon host software libraries.
Definition ifx-error.h:91
uint8_t ifx_error_get_function(ifx_status_t error_code)
Extracts function identifier from error code.