Skip to content

Commit 9350762

Browse files
include: add nrf_error.h when softdevice is not enabled
Add nrf_error.h to be used when SoftDevice is not enabled. Signed-off-by: Eivind Jølsgard <[email protected]>
1 parent 9bafc4f commit 9350762

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

include/nrf_error.h

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/* NOTE!
8+
* This file is only used if the SoftDevice is not enabled.
9+
* When SoftDevice is enabled, the nrf_error.h is included from SoftDevice.
10+
* See the components/softdevice folder.
11+
*/
12+
#ifdef CONFIG_SOFTDEVICE
13+
#include_next <nrf_error.h>
14+
#endif
15+
16+
/**
17+
* @defgroup nrf_error nRF Global Error Codes
18+
* @{
19+
*
20+
* @brief Global Error definitions
21+
*/
22+
23+
/* Header guard */
24+
#ifndef NRF_ERROR_H__
25+
#define NRF_ERROR_H__
26+
27+
#ifdef __cplusplus
28+
extern "C" {
29+
#endif
30+
31+
/** @defgroup NRF_ERRORS_BASE Error Codes Base number definitions
32+
* @{
33+
*/
34+
/** Global error base */
35+
#define NRF_ERROR_BASE_NUM (0x0)
36+
/** SDM error base */
37+
#define NRF_ERROR_SDM_BASE_NUM (0x1000)
38+
/** SoC error base */
39+
#define NRF_ERROR_SOC_BASE_NUM (0x2000)
40+
/** STK error base */
41+
#define NRF_ERROR_STK_BASE_NUM (0x3000)
42+
/** @} */
43+
44+
/** Successful command */
45+
#define NRF_SUCCESS (NRF_ERROR_BASE_NUM + 0)
46+
/** SVC handler is missing */
47+
#define NRF_ERROR_SVC_HANDLER_MISSING (NRF_ERROR_BASE_NUM + 1)
48+
/** SoftDevice has not been enabled */
49+
#define NRF_ERROR_SOFTDEVICE_NOT_ENABLED (NRF_ERROR_BASE_NUM + 2)
50+
/** Internal Error */
51+
#define NRF_ERROR_INTERNAL (NRF_ERROR_BASE_NUM + 3)
52+
/** No Memory for operation */
53+
#define NRF_ERROR_NO_MEM (NRF_ERROR_BASE_NUM + 4)
54+
/** Not found */
55+
#define NRF_ERROR_NOT_FOUND (NRF_ERROR_BASE_NUM + 5)
56+
/** Not supported */
57+
#define NRF_ERROR_NOT_SUPPORTED (NRF_ERROR_BASE_NUM + 6)
58+
/** Invalid Parameter */
59+
#define NRF_ERROR_INVALID_PARAM (NRF_ERROR_BASE_NUM + 7)
60+
/** Invalid state, operation disallowed in this state */
61+
#define NRF_ERROR_INVALID_STATE (NRF_ERROR_BASE_NUM + 8)
62+
/** Invalid Length */
63+
#define NRF_ERROR_INVALID_LENGTH (NRF_ERROR_BASE_NUM + 9)
64+
/** Invalid Flags */
65+
#define NRF_ERROR_INVALID_FLAGS (NRF_ERROR_BASE_NUM + 10)
66+
/** Invalid Data */
67+
#define NRF_ERROR_INVALID_DATA (NRF_ERROR_BASE_NUM + 11)
68+
/** Invalid Data size */
69+
#define NRF_ERROR_DATA_SIZE (NRF_ERROR_BASE_NUM + 12)
70+
/** Operation timed out */
71+
#define NRF_ERROR_TIMEOUT (NRF_ERROR_BASE_NUM + 13)
72+
/** Null Pointer */
73+
#define NRF_ERROR_NULL (NRF_ERROR_BASE_NUM + 14)
74+
/** Forbidden Operation */
75+
#define NRF_ERROR_FORBIDDEN (NRF_ERROR_BASE_NUM + 15)
76+
/** Bad Memory Address */
77+
#define NRF_ERROR_INVALID_ADDR (NRF_ERROR_BASE_NUM + 16)
78+
/** Busy */
79+
#define NRF_ERROR_BUSY (NRF_ERROR_BASE_NUM + 17)
80+
/** Maximum connection count exceeded. */
81+
#define NRF_ERROR_CONN_COUNT (NRF_ERROR_BASE_NUM + 18)
82+
/** Not enough resources for operation */
83+
#define NRF_ERROR_RESOURCES (NRF_ERROR_BASE_NUM + 19)
84+
85+
#ifdef __cplusplus
86+
}
87+
#endif
88+
89+
#endif /* NRF_ERROR_H__ */
90+
91+
/** @} */

0 commit comments

Comments
 (0)