@@ -1216,7 +1216,7 @@ FILE: xx_app.c
12161216void XX_AppMain(void)
12171217{
12181218 uint32 RunStatus = CFE_ES_RunStatus_APP_RUN;
1219- CFE_SB_MsgPtr_t MsgPtr;
1219+ CFE_MSG_Message_t * MsgPtr;
12201220 int32 Result = CFE_SUCCESS;
12211221
12221222 /* Register application */
@@ -1319,18 +1319,18 @@ SB Messages by allocating sufficient memory, calling the SB API to
13191319initialize the contents of the SB Message and then storing any
13201320appropriate data into the structure.
13211321
1322- The Software Bus API hides the details of the message structure,
1323- providing routines such as CFE_SB_GetMsgTime and CFE_SB_SetMsgTime
1322+ The Message API hides the details of the message structure,
1323+ providing routines such as CFE_MSG_GetMsgTime and CFE_MSG_SetMsgTime
13241324in order to get and set a message time. The current version of the cFE
13251325supports only CCSDS, however, the implementation of the message
13261326structure can be changed without affecting cFS Applications.
13271327
1328- In the CCSDS implementation of the Software Bus, the upper 3 most
1329- significant bits of the 16 bit Message ID Number ** shall be zero
1330- (b'000'). ** The Software Bus ignores the upper 3 most significant bits
1331- defined by CCSDS as the Version Number. A non-zero value in the Version
1332- Number (3 bits) could result in duplicate Message IDs being defined. For
1333- example, x01FF and x81FF are the same Message ID to the Software Bus .
1328+ See the implementation documentation for specific formats,
1329+ fields, and bit values. The message ID (MsgId) is an abstract
1330+ concept that is implementation depended, used for routing messages
1331+ on the Software Bus. Depending on the implementation, different
1332+ ranges and values are supported, and the values effect the message
1333+ header differently .
13341334
13351335##### 6.1.2 Pipes
13361336
@@ -1646,10 +1646,9 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
16461646 int32 Status;
16471647
16481648 ...
1649- Status = CFE_SB_InitMsg(&SAMPLE_AppData.HkPacket, /* Address of SB Message Data Buffer */
1650- SAMPLE_HK_TLM_MID, /* SB Message ID associated with Data */
1651- sizeof(SAMPLE_HkPacket_t), /* Size of Buffer */
1652- CFE_SB_CLEAR_DATA); /* Buffer should be cleared by cFE */
1649+ Status = CFE_MSG_Init(&SAMPLE_AppData.HkPacket, /* Address of SB Message Data Buffer */
1650+ SAMPLE_HK_TLM_MID, /* SB Message ID associated with Data */
1651+ sizeof(SAMPLE_HkPacket_t)); /* Size of Buffer */
16531652 ...
16541653}
16551654```
@@ -1660,7 +1659,7 @@ the SB Message was to be a command message, it would have been important
16601659for the Developer to have used the CFE_SB_CMD_HDR_SIZE macro
16611660instead.
16621661
1663- The CFE_SB_InitMsg API call formats the SB Message Header
1662+ The CFE_MSG_Init API call formats the Message Header
16641663appropriately with the given SB Message ID, size and, in this case,
16651664clears the data portion of the SB Message (CFE_SB_CLEAR_DATA).
16661665Another option for the fourth parameter is CFE_SB_NO_CLEAR which
@@ -1706,74 +1705,80 @@ It is important to note that some SB API calls assume the presence of a
17061705particular header type and will not work properly if the other header type
17071706is present instead. The following section provides more detail.
17081707
1709- ##### 6.5.2 Modifying Software Bus Message Header Information
1708+ ##### 6.5.2 Setting Message Header Information
17101709
1711- Before sending an SB Message to the SB, the Application can update the
1712- SB Message Header. The following table summarizes the functions that
1713- can be used to modify SB Message Header fields. Note that some of these
1710+ Before sending a Message to the SB, the Application can set fields in the
1711+ Message Header. The following table summarizes the functions that
1712+ can be used to modify Message Header fields. Note that some of these
17141713functions are only applicable to a specific header type. Additional
17151714information on modifying specific header types is provided in the following
17161715subsections.
17171716
1718- | ** SB Message Header Field** | ** SB API for Modifying the Header Field** | ** Applicability** |
1719- | ---------------------------:| -----------------------------------------:| -------------------:|
1720- | Message ID | CFE_SB_SetMsgId | Command & Telemetry |
1721- | Total Message Length | CFE_SB_SetTotalMsgLength | Command & Telemetry |
1722- | User Data Message Length | CFE_SB_SetUserDataLength | Command & Telemetry |
1723- | Command Code | CFE_SB_SetCmdCode | Command Only |
1724- | Checksum | CFE_SB_GenerateChecksum | Command Only |
1725- | Time | CFE_SB_TimeStampMsg | Telemetry Only |
1726- | Time | CFE_SB_SetMsgTime | Telemetry Only |
1727-
1728- Applications shall always use these functions to manipulate the SB
1729- Message Header. The structure of the SB Message Header may change from
1717+ | ** SB Message Header Field** | ** API for Modifying the Header Field** | ** Applicability** |
1718+ | ---------------------------:| --------------------------------------:| -------------------:|
1719+ | Message ID | CFE_MSG_SetMsgId | Command & Telemetry |
1720+ | Total Message Length | CFE_MSG_SetSize | Command & Telemetry |
1721+ | Command Code | CFE_MSG_SetFcnCode | Command Only |
1722+ | Checksum | CFE_MSG_GenerateChecksum | Command Only |
1723+ | Time | CFE_SB_TimeStampMsg | Telemetry Only |
1724+ | Time | CFE_MSG_SetMsgTime | Telemetry Only |
1725+
1726+ Applications shall always use these functions to manipulate the
1727+ Message Header. The structure of the Message Header may change from
17301728one deployment to the next. By using these functions, Applications are
1731- guaranteed to work regardless of the structure of the SB Message Header.
1729+ guaranteed to work regardless of the structure of the Message Header.
17321730
1733- ##### 6.5.2.1 Modifying SB Command Message Header Information
1731+ Although CFE_SB_SetUserDataLength APIs is available,
1732+ it is based on assumptions about the defintion of "User Data" and is
1733+ really just a best guess since the packet structure is dependent on implementation.
1734+ The preference is to use CFE_MSG_SetSize and actual packet structure
1735+ information when available.
1736+
1737+ ##### 6.5.2.1 Modifying Command Message Header Information
17341738The most common update for command messages is to set the command code.
1735- This is done through the CFE_SB_SetCmdCode () API call. This code is used
1739+ This is done through the CFE_MSG_SetFcnCode () API call. This code is used
17361740to distinguish between multiple commands that share a Message ID. It is
17371741common practice for an application to have a single "CMD_MID" to capture
17381742all commands and then to differentiate those commands using a command code.
17391743
1740- ##### 6.5.2.2 Modifying SB Telemetry Message Header Information
1744+ ##### 6.5.2.2 Modifying Telemetry Message Header Information
17411745The most common update for telemetry messages is to put the current time in
1742- the SB Message. This is accomplished with one of two SB API functions. The
1746+ the Message. This is accomplished with one of two API functions. The
17431747most commonly used function would be CFE_SB_TimeStampMsg(). This API would
17441748insert the current time, in the mission defined format with the mission
1745- defined epoch, into the SB Message Header. The other SB API that can modify
1746- the SB Message Header time is CFE_SB_SetMsgTime (). This API call sets the
1747- time in the SB Message Header to the time specified during the call. This is
1748- useful when the Application wishes to time tag a series of SB Messages with
1749+ defined epoch, into the Message Header. The other API that can modify
1750+ the Message Header time is CFE_MSG_SetMsgTime (). This API call sets the
1751+ time in the Message Header to the time specified during the call. This is
1752+ useful when the Application wishes to time tag a series of Messages with
17491753the same time.
17501754
1751- ##### 6.5.3 Reading Software Bus Message Header Information
1755+ ##### 6.5.3 Reading Message Header Information
17521756
1753- There are several SB APIs available for extracting the SB Message Header
1757+ There are several APIs available for extracting the Message Header
17541758Fields. These APIs shall always be used by Applications to ensure the
17551759Applications are portable to future missions. The following table
1756- identifies the fields of the SB Message Header and the appropriate API
1760+ identifies the fields of the Message Header and the appropriate API
17571761for extracting that field from the header:
17581762
1759- | ** SB Message Header Field** | ** SB API for Reading the Header Field** | ** Applicability** |
1760- | :----------------------------| :---------------------------------------- | :--------------------|
1761- | Message ID | CFE_SB_GetMsgId | Command & Telemetry |
1762- | Message Time | CFE_SB_GetMsgTime | Telemetry Only |
1763- | Total Message Length | CFE_SB_GetTotalMsgLength | Command & Telemetry |
1764- | User Data Message Length | CFE_SB_GetUserDataLength | Command & Telemetry |
1765- | Command Code | CFE_SB_GetCmdCode | Command Only |
1766- | Checksum | CFE_SB_GetChecksum | Command Only |
1767-
1768- In addition to the function for reading the checksum field, there is
1769- another API that automatically calculates the checksum for the packet
1763+ | ** SB Message Header Field** | ** API for Reading the Header Field** | ** Applicability** |
1764+ | :----------------------------| :-------------------------------------| :--------------------|
1765+ | Message ID | CFE_MSG_GetMsgId | Command & Telemetry |
1766+ | Message Time | CFE_MSG_GetTime | Imp. Dependent |
1767+ | Total Message Length | CFE_MSG_GetSize | Command & Telemetry |
1768+ | Command Code | CFE_MSG_GetFcnCode | Command Only |
1769+
1770+ There are other APIs based on selected implementation. The full list is
1771+ available in the user's guide.
1772+
1773+ There is another API that automatically calculates the checksum for the packet
17701774and compares it to the checksum in the header. The API is called
1771- CFE_SB_ValidateChecksum () and it simply returns a success or failure
1775+ CFE_MSG_ValidateChecksum () and it simply returns a success or failure
17721776indication.
17731777
1774- If the Application's data structure definitions don't include the header
1775- information, then the CFE_SB_GetUserData API could be used to obtain
1776- the start address of the SB Message data.
1778+ Although CFE_SB_GetUserDataLength and CFE_SB_GetUserData APIs are available,
1779+ they are based on assumptions about the defintion of "User Data" and are
1780+ really just a best guess since the packet structure is dependent on implementation.
1781+ The preference is to use the actual packet structure when available.
17771782
17781783#### 6.6 Sending Software Bus Messages
17791784
@@ -1799,8 +1804,8 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
17991804 /*
18001805 ** Send housekeeping SB Message after time tagging it with current time
18011806 */
1802- CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &SAMPLE_AppData.HkPacket);
1803- CFE_SB_SendMsg((CFE_SB_Msg_t *) &SAMPLE_AppData.HkPacket);
1807+ CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &SAMPLE_AppData.HkPacket);
1808+ CFE_SB_SendMsg((CFE_MSG_Message_t *) &SAMPLE_AppData.HkPacket);
18041809 ...
18051810}
18061811```
@@ -1816,8 +1821,8 @@ FILE: sample_app.h
18161821typedef struct
18171822{
18181823 ...
1819- CFE_SB_MsgPtr_t MsgPtr;
1820- CFE_SB_PipeId_t CmdPipe;
1824+ CFE_MSG_Message_t * MsgPtr;
1825+ CFE_SB_PipeId_t CmdPipe;
18211826 ...
18221827} SAMPLE_AppData_t;
18231828```
@@ -1945,10 +1950,9 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
19451950 ** Get a SB Message block of memory and initialize it
19461951 */
19471952 SAMPLE_AppData.BigPktPtr = (SAMPLE_BigPkt_t *)CFE_SB_ZeroCopyGetPtr(SAMPLE_BIGPKT_MSGLEN);
1948- CFE_SB_InitMsg((CFE_SB_Msg_t *) SAMPLE_AppData.BigPktPtr,
1949- SAMPLE_BIG_TLM_MID,
1950- SAMPLE_BIGPKT_MSGLEN,
1951- CFE_SB_CLEAR_DATA);
1953+ CFE_MSG_Init((CFE_MSG_Message_t *) SAMPLE_AppData.BigPktPtr,
1954+ SAMPLE_BIG_TLM_MID,
1955+ SAMPLE_BIGPKT_MSGLEN);
19521956
19531957 /*
19541958 ** ...Fill Packet with Data...
@@ -1957,8 +1961,8 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
19571961 /*
19581962 ** Send SB Message after time tagging it with current time
19591963 */
1960- CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) SAMPLE_AppData.BigPktPtr);
1961- CFE_SB_ZeroCopySend((CFE_SB_Msg_t *) SAMPLE_AppData.BigPktPtr);
1964+ CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) SAMPLE_AppData.BigPktPtr);
1965+ CFE_SB_ZeroCopySend((CFE_MSG_Message_t *) SAMPLE_AppData.BigPktPtr);
19621966 /* SAMPLE_AppData.BigPktPtr is no longer a valid pointer */
19631967 ...
19641968}
0 commit comments