Skip to content

Commit ad7c0e7

Browse files
committed
Fix #16, Convert LC state macros to enums
1 parent 543cf6b commit ad7c0e7

16 files changed

Lines changed: 413 additions & 404 deletions

File tree

docs/dox_src/cfs_lc.dox

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@
181181
commands as a response to this condition.
182182

183183
Actionpoints can be individually enabled/disabled with the #LC_SET_AP_STATE_CC ground
184-
command. The state of an actionpoint may be set to #LC_APSTATE_ACTIVE, #LC_APSTATE_PASSIVE,
185-
or #LC_APSTATE_DISABLED. These states operate in the same way as the application operating
186-
modes described above. #LC_APSTATE_PASSIVE will just disable RTS requests, while
187-
#LC_APSTATE_DISABLED will stop evaluation of the actionpoint all together. An additional
188-
state #LC_APSTATE_PERMOFF which functions the same as #LC_APSTATE_DISABLED but can only
184+
command. The state of an actionpoint may be set to #LC_ActionPointState_ACTIVE, #LC_ActionPointState_PASSIVE,
185+
or #LC_ActionPointState_DISABLED. These states operate in the same way as the application operating
186+
modes described above. #LC_ActionPointState_PASSIVE will just disable RTS requests, while
187+
#LC_ActionPointState_DISABLED will stop evaluation of the actionpoint all together. An additional
188+
state #LC_ActionPointState_PERMOFF which functions the same as #LC_ActionPointState_DISABLED but can only
189189
be changed via table load, can be set using the #LC_SET_AP_PERMOFF_CC ground command
190190
(see \ref cfslcfaqs).
191191

@@ -259,7 +259,7 @@
259259
In the lc_platform_cfg.h file, there are configuration parameters that control use
260260
of the Critical Data Store (CDS) and the LC operation mode on application
261261
initialization. The default case is not to use the CDS and to set the application
262-
state to #LC_STATE_DISABLED.
262+
state to #LC_AppState_DISABLED.
263263
**/
264264

265265
/**
@@ -302,7 +302,7 @@
302302
The entire ADT is processed anytime a sample request is received that specifies an
303303
actionpoint equal to #LC_ALL_ACTIONPOINTS. For this reason, it is important that unused
304304
entries are properly marked by setting the ADT parameter DefaultState to
305-
#LC_ACTION_NOT_USED.
305+
#LC_ActionPoint_NOT_USED.
306306

307307
When either the WDT or ADT are updated, the corresponding results table (WRT or ART) is
308308
reset to initialization values. For each entry in the WRT, WatchResult is set to
@@ -523,7 +523,7 @@
523523
three possible conditions are true:
524524

525525
1) The actionpoint is unused (the DefaultState in the ADT is set to
526-
#LC_ACTION_NOT_USED).
526+
#LC_ActionPoint_NOT_USED).
527527

528528
2) An actionpoint sample request (#LC_SAMPLE_AP_MID) targeting the AP has not
529529
yet been received by LC so the AP has not yet been evaluated.
@@ -551,27 +551,27 @@
551551
</I>
552552

553553
<B> (Q)
554-
How does the Actionpoint state #LC_APSTATE_PERMOFF differ from
555-
#LC_APSTATE_DISABLED?
554+
How does the Actionpoint state #LC_ActionPointState_PERMOFF differ from
555+
#LC_ActionPointState_DISABLED?
556556
</B> <BR> <BR> <I>
557-
The AP state #LC_APSTATE_PERMOFF is intended to provide a way to disable
557+
The AP state #LC_ActionPointState_PERMOFF is intended to provide a way to disable
558558
an AP so it can not easily be turned back on by mistake. Such actionpoints
559559
may not be needed after a seperation sequence or only apply to certain
560560
mission phases.
561561

562562
While the two states are treated the same way during actionpoint processing
563563
(the AP isn't evaluated), there are a few differences.
564564

565-
An AP can't be set to #LC_APSTATE_PERMOFF with the #LC_SET_AP_STATE_CC command,
565+
An AP can't be set to #LC_ActionPointState_PERMOFF with the #LC_SET_AP_STATE_CC command,
566566
it must be done with the #LC_SET_AP_PERMOFF_CC command.
567567

568-
To set an AP to #LC_APSTATE_PERMOFF with the #LC_SET_AP_PERMOFF_CC command, the
569-
current AP state must be #LC_APSTATE_DISABLED.
568+
To set an AP to #LC_ActionPointState_PERMOFF with the #LC_SET_AP_PERMOFF_CC command, the
569+
current AP state must be #LC_ActionPointState_DISABLED.
570570

571571
The #LC_SET_AP_PERMOFF_CC command can only be issued for a single actionpoint,
572572
#LC_ALL_ACTIONPOINTS is not valid as an argument for this command.
573573

574-
Once an AP is set to #LC_APSTATE_PERMOFF, it can only be changed with a new ADT
574+
Once an AP is set to #LC_ActionPointState_PERMOFF, it can only be changed with a new ADT
575575
table load.
576576
</I>
577577

@@ -592,7 +592,7 @@
592592
#LC_HKAR_STATE_NOT_USED, #LC_HKAR_STATE_ACTIVE, #LC_HKAR_STATE_PASSIVE,
593593
#LC_HKAR_STATE_DISABLED
594594

595-
An actionpoint whose current state is #LC_APSTATE_PERMOFF will have it's
595+
An actionpoint whose current state is #LC_ActionPointState_PERMOFF will have it's
596596
state reported in the APResults as #LC_HKAR_STATE_NOT_USED.
597597

598598
The numerical 2 bit values for evaluation results are defined using the
@@ -614,9 +614,9 @@
614614
Will an RTS get requested more than once if an AP stays in the #LC_ACTION_FAIL
615615
state?
616616
</B> <BR> <BR> <I>
617-
No. Assuming the current state of an actionpoint is #LC_APSTATE_ACTIVE, then
617+
No. Assuming the current state of an actionpoint is #LC_ActionPointState_ACTIVE, then
618618
when the actionpoint fails enough times to trigger an RTS, the state is set
619-
to #LC_APSTATE_PASSIVE.
619+
to #LC_ActionPointState_PASSIVE.
620620

621621
In the passive state, the AP will continue to be sampled and statistics
622622
updated, but no RTS requests will be initiated.

fsw/platform_inc/lc_platform_cfg.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@
120120
*
121121
* \par Limits:
122122
* This parameter must be one of the following:
123-
* #LC_STATE_ACTIVE
124-
* #LC_STATE_PASSIVE
125-
* #LC_STATE_DISABLED
123+
* #LC_AppState_ACTIVE
124+
* #LC_AppState_PASSIVE
125+
* #LC_AppState_DISABLED
126126
*/
127-
#define LC_STATE_POWER_ON_RESET LC_STATE_DISABLED
127+
#define LC_STATE_POWER_ON_RESET LC_AppState_DISABLED
128128

129129
/**
130130
* \brief Save data to CDS compiler switch
@@ -152,19 +152,19 @@
152152
* is set to true, and provides a way to override any state LC
153153
* may have been operating in prior to the reset occurring.
154154
*
155-
* If this is set to LC_STATE_FROM_CDS and LC_SAVE_TO_CDS is set
155+
* If this is set to LC_AppState_FROM_CDS and LC_SAVE_TO_CDS is set
156156
* to true, then the LC state will be preserved across resets and
157-
* restored. If this is not set to LC_STATE_FROM_CDS, the state
157+
* restored. If this is not set to LC_AppState_FROM_CDS, the state
158158
* saved in the CDS is overwritten by the state assigned here.
159159
*
160160
* \par Limits:
161161
* This parameter must be one of the following:
162-
* #LC_STATE_ACTIVE
163-
* #LC_STATE_PASSIVE
164-
* #LC_STATE_DISABLED
165-
* #LC_STATE_FROM_CDS
162+
* #LC_AppState_ACTIVE
163+
* #LC_AppState_PASSIVE
164+
* #LC_AppState_DISABLED
165+
* #LC_AppState_FROM_CDS
166166
*/
167-
#define LC_STATE_WHEN_CDS_RESTORED LC_STATE_FROM_CDS
167+
#define LC_STATE_WHEN_CDS_RESTORED LC_AppState_FROM_CDS
168168

169169
/**
170170
* \brief Watchpoint Definition Table (WDT) filename

fsw/src/lc_action.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void LC_SampleAPs(uint16 StartIndex, uint16 EndIndex)
5151
{
5252
CurrentAPState = LC_OperData.ARTPtr[StartIndex].CurrentState;
5353

54-
if ((CurrentAPState != LC_ACTION_NOT_USED) && (CurrentAPState != LC_APSTATE_PERMOFF))
54+
if ((CurrentAPState != LC_ActionPoint_NOT_USED) && (CurrentAPState != LC_ActionPointState_PERMOFF))
5555
{
5656
/*
5757
** Sample the specified actionpoint
@@ -101,7 +101,7 @@ void LC_SampleSingleAP(uint16 APNumber)
101101
*/
102102
CurrentAPState = LC_OperData.ARTPtr[APNumber].CurrentState;
103103

104-
if ((CurrentAPState == LC_APSTATE_ACTIVE) || (CurrentAPState == LC_APSTATE_PASSIVE))
104+
if ((CurrentAPState == LC_ActionPointState_ACTIVE) || (CurrentAPState == LC_ActionPointState_PASSIVE))
105105
{
106106
/*
107107
** Evaluate the actionpoint and update the results
@@ -146,14 +146,14 @@ void LC_SampleSingleAP(uint16 APNumber)
146146
/*
147147
** We have failed enough times to request the RTS
148148
*/
149-
if (CurrentAPState == LC_APSTATE_ACTIVE)
149+
if (CurrentAPState == LC_ActionPointState_ACTIVE)
150150
{
151151
/*
152152
** Actions go to passive after they've failed
153153
*/
154-
LC_OperData.ARTPtr[APNumber].CurrentState = LC_APSTATE_PASSIVE;
154+
LC_OperData.ARTPtr[APNumber].CurrentState = LC_ActionPointState_PASSIVE;
155155

156-
if (LC_AppData.CurrentLCState == LC_STATE_ACTIVE)
156+
if (LC_AppData.CurrentLCState == LC_AppState_ACTIVE)
157157
{
158158
/*
159159
** If the LC application state is active, request the
@@ -511,15 +511,15 @@ int32 LC_ValidateADT(void *TableData)
511511
RPNPtr = TableArray[TableIndex].RPNEquation;
512512
EventType = TableArray[TableIndex].EventType;
513513

514-
if (DefaultState == LC_ACTION_NOT_USED)
514+
if (DefaultState == LC_ActionPoint_NOT_USED)
515515
{
516516
/*
517517
** Unused table entry
518518
*/
519519
UnusedCount++;
520520
}
521-
else if ((DefaultState != LC_APSTATE_ACTIVE) && (DefaultState != LC_APSTATE_PASSIVE) &&
522-
(DefaultState != LC_APSTATE_DISABLED) && (DefaultState != LC_APSTATE_PERMOFF))
521+
else if ((DefaultState != LC_ActionPointState_ACTIVE) && (DefaultState != LC_ActionPointState_PASSIVE) &&
522+
(DefaultState != LC_ActionPointState_DISABLED) && (DefaultState != LC_ActionPointState_PERMOFF))
523523
{
524524
/*
525525
** Invalid default state

fsw/src/lc_app.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ int32 LC_CreateTaskCDS(void)
831831
** May need to override the restored application state
832832
*/
833833

834-
#if LC_STATE_WHEN_CDS_RESTORED != LC_STATE_FROM_CDS
834+
#if LC_STATE_WHEN_CDS_RESTORED != LC_AppState_FROM_CDS
835835
LC_AppData.CurrentLCState = LC_STATE_WHEN_CDS_RESTORED;
836836
#endif
837837
}

fsw/src/lc_app.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ typedef struct
201201
uint32 RTSExecCount; /**< \brief Total count of RTS sequences initiated */
202202
uint16 PassiveRTSExecCount; /**< \brief Total count of RTS sequences not
203203
initiated because the LC state is
204-
set to #LC_STATE_PASSIVE or the state
204+
set to #LC_AppState_PASSIVE or the state
205205
of the actionpoint that failed is set to
206-
#LC_APSTATE_PASSIVE */
206+
#LC_ActionPointState_PASSIVE */
207207

208208
uint16 CDSSavedOnExit; /**< \brief Variable that tells us if we exited clean or not */
209209
uint8 CurrentLCState; /**< \brief Current LC application operating state */

fsw/src/lc_cmds.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void LC_SampleAPReq(const CFE_SB_Buffer_t *BufPtr)
145145
/*
146146
** Ignore AP sample requests if disabled at the application level
147147
*/
148-
if (LC_AppData.CurrentLCState != LC_STATE_DISABLED)
148+
if (LC_AppData.CurrentLCState != LC_AppState_DISABLED)
149149
{
150150
/*
151151
** Range check the actionpoint array index arguments
@@ -361,20 +361,20 @@ int32 LC_HousekeepingReq(const CFE_MSG_CommandHeader_t *MsgPtr)
361361
*/
362362
switch (LC_OperData.ARTPtr[TableIndex + 1].CurrentState)
363363
{
364-
case LC_ACTION_NOT_USED:
364+
case LC_ActionPoint_NOT_USED:
365365
ByteData = LC_HKAR_STATE_NOT_USED << 6;
366366
break;
367367

368-
case LC_APSTATE_ACTIVE:
368+
case LC_ActionPointState_ACTIVE:
369369
ByteData = LC_HKAR_STATE_ACTIVE << 6;
370370
LC_OperData.HkPacket.ActiveAPs++;
371371
break;
372372

373-
case LC_APSTATE_PASSIVE:
373+
case LC_ActionPointState_PASSIVE:
374374
ByteData = LC_HKAR_STATE_PASSIVE << 6;
375375
break;
376376

377-
case LC_APSTATE_DISABLED:
377+
case LC_ActionPointState_DISABLED:
378378
ByteData = LC_HKAR_STATE_DISABLED << 6;
379379
break;
380380

@@ -383,7 +383,7 @@ int32 LC_HousekeepingReq(const CFE_MSG_CommandHeader_t *MsgPtr)
383383
** as unused. We should never get an undefined
384384
** action state, but we'll set to not used if we do.
385385
*/
386-
case LC_APSTATE_PERMOFF:
386+
case LC_ActionPointState_PERMOFF:
387387
default:
388388
ByteData = LC_HKAR_STATE_NOT_USED << 6;
389389
break;
@@ -421,24 +421,24 @@ int32 LC_HousekeepingReq(const CFE_MSG_CommandHeader_t *MsgPtr)
421421
*/
422422
switch (LC_OperData.ARTPtr[TableIndex].CurrentState)
423423
{
424-
case LC_ACTION_NOT_USED:
424+
case LC_ActionPoint_NOT_USED:
425425
ByteData = (ByteData | (LC_HKAR_STATE_NOT_USED << 2));
426426
break;
427427

428-
case LC_APSTATE_ACTIVE:
428+
case LC_ActionPointState_ACTIVE:
429429
ByteData = (ByteData | (LC_HKAR_STATE_ACTIVE << 2));
430430
LC_OperData.HkPacket.ActiveAPs++;
431431
break;
432432

433-
case LC_APSTATE_PASSIVE:
433+
case LC_ActionPointState_PASSIVE:
434434
ByteData = (ByteData | (LC_HKAR_STATE_PASSIVE << 2));
435435
break;
436436

437-
case LC_APSTATE_DISABLED:
437+
case LC_ActionPointState_DISABLED:
438438
ByteData = (ByteData | (LC_HKAR_STATE_DISABLED << 2));
439439
break;
440440

441-
case LC_APSTATE_PERMOFF:
441+
case LC_ActionPointState_PERMOFF:
442442
default:
443443
ByteData = (ByteData | (LC_HKAR_STATE_NOT_USED << 2));
444444
break;
@@ -569,9 +569,9 @@ void LC_SetLCStateCmd(const CFE_SB_Buffer_t *BufPtr)
569569

570570
switch (CmdPtr->NewLCState)
571571
{
572-
case LC_STATE_ACTIVE:
573-
case LC_STATE_PASSIVE:
574-
case LC_STATE_DISABLED:
572+
case LC_AppState_ACTIVE:
573+
case LC_AppState_PASSIVE:
574+
case LC_AppState_DISABLED:
575575
LC_AppData.CurrentLCState = CmdPtr->NewLCState;
576576
LC_AppData.CmdCount++;
577577

@@ -618,9 +618,9 @@ void LC_SetAPStateCmd(const CFE_SB_Buffer_t *BufPtr)
618618
*/
619619
switch (CmdPtr->NewAPState)
620620
{
621-
case LC_APSTATE_ACTIVE:
622-
case LC_APSTATE_PASSIVE:
623-
case LC_APSTATE_DISABLED:
621+
case LC_ActionPointState_ACTIVE:
622+
case LC_ActionPointState_PASSIVE:
623+
case LC_ActionPointState_DISABLED:
624624
break;
625625

626626
default:
@@ -648,7 +648,7 @@ void LC_SetAPStateCmd(const CFE_SB_Buffer_t *BufPtr)
648648
{
649649
CurrentAPState = LC_OperData.ARTPtr[TableIndex].CurrentState;
650650

651-
if ((CurrentAPState != LC_ACTION_NOT_USED) && (CurrentAPState != LC_APSTATE_PERMOFF))
651+
if ((CurrentAPState != LC_ActionPoint_NOT_USED) && (CurrentAPState != LC_ActionPointState_PERMOFF))
652652
{
653653
LC_OperData.ARTPtr[TableIndex].CurrentState = CmdPtr->NewAPState;
654654
}
@@ -666,7 +666,7 @@ void LC_SetAPStateCmd(const CFE_SB_Buffer_t *BufPtr)
666666
TableIndex = CmdPtr->APNumber;
667667
CurrentAPState = LC_OperData.ARTPtr[TableIndex].CurrentState;
668668

669-
if ((CurrentAPState != LC_ACTION_NOT_USED) && (CurrentAPState != LC_APSTATE_PERMOFF))
669+
if ((CurrentAPState != LC_ActionPoint_NOT_USED) && (CurrentAPState != LC_ActionPointState_PERMOFF))
670670
{
671671
/*
672672
** Update state for single actionpoint specified
@@ -756,7 +756,7 @@ void LC_SetAPPermOffCmd(const CFE_SB_Buffer_t *BufPtr)
756756
TableIndex = CmdPtr->APNumber;
757757
CurrentAPState = LC_OperData.ARTPtr[TableIndex].CurrentState;
758758

759-
if (CurrentAPState != LC_APSTATE_DISABLED)
759+
if (CurrentAPState != LC_ActionPointState_DISABLED)
760760
{
761761
/*
762762
** Actionpoints can only be turned permanently off if
@@ -773,7 +773,7 @@ void LC_SetAPPermOffCmd(const CFE_SB_Buffer_t *BufPtr)
773773
/*
774774
** Update state for actionpoint specified
775775
*/
776-
LC_OperData.ARTPtr[TableIndex].CurrentState = LC_APSTATE_PERMOFF;
776+
LC_OperData.ARTPtr[TableIndex].CurrentState = LC_ActionPointState_PERMOFF;
777777

778778
LC_AppData.CmdCount++;
779779

fsw/src/lc_events.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@
448448
*
449449
* This event message is issued when the #LC_SET_AP_STATE_CC command
450450
* has been received and the current actionpoint state is either
451-
* #LC_ACTION_NOT_USED or #LC_APSTATE_PERMOFF which can only be changed
451+
* #LC_ActionPoint_NOT_USED or #LC_ActionPointState_PERMOFF which can only be changed
452452
* with a table load.
453453
*/
454454
#define LC_APSTATE_CURR_ERR_EID 31
@@ -498,7 +498,7 @@
498498
*
499499
* This event message is issued when the #LC_SET_AP_PERMOFF_CC command
500500
* has been received and the current actionpoint state is not
501-
* #LC_APSTATE_DISABLED
501+
* #LC_ActionPointState_DISABLED
502502
*/
503503
#define LC_APOFF_CURR_ERR_EID 35
504504

@@ -772,7 +772,7 @@
772772
*
773773
* This event message is issued when the #LC_SAMPLE_AP_MID message
774774
* has been received and the current state for the specified
775-
* actionpoint state is either #LC_ACTION_NOT_USED or #LC_APSTATE_PERMOFF.
775+
* actionpoint state is either #LC_ActionPoint_NOT_USED or #LC_ActionPointState_PERMOFF.
776776
*/
777777
#define LC_APSAMPLE_CURR_ERR_EID 57
778778

@@ -796,7 +796,7 @@
796796
* \par Cause:
797797
*
798798
* This event message is issued when an actionpoint fails evaluation while
799-
* the LC task operating state is #LC_STATE_PASSIVE
799+
* the LC task operating state is #LC_AppState_PASSIVE
800800
*/
801801
#define LC_PASSIVE_FAIL_DBG_EID 59
802802

@@ -808,7 +808,7 @@
808808
* \par Cause:
809809
*
810810
* This event message is issued when an actionpoint fails evaluation while
811-
* the actionpoint state is #LC_APSTATE_PASSIVE
811+
* the actionpoint state is #LC_ActionPointState_PASSIVE
812812
*/
813813
#define LC_AP_PASSIVE_FAIL_INF_EID 60
814814

0 commit comments

Comments
 (0)