Skip to content

Commit eed424d

Browse files
committed
NASA Docket No. GSC-19,200-1, and identified as "cFS Draco"
Batch update of latest cFS software release
1 parent 3bcb137 commit eed424d

File tree

160 files changed

+7283
-591
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+7283
-591
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
11
build
22
Makefile
3+
4+
# Ignore macOS generated files types
5+
.DS_Store
6+
.DS_Store?
7+
._*
8+
.Spotlight-V100
9+
.Trashes
10+
ehthumbs.db
11+
Thumbs.db
12+
.fuse_hidden*
13+

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
# OSAL resources.
8989
#
9090
######################################################################
91-
cmake_minimum_required(VERSION 3.5)
91+
cmake_minimum_required(VERSION 3.10)
9292

9393
# Set the policy dictating use of target_link_libraries across directories
9494
# Either OLD or NEW should work here but setting it to something avoids a
@@ -355,6 +355,7 @@ set(OSAL_SRCLIST
355355
src/os/shared/src/osapi-network.c
356356
src/os/shared/src/osapi-printf.c
357357
src/os/shared/src/osapi-queue.c
358+
src/os/shared/src/osapi-rwlock.c
358359
src/os/shared/src/osapi-select.c
359360
src/os/shared/src/osapi-shell.c
360361
src/os/shared/src/osapi-sockets.c
@@ -370,7 +371,6 @@ if (OSAL_CONFIG_DEBUG_PRINTF)
370371
)
371372
endif (OSAL_CONFIG_DEBUG_PRINTF)
372373

373-
374374
# Define the external "osal" static library target
375375
# This is a combination of the generic parts with the low level
376376
# system-specific parts
@@ -419,7 +419,7 @@ if (ENABLE_UNIT_TESTS)
419419
target_link_libraries(${TGTNAME} PUBLIC ut_assert osal)
420420
add_test(${TGTNAME} ${TGTNAME})
421421
foreach(TGT ${INSTALL_TARGET_LIST})
422-
install(TARGETS ${TGTNAME} DESTINATION ${TGT}/${UT_INSTALL_SUBDIR})
422+
install(TARGETS ${TGTNAME} DESTINATION ${TGT})
423423
endforeach()
424424

425425
endfunction(add_osal_ut_exe)

default_config.cmake

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,33 @@ set(OSAL_CONFIG_CONSOLE_ASYNC TRUE
206206
CACHE BOOL "Controls spawning of a separate utility task for OS_printf"
207207
)
208208

209+
#
210+
# OS_CONFIG_RWLOCK
211+
# ----------------------------------
212+
#
213+
# Controls whether the readers-writer lock object is included in the compilation
214+
# process of the OSAL.
215+
#
216+
# If set FALSE, the relevant source and header files will be excluded in the compilation
217+
# of OSAL, such that the object is still registered with the Object ID system
218+
# but its associated functions won't be defined or declared.
219+
#
220+
# If set TRUE, the relevant source and header files will be included in the compilation
221+
# of OSAL, and all it's associated functions will be callable.
222+
#
223+
# When this is TRUE (default), it gives the ability to create a readers-writer lock as
224+
# an alternative to synchronization with mutexes for data structures that are read-heavy.
225+
# It allows for either an infinite number of readers to be accessing a data structure or
226+
# a single writer.
227+
#
228+
# This option is available since some platforms may not support readers-writer locks, so
229+
# any use of a readers-writer lock should also create an implementation using solely
230+
# mutexes.
231+
#
232+
set(OSAL_CONFIG_RWLOCK TRUE
233+
CACHE BOOL "Controls the inclusion of readers-writer lock objects in the code"
234+
)
235+
209236
#############################################
210237
# Resource Limits for the OS API
211238
#############################################
@@ -238,6 +265,11 @@ set(OSAL_CONFIG_MAX_MUTEXES 20
238265
CACHE STRING "Maximum Number of Mutexes to support"
239266
)
240267

268+
# The maximum number of rwlocks to support
269+
set(OSAL_CONFIG_MAX_RWLOCKS 20
270+
CACHE STRING "Maximum Number of RwLocks to support"
271+
)
272+
241273
# The maximum number of condition variables to support
242274
set(OSAL_CONFIG_MAX_CONDVARS 4
243275
CACHE STRING "Maximum Number of Condition Variables to support"

docs/src/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
# in a standalone build environment.
2929
#
3030

31-
cmake_minimum_required(VERSION 3.5)
3231
project(OSAL_DOCS NONE)
3332

3433
# List of dox files to include -

osconfig.h.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@
7171
*/
7272
#define OS_MAX_MUTEXES @OSAL_CONFIG_MAX_MUTEXES@
7373

74+
/**
75+
* \brief The maximum number of rwlocks to support
76+
*
77+
* Based on the OSAL_CONFIG_MAX_RWLOCKS configuration option
78+
*/
79+
#define OS_MAX_RWLOCKS @OSAL_CONFIG_MAX_RWLOCKS@
80+
7481
/**
7582
* \brief The maximum number of condition variables to support
7683
*

src/bsp/generic-qnx/CMakeLists.txt

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
######################################################################
2+
#
3+
# CMAKE build recipe for QNX Board Support Package (BSP)
4+
#
5+
######################################################################
6+
7+
# This basic implementation library should be generic enough to use
8+
# on any QNX based processor board.
9+
add_library(osal_generic-qnx_impl OBJECT
10+
src/bsp_start.c
11+
src/bsp_console.c
12+
)
13+
14+
# OSAL needs conformance to at least POSIX.1c (aka POSIX 1995) - this includes all the
15+
# real-time support and threading extensions.
16+
#
17+
# When compiling against glibc, using "_XOPEN_SOURCE=600" enables the X/Open 6 standard.
18+
# XPG6 includes all necessary XPG5, POSIX.1c features as well as SUSv2/UNIX98 extensions.
19+
# This OSAL implementation uses clock_nanosleep(), mq_timedreceive(), and
20+
# mq_timedsend() which are enhancements added in the XPG6 standard.
21+
#
22+
# See http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
23+
# for a more detailed description of the feature test macros and available values
24+
target_compile_definitions(osal_public_api INTERFACE
25+
_XOPEN_SOURCE=600
26+
)
27+
28+
# QNX system libraries required for the final link of applications using OSAL
29+
if (QNX_SDP_VERSION EQUAL 800)
30+
target_link_libraries(osal_public_api INTERFACE
31+
socket unwind unwind-nto unwind-generic
32+
)
33+
elseif (QNX_SDP_VERSION EQUAL 710)
34+
target_link_libraries(osal_public_api INTERFACE
35+
socket backtrace
36+
)
37+
endif()
38+
39+
# This BSP only works with "qnx" OS layer.
40+
# Confirming this reduces risk of accidental misconfiguration
41+
set_property(TARGET osal_generic-qnx_impl PROPERTY OSAL_EXPECTED_OSTYPE "qnx")
42+
43+
# Configure the ut_coverage_compile and ut_coverage_link for enabling coverage
44+
# testing on this platform.
45+
if (NOT CMAKE_CROSSCOMPILING AND ENABLE_UNIT_TESTS)
46+
# Support for other compilers/coverage tools could be added here.
47+
# for now only the GNU "gcov" will be enabled
48+
if (CMAKE_C_COMPILER_ID STREQUAL GNU)
49+
target_compile_options(ut_coverage_compile INTERFACE -pg -ftest-coverage -fprofile-arcs)
50+
target_link_libraries(ut_coverage_link INTERFACE gcov)
51+
endif()
52+
endif()
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
##########################################################################
2+
#
3+
# Build options for "generic-qnx" BSP
4+
#
5+
##########################################################################
6+
7+
# C flags that should be used when (re-) compiling code for unit testing.
8+
# Note: --coverage is just a shortcut for "-ftest-coverage" and "-fprofile-arcs"
9+
# This also does not work well when cross compiling since paths to the _compile_ dir
10+
# are baked into the executables, so they will not be there when copied to the target
11+
# Note - although GCC understands the same flags for compile and link here, this may
12+
# not be true on all platforms so the compile and link flags are specified separately.
13+
if (NOT CMAKE_CROSSCOMPILING AND NOT OSAL_OMIT_DEPRECATED)
14+
# The variables here (UT_COVERAGE_COMPILE_FLAGS/LINK_FLAGS) should be phased out, prefer
15+
# to use the interface libraries (ut_coverage_compile/link) instead, which are more flexible.
16+
set(UT_COVERAGE_COMPILE_FLAGS -pg --coverage)
17+
set(UT_COVERAGE_LINK_FLAGS -pg --coverage)
18+
endif()
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
/************************************************************************
2+
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
3+
*
4+
* Copyright (c) 2020 United States Government as represented by the
5+
* Administrator of the National Aeronautics and Space Administration.
6+
* All Rights Reserved.
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
9+
* not use this file except in compliance with the License. You may obtain
10+
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
************************************************************************/
18+
19+
/*
20+
* File: bsp_console.c
21+
*
22+
* Purpose:
23+
* OSAL BSP debug console abstraction
24+
*/
25+
26+
#include <stdio.h>
27+
#include <stdlib.h>
28+
#include <string.h>
29+
#include <unistd.h>
30+
#include <sys/types.h>
31+
#include <sys/wait.h>
32+
33+
#include "generic_qnx_bsp_internal.h"
34+
#include "bsp-impl.h"
35+
36+
/*----------------------------------------------------------------
37+
OS_BSP_ExecTput()
38+
39+
Helper function: Use the system "tput" utility to set the given
40+
console capability.
41+
42+
This uses a fork/exec to invoke the external command which outputs
43+
the control sequence directly to the controlling terminal.
44+
45+
It is assumed that this will only be used during debug/testing.
46+
Otherwise it would be preferable to cache the control strings to
47+
avoid repetitive fork/exec operations.
48+
------------------------------------------------------------------*/
49+
static void OS_BSP_ExecTput(const char *cap, const char *param)
50+
{
51+
pid_t cpid;
52+
int status;
53+
54+
cpid = fork();
55+
if (cpid < 0)
56+
{
57+
return;
58+
}
59+
if (cpid == 0)
60+
{
61+
execlp("tput", "tput", cap, param, NULL);
62+
exit(EXIT_FAILURE);
63+
}
64+
waitpid(cpid, &status, 0);
65+
}
66+
67+
/****************************************************************************************
68+
BSP CONSOLE IMPLEMENTATION FUNCTIONS
69+
****************************************************************************************/
70+
71+
/*----------------------------------------------------------------
72+
OS_BSP_ConsoleOutput_Impl
73+
See full description in header
74+
------------------------------------------------------------------*/
75+
void OS_BSP_ConsoleOutput_Impl(const char *Str, size_t DataLen)
76+
{
77+
ssize_t WriteLen;
78+
79+
while (DataLen > 0)
80+
{
81+
/* writes the raw data directly to STDOUT_FILENO (unbuffered) */
82+
WriteLen = write(STDOUT_FILENO, Str, DataLen);
83+
if (WriteLen <= 0)
84+
{
85+
/* no recourse if this fails, just stop. */
86+
break;
87+
}
88+
Str += WriteLen;
89+
DataLen -= WriteLen;
90+
}
91+
}
92+
93+
/*----------------------------------------------------------------
94+
OS_BSP_ConsoleSetMode_Impl() definition
95+
See full description in header
96+
------------------------------------------------------------------*/
97+
void OS_BSP_ConsoleSetMode_Impl(uint32 ModeBits)
98+
{
99+
char param[32];
100+
101+
if (OS_BSP_GenericQnxGlobal.EnableTermControl)
102+
{
103+
if (ModeBits == OS_BSP_CONSOLEMODE_NORMAL)
104+
{
105+
OS_BSP_ExecTput("sgr0", NULL);
106+
}
107+
else
108+
{
109+
if ((ModeBits & OS_BSP_CONSOLEMODE_HIGHLIGHT) == 0)
110+
{
111+
/* no highlight (standout) text */
112+
OS_BSP_ExecTput("rmso", NULL);
113+
}
114+
else
115+
{
116+
/* set highlight (standout) text */
117+
OS_BSP_ExecTput("smso", NULL);
118+
}
119+
120+
snprintf(param, sizeof(param), "%d", OS_BSP_CONSOLEMODE_TO_ANSICOLOR(ModeBits));
121+
OS_BSP_ExecTput("setaf", param);
122+
}
123+
}
124+
}

0 commit comments

Comments
 (0)