Edge AI Add-on API 2.2.0
Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
21#ifndef __COMMON_H__
22#define __COMMON_H__
23
24#include <stdint.h>
25#include <string.h>
26#include <stdbool.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif /* __cplusplus */
31
39#define NULL_CHECK(x) \
40 do { \
41 if ((x) == NULL) { \
42 return STATUS_NULL_ARGUMENT; \
43 } \
44 } while (0)
45
52#define VERIFY_VALID_ARG(is_valid) \
53do { \
54 if (!(is_valid)) { \
55 return STATUS_INVALID_ARGUMENT; \
56 } \
57} while (0)
58
65#define HW_RETURN_IF(err_cond, err) __RETURN_CONDITIONAL(err_cond, err)
66
73#ifndef __RETURN_CONDITIONAL
74# define __RETURN_CONDITIONAL(expr, ret_val) \
75 do { \
76 if ((expr) == true) { \
77 return ret_val; \
78 } \
79 } \
80 while (0)
81#endif
82
84typedef void(*generic_cb_t)(void);
85
88
95typedef void(*async_drdy_cb_t)(void *data, uint32_t data_size);
96
135
136#ifdef __cplusplus
137}
138#endif /* __cplusplus */
139
140
141#endif /* __COMMON_H__ */
142
generic_cb_t irq_handler_t
Definition common.h:87
status_e
Definition common.h:104
@ STATUS_TIMEOUT
Definition common.h:133
@ STATUS_BUSY
Definition common.h:124
@ STATUS_ALREADY_IN_MODE
Definition common.h:109
@ STATUS_INVALID_ARGUMENT
Definition common.h:118
@ STATUS_SUCCESS
Definition common.h:106
@ STATUS_UNSPECIFIED_ERROR
Definition common.h:115
@ STATUS_UNAVAILABLE
Definition common.h:127
@ STATUS_NOT_SUPPORTED
Definition common.h:130
@ STATUS_NULL_ARGUMENT
Definition common.h:121
@ STATUS_HARDWARE_ERROR
Definition common.h:112
enum status_e status_t
void(* generic_cb_t)(void)
Definition common.h:84
void(* async_drdy_cb_t)(void *data, uint32_t data_size)
Base async data ready callback type.
Definition common.h:95