Skip to content

Commit

Permalink
Merge pull request nasa#680 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
OSAL Integration Candidate: 2020-12-08
  • Loading branch information
astrogeco authored Dec 9, 2020
2 parents fa0cffa + 5212489 commit 9407cdf
Show file tree
Hide file tree
Showing 161 changed files with 3,886 additions and 5,528 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ The autogenerated OSAL user's guide can be viewed at <https://github.com/nasa/cF

## Version History

### Development Build: 5.1.0-rc1+dev109

- Add support for RTEMS 5.1 in the OSAL and provides defines and necessary ifdefs so RTEMS 4.11 can continue to be supported.
- Adds functional test for OS_chmod
- Refactor the table array access across OSAL. Use a token concept in combination with a macro to obtain the table entry instead of indexing arrays directly. All access is then done through this table pointer. Use the full object ID in the timer call back list. Update the timer sync callback prototype. Pass the entire OSAL ID to the sync function, not just the index. This is technically an API change.
- Replaces condition on forever loops to end on shutdown. Loops now exit on shutdown.
- Removes obsolete printf tests that didn't work
- See <https://github.com/nasa/osal/pull/680>


### Development Build: 5.1.0-rc1+dev91

- Rename `UT_SetForceFail` to `UT_SetDefaultReturnValue` since some functions that retain more than 1 value are not necessarily failing
Expand Down
7 changes: 7 additions & 0 deletions src/bsp/pc-rtems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ add_library(osal_pc-rtems_impl OBJECT
src/bsp_console.c
)

# This definition is needed for the gethostname call
# By defining this, it avoids the need to use the -std=gnu99
# instead of the preferred -std=c99 GCC switch
target_compile_definitions(osal_pc-rtems_impl PUBLIC
_BSD_SOURCE
)

# This BSP only works with "rtems" OS layer.
# Confirming this reduces risk of accidental misconfiguration
set(OSAL_EXPECTED_OSTYPE "rtems" PARENT_SCOPE)
14 changes: 9 additions & 5 deletions src/bsp/pc-rtems/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ void OS_BSP_Setup(void)
cmdlinestr = bsp_cmdline();

printf("\n\n*** RTEMS Info ***\n");
printf("%s", _Copyright_Notice);
printf("%s\n\n", _RTEMS_version);
printf(" Stack size=%d\n", (int)Configuration.stack_space_size);
printf(" Workspace size=%d\n", (int)Configuration.work_space_size);
printf("%s", OSAL_BSP_COPYRIGHT_NOTICE);
printf("%s\n\n", rtems_get_version_string());
printf(" Stack size=%d\n", (int)rtems_configuration_get_stack_space_size());
printf(" Workspace size=%d\n", (int)rtems_configuration_get_work_space_size());
if (cmdlinestr != NULL)
{
printf(" Bootloader Command Line: %s\n", cmdlinestr);
Expand Down Expand Up @@ -374,9 +374,13 @@ rtems_task Init(rtems_task_argument ignored)
#define CONFIGURE_MAXIMUM_TIMERS (OS_MAX_TIMERS + 2)
#define CONFIGURE_MAXIMUM_SEMAPHORES (OS_MAX_BIN_SEMAPHORES + OS_MAX_COUNT_SEMAPHORES + OS_MAX_MUTEXES + 16)
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES (OS_MAX_QUEUES + 4)
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS (OS_MAX_NUM_OPEN_FILES + 8)
#define CONFIGURE_MAXIMUM_DRIVERS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 4
#ifdef _RTEMS_5_
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS (OS_MAX_NUM_OPEN_FILES + 8)
#else
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS (OS_MAX_NUM_OPEN_FILES + 8)
#endif

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
Expand Down
9 changes: 9 additions & 0 deletions src/bsp/pc-rtems/src/pcrtems_bsp_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
#define RTEMS_MAX_USER_OPTIONS 4
#define RTEMS_MAX_CMDLINE 256

/*
* Handle the differences between RTEMS 5 and 4.11 copyright notice
*/
#ifdef _RTEMS_5_
#define OSAL_BSP_COPYRIGHT_NOTICE rtems_get_copyright_notice()
#else
#define OSAL_BSP_COPYRIGHT_NOTICE _Copyright_Notice
#endif

/*
* The location which the general purpose file system will be mounted
*/
Expand Down
4 changes: 2 additions & 2 deletions src/os/inc/osapi-os-timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
/*
** Typedefs
*/
typedef void (*OS_TimerCallback_t)(osal_id_t timer_id); /**< @brief Timer callback */
typedef uint32 (*OS_TimerSync_t)(osal_index_t timer_id); /**< @brief Timer sync */
typedef void (*OS_TimerCallback_t)(osal_id_t timer_id); /**< @brief Timer callback */
typedef uint32 (*OS_TimerSync_t)(osal_id_t timer_id); /**< @brief Timer sync */

/** @brief Timer properties */
typedef struct
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 @@ -30,7 +30,7 @@
/*
* Development Build Macro Definitions
*/
#define OS_BUILD_NUMBER 91
#define OS_BUILD_NUMBER 109
#define OS_BUILD_BASELINE "v5.1.0-rc1"

/*
Expand Down
24 changes: 14 additions & 10 deletions src/os/portable/os-impl-bsd-select.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <osapi.h>
#include "os-impl-select.h"
#include "os-shared-select.h"
#include "os-shared-idmap.h"

/****************************************************************************************
DEFINES
Expand Down Expand Up @@ -249,17 +250,20 @@ static int32 OS_DoSelect(int maxfd, fd_set *rd_set, fd_set *wr_set, int32 msecs)
* See prototype for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_SelectSingle_Impl(osal_index_t stream_id, uint32 *SelectFlags, int32 msecs)
int32 OS_SelectSingle_Impl(const OS_object_token_t *token, uint32 *SelectFlags, int32 msecs)
{
int32 return_code;
fd_set wr_set;
fd_set rd_set;
int32 return_code;
fd_set wr_set;
fd_set rd_set;
OS_impl_file_internal_record_t *impl;

impl = OS_OBJECT_TABLE_GET(OS_impl_filehandle_table, *token);

/*
* If called on a stream_id which does not support this
* operation, return immediately and do not invoke the system call
*/
if (!OS_impl_filehandle_table[stream_id].selectable)
if (!impl->selectable)
{
return OS_ERR_OPERATION_NOT_SUPPORTED;
}
Expand All @@ -270,22 +274,22 @@ int32 OS_SelectSingle_Impl(osal_index_t stream_id, uint32 *SelectFlags, int32 ms
FD_ZERO(&rd_set);
if (*SelectFlags & OS_STREAM_STATE_READABLE)
{
FD_SET(OS_impl_filehandle_table[stream_id].fd, &rd_set);
FD_SET(impl->fd, &rd_set);
}
if (*SelectFlags & OS_STREAM_STATE_WRITABLE)
{
FD_SET(OS_impl_filehandle_table[stream_id].fd, &wr_set);
FD_SET(impl->fd, &wr_set);
}

return_code = OS_DoSelect(OS_impl_filehandle_table[stream_id].fd, &rd_set, &wr_set, msecs);
return_code = OS_DoSelect(impl->fd, &rd_set, &wr_set, msecs);

if (return_code == OS_SUCCESS)
{
if (!FD_ISSET(OS_impl_filehandle_table[stream_id].fd, &rd_set))
if (!FD_ISSET(impl->fd, &rd_set))
{
*SelectFlags &= ~OS_STREAM_STATE_READABLE;
}
if (!FD_ISSET(OS_impl_filehandle_table[stream_id].fd, &wr_set))
if (!FD_ISSET(impl->fd, &wr_set))
{
*SelectFlags &= ~OS_STREAM_STATE_WRITABLE;
}
Expand Down
Loading

0 comments on commit 9407cdf

Please sign in to comment.