src.dualinventive.com/fw/libdi_fw-tests/libdi/libdi_constants/include/di/errno.h

118 lines
6.8 KiB
C
Executable File

#ifndef INCLUDE_DI_ERRNO_H_
#define INCLUDE_DI_ERRNO_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#define DI_ERRNO_LIST \
DI_ERRNO(DNOK, 0U, "Valid/success") \
/* 1 - 255: Generic */ \
DI_ERRNO(DNE_PARAM, 1U, "Invalid parameter") \
DI_ERRNO(DNE_RANGE, 2U, "Value/parameter out of range") \
DI_ERRNO(DNE_NODEV, 3U, "No such device") \
DI_ERRNO(DNE_NORES, 4U, "No such resource") \
DI_ERRNO(DNE_BUSY, 5U, "Device or resource busy") \
DI_ERRNO(DNE_OPNOTSUPP, 6U, "Operation not supported") \
DI_ERRNO(DNE_PROTO, 7U, "Protocol error") \
DI_ERRNO(DNE_CHECKSUM, 8U, "Checksum error") \
DI_ERRNO(DNE_TIMEOUT, 9U, "Timeout") \
DI_ERRNO(DNE_DISCONNECTED, 10U, "Disconnected") \
DI_ERRNO(DNE_AGAIN, 11U, "Try again") \
DI_ERRNO(DNE_OPDENIED, 12U, "Operation denied") \
DI_ERRNO(DNE_IOFAILED, 13U, "I/O operation failed") \
DI_ERRNO(DNE_NOTFOUND, 14U, "Not found") \
DI_ERRNO(DNE_NOMEM, 16U, "Out of memory") \
/* 256 - 511: Secure server */ \
DI_ERRNO(DNE_DUPLICATE_PROJECT, 256U, "Duplicate project found") \
DI_ERRNO(DNE_INVALID_PROJECT_STATE, 257U, "Invalid project state reached") \
DI_ERRNO(DNE_INVALID_MUTATION, 258U, "Invalid mutation requested") \
DI_ERRNO(DNE_INVALID_ACTION, 259U, "Invalid action specified") \
DI_ERRNO(DNE_PROJECT_CHANGED, 260U, "Project data changed") \
DI_ERRNO(DNE_PLANNING_CHANGED, 261U, "Project planning changed") \
DI_ERRNO(DNE_DESIGN_CHANGED, 262U, "Project design changed") \
DI_ERRNO(DNE_DATABASE_ERROR, 263U, "Database error occurred") \
DI_ERRNO(DNE_NO_PROJECT_DATA, 264U, "No project data provided") \
DI_ERRNO(DNE_INVALID_PROJECT, 265U, "Invalid project selected") \
DI_ERRNO(DNE_INVALID_REQUEST, 266U, "Invalid request supplied") \
DI_ERRNO(DNE_INTERNAL_ERROR, 267U, "Internal error supplied") \
DI_ERRNO(DNE_NO_BACKEND, 268U, "Back-end is not connected") \
DI_ERRNO(DNE_BACKEND_INVALID_MESSAGE, 269U, "Back-end sent an invalid message") \
DI_ERRNO(DNE_SETUP_CHANGED, 270U, "Project setup changed") \
DI_ERRNO(DNE_INVALID_PROJECT_TYPE, 271U, "Project type not recognized") \
DI_ERRNO(DNE_NO_PROJECT_DEVICES, 272U, "No project devices provided") \
DI_ERRNO(DNE_NO_PROJECT_GROUP, 273U, "No project groups provided") \
DI_ERRNO(DNE_ACTIVATION_FAILED, 274U, "Project activation failed") \
DI_ERRNO(DNE_DEACTIVATION_FAILED, 275U, "Project deactivation failed") \
/* 512 - 767: Business-logic */ \
DI_ERRNO(DNE_BACKEND_DUPLICATE_PROJECT, 512U, "Duplicate project") \
DI_ERRNO(DNE_BACKEND_INVALID_PROJECT, 513U, "Invalid project") \
DI_ERRNO(DNE_BACKEND_DEVICE_ERROR, 514U, "Device error") \
DI_ERRNO(DNE_BACKEND_INTERNAL_ERROR, 515U, "Back-end internal error") \
DI_ERRNO(DNE_BACKEND_INVALID_MUTATION, 516U, "Invalid mutation requested") \
DI_ERRNO(DNE_BACKEND_INVALID_GROUP, 517U, "Invalid group action") \
/* 1024 - 2047: Firmware */ \
DI_ERRNO(DNE_FIRMWARE_TILT, 1024U, "Tilt error") \
DI_ERRNO(DNE_FIRMWARE_ULTRASONIC, 1025U, "Ultrasonic error") \
DI_ERRNO(DNE_FIRMWARE_SPEAKER, 1026U, "Speaker error") \
DI_ERRNO(DNE_FIRMWARE_EEPROM, 1027U, "EEPROM error") \
DI_ERRNO(DNE_FIRMWARE_CALIBRATION, 1028U, "Calibration error") \
DI_ERRNO(DNE_FIRMWARE_BA, 1029U, "BA error") \
DI_ERRNO(DNE_FIRMWARE_VREF, 1030U, "Vref error") \
/* 2048 - 2112: DI CAN Protocol */ \
DI_ERRNO(DNE_CAN_INVAL, 3000U, "CAN invalid argument") \
DI_ERRNO(DNE_CAN_IO, 3001U, "CAN peripheral I/O error") \
DI_ERRNO(DNE_CAN_TIMEOUT, 3002U, "CAN timeout") \
DI_ERRNO(DNE_CAN_AGAIN, 3003U, "CAN try again") \
DI_ERRNO(DNE_CAN_NOBUFS, 3004U, "CAN buffers depleted") \
DI_ERRNO(DNE_CAN_PROTO, 3005U, "CAN protocol error") \
DI_ERRNO(DNE_CAN_CRC, 3006U, "CAN msg CRC error") \
/* UINT32_MAX: Unknown/reserved */ \
DI_ERRNO(DNE_UNKNOWN, UINT32_MAX, "<di_errno_t>")
#define DI_ERRNO(_e, _v, descr) _e = _v,
enum di_errno {
DI_ERRNO_LIST
};
#undef DI_ERRNO
/** Error code ranges */
enum di_errno_ranges {
DI_ERRNO_RANGE_GENERIC_FIRST = 1,
DI_ERRNO_RANGE_GENERIC_LAST = 255,
DI_ERRNO_RANGE_SECURE_SERVER_FIRST = 256,
DI_ERRNO_RANGE_SECURE_SERVER_LAST = 511,
DI_ERRNO_RANGE_BUSINESS_LOGIC_FIRST = 512,
DI_ERRNO_RANGE_BUSINESS_LOGIC_LAST = 767,
/* 768-1023 reserved for future use */
DI_ERRNO_RANGE_FIRMWARE_FIRST = 1024,
DI_ERRNO_RANGE_FIRMWARE_LAST = 2999,
DI_ERRNO_RANGE_CAN_PROTOCOL_FIRST = 3000,
DI_ERRNO_RANGE_CAN_PROTOCOL_LAST = 3050,
/* 9216 - 10239 reserved for future use */
DI_ERRNO_RANGE_FRONTEND_FIRST = 9216,
DI_ERRNO_RANGE_FRONTEND_LAST = 10239
/* 10240 - (UINT32_MAX - 1) reserved for future use */
};
/**
* Get errno enumerator description
* @param errnum Error number of type di_errno
*/
const char *di_errno_descr(uint32_t errnum);
/**
* Get errno enumerator string
* @param errnum Error number of type di_errno
*/
const char *di_errno_str(uint32_t errnum);
#ifdef __cplusplus
}
#endif
#endif /* INCLUDE_DI_ERRNO_H_ */