Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions cfecfs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,4 @@
add_subdirectory(missionlib)
add_subdirectory(eds2cfetbl)
add_subdirectory(util)

# the test executive is an optional component to provide a black-box
# style test framework. It is built using OSAL and UT-Assert.
if (ENABLE_EDS_TESTEXEC)
add_subdirectory(testexecutive)
endif (ENABLE_EDS_TESTEXEC)
add_subdirectory(testrunner)
10 changes: 9 additions & 1 deletion cfecfs/eds2cfetbl/eds2cfetbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,15 @@ int EdsTableTool_WriteGenericFile(lua_State *lua)
return luaL_error(lua, "%s: %s", lua_tostring(lua, 1), strerror(errno));
}

EdsTableTool_PushEncodedSingleObject(lua);
if (lua_type(lua, -1) == LUA_TTABLE)
{
EdsTableTool_PushEncodedMultiObject(lua);
}
else
{
EdsTableTool_PushEncodedSingleObject(lua);
}

fwrite(lua_tostring(lua, -1), lua_rawlen(lua, -1), 1, OutputFile);
fclose(OutputFile);
lua_pop(lua, 1);
Expand Down
2 changes: 1 addition & 1 deletion cfecfs/edsmsg/fsw/inc/edsmsg_hdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
.SecHdrFlags = (mid) >> 11, \
.AppId = (mid) & 0x7FF, \
.SeqFlag = 0x03, \
.Length = (size), \
.Length = (size - 7), \
}, \
.Sec = {.FunctionCode = (fc), .Checksum = (cksum)} \
} \
Expand Down
25 changes: 15 additions & 10 deletions cfecfs/edsmsg/fsw/src/edsmsg_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
#include "cfe_msg.h"
#include "cfe_time.h"
#include "cfe_sb.h"
#include "cfe_missionlib_runtime.h"

#include "ccsds_spacepacket_eds_datatypes.h"
Expand All @@ -41,8 +42,7 @@
*-----------------------------------------------------------------*/
CFE_Status_t CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size_t Size)
{
EdsDataType_CCSDS_CommonHdr_t *CommonHdr;
CFE_Status_t Status;
CFE_Status_t Status;

if (MsgPtr == NULL || Size < sizeof(EdsDataType_CCSDS_CommonHdr_t))
{
Expand All @@ -52,17 +52,22 @@ CFE_Status_t CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_M
/* Clear and set defaults */
memset(MsgPtr, 0, Size);

/* Set various fields in the MsgPtr Metadata object from the bits in MsgId */
Status = CFE_MSG_SetMsgId(MsgPtr, MsgId);
if (Status == CFE_SUCCESS)
/* Allow "CFE_SB_INVALID_MSG_ID" here - in some cases the real msgid is filled in later */
/* however the size should always be a valid value */
if (CFE_SB_MsgIdToValue(MsgId) == CFE_SB_MsgIdToValue(CFE_SB_INVALID_MSG_ID))
{
Status = CFE_SUCCESS;
}
else
{
CommonHdr = (EdsDataType_CCSDS_CommonHdr_t *)(void *)MsgPtr;
Status = CFE_MSG_SetMsgId(MsgPtr, MsgId);
}

/* Default to complete packets */
CommonHdr->SeqFlag = 3; /* jphfix: enum? */
if (Status == CFE_SUCCESS)
{
CFE_MSG_SetSegmentationFlag(MsgPtr, CFE_MSG_SegFlag_Unsegmented);

/* Set the standard size field */
CommonHdr->Length = Size - 7;
Status = CFE_MSG_SetSize(MsgPtr, Size);
}

return Status;
Expand Down
36 changes: 8 additions & 28 deletions cfecfs/missionlib/eds/91-write_cosmos_txt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -306,23 +306,12 @@ local write_tlm_intf_items = function (output,ds,reqintf,msgid,argtype)
tlmname = string.sub(tlmname, 1, -5)
end

output:write(string.format("TELEMETRY %s %s %s_ENDIAN \"%s\"", global_fsw_title, tlmname,
endianness, reqintf.attributes.shortdescription or "Telemetry Message"))
-- Use the predefined values in the cfs_tlm_hdr() function for packet specifics
output:write(string.format("<%%= cfs_tlm_hdr(target_name, '%s', \"%s\") %%>", tlmname,
reqintf.attributes.shortdescription or "Telemetry Message"))

output:start_group("")


-- BACKWARD COMPATIBILITY: A proper identification of the packet involves multiple fields.
-- Historically these were merged into a single 16-bit "StreamID" value and that's what
-- appears to be done in existing/old cosmos DB files. This mimics that for now. There
-- should be a better/more correct way to do this. But for now, this just duplicates the
-- simplified (3x 16-bit UINT) view of the CCSDS v1 header. These should always be big-endian.
output:write(string.format("APPEND_ID_ITEM CCSDS_STREAMID 16 UINT 0x%04X \"CCSDS Packet Identification\" FORMAT_STRING \"0x%%04X\"%s", msgid.Value(), ccsds_append))
output:write(string.format("APPEND_ITEM CCSDS_SEQUENCE 16 UINT \"CCSDS Packet Sequence Control\" FORMAT_STRING \"0x%%04X\"%s", ccsds_append))
output:write(string.format("APPEND_ITEM CCSDS_LENGTH 16 UINT \"CCSDS Packet Data Length\"%s", ccsds_append))
output:write(string.format("APPEND_ITEM SECONDS 32 UINT \"Whole number of Seconds since CFS Epoch\"%s", ccsds_append))
output:write(string.format("APPEND_ITEM SUBSECS 16 UINT \"Fractional portion of Seconds since CFS Epoch\"%s", ccsds_append))

-- Write the definition of the payload
-- Do not output the basetype, only direct members (Payload)
-- This is done by checking that refnode is non-nil
Expand All @@ -348,22 +337,12 @@ local write_cmd_intf_params = function (output,ds,reqintf,msgid,cc)
cmdname = string.sub(cmdname, 1, -5)
end

output:write(string.format("COMMAND %s %s %s_ENDIAN \"%s\"", global_fsw_title, cmdname,
endianness, argtype.attributes.shortdescription or "Telecommand Message"))
-- Use the predefined values in the cfs_cmd_hdr() function for packet specifics
output:write(string.format("<%%= cfs_cmd_hdr(target_name, '%s', %d, \"%s\") %%>", cmdname, cc.value,
argtype.attributes.shortdescription or "Telecommand Message"))

output:start_group("")

-- BACKWARD COMPATIBILITY: A proper identification of the packet involves multiple fields.
-- Historically these were merged into a single 16-bit "StreamID" value and that's what
-- appears to be done in existing/old cosmos DB files. This mimics that for now. There
-- should be a better/more correct way to do this. But for now, this just duplicates the
-- simplified (3x 16-bit UINT) view of the CCSDS v1 header. These should always be big-endian.
output:write(string.format("APPEND_ID_PARAMETER CCSDS_STREAMID 16 UINT MIN MAX 0x%04X \"CCSDS Packet Identification\" FORMAT_STRING \"0x%%04X\"%s", msgid.Value(), ccsds_append))
output:write(string.format("APPEND_PARAMETER CCSDS_SEQUENCE 16 UINT MIN MAX 0xC000 \"CCSDS Packet Sequence Control\" FORMAT_STRING \"0x%%04X\"%s", ccsds_append))
output:write(string.format("APPEND_PARAMETER CCSDS_LENGTH 16 UINT MIN MAX %d \"CCSDS Packet Data Length\"%s", math.ceil(argtype.resolved_size.bits / 8) - 7, ccsds_append))
output:write(string.format("APPEND_PARAMETER CCSDS_FC 8 UINT MIN MAX %d \"CCSDS Command Function Code\"", cc.value))
output:write(string.format("APPEND_PARAMETER CCSDS_CHECKSUM 8 UINT MIN MIN 0 \"Checksum\""))

-- Write the definition of the payload
-- Do not output the basetype, only direct members (Payload)
-- This is done by checking that refnode is non-nil
Expand Down Expand Up @@ -401,13 +380,14 @@ for _,instance in ipairs(SEDS.highlevel_interfaces) do
local argtype = cmd.args[1].type

if (sb_params) then
local file = "cosmos/" .. SEDS.to_filename(reqintf.name .. "_cosmos_intf.txt", ds.name)
local file = "cosmos/" .. SEDS.to_filename(reqintf.name .. "_def.txt", ds.name)
local msgid = sb_params.PubSub.MsgId -- This is the actual hex msgid value
local output

if (reqintf.type.name == "Telecommand") then
if (cmd.cc_list) then
output = SEDS.output_open(file)

for _,cc in ipairs(cmd.cc_list) do
write_cmd_intf_params(output,ds,reqintf,msgid,cc)
output:add_whitespace(1)
Expand Down
8 changes: 4 additions & 4 deletions cfecfs/missionlib/fsw/inc/cfe_missionlib_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ extern "C"
{
#endif

void CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
bool CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
const EdsComponent_CFE_SB_Listener_t *Input);
void CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t *Output,
bool CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t *Output,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input);
void CFE_MissionLib_MapPublisherComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
bool CFE_MissionLib_MapPublisherComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
const EdsComponent_CFE_SB_Publisher_t *Input);
void CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t *Output,
bool CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t *Output,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input);

bool CFE_MissionLib_PubSub_IsListenerComponent(const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params);
Expand Down
84 changes: 54 additions & 30 deletions cfecfs/missionlib/fsw/src/cfe_missionlib_runtime_default.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,71 +299,95 @@ static bool CFE_MissionLib_TryUnmapping(uint16_t
return true;
}

void CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
bool CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
const EdsComponent_CFE_SB_Listener_t *Input)
{
bool Result;

memset(Output, 0, sizeof(*Output));

if (!CFE_MissionLib_TryMapping(Output,
&CFE_MISSIONLIB_LOCAL_CMD_LIMITS,
Input->Telecommand.InstanceNumber,
Input->Telecommand.TopicId))
Result = CFE_MissionLib_TryMapping(Output,
&CFE_MISSIONLIB_LOCAL_CMD_LIMITS,
Input->Telecommand.InstanceNumber,
Input->Telecommand.TopicId);

if (!Result)
{
CFE_MissionLib_TryMapping(Output, &CFE_MISSIONLIB_GLOBAL_CMD_LIMITS, 0, Input->Telecommand.TopicId);
Result = CFE_MissionLib_TryMapping(Output, &CFE_MISSIONLIB_GLOBAL_CMD_LIMITS, 0, Input->Telecommand.TopicId);
}

return Result;
}

void CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t *Output,
bool CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t *Output,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input)
{
bool Result;

memset(Output, 0, sizeof(*Output));

if (!CFE_MissionLib_TryUnmapping(&Output->Telecommand.InstanceNumber,
&Output->Telecommand.TopicId,
&CFE_MISSIONLIB_GLOBAL_CMD_LIMITS,
Input))
Result = CFE_MissionLib_TryUnmapping(&Output->Telecommand.InstanceNumber,
&Output->Telecommand.TopicId,
&CFE_MISSIONLIB_GLOBAL_CMD_LIMITS,
Input);

if (!Result)
{
CFE_MissionLib_TryUnmapping(&Output->Telecommand.InstanceNumber,
&Output->Telecommand.TopicId,
&CFE_MISSIONLIB_LOCAL_CMD_LIMITS,
Input);
Result = CFE_MissionLib_TryUnmapping(&Output->Telecommand.InstanceNumber,
&Output->Telecommand.TopicId,
&CFE_MISSIONLIB_LOCAL_CMD_LIMITS,
Input);
}

return Result;
}

bool CFE_MissionLib_PubSub_IsListenerComponent(const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params)
{
return (CFE_MissionLib_GetMsgIdInterfaceType(&Params->MsgId) == CFE_MISSIONLIB_MSGID_TELECOMMAND_BITS);
}

void CFE_MissionLib_MapPublisherComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
bool CFE_MissionLib_MapPublisherComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
const EdsComponent_CFE_SB_Publisher_t *Input)
{
bool Result;

memset(Output, 0, sizeof(*Output));

if (!CFE_MissionLib_TryMapping(Output,
&CFE_MISSIONLIB_LOCAL_TLM_LIMITS,
Input->Telemetry.InstanceNumber,
Input->Telemetry.TopicId))
Result = CFE_MissionLib_TryMapping(Output,
&CFE_MISSIONLIB_LOCAL_TLM_LIMITS,
Input->Telemetry.InstanceNumber,
Input->Telemetry.TopicId);

if (!Result)
{
CFE_MissionLib_TryMapping(Output, &CFE_MISSIONLIB_GLOBAL_TLM_LIMITS, 0, Input->Telemetry.TopicId);
Result = CFE_MissionLib_TryMapping(Output, &CFE_MISSIONLIB_GLOBAL_TLM_LIMITS, 0, Input->Telemetry.TopicId);
}

return Result;
}

void CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t *Output,
bool CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t *Output,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input)
{
bool Result;

memset(Output, 0, sizeof(*Output));

if (!CFE_MissionLib_TryUnmapping(&Output->Telemetry.InstanceNumber,
&Output->Telemetry.TopicId,
&CFE_MISSIONLIB_LOCAL_TLM_LIMITS,
Input))
Result = CFE_MissionLib_TryUnmapping(&Output->Telemetry.InstanceNumber,
&Output->Telemetry.TopicId,
&CFE_MISSIONLIB_LOCAL_TLM_LIMITS,
Input);

if (!Result)
{
CFE_MissionLib_TryUnmapping(&Output->Telemetry.InstanceNumber,
&Output->Telemetry.TopicId,
&CFE_MISSIONLIB_GLOBAL_TLM_LIMITS,
Input);
Result = CFE_MissionLib_TryUnmapping(&Output->Telemetry.InstanceNumber,
&Output->Telemetry.TopicId,
&CFE_MISSIONLIB_GLOBAL_TLM_LIMITS,
Input);
}

return Result;
}

bool CFE_MissionLib_PubSub_IsPublisherComponent(const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params)
Expand Down
24 changes: 20 additions & 4 deletions cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_runtime_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,39 @@ void CFE_MissionLib_Get_PubSub_Parameters(EdsInterface_CFE_SB_SoftwareBus_PubSub
* Generated stub function for CFE_MissionLib_MapListenerComponent()
* ----------------------------------------------------
*/
void CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
bool CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
const EdsComponent_CFE_SB_Listener_t *Input)
{
UT_GenStub_SetupReturnBuffer(CFE_MissionLib_MapListenerComponent, bool);

UT_GenStub_AddParam(CFE_MissionLib_MapListenerComponent, EdsInterface_CFE_SB_SoftwareBus_PubSub_t *, Output);
UT_GenStub_AddParam(CFE_MissionLib_MapListenerComponent, const EdsComponent_CFE_SB_Listener_t *, Input);

UT_GenStub_Execute(CFE_MissionLib_MapListenerComponent,
Basic,
UT_DefaultHandler_CFE_MissionLib_MapListenerComponent);

return UT_GenStub_GetReturnValue(CFE_MissionLib_MapListenerComponent, bool);
}

/*
* ----------------------------------------------------
* Generated stub function for CFE_MissionLib_MapPublisherComponent()
* ----------------------------------------------------
*/
void CFE_MissionLib_MapPublisherComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
bool CFE_MissionLib_MapPublisherComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
const EdsComponent_CFE_SB_Publisher_t *Input)
{
UT_GenStub_SetupReturnBuffer(CFE_MissionLib_MapPublisherComponent, bool);

UT_GenStub_AddParam(CFE_MissionLib_MapPublisherComponent, EdsInterface_CFE_SB_SoftwareBus_PubSub_t *, Output);
UT_GenStub_AddParam(CFE_MissionLib_MapPublisherComponent, const EdsComponent_CFE_SB_Publisher_t *, Input);

UT_GenStub_Execute(CFE_MissionLib_MapPublisherComponent,
Basic,
UT_DefaultHandler_CFE_MissionLib_MapPublisherComponent);

return UT_GenStub_GetReturnValue(CFE_MissionLib_MapPublisherComponent, bool);
}

/*
Expand Down Expand Up @@ -145,25 +153,31 @@ void CFE_MissionLib_Set_PubSub_Parameters(EdsDataType_CFE_HDR_Message_t
* Generated stub function for CFE_MissionLib_UnmapListenerComponent()
* ----------------------------------------------------
*/
void CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t *Output,
bool CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t *Output,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input)
{
UT_GenStub_SetupReturnBuffer(CFE_MissionLib_UnmapListenerComponent, bool);

UT_GenStub_AddParam(CFE_MissionLib_UnmapListenerComponent, EdsComponent_CFE_SB_Listener_t *, Output);
UT_GenStub_AddParam(CFE_MissionLib_UnmapListenerComponent, const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *, Input);

UT_GenStub_Execute(CFE_MissionLib_UnmapListenerComponent,
Basic,
UT_DefaultHandler_CFE_MissionLib_UnmapListenerComponent);

return UT_GenStub_GetReturnValue(CFE_MissionLib_UnmapListenerComponent, bool);
}

/*
* ----------------------------------------------------
* Generated stub function for CFE_MissionLib_UnmapPublisherComponent()
* ----------------------------------------------------
*/
void CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t *Output,
bool CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t *Output,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input)
{
UT_GenStub_SetupReturnBuffer(CFE_MissionLib_UnmapPublisherComponent, bool);

UT_GenStub_AddParam(CFE_MissionLib_UnmapPublisherComponent, EdsComponent_CFE_SB_Publisher_t *, Output);
UT_GenStub_AddParam(CFE_MissionLib_UnmapPublisherComponent,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *,
Expand All @@ -172,4 +186,6 @@ void CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t
UT_GenStub_Execute(CFE_MissionLib_UnmapPublisherComponent,
Basic,
UT_DefaultHandler_CFE_MissionLib_UnmapPublisherComponent);

return UT_GenStub_GetReturnValue(CFE_MissionLib_UnmapPublisherComponent, bool);
}
Loading
Loading