1 #ifndef RUUVI_DRIVER_ERROR_H
2 #define RUUVI_DRIVER_ERROR_H
23 #define RD_FLOAT_INVALID NAN
24 #define RD_UINT64_INVALID UINT64_MAX
25 #define RD_INT64_INVALID INT64_MIN
26 #define RD_INT32_INVALID INT32_MIN
28 #define RD_SUCCESS (0U)
29 #define RD_ERROR_INTERNAL (1U<<0U)
30 #define RD_ERROR_NO_MEM (1U<<1U)
31 #define RD_ERROR_NOT_FOUND (1U<<2U)
32 #define RD_ERROR_NOT_SUPPORTED (1U<<3U)
33 #define RD_ERROR_INVALID_PARAM (1U<<4U)
34 #define RD_ERROR_INVALID_STATE (1U<<5U)
35 #define RD_ERROR_INVALID_LENGTH (1U<<6U)
36 #define RD_ERROR_INVALID_FLAGS (1U<<7U)
37 #define RD_ERROR_INVALID_DATA (1U<<8U)
38 #define RD_ERROR_DATA_SIZE (1U<<9U)
39 #define RD_ERROR_TIMEOUT (1U<<10U)
40 #define RD_ERROR_NULL (1U<<11U)
41 #define RD_ERROR_FORBIDDEN (1U<<12U)
42 #define RD_ERROR_INVALID_ADDR (1U<<13U)
43 #define RD_ERROR_BUSY (1U<<14U)
44 #define RD_ERROR_RESOURCES (1U<<15U)
45 #define RD_ERROR_NOT_IMPLEMENTED (1U<<16U)
46 #define RD_ERROR_SELFTEST (1U<<17U)
47 #define RD_STATUS_MORE_AVAILABLE (1U<<18U)
48 #define RD_ERROR_NOT_INITIALIZED (1U<<19U)
49 #define RD_ERROR_NOT_ACKNOWLEDGED (1U<<20U)
50 #define RD_ERROR_NOT_ENABLED (1U<<21U)
51 #define RD_WARNING_DEPRECATED (1U<<22U)
52 #define RD_ERROR_FATAL (1U<<31U)
70 const rd_status_t non_fatal_mask,
const char * p_file,
const int line);
83 #define RD_ERROR_CHECK(error, mask) rd_error_check(error, mask, __FILE__, __LINE__)
void rd_error_cb_set(rd_error_cb cb)
Configure application callback for errors.
uint32_t rd_status_t
bitfield for representing errors
void(* rd_error_cb)(const rd_status_t error, const bool fatal, const char *file, const int line)
void rd_error_check(rd_status_t error, rd_status_t non_fatal_mask, const char *file, int line)
Check given error code and compare it to non-fatal errors.
rd_status_t rd_errors_clear()