Files | |
file | task_queue_types.h |
MARS Task Queue Types. | |
file | task_queue.h |
[host] MARS Task Queue Flag API | |
file | task_queue.h |
[MPU] MARS Task Queue API | |
Defines | |
#define | MARS_TASK_QUEUE_HOST_TO_MPU 0x10 |
Queue direction from PPU to SPU. | |
#define | MARS_TASK_QUEUE_MPU_TO_HOST 0x11 |
Queue direction from SPU to PPU. | |
#define | MARS_TASK_QUEUE_MPU_TO_MPU 0x12 |
Queue direction from SPU to SPU. | |
#define | MARS_TASK_QUEUE_WAIT_MAX 18 |
Maximum tasks allowed to wait on a queue. | |
#define | MARS_TASK_QUEUE_ENTRY_SIZE_MAX 16384 |
Maximum size allowed for queue entry. | |
Functions | |
int | mars_task_queue_create (struct mars_context *mars, struct mars_task_queue **queue, uint32_t size, uint32_t depth, uint8_t direction) |
[host] Creates a task queue. | |
int | mars_task_queue_destroy (struct mars_task_queue *queue) |
[host] Destroys a task queue. | |
int | mars_task_queue_count (struct mars_task_queue *queue, uint32_t *count) |
[host] Returns the number of data items in the task queue. | |
int | mars_task_queue_clear (struct mars_task_queue *queue) |
[host] Clears the data items in the task queue. | |
int | mars_task_queue_push (struct mars_task_queue *queue, const void *data) |
[host] Pushes the data specified into the task queue. | |
int | mars_task_queue_try_push (struct mars_task_queue *queue, const void *data) |
[host] Pushes the data specified into the task queue. | |
int | mars_task_queue_pop (struct mars_task_queue *queue, void *data) |
[host] Pops data from a task queue. | |
int | mars_task_queue_try_pop (struct mars_task_queue *queue, void *data) |
[host] Pops data from a task queue. | |
int | mars_task_queue_peek (struct mars_task_queue *queue, void *data) |
[host] Pops data from a task queue without removing it. | |
int | mars_task_queue_try_peek (struct mars_task_queue *queue, void *data) |
[host] Pops data from a task queue without removing it. | |
int | mars_task_queue_count (uint64_t queue_ea, uint32_t *count) |
[MPU] Returns the number of data items in the task queue. | |
int | mars_task_queue_clear (uint64_t queue_ea) |
[MPU] Clears the data items in the task queue. | |
int | mars_task_queue_push (uint64_t queue_ea, const void *data) |
[MPU] Pushes the data specified into the task queue. (Task Switch Call) | |
int | mars_task_queue_push_begin (uint64_t queue_ea, const void *data, uint32_t tag) |
[MPU] Begins push operation on a task queue. (Task Switch Call) | |
int | mars_task_queue_push_end (uint64_t queue_ea, uint32_t tag) |
[MPU] Completes push operation on a task queue. | |
int | mars_task_queue_try_push (uint64_t queue_ea, const void *data) |
[MPU] Pushes the data specified into the task queue. | |
int | mars_task_queue_try_push_begin (uint64_t queue_ea, const void *data, uint32_t tag) |
[MPU] Begins push operation on a task queue. | |
int | mars_task_queue_pop (uint64_t queue_ea, void *data) |
[MPU] Pops data from a task queue. (Task Switch Call) | |
int | mars_task_queue_pop_begin (uint64_t queue_ea, void *data, uint32_t tag) |
[MPU] Begins pop operation on a task queue. (Task Switch Call) | |
int | mars_task_queue_pop_end (uint64_t queue_ea, uint32_t tag) |
[MPU] Completes pop operation on a task queue. | |
int | mars_task_queue_try_pop (uint64_t queue_ea, void *data) |
[MPU] Pops data from a task queue. | |
int | mars_task_queue_try_pop_begin (uint64_t queue_ea, void *data, uint32_t tag) |
[MPU] Begins pop operation on a task queue. | |
int | mars_task_queue_peek (uint64_t queue_ea, void *data) |
[MPU] Pops data from a task queue without removing it. (Task Switch Call) | |
int | mars_task_queue_peek_begin (uint64_t queue_ea, void *data, uint32_t tag) |
[MPU] Begins peek operation on a task queue. (Task Switch Call) | |
int | mars_task_queue_peek_end (uint64_t queue_ea, uint32_t tag) |
[MPU] Completes peek operation on a task queue. | |
int | mars_task_queue_try_peek (uint64_t queue_ea, void *data) |
[MPU] Pops data from a task queue without removing it. | |
int | mars_task_queue_try_peek_begin (uint64_t queue_ea, void *data, uint32_t tag) |
[MPU] Begins peek operation on a task queue. |
From either a host program or MARS task you can push data into the queue and also from either a host program or MARS task you can pop data out from the queue as soon as it becomes available.
The advantage of the MARS task queue is that when a MARS task requests to do a pop and no data is available yet to be received from the queue, the MARS task will enter a waiting state. As soon as data is available to be popped from the queue, the MARS task can be scheduled for resumed execution with the received data.
int mars_task_queue_create | ( | struct mars_context * | mars, | |
struct mars_task_queue ** | queue, | |||
uint32_t | size, | |||
uint32_t | depth, | |||
uint8_t | direction | |||
) |
[host] Creates a task queue.
This function will allocate an instance of the task queue. The queue allows for tasks to wait until data is available from a FIFO data queue. The queue should be used in pairs with various calls to push and pop the the queue
Key Parameters:
size
depth
direction
[in] | mars | - pointer to MARS context |
[out] | queue | - address of pointer to queue instance |
[in] | size | - size of each data item in data buffer |
[in] | depth | - maximum number of data entries in data buffer |
[in] | direction | - direction of the event flag |
int mars_task_queue_destroy | ( | struct mars_task_queue * | queue | ) |
[host] Destroys a task queue.
This function will free any resources allocated during creation of the task queue.
[in] | queue | - pointer to queue instance |
int mars_task_queue_count | ( | struct mars_task_queue * | queue, | |
uint32_t * | count | |||
) |
[host] Returns the number of data items in the task queue.
This function will return the total number of data items in the queue at the time of the call.
[in] | queue | - pointer to queue instance |
[out] | count | - pointer to variable to store return count |
int mars_task_queue_clear | ( | struct mars_task_queue * | queue | ) |
[host] Clears the data items in the task queue.
This function will clear all data items currently in the queue. Tasks waiting to pop data from the queue will remain waiting. Tasks waiting to push data into the queue will resume.
[in] | queue | - pointer to queue instance |
int mars_task_queue_push | ( | struct mars_task_queue * | queue, | |
const void * | data | |||
) |
[host] Pushes the data specified into the task queue.
This function will push the data specified into the queue. The task waiting longest to pop data from the queue can resume.
If the queue is full at the time of this call, this function will block until there is room in the queue to push the data.
Key Parameters:
data
[in] | queue | - pointer to queue instance |
[in] | data | - address of data to be pushed into queue |
int mars_task_queue_try_push | ( | struct mars_task_queue * | queue, | |
const void * | data | |||
) |
[host] Pushes the data specified into the task queue.
This function will push the data specified into the queue. The task waiting longest to pop data from the queue can resume.
If the queue is full at the time of this call, this function will not block and returns immediately with MARS_ERROR_BUSY.
Key Parameters:
data
[in] | queue | - pointer to queue instance |
[in] | data | - address of data to be pushed into queue |
int mars_task_queue_pop | ( | struct mars_task_queue * | queue, | |
void * | data | |||
) |
[host] Pops data from a task queue.
This function will pop data from the queue.
If the queue is empty at the time of this call, this function will block until there is data to be popped from the queue.
Key Parameters:
data
[in] | queue | - pointer to task instance |
[in] | data | - address of data to be popped from queue |
int mars_task_queue_try_pop | ( | struct mars_task_queue * | queue, | |
void * | data | |||
) |
[host] Pops data from a task queue.
This function will pop data from the queue.
If the queue is empty at the time of this call, this function will not block and returns immediately with MARS_ERROR_BUSY.
Key Parameters:
data
[in] | queue | - pointer to task instance |
[in] | data | - address of data to be popped from queue |
int mars_task_queue_peek | ( | struct mars_task_queue * | queue, | |
void * | data | |||
) |
[host] Pops data from a task queue without removing it.
This function will retrieve data from the queue without removing it from the queue.
If the queue is empty at the time of this call, this function will block until there is data to be retrieved from the queue.
Key Parameters:
data
[in] | queue | - pointer to task instance |
[in] | data | - address of data to be popped from queue |
int mars_task_queue_try_peek | ( | struct mars_task_queue * | queue, | |
void * | data | |||
) |
[host] Pops data from a task queue without removing it.
This function will retrieve data from the queue.
If the queue is empty at the time of this call, this function will not block and returns immediately with MARS_ERROR_BUSY.
Key Parameters:
data
[in] | queue | - pointer to task instance |
[in] | data | - address of data to be popped from queue |
int mars_task_queue_count | ( | uint64_t | queue_ea, | |
uint32_t * | count | |||
) |
[MPU] Returns the number of data items in the task queue.
This function will return the total number of data items in the queue at the time of the call.
[in] | queue_ea | - ea of initialized queue instance |
[out] | count | - pointer to variable to store return count |
int mars_task_queue_clear | ( | uint64_t | queue_ea | ) |
[MPU] Clears the data items in the task queue.
This function will clear all data items currently in the queue. Entities waiting to pop data from the queue will remain waiting. Entities waiting to push data into the queue will resume.
[in] | queue_ea | - ea of initialized queue instance |
int mars_task_queue_push | ( | uint64_t | queue_ea, | |
const void * | data | |||
) |
[MPU] Pushes the data specified into the task queue. (Task Switch Call)
If the queue is full at the time of this call, this function will cause the caller task to enter a waiting state until there is room in the queue to push the data.
Key Parameters:
data
[in] | queue_ea | - ea of initialized queue instance |
[in] | data | - address of data to be pushed into queue |
int mars_task_queue_push_begin | ( | uint64_t | queue_ea, | |
const void * | data, | |||
uint32_t | tag | |||
) |
[MPU] Begins push operation on a task queue. (Task Switch Call)
If the queue is full at the time of this call, this function will cause the caller task to enter a waiting state until there is room in the queue to push the data.
Key Parameters:
data
tag
[in] | queue_ea | - ea of initialized queue instance |
[in] | data | - address of data to be pushed into queue |
[in] | tag | - tag identifier for memory transfer |
int mars_task_queue_push_end | ( | uint64_t | queue_ea, | |
uint32_t | tag | |||
) |
[MPU] Completes push operation on a task queue.
This function will complete a push operation initiated with mars_task_queue_push_begin or mars_task_queue_try_push_begin. This function must be called in pair for each call to mars_task_queue_push_begin or mars_task_queue_try_push_begin to guarantee the completion of the initiated push operation.
Key Parameters:
tag
[in] | queue_ea | - ea of initialized queue instance |
[in] | tag | - tag identifier for memory transfer |
int mars_task_queue_try_push | ( | uint64_t | queue_ea, | |
const void * | data | |||
) |
[MPU] Pushes the data specified into the task queue.
This function will push the data specified into the queue. The entity waiting longest to pop data from the queue can resume.
If the queue is full at the time of this call, this function will return immedately with MARS_ERROR_BUSY.
Key Parameters:
data
[in] | queue_ea | - ea of initialized queue instance |
[in] | data | - address of data to be pushed into queue |
int mars_task_queue_try_push_begin | ( | uint64_t | queue_ea, | |
const void * | data, | |||
uint32_t | tag | |||
) |
[MPU] Begins push operation on a task queue.
This function will begin pushing the data specified into the queue. This only initiates the memory transfer of data into the queue. This function must be completed with a matching call to mars_task_queue_push_end to guarantee the completion of the push.
If the queue is full at the time of this call, this function will return immedately with MARS_ERROR_BUSY.
Key Parameters:
data
tag
[in] | queue_ea | - ea of initialized queue instance |
[in] | data | - address of data to be pushed into queue |
[in] | tag | - tag identifier for memory transfer |
int mars_task_queue_pop | ( | uint64_t | queue_ea, | |
void * | data | |||
) |
[MPU] Pops data from a task queue. (Task Switch Call)
If the queue is empty at the time of this call, this function will cause the caller task to enter a waiting state until there is data in the queue to pop.
Key Parameters:
data
[in] | queue_ea | - ea of initialized queue instance |
[in] | data | - address of data to be popped from queue |
int mars_task_queue_pop_begin | ( | uint64_t | queue_ea, | |
void * | data, | |||
uint32_t | tag | |||
) |
[MPU] Begins pop operation on a task queue. (Task Switch Call)
If the queue is empty at the time of this call, this function will cause the caller task to enter a waiting state until there is data in the queue to pop.
Key Parameters:
data
[in] | queue_ea | - ea of initialized queue instance |
[in] | data | - address of data to be popped from queue |
[in] | tag | - tag identifier for memory transfer |
int mars_task_queue_pop_end | ( | uint64_t | queue_ea, | |
uint32_t | tag | |||
) |
[MPU] Completes pop operation on a task queue.
This function will complete a pop operation initiated with mars_task_queue_pop_begin or mars_task_queue_try_pop_begin. This function must be called in pair for each call to mars_task_queue_pop_begin or mars_task_queue_try_pop_begin to guarantee the completion of the initiated pop operation.
Key Parameters:
tag
[in] | queue_ea | - ea of initialized queue instance |
[in] | tag | - tag identifier for memory transfer |
int mars_task_queue_try_pop | ( | uint64_t | queue_ea, | |
void * | data | |||
) |
[MPU] Pops data from a task queue.
This function will pop data from the queue.
If the queue is empty at the time of this call, this function will return immedately with MARS_ERROR_BUSY.
Key Parameters:
data
[in] | queue_ea | - ea of initialized queue instance |
[in] | data | - address for data to be popped from queue |
int mars_task_queue_try_pop_begin | ( | uint64_t | queue_ea, | |
void * | data, | |||
uint32_t | tag | |||
) |
[MPU] Begins pop operation on a task queue.
This function will begin popping data from the queue. This only initiates the memory transfer of data from the queue. This function must be completed with a matching call to mars_task_queue_pop_end to guarantee the completion of the pop.
If the queue is empty at the time of this call, this function will return immedately with MARS_ERROR_BUSY.
Key Parameters:
data
[in] | queue_ea | - ea of initialized queue instance |
[in] | data | - address for data to be popped from queue |
[in] | tag | - tag identifier for memory transfer |
int mars_task_queue_peek | ( | uint64_t | queue_ea, | |
void * | data | |||
) |
[MPU] Pops data from a task queue without removing it. (Task Switch Call)
If the queue is empty at the time of this call, this function will cause the caller task to enter a waiting state until there is data in the queue to be retrieved.
Key Parameters:
data
[in] | queue_ea | - ea of initialized queue instance |
[in] | data | - address of data to be popped from queue |
int mars_task_queue_peek_begin | ( | uint64_t | queue_ea, | |
void * | data, | |||
uint32_t | tag | |||
) |
[MPU] Begins peek operation on a task queue. (Task Switch Call)
If the queue is empty at the time of this call, this function will cause the caller task to enter a waiting state until there is data in the queue to be retrived.
Key Parameters:
data
[in] | queue_ea | - ea of initialized queue instance |
[in] | data | - address of data to be popped from queue |
[in] | tag | - tag identifier for memory transfer |
int mars_task_queue_peek_end | ( | uint64_t | queue_ea, | |
uint32_t | tag | |||
) |
[MPU] Completes peek operation on a task queue.
This function will complete a peek operation initiated with mars_task_queue_peek_begin or mars_task_queue_try_peek_begin. This function must be called in pair for each call to mars_task_queue_peek_begin or mars_task_queue_try_peek_begin to guarantee the completion of the initiated peek operation.
Key Parameters:
tag
[in] | queue_ea | - ea of initialized queue instance |
[in] | tag | - tag identifier for memory transfer |
int mars_task_queue_try_peek | ( | uint64_t | queue_ea, | |
void * | data | |||
) |
[MPU] Pops data from a task queue without removing it.
This function will retrieve data from the queue without removing it from the queue.
If the queue is empty at the time of this call, this function will return immedately with MARS_ERROR_BUSY.
Key Parameters:
data
[in] | queue_ea | - ea of initialized queue instance |
[in] | data | - address of data to be popped from queue |
int mars_task_queue_try_peek_begin | ( | uint64_t | queue_ea, | |
void * | data, | |||
uint32_t | tag | |||
) |
[MPU] Begins peek operation on a task queue.
This function will begin retriveing data from the queue without removing the data from the queue. This only initiates the memory transfer of data from the queue. This function must be completed with a matching call to mars_task_queue_peek_end to guarantee the completion of the peek.
If the queue is empty at the time of this call, this function will return immedately with MARS_ERROR_BUSY.
Key Parameters:
data
[in] | queue_ea | - ea of initialized queue instance |
[in] | data | - address of data to be popped from queue |
[in] | tag | - tag identifier for memory transfer |