Callisto4Bootloader: include/c4_error_codes.h Source File

Callisto4Bootloader

c4_error_codes.h
Go to the documentation of this file.
1
12 #ifndef C4_ERROR_CODES_H_
13 #define C4_ERROR_CODES_H_
14
15 /*******************************************************************************
16 * Includes
17 ******************************************************************************/
18
19 #include "c4_colours.h"
20 #include <stdbool.h>
21
22 /*******************************************************************************
23 * Defines
24 ******************************************************************************/
37 #define ERROR_LIST \
38 CALLISTO_ERR(OK, \
39 "Success.", \
40 {E_RED, DI, DAH, 0, 0, 0}) \
41 CALLISTO_ERR(FILE_NOT_FOUND, \
42 "File not found or not readable.", \
43 {E_GREEN, DI, DAH, DAH, DAH, DAH}) \
44 CALLISTO_ERR(FIELD_NOT_FOUND, \
45 "Field not found in file.", \
46 {E_GREEN, DI, DI, DAH, DAH, DAH}) \
47 CALLISTO_ERR(VERSION, \
48 "Incompatible version.", \
49 {E_GREEN, DI, DI, DI, DAH, DAH}) \
50 CALLISTO_ERR(SYNTAX, \
51 "Bad syntax.", \
52 {E_GREEN, DI, DI, DI, DI, DAH}) \
53 CALLISTO_ERR(FIELD_UNDEFINED, \
54 "Undefined field found in config.", \
55 {E_GREEN, DI, DI, DI, DI, DIT}) \
56 CALLISTO_ERR(NOT_IMPLEMENTED, \
57 "Feature not implemented.", \
58 {E_YELLOW, DI, DI, DI, DI, DIT}) \
59 CALLISTO_ERR(UNINITIALISED, \
60 "Subsystem not initialised.", \
61 {E_YELLOW, DAH, DI, DI, DI, DIT}) \
62 CALLISTO_ERR(FAILED, \
63 "Operation failed.", \
64 {E_YELLOW, DAH, DAH, DI, DI, DIT}) \
65 CALLISTO_ERR(ALREADY_SET, \
66 "Write-once value already set.", \
67 {E_YELLOW, DAH, DAH, DAH, DI, DIT}) \
68 CALLISTO_ERR(HARDWARE, \
69 "Hardware error.", \
70 {E_CYAN, DAH, DI, DI, DI, DIT}) \
71 CALLISTO_ERR(RANGE, \
72 "Range error.", \
73 {E_CYAN, DAH, DAH, DI, DI, DIT}) \
74 CALLISTO_ERR(IMAGE_INCOMPATIBLE, \
75 "Application image is not compatible.", \
76 {E_MAGENTA, DI, DAH, DAH, DAH, DAH}) \
77 CALLISTO_ERR(IMAGE_CORRUPT, \
78 "Application image is corrupt.", \
79 {E_MAGENTA, DI, DI, DAH, DAH, DAH}) \
80 CALLISTO_ERR(IMAGE_BOOTABLE, \
81 "Application image is bootable.", \
82 {E_MAGENTA, DI, DI, DI, DAH, DAH}) \
83 CALLISTO_ERR(IMAGE_EXECUTABLE, \
84 "Application image is executable.", \
85 {E_MAGENTA, DI, DI, DI, DI, DAH}) \
86 CALLISTO_ERR(SOCKET, \
87 "LWIP socket error.", \
88 {E_BLUE, DI, DI, DI, DI, DIT})
89
90 /*******************************************************************************
91 * Structures
92 ******************************************************************************/
93
94 /*******************************************************************************
95 * Prototypes
96 ******************************************************************************/
97
99 typedef enum {
100 #define CALLISTO_ERR(name, text, col_code) C4_ERR_##name,
101 ERROR_LIST
102 #undef CALLISTO_ERR
103 C4_ERR_MAX
104 } exit_code_t;
105
106
116 void C4_displayError(const char *text, exit_code_t errVal, bool fatal);
117
118 /*******************************************************************************
119 * Variables
120 ******************************************************************************/
121
122 #endif /* C4_ERROR_CODES_H_ */
ERROR_LIST
#define ERROR_LIST
Error codes and strings.
Definition: c4_error_codes.h:36
c4_colours.h
Enumeration of LED colour combinations.
exit_code_t
exit_code_t
Enumeration of error codes.
Definition: c4_error_codes.h:96
C4_displayError
void C4_displayError(const char *text, exit_code_t errVal, bool fatal)
Print exit code on serial line and flash led.
Definition: c4_error_codes.c:44
C4_ERR_MAX
Definition: c4_error_codes.h:102