-
Notifications
You must be signed in to change notification settings - Fork 207
/
cfe_es.h
1635 lines (1553 loc) · 71.1 KB
/
cfe_es.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
** GSC-18128-1, "Core Flight Executive Version 6.7"
**
** Copyright (c) 2006-2019 United States Government as represented by
** the Administrator of the National Aeronautics and Space Administration.
** All Rights Reserved.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/**
* @file
*
* Purpose:
* Unit specification for Executive Services library functions and macros.
*
* References:
* Flight Software Branch C Coding Standard Version 1.0a
* cFE Flight Software Application Developers Guide
*
* Notes:
*
*/
#ifndef CFE_ES_H
#define CFE_ES_H
/*
** Includes
*/
#include "common_types.h"
#include "cfe_error.h"
#include "cfe_es_api_typedefs.h"
/*
** The OS_PRINTF macro may be defined by OSAL to enable
** printf-style argument checking. If using a version of OSAL
** that does not define this then define it as a no-op.
*/
#ifndef OS_PRINTF
#define OS_PRINTF(m, n)
#endif
/*
** Macro Definitions
*/
#define CFE_ES_DBIT(x) (1L << (x)) /* Places a one at bit positions 0 thru 31 */
#define CFE_ES_DTEST(i, x) (((i)&CFE_ES_DBIT(x)) != 0) /* true iff bit x of i is set */
#define CFE_ES_TEST_LONG_MASK(m, s) \
(CFE_ES_DTEST(m[(s) / 32], (s) % 32)) /* Test a bit within an array of 32-bit integers. */
/*****************************************************************************/
/*
** Exported Functions
*/
/*****************************************************************************/
/** @defgroup CFEAPIESResourceID cFE Resource ID APIs
* @{
*/
/**
* @brief Obtain an index value correlating to an ES Application ID
*
* This calculates a zero based integer value that may be used for indexing
* into a local resource table/array.
*
* Index values are only guaranteed to be unique for resources of the same
* type. For instance, the indices corresponding to two [valid] application
* IDs will never overlap, but the index of an application and a library ID
* may be the same. Furthermore, indices may be reused if a resource is
* deleted and re-created.
*
* @note There is no inverse of this function - indices cannot be converted
* back to the original AppID value. The caller should retain the original ID
* for future use.
*
* @param[in] AppID Application ID to convert
* @param[out] Idx Buffer where the calculated index will be stored
*
* @return Execution status, see @ref CFEReturnCodes
* @retval #CFE_SUCCESS @copybrief CFE_SUCCESS
* @retval #CFE_ES_ERR_RESOURCEID_NOT_VALID @copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
*/
CFE_Status_t CFE_ES_AppID_ToIndex(CFE_ES_AppId_t AppID, uint32 *Idx);
/**
* @brief Obtain an index value correlating to an ES Library ID
*
* This calculates a zero based integer value that may be used for indexing
* into a local resource table/array.
*
* Index values are only guaranteed to be unique for resources of the same
* type. For instance, the indices corresponding to two [valid] Library
* IDs will never overlap, but the index of an Library and a library ID
* may be the same. Furthermore, indices may be reused if a resource is
* deleted and re-created.
*
* @note There is no inverse of this function - indices cannot be converted
* back to the original LibID value. The caller should retain the original ID
* for future use.
*
* @param[in] LibID Library ID to convert
* @param[out] Idx Buffer where the calculated index will be stored
*
* @return Execution status, see @ref CFEReturnCodes
* @retval #CFE_SUCCESS @copybrief CFE_SUCCESS
* @retval #CFE_ES_ERR_RESOURCEID_NOT_VALID @copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
*/
int32 CFE_ES_LibID_ToIndex(CFE_ES_LibId_t LibID, uint32 *Idx);
/**
* @brief Obtain an index value correlating to an ES Task ID
*
* This calculates a zero based integer value that may be used for indexing
* into a local resource table/array.
*
* Index values are only guaranteed to be unique for resources of the same
* type. For instance, the indices corresponding to two [valid] Task
* IDs will never overlap, but the index of an Task and a library ID
* may be the same. Furthermore, indices may be reused if a resource is
* deleted and re-created.
*
* @note There is no inverse of this function - indices cannot be converted
* back to the original TaskID value. The caller should retain the original ID
* for future use.
*
* @param[in] TaskID Task ID to convert
* @param[out] Idx Buffer where the calculated index will be stored
*
* @return Execution status, see @ref CFEReturnCodes
* @retval #CFE_SUCCESS @copybrief CFE_SUCCESS
* @retval #CFE_ES_ERR_RESOURCEID_NOT_VALID @copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
*/
CFE_Status_t CFE_ES_TaskID_ToIndex(CFE_ES_TaskId_t TaskID, uint32 *Idx);
/**
* @brief Obtain an index value correlating to an ES Counter ID
*
* This calculates a zero based integer value that may be used for indexing
* into a local resource table/array.
*
* Index values are only guaranteed to be unique for resources of the same
* type. For instance, the indices corresponding to two [valid] Counter
* IDs will never overlap, but the index of an Counter and a library ID
* may be the same. Furthermore, indices may be reused if a resource is
* deleted and re-created.
*
* @note There is no inverse of this function - indices cannot be converted
* back to the original CounterID value. The caller should retain the original ID
* for future use.
*
* @param[in] CounterID Counter ID to convert
* @param[out] Idx Buffer where the calculated index will be stored
*
* @return Execution status, see @ref CFEReturnCodes
* @retval #CFE_SUCCESS @copybrief CFE_SUCCESS
* @retval #CFE_ES_ERR_RESOURCEID_NOT_VALID @copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
*/
CFE_Status_t CFE_ES_CounterID_ToIndex(CFE_ES_CounterId_t CounterID, uint32 *Idx);
/** @} */
/*****************************************************************************/
/** @defgroup CFEAPIESEntryExit cFE Entry/Exit APIs
* @{
*/
/*****************************************************************************/
/**
** \brief cFE Main Entry Point used by Board Support Package to start cFE
**
** \par Description
** cFE main entry point. This is the entry point into the cFE software.
** It is called only by the Board Support Package software.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in] StartType Identifies whether this was a #CFE_PSP_RST_TYPE_POWERON or #CFE_PSP_RST_TYPE_PROCESSOR.
**
** \param[in] StartSubtype Specifies, in more detail, what caused the \c StartType identified above.
** See #CFE_PSP_RST_SUBTYPE_POWER_CYCLE for possible examples.
**
** \param[in] ModeId Identifies the source of the Boot as determined by the BSP.
**
** \param[in] StartFilePath Identifies the startup file to use to initialize the cFE apps.
**
** \sa #CFE_ES_ResetCFE
**
******************************************************************************/
void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const char *StartFilePath);
/*****************************************************************************/
/**
** \brief Reset the cFE Core and all cFE Applications
**
** \par Description
** This API causes an immediate reset of the cFE Kernel and all cFE Applications.
** The caller can specify whether the reset should clear all memory (#CFE_PSP_RST_TYPE_POWERON)
** or try to retain volatile memory areas (#CFE_PSP_RST_TYPE_PROCESSOR).
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in] ResetType Identifies the type of reset desired. Allowable settings are:
** \arg #CFE_PSP_RST_TYPE_POWERON - Causes all memory to be cleared
** \arg #CFE_PSP_RST_TYPE_PROCESSOR - Attempts to retain volatile disk, critical data store
** and user reserved memory.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
** \retval #CFE_ES_NOT_IMPLEMENTED \copybrief CFE_ES_NOT_IMPLEMENTED
**
** \sa #CFE_ES_Main
**
******************************************************************************/
CFE_Status_t CFE_ES_ResetCFE(uint32 ResetType);
/**@}*/
/** @defgroup CFEAPIESAppControl cFE Application Control APIs
* @{
*/
/*****************************************************************************/
/**
** \brief Restart a single cFE Application
**
** \par Description
** This API causes a cFE Application to be unloaded and restarted
** from the same file name as the last start.
**
** \par Assumptions, External Events, and Notes:
** The filename is checked for existance prior to load. A missing file
** will be reported and the reload operation will be aborted prior
** to unloading the app.
**
** Goes through the standard CFE_ES_CleanUpApp which unloads,
** then attempts a load using the original file name.
**
** In the event that an application cannot be reloaded due to a
** missing file or any other load issue, the application may no longer be
** restarted or reloaded when given a valid load file (the app has been
** deleted and no longer exists). To recover, the application
** may be started by loading the application via the ES_STARTAPP
** command (#CFE_ES_START_APP_CC).
**
** \param[in] AppID Identifies the application to be reset.
**
** \return Execution status, see \ref CFEReturnCodes
**
** \sa #CFE_ES_ReloadApp, #CFE_ES_DeleteApp
**
******************************************************************************/
CFE_Status_t CFE_ES_RestartApp(CFE_ES_AppId_t AppID);
/*****************************************************************************/
/**
** \brief Reload a single cFE Application
**
** \par Description
** This API causes a cFE Application to be stopped and restarted from
** the specified file.
**
** \par Assumptions, External Events, and Notes:
** The filename is checked for existance prior to load. A missing file
** will be reported and the reload operation will be aborted prior
** to unloading the app.
**
** Goes through the standard CFE_ES_CleanUpApp which unloads,
** then attempts a load using the specified file name.
**
** In the event that an application cannot be reloaded due to
** a corrupt file, the application may no longer be reloaded when given a valid
** load file (it has been deleted and no longer exists). To recover, the
** application may be started by loading the application via the ES_STARTAPP
** command (#CFE_ES_START_APP_CC).
**
** \param[in] AppID Identifies the application to be reset.
**
** \param[in] AppFileName Identifies the new file to start.
**
** \return Execution status, see \ref CFEReturnCodes
**
** \sa #CFE_ES_RestartApp, #CFE_ES_DeleteApp, #CFE_ES_START_APP_CC
**
******************************************************************************/
CFE_Status_t CFE_ES_ReloadApp(CFE_ES_AppId_t AppID, const char *AppFileName);
/*****************************************************************************/
/**
** \brief Delete a cFE Application
**
** \par Description
** This API causes a cFE Application to be stopped deleted.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in] AppID Identifies the application to be reset.
**
** \return Execution status, see \ref CFEReturnCodes
**
** \sa #CFE_ES_RestartApp, #CFE_ES_ReloadApp
**
******************************************************************************/
CFE_Status_t CFE_ES_DeleteApp(CFE_ES_AppId_t AppID);
/**@}*/
/** @defgroup CFEAPIESAppBehavior cFE Application Behavior APIs
* @{
*/
/*****************************************************************************/
/**
** \brief Exit a cFE Application
**
** \par Description
** This API is the "Exit Point" for the cFE application
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in] ExitStatus Acceptable values are: \arg #CFE_ES_RunStatus_APP_EXIT - \copybrief CFE_ES_RunStatus_APP_EXIT
** \arg #CFE_ES_RunStatus_APP_ERROR - \copybrief CFE_ES_RunStatus_APP_ERROR
** \arg #CFE_ES_RunStatus_CORE_APP_INIT_ERROR - \copybrief CFE_ES_RunStatus_CORE_APP_INIT_ERROR
** \arg #CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR - \copybrief CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR
**
**
** \sa #CFE_ES_RunLoop
**
******************************************************************************/
void CFE_ES_ExitApp(uint32 ExitStatus);
/*****************************************************************************/
/**
** \brief Check for Exit, Restart, or Reload commands
**
** \par Description
** This is the API that allows an app to check for exit requests from
** the system.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in] ExitStatus A pointer to a variable containing the Application's
** desired run status. Acceptable values are:
** \arg #CFE_ES_RunStatus_APP_RUN - \copybrief CFE_ES_RunStatus_APP_RUN
** \arg #CFE_ES_RunStatus_APP_EXIT - \copybrief CFE_ES_RunStatus_APP_EXIT
** \arg #CFE_ES_RunStatus_APP_ERROR - \copybrief CFE_ES_RunStatus_APP_ERROR
**
** \return Boolean indicating application should continue running
** \retval true Application should continue running
** \retval false Application should not continue running
**
** \sa #CFE_ES_ExitApp
**
******************************************************************************/
bool CFE_ES_RunLoop(uint32 *ExitStatus);
/*****************************************************************************/
/**
** \brief Allow an Application to Wait for a minimum global system state
**
** \par Description
** This is the API that allows an app to wait for the rest of the apps
** to complete a given stage of initialization before continuing.
**
** This gives finer grained control than #CFE_ES_WaitForStartupSync
**
** \par Assumptions, External Events, and Notes:
** This API assumes that the caller has also been initialized sufficiently
** to satisfy the global system state it is waiting for, and the apps own
** state will be updated accordingly.
**
** \param[in] TimeOutMilliseconds The timeout value in Milliseconds.
** This parameter must be at least 1000. Lower values
** will be rounded up. There is not an option to
** wait indefinitely to avoid hanging a critical
** application because a non-critical app did not start.
**
** \param[in] MinSystemState Determine the state of the App
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS State successfully achieved
** \retval #CFE_ES_OPERATION_TIMED_OUT Timeout was reached
**
** \sa #CFE_ES_RunLoop
**
******************************************************************************/
CFE_Status_t CFE_ES_WaitForSystemState(uint32 MinSystemState, uint32 TimeOutMilliseconds);
/*****************************************************************************/
/**
** \brief Allow an Application to Wait for the "OPERATIONAL" global system state
**
** \par Description
** This is the API that allows an app to wait for the rest of the apps
** to complete their entire initialization before continuing. It is most
** useful for applications such as Health and Safety or the Scheduler that need
** to wait until applications exist and are running before sending out
** packets to them.
**
** This is a specialized wrapper for CFE_ES_WaitForSystemState for compatibility
** with applications using this API.
**
** \par Assumptions, External Events, and Notes:
** This API should only be called as the last item of an Apps initialization.
** In addition, this API should only be called by an App that is started
** from the ES Startup file. It should not be used by an App that is
** started after the system is running. ( Although it will cause no harm )
**
** \param[in] TimeOutMilliseconds The timeout value in Milliseconds.
** This parameter must be at least 1000. Lower values
** will be rounded up. There is not an option to
** wait indefinitely to avoid hanging a critical
** application because a non-critical app did not start.
**
** \sa #CFE_ES_RunLoop
**
******************************************************************************/
void CFE_ES_WaitForStartupSync(uint32 TimeOutMilliseconds);
/*****************************************************************************/
/**
** \ingroup CFEAPIESAppBehavior
** \brief Increments the execution counter for the calling task
**
** \par Description
** This routine increments the execution counter that is stored for
** the calling task. It can be called from cFE Application main tasks, child
** tasks, or cFE Core application main tasks. Normally, the call is not
** necessary from a cFE Application, since the CFE_ES_RunLoop call increments
** the counter for the Application.
**
** \par Assumptions, External Events, and Notes:
** NOTE: This API is not needed for Appplications that call the CFE_ES_RunLoop call.
**
** \sa #CFE_ES_RunLoop
**
******************************************************************************/
void CFE_ES_IncrementTaskCounter(void);
/**@}*/
/** @defgroup CFEAPIESInfo cFE Information APIs
* @{
*/
/*****************************************************************************/
/**
** \brief Return the most recent Reset Type
**
** \par Description
** Provides the caller with codes that identifies the type of Reset
** the processor most recently underwent. The caller can also obtain
** information on what caused the reset by supplying a pointer to a
** variable that will be filled with the Reset Sub-Type.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in, out] ResetSubtypePtr Pointer to \c uint32 type variable in which the Reset Sub-Type will be stored.
** The caller can set this pointer to NULL if the Sub-Type is of no interest. \n
** ResetSubtypePtr If the provided pointer was not \c NULL, the Reset Sub-Type is
** stored at the given address. For a list of possible Sub-Type values, see \link
** #CFE_PSP_RST_SUBTYPE_POWER_CYCLE "Reset Sub-Types" \endlink.
**
** \return Processor reset type
** \retval #CFE_PSP_RST_TYPE_POWERON \copybrief CFE_PSP_RST_TYPE_POWERON
** \retval #CFE_PSP_RST_TYPE_PROCESSOR \copybrief CFE_PSP_RST_TYPE_PROCESSOR
**
** \sa #CFE_ES_GetAppID, #CFE_ES_GetAppIDByName, #CFE_ES_GetAppName, #CFE_ES_GetTaskInfo
**
******************************************************************************/
int32 CFE_ES_GetResetType(uint32 *ResetSubtypePtr);
/*****************************************************************************/
/**
** \brief Get an Application ID for the calling Application
**
** \par Description
** This routine retrieves the cFE Application ID for the calling Application.
**
** \par Assumptions, External Events, and Notes:
** NOTE: \b All tasks associated with the Application would return the same Application ID.
**
** \param[out] AppIdPtr Pointer to variable that is to receive the Application's ID.
** *AppIdPtr will be set to the application ID of the calling Application.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
** \sa #CFE_ES_GetResetType, #CFE_ES_GetAppIDByName, #CFE_ES_GetAppName, #CFE_ES_GetTaskInfo
**
******************************************************************************/
CFE_Status_t CFE_ES_GetAppID(CFE_ES_AppId_t *AppIdPtr);
/*****************************************************************************/
/**
** \brief Get the task ID of the calling context
**
** \par Description
** This retrieves the current task context from OSAL
**
** \par Assumptions, External Events, and Notes:
** Applications which desire to call other CFE ES services such as
** CFE_ES_TaskGetInfo() should use this API rather than getting the ID
** from OSAL directly via OS_TaskGetId().
**
** \param[out] TaskIdPtr Pointer to variable that is to receive the ID.
** Will be set to the ID of the calling task.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
******************************************************************************/
CFE_Status_t CFE_ES_GetTaskID(CFE_ES_TaskId_t *TaskIdPtr);
/*****************************************************************************/
/**
** \brief Get an Application ID associated with a specified Application name
**
** \par Description
** This routine retrieves the cFE Application ID associated with a
** specified Application name.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[out] AppIdPtr Pointer to variable that is to receive the Application's ID.
** \param[in] AppName Pointer to null terminated character string containing an Application name.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_NAME_NOT_FOUND \copybrief CFE_ES_ERR_NAME_NOT_FOUND
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
** \sa #CFE_ES_GetAppID, #CFE_ES_GetAppName, #CFE_ES_GetAppInfo
**
******************************************************************************/
CFE_Status_t CFE_ES_GetAppIDByName(CFE_ES_AppId_t *AppIdPtr, const char *AppName);
/*****************************************************************************/
/**
** \brief Get a Library ID associated with a specified Library name
**
** \par Description
** This routine retrieves the cFE Library ID associated with a
** specified Library name.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[out] LibIdPtr Pointer to variable that is to receive the Library's ID.
** \param[in] LibName Pointer to null terminated character string containing a Library name.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_NAME_NOT_FOUND \copybrief CFE_ES_ERR_NAME_NOT_FOUND
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
** \sa #CFE_ES_GetLibName
**
******************************************************************************/
CFE_Status_t CFE_ES_GetLibIDByName(CFE_ES_LibId_t *LibIdPtr, const char *LibName);
/*****************************************************************************/
/**
** \brief Get an Application name for a specified Application ID
**
** \par Description
** This routine retrieves the cFE Application name associated with a
** specified Application ID.
**
** \par Assumptions, External Events, and Notes:
** In the case of a failure (#CFE_ES_ERR_RESOURCEID_NOT_VALID), an empty string is returned.
**
** \param[out] AppName Pointer to a character array of at least \c BufferLength in size that will
** be filled with the appropriate Application name.
**
** \param[in] AppId Application ID of Application whose name is being requested.
**
** \param[in] BufferLength The maximum number of characters, including the null terminator, that can be put
** into the \c AppName buffer. This routine will truncate the name to this length,
** if necessary.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
** \sa #CFE_ES_GetAppID, #CFE_ES_GetAppIDByName, #CFE_ES_GetAppInfo
**
******************************************************************************/
CFE_Status_t CFE_ES_GetAppName(char *AppName, CFE_ES_AppId_t AppId, size_t BufferLength);
/*****************************************************************************/
/**
** \brief Get a Library name for a specified Library ID
**
** \par Description
** This routine retrieves the cFE Library name associated with a
** specified Library ID.
**
** \par Assumptions, External Events, and Notes:
** In the case of a failure (#CFE_ES_ERR_RESOURCEID_NOT_VALID), an empty string is returned.
**
** \param[out] LibName Pointer to a character array of at least \c BufferLength in size that will
** be filled with the Library name.
**
** \param[in] LibId Library ID of Library whose name is being requested.
**
** \param[in] BufferLength The maximum number of characters, including the null terminator, that can be put
** into the \c LibName buffer. This routine will truncate the name to this length,
** if necessary.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
** \sa #CFE_ES_GetLibIDByName
**
******************************************************************************/
CFE_Status_t CFE_ES_GetLibName(char *LibName, CFE_ES_LibId_t LibId, size_t BufferLength);
/*****************************************************************************/
/**
** \brief Get Application Information given a specified App ID
**
** \par Description
** This routine retrieves the information about an App associated with a
** specified App ID. The information includes all of the information ES
** maintains for an application ( documented in the CFE_ES_AppInfo_t type )
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[out] AppInfo Pointer to a structure that will be filled with
** resource name and memory addresses information.
** \param[in] AppId ID of application to obtain information about
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
** \sa #CFE_ES_GetAppID, #CFE_ES_GetAppIDByName, #CFE_ES_GetAppName
**
******************************************************************************/
CFE_Status_t CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, CFE_ES_AppId_t AppId);
/*****************************************************************************/
/**
** \brief Get Task Information given a specified Task ID
**
** \par Description
** This routine retrieves the information about a Task associated with a
** specified Task ID. The information includes Task Name, and Parent/Creator
** Application ID.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[out] TaskInfo Pointer to a \c CFE_ES_TaskInfo_t structure that holds the specific
** task information. *TaskInfo is the filled out \c CFE_ES_TaskInfo_t structure containing
** the Task Name, Parent App Name, Parent App ID among other fields.
**
** \param[in] TaskId Application ID of Application whose name is being requested.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
** \sa #CFE_ES_GetTaskID, #CFE_ES_GetTaskIDByName, #CFE_ES_GetTaskName
**
******************************************************************************/
CFE_Status_t CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_TaskId_t TaskId);
/*****************************************************************************/
/**
** \brief Get Library Information given a specified Resource ID
**
** \par Description
** This routine retrieves the information about a Library
** associated with a specified ID. The information includes all of the
** information ES maintains for this resource type ( documented in
** the CFE_ES_AppInfo_t type ).
**
** This shares the same output structure as CFE_ES_GetAppInfo, such that
** informational commands can be executed against either applications or
** libraries. When applied to a library, the task information in the
** structure will be omitted, as libraries do not have tasks associated.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[out] LibInfo Pointer to a structure that will be filled with
** resource name and memory addresses information.
** \param[in] LibId ID of application to obtain information about
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
** \sa #CFE_ES_GetLibIDByName, #CFE_ES_GetLibName
**
******************************************************************************/
int32 CFE_ES_GetLibInfo(CFE_ES_AppInfo_t *LibInfo, CFE_ES_LibId_t LibId);
/*****************************************************************************/
/**
** \brief Get Information given a specified Resource ID
**
** \par Description
** This routine retrieves the information about an Application or Library
** associated with a specified ID.
**
** This is a wrapper API that in turn calls either CFE_ES_GetAppInfo or
** CFE_ES_GetLibInfo if passed an AppId or LibId, respectively.
**
** This allows commands originally targeted to operate on AppIDs to be
** easily ported to operate on either Libraries or Applications, where
** relevant.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[out] ModuleInfo Pointer to a structure that will be filled with
** resource name and memory addresses information.
** \param[in] ResourceId ID of application or library to obtain information about
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
** \sa #CFE_ES_GetLibInfo, #CFE_ES_GetAppInfo
**
******************************************************************************/
int32 CFE_ES_GetModuleInfo(CFE_ES_AppInfo_t *ModuleInfo, CFE_ResourceId_t ResourceId);
/**@}*/
/** @defgroup CFEAPIESChildTask cFE Child Task APIs
* @{
*/
/*****************************************************************************/
/**
** \brief Creates a new task under an existing Application
**
** \par Description
** This routine creates a new task (a separate execution thread) owned by the calling Application.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in, out] TaskIdPtr A pointer to a variable that will be filled in with the new task's ID. *TaskIdPtr is
** the Task ID of the newly created child task.
**
** \param[in] TaskName A pointer to a string containing the desired name of the new task.
** This can be up to #OS_MAX_API_NAME characters, including the trailing null.
**
** \param[in] FunctionPtr A pointer to the function that will be spawned as a new task. This function
** must have the following signature: uint32 function(void). Input parameters
** for the new task are not supported.
**
** \param[in] StackPtr A pointer to the location where the child task's stack pointer should start.
** NOTE: Not all underlying operating systems support this parameter.
** The CFE_ES_TASK_STACK_ALLOCATE constant may be passed to indicate that the
** stack should be dynamically allocated.
**
** \param[in] StackSize The number of bytes to allocate for the new task's stack.
**
** \param[in] Priority The priority for the new task. Lower numbers are higher priority, with 0 being
** the highest priority. Applications cannot create tasks with a higher priority
** (lower number) than their own priority.
**
** \param[in] Flags Reserved for future expansion.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_CHILD_TASK_CREATE \copybrief CFE_ES_ERR_CHILD_TASK_CREATE
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
** \sa #CFE_ES_DeleteChildTask, #CFE_ES_ExitChildTask
**
******************************************************************************/
CFE_Status_t CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName,
CFE_ES_ChildTaskMainFuncPtr_t FunctionPtr, CFE_ES_StackPointer_t StackPtr,
size_t StackSize, CFE_ES_TaskPriority_Atom_t Priority, uint32 Flags);
/*****************************************************************************/
/**
** \brief Get a Task ID associated with a specified Task name
**
** \par Description
** This routine retrieves the cFE Task ID associated with a
** specified Task name.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[out] TaskIdPtr Pointer to variable that is to receive the Task's ID.
** \param[in] TaskName Pointer to null terminated character string containing an Task name.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_NAME_NOT_FOUND \copybrief CFE_ES_ERR_NAME_NOT_FOUND
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
** \sa #CFE_ES_GetTaskName
**
******************************************************************************/
CFE_Status_t CFE_ES_GetTaskIDByName(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName);
/*****************************************************************************/
/**
** \brief Get a Task name for a specified Task ID
**
** \par Description
** This routine retrieves the cFE Task name associated with a
** specified Task ID.
**
** \par Assumptions, External Events, and Notes:
** In the case of a failure (#CFE_ES_ERR_RESOURCEID_NOT_VALID), an empty string is returned.
**
** \param[out] TaskName Pointer to a character array of at least \c BufferLength in size that will
** be filled with the Task name.
**
** \param[in] TaskId Task ID of Task whose name is being requested.
**
** \param[in] BufferLength The maximum number of characters, including the null terminator, that can be put
** into the \c TaskName buffer. This routine will truncate the name to this length,
** if necessary.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
** \sa #CFE_ES_GetTaskIDByName
**
******************************************************************************/
CFE_Status_t CFE_ES_GetTaskName(char *TaskName, CFE_ES_TaskId_t TaskId, size_t BufferLength);
/*****************************************************************************/
/**
** \brief Deletes a task under an existing Application
**
** \par Description
** This routine deletes a task under an Application specified by the \c TaskId obtained
** when the child task was created using the #CFE_ES_CreateChildTask API.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in] TaskId The task ID previously obtained when the Child Task was created with the
*#CFE_ES_CreateChildTask API.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_NOT_IMPLEMENTED \copybrief CFE_ES_NOT_IMPLEMENTED
**
** \sa #CFE_ES_CreateChildTask, #CFE_ES_ExitChildTask
**
******************************************************************************/
CFE_Status_t CFE_ES_DeleteChildTask(CFE_ES_TaskId_t TaskId);
/*****************************************************************************/
/**
** \brief Exits a child task
**
** \par Description
** This routine allows the current executing child task to exit and
** be deleted by ES.
**
** \par Assumptions, External Events, and Notes:
** This function cannot be called from an Application's Main Task.
**
** \note This function does not return a value, but if it does return
** at all, it is assumed that the Task was either unregistered or
** this function was called from a cFE Application's main task.
**
** \sa #CFE_ES_CreateChildTask, #CFE_ES_DeleteChildTask
**
******************************************************************************/
void CFE_ES_ExitChildTask(void);
/**@}*/
/** @defgroup CFEAPIESMisc cFE Miscellaneous APIs
* @{
*/
/*****************************************************************************/
/**
** \brief Wakes up the CFE background task
**
** \par Description
** Normally the ES background task wakes up at a periodic interval.
** Whenever new background work is added, this can be used to wake the task early,
** which may reduce the delay between adding the job and the job getting processed.
**
** \par Assumptions, External Events, and Notes:
** Note the amount of work that the background task will perform is pro-rated
** based on the amount of time elapsed since the last wakeup. Waking the task
** early will not cause the background task to do more work than it otherwise
** would - it just reduces the delay before work starts initially.
**
******************************************************************************/
void CFE_ES_BackgroundWakeup(void);
/*****************************************************************************/
/**
** \brief Write a string to the cFE System Log
**
** \par Description
** This routine writes a formatted string to the cFE system log. This
** can be used to record very low-level errors that can't be reported
** using the Event Services. This function is used in place of printf
** for flight software. It should be used for significant startup events,
** critical errors, and conditionally compiled debug software.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in] SpecStringPtr The format string for the log message.
** This is similar to the format string for a printf() call.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
** \retval #CFE_ES_ERR_SYS_LOG_FULL \copybrief CFE_ES_ERR_SYS_LOG_FULL
** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT
**
******************************************************************************/
CFE_Status_t CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) OS_PRINTF(1, 2);
/*****************************************************************************/
/**
** \brief Calculate a CRC on a block of memory
**
** \par Description
** This routine calculates a cyclic redundancy check (CRC) on a block of memory. The CRC algorithm
** used is determined by the last parameter.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in] DataPtr Pointer to the base of the memory block.
**
** \param[in] DataLength The number of bytes in the memory block.
**
** \param[in] InputCRC A starting value for use in the CRC calculation. This parameter
** allows the user to calculate the CRC of non-contiguous blocks as
** a single value. Nominally, the user should set this value to zero.
**
** \param[in] TypeCRC One of the following CRC algorithm selections:
** \arg \c CFE_MISSION_ES_CRC_8 - (Not currently implemented)
** \arg \c CFE_MISSION_ES_CRC_16 - CRC-16/ARC <BR>
** Polynomial: 0x8005 <BR>
** Initialization: 0x0000 <BR>
** Reflect Input/Output: true <BR>
** XorOut: 0x0000
** \arg \c CFE_MISSION_ES_CRC_32 - (not currently implemented)
**
** \return The result of the CRC calculation on the specified memory block, or error code \ref CFEReturnCodes
**
******************************************************************************/
uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputCRC, uint32 TypeCRC);
/*****************************************************************************/
/**
** \ingroup CFEAPIESMisc
** \brief Notification that an asynchronous event was detected by the underlying OS/PSP
**
** \par Description
** This hook routine is called from the PSP when an exception or
** other asynchronous system event occurs
**