Notes
This module defines locks to constitute critical sections by executing the system unlock sequence. This is required to write dedicated registers, such as the OSCCON
register when performing a clock switch.
Example
ao_sys_lock_device_t x;
ao_sys_unlock_device(&x);
{
// ...
// Critical section.
// Device is unlocked.
// ...
}
ao_sys_lock_device(&x);
Include
stdint.h |
Types
ao_sys_lock_device_t
typedef struct ao_sys_lock_device_t ao_sys_lock_device_t;
Represents lock-related data.
Structs
ao_sys_lock_device_t
struct ao_sys_lock_device_t
{
uint32_t dma;
uint32_t ie;
};
dma |
The backup of the DMACON.SUSPEND bit. |
ie |
The backup of the Status register. |
Functions
ao_sys_unlock_device
void ao_sys_unlock_device(ao_sys_lock_device_t * x);
Enters a critical section. First, this function disables interrupts globally and suspends the DMA controller. Then, it performs the system unlock sequence.
ao_sys_lock_device
void ao_sys_lock_device(ao_sys_lock_device_t * x);
Exists a critical section. First, this function performs a system lock. Then, it restores the previous state of both the DMA controller and the global interrupts enable.