Files | |
file | task_event_flag_types.h |
MARS Task Event Flag Types. | |
file | task_event_flag.h |
[host] MARS Task Event Flag API | |
file | task_event_flag.h |
[MPU] MARS Task Event Flag API | |
Data Structures | |
struct | mars_task_event_flag |
MARS task event flag structure. More... | |
Defines | |
#define | MARS_TASK_EVENT_FLAG_HOST_TO_MPU 0x10 |
Event flag direction from PPU to SPU. | |
#define | MARS_TASK_EVENT_FLAG_MPU_TO_HOST 0x11 |
Event flag direction from SPU to PPU. | |
#define | MARS_TASK_EVENT_FLAG_MPU_TO_MPU 0x12 |
Event flag direction from SPU to SPU. | |
#define | MARS_TASK_EVENT_FLAG_CLEAR_AUTO 0x20 |
Event flag clear mode automatic. | |
#define | MARS_TASK_EVENT_FLAG_CLEAR_MANUAL 0x21 |
Event flag clear mode manual. | |
#define | MARS_TASK_EVENT_FLAG_MASK_OR 0x30 |
Event flag mask mode bitwise OR. | |
#define | MARS_TASK_EVENT_FLAG_MASK_AND 0x31 |
Event flag mask mode bitwise AND. | |
#define | MARS_TASK_EVENT_FLAG_WAIT_MAX 15 |
Maximum tasks allowed to wait on a single event flag. | |
Functions | |
int | mars_task_event_flag_create (struct mars_context *mars, struct mars_task_event_flag **event_flag, uint8_t direction, uint8_t clear_mode) |
[host] Creates a task event flag. | |
int | mars_task_event_flag_destroy (struct mars_task_event_flag *event_flag) |
[host] Destroys a task event flag. | |
int | mars_task_event_flag_clear (struct mars_task_event_flag *event_flag, uint32_t bits) |
[host] Clears the bits specified in the task event flag. | |
int | mars_task_event_flag_set (struct mars_task_event_flag *event_flag, uint32_t bits) |
[host] Sets the bits specified in the task event flag. | |
int | mars_task_event_flag_wait (struct mars_task_event_flag *event_flag, uint32_t mask, uint8_t mask_mode, uint32_t *bits) |
[host] Waits on a task event flag. | |
int | mars_task_event_flag_try_wait (struct mars_task_event_flag *event_flag, uint32_t mask, uint8_t mask_mode, uint32_t *bits) |
[host] Waits on a task event flag. | |
int | mars_task_event_flag_clear (uint64_t event_flag_ea, uint32_t bits) |
[MPU] Clears the bits specified in the task event flag. | |
int | mars_task_event_flag_set (uint64_t event_flag_ea, uint32_t bits) |
[MPU] Sets the bits specified in the task event flag. | |
int | mars_task_event_flag_wait (uint64_t event_flag_ea, uint32_t mask, uint8_t mask_mode, uint32_t *bits) |
[MPU] Waits on a task event flag. (Task Switch Call) | |
int | mars_task_event_flag_try_wait (uint64_t event_flag_ea, uint32_t mask, uint8_t mask_mode, uint32_t *bits) |
[MPU] Waits on a task event flag. |
The event flags can be sent from host program to MARS task or vice versa, as well as between multiple MARS tasks. While waiting on certain event flags to be received, the task transitions to the waiting state until the event flag is received.
int mars_task_event_flag_create | ( | struct mars_context * | mars, | |
struct mars_task_event_flag ** | event_flag, | |||
uint8_t | direction, | |||
uint8_t | clear_mode | |||
) |
[host] Creates a task event flag.
This function will allocate an instance of the task event flag. The event flag allows for tasks to wait on specific events. The event flag should be used in pairs with calls to set an event flag and wait for an event flag.
Key Parameters:
direction
clear_mode
[in] | mars | - pointer to MARS context |
[out] | event_flag | - address of pointer to event flag instance |
[in] | direction | - direction of the event flag |
[in] | clear_mode | - behavior of how the event flag is cleared |
int mars_task_event_flag_destroy | ( | struct mars_task_event_flag * | event_flag | ) |
[host] Destroys a task event flag.
This function will free any resources allocated during creation of the task event flag.
[in] | event_flag | - pointer to event flag instance |
int mars_task_event_flag_clear | ( | struct mars_task_event_flag * | event_flag, | |
uint32_t | bits | |||
) |
[host] Clears the bits specified in the task event flag.
This function will clear all bits currently set in the event flag. Tasks waiting on some events will remain in the waiting state.
Key Parameters:
bits
[in] | event_flag | - pointer to event flag instance |
[in] | bits | - bits to clear |
int mars_task_event_flag_set | ( | struct mars_task_event_flag * | event_flag, | |
uint32_t | bits | |||
) |
[host] Sets the bits specified in the task event flag.
This function will set the bits specified. The bits are OR'd with bits already set in the event flag at the time of this call. If there are any tasks in the waiting state, and this call satisfies the release condition of those tasks, all those tasks will be returned to the ready state.
Key Parameters:
bits
[in] | event_flag | - pointer to event flag instance |
[in] | bits | - bits to set |
int mars_task_event_flag_wait | ( | struct mars_task_event_flag * | event_flag, | |
uint32_t | mask, | |||
uint8_t | mask_mode, | |||
uint32_t * | bits | |||
) |
[host] Waits on a task event flag.
This call will block until the specified event flag condition is met.
Key Parameters:
mask
mask_mode
bits
[in] | event_flag | - pointer to event flag instance |
[in] | mask | - bit mask to test event flag bits against |
[in] | mask_mode | - specifies how to mask bits (AND, OR) |
[out] | bits | - pointer to instance to store bits upon release |
int mars_task_event_flag_try_wait | ( | struct mars_task_event_flag * | event_flag, | |
uint32_t | mask, | |||
uint8_t | mask_mode, | |||
uint32_t * | bits | |||
) |
[host] Waits on a task event flag.
This call will test to see if the specified event flag condition is met without blocking and returns immediately with MARS_ERROR_BUSY if it did not.
Key Parameters:
mask
mask_mode
bits
[in] | event_flag | - pointer to event flag instance |
[in] | mask | - bit mask to test event flag bits against |
[in] | mask_mode | - specifies how to mask bits (AND, OR) |
[out] | bits | - pointer to instance to store bits upon release |
int mars_task_event_flag_clear | ( | uint64_t | event_flag_ea, | |
uint32_t | bits | |||
) |
[MPU] Clears the bits specified in the task event flag.
This function will clear all bits currently set in the event flag. Tasks waiting on some events will remain in the waiting state.
Key Parameters:
bits
[in] | event_flag_ea | - ea of initialized event flag instance |
[in] | bits | - bits to clear |
int mars_task_event_flag_set | ( | uint64_t | event_flag_ea, | |
uint32_t | bits | |||
) |
[MPU] Sets the bits specified in the task event flag.
This function will set the bits specified. The bits are OR'd with bits already set in the event flag at the time of this call. If there are any tasks in the waiting state, and this call satisfies the release condition of those tasks, all those tasks will be returned to the ready state.
Key Parameters:
bits
[in] | event_flag_ea | - ea of initialized event flag instance |
[in] | bits | - bits to set |
int mars_task_event_flag_wait | ( | uint64_t | event_flag_ea, | |
uint32_t | mask, | |||
uint8_t | mask_mode, | |||
uint32_t * | bits | |||
) |
[MPU] Waits on a task event flag. (Task Switch Call)
Key Parameters:
mask
mask_mode
bits
[in] | event_flag_ea | - ea of initialized event flag instance |
[in] | mask | - bit mask to test event flag bits against |
[in] | mask_mode | - specifies how to mask bits (AND, OR) |
[out] | bits | - pointer to instance to store bits upon release |
int mars_task_event_flag_try_wait | ( | uint64_t | event_flag_ea, | |
uint32_t | mask, | |||
uint8_t | mask_mode, | |||
uint32_t * | bits | |||
) |
[MPU] Waits on a task event flag.
This call will test to see if the specified event flag condition is met returns immediately with MARS_ERROR_BUSY if it did not.
Key Parameters:
mask
mask_mode
bits
[in] | event_flag_ea | - ea of initialized event flag instance |
[in] | mask | - bit mask to test event flag bits against |
[in] | mask_mode | - specifies how to mask bits (AND, OR) |
[out] | bits | - pointer to instance to store bits upon release |