50 #include "cfg_subsys.h"
107 #define E_CLBSTATE_STATECHANGE ( E_CLBSTATE + 0x01 )
108 #define E_CLBSTATE_STATECHANGE_DESCR "Invalid State Change"
111 #define CLB_SUB_ALL 255
114 #define CLB_STATUS_PENDING BIT(0)
115 #define CLB_STATUS_ERROR BIT(1)
117 #define SUBS(IDX, ID, NAME) \
118 void _subs ## NAME ## ExecEvent (ClbEvent event);
124 #define SUBS(IDX, ID, NAME) \
125 bool _subs ## NAME ## Update (ClbState state, uint32_t time) __attribute__((weak));
181 void _clbStateError(
int idx,
int error,
const char * message,
const char * name);
210 bool clbStateError(
int idx,
int * code,
const char ** message);
bool errHas()
Returns whether there is an error pending.
const char *const clbEventNames[9]
All state change event names.
ClbEvent
All state change events.
Application specific error codes.
static void _clbStateModErr(int idx)
Invoked by subsystem to indicate an error happened.
ClbState clbState(int idx)
Returns the current clbSubState for the specified subsystem.
bool clbEvent(int idx, ClbEvent event)
Request a subsystem to go to a certain state.
const char * errGetDescr()
Returns the last error description, if any, else null.
void clbClearErrorState(int idx)
Clears the error state of the specific subsystem.
void clbAutoEventSeq(ClbEvent *events, int seqLen)
Executes an autonomous a sequence of events.
bool clbStateError(int idx, int *code, const char **message)
Retrieves the error of a subsystem (if any).
uint8_t clbSys2Idx[6]
Mapping from subsystem ID to index.
void clbUpdateSubsys()
Invoked the update method on each subsystem.
const char *const clbSubsystemNames[5]
Contains a list of all the subsystems.
int clbSubId(int idx)
Returns the subsystem ID code for the provided index.
Manages the global system error.
Undefined => Idle, for internal use only.
void clbStateInit()
Initializes the state machine.
const char *const clbStateNames[6]
Contains list of the state names.
void errClear()
Clears the current error.
uint32_t errGet()
Returns the last error code, or null.
const char * errGetName()
Returns the last error cause name, or null.
#define ERROR(CODE,...)
Expands an error code to an error code with a description (if ERROR_W_DESCR is declared).
void _clbStateError(int idx, int error, const char *message, const char *name)
Invoked by subsystem to indicate an error happened.
#define E_UNKNOWN
Generic error: Unknown error.
void _clbStateUpdate(int idx, ClbEvent event, uint8_t status)
Invoked by the subsystem to indicate a state change has happened.
Undefined state (prior to module init, should never be seen on shore)
uint8_t clbStatus(int idx)
Returns the current subsystem status.