Skip to content

Commit

Permalink
Fix #1345, Support adding default flags at task creation
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Jan 3, 2023
1 parent b4d4eb6 commit d7ca572
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions default_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,14 @@ set(OSAL_CONFIG_MAX_CMD_LEN 1000
set(OSAL_CONFIG_QUEUE_MAX_DEPTH 50
CACHE STRING "Maximum depth of message queue"
)

# Flags added to all tasks on creation
#
# Some OS's use floating point under the hood, this supports
# adding the floating point flag on creation of all tasks instead of
# just when OS_FP_ENABLED flag is passed in to OS_TaskCreate
#
# Set to 0 to not add any
set(OSAL_CONFIG_ADD_TASK_FLAGS 0
CACHE STRING "Flags added to all tasks"
)
9 changes: 9 additions & 0 deletions osconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,15 @@
*/
#define OS_PRINTF_CONSOLE_NAME "@OSAL_CONFIG_PRINTF_CONSOLE_NAME@"

/**
* \brief Flags added to all tasks on creation
*
* Added to the task flags on creation
*
* Supports adding floating point support for all tasks when the OS requires it
*/
#define OS_ADD_TASK_FLAGS @OSAL_CONFIG_ADD_TASK_FLAGS@

/*
* OSAL fixed resource limits
*
Expand Down
3 changes: 3 additions & 0 deletions src/os/shared/src/osapi-task.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ int32 OS_TaskCreate(osal_id_t *task_id, const char *task_name, osal_task_entry f
task->entry_function_pointer = function_pointer;
task->stack_pointer = stack_pointer;

/* Add default flags */
flags |= OS_ADD_TASK_FLAGS;

/* Now call the OS-specific implementation. This reads info from the task table. */
return_code = OS_TaskCreate_Impl(&token, flags);

Expand Down

0 comments on commit d7ca572

Please sign in to comment.