CMSIS-Driver_PIC32CM-PL  
Peripheral Library (PLIB) Documentation
 
Loading...
Searching...
No Matches
EVSYS Interface

Driver API for EVSYS (plib_evsys.h) More...

Macros

#define EVSYS_ONDEMAND_ENABLE   1U
 
#define EVSYS_ONDEMAND_DISABLE   0U
 
#define EVSYS_RUNSTDBY_ENABLE   1U
 
#define EVSYS_RUNSTDBY_DISABLE   0U
 

Typedefs

typedef void(* EVSYS_CALLBACK_HANDLER) (uint32_t int_cause)
 EVSYS interrupt callback function type.
 

Functions

void EVSYS_ResetSoftware (void)
 Perform a software reset of the EVSYS peripheral.
 
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.
 
bool EVSYS_ChannelIsBusy (uint8_t channel)
 Check whether an EVSYS channel is busy.
 
bool EVSYS_UserIsReady (uint8_t channel)
 Check whether all users connected to a channel are ready.
 
void EVSYS_EnableUser (uint8_t channel, uint8_t user)
 Connect an EVSYS user to a channel.
 
void EVSYS_DisableUser (uint8_t user)
 Disconnect an EVSYS user from its channel.
 
void EVSYS_SetCallbackHandler (uint8_t channel, EVSYS_CALLBACK_HANDLER callback)
 Register a callback handler for an EVSYS channel.
 
void EVSYS_EnableInterrupt (uint32_t interrupt_mask)
 Enable EVSYS interrupts.
 
void EVSYS_DisableInterrupt (uint32_t interrupt_mask)
 Disable EVSYS interrupts.
 
void EVSYS_SetSoftwareEvent (uint8_t channel)
 Trigger a software-generated event on an EVSYS channel.
 

Variables

volatile EVSYS_CALLBACK_HANDLER evsys_callback_func [EVSYS_CHANNELS]
 Callback table indexed by EVSYS channel number.
 

Description

Driver API for EVSYS (plib_evsys.h)

Usage Example

The following example demonstrates typical usage of the EVSYS peripheral:

#include "plib_evsys.h"
#include <stdint.h>
int configure_evsys(void)
{
/* Perform software reset to put EVSYS into a known state */
/* Configure Event Channel 0, Generator: EIC EXTINT3, Path: Asynchronous, Edge Select: No event output (edge detection handled by EIC), Run Standby: Enable On Demand : Disabled*/
EVSYS_SetEventChannel(0,EVENT_ID_GEN_EIC_EXTINT_3,EVSYS_CHANNEL_PATH_ASYNCHRONOUS_Val,EVSYS_CHANNEL_EDGSEL_NO_EVT_OUTPUT_Val, EVSYS_RUNSTDBY_ENABLE, EVSYS_ONDEMAND_DISABLE );
/* Connect PORT Event User 0 to Event Channel 0 */
EVSYS_EnableUser(0, EVENT_ID_USER_PORT_EV_0);
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.

Macro Definition Documentation

◆ 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

Typedef Documentation

◆ EVSYS_CALLBACK_HANDLER

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_causeBitmask indicating the interrupt cause.

Function Documentation

◆ EVSYS_ChannelIsBusy()

bool EVSYS_ChannelIsBusy ( uint8_t channel)

Check whether an EVSYS channel is busy.

Parameters
channelEVSYS 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_maskInterrupt disable bitmask

◆ EVSYS_DisableUser()

void EVSYS_DisableUser ( uint8_t user)

Disconnect an EVSYS user from its channel.

Parameters
userEvent user ID

◆ 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_maskInterrupt 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
channelEVSYS channel number
userEvent 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()

void EVSYS_SetCallbackHandler ( uint8_t channel,
EVSYS_CALLBACK_HANDLER callback )

Register a callback handler for an EVSYS channel.

Parameters
channelEVSYS channel number
callbackCallback 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
channelEVSYS channel number
generatorEvent generator ID
pathChannel path selection
edgeEdge detection selection
run_standbyRun in Standby enable/disable
on_demandOn-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
channelEVSYS channel number

◆ EVSYS_UserIsReady()

bool EVSYS_UserIsReady ( uint8_t channel)

Check whether all users connected to a channel are ready.

Parameters
channelEVSYS channel number
Returns
true if all users are ready, false otherwise

Variable Documentation

◆ evsys_callback_func

volatile EVSYS_CALLBACK_HANDLER evsys_callback_func[EVSYS_CHANNELS]
extern

Callback table indexed by EVSYS channel number.