2022-02-17 16:14:33 +01:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause OR Apache-2.0
|
2020-11-13 10:42:31 +01:00
|
|
|
/*
|
|
|
|
|
* hal_task.h
|
|
|
|
|
*
|
|
|
|
|
* Description: contains the definitions of the hardware abstraction
|
|
|
|
|
* layer interface for thread-related functionality
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef HAL_TASK_H_INCLUDED
|
|
|
|
|
#define HAL_TASK_H_INCLUDED
|
|
|
|
|
|
2023-01-10 14:48:49 +01:00
|
|
|
#include "ud3tn/common.h"
|
|
|
|
|
|
2020-11-13 10:42:31 +01:00
|
|
|
#include "platform/hal_types.h"
|
|
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief hal_createTask Creates a new task in the underlying OS infrastructure
|
|
|
|
|
* @param taskFunction Pointer to the initial task function
|
|
|
|
|
* <b>currently this function should never reach its end</b>
|
|
|
|
|
* @param taskName a descriptive name for the task
|
|
|
|
|
* @param taskPriority The priority with witch the scheduler should regard
|
|
|
|
|
* the task
|
|
|
|
|
* @param taskParameters Arbitrary data that is passed to the created task
|
|
|
|
|
* @param taskStackSize The number of words (not bytes!) to allocate for use
|
|
|
|
|
* as the task's stack
|
|
|
|
|
* @param taskTag Identifier that is assigned to the created task for
|
|
|
|
|
* debugging/tracing
|
2023-01-10 14:48:49 +01:00
|
|
|
* @return a ud3tn_result indicating whether the operation was successful or not
|
2020-11-13 10:42:31 +01:00
|
|
|
*/
|
2023-01-10 14:48:49 +01:00
|
|
|
enum ud3tn_result hal_task_create(
|
|
|
|
|
void (*task_function)(void *), const char *task_name,
|
|
|
|
|
int task_priority, void *task_parameters,
|
|
|
|
|
size_t task_stack_size);
|
2020-11-13 10:42:31 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief hal_startScheduler Starts the task scheduler of the underlying OS
|
|
|
|
|
* infrastructure (if necessary)
|
|
|
|
|
*/
|
|
|
|
|
void hal_task_start_scheduler(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief hal_task_delay Blocks the calling task for the specified time.
|
|
|
|
|
* @param delay The delay in milliseconds
|
|
|
|
|
*/
|
|
|
|
|
void hal_task_delay(int delay);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* HAL_TASK_H_INCLUDED */
|