Visible to Intel only — GUID: iga1401399016992
Ixiasoft
Visible to Intel only — GUID: iga1401399016992
Ixiasoft
14.4.2. Hardware Access Routines
Function Name | Description |
---|---|
altera_avalon_mutex_open() | Claims a handle to a mutex, enabling all the other functions to access the mutex core. |
altera_avalon_mutex_trylock() | Tries to lock the mutex. Returns immediately if it fails to lock the mutex. |
altera_avalon_mutex_lock() | Locks the mutex. Will not return until it has successfully claimed the mutex. |
altera_avalon_mutex_unlock() | Unlocks the mutex. |
altera_avalon_mutex_is_mine() | Determines if this CPU owns the mutex. |
altera_avalon_mutex_first_lock() | Tests whether the mutex has been released since reset. |
These routines coordinate access to the software mutex structure using a hardware mutex core. For a complete description of each function, see section the Mutex API section.
The code shown in below demonstrates opening a mutex device handle and locking a mutex.
#include <altera_avalon_mutex.h>
/* get the mutex device handle */ alt_mutex_dev* mutex = altera_avalon_mutex_open( “/dev/mutex” );
/* acquire the mutex, setting the value to one */ altera_avalon_mutex_lock( mutex, 1 );
/* * Access a shared resource here. */
/* release the lock */
altera_avalon_mutex_unlock( mutex );