Skip to content

Commit c2b7502

Browse files
authored
Merge pull request #2809 from jphickey/fix-2798-es-apps-complexity
Fix #2798, reduce complexity of ES functions
2 parents f881799 + bf9ba63 commit c2b7502

24 files changed

Lines changed: 1410 additions & 895 deletions

‎cmake/target/inc/target_objtab.h‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,22 @@
4040
* objtab.c file. ES iterates the table of pointers to these descriptors
4141
* at each lifecycle phase:
4242
*
43-
* - EarlyInit : called before any tasks are started
44-
* - TaskMain : entry point passed to OS_TaskCreate(); NULL for library modules
45-
* - Cleanup : called during shutdown; NULL if not required
43+
* - EarlyInit : called before any tasks are started
44+
* - TaskMain : entry point passed to OS_TaskCreate(); NULL for library modules
45+
* - AppCleanupCb : Notification function called when state from an external is cleaned up.
46+
* If this module has any resources associated with the given app, this routine
47+
* should free those resources. If this module does not track any per-app state,
48+
* then this should be set NULL. The parameter is the CFE ES AppId converted to
49+
* a plain unsigned integer value (the CFE_ES_AppId_t typedef does not exist here).
4650
*/
4751
typedef struct
4852
{
49-
const char *Name; /**< Module name, e.g. "CFE_EVS" */
50-
int32 (*EarlyInit)(void); /**< Early initialization function; must not be NULL */
51-
void (*TaskMain)(void); /**< Task entry point; NULL for library-only modules */
52-
int32 (*Cleanup)(uint32 Id); /**< Cleanup function; NULL if not required */
53-
uint32 Priority; /**< Task priority; ignored if TaskMain is NULL */
54-
uint32 StackSize; /**< Task stack size in bytes; ignored if TaskMain is NULL */
53+
const char *Name; /**< Module name, e.g. "CFE_EVS" */
54+
int32 (*EarlyInit)(void); /**< Early initialization function; must not be NULL */
55+
void (*TaskMain)(void); /**< Task entry point; NULL for library-only modules */
56+
int32 (*AppCleanupCb)(uint32 Id); /**< Callback function to invoke when external apps are stopped */
57+
uint32 Priority; /**< Task priority; ignored if TaskMain is NULL */
58+
uint32 StackSize; /**< Task stack size in bytes; ignored if TaskMain is NULL */
5559
} Target_ObjectTable_t;
5660

5761
#endif /* CFE_ES_OBJTAB_H */

‎modules/config/fsw/src/cfe_config_objtab.c‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,5 @@
3030
#include "target_objtab.h"
3131
#include "cfe_config_core_internal.h"
3232

33-
const Target_ObjectTable_t CFE_CONFIG_ModuleEntry = { .Name = "CFE_CONFIG",
34-
.EarlyInit = CFE_Config_Init,
35-
.TaskMain = NULL, /* library module - no task */
36-
.Cleanup = NULL,
37-
.Priority = 0,
38-
.StackSize = 0 };
33+
/* this is a core library module with no task, but it does have global data to initialize */
34+
const Target_ObjectTable_t CFE_CONFIG_ModuleEntry = { .Name = "CFE_CONFIG", .EarlyInit = CFE_Config_Init };

‎modules/es/CMakeLists.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ project(CFE_ES C)
99
# Executive services source files
1010
set(es_SOURCES
1111
fsw/src/cfe_es_api.c
12+
fsw/src/cfe_es_appctrl.c
1213
fsw/src/cfe_es_apps.c
1314
fsw/src/cfe_es_backgroundtask.c
1415
fsw/src/cfe_es_cds.c
@@ -21,6 +22,7 @@ set(es_SOURCES
2122
fsw/src/cfe_es_perf.c
2223
fsw/src/cfe_es_resource.c
2324
fsw/src/cfe_es_start.c
25+
fsw/src/cfe_es_startupscript.c
2426
fsw/src/cfe_es_syslog.c
2527
fsw/src/cfe_es_task.c
2628
)

0 commit comments

Comments
 (0)