|
| 1 | +#include "cfe.h" |
| 2 | +#include "cfe_tbl_filedef.h" |
| 3 | + |
| 4 | +#include "sc_tbldefs.h" /* defines SC table headers */ |
| 5 | +#include "sc_platform_cfg.h" /* defines table buffer size */ |
| 6 | +#include "sc_msgdefs.h" /* defines SC command code values */ |
| 7 | +#include "sc_msgids.h" /* defines SC packet msg ID's */ |
| 8 | +#include "sc_msg.h" /* defines SC message structures */ |
| 9 | + |
| 10 | +/* Command Includes */ |
| 11 | +#include "generic_css_msg.h" |
| 12 | +#include "generic_css_msgids.h" |
| 13 | +#include "generic_fss_msg.h" |
| 14 | +#include "generic_fss_msgids.h" |
| 15 | +#include "generic_imu_msg.h" |
| 16 | +#include "generic_imu_msgids.h" |
| 17 | +#include "generic_mag_msg.h" |
| 18 | +#include "generic_mag_msgids.h" |
| 19 | +#include "generic_torquer_msg.h" |
| 20 | +#include "generic_torquer_msgids.h" |
| 21 | +#include "novatel_oem615_msg.h" |
| 22 | +#include "novatel_oem615_msgids.h" |
| 23 | +#include "generic_adcs_msg.h" |
| 24 | +#include "generic_adcs_msgids.h" |
| 25 | +#include "generic_adcs_adac.h" |
| 26 | + |
| 27 | +/* Custom table structure, modify as needed to add desired commands */ |
| 28 | +typedef struct |
| 29 | +{ |
| 30 | + /* 1 - Enable CSS */ |
| 31 | + SC_RtsEntryHeader_t hdr1; |
| 32 | + GENERIC_CSS_NoArgs_cmd_t cmd1; |
| 33 | + /* 2 - Enable FSS */ |
| 34 | + SC_RtsEntryHeader_t hdr2; |
| 35 | + GENERIC_FSS_NoArgs_cmd_t cmd2; |
| 36 | + /* 3 - Enable IMU */ |
| 37 | + SC_RtsEntryHeader_t hdr3; |
| 38 | + GENERIC_IMU_NoArgs_cmd_t cmd3; |
| 39 | + /* 4 - Enable MAG */ |
| 40 | + SC_RtsEntryHeader_t hdr4; |
| 41 | + GENERIC_MAG_NoArgs_cmd_t cmd4; |
| 42 | + /* 5 - Enable torquers */ |
| 43 | + SC_RtsEntryHeader_t hdr5; |
| 44 | + GENERIC_TORQUER_NoArgs_cmd_t cmd5; |
| 45 | + /* 6 - Enable GPS */ |
| 46 | + SC_RtsEntryHeader_t hdr6; |
| 47 | + NOVATEL_OEM615_NoArgs_cmd_t cmd6; |
| 48 | + /* 7 - Set ADCS to SUNSAFE_MODE */ |
| 49 | + SC_RtsEntryHeader_t hdr7; |
| 50 | + Generic_ADCS_Mode_cmd_t cmd7; |
| 51 | +} SC_RtsStruct003_t; |
| 52 | + |
| 53 | +/* Define the union to size the table correctly */ |
| 54 | +typedef union |
| 55 | +{ |
| 56 | + SC_RtsStruct003_t rts; |
| 57 | + uint16 buf[SC_RTS_BUFF_SIZE]; |
| 58 | +} SC_RtsTable003_t; |
| 59 | + |
| 60 | +/* Helper macro to get size of structure elements */ |
| 61 | +#define SC_MEMBER_SIZE(member) (sizeof(((SC_RtsStruct003_t *)0)->member)) |
| 62 | + |
| 63 | +/* Used designated intializers to be verbose, modify as needed/desired */ |
| 64 | +SC_RtsTable003_t SC_Rts003 = { |
| 65 | +.rts = { |
| 66 | + /* 1 - Enable CSS */ |
| 67 | + .hdr1.TimeTag = 1, |
| 68 | + .cmd1.CmdHeader = CFE_MSG_CMD_HDR_INIT(GENERIC_CSS_CMD_MID, SC_MEMBER_SIZE(cmd1), GENERIC_CSS_ENABLE_CC, 0x00), |
| 69 | + |
| 70 | + /* 2 - Enable FSS */ |
| 71 | + .hdr2.TimeTag = 1, |
| 72 | + .cmd2.CmdHeader = CFE_MSG_CMD_HDR_INIT(GENERIC_FSS_CMD_MID, SC_MEMBER_SIZE(cmd2), GENERIC_FSS_ENABLE_CC, 0x00), |
| 73 | + |
| 74 | + /* 3 - Enable IMU */ |
| 75 | + .hdr3.TimeTag = 1, |
| 76 | + .cmd3.CmdHeader = CFE_MSG_CMD_HDR_INIT(GENERIC_IMU_CMD_MID, SC_MEMBER_SIZE(cmd3), GENERIC_IMU_ENABLE_CC, 0x00), |
| 77 | + |
| 78 | + /* 4 - Enable MAG */ |
| 79 | + .hdr4.TimeTag = 1, |
| 80 | + .cmd4.CmdHeader = CFE_MSG_CMD_HDR_INIT(GENERIC_MAG_CMD_MID, SC_MEMBER_SIZE(cmd4), GENERIC_MAG_ENABLE_CC, 0x00), |
| 81 | + |
| 82 | + /* 5 - Enable torquers */ |
| 83 | + .hdr5.TimeTag = 1, |
| 84 | + .cmd5.CmdHeader = CFE_MSG_CMD_HDR_INIT(GENERIC_TORQUER_CMD_MID, SC_MEMBER_SIZE(cmd5), GENERIC_TORQUER_ENABLE_CC, 0x00), |
| 85 | + |
| 86 | + /* 6 - Enable GPS */ |
| 87 | + .hdr6.TimeTag = 1, |
| 88 | + .cmd6.CmdHeader = CFE_MSG_CMD_HDR_INIT(NOVATEL_OEM615_CMD_MID, SC_MEMBER_SIZE(cmd6), NOVATEL_OEM615_ENABLE_CC, 0x00), |
| 89 | + |
| 90 | + /* 7 - Set ADCS to SUNSAFE_MODE */ |
| 91 | + .hdr7.TimeTag = 5, |
| 92 | + .cmd7.CmdHeader = CFE_MSG_CMD_HDR_INIT(GENERIC_ADCS_CMD_MID, SC_MEMBER_SIZE(cmd7), GENERIC_ADCS_SET_MODE_CC, 0x00), |
| 93 | + .cmd7.Mode = SUNSAFE_MODE, |
| 94 | + } |
| 95 | +}; |
| 96 | + |
| 97 | +/* Macro for table structure */ |
| 98 | +CFE_TBL_FILEDEF(SC_Rts003, SC.RTS_TBL003, Safe Mode RTS003, sc_rts003.tbl) |
0 commit comments