Files | |
file | workload_types.h |
[host/MPU] MARS Workload Types | |
file | workload_queue.h |
[host] MARS Workload Queue API | |
Defines | |
#define | MARS_WORKLOAD_RESERVED_SIZE 128 |
Size of workload module structure. | |
#define | MARS_WORKLOAD_CONTEXT_SIZE 256 |
Size of workload context structure. | |
#define | MARS_WORKLOAD_CONTEXT_ALIGN 128 |
Alignment of workload context structure. | |
Functions | |
int | mars_workload_queue_query (struct mars_context *mars, uint16_t id, int query) |
[host] Returns whether or not specified query is satisfied. | |
int | mars_workload_queue_add_begin (struct mars_context *mars, uint16_t *id, uint64_t *workload_ea, const void *module_elf, const char *module_name) |
[host] Begins adding workload to workload queue. | |
int | mars_workload_queue_add_end (struct mars_context *mars, uint16_t id, int cancel) |
[host] Ends adding of specified workload. | |
int | mars_workload_queue_remove_begin (struct mars_context *mars, uint16_t id, uint64_t *workload_ea) |
[host] Begins removing workload from workload queue. | |
int | mars_workload_queue_remove_end (struct mars_context *mars, uint16_t id, int cancel) |
[host] Ends removing of specified workload. | |
int | mars_workload_queue_schedule_begin (struct mars_context *mars, uint16_t id, uint8_t priority, uint64_t *workload_ea) |
[host] Begins scheduling of specified workload. | |
int | mars_workload_queue_schedule_end (struct mars_context *mars, uint16_t id, int cancel) |
[host] Ends scheduling of specified workload. | |
int | mars_workload_queue_unschedule_begin (struct mars_context *mars, uint16_t id, uint64_t *workload_ea) |
[host] Begins unscheduling of specified workload. | |
int | mars_workload_queue_unschedule_end (struct mars_context *mars, uint16_t id) |
[host] Ends unscheduling of specified workload. | |
int | mars_workload_queue_wait (struct mars_context *mars, uint16_t id, uint64_t *workload_ea) |
[host] Waits for specified workload to finish. | |
int | mars_workload_queue_try_wait (struct mars_context *mars, uint16_t id, uint64_t *workload_ea) |
[host] Waits for specified workload to finish. | |
int | mars_workload_queue_signal_send (struct mars_context *mars, uint16_t id) |
[host] Sends signal to specified workload. |
The workload queue API provides the basic funtions to create, schedule, remove a workload context within the workload queue. It also provides APIs to do signal handling of workloads and to wait for specific workloads to complete.
int mars_workload_queue_query | ( | struct mars_context * | mars, | |
uint16_t | id, | |||
int | query | |||
) |
[host] Returns whether or not specified query is satisfied.
[in] | mars | - address of pointer to MARS context |
[in] | id | - id of workload |
[in] | query | - query type |
int mars_workload_queue_add_begin | ( | struct mars_context * | mars, | |
uint16_t * | id, | |||
uint64_t * | workload_ea, | |||
const void * | module_elf, | |||
const char * | module_name | |||
) |
[host] Begins adding workload to workload queue.
This function will begin the process to add a workload to the workload queue. This only initiates the add operation. This function must be completed with a matching call to mars_workload_queue_add_end to guarantee the completion of the add operation.
If workload_ea is not NULL, the ea of the workload will be returned.
The workload adding process is not completed until the matching call to mars_workload_queue_add_end is made. The user should make any necessary updates to the returned workload context in between this begin call and the end call.
[in] | mars | - address of pointer to MARS context |
[out] | id | - pointer to return workload id |
[out] | workload_ea | - address of pointer to workload context ea |
[in] | module_elf | - pointer to workload module elf image |
[in] | module_name | - name of module |
int mars_workload_queue_add_end | ( | struct mars_context * | mars, | |
uint16_t | id, | |||
int | cancel | |||
) |
[host] Ends adding of specified workload.
This function will complete a add operation previously initiated with mars_workload_queue_add_begin. This function must be called in pair for each call to mars_workload_queue_add_begin to guarantee the completion of the initiated add operation.
[in] | mars | - address of pointer to MARS context |
[in] | id | - id of workload to end add |
[in] | cancel | - cancels the add operation |
int mars_workload_queue_remove_begin | ( | struct mars_context * | mars, | |
uint16_t | id, | |||
uint64_t * | workload_ea | |||
) |
[host] Begins removing workload from workload queue.
This function will begin the process to remove a workload from the workload queue. This only initiates the remove operation. This function must be completed with a matching call to mars_workload_queue_remove_end to guarantee the completion of the remove operation.
If workload_ea is not NULL, the ea of the workload will be returned.
The workload removing process is not completed until the matching call to mars_workload_queue_remove_end is made. The user should make any necessary updates to the returned workload context in between this begin call and the end call.
[in] | mars | - address of pointer to MARS context |
[in] | id | - id of workload to begin remove |
[out] | workload_ea | - address of pointer to workload context ea |
int mars_workload_queue_remove_end | ( | struct mars_context * | mars, | |
uint16_t | id, | |||
int | cancel | |||
) |
[host] Ends removing of specified workload.
This function will complete a remove operation previously initiated with mars_workload_queue_remove_begin. This function must be called in pair for each call to mars_workload_queue_remove_begin to guarantee the completion of the initiated remove operation.
[in] | mars | - address of pointer to MARS context |
[in] | id | - id of workload |
[in] | cancel | - cancels the remove operation |
int mars_workload_queue_schedule_begin | ( | struct mars_context * | mars, | |
uint16_t | id, | |||
uint8_t | priority, | |||
uint64_t * | workload_ea | |||
) |
[host] Begins scheduling of specified workload.
This function will begin scheduling the workload specified. This only initiates the scheduling of the workload. This function must be completed with a matching call to mars_workload_queue_schedule_end to guarantee the completion of the scheduling.
If workload_ea is not NULL, the ea of the workload will be returned.
The workload scheduling process is not completed until the matching call to mars_workload_queue_schedule_end is made. The user should make any necessary updates to the returned workload context in between this begin call and the end call.
[in] | mars | - address of pointer to MARS context |
[in] | id | - id of workload |
[in] | priority | - scheduling priority of workload |
[out] | workload_ea | - address of pointer to workload context ea |
int mars_workload_queue_schedule_end | ( | struct mars_context * | mars, | |
uint16_t | id, | |||
int | cancel | |||
) |
[host] Ends scheduling of specified workload.
This function will complete a schedule operation previously initiated with mars_workload_queue_schedule_begin. This function must be called in pair for each call to mars_workload_queue_schedule_begin to guarantee the completion of the initiated schedule operation.
[in] | mars | - address of pointer to MARS context |
[in] | id | - id of workload |
[in] | cancel | - cancels the schedule operation |
int mars_workload_queue_unschedule_begin | ( | struct mars_context * | mars, | |
uint16_t | id, | |||
uint64_t * | workload_ea | |||
) |
[host] Begins unscheduling of specified workload.
This function will begin unscheduling the workload specified. This only initiates the unscheduling of the workload. This function must be completed with a matching call to mars_workload_queue_unschedule_end to guarantee the completion of the unscheduling.
If workload_ea is not NULL, the ea of the workload will be returned.
The workload unscheduling process is not completed until the matching call to mars_workload_queue_unschedule_end is made. The user should make any necessary updates to the returned workload context in between this begin call and the end call.
When a workload is unscheduled, it will be put into a finished state and any entities waiting on the workload to finish will be resumed.
If a scheduled workload is unscheduled before execution, the workload will not be executed until a subsequent scheduling request is made.
If the workload is currently in a waiting state, calling unschedule will finish the workload and will not be resumed from the waiting state.
If the workload is currently in a running state, calling unschedule will immediately put the workload into a finished state. However, execution of the workload will only be suspended when the workload yields, waits, or finishes.
[in] | mars | - address of pointer to MARS context |
[in] | id | - id of workload |
[out] | workload_ea | - address of pointer to workload context ea |
int mars_workload_queue_unschedule_end | ( | struct mars_context * | mars, | |
uint16_t | id | |||
) |
[host] Ends unscheduling of specified workload.
This function will complete an unschedule operation previously initiated with mars_workload_queue_unschedule_begin. This function must be called in pair for each call to mars_workload_queue_unschedule_begin to guarantee the completion of the initiated unschedule operation.
[in] | mars | - address of pointer to MARS context |
[in] | id | - id of workload |
int mars_workload_queue_wait | ( | struct mars_context * | mars, | |
uint16_t | id, | |||
uint64_t * | workload_ea | |||
) |
[host] Waits for specified workload to finish.
This function will block and wait until the specified workload finishes.
If workload_ea is not NULL, the ea of the workload will be returned.
[in] | mars | - address of pointer to MARS context |
[in] | id | - id of workload |
[out] | workload_ea | - address of pointer to workload context ea |
int mars_workload_queue_try_wait | ( | struct mars_context * | mars, | |
uint16_t | id, | |||
uint64_t * | workload_ea | |||
) |
[host] Waits for specified workload to finish.
This function will check whether the workload specified is finished or not and return immediately without blocking.
If workload_ea is not NULL, the ea of the workload will be returned.
[in] | mars | - address of pointer to MARS context |
[in] | id | - id of workload |
[out] | workload_ea | - address of pointer to workload context ea |
int mars_workload_queue_signal_send | ( | struct mars_context * | mars, | |
uint16_t | id | |||
) |
[host] Sends signal to specified workload.
This function will send a signal to the specified workload.
[in] | mars | - address of pointer to MARS context |
[in] | id | - id of workload |