Skip to content

Commit

Permalink
Merge branch 'nasa:main' into fix1115-branch-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
nmullane authored Jul 29, 2021
2 parents e5e7799 + 1963483 commit 38dce85
Show file tree
Hide file tree
Showing 67 changed files with 1,425 additions and 1,317 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,37 @@ The autogenerated OSAL user's guide can be viewed at <https://github.com/nasa/cF

## Version History

### Development Build: v5.1.0-rc1+dev578

- Add unit test branch coverage
- See <https://github.com/nasa/osal/pull/1116> and <https://github.com/nasa/cfs/pull/313>

### Development Build: v5.1.0-rc1+dev573

- Add independent OS_rename functional test parameter checks
- See <https://github.com/nasa/osal/pull/1113> and <https://github.com/nasa/cfs/pull/311>

### Development Build: v5.1.0-rc1+dev569

- Skip these "timer reconfig" unit tests on non-POSIX platforms. Add documentation clearly indicating that the API must not be called from a timer context.
- See <https://github.com/nasa/osal/pull/1100> and <https://github.com/nasa/cFS/pull/297>

### Development Build: v5.1.0-rc1+dev564

- Add range to OS_TaskDelay checks
- Return `OS_OBJECT_ID_UNDEFINED` for root task ID on RTEMS
- Increase timeout in network-api-test
- Avoid task delete during UtPrintf
- Increase UT symbol dump size limit
- Do not register RTOS timer for external sync
- Add osal# prefix to Network API group
- Increase timeout in network-api-test
- See <https://github.com/nasa/osal/pull/1098> and <https://github.com/nasa/cfs/pull/287>

### Development Build: v5.1.0-rc1+dev548

- implement missing parameter/retcode test permutations
- See <https://github.com/nasa/osal/pull/1079> and <https://github.com/nasa/cFS/pull/270>

### Development Build: v5.1.0-rc1+dev530

Expand Down
4 changes: 2 additions & 2 deletions docs/src/osalmain.dox
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
<UL>
<LI> APIs
<UL>
<LI> \ref OSALAPINetwork
<LI> \ref OSAPINetwork
<LI> \ref OSAPISocketAddr
<LI> \ref OSALAPISocket
<LI> \ref OSAPISocket
</UL>
<LI> \subpage osapi-network.h "Network Reference"
<LI> \subpage osapi-sockets.h "Socket Reference"
Expand Down
4 changes: 2 additions & 2 deletions src/bsp/generic-vxworks/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ int OS_BSPMain(void)
/*
* Initialize the low level access sem
*/
OS_BSP_GenericVxWorksGlobal.AccessMutex =
semMInitialize(OS_BSP_GenericVxWorksGlobal.AccessMutexMem, SEM_Q_PRIORITY | SEM_INVERSION_SAFE);
OS_BSP_GenericVxWorksGlobal.AccessMutex = semMInitialize(OS_BSP_GenericVxWorksGlobal.AccessMutexMem,
SEM_Q_PRIORITY | SEM_INVERSION_SAFE | SEM_DELETE_SAFE);

if (OS_BSP_GenericVxWorksGlobal.AccessMutex == (SEM_ID)0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-filesys.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ typedef struct
*
* OS_FileSysAddFixedMap(&fs_id, "/", "/root");
*
* @param[out] filesys_id A non-zero OSAL ID reflecting the file system
* @param[out] filesys_id A buffer to store the ID of the file system mapping @nonnull
* @param[in] phys_path The native system directory (an existing mount point) @nonnull
* @param[in] virt_path The virtual mount point of this filesystem @nonnull
*
Expand Down
6 changes: 3 additions & 3 deletions src/os/inc/osapi-network.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "common_types.h"

/**
* @defgroup OSALAPINetwork Network ID APIs
* @defgroup OSAPINetwork OSAL Network ID APIs
*
* Provides some basic methods to query a network host name and ID
*
Expand Down Expand Up @@ -61,8 +61,8 @@ int32 OS_NetworkGetID(void);
* If configured in the underlying network stack,
* this function retrieves the local hostname of the system.
*
* @param[out] host_name Buffer to hold name information
* @param[in] name_len Maximum length of host name buffer
* @param[out] host_name Buffer to hold name information @nonnull
* @param[in] name_len Maximum length of host name buffer @nonzero
*
* @return Execution status, see @ref OSReturnCodes
* @retval #OS_SUCCESS @copybrief OS_SUCCESS
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ int32 OS_SocketAddrSetPort(OS_SockAddr_t *Addr, uint16 PortNum);
/**@}*/

/**
* @defgroup OSALAPISocket OSAL Socket Management APIs
* @defgroup OSAPISocket OSAL Socket Management APIs
*
* These functions are loosely related to the BSD Sockets API but made to be
* more consistent with other OSAL API functions. That is, they operate on
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-task.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ typedef osal_task((*osal_task_entry)(void)); /**< @brief For task entry point */
* In that case, a stack of the requested size will be dynamically allocated from
* the system heap.
*
* @param[out] task_id will be set to the non-zero ID of the newly-created resource
* @param[out] task_id will be set to the non-zero ID of the newly-created resource @nonnull
* @param[in] task_name the name of the new resource to create @nonnull
* @param[in] function_pointer the entry point of the new task @nonnull
* @param[in] stack_pointer pointer to the stack for the task, or NULL
Expand Down
17 changes: 16 additions & 1 deletion src/os/inc/osapi-timebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ typedef struct
* be configured to support at least (OS_MAX_TASKS + OS_MAX_TIMEBASES) threads,
* to account for the helper threads associated with time base objects.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[out] timebase_id will be set to the non-zero ID of the newly-created resource @nonnull
* @param[in] timebase_name The name of the time base @nonnull
* @param[in] external_sync A synchronization function for BSP hardware-based timer ticks
Expand Down Expand Up @@ -101,6 +104,9 @@ int32 OS_TimeBaseCreate(osal_id_t *timebase_id, const char *timebase_name, OS_Ti
* This function has no effect for time bases that are using
* a BSP-provided external_sync function.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[in] timebase_id The timebase resource to configure
* @param[in] start_time The amount of delay for the first tick, in microseconds.
* @param[in] interval_time The amount of delay between ticks, in microseconds.
Expand All @@ -120,6 +126,9 @@ int32 OS_TimeBaseSet(osal_id_t timebase_id, uint32 start_time, uint32 interval_t
* The helper task and any other resources associated with the time base
* abstraction will be freed.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[in] timebase_id The timebase resource to delete
*
* @return Execution status, see @ref OSReturnCodes
Expand All @@ -135,6 +144,9 @@ int32 OS_TimeBaseDelete(osal_id_t timebase_id);
*
* Given a time base name, find and output the ID associated with it.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[out] timebase_id will be set to the non-zero ID of the matching resource @nonnull
* @param[in] timebase_name The name of the timebase resource to find @nonnull
*
Expand All @@ -155,7 +167,10 @@ int32 OS_TimeBaseGetIdByName(osal_id_t *timebase_id, const char *timebase_name);
* relevant information about the time base resource.
*
* This function will pass back a pointer to structure that contains
* all of the relevant info( name and creator) about the specified timebase.
* all of the relevant info( name and creator) about the specified timebase.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[in] timebase_id The timebase resource ID
* @param[out] timebase_prop Buffer to store timebase properties @nonnull
Expand Down
18 changes: 18 additions & 0 deletions src/os/inc/osapi-timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ typedef struct
* @note clock_accuracy comes from the underlying OS tick value. The nearest integer
* microsecond value is returned, so may not be exact.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @sa OS_TimerCallback_t
*
* @param[out] timer_id Will be set to the non-zero resource ID of the timer object @nonnull
Expand Down Expand Up @@ -109,6 +112,9 @@ int32 OS_TimerCreate(osal_id_t *timer_id, const char *timer_name, uint32 *clock_
* function by the OSAL, and the arg parameter is passed through from the
* callback_arg argument on this call.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @sa OS_ArgCallback_t
*
* @param[out] timer_id Will be set to the non-zero resource ID of the timer object @nonnull
Expand Down Expand Up @@ -149,6 +155,9 @@ int32 OS_TimerAdd(osal_id_t *timer_id, const char *timer_name, osal_id_t timebas
* or interval_msec parameters are less than the accuracy, they will be rounded
* up to the accuracy of the timer.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[in] timer_id The timer ID to operate on
* @param[in] start_time Time in microseconds to the first expiration
* @param[in] interval_time Time in microseconds between subsequent intervals, value
Expand All @@ -171,6 +180,9 @@ int32 OS_TimerSet(osal_id_t timer_id, uint32 start_time, uint32 interval_time);
* The application callback associated with the timer will be stopped,
* and the resources freed for future use.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[in] timer_id The timer ID to operate on
*
* @return Execution status, see @ref OSReturnCodes
Expand All @@ -187,6 +199,9 @@ int32 OS_TimerDelete(osal_id_t timer_id);
*
* Outputs the ID associated with the given timer, if it exists.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[out] timer_id Will be set to the timer ID corresponding to the name @nonnull
* @param[in] timer_name The timer name to find @nonnull
*
Expand All @@ -206,6 +221,9 @@ int32 OS_TimerGetIdByName(osal_id_t *timer_id, const char *timer_name);
* This function takes timer_id, and looks it up in the OS table. It puts all of the
* information known about that timer into a structure pointer to by timer_prop.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[in] timer_id The timer ID to operate on
* @param[out] timer_prop Buffer containing timer properties @nonnull
* - creator: the OS task ID of the task that created this timer
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 @@ -36,7 +36,7 @@
/*
* Development Build Macro Definitions
*/
#define OS_BUILD_NUMBER 530
#define OS_BUILD_NUMBER 578
#define OS_BUILD_BASELINE "v5.1.0-rc1"

/*
Expand Down
3 changes: 1 addition & 2 deletions src/os/posix/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
##########################################################################

# this file is a placeholder for POSIX-specific compile tuning
# currently no extra flags/definitions needed

add_definitions(-D_POSIX_OS_)
3 changes: 1 addition & 2 deletions src/os/rtems/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
##########################################################################

# this file is a placeholder for RTEMS-specific compile tuning
# currently no extra flags/definitions needed

add_definitions(-D_RTEMS_OS_)
11 changes: 10 additions & 1 deletion src/os/rtems/src/os-impl-tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,20 @@ osal_id_t OS_TaskGetId_Impl(void)

task_self = rtems_task_self();
/* When the task was created the OSAL ID was used as the "classic name",
* which gives us an easy way to map it back again */
* which gives us an easy way to map it back again. However, if this
* API is invoked from a non-OSAL task (i.e. the "root" task) then it is
* possible that rtems_object_get_classic_name() succeeds but the result
* is not actually an OSAL task ID. */
status = rtems_object_get_classic_name(task_self, &self_name);
if (status == RTEMS_SUCCESSFUL)
{
global_task_id = OS_ObjectIdFromInteger(self_name);

if (OS_ObjectIdToType_Impl(global_task_id) != OS_OBJECT_TYPE_OS_TASK)
{
/* not an OSAL task */
global_task_id = OS_OBJECT_ID_UNDEFINED;
}
}
else
{
Expand Down
1 change: 1 addition & 0 deletions src/os/shared/src/osapi-filesys.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ int32 OS_FileSysAddFixedMap(osal_id_t *filesys_id, const char *phys_path, const
/*
* Validate inputs
*/
OS_CHECK_POINTER(filesys_id);
OS_CHECK_STRING(phys_path, sizeof(filesys->system_mountpt), OS_FS_ERR_PATH_TOO_LONG);
OS_CHECK_PATHNAME(virt_path);

Expand Down
2 changes: 2 additions & 0 deletions src/os/shared/src/osapi-queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ int32 OS_QueueGet(osal_id_t queue_id, void *data, size_t size, size_t *size_copi
/* Check Parameters */
OS_CHECK_POINTER(data);
OS_CHECK_POINTER(size_copied);
OS_CHECK_SIZE(size);

return_code = OS_ObjectIdGetById(OS_LOCK_MODE_NONE, LOCAL_OBJID_TYPE, queue_id, &token);
if (return_code == OS_SUCCESS)
Expand Down Expand Up @@ -205,6 +206,7 @@ int32 OS_QueuePut(osal_id_t queue_id, const void *data, size_t size, uint32 flag

/* Check Parameters */
OS_CHECK_POINTER(data);
OS_CHECK_SIZE(size);

return_code = OS_ObjectIdGetById(OS_LOCK_MODE_NONE, LOCAL_OBJID_TYPE, queue_id, &token);
if (return_code == OS_SUCCESS)
Expand Down
3 changes: 1 addition & 2 deletions src/os/vxworks/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
##########################################################################

# this file is a placeholder for VxWorks-specific compile tuning
# currently no extra flags/definitions needed

add_definitions(-D_VXWORKS_OS_)
43 changes: 26 additions & 17 deletions src/os/vxworks/src/os-impl-timebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,31 @@ void OS_VxWorks_RegisterTimer(osal_id_t obj_id)
{
local = OS_OBJECT_TABLE_GET(OS_impl_timebase_table, token);

memset(&evp, 0, sizeof(evp));
evp.sigev_notify = SIGEV_SIGNAL;
evp.sigev_signo = local->assigned_signal;
if (local->assigned_signal == 0)
{
/* nothing to register in RTOS */
status = 0;
}
else
{
memset(&evp, 0, sizeof(evp));
evp.sigev_notify = SIGEV_SIGNAL;
evp.sigev_signo = local->assigned_signal;

/*
** Create the timer
**
** The result is not returned from this function, because
** this is a different task context from the original creator.
**
** The registration status is returned through the OS_impl_timebase_table entry,
** which is checked by the creator before returning.
**
** If set to ERROR, then this task will be subsequently deleted.
*/
status = timer_create(OS_PREFERRED_CLOCK, &evp, &local->host_timerid);
}

/*
** Create the timer
**
** The result is not returned from this function, because
** this is a different task context from the original creator.
**
** The registration status is returned through the OS_impl_timebase_table entry,
** which is checked by the creator before returning.
**
** If set to ERROR, then this task will be subsequently deleted.
*/
status = timer_create(OS_PREFERRED_CLOCK, &evp, &local->host_timerid);
if (status < 0)
{
OS_DEBUG("timer_create() failed: errno=%d\n", errno);
Expand Down Expand Up @@ -529,8 +538,8 @@ int32 OS_TimeBaseSet_Impl(const OS_object_token_t *token, uint32 start_time, uin
/* There is only something to do here if we are generating a simulated tick */
if (local->assigned_signal <= 0)
{
/* An externally synced timebase does not need to be set */
return_code = OS_ERR_NOT_IMPLEMENTED;
/* An externally synced timebase does not need to be set (noop) */
return_code = OS_SUCCESS;
}
else
{
Expand Down
Loading

0 comments on commit 38dce85

Please sign in to comment.