Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Peripheral Event Controller (PEVC) Driver

The Peripheral EVent Controller (PEVC) offers a set of features that allows peripherals to interact without intervention from the CPU.

The PEVC connects Event Generators to Event Users.

Modules

 

Data Structures

struct  pevc_evs_opt_t
 Parameters of a channel Event Shaper (for channels with asynchronous and external inputs). More...
 

Number of Event Generator and number of Event users

#define PEVC_NUMBER_OF_EVENT_GENERATORS   AVR32_PEVC_EVIN_BITS
 
#define PEVC_NUMBER_OF_EVENT_USERS   AVR32_PEVC_TRIGOUT_BITS
 Number of event users. More...
 

Channel state (Idle or Busy)

#define PEVC_CHANNEL_IDLE   0
 
#define PEVC_CHANNEL_BUSY   1
 

Event Shaper configuration values

#define PEVC_EVS_IGF_ON   true
 
#define PEVC_EVS_IGF_OFF   false
 
#define PEVC_EVS_EVF_ON   true
 
#define PEVC_EVS_EVF_OFF   false
 
#define PEVC_EVS_EVR_ON   true
 
#define PEVC_EVS_EVR_OFF   false
 

Channels configuration API

bool pevc_channel_configure (volatile avr32_pevc_t *pevc, unsigned short int chan_id, unsigned short int gen_id, const pevc_evs_opt_t *pevs)
 Configure a channel. More...
 
void pevc_igfd_set (volatile avr32_pevc_t *pevc, unsigned char igfd)
 Set a value for the Input Glitch Filter Divider (used by the Event Shaper). More...
 
#define PEVC_IGFD_SET(pevc, igfd)   (pevc)->igfdr = ((igfd)<<AVR32_PEVC_IGFDR_IGFDR_OFFSET) & AVR32_PEVC_IGFDR_IGFDR_MASK;
 

Channels Enable/Disable API

void pevc_channels_enable (volatile avr32_pevc_t *pevc, unsigned long long int chan_mask)
 Enable one or more channels. More...
 
void pevc_channels_disable (volatile avr32_pevc_t *pevc, unsigned long long int chan_mask)
 Disable one or more channels. More...
 
bool pevc_get_channel_status (volatile avr32_pevc_t *pevc, unsigned short int chan_id)
 Get the status of a channel. More...
 
#define PEVC_CHANNELS_ENABLE(pevc, chan_mask)
 
#define PEVC_CHANNELS_DISABLE(pevc, chan_mask)
 

Channels state (Idle/Busy) API

bool pevc_get_channel_state (volatile avr32_pevc_t *pevc, unsigned short int chan_id)
 Get the state of a channel (idle or busy) More...
 

Channels Software Event API

void pevc_channel_sev_enable (volatile avr32_pevc_t *pevc, unsigned short int chan_id)
 Enable the Software Event as the event source for a channel. More...
 
void pevc_channels_trigger_sev (volatile avr32_pevc_t *pevc, unsigned long long int chan_mask)
 Trigger a software event to one or more channels. More...
 
void pevc_channel_sev_disable (volatile avr32_pevc_t *pevc, unsigned short int chan_id)
 Disable the Software Event as the event source for a channel. More...
 
#define PEVC_CHANNEL_SEV_ENABLE(pevc, chan_id)   ((pevc)->CHMX[(chan_id)].smx = ENABLE)
 
#define PEVC_CHANNELS_TRIGGER_SEV(pevc, chan_mask)
 
#define PEVC_CHANNEL_SEV_DISABLE(pevc, chan_id)   ((pevc)->CHMX[(chan_id)].smx = DISABLE)
 

Channels trigger interrupt API

void pevc_channels_enable_trigger_interrupt (volatile avr32_pevc_t *pevc, unsigned long long int chan_mask)
 Enable the event trigger interrupt of one or more channels. More...
 
void pevc_channels_disable_trigger_interrupt (volatile avr32_pevc_t *pevc, unsigned long long int chan_mask)
 Disable the event trigger interrupt of one or more channels. More...
 
bool pevc_channel_is_trigger_interrupt_enabled (volatile avr32_pevc_t *pevc, unsigned short int chan_id)
 Check if the event trigger interrupt for a given channel is enabled. More...
 
bool pevc_channel_is_trigger_interrupt_raised (volatile avr32_pevc_t *pevc, unsigned short int chan_id)
 Check if the event trigger interrupt was raised for a given channel. More...
 
void pevc_channel_clear_trigger_interrupt (volatile avr32_pevc_t *pevc, unsigned short int chan_id)
 Clear the event trigger interrupt for a given channel. More...
 
#define PEVC_CHANNELS_ENABLE_TRIGGER_INTERRUPT(pevc, chan_mask)
 
#define PEVC_CHANNELS_DISABLE_TRIGGER_INTERRUPT(pevc, chan_mask)
 

Channels overrun interrupt API

void pevc_channels_enable_overrun_interrupt (volatile avr32_pevc_t *pevc, unsigned long long int chan_mask)
 Enable the event overrun interrupt of one or more channels. More...
 
void pevc_channels_disable_overrun_interrupt (volatile avr32_pevc_t *pevc, unsigned long long int chan_mask)
 Disable the event overrun interrupt of one or more channels. More...
 
bool pevc_channel_is_overrun_interrupt_enabled (volatile avr32_pevc_t *pevc, unsigned short int chan_id)
 Check if the event overrun interrupt for a given channel is enabled. More...
 
bool pevc_channel_is_overrun_interrupt_raised (volatile avr32_pevc_t *pevc, unsigned short int chan_id)
 Check if the event overrun interrupt was raised for a given channel. More...
 
void pevc_channel_clear_overrun_interrupt (volatile avr32_pevc_t *pevc, unsigned short int chan_id)
 Clear the event overrun interrupt for a given channel. More...
 
#define PEVC_CHANNELS_ENABLE_OVERRUN_INTERRUPT(pevc, chan_mask)
 
#define PEVC_CHANNELS_DISABLE_OVERRUN_INTERRUPT(pevc, chan_mask)
 

#define PEVC_CHANNEL_BUSY   1
#define PEVC_CHANNEL_IDLE   0
#define PEVC_CHANNEL_SEV_DISABLE (   pevc,
  chan_id 
)    ((pevc)->CHMX[(chan_id)].smx = DISABLE)
#define PEVC_CHANNEL_SEV_ENABLE (   pevc,
  chan_id 
)    ((pevc)->CHMX[(chan_id)].smx = ENABLE)
#define PEVC_CHANNELS_DISABLE (   pevc,
  chan_mask 
)
Value:
if((chan_mask)<=0x80000000) (pevc)->chdr0 = (chan_mask); \
else (pevc)->chdr1 = (chan_mask);
else
Definition: lwip-1.4.1/src/core/memp.c:418

Referenced by pevc_channels_disable().

#define PEVC_CHANNELS_DISABLE_OVERRUN_INTERRUPT (   pevc,
  chan_mask 
)
Value:
if((chan_mask)<=0x80000000) (pevc)->ovidr0 = (chan_mask); \
else (pevc)->ovidr1 = (chan_mask);
else
Definition: lwip-1.4.1/src/core/memp.c:418

Referenced by pevc_channels_disable_overrun_interrupt().

#define PEVC_CHANNELS_DISABLE_TRIGGER_INTERRUPT (   pevc,
  chan_mask 
)
Value:
if((chan_mask)<=0x80000000) (pevc)->tridr0 = (chan_mask); \
else (pevc)->tridr1 = (chan_mask);
else
Definition: lwip-1.4.1/src/core/memp.c:418

Referenced by pevc_channels_disable_trigger_interrupt().

#define PEVC_CHANNELS_ENABLE (   pevc,
  chan_mask 
)
Value:
if((chan_mask)<=0x80000000) (pevc)->cher0 = (chan_mask); \
else (pevc)->cher1 = (chan_mask);
else
Definition: lwip-1.4.1/src/core/memp.c:418

Referenced by init_pdca(), init_pevc(), and pevc_channels_enable().

#define PEVC_CHANNELS_ENABLE_OVERRUN_INTERRUPT (   pevc,
  chan_mask 
)
Value:
if((chan_mask)<=0x80000000) (pevc)->ovier0 = (chan_mask); \
else (pevc)->ovier1 = (chan_mask);
else
Definition: lwip-1.4.1/src/core/memp.c:418

Referenced by pevc_channels_enable_overrun_interrupt().

#define PEVC_CHANNELS_ENABLE_TRIGGER_INTERRUPT (   pevc,
  chan_mask 
)
Value:
if((chan_mask)<=0x80000000) (pevc)->trier0 = (chan_mask); \
else (pevc)->trier1 = (chan_mask);
else
Definition: lwip-1.4.1/src/core/memp.c:418

Referenced by pevc_channels_enable_trigger_interrupt().

#define PEVC_CHANNELS_TRIGGER_SEV (   pevc,
  chan_mask 
)
Value:
if((chan_mask)<=0x80000000) (pevc)->sev0 = (chan_mask); \
else (pevc)->sev1 = (chan_mask);
else
Definition: lwip-1.4.1/src/core/memp.c:418

Referenced by pevc_channels_trigger_sev().

#define PEVC_EVS_EVF_OFF   false

Referenced by init_pevc().

#define PEVC_EVS_EVF_ON   true

Referenced by init_pevc().

#define PEVC_EVS_EVR_OFF   false
#define PEVC_EVS_EVR_ON   true

Referenced by init_pevc().

#define PEVC_EVS_IGF_OFF   false

Referenced by init_pevc().

#define PEVC_EVS_IGF_ON   true
#define PEVC_IGFD_SET (   pevc,
  igfd 
)    (pevc)->igfdr = ((igfd)<<AVR32_PEVC_IGFDR_IGFDR_OFFSET) & AVR32_PEVC_IGFDR_IGFDR_MASK;

Referenced by pevc_igfd_set().

#define PEVC_NUMBER_OF_EVENT_GENERATORS   AVR32_PEVC_EVIN_BITS

Number of event generators

Referenced by pevc_channel_configure().

void pevc_channel_clear_overrun_interrupt ( volatile avr32_pevc_t *  pevc,
unsigned short int  chan_id 
)

Clear the event overrun interrupt for a given channel.

Parameters
*pevcBase address of the PEVC
chan_idchannel id

References Assert, NULL, and PEVC_NUMBER_OF_EVENT_USERS.

Referenced by ISR().

void pevc_channel_clear_trigger_interrupt ( volatile avr32_pevc_t *  pevc,
unsigned short int  chan_id 
)

Clear the event trigger interrupt for a given channel.

Parameters
*pevcBase address of the PEVC
chan_idchannel id

References Assert, NULL, and PEVC_NUMBER_OF_EVENT_USERS.

Referenced by ISR().

bool pevc_channel_configure ( volatile avr32_pevc_t *  pevc,
unsigned short int  chan_id,
unsigned short int  gen_id,
const pevc_evs_opt_t pevs 
)

Configure a channel.

Parameters
*pevcBase address of the PEVC
chan_idchannel to configure
gen_idEvent generator to connect to the channel
*pevsParameters for the channel Event Shaper (valid only for channels with asynchronous and external inputs).
Note
pevs should be NULL if the event generator is not an asynchronous or external event.
Returns
bool PASS if the channel was successfully configured FAIL if the channel configuration failed due to incorrect parameters

References pevc_evs_opt_t::evf, pevc_evs_opt_t::evr, FAIL, pevc_evs_opt_t::igf, pevc_evs_opt_t::igfdr, NULL, PASS, PEVC_NUMBER_OF_EVENT_GENERATORS, and PEVC_NUMBER_OF_EVENT_USERS.

Referenced by init_pevc().

bool pevc_channel_is_overrun_interrupt_enabled ( volatile avr32_pevc_t *  pevc,
unsigned short int  chan_id 
)

Check if the event overrun interrupt for a given channel is enabled.

Parameters
*pevcBase address of the PEVC
chan_idchannel id
Returns
bool true if the channel trigger interrupt is enabled false if the channel trigger interrupt is disabled

References Assert, NULL, and PEVC_NUMBER_OF_EVENT_USERS.

bool pevc_channel_is_overrun_interrupt_raised ( volatile avr32_pevc_t *  pevc,
unsigned short int  chan_id 
)

Check if the event overrun interrupt was raised for a given channel.

Parameters
*pevcBase address of the PEVC
chan_idchannel id
Returns
bool true if the channel trigger interrupt was raised false otherwise

References Assert, NULL, and PEVC_NUMBER_OF_EVENT_USERS.

Referenced by ISR().

bool pevc_channel_is_trigger_interrupt_enabled ( volatile avr32_pevc_t *  pevc,
unsigned short int  chan_id 
)

Check if the event trigger interrupt for a given channel is enabled.

Parameters
*pevcBase address of the PEVC
chan_idchannel id
Returns
bool true if the channel trigger interrupt is enabled false if the channel trigger interrupt is disabled

References Assert, NULL, and PEVC_NUMBER_OF_EVENT_USERS.

bool pevc_channel_is_trigger_interrupt_raised ( volatile avr32_pevc_t *  pevc,
unsigned short int  chan_id 
)

Check if the event trigger interrupt was raised for a given channel.

Parameters
*pevcBase address of the PEVC
chan_idchannel id
Returns
bool true if the channel trigger interrupt was raised false otherwise

References Assert, NULL, and PEVC_NUMBER_OF_EVENT_USERS.

Referenced by ISR().

void pevc_channel_sev_disable ( volatile avr32_pevc_t *  pevc,
unsigned short int  chan_id 
)

Disable the Software Event as the event source for a channel.

Note
When the sev is disabled, the event generator is the input event for the channel.
Parameters
*pevcBase address of the PEVC
chan_idchannel to configure

References Assert, DISABLE, NULL, and PEVC_NUMBER_OF_EVENT_USERS.

void pevc_channel_sev_enable ( volatile avr32_pevc_t *  pevc,
unsigned short int  chan_id 
)

Enable the Software Event as the event source for a channel.

Note
When the sev is enabled, the event generator is ignored.
Parameters
*pevcBase address of the PEVC
chan_idchannel to configure

References Assert, ENABLE, NULL, and PEVC_NUMBER_OF_EVENT_USERS.

void pevc_channels_disable ( volatile avr32_pevc_t *  pevc,
unsigned long long int  chan_mask 
)

Disable one or more channels.

Parameters
*pevcBase address of the PEVC
chan_maskbitmask of channel masks to enable (1 bit per channel, up to 64 channels, actual number of channels depending on the part, chan_mask being (1 << chan_id))

References Assert, NULL, and PEVC_CHANNELS_DISABLE.

void pevc_channels_disable_overrun_interrupt ( volatile avr32_pevc_t *  pevc,
unsigned long long int  chan_mask 
)

Disable the event overrun interrupt of one or more channels.

Parameters
*pevcBase address of the PEVC
chan_maskbitmask of channel masks to enable (1 bit per channel, up to 64 channels, actual number of channels depending on the part, chan_mask being (1 << chan_id))

References Assert, NULL, and PEVC_CHANNELS_DISABLE_OVERRUN_INTERRUPT.

void pevc_channels_disable_trigger_interrupt ( volatile avr32_pevc_t *  pevc,
unsigned long long int  chan_mask 
)

Disable the event trigger interrupt of one or more channels.

Parameters
*pevcBase address of the PEVC
chan_maskbitmask of channel masks to enable (1 bit per channel, up to 64 channels, actual number of channels depending on the part, chan_mask being (1 << chan_id))

References Assert, NULL, and PEVC_CHANNELS_DISABLE_TRIGGER_INTERRUPT.

void pevc_channels_enable ( volatile avr32_pevc_t *  pevc,
unsigned long long int  chan_mask 
)

Enable one or more channels.

Parameters
*pevcBase address of the PEVC
chan_maskbitmask of channel masks to enable (1 bit per channel, up to 64 channels, actual number of channels depending on the part, chan_mask being (1 << chan_id))

References Assert, NULL, and PEVC_CHANNELS_ENABLE.

Referenced by init_pevc().

void pevc_channels_enable_overrun_interrupt ( volatile avr32_pevc_t *  pevc,
unsigned long long int  chan_mask 
)

Enable the event overrun interrupt of one or more channels.

Note
An overrun interrupt is raised when an event could not be forwarded to a channel user (if the channel state is busy or if the previous event is still being processed).
Parameters
*pevcBase address of the PEVC
chan_maskbitmask of channel masks to enable (1 bit per channel, up to 64 channels, actual number of channels depending on the part, chan_mask being (1 << chan_id))

References Assert, NULL, and PEVC_CHANNELS_ENABLE_OVERRUN_INTERRUPT.

Referenced by init_pevc().

void pevc_channels_enable_trigger_interrupt ( volatile avr32_pevc_t *  pevc,
unsigned long long int  chan_mask 
)

Enable the event trigger interrupt of one or more channels.

Note
A trigger interrupt is raised when an event trigger is forwarded to a channel user (if the channel state is ready).
Parameters
*pevcBase address of the PEVC
chan_maskbitmask of channel masks to enable (1 bit per channel, up to 64 channels, actual number of channels depending on the part, chan_mask being (1 << chan_id))

References Assert, NULL, and PEVC_CHANNELS_ENABLE_TRIGGER_INTERRUPT.

Referenced by init_pevc().

void pevc_channels_trigger_sev ( volatile avr32_pevc_t *  pevc,
unsigned long long int  chan_mask 
)

Trigger a software event to one or more channels.

Note
the channel must have previously been enabled.
Parameters
*pevcBase address of the PEVC
chan_maskbitmask of channel masks to enable (1 bit per channel, up to 64 channels, actual number of channels depending on the part, chan_mask being (1 << chan_id))

References Assert, NULL, and PEVC_CHANNELS_TRIGGER_SEV.

bool pevc_get_channel_state ( volatile avr32_pevc_t *  pevc,
unsigned short int  chan_id 
)

Get the state of a channel (idle or busy)

Note
the channel must have previously been enabled.
Parameters
*pevcBase address of the PEVC
chan_idchannel id
Returns
bool PEVC_CHANNEL_BUSY if the channel is busy (i.e. it is not ready to accept an event) PEVC_CHANNEL_IDLE if the channel is idle

References Assert, NULL, and PEVC_NUMBER_OF_EVENT_USERS.

bool pevc_get_channel_status ( volatile avr32_pevc_t *  pevc,
unsigned short int  chan_id 
)

Get the status of a channel.

Parameters
*pevcBase address of the PEVC
chan_idchannel id
Returns
bool true if channel is enabled false if channel is disabled

References Assert, NULL, and PEVC_NUMBER_OF_EVENT_USERS.

void pevc_igfd_set ( volatile avr32_pevc_t *  pevc,
unsigned char  igfd 
)

Set a value for the Input Glitch Filter Divider (used by the Event Shaper).

Parameters
*pevcBase address of the PEVC
igfdInput Glitch Filter divider [0,15]
Note
as stated in the datasheet, there is one divider value for all EVS instance.

References Assert, NULL, and PEVC_IGFD_SET.