Files | |
file | task_barrier_types.h |
MARS Task Barrier Types. | |
file | task_barrier.h |
[host] MARS Task Barrier API | |
file | task_barrier.h |
[MPU] MARS Task Barrier API | |
Defines | |
#define | MARS_TASK_BARRIER_WAIT_MAX 25 |
Maximum tasks allowed for single barrier. | |
Functions | |
int | mars_task_barrier_create (struct mars_context *mars, struct mars_task_barrier **barrier, uint32_t total) |
[host] Creates a task barrier. | |
int | mars_task_barrier_destroy (struct mars_task_barrier *barrier) |
[host] Destroys a task barrier. | |
int | mars_task_barrier_notify (uint64_t barrier_ea) |
[MPU] Notifies a task barrier. (Task Switch Call) | |
int | mars_task_barrier_try_notify (uint64_t barrier_ea) |
[MPU] Notifies a task barrier. | |
int | mars_task_barrier_wait (uint64_t barrier_ea) |
[MPU] Waits on a task barrier. (Task Switch Call) | |
int | mars_task_barrier_try_wait (uint64_t barrier_ea) |
[MPU] Waits on a task barrier. |
int mars_task_barrier_create | ( | struct mars_context * | mars, | |
struct mars_task_barrier ** | barrier, | |||
uint32_t | total | |||
) |
[host] Creates a task barrier.
This function will allocate an instance of the task barrier. The barrier allows for tasks within the barrier group to wait until all tasks arrive at some synchronization point and notify the barrier. All tasks included in the barrier group should call the notify and wait in pairs.
Key Parameters:
total
[in] | mars | - pointer to MARS context |
[out] | barrier | - address of pointer to barrier instance |
[in] | total | - number of notifies before barrier released |
int mars_task_barrier_destroy | ( | struct mars_task_barrier * | barrier | ) |
[host] Destroys a task barrier.
This function will free any resources allocated during creation of the task barrier.
[in] | barrier | - pointer to barrier instance |
int mars_task_barrier_notify | ( | uint64_t | barrier_ea | ) |
[MPU] Notifies a task barrier. (Task Switch Call)
If all tasks from the previous barrier cycle have not reached the synchronization point and notified the barrier yet, the caller task will enter a waiting state until the previous barrier cycle is released.
[in] | barrier_ea | - ea of initialized barrier instance |
int mars_task_barrier_try_notify | ( | uint64_t | barrier_ea | ) |
[MPU] Notifies a task barrier.
This function notifies the barrier that the caller task has reached the synchronization point. Once a task reaches the synchronization point and notifies the barrier, it may handle other processing before calling the required mars_task_barrier_wait.
If all tasks from the previous barrier cycle have not reached the synchronization point and notified the barrier yet, this function will return immediately with MARS_ERROR_BUSY.
[in] | barrier_ea | - ea of initialized barrier instance |
int mars_task_barrier_wait | ( | uint64_t | barrier_ea | ) |
[MPU] Waits on a task barrier. (Task Switch Call)
If not all tasks associated with the barrier have reached the synchronization point and notified the barrier at the time of this call, the caller task will enter a waiting state until all notifications are received from the other tasks and the barrier is released.
[in] | barrier_ea | - ea of initialized barrier instance |
int mars_task_barrier_try_wait | ( | uint64_t | barrier_ea | ) |
[MPU] Waits on a task barrier.
This function should be called after the caller task has previously called mars_task_barrier_notify. This function should be called when the task that reached the synchronization point is ready to wait for others to arrive at the synchronization point.
If not all tasks associated with the barrier have reached the synchronization point and notified the barrier at the time of this call, this function will return immediately with MARS_ERROR_BUSY.
[in] | barrier_ea | - ea of initialized barrier instance |