![]() |
mutex
Vitis Drivers API Documentation
|
Macros | |
| #define | XMutex_ReadReg(BaseAddress, MutexNumber, RegOffset) Xil_In32((BaseAddress) + XMutex_Offset(MutexNumber) + (RegOffset)) |
| Reads one of the Mutex registers. More... | |
| #define | XMutex_WriteReg(BaseAddress, MutexNumber, RegOffset, ValueToWrite) |
| Writes a value to a Mutex register. More... | |
Functions | |
| int | XMutex_CfgInitialize (XMutex *InstancePtr, XMutex_Config *ConfigPtr, UINTPTR EffectiveAddress) |
| Initializes a specific Mutex instance. More... | |
| void | XMutex_Lock (XMutex *InstancePtr, u8 MutexNumber) |
| Locks a Mutex within a Mutex device. More... | |
| int | XMutex_Trylock (XMutex *InstancePtr, u8 MutexNumber) |
| Tries to lock a Mutex without blocking. More... | |
| int | XMutex_Unlock (XMutex *InstancePtr, u8 MutexNumber) |
| Unlocks a Mutex within a Mutex device. More... | |
| int | XMutex_IsLocked (XMutex *InstancePtr, u8 MutexNumber) |
| Returns whether a Mutex is locked. More... | |
| void | XMutex_GetStatus (XMutex *InstancePtr, u8 MutexNumber, u32 *Locked, u32 *Owner) |
| Gets the lock status and owner of a Mutex. More... | |
| int | XMutex_GetUser (XMutex *InstancePtr, u8 MutexNumber, u32 *User) |
| Reads the USER register of a Mutex. More... | |
| int | XMutex_SetUser (XMutex *InstancePtr, u8 MutexNumber, u32 User) |
| Writes the USER register of a Mutex. More... | |
| int | XMutex_SelfTest (XMutex *InstancePtr) |
| Runs a destructive self-test on a Mutex core. More... | |
| XMutex_Config * | XMutex_LookupConfig (UINTPTR BaseAddress) |
| Looks up Mutex configuration by device ID or base address. More... | |
Register Offset Definitions | |
Register offsets within a Mutex, there are multiple Mutexes within a single device | |
| #define | XMU_MUTEX_REG_OFFSET 0 |
| Mutex register. More... | |
| #define | XMU_USER_REG_OFFSET 4 |
| User register. More... | |
Mutex Register Bit Definitions | |
| #define | LOCKED_BIT 0x00000001 |
| This is the Lock bit. More... | |
| #define | OWNER_MASK 0x000001FE |
| This is CPU_ID Mask. More... | |
| #define | OWNER_SHIFT 0x00000001 |
| This is CPU_ID Shift. More... | |
| #define LOCKED_BIT 0x00000001 |
This is the Lock bit.
Set to 1 indicates that the lock is currently owned by the processor ID specified by the CPU_ID (OWNER_MASK) in this register. Set to 0 indicates that the lock is free.
Referenced by XMutex_GetStatus(), XMutex_IsLocked(), XMutex_Lock(), XMutex_SelfTest(), and XMutex_Trylock().
| #define OWNER_MASK 0x000001FE |
This is CPU_ID Mask.
CPU_ID indicates the ID the processor holding the lock.
Referenced by XMutex_GetStatus(), and XMutex_Unlock().
| #define OWNER_SHIFT 0x00000001 |
This is CPU_ID Shift.
Referenced by XMutex_GetStatus(), XMutex_Lock(), XMutex_Trylock(), and XMutex_Unlock().
| #define XMU_MUTEX_REG_OFFSET 0 |
Mutex register.
Referenced by XMutex_GetStatus(), XMutex_IsLocked(), XMutex_Lock(), XMutex_Trylock(), and XMutex_Unlock().
| #define XMU_USER_REG_OFFSET 4 |
User register.
Referenced by XMutex_GetUser(), and XMutex_SetUser().
| #define XMutex_ReadReg | ( | BaseAddress, | |
| MutexNumber, | |||
| RegOffset | |||
| ) | Xil_In32((BaseAddress) + XMutex_Offset(MutexNumber) + (RegOffset)) |
Reads one of the Mutex registers.
Read one of the Mutex registers.
| [in] | BaseAddress | Contains the base address of the Mutex device. |
| [in] | MutexNumber | Contains the specific Mutex within the device, a zero based number, 0 - (NumMutexConfigured in HW - 1). |
| [in] | RegOffset | Contains the offset from the 1st register of the Mutex to select the specific register of the Mutex. |
Referenced by XMutex_GetStatus(), XMutex_GetUser(), XMutex_IsLocked(), XMutex_Lock(), XMutex_Trylock(), and XMutex_Unlock().
| #define XMutex_WriteReg | ( | BaseAddress, | |
| MutexNumber, | |||
| RegOffset, | |||
| ValueToWrite | |||
| ) |
Writes a value to a Mutex register.
Write a specified value to a register of a Mutex.
| [in] | BaseAddress | Base address of the Mutex device. |
| [in] | MutexNumber | Specific Mutex within the device, a zero based number, 0 - (NumMutexConfigured in HW - 1). |
| [in] | RegOffset | Contains the offset from the 1st register of the Mutex to select the specific register of the Mutex. |
| [in] | ValueToWrite | 32 bit value to be written to the register. |
Referenced by XMutex_Lock(), XMutex_SetUser(), XMutex_Trylock(), and XMutex_Unlock().
| int XMutex_CfgInitialize | ( | XMutex * | InstancePtr, |
| XMutex_Config * | ConfigPtr, | ||
| UINTPTR | EffectiveAddress | ||
| ) |
Initializes a specific Mutex instance.
Initializes a specific Mutex instance/driver.
| [out] | InstancePtr | Pointer to the XMutex instance to be worked on. |
| [in] | ConfigPtr | Device configuration structure containing required HW build data. |
| [in] | EffectiveAddress | Physical address of the hardware in a Virtual Memory operating system environment. It is the Base Address in a stand alone environment. |
References XMutex_Config::BaseAddress, XMutex::Config, XMutex::IsReady, XMutex_Config::NumMutex, and XMutex_Unlock().
Referenced by MutexExample().
| void XMutex_GetStatus | ( | XMutex * | InstancePtr, |
| u8 | MutexNumber, | ||
| u32 * | Locked, | ||
| u32 * | Owner | ||
| ) |
Gets the lock status and owner of a Mutex.
Gets the current status of a Mutex lock within a Mutex device.
| [in] | InstancePtr | Pointer to the XMutex instance to be worked on. |
| [in] | MutexNumber | Specific Mutex lock within the device to operate on. Each device may contain multiple Mutex locks. The Mutex number is a zero based number with a range of 0 - (InstancePtr->Config.NumMutex - 1). |
| [out] | Locked | Pointer where the current lock status is stored. Sets memory pointed to by 'Locked' to 1 if the Mutex is locked and 0 if it is unlocked. |
| [out] | Owner | Pointer where the current owner status is stored. If the Mutex is locked, the memory pointed to by 'Owner' is updated to reflect the CPU ID that has currently locked this Mutex. |
References XMutex_Config::BaseAddress, XMutex::Config, LOCKED_BIT, OWNER_MASK, OWNER_SHIFT, XMU_MUTEX_REG_OFFSET, and XMutex_ReadReg.
Referenced by XMutex_SelfTest().
| int XMutex_GetUser | ( | XMutex * | InstancePtr, |
| u8 | MutexNumber, | ||
| u32 * | User | ||
| ) |
Reads the USER register of a Mutex.
Gets the USER register of a Mutex lock within a Mutex device.
| [in] | InstancePtr | Pointer to the XMutex instance to be worked on. |
| [in] | MutexNumber | Specific Mutex lock within the device to operate on. Each device may contain multiple Mutex locks. The Mutex number is a zero based number with a range of 0 - (InstancePtr->Config.NumMutex - 1). |
| [out] | User | Pointer to an u32 where the current user register value is stored by this function. |
References XMutex_Config::BaseAddress, XMutex::Config, XMutex_Config::UserReg, XMU_USER_REG_OFFSET, and XMutex_ReadReg.
| int XMutex_IsLocked | ( | XMutex * | InstancePtr, |
| u8 | MutexNumber | ||
| ) |
Returns whether a Mutex is locked.
Gets the current lock state of a Mutex lock within a Mutex device.
| [in] | InstancePtr | Pointer to the XMutex instance to be worked on. |
| [in] | MutexNumber | Specific Mutex lock within the device to operate on. Each device may contain multiple Mutex locks. The Mutex number is a zero based number with a range of 0 - (InstancePtr->Config.NumMutex - 1). |
References XMutex_Config::BaseAddress, XMutex::Config, LOCKED_BIT, XMU_MUTEX_REG_OFFSET, and XMutex_ReadReg.
Referenced by XMutex_SelfTest().
| void XMutex_Lock | ( | XMutex * | InstancePtr, |
| u8 | MutexNumber | ||
| ) |
Locks a Mutex within a Mutex device.
Locks a particular Mutex lock within a Mutex device. Call blocks till the Mutex is locked.
| [in] | InstancePtr | Pointer to the XMutex instance to be worked on. |
| [in] | MutexNumber | Specific Mutex lock within the device to operate on. Each device may contain multiple Mutex locks. The Mutex number is a zero based number with a range of 0 - (InstancePtr->Config.NumMutex - 1). |
References XMutex_Config::BaseAddress, XMutex::Config, LOCKED_BIT, OWNER_SHIFT, XMU_MUTEX_REG_OFFSET, XMutex_ReadReg, and XMutex_WriteReg.
Referenced by MutexExample(), and XMutex_SelfTest().
| XMutex_Config* XMutex_LookupConfig | ( | UINTPTR | BaseAddress | ) |
Looks up Mutex configuration by device ID or base address.
Looks up the device configuration based on the unique device ID/BaseAddress. The XMutex_ConfigTable[] contains the configuration info for each device in the system.
| [in] | BaseAddress | Contains the base address of the device. |
References XMutex_Config::Name.
Referenced by MutexExample().
| int XMutex_SelfTest | ( | XMutex * | InstancePtr | ) |
Runs a destructive self-test on a Mutex core.
Selftest a particular Mutex hardware core.
| [in] | InstancePtr | Pointer to the XMutex instance to be worked on. |
References XMutex::Config, LOCKED_BIT, XMutex_Config::NumMutex, XMutex_GetStatus(), XMutex_IsLocked(), XMutex_Lock(), and XMutex_Unlock().
| int XMutex_SetUser | ( | XMutex * | InstancePtr, |
| u8 | MutexNumber, | ||
| u32 | User | ||
| ) |
Writes the USER register of a Mutex.
Sets the USER register of a Mutex lock within a Mutex device.
| [in] | InstancePtr | Pointer to the XMutex instance to be worked on. |
| [in] | MutexNumber | Specific Mutex lock within the device to operate on. Each device may contain multiple Mutex locks. The Mutex number is a zero based number with a range of 0 - (InstancePtr->Config.NumMutex - 1). |
| [in] | User | Value to update the USER register with. |
References XMutex_Config::BaseAddress, XMutex::Config, XMutex_Config::UserReg, XMU_USER_REG_OFFSET, and XMutex_WriteReg.
| int XMutex_Trylock | ( | XMutex * | InstancePtr, |
| u8 | MutexNumber | ||
| ) |
Tries to lock a Mutex without blocking.
Locks a particular Mutex lock within a Mutex device. Call returns immediately if the Mutex is already locked (This is Non-Blocking call).
| [in] | InstancePtr | Pointer to the XMutex instance to be worked on. |
| [in] | MutexNumber | Specific Mutex lock within the device to operate on. Each device may contain multiple Mutex locks. The Mutex number is a zero based number with a range of 0 - (InstancePtr->Config.NumMutex - 1). |
References XMutex_Config::BaseAddress, XMutex::Config, LOCKED_BIT, OWNER_SHIFT, XMU_MUTEX_REG_OFFSET, XMutex_ReadReg, and XMutex_WriteReg.
Referenced by MutexExample().
| int XMutex_Unlock | ( | XMutex * | InstancePtr, |
| u8 | MutexNumber | ||
| ) |
Unlocks a Mutex within a Mutex device.
Unlocks a particular Mutex lock within a Mutex device.
| [in] | InstancePtr | Pointer to the XMutex instance to be worked on. |
| [in] | MutexNumber | Specific Mutex lock within the device to operate on. Each device may contain multiple Mutex locks. The Mutex number is a zero based number with a range of 0 - (InstancePtr->Config.NumMutex - 1). |
References XMutex_Config::BaseAddress, XMutex::Config, OWNER_MASK, OWNER_SHIFT, XMU_MUTEX_REG_OFFSET, XMutex_ReadReg, and XMutex_WriteReg.
Referenced by MutexExample(), XMutex_CfgInitialize(), and XMutex_SelfTest().