ICAROUS
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Modules Pages
sch_app.h
1/************************************************************************
2** File:
3** $Id: sch_app.h 1.4 2017/06/21 15:29:01EDT mdeschu Exp $
4**
5** Copyright (c) 2007-2014 United States Government as represented by the
6** Administrator of the National Aeronautics and Space Administration.
7** All Other Rights Reserved.
8**
9** This software was created at NASA's Goddard Space Flight Center.
10** This software is governed by the NASA Open Source Agreement and may be
11** used, distributed and modified only pursuant to the terms of that
12** agreement.
13**
14** Purpose:
15** The CFS Scheduler (SCH) Application header file
16**
17** Notes:
18**
19*************************************************************************/
20#ifndef _sch_app_
21#define _sch_app_
22
23/*************************************************************************
24**
25** Include section
26**
27**************************************************************************/
28
29#include "cfe.h"
30#include "cfe_platform_cfg.h"
31#include "sch_msg.h"
32#include "sch_tbldefs.h"
33
34/*************************************************************************
35**
36** Macro definitions
37**
38**************************************************************************/
39
40/*************************************************************************/
41/*************************************************************************/
42
43/*
44** Computed Scheduler Parameters
45*/
46#define SCH_WORST_CLOCK_ACCURACY (SCH_NORMAL_SLOT_PERIOD/(SCH_TOTAL_SLOTS-1))
50#define SCH_MAX_SYNC_ATTEMPTS (SCH_TOTAL_SLOTS * 3)
55/*
56** Command pipe definitions
57*/
60#define SCH_PIPE_NAME "SCH_CMD_PIPE"
63/*
64** Event filter table definitions
65*/
68#define SCH_FILTER_COUNT 5
71/*
72** Minor Frame Slot Characteristics
73*/
76#define SCH_TIME_SYNC_SLOT (SCH_TOTAL_SLOTS-1)
78#define SCH_NORMAL_SLOT_PERIOD (SCH_MICROS_PER_MAJOR_FRAME / SCH_TOTAL_SLOTS)
79#define SCH_SYNC_SLOT_PERIOD (SCH_NORMAL_SLOT_PERIOD + SCH_SYNC_SLOT_DRIFT_WINDOW)
80#define SCH_SHORT_SLOT_PERIOD (SCH_NORMAL_SLOT_PERIOD - SCH_SYNC_SLOT_DRIFT_WINDOW)
83/*
84** Table names
85*/
88#define SCH_SCHEDULE_TABLE_NAME "SCHED_DEF"
89#define SCH_MESSAGE_TABLE_NAME "MSG_DEFS"
92/*
93** Internal Function Return Codes
94*/
97#define SCH_SUCCESS (0)
98#define SCH_ERROR (-1)
99#define SCH_BAD_MSG_LENGTH_RC (-2)
100#define SCH_UNKNOWN_ACTIVITY (-3)
103/*
104** Time Semaphore Characteristics
105*/
106#define SCH_SEM_NAME "SCH_TIME_SEM"
107#define SCH_SEM_VALUE 0
108#define SCH_SEM_OPTIONS 0
109
110/*
111** SDT Table Validation Error Codes
112*/
113#define SCH_SDT_GARBAGE_ENTRY (-1)
114#define SCH_SDT_NO_FREQUENCY (-2)
115#define SCH_SDT_BAD_REMAINDER (-3)
116#define SCH_SDT_BAD_ACTIVITY (-4)
117#define SCH_SDT_BAD_MSG_INDEX (-5)
118#define SCH_SDT_BAD_ENABLE_STATE (-6)
119
120/*
121** MDT Table Validation Error Codes
122*/
123#define SCH_MDT_GARBAGE_ENTRY (-1)
124#define SCH_MDT_INVALID_LENGTH (-2)
125#define SCH_MDT_BAD_MSG_ID (-3)
126
127/*************************************************************************
128**
129** Type definitions
130**
131**************************************************************************/
132
133/*
134** Type definition (SCH app global data)
135*/
136typedef struct
137{
138 /*
139 ** Operational data
140 */
141 CFE_SB_MsgPtr_t MsgPtr;
142 CFE_SB_PipeId_t CmdPipe;
147 CFE_TBL_Handle_t ScheduleTableHandle;
148 CFE_TBL_Handle_t MessageTableHandle;
150 CFE_EVS_BinFilter_t EventFilters[SCH_FILTER_COUNT];
157 uint32 TimerId;
161 /* to be processed upon each Minor Frame signal */
162
163
164 uint32 AppID;
166 /*
167 ** Command execution counters (ground commands)
168 */
171 uint8 SyncToMET;
174 /*
175 ** Messages sent by schedule table processor
176 */
180 /*
181 ** Total schedule table slots processed
182 */
185 /*
186 ** The number of times that slots were skipped
187 ** (not the number of slots that were skipped)
188 */
193 /*
194 ** The number of times that multiple slots were processed
195 ** (not the number of slots that were processed)
196 */
202 /*
203 ** The number of times that SCH woke up in the same slot as last time
204 */
207 /*
208 ** The number of times that a table entry with bad data was processed
209 ** (the entry previously passed validation but then somehow went bad)
210 */
213 /*
214 ** The number of tables verified prior to table load
215 */
236
237/*************************************************************************
238**
239** Exported data
240**
241**************************************************************************/
242
243extern SCH_AppData_t SCH_AppData;
244
245/*************************************************************************
246**
247** Exported functions
248**
249**************************************************************************/
250
251/*
252** Application entry point and main process loop
253*/
254/************************************************************************/
264void SCH_AppMain(void);
265
266/*************************************************************************
267** Local function prototypes
268**************************************************************************/
269
270/************************************************************************/
290int32 SCH_AppInit(void);
291
292/************************************************************************/
310int32 SCH_EvsInit(void);
311
312/************************************************************************/
330int32 SCH_SbInit(void);
331
332/************************************************************************/
350int32 SCH_TblInit(void);
351
352/************************************************************************/
371int32 SCH_TimerInit(void);
372
373/************************************************************************/
393int32 SCH_ProcessScheduleTable(void);
394
395/************************************************************************/
414int32 SCH_ProcessNextSlot(void);
415
416/************************************************************************/
427void SCH_ProcessNextEntry(SCH_ScheduleEntry_t *NextEntry, int32 EntryNumber);
428
429/************************************************************************/
447int32 SCH_ProcessCommands(void);
448
449/************************************************************************/
467int32 SCH_ValidateScheduleData(void *TableData);
468
469/************************************************************************/
487int32 SCH_ValidateMessageData(void *TableData);
488
489#endif /* _sch_app_ */
490
491/************************/
492/* End of File Comment */
493/************************/
Definition: sch_app.h:137
uint16 MultipleSlotsCount
Number of times that multiple slots processed.
Definition: sch_app.h:197
CFE_TBL_Handle_t ScheduleTableHandle
Handle for Schedule Definition Table.
Definition: sch_app.h:147
SCH_HkPacket_t HkPacket
Housekeeping Telemetry Packet.
Definition: sch_app.h:152
CFE_TBL_Handle_t MessageTableHandle
Handle for Message Definition Table.
Definition: sch_app.h:148
uint16 SyncAttemptsLeft
Timeout counter used when syncing Major Frame to MET.
Definition: sch_app.h:229
uint8 MajorFrameSource
Major Frame Signal source identifier.
Definition: sch_app.h:172
uint32 AppID
SCH Application's Application ID.
Definition: sch_app.h:164
CFE_SB_PipeId_t CmdPipe
Pipe ID for SCH Command Pipe.
Definition: sch_app.h:142
SCH_MessageEntry_t * MessageTable
Ptr to Message Table contents.
Definition: sch_app.h:144
uint32 ValidMajorFrameCount
# of valid Major Frame tones received
Definition: sch_app.h:219
uint16 MinorFramesSinceTone
# of Minor Frames since last Major Frame tone
Definition: sch_app.h:226
CFE_SB_MsgPtr_t MsgPtr
Ptr to most recently received cmd message.
Definition: sch_app.h:141
uint32 ConsecutiveNoisyFrameCounter
# of consecutive noisy Major Frames
Definition: sch_app.h:224
uint32 ScheduleActivityFailureCount
Number of unsuccessful activities attempted.
Definition: sch_app.h:178
uint16 TableVerifyFailureCount
# of times table loads unsuccessfully verified
Definition: sch_app.h:217
uint16 SameSlotCount
# of times SCH woke up in the same slot as last time
Definition: sch_app.h:205
uint32 ClockAccuracy
Accuracy of Minor Frame Timer.
Definition: sch_app.h:159
uint32 UnexpectedMajorFrameCount
# of unexpected Major Frame tones
Definition: sch_app.h:221
uint16 LastSyncMETSlot
MET Slot # where Time Sync last occurred.
Definition: sch_app.h:228
uint8 SyncToMET
Slots should be aligned with subseconds.
Definition: sch_app.h:171
uint32 MissedMajorFrameCount
# of missing Major Frame tones
Definition: sch_app.h:220
uint8 CmdCounter
Number of successful ground cmds received.
Definition: sch_app.h:169
SCH_ScheduleEntry_t * ScheduleTable
Ptr to Schedule Table contents.
Definition: sch_app.h:145
uint32 TimeSemaphore
Semaphore used by time references to control main loop.
Definition: sch_app.h:158
uint32 LastProcessCount
Number of Slots Processed Last Cycle.
Definition: sch_app.h:155
uint32 ScheduleActivitySuccessCount
Number of successfully performed activities.
Definition: sch_app.h:177
uint16 TableVerifySuccessCount
# of times table loads successfully verified
Definition: sch_app.h:216
uint16 SkippedSlotsCount
Number of times that slots were skipped.
Definition: sch_app.h:189
uint32 WorstCaseSlotsPerMinorFrame
When syncing to MET, worst case # of slots that may need.
Definition: sch_app.h:160
uint32 SlotsProcessedCount
Total # of Schedule Slots (Minor Frames) Processed.
Definition: sch_app.h:183
SCH_DiagPacket_t DiagPacket
Diagnostic Telemetry Packet.
Definition: sch_app.h:153
uint16 NextSlotNumber
Next Minor Frame to be processed.
Definition: sch_app.h:227
uint32 TablePassCount
# of times Schedule Table has been processed
Definition: sch_app.h:223
uint8 ErrCounter
Number of unsuccessful ground cmds received.
Definition: sch_app.h:170
boolean IgnoreMajorFrameMsgSent
Major Frame Event Message has been sent.
Definition: sch_app.h:232
boolean IgnoreMajorFrame
Major Frame too noisy to trust.
Definition: sch_app.h:231
boolean UnexpectedMajorFrame
Major Frame signal was unexpected.
Definition: sch_app.h:233
uint32 TimerId
OSAL assigned timer ID for minor frame timer.
Definition: sch_app.h:157
uint16 BadTableDataCount
# of times corrupted table entries were processed
Definition: sch_app.h:211
Definition: sch_msg.h:231
Definition: sch_msg.h:109
Definition: sch_tbldefs.h:55
Definition: sch_tbldefs.h:40