Files CCore/inc/dev/DevPlanInit.h CCore/src/dev/DevPlanInit.cpp
This part is a PlanInit node for the Dev subsystem and some extra initialization functions. Dev includes initialization the most important peripheral devices on the board, like interrupt controller.
/* DevPlanInit.h */ #ifndef CCore_inc_dev_DevPlanInit_h #define CCore_inc_dev_DevPlanInit_h #include <CCore/inc/PlanInit.h> namespace CCore { namespace Dev { /* init/exit functions */ void Init_CPU(); void Exit_CPU(); /* GetPlanInitNode_...() */ PlanInitNode * GetPlanInitNode_Dev(); } // namespace Dev } // namespace CCore #endif
The typical implementation is:
/* DevPlanInit.cpp */ #include <CCore/inc/dev/DevPlanInit.h> #include <CCore/inc/dev/DevIntHandle.h> #include <__std_init.h> namespace CCore { namespace Dev { /* Init_CPU() */ void Init_CPU() { // TODO } void Exit_CPU() { // TODO } /* GetPlanInitNode_...() */ namespace Private_DevPlanInit { struct Empty { static const char * GetTag() { return "Dev"; } }; PlanInitObject<Empty,PlanInitReq<GetPlanInitNode_DevIntHandle> > Object CCORE_INITPRI_1 ; } // namespace Private_DevPlanInit using namespace Private_DevPlanInit; PlanInitNode * GetPlanInitNode_Dev() { return &Object; } } // namespace Dev } // namespace CCore
Two special functions Init_CPU() and Exit_CPU() are used by the first stage initialization code to switch CPU into desired mode of operation and turn back.