Driver API for EVSYS (plib_evsys.h)
More...
Driver API for EVSYS (plib_evsys.h)
Usage Example
The following example demonstrates typical usage of the EVSYS peripheral:
#include <stdint.h>
int configure_evsys(void)
{
return 0;
}
#define EVSYS_ONDEMAND_DISABLE
Definition plib_evsys.h:60
bool EVSYS_SetEventChannel(uint8_t channel, uint32_t generator, uint32_t path, uint32_t edge, uint32_t run_standby, uint32_t on_demand)
Configure an EVSYS event channel.
void EVSYS_ResetSoftware(void)
Perform a software reset of the EVSYS peripheral.
#define EVSYS_RUNSTDBY_ENABLE
Definition plib_evsys.h:61
void EVSYS_EnableUser(uint8_t channel, uint8_t user)
Connect an EVSYS user to a channel.
◆ EVSYS_ONDEMAND_DISABLE
| #define EVSYS_ONDEMAND_DISABLE 0U |
◆ EVSYS_ONDEMAND_ENABLE
| #define EVSYS_ONDEMAND_ENABLE 1U |
◆ EVSYS_RUNSTDBY_DISABLE
| #define EVSYS_RUNSTDBY_DISABLE 0U |
◆ EVSYS_RUNSTDBY_ENABLE
| #define EVSYS_RUNSTDBY_ENABLE 1U |
◆ EVSYS_CALLBACK_HANDLER
EVSYS interrupt callback function type.
The callback is invoked from the EVSYS interrupt handler when an Event Detected (EVDn) or Overrun (OVRn) interrupt occurs.
- Parameters
-
| int_cause | Bitmask indicating the interrupt cause. |
◆ EVSYS_ChannelIsBusy()
| bool EVSYS_ChannelIsBusy |
( |
uint8_t | channel | ) |
|
Check whether an EVSYS channel is busy.
- Parameters
-
| channel | EVSYS channel number |
- Returns
- true if the channel is busy, false otherwise
◆ EVSYS_DisableInterrupt()
| void EVSYS_DisableInterrupt |
( |
uint32_t | interrupt_mask | ) |
|
Disable EVSYS interrupts.
- Parameters
-
| interrupt_mask | Interrupt disable bitmask |
◆ EVSYS_DisableUser()
| void EVSYS_DisableUser |
( |
uint8_t | user | ) |
|
Disconnect an EVSYS user from its channel.
- Parameters
-
◆ EVSYS_EnableInterrupt()
| void EVSYS_EnableInterrupt |
( |
uint32_t | interrupt_mask | ) |
|
Enable EVSYS interrupts.
Enables one or more EVSYS interrupt sources using a bitmask.
NOTE:
- Interrupts are only generated for SYNC and RESYNC paths.
- Asynchronous paths never generate EVSYS interrupts.
- Parameters
-
| interrupt_mask | Interrupt enable bitmask |
◆ EVSYS_EnableUser()
| void EVSYS_EnableUser |
( |
uint8_t | channel, |
|
|
uint8_t | user ) |
Connect an EVSYS user to a channel.
Each user can be connected to only one channel at a time.
- Parameters
-
| channel | EVSYS channel number |
| user | Event user ID |
◆ EVSYS_ResetSoftware()
| void EVSYS_ResetSoftware |
( |
void | | ) |
|
Perform a software reset of the EVSYS peripheral.
Resets all EVSYS registers to their default values. All event channels, users, and generators are disabled.
◆ EVSYS_SetCallbackHandler()
Register a callback handler for an EVSYS channel.
- Parameters
-
| channel | EVSYS channel number |
| callback | Callback function |
◆ EVSYS_SetEventChannel()
| bool EVSYS_SetEventChannel |
( |
uint8_t | channel, |
|
|
uint32_t | generator, |
|
|
uint32_t | path, |
|
|
uint32_t | edge, |
|
|
uint32_t | run_standby, |
|
|
uint32_t | on_demand ) |
Configure an EVSYS event channel.
This function configures all routing-related parameters of an EVSYS channel using a single atomic write to the CHANNEL[n] register.
- IMPORTANT:
- For SYNC/RESYNC paths, the channel must not be busy.
- Asynchronous path does NOT generate EVSYS interrupts.
- Parameters
-
| channel | EVSYS channel number |
| generator | Event generator ID |
| path | Channel path selection |
| edge | Edge detection selection |
| run_standby | Run in Standby enable/disable |
| on_demand | On-demand clock enable/disable |
- Returns
- true if configuration was successful, false otherwise
◆ EVSYS_SetSoftwareEvent()
| void EVSYS_SetSoftwareEvent |
( |
uint8_t | channel | ) |
|
Trigger a software-generated event on an EVSYS channel.
- Parameters
-
| channel | EVSYS channel number |
◆ EVSYS_UserIsReady()
| bool EVSYS_UserIsReady |
( |
uint8_t | channel | ) |
|
Check whether all users connected to a channel are ready.
- Parameters
-
| channel | EVSYS channel number |
- Returns
- true if all users are ready, false otherwise
◆ evsys_callback_func
Callback table indexed by EVSYS channel number.