Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osal Integration candidate: Caelum-rc4+dev26 #1314

Merged
merged 11 commits into from
Oct 17, 2022
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Development Build: v6.0.0-rc4:dev143
- locks for condvar objects on rtems/vxworks
- Add time conversion reciprocal functions
- add export targets and package script
- Stop empty function catching CI workflow format checks
- Remove redundant/inconsistent comments (/* end of function */, /* end if */ etc.) and clean up empty lines.
- See <https://github.com/nasa/osal/pull/1311>, <https://github.com/nasa/osal/pull/1310>, <https://github.com/nasa/osal/pull/1313>, <https://github.com/nasa/osal/pull/1306>, and <https://github.com/nasa/osal/pull/1309>

## Development Build: v6.0.0-rc4+dev131
- rtems queue multi-size, mimic posix logic
- cmake script modernization
Expand Down
58 changes: 57 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@
# Normally this setting is not needed to be configured as it is
# inferred from the BSP type.
#
# OSAL_INSTALL_LIBRARIES : Boolean, enables "install" of targets listed above such
# that libraries and public API header files are copied into the system
# location specified by CMAKE_INSTALL_PREFIX. This set of headers
# and link libraries can then be used to compile other applications
# separately from OSAL. Default is "ON" when OSAL is being compiled
# standalone (i.e. cmake called directly on the OSAL source dir).
# Default is "OFF" when OSAL is included via 'add_subdirectory' in
# a parent application project such as CFE/CFS.
#
# ENABLE_UNIT_TESTS : Boolean, enables build of the unit tests (coverage and functional)
#
# OSAL_OMIT_DEPRECATED : Boolean, Compile without deprecated or obsolete features for
Expand Down Expand Up @@ -99,8 +108,24 @@ define_property(TARGET PROPERTY OSAL_EXPECTED_OSTYPE
"This property is used to indicate the OS implementation layer that is intended to be paired with the BSP implementation"
)

# If this build is being performed as a subdirectory within a larger project,
# then the static libraries and header files will _not_ be installed by default,
# as in those cases one would typically just use the "osal" target directly.
# This behavior can be explicitly controlled via the OSAL_INSTALL_LIBRARIES option.
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
if (HAS_PARENT)
set(OSAL_DEFAULT_INSTALL_LIBRARIES OFF)
else()
set(OSAL_DEFAULT_INSTALL_LIBRARIES ON)
endif()

option(OSAL_INSTALL_LIBRARIES "Whether or not to install static libraries and headers" ${OSAL_DEFAULT_INSTALL_LIBRARIES})
option(OSAL_OMIT_DEPRECATED "Compile without deprecated or obsolete features for backward compatibility testing" OFF)

if (OSAL_INSTALL_LIBRARIES)
include(CMakePackageConfigHelpers)
endif()

# The "OSAL_EXT_SOURCE_DIR" cache variable may be set to a path
# on the host containing extra OS/BSP implementations which are not
# part of the open source release.
Expand Down Expand Up @@ -406,7 +431,6 @@ endif (ENABLE_UNIT_TESTS)
# If this build is being performed as a subdirectory within a larger project,
# then export the important data regarding compile flags/dirs to that parent
# This is conditional to avoid warnings in a standalone build.
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
if (HAS_PARENT)
# Export the UT coverage compiler/linker flags to the parent build.
# These flags are based on the target system type and should be used
Expand All @@ -420,3 +444,35 @@ else(HAS_PARENT)
# Note that in a CFE/integrated build, it is expected this will be built separately.
add_subdirectory(docs/src docs)
endif(HAS_PARENT)

if (OSAL_INSTALL_LIBRARIES)

# Install and also export this library, so it can be found via
# "find_package()" from some other CMake build
install(
TARGETS osal_public_api osal_bsp osal
EXPORT nasa-osal-export
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include/osal
INCLUDES DESTINATION include/osal
)
install(DIRECTORY
${OSAL_SOURCE_DIR}/src/os/inc/
${CMAKE_CURRENT_BINARY_DIR}/inc/
DESTINATION include/osal
)
install(EXPORT nasa-osal-export
FILE NasaOsalTargets.cmake
DESTINATION lib/cmake
)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/NasaOsalConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/NasaOsalConfig.cmake"
INSTALL_DESTINATION lib/cmake
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/NasaOsalConfig.cmake"
DESTINATION lib/cmake
)

endif()
6 changes: 6 additions & 0 deletions NasaOsalConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/NasaOsalTargets.cmake")

check_required_components(NasaOsal)

1 change: 0 additions & 1 deletion src/bsp/generic-linux/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ void OS_BSP_Shutdown_Impl(void)
}

/******************************************************************************
** Function: main()
**
** Purpose:
** BSP Application entry point.
Expand Down
1 change: 0 additions & 1 deletion src/bsp/generic-vxworks/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ void OS_BSP_Shutdown_Impl(void)
}

/******************************************************************************
** Function: OS_BSPMain()
**
** Purpose:
** vxWorks/BSP Application entry point.
Expand Down
1 change: 0 additions & 1 deletion src/bsp/generic-vxworks/src/generic_vxworks_bsp_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ typedef struct
{
SEM_ID AccessMutex;
VX_MUTEX_SEMAPHORE(AccessMutexMem);

} OS_BSP_GenericVxWorksGlobalData_t;

/*
Expand Down
6 changes: 0 additions & 6 deletions src/bsp/shared/inc/bsp-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ typedef struct
* feature.
*/
uint32 ResoureConfig[OS_OBJECT_TYPE_USER];

} OS_BSP_GlobalData_t;

/*
Expand All @@ -116,7 +115,6 @@ extern OS_BSP_GlobalData_t OS_BSP_Global;
/********************************************************************/

/*----------------------------------------------------------------
Function: OS_BSP_Lock_Impl

Purpose: Get exclusive access to a BSP-provided service or object

Expand All @@ -127,7 +125,6 @@ extern OS_BSP_GlobalData_t OS_BSP_Global;
void OS_BSP_Lock_Impl(void);

/*----------------------------------------------------------------
Function: OS_BSP_Unlock_Impl

Purpose: Release exclusive access to a BSP-provided service or object

Expand All @@ -138,7 +135,6 @@ void OS_BSP_Lock_Impl(void);
void OS_BSP_Unlock_Impl(void);

/*----------------------------------------------------------------
Function: OS_BSP_ConsoleOutput_Impl

Purpose: Low level raw console data output. Writes a sequence of
characters directly to the BSP debug terminal or console device.
Expand All @@ -153,7 +149,6 @@ void OS_BSP_Unlock_Impl(void);
void OS_BSP_ConsoleOutput_Impl(const char *Str, size_t DataLen);

/*----------------------------------------------------------------
Function: OS_BSP_ConsoleSetMode_Impl

Purpose: Set the console output mode, if supported by the BSP.

Expand All @@ -171,7 +166,6 @@ void OS_BSP_ConsoleOutput_Impl(const char *Str, size_t DataLen);
void OS_BSP_ConsoleSetMode_Impl(uint32 ModeBits);

/*----------------------------------------------------------------
Function: OS_BSP_Shutdown_Impl

Purpose: Causes the calling task to abort in a BSP-safe way.
This may map to the abort() system call, but on some systems
Expand Down
1 change: 0 additions & 1 deletion src/examples/tasking-example/tasking-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ void task_2(void)

void task_3(void)
{

uint32 data_received;
uint32 data_size;
uint32 status;
Expand Down
5 changes: 0 additions & 5 deletions src/os/inc/osapi-bsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,20 @@
*/

/*----------------------------------------------------------------
Function: OS_BSP_SetResourceTypeConfig

Purpose: Sets BSP/platform-specific flags for the given resource type
Flags and bit meanings are all platform defined.
------------------------------------------------------------------*/
void OS_BSP_SetResourceTypeConfig(uint32 ResourceType, uint32 ConfigOptionValue);

/*----------------------------------------------------------------
Function: OS_BSP_SetResourceTypeConfig

Purpose: Gets BSP/platform-specific flags for the given resource type
Flags and bit meanings are all platform defined.
------------------------------------------------------------------*/
uint32 OS_BSP_GetResourceTypeConfig(uint32 ResourceType);

/*----------------------------------------------------------------
Function: OS_BSP_GetArgC

Purpose: Obtain the number of boot arguments passed from the bootloader
or shell if supported by the platform
Expand All @@ -70,7 +67,6 @@ uint32 OS_BSP_GetResourceTypeConfig(uint32 ResourceType);
uint32 OS_BSP_GetArgC(void);

/*----------------------------------------------------------------
Function: OS_BSP_GetArgV

Purpose: Obtain an array of boot argument strings passed from the bootloader
or shell if supported by the platform
Expand All @@ -83,7 +79,6 @@ uint32 OS_BSP_GetArgC(void);
char *const *OS_BSP_GetArgV(void);

/*----------------------------------------------------------------
Function: OS_BSP_SetExitCode

Purpose: Sets the status to be returned to the shell or bootloader
if supported by the platform. The value is an integer with
Expand Down
75 changes: 75 additions & 0 deletions src/os/inc/osapi-clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ int32 OS_SetLocalTime(const OS_time_t *time_struct);
* structure was defined with separate seconds/microseconds fields.
*
* @sa OS_TimeGetMicrosecondsPart()
* @sa OS_TimeFromTotalSeconds()
*
* @param[in] tm Time interval value
* @returns Whole number of seconds in time interval
Expand All @@ -132,12 +133,31 @@ static inline int64 OS_TimeGetTotalSeconds(OS_time_t tm)
return (tm.ticks / OS_TIME_TICKS_PER_SECOND);
}

/*-------------------------------------------------------------------------------------*/
/**
* @brief Get an OS_time_t interval object from an integer number of seconds
*
* This is the inverse operation of OS_TimeGetTotalSeconds(), converting the
* total number of seconds into an OS_time_t value.
*
* @sa OS_TimeGetTotalSeconds()
*
* @param[in] tm Time interval value, in seconds
* @returns OS_time_t value representing the interval
*/
static inline OS_time_t OS_TimeFromTotalSeconds(int64 tm)
{
return (OS_time_t) {.ticks = (tm * OS_TIME_TICKS_PER_SECOND)};
}

/*-------------------------------------------------------------------------------------*/
/**
* @brief Get interval from an OS_time_t object normalized to millisecond units
*
* Note this refers to the complete interval, not just the fractional part.
*
* @sa OS_TimeFromTotalMilliseconds()
*
* @param[in] tm Time interval value
* @returns Whole number of milliseconds in time interval
*/
Expand All @@ -146,12 +166,31 @@ static inline int64 OS_TimeGetTotalMilliseconds(OS_time_t tm)
return (tm.ticks / OS_TIME_TICKS_PER_MSEC);
}

/*-------------------------------------------------------------------------------------*/
/**
* @brief Get an OS_time_t interval object from a integer number of milliseconds
*
* This is the inverse operation of OS_TimeGetTotalMilliseconds(), converting the
* total number of milliseconds into an OS_time_t value.
*
* @sa OS_TimeGetTotalMilliseconds()
*
* @param[in] tm Time interval value, in milliseconds
* @returns OS_time_t value representing the interval
*/
static inline OS_time_t OS_TimeFromTotalMilliseconds(int64 tm)
{
return (OS_time_t) {.ticks = (tm * OS_TIME_TICKS_PER_MSEC)};
}

/*-------------------------------------------------------------------------------------*/
/**
* @brief Get interval from an OS_time_t object normalized to microsecond units
*
* Note this refers to the complete interval, not just the fractional part.
*
* @sa OS_TimeFromTotalMicroseconds()
*
* @param[in] tm Time interval value
* @returns Whole number of microseconds in time interval
*/
Expand All @@ -160,6 +199,23 @@ static inline int64 OS_TimeGetTotalMicroseconds(OS_time_t tm)
return (tm.ticks / OS_TIME_TICKS_PER_USEC);
}

/*-------------------------------------------------------------------------------------*/
/**
* @brief Get an OS_time_t interval object from a integer number of microseconds
*
* This is the inverse operation of OS_TimeGetTotalMicroseconds(), converting the
* total number of microseconds into an OS_time_t value.
*
* @sa OS_TimeGetTotalMicroseconds()
*
* @param[in] tm Time interval value, in microseconds
* @returns OS_time_t value representing the interval
*/
static inline OS_time_t OS_TimeFromTotalMicroseconds(int64 tm)
{
return (OS_time_t) {.ticks = (tm * OS_TIME_TICKS_PER_USEC)};
}

/*-------------------------------------------------------------------------------------*/
/**
* @brief Get interval from an OS_time_t object normalized to nanosecond units
Expand All @@ -170,6 +226,8 @@ static inline int64 OS_TimeGetTotalMicroseconds(OS_time_t tm)
* Applications must use caution to ensure that the interval does not exceed the
* representable range of a signed 64 bit integer - approximately 140 years.
*
* @sa OS_TimeFromTotalNanoseconds
*
* @param[in] tm Time interval value
* @returns Whole number of microseconds in time interval
*/
Expand All @@ -178,6 +236,23 @@ static inline int64 OS_TimeGetTotalNanoseconds(OS_time_t tm)
return (tm.ticks * OS_TIME_TICK_RESOLUTION_NS);
}

/*-------------------------------------------------------------------------------------*/
/**
* @brief Get an OS_time_t interval object from a integer number of nanoseconds
*
* This is the inverse operation of OS_TimeGetTotalNanoseconds(), converting the
* total number of nanoseconds into an OS_time_t value.
*
* @sa OS_TimeGetTotalNanoseconds()
*
* @param[in] tm Time interval value, in nanoseconds
* @returns OS_time_t value representing the interval
*/
static inline OS_time_t OS_TimeFromTotalNanoseconds(int64 tm)
{
return (OS_time_t) {.ticks = (tm / OS_TIME_TICK_RESOLUTION_NS)};
}

/*-------------------------------------------------------------------------------------*/
/**
* @brief Get subseconds portion (fractional part only) from an OS_time_t object
Expand Down
1 change: 0 additions & 1 deletion src/os/inc/osapi-timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ typedef struct
uint32 start_time;
uint32 interval_time;
uint32 accuracy;

} OS_timer_prop_t;

/** @defgroup OSAPITimer OSAL Timer APIs
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/*
* Development Build Macro Definitions
*/
#define OS_BUILD_NUMBER 131
#define OS_BUILD_NUMBER 143
#define OS_BUILD_BASELINE "v6.0.0-rc4"

/*
Expand Down
Loading