Skip to content

Commit 47d8d97

Browse files
committed
Merge pull request #2013 from Nodraak/patch-3
Fix #2016, cFE Application Developers Guide.md: specify language for improved code highlighting
2 parents efa4640 + 3a122b6 commit 47d8d97

File tree

1 file changed

+51
-48
lines changed

1 file changed

+51
-48
lines changed

docs/cFE Application Developers Guide.md

Lines changed: 51 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ headers, while files listed in the second table (without suffix) should be used
501501

502502
Finally, to simplify application headers, a single "all-inclusive" cFE header is also provided:
503503

504-
```
504+
```c
505505
#include "cfe.h" /* Define cFE API prototypes and data types */
506506
```
507507

@@ -779,7 +779,7 @@ clock tick. This can also be used to calculate the appropriate number of
779779
system clock ticks for a specific delta time. An example can be seen
780780
below:
781781

782-
```
782+
```c
783783
uint32 ConvertSecs2Ticks(uint32 Seconds)
784784
{
785785
uint32 NumOfTicks,TickDurationInMicroSec;
@@ -839,20 +839,20 @@ success, the OS_BinSemCreate function sets the sem_id parameter to the ID of
839839
the newly-created resource. This ID is used in all other functions that use
840840
the binary semaphore.
841841
842-
```
842+
```c
843843
int32 OS_BinSemCreate(uint32 *xxx_SEM_ID, const char *xxx_SEM_NAME,
844844
uint32 sem_initial_value, uint32 options);
845845
```
846846

847847
There are two options for pending on a binary semaphore:
848848

849-
```
849+
```c
850850
int32 OS_BinSemTake( uint32 xxx_SEM_ID );
851851
```
852852
853853
which waits indefinitely for a semaphore to become available, and
854854
855-
```
855+
```c
856856
int32 OS_BinSemTimedWait( uint32 xxx_SEM_ID , uint32 timeout_in_milliseconds );
857857
```
858858

@@ -861,7 +861,7 @@ has not become available.
861861

862862
A binary semaphore is given by using this function:
863863

864-
```
864+
```c
865865
int32 OS_BinSemGive( uint32 xxx_SEM_ID );
866866
```
867867
@@ -886,25 +886,26 @@ Upon success, the OS_CountSemCreate function sets the sem_id parameter to the
886886
ID of the newly-created resource. This ID is used in all other functions that
887887
use the binary semaphore.
888888
889-
```
889+
```c
890890
int32 OS_CountSemCreate(uint32 *xxx_SEM_ID, const char *xxx_SEM_NAME,
891891
uint32 sem_initial_value, uint32 options);
892892
```
893893

894894
There are two options for pending on a counting semaphore:
895895

896-
```
896+
```c
897897
int32 OS_CountSemTake( uint32 xxx_SEM_ID );
898898
```
899899
900900
which waits indefinitely for a semaphore to become available, and
901901
902-
```
902+
```c
903903
int32 OS_CountSemTimedWait( uint32 xxx_SEM_ID , uint32 timeout_in_milliseconds );
904904
```
905+
905906
A counting semaphore is given by using this function:
906907

907-
```
908+
```c
908909
int32 OS_CountSemGive( uint32 xxx_SEM_ID );
909910
```
910911
@@ -940,7 +941,7 @@ being done in the protected region. The Take and Give functions should
940941
have the same level of indentation, and there should be exactly one
941942
entry point and one exit point to the protected region.
942943
943-
```
944+
```c
944945
int32 OS_MutSemTake( uint32 xxx_MUT_ID );
945946
946947
/* protected region */
@@ -965,25 +966,25 @@ of the entire system.
965966

966967
An application creates a mutex by calling:
967968

968-
```
969+
```c
969970
int32 OS_MutSemCreate (uint32 *sem_id, const char *sem_name, uint32 options);
970971
```
971972
972973
and deletes it by calling:
973974
974-
```
975+
```c
975976
int32 OS_MutSemDelete (uint32 sem_id);
976977
```
977978

978979
An application takes a mutex by calling:
979980

980-
```
981+
```c
981982
int32 OS_MutSemTake( uint32 xxx_MUT_ID );
982983
```
983984
984985
and gives it by calling:
985986
986-
```
987+
```c
987988
int32 OS_MutSemGive( uint32 xxx_MUT_ID );
988989
```
989990

@@ -1009,22 +1010,22 @@ Similar to interrupt service routines, handlers can be associated with
10091010
specific exceptions. The following function specifies a handler for an
10101011
exception:
10111012

1012-
```
1013+
```c
10131014
OS_ExcAttachHandler( uint32 ExceptionNumber, void *ExceptionHandler, int32 Param );
10141015
```
10151016
10161017
The ExceptionHandler is a function that will be called when the
10171018
exception is detected and should have a prototype that looks like the
10181019
following:
10191020
1020-
```
1021+
```c
10211022
void ExceptionHandler( int32 Param );
10221023
```
10231024

10241025
There are addition functions for enabling/masking and
10251026
disabling/unmasking specific exceptions. These are as follows:
10261027

1027-
```
1028+
```c
10281029
OS_ExcEnable( uint32 ExceptionNumber );
10291030
OS_ExcDisable( uint32 ExceptionNumber );
10301031
```
@@ -1035,22 +1036,22 @@ In addition to the exception handlers identified above, a similar
10351036
paradigm exists for handling floating point processor exceptions. The
10361037
following function specifies a handler for an FPU exception:
10371038
1038-
```
1039+
```c
10391040
OS_FPUExcAttachHandler( uint32 ExceptionNumber, void *ExceptionHandler, int32 Param );
10401041
```
10411042

10421043
The ExceptionHandler is a function that will be called when the
10431044
exception is detected and should have a prototype that looks like the
10441045
following:
10451046

1046-
```
1047+
```c
10471048
void ExceptionHandler( int32 Param );
10481049
```
10491050
10501051
There are addition functions for enabling/masking and
10511052
disabling/unmasking specific exceptions. These are as follows:
10521053
1053-
```
1054+
```c
10541055
OS_FPUExcEnable( uint32 ExceptionNumber );
10551056
OS_FPUExcDisable( uint32 ExceptionNumber );
10561057
```
@@ -1367,7 +1368,7 @@ significant Event that cannot be recorded using the CFE_EVS_SendEvent
13671368
function, then the Developer can use the CFE_ES_WriteToSysLog
13681369
function. This function has the following prototype:
13691370
1370-
```
1371+
```c
13711372
int32 CFE_ES_WriteToSysLog(const char *pSpecString, ...);
13721373
```
13731374

@@ -2313,7 +2314,7 @@ used to uniquely identify an application event. The Event ID is defined
23132314
and supplied to the EVS by the application requesting services. The
23142315
hexadecimal bit mask represents the filtering frequency for the event.
23152316

2316-
```
2317+
```c
23172318
typedef struct
23182319
{
23192320
uint16 EventID,
@@ -2342,7 +2343,7 @@ section 7.4) regardless of whether the message was sent.
23422343
An example of an Application registering with Event Services and
23432344
specifying its binary filters is shown below:
23442345

2345-
```
2346+
```c
23462347
FILE: sample_app.h
23472348

23482349
...
@@ -2415,7 +2416,7 @@ reset the filter counter for a specified Event ID. The latter function
24152416
resets all event filter counters for the Application. An example of
24162417
resetting a specific Event ID filter counter is shown below:
24172418

2418-
```
2419+
```c
24192420
FILE: sample_app.c
24202421

24212422
{
@@ -2434,7 +2435,7 @@ or the CFE_EVS_SendTimedEvent() function, which are both analogous to
24342435
the C printf() function in how strings are formatted. An example of each
24352436
function call is shown below:
24362437

2437-
```
2438+
```c
24382439
CFE_EVS_SendEvent(EventID, EventType, "Unknown stream on cmd pipe:
24392440
0x%04X", sid);
24402441
```
@@ -2451,7 +2452,7 @@ sent.
24512452
The other function that can be called to send an event message is shown
24522453
below:
24532454
2454-
```
2455+
```c
24552456
CFE_EVS_SendTimedEvent(PktTime, EventID, EventType, "CSS Data Bad:
24562457
0x%04X", CssData);
24572458
```
@@ -2644,7 +2645,7 @@ it should use the CFE_TBL_Share API instead. The CFE_TBL_Share API will locate
26442645
the specified Table by name and return a Table Handle to the calling
26452646
Application. An example of Table sharing is shown below:
26462647

2647-
```
2648+
```c
26482649
FILE: SAMPLE_app.c
26492650

26502651
CFE_TBL_Handle_t MyTableHandle; /* Handle to MyTable */
@@ -2679,7 +2680,7 @@ Application can obtain a pointer to the start of the data within the
26792680
Table using the CFE_TBL_GetAddress or CFE_TBL_GetAddresses APIs. An example
26802681
of this is shown in Section 8.5.1.
26812682

2682-
```
2683+
```c
26832684
{
26842685
int32 Status = CFE_SUCCESS;
26852686
SAMPLE_MyTable_t *MyTblPtr;
@@ -2772,7 +2773,7 @@ assigning and creating a validation function is a fairly simple process.
27722773
To use the function, the Application should periodically identify when a
27732774
Table Validation Request has been made as shown below:
27742775

2775-
```
2776+
```c
27762777
{
27772778
int32 Status = CFE_SUCCESS;
27782779
boolean FinishedManaging = FALSE;
@@ -2821,7 +2822,7 @@ the Table with default values or when the Application is changing modes
28212822
and wishes to use a different parameter set. An example of this can be
28222823
seen below:
28232824

2824-
```
2825+
```c
28252826
FILE: sample_app.c
28262827

28272828
CFE_TBL_Handle_t MyTableHandle /* Handle to MyTable */
@@ -2847,7 +2848,7 @@ SAMPLE_MyTable_t MyTblInitData = { 0x1234, 0x5678, { 2, 3, 4, ... }, ...};
28472848
If a developer wishes to load the table from a file rather than from a
28482849
memory image, the code would look something like the following:
28492850
2850-
```
2851+
```c
28512852
{
28522853
int32 Status;
28532854
@@ -2898,6 +2899,7 @@ A typical layout of table-related files within an application (xx) is shown
28982899
below. Note that this does not show all of an application's files, just those
28992900
related to tables.
29002901

2902+
```
29012903
xx
29022904
|----fsw
29032905
|----src
@@ -2910,27 +2912,28 @@ xx
29102912
|
29112913
|----platform_inc
29122914
|----xx_platform_cfg.h
2915+
```
29132916

2914-
The xx_app.h file is included in this layout only because table handles are
2915-
typically stored in an application's AppData_t structure.
2917+
The `xx_app.h` file is included in this layout only because table handles are
2918+
typically stored in an application's `AppData_t` structure.
29162919

2917-
The file xx_tbldefs.h (sometimes just named xx_tbl.h) typically contains the
2920+
The file `xx_tbldefs.h` (sometimes just named `xx_tbl.h`) typically contains the
29182921
structure definition of a single table entry. This file is included in the
2919-
xx_table1.c file where the table itself is defined. It may also contain
2922+
`xx_table1.c` file where the table itself is defined. It may also contain
29202923
declarations for table-related utility functions.
29212924

2922-
The xx_tbl.c file typically contains table-related utility functions. For
2925+
The `xx_tbl.c` file typically contains table-related utility functions. For
29232926
instance, many applications define table initialization and validation functions
29242927
in this file.
29252928

2926-
The xx_table1.c file is the source code for a table itself.
2929+
The `xx_table1.c` file is the source code for a table itself.
29272930

2928-
The xx_platform_cfg.h file contains configuration parameters for applications,
2931+
The `xx_platform_cfg.h` file contains configuration parameters for applications,
29292932
and there are typically several configuration parameters associated with tables.
29302933

29312934
### 8.5.1 Table Files Example
29322935

2933-
```
2936+
```c
29342937
FILE: xx_app.h
29352938

29362939
...
@@ -2945,7 +2948,7 @@ XX_AppData_t XX_AppData;
29452948
...
29462949
```
29472950

2948-
```
2951+
```c
29492952
FILE: xx_tbldefs.h
29502953

29512954
...
@@ -2968,7 +2971,7 @@ int32 XX_ValidateTable(void *TableData);
29682971
...
29692972
```
29702973
2971-
```
2974+
```c
29722975
FILE: xx_tbl.c
29732976
29742977
#include xx_tbldefs.h
@@ -3028,7 +3031,7 @@ int32 XX_ValidateTable(void *TableData)
30283031
}
30293032
```
30303033

3031-
```
3034+
```c
30323035
FILE: xx_table1.c
30333036

30343037
#include "cfe.h"
@@ -3054,7 +3057,7 @@ XX_MyTable_t XX_MyTable =
30543057
};
30553058
```
30563059
3057-
```
3060+
```c
30583061
FILE: xx_platform_cfg.h
30593062
30603063
#define XX_APP_NAME "XX"
@@ -3071,7 +3074,7 @@ In order to build application tables with the CMake build system, the
30713074
application is structured with a "Tables" directory, another
30723075
"aux_source_directory" may need to be added as well.
30733076

3074-
```
3077+
```cmake
30753078
aux_source_directory(fsw/tables APP_TABLE_FILES)
30763079
30773080
# Create the app module
@@ -3106,7 +3109,7 @@ standard file header.
31063109

31073110
The structure of the standard file header is as follows:
31083111

3109-
```
3112+
```c
31103113
typedef struct
31113114
{
31123115
uint32 ContentType; /* Identifies the content type (magic #=’cFE1’) */
@@ -3215,7 +3218,7 @@ integer represents the number of seconds and the second integer
32153218
represents the number of `2^-32` seconds. The data structure for this
32163219
representation of time is as follows:
32173220

3218-
```
3221+
```c
32193222
typedef struct {
32203223
uint32 Seconds; /* Number of seconds */
32213224
uint32 Subseconds; /* Number of 2^(-32) subseconds */
@@ -3420,7 +3423,7 @@ the first time in the subtraction. Otherwise, as shown above, the delta
34203423
time between two absolute times could either be 5 hours or 7 hours. An
34213424
example of a delta time computation function is shown below:
34223425

3423-
```
3426+
```c
34243427
CFE_TIME_SysTime_t ComputeDeltaTime(CFE_TIME_SysTime_t TimeA,
34253428
CFE_TIME_SysTime_t TimeB)
34263429
{

0 commit comments

Comments
 (0)