diff --git a/CHANGELOG.md b/CHANGELOG.md index 05606e0..a7e1ed6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Development Build: v2.5.0-rc4+dev57 +- Add support for cmds w/args +- See + ## Development Build: 2.5.0-rc4+dev53 - adjust table based on apps present - See diff --git a/fsw/platform_inc/sch_lab_table.h b/fsw/platform_inc/sch_lab_table.h index 8cb46fc..c37d675 100644 --- a/fsw/platform_inc/sch_lab_table.h +++ b/fsw/platform_inc/sch_lab_table.h @@ -36,14 +36,26 @@ #define SCH_LAB_MAX_SCHEDULE_ENTRIES 32 #define SCH_TBL_DEFAULT_FILE "/cf/sch_lab_table.tbl" +#define SCH_MAX_MSG_WORDS 32 + +#ifdef SOFTWARE_BIG_BIT_ORDER +#define SCH_PACK_32BIT(value) \ +(uint16)((value & 0xFFFF0000) >> 16), (uint16)(value & 0x0000FFFF) +#else +#define SCH_PACK_32BIT(value) \ +(uint16)(value & 0x0000FFFF), (uint16)((value & 0xFFFF0000) >> 16) +#endif + /* ** Typedefs */ typedef struct { - CFE_SB_MsgId_t MessageID; /* Message ID for the table entry */ - uint32 PacketRate; /* Rate: Send packet every N ticks */ - CFE_MSG_FcnCode_t FcnCode; /* Command/Function code to set */ + CFE_SB_MsgId_t MessageID; /* Message ID for the table entry */ + uint32 PacketRate; /* Rate: Send packet every N ticks */ + CFE_MSG_FcnCode_t FcnCode; /* Command/Function code to set */ + uint16 PayloadLength; /* Length of additional command args */ + uint16 MessageBuffer[SCH_MAX_MSG_WORDS]; /* Command args in 16 bit words */ } SCH_LAB_ScheduleTableEntry_t; typedef struct diff --git a/fsw/src/sch_lab_app.c b/fsw/src/sch_lab_app.c index 84e6772..d699768 100644 --- a/fsw/src/sch_lab_app.c +++ b/fsw/src/sch_lab_app.c @@ -46,6 +46,8 @@ typedef struct { CFE_MSG_CommandHeader_t CommandHeader; + uint16 MessageBuffer[SCH_MAX_MSG_WORDS]; + uint16 PayloadLength; uint32 PacketRate; uint32 Counter; } SCH_LAB_StateEntry_t; @@ -64,6 +66,7 @@ typedef struct */ SCH_LAB_GlobalData_t SCH_LAB_Global; + /* ** Local Function Prototypes */ @@ -121,6 +124,7 @@ void SCH_Lab_AppMain(void) ** Process table every tick, sending packets that are ready */ LocalStateEntry = SCH_LAB_Global.State; + for (i = 0; i < SCH_LAB_MAX_SCHEDULE_ENTRIES; i++) { if (LocalStateEntry->PacketRate != 0) @@ -153,7 +157,7 @@ void SCH_LAB_LocalTimerCallback(osal_id_t object_id, void *arg) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ int32 SCH_LAB_AppInit(void) { - int i; + int i, x; int32 Status; int32 OsStatus; uint32 TimerPeriod; @@ -233,14 +237,24 @@ int32 SCH_LAB_AppInit(void) ConfigTable = TableAddr; ConfigEntry = ConfigTable->Config; LocalStateEntry = SCH_LAB_Global.State; + + /* Populate the CCSDS message and move the message content into the proper user data space. */ for (i = 0; i < SCH_LAB_MAX_SCHEDULE_ENTRIES; i++) { if (ConfigEntry->PacketRate != 0) { + /* Initialize the message with the length of the header + payload */ CFE_MSG_Init(CFE_MSG_PTR(LocalStateEntry->CommandHeader), ConfigEntry->MessageID, - sizeof(LocalStateEntry->CommandHeader)); + sizeof(LocalStateEntry->CommandHeader) + ConfigEntry->PayloadLength); CFE_MSG_SetFcnCode(CFE_MSG_PTR(LocalStateEntry->CommandHeader), ConfigEntry->FcnCode); + LocalStateEntry->PacketRate = ConfigEntry->PacketRate; + LocalStateEntry->PayloadLength = ConfigEntry->PayloadLength; + + for (x =0; x < SCH_MAX_MSG_WORDS; x++) + { + LocalStateEntry->MessageBuffer[x]=ConfigEntry->MessageBuffer[x]; + } } ++ConfigEntry; ++LocalStateEntry; diff --git a/fsw/src/sch_lab_version.h b/fsw/src/sch_lab_version.h index b5319db..bfd67c9 100644 --- a/fsw/src/sch_lab_version.h +++ b/fsw/src/sch_lab_version.h @@ -25,7 +25,7 @@ */ /* Development Build Macro Definitions */ -#define SCH_LAB_BUILD_NUMBER 53 /*!< Development Build: Number of commits since baseline */ +#define SCH_LAB_BUILD_NUMBER 57 /*!< Development Build: Number of commits since baseline */ #define SCH_LAB_BUILD_BASELINE \ "v2.5.0-rc4" /*!< Development Build: git tag that is the base for the current development */ diff --git a/fsw/tables/sch_lab_table.c b/fsw/tables/sch_lab_table.c index c097396..bfee7a9 100644 --- a/fsw/tables/sch_lab_table.c +++ b/fsw/tables/sch_lab_table.c @@ -20,9 +20,6 @@ #include "sch_lab_table.h" #include "cfe_sb.h" /* Required to use the CFE_SB_MSGID_WRAP_VALUE macro */ -/* -** Include headers for message IDs here -*/ #ifdef HAVE_CI_LAB #include "ci_lab_msgids.h" #endif @@ -35,26 +32,35 @@ #include "sample_app_msgids.h" #endif -#ifdef HAVE_HS_APP +#ifdef HAVE_HS #include "hs_msgids.h" #endif -#ifdef HAVE_FM_APP +#ifdef HAVE_FM #include "fm_msgids.h" #endif -#ifdef HAVE_SC_APP +#ifdef HAVE_SC #include "sc_msgids.h" #endif -#ifdef HAVE_DS_APP +#ifdef HAVE_DS #include "ds_msgids.h" #endif -#ifdef HAVE_LC_APP +#ifdef HAVE_LC #include "lc_msgids.h" #endif + +/* +** Include headers for message IDs here +*/ +#include "ci_lab_msgids.h" +#include "to_lab_msgids.h" + +#include "sample_app_msgids.h" + /* ** SCH Lab schedule table ** When populating this table: @@ -64,40 +70,43 @@ ** 3. If the table grows too big, increase SCH_LAB_MAX_SCHEDULE_ENTRIES */ -SCH_LAB_ScheduleTable_t SCH_TBL_Structure = { - .TickRate = 1, - .Config = { - {CFE_SB_MSGID_WRAP_VALUE(CFE_ES_SEND_HK_MID), 4, 0}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SEND_HK_MID), 4, 0}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_SEND_HK_MID), 4, 0}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_SB_SEND_HK_MID), 4, 0}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_SEND_HK_MID), 4, 0}, -#ifdef HAVE_CI_LAB - {CFE_SB_MSGID_WRAP_VALUE(CI_LAB_SEND_HK_MID), 4, 0}, -#endif -#ifdef HAVE_TO_LAB - {CFE_SB_MSGID_WRAP_VALUE(TO_LAB_SEND_HK_MID), 4, 0}, -#endif -#ifdef HAVE_SAMPLE_APP - {CFE_SB_MSGID_WRAP_VALUE(SAMPLE_APP_SEND_HK_MID), 4, 0}, -#endif -#ifdef HAVE_SC_APP - {CFE_SB_MSGID_WRAP_VALUE(SC_SEND_HK_MID), 4, 0}, - {CFE_SB_MSGID_WRAP_VALUE(SC_1HZ_WAKEUP_MID), 1, 0}, /* Example of a 1hz packet */ -#endif -#ifdef HAVE_HS_APP - {CFE_SB_MSGID_WRAP_VALUE(HS_SEND_HK_MID), 0, 0}, /* Example of a message that wouldn't be sent */ -#endif -#ifdef HAVE_FM_APP - {CFE_SB_MSGID_WRAP_VALUE(FM_SEND_HK_MID), 4, 0}, -#endif -#ifdef HAVE_DS_APP - {CFE_SB_MSGID_WRAP_VALUE(DS_SEND_HK_MID), 4, 0}, -#endif -#ifdef HAVE_LC_APP - {CFE_SB_MSGID_WRAP_VALUE(LC_SEND_HK_MID), 4, 0}, -#endif - }}; +SCH_LAB_ScheduleTable_t SCH_TBL_Structure = {.TickRate = 100, + .Config = { + {CFE_SB_MSGID_WRAP_VALUE(CFE_ES_SEND_HK_MID), 100, 0}, /* Example of a 1hz packet */ + {CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_SEND_HK_MID), 50, 0}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_SEND_HK_MID), 98, 0}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_SB_SEND_HK_MID), 97, 0}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SEND_HK_MID), 96, 0}, + + /* Example of including additional open source apps */ + #ifdef HAVE_CI_LAB + {CFE_SB_MSGID_WRAP_VALUE(CI_LAB_SEND_HK_MID), 95, 0}, + #endif + #ifdef HAVE_TO_LAB + {CFE_SB_MSGID_WRAP_VALUE(TO_LAB_SEND_HK_MID), 94, 0}, + #endif + #ifdef HAVE_SAMPLE_APP + {CFE_SB_MSGID_WRAP_VALUE(SAMPLE_APP_SEND_HK_MID), 93, 0}, + #endif + #ifdef HAVE_SC + {CFE_SB_MSGID_WRAP_VALUE(SC_SEND_HK_MID), 92, 0}, + {CFE_SB_MSGID_WRAP_VALUE(SC_1HZ_WAKEUP_MID), 91, 0}, + #endif + #ifdef HAVE_HS + {CFE_SB_MSGID_WRAP_VALUE(HS_SEND_HK_MID), 90, 0}, /* Example of a message that wouldn't be sent */ + #endif + #ifdef HAVE_FM + {CFE_SB_MSGID_WRAP_VALUE(FM_SEND_HK_MID), 101, 0}, + #endif + #ifdef HAVE_DS + {CFE_SB_MSGID_WRAP_VALUE(DS_SEND_HK_MID), 102, 0}, + #endif + #ifdef HAVE_LC + {CFE_SB_MSGID_WRAP_VALUE(LC_SEND_HK_MID), 103, 0}, + {CFE_SB_MSGID_WRAP_VALUE(LC_SAMPLE_AP_MID), 500, 0, 8, { 0, 175, 1 }}, + #endif + + }}; /* ** The macro below identifies: