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
19 changes: 19 additions & 0 deletions .github/workflows/format-check-internal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Internal Format Check

# Run on all push and pull requests
on:
push:
branches:
- dev
- main
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:

jobs:
format-check:
name: Run format check
uses: cFS/workflows/.github/workflows/format-check-reusable-internal.yml@dev
309 changes: 174 additions & 135 deletions cfecfs/eds2cfetbl/eds2cfetbl.c

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions cfecfs/eds2cfetbl/scripts/eds_tbltool_filedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ EdsDataType_CFE_SB_MsgIdValue_t CFE_SB_CmdTopicIdToMsgId(uint16_t TopicId, uint1
EdsDataType_CFE_SB_MsgIdValue_t CFE_SB_TlmTopicIdToMsgId(uint16_t TopicId, uint16_t InstanceNum);

uint16_t EdsTableTool_GetProcessorId(void);
void EdsTableTool_DoExport(const void *filedefptr, const void *objptr, size_t objsize, const char *typename, size_t typesize);

void EdsTableTool_DoExport(const void *filedefptr,
const void *objptr,
size_t objsize,
const char *typename,
size_t typesize);

static inline EdsDataType_CFE_SB_MsgIdValue_t CFE_SB_GlobalCmdTopicIdToMsgId(uint16_t TopicId)
{
Expand All @@ -37,5 +40,4 @@ static inline EdsDataType_CFE_SB_MsgIdValue_t CFE_SB_LocalTlmTopicIdToMsgId(uint
return CFE_SB_TlmTopicIdToMsgId(TopicId, EdsTableTool_GetProcessorId());
}


#endif
1 change: 1 addition & 0 deletions cfecfs/edsmsg/eds/cfe_hdr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
</ConstraintSet>-->
<EntryList>
<Entry name="Sec" type="TlmSecHdr" shortDescription="Telemetry Secondary Header" />
<PaddingEntry sizeInBits="32" shortDescription="Spare bytes for alignment"/>
</EntryList>
</ContainerDataType>

Expand Down
6 changes: 4 additions & 2 deletions cfecfs/edsmsg/fsw/inc/edsmsg_dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@
* \param DispatchTable Pointer to the dispatch table
* \returns If successfully dispatched, returns code from handler function, otherwise an error code.
*/
CFE_Status_t CFE_EDSMSG_Dispatch(EdsLib_Id_t DeclIntfId, EdsLib_Id_t ComponentId, const CFE_SB_Buffer_t *Buffer,
const void *DispatchTable);
CFE_Status_t CFE_EDSMSG_Dispatch(EdsLib_Id_t DeclIntfId,
EdsLib_Id_t ComponentId,
const CFE_SB_Buffer_t *Buffer,
const void *DispatchTable);

#endif /* edsmsg_dispatcher_H */
6 changes: 3 additions & 3 deletions cfecfs/edsmsg/fsw/inc/edsmsg_hdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
/**
* \brief Macro to initialize a command header, useful in tables that define commands
*/
#define CFE_MSG_CMD_HDR_INIT(mid, size, fc, cksum) \
{ \
#define CFE_MSG_CMD_HDR_INIT(mid, size, fc, cksum) \
{ \
.CommandHeader = { \
.Message.CCSDS.CommonHdr = \
{ \
Expand All @@ -76,7 +76,7 @@
.Length = (size), \
}, \
.Sec = {.FunctionCode = (fc), .Checksum = (cksum)} \
} \
} \
}

/*
Expand Down
27 changes: 16 additions & 11 deletions cfecfs/edsmsg/fsw/src/edsmsg_dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ bool CFE_EDSMSG_Dispatch_CheckComponentMatch(EdsLib_Id_t ComponentId, CFE_Missio
* This just finds the base type using the information in the EDS DB only
*
*-----------------------------------------------------------------*/
CFE_Status_t CFE_EDSMSG_Dispatch_FindArgBaseType(EdsLib_Id_t DeclIntfId, EdsLib_Id_t CompIntfId,
EdsLib_Id_t *ArgTypeBuf)
CFE_Status_t
CFE_EDSMSG_Dispatch_FindArgBaseType(EdsLib_Id_t DeclIntfId, EdsLib_Id_t CompIntfId, EdsLib_Id_t *ArgTypeBuf)
{
const EdsLib_DatabaseObject_t *GD;
EdsLib_Id_t CommandEdsId;
Expand Down Expand Up @@ -199,8 +199,9 @@ CFE_Status_t CFE_EDSMSG_Dispatch_FindArgBaseType(EdsLib_Id_t DeclIntfId, EdsLib_
* expected/defined size in EDS
*
*-----------------------------------------------------------------*/
CFE_Status_t CFE_EDSMSG_Dispatch_CheckActualBufferType(const CFE_SB_Buffer_t *Buffer, EdsLib_Id_t *EdsId,
uint32_t *DispatchTblPosition)
CFE_Status_t CFE_EDSMSG_Dispatch_CheckActualBufferType(const CFE_SB_Buffer_t *Buffer,
EdsLib_Id_t *EdsId,
uint32_t *DispatchTblPosition)
{
const EdsLib_DatabaseObject_t *GD;
EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
Expand Down Expand Up @@ -254,8 +255,10 @@ CFE_Status_t CFE_EDSMSG_Dispatch_CheckActualBufferType(const CFE_SB_Buffer_t *Bu
* Completely look up the data type from the supplied interface IDs
*
*-----------------------------------------------------------------*/
CFE_Status_t CFE_EDSMSG_Dispatch_FindArgType(EdsLib_Id_t DeclIntfId, EdsLib_Id_t ParentIntfId,
const CFE_SB_Buffer_t *Buffer, uint32_t *DispatchPosition)
CFE_Status_t CFE_EDSMSG_Dispatch_FindArgType(EdsLib_Id_t DeclIntfId,
EdsLib_Id_t ParentIntfId,
const CFE_SB_Buffer_t *Buffer,
uint32_t *DispatchPosition)
{
CFE_Status_t ReturnCode;
EdsLib_Id_t ArgType;
Expand All @@ -281,15 +284,15 @@ CFE_Status_t CFE_EDSMSG_Dispatch_FindArgType(EdsLib_Id_t DeclIntfId, EdsLib_Id_t
* Finds the matching handler function from the dispatch table
*
*-----------------------------------------------------------------*/
CFE_EDSMSG_DispatchFunc_t CFE_EDSMSG_Dispatch_LookupHandler(const void *DispatchTable, size_t DispatchStartOffset,
uint32_t DispatchPosition)
CFE_EDSMSG_DispatchFunc_t
CFE_EDSMSG_Dispatch_LookupHandler(const void *DispatchTable, size_t DispatchStartOffset, uint32_t DispatchPosition)
{
const uint8 *MemAddr;
const CFE_EDSMSG_DispatchFunc_t *DispatchTbl;

/* calculate the address of the first handler routine for this intf
* Note the START offsets are in bytes, so this must be done in uint8* logic */
MemAddr = (const uint8 *)DispatchTable;
MemAddr = (const uint8 *)DispatchTable;
MemAddr += DispatchStartOffset;

/* now shift to the correct type (function pointer) and apply the position offset */
Expand All @@ -304,8 +307,10 @@ CFE_EDSMSG_DispatchFunc_t CFE_EDSMSG_Dispatch_LookupHandler(const void *Dispatch
* Dispatch the message based on the IDs and dispatch table
*
*-----------------------------------------------------------------*/
CFE_Status_t CFE_EDSMSG_Dispatch(EdsLib_Id_t DeclIntfId, EdsLib_Id_t ComponentId, const CFE_SB_Buffer_t *Buffer,
const void *DispatchTable)
CFE_Status_t CFE_EDSMSG_Dispatch(EdsLib_Id_t DeclIntfId,
EdsLib_Id_t ComponentId,
const CFE_SB_Buffer_t *Buffer,
const void *DispatchTable)
{
CFE_Status_t ReturnCode;
CFE_MissionLib_TopicInfo_t TopicInfo;
Expand Down
6 changes: 4 additions & 2 deletions cfecfs/edsmsg/fsw/ut-stubs/edsmsg_dispatcher_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
* Generated stub function for CFE_EDSMSG_Dispatch()
* ----------------------------------------------------
*/
CFE_Status_t CFE_EDSMSG_Dispatch(EdsLib_Id_t DeclIntfId, EdsLib_Id_t ComponentId, const CFE_SB_Buffer_t *Buffer,
const void *DispatchTable)
CFE_Status_t CFE_EDSMSG_Dispatch(EdsLib_Id_t DeclIntfId,
EdsLib_Id_t ComponentId,
const CFE_SB_Buffer_t *Buffer,
const void *DispatchTable)
{
UT_GenStub_SetupReturnBuffer(CFE_EDSMSG_Dispatch, CFE_Status_t);

Expand Down
4 changes: 3 additions & 1 deletion cfecfs/missionlib/cmake/dbobj_patternrules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ include $(EDS_REPO_SOURCE_DIR)/edslib/cmake/base_patternrules.mk
# linker logic that CMake uses, this just assumes a GNU-style LD, and that the file extension
# (.so or .obj) indicates the style of loadable object being used.

$(O)/$(EDS_FILE_PREFIX)_sb_dispatchdb.so: EXTRA_LINK_LIBS=-l:$(EDS_FILE_PREFIX)_db.so

$(O)/%.so:
@echo EDS: Linking shared object $(@) for $(EDSTOOL_ARCH)
$(LD) $(SHARED_LDFLAGS) -shared -o $@ $^ -L$(O) -l:$(EDS_FILE_PREFIX)_db.so
$(LD) $(SHARED_LDFLAGS) -shared -o $@ $^ -L$(O) $(EXTRA_LINK_LIBS)

$(O)/%.obj:
@echo EDS: Linking relocatable object $(@) for $(EDSTOOL_ARCH)
Expand Down
65 changes: 49 additions & 16 deletions cfecfs/missionlib/eds/91-write_cosmos_txt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,13 @@ write_cosmos_lineitem = function(output,line_writer,entry,qual_prefix,descr)
bits_remainder = bits_remainder - attribs.bitsize
end
attribs.bitsize = bits_remainder
elseif (entry.entity_type == "STRING_DATATYPE" or entry.entity_type == "BINARY_DATATYPE") then
elseif (entry.entity_type == "STRING_DATATYPE") then
attribs.ctype = "STRING"
elseif (SEDS.index_datatype_filter(entry)) then
elseif (entry.entity_type == "BINARY_DATATYPE") then
attribs.ctype = "BLOCK"
elseif (entry.entity_type == "FLOAT_DATATYPE") then
attribs.ctype = "FLOAT"
elseif (entry.entity_type == "BOOLEAN_DATATYPE" or SEDS.index_datatype_filter(entry)) then
attribs.ctype = (entry.is_signed and "INT") or "UINT"

-- This only handles integers
Expand Down Expand Up @@ -193,38 +197,68 @@ write_cosmos_block = function(output,line_writer,entry,qual_prefix,descr)

end


-- -------------------------------------------------------------------------
-- Helper function: write a flattened array, adding a digit to the name prefix
-- -------------------------------------------------------------------------
write_cosmos_array_members = function(output,line_writer,arr,qual_prefix)

local min, max

-- Arrays can be dimensioned by an index type, and that type may have a better string representation
-- This also means that the range could be something other than the typical limits
local min, max
local minv, maxv
local dimension_typename
local writer
local datatyperef
local dimension_obj

-- This wrapper handles the case where the array elements are not at byte boundaries
-- The output is expressed as a series of 8 bit values (packed)
local_packedarray_writer = function(idx, element_qual_prefix)
local attribs = {
name = SEDS.to_macro_name(element_qual_prefix),
ctype = "UINT",
bitsize = 8,
descr = string.format("%s packed byte %d", qual_prefix or "array", idx)
}
line_writer(output, attribs)
end

for dimension in arr:iterate_subtree("DIMENSION") do
if (dimension.indextyperef) then
dimension_typename = dimension.indextyperef:get_qualified_name()
min = dimension.indextyperef.resolved_range.min
max = dimension.indextyperef.resolved_range.max
-- This wrapper handles the normal case where the array elements are a
-- whole number of bytes, and thus spelled out normally in the definition
local_array_writer = function(idx, element_qual_prefix)
write_cosmos_block(output,line_writer,datatyperef,element_qual_prefix)
end

datatyperef = arr.datatyperef

-- Check if this needs to be output as a bitmap
if ((datatyperef.resolved_size.bits % 8) ~= 0) then
-- Packing: The dimension is the size of the whole array
min = { value = 0, inclusive = true }
max = { value = arr.resolved_size.bits / 8, inclusive = false }
writer = local_packedarray_writer
else
-- Normal: The actual dimension will be used
for dimension in arr:iterate_subtree("DIMENSION") do
if (dimension.indextyperef) then
dimension_typename = dimension.indextyperef:get_qualified_name()
min = dimension.indextyperef.resolved_range.min
max = dimension.indextyperef.resolved_range.max
end
end
writer = local_array_writer
end

-- As a fallback use a generic 32-bit integer as the index type
local dimension_obj = SEDS.edslib.NewObject(dimension_typename or "BASE_TYPES/int32")
dimension_obj = SEDS.edslib.NewObject(dimension_typename or "BASE_TYPES/int32")

-- Determine the usable min/max -- this means adjusting for inclusiveness of the limits
local minv
if (min) then
minv = min.value + (min.inclusive and 0 or 1)
else
minv = 0
end

local maxv
if (max) then
maxv = max.value - (max.inclusive and 0 or 1)
else
Expand All @@ -234,7 +268,7 @@ write_cosmos_array_members = function(output,line_writer,arr,qual_prefix)
for i=minv,maxv do

dimension_obj(i)
write_cosmos_block(output,line_writer,arr.datatyperef,append_qual_prefix(qual_prefix, dimension_obj))
writer(i, append_qual_prefix(qual_prefix, dimension_obj))

end

Expand Down Expand Up @@ -355,7 +389,7 @@ for _,instance in ipairs(SEDS.highlevel_interfaces) do
-- The various interfaces should be attached under required_links
for _,binding in ipairs(instance.required_links) do
local reqintf = binding.reqintf
local intf_type_str = reqintf.type:get_qualified_name()
local intf_type_str = reqintf.type:get_qualified_name()
if (intf_type_str == "CFE_SB/Telemetry" or intf_type_str == "CFE_SB/Telecommand") then
local cmd = reqintf.intf_commands and reqintf.intf_commands[1]

Expand Down Expand Up @@ -391,4 +425,3 @@ for _,instance in ipairs(SEDS.highlevel_interfaces) do
end
end
end

11 changes: 7 additions & 4 deletions cfecfs/missionlib/fsw/inc/cfe_missionlib_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ extern "C"
* @param[out] TopicInfo output buffer for detail information, if successful
* @return CFE_MISSIONLIB_SUCCESS if successful, error code if unsuccessful
*/
int32_t CFE_MissionLib_GetTopicInfo(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB, uint16_t TopicId,
CFE_MissionLib_TopicInfo_t *TopicInfo);
int32_t CFE_MissionLib_GetTopicInfo(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
uint16_t TopicId,
CFE_MissionLib_TopicInfo_t *TopicInfo);

/**
* Get the instance name corresponding to an instance number
Expand Down Expand Up @@ -196,7 +197,8 @@ extern "C"
* @param[inout] OpaqueArg an argument that is passed to the callback, may be NULL if not needed
*/
void CFE_MissionLib_EnumerateTopics(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
CFE_MissionLib_TopicInfo_Callback_t Callback, void *OpaqueArg);
CFE_MissionLib_TopicInfo_Callback_t Callback,
void *OpaqueArg);

/**
* Finds a topic ID matching the given interface ID
Expand All @@ -210,7 +212,8 @@ extern "C"
* @return CFE_MISSIONLIB_SUCCESS if successful, error code if unsuccessful
*/
int32_t CFE_MissionLib_FindTopicIdFromIntfId(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
EdsLib_Id_t IntfEdsId, uint16_t *TopicIdBuffer);
EdsLib_Id_t IntfEdsId,
uint16_t *TopicIdBuffer);

#ifdef __cplusplus
} /* extern "C" */
Expand Down
12 changes: 6 additions & 6 deletions cfecfs/missionlib/fsw/inc/cfe_missionlib_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,20 @@ extern "C"
#endif

void 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,
const EdsComponent_CFE_SB_Listener_t *Input);
void 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,
const EdsComponent_CFE_SB_Publisher_t * Input);
void CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t * Output,
const EdsComponent_CFE_SB_Publisher_t *Input);
void 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);
bool CFE_MissionLib_PubSub_IsPublisherComponent(const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params);

void CFE_MissionLib_Get_PubSub_Parameters(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params,
const EdsDataType_CFE_HDR_Message_t * Packet);
void CFE_MissionLib_Set_PubSub_Parameters(EdsDataType_CFE_HDR_Message_t * Packet,
const EdsDataType_CFE_HDR_Message_t *Packet);
void CFE_MissionLib_Set_PubSub_Parameters(EdsDataType_CFE_HDR_Message_t *Packet,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params);

#ifdef __cplusplus
Expand Down
13 changes: 8 additions & 5 deletions cfecfs/missionlib/fsw/src/cfe_missionlib_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ uint16_t CFE_MissionLib_GetNumInstances(const CFE_MissionLib_SoftwareBus_Interfa
* Public API function
*
*-----------------------------------------------------------------*/
int32_t CFE_MissionLib_GetTopicInfo(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB, uint16_t TopicId,
CFE_MissionLib_TopicInfo_t *TopicInfo)
int32_t CFE_MissionLib_GetTopicInfo(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
uint16_t TopicId,
CFE_MissionLib_TopicInfo_t *TopicInfo)
{
const CFE_MissionLib_TopicId_Entry_t *TopicPtr;
int32_t Status;
Expand Down Expand Up @@ -200,7 +201,8 @@ uint16_t CFE_MissionLib_GetInstanceNumber(const CFE_MissionLib_SoftwareBus_Inter
*
*-----------------------------------------------------------------*/
void CFE_MissionLib_EnumerateTopics(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
CFE_MissionLib_TopicInfo_Callback_t Callback, void *OpaqueArg)
CFE_MissionLib_TopicInfo_Callback_t Callback,
void *OpaqueArg)
{
const CFE_MissionLib_TopicId_Entry_t *TopicPtr;
uint16_t TopicId;
Expand All @@ -218,8 +220,9 @@ void CFE_MissionLib_EnumerateTopics(const CFE_MissionLib_SoftwareBus_Interface_t
* Public API function
*
*-----------------------------------------------------------------*/
int32_t CFE_MissionLib_FindTopicIdFromIntfId(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB, EdsLib_Id_t IntfEdsId,
uint16_t *TopicIdBuffer)
int32_t CFE_MissionLib_FindTopicIdFromIntfId(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
EdsLib_Id_t IntfEdsId,
uint16_t *TopicIdBuffer)
{
const CFE_MissionLib_TopicId_Entry_t *TopicPtr;
uint16_t TopicId;
Expand Down
Loading
Loading