Skip to content

Commit

Permalink
Merge pull request #145 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
sch_lab Integration candidate: Caelum-rc4+dev51
  • Loading branch information
dzbaker authored May 22, 2023
2 parents a6a5559 + 1c6d4fd commit 82645f5
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 48 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Development Build: v2.5.0-rc4+dev57
- Add support for cmds w/args
- See <https://github.com/nasa/sch_lab/pull/144>

## Development Build: 2.5.0-rc4+dev53
- adjust table based on apps present
- See <https://github.com/nasa/sch_lab/pull/139>
Expand Down
18 changes: 15 additions & 3 deletions fsw/platform_inc/sch_lab_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions fsw/src/sch_lab_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -64,6 +66,7 @@ typedef struct
*/
SCH_LAB_GlobalData_t SCH_LAB_Global;


/*
** Local Function Prototypes
*/
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/sch_lab_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
93 changes: 51 additions & 42 deletions fsw/tables/sch_lab_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 82645f5

Please sign in to comment.