Files | |
file | mutex_types.h |
[host/MPU] MARS Mutex Types | |
file | mutex.h |
[host] MARS Mutex API | |
file | mutex.h |
[MPU] MARS Mutex API | |
Data Structures | |
struct | mars_mutex |
MARS mutex structure. More... | |
Functions | |
int | mars_mutex_create (uint64_t *mutex_ea) |
[host] Creates a mutex. | |
int | mars_mutex_destroy (uint64_t mutex_ea) |
[host] Destroys a mutex. | |
int | mars_mutex_reset (uint64_t mutex_ea) |
[host] Resets a mutex. | |
int | mars_mutex_lock (uint64_t mutex_ea) |
[host] Locks a mutex. | |
int | mars_mutex_unlock (uint64_t mutex_ea) |
[host] Unlocks a mutex. | |
int | mars_mutex_lock_get (uint64_t mutex_ea, struct mars_mutex *mutex) |
[MPU] Locks a mutex. | |
int | mars_mutex_unlock_put (uint64_t mutex_ea, struct mars_mutex *mutex) |
[MPU] Unlocks a mutex. | |
Variables | |
struct mars_mutex | MARS_MUTEX_ALIGN |
MARS mutex structure. |
The MARS mutex is independent of the MARS context or MARS workload model. A MARS mutex can be used in a host program without even creating a MARS context. A MARS mutex can also be used in an MPU program independent of any MARS workload model or API. However, an MPU program independent of any MARS workload model means the user will be responsible for the loading and execution of such a program and has close to no meaning with regards to the usage of MARS.
The MARS mutex does not call into the MARS kernel's scheduler. This means that when some entity attempts to lock a mutex that is already locked, the mutex will block execution of the entity until the lock can be obtained. For the MPU-side, this means that the MARS kernel can not schedule any other workloads while a MARS mutex is waiting to lock.
int mars_mutex_create | ( | uint64_t * | mutex_ea | ) |
[host] Creates a mutex.
This function creates a mutex instance that can be locked or unlocked from both host and MPU to restrict concurrent accesses.
[in] | mutex_ea | - address of 64-bit address of mutex instance |
int mars_mutex_destroy | ( | uint64_t | mutex_ea | ) |
[host] Destroys a mutex.
This function destroys a mutex instance.
[in] | mutex_ea | - 64-bit address of mutex instance |
int mars_mutex_reset | ( | uint64_t | mutex_ea | ) |
[host] Resets a mutex.
This function resets a mutex instance and forces it into an unlocked state regardless of whether it is locked or unlocked.
[in] | mutex_ea | - 64-bit address of mutex instance |
int mars_mutex_lock | ( | uint64_t | mutex_ea | ) |
[host] Locks a mutex.
[MPU] Locks a mutex.
This function locks a mutex and blocks other requests to lock it.
[in] | mutex_ea | - 64-bit address of mutex instance |
[in] | mutex_ea | - ea of mutex instance to lock |
int mars_mutex_unlock | ( | uint64_t | mutex_ea | ) |
[host] Unlocks a mutex.
[MPU] Unlocks a mutex.
This function unlocks a previously locked mutex to allow other lock requests.
[in] | mutex_ea | - 64-bit address of mutex instance |
[in] | mutex_ea | - ea of mutex instance to unlock |
int mars_mutex_lock_get | ( | uint64_t | mutex_ea, | |
struct mars_mutex * | mutex | |||
) |
[MPU] Locks a mutex.
This function locks a mutex and blocks other requests to lock it. It also loads the mutex instance from the effective address specified into the local mutex instance.
[in] | mutex_ea | - ea of mutex instance to lock |
[in] | mutex | - pointer to local mutex instance |
int mars_mutex_unlock_put | ( | uint64_t | mutex_ea, | |
struct mars_mutex * | mutex | |||
) |
[MPU] Unlocks a mutex.
This function unlocks a previously locked mutex to allow other lock requests. It also stores the local mutex instance into the effective address specified.
[in] | mutex_ea | - ea of mutex instance to unlock |
[in] | mutex | - pointer to local mutex instance |
struct mars_mutex MARS_MUTEX_ALIGN |
MARS mutex structure.
An instance of this structure must be created when using the MARS Mutex API.