PRSEMLIB

Detailed Description

Peripheral Reflex System (PRS) Peripheral API.

This module contains functions to control the PRS peripheral of Silicon Labs 32-bit MCUs and SoCs. The PRS allows configurable, fast, and autonomous communication between peripherals on the MCU or SoC.

Macros

#define PRS_ASYNC_CHAN_COUNT   0
 
#define PRS_SYNC_CHAN_COUNT   PRS_CHAN_COUNT
 
#define PRS_USART0_RXDATA   PRS_USART0_RXDATAV
 
#define PRS_USART1_RXDATA   PRS_USART1_RXDATAV
 
#define PRS_USART2_RXDATA   PRS_USART2_RXDATAV
 

Enumerations

enum  PRS_ChType_t {
  prsTypeAsync,
  prsTypeSync
}
 
enum  PRS_Edge_TypeDef {
  prsEdgeOff,
  prsEdgePos,
  prsEdgeNeg,
  prsEdgeBoth
}
 
enum  PRS_Signal_t {
  prsSignalNone = 0x0,
  prsSignalTIMER0_UF = PRS_TIMER0_UF,
  prsSignalTIMER0_OF = PRS_TIMER0_OF,
  prsSignalTIMER0_CC0 = PRS_TIMER0_CC0,
  prsSignalTIMER0_CC1 = PRS_TIMER0_CC1,
  prsSignalTIMER0_CC2 = PRS_TIMER0_CC2,
  prsSignalTIMER1_UF = PRS_TIMER1_UF,
  prsSignalTIMER1_OF = PRS_TIMER1_OF,
  prsSignalTIMER1_CC0 = PRS_TIMER1_CC0,
  prsSignalTIMER1_CC1 = PRS_TIMER1_CC1,
  prsSignalTIMER1_CC2 = PRS_TIMER1_CC2,
  prsSignalTIMER2_UF = PRS_TIMER2_UF,
  prsSignalTIMER2_OF = PRS_TIMER2_OF,
  prsSignalTIMER2_CC0 = PRS_TIMER2_CC0,
  prsSignalTIMER2_CC1 = PRS_TIMER2_CC1,
  prsSignalTIMER2_CC2 = PRS_TIMER2_CC2,
  prsSignalACMP0_OUT = PRS_ACMP0_OUT,
  prsSignalACMP1_OUT = PRS_ACMP1_OUT,
  prsSignalUSART0_IRTX = PRS_USART0_IRTX,
  prsSignalUSART0_TXC = PRS_USART0_TXC,
  prsSignalUSART0_RXDATA = PRS_USART0_RXDATA,
  prsSignalUSART1_TXC = PRS_USART1_TXC,
  prsSignalUSART1_RXDATA = PRS_USART1_RXDATA,
  prsSignalUSART1_IRTX = PRS_USART1_IRTX,
  prsSignalUSART2_TXC = PRS_USART2_TXC,
  prsSignalUSART2_RXDATA = PRS_USART2_RXDATA,
  prsSignalUSART2_IRTX = PRS_USART2_IRTX,
  prsSignalGPIO_PIN0 = PRS_GPIO_PIN0,
  prsSignalGPIO_PIN1 = PRS_GPIO_PIN1,
  prsSignalGPIO_PIN2 = PRS_GPIO_PIN2,
  prsSignalGPIO_PIN3 = PRS_GPIO_PIN3,
  prsSignalGPIO_PIN4 = PRS_GPIO_PIN4,
  prsSignalGPIO_PIN5 = PRS_GPIO_PIN5,
  prsSignalGPIO_PIN6 = PRS_GPIO_PIN6,
  prsSignalGPIO_PIN7 = PRS_GPIO_PIN7,
  prsSignalGPIO_PIN8 = PRS_GPIO_PIN8,
  prsSignalGPIO_PIN9 = PRS_GPIO_PIN9,
  prsSignalGPIO_PIN10 = PRS_GPIO_PIN10,
  prsSignalGPIO_PIN11 = PRS_GPIO_PIN11,
  prsSignalGPIO_PIN12 = PRS_GPIO_PIN12,
  prsSignalGPIO_PIN13 = PRS_GPIO_PIN13,
  prsSignalGPIO_PIN14 = PRS_GPIO_PIN14,
  prsSignalGPIO_PIN15 = PRS_GPIO_PIN15
}
 

Functions

__STATIC_INLINE void PRS_ChannelLevelSet (unsigned int ch, bool level)
 Set the PRS channel level for one asynchronous PRS channel.
 
__STATIC_INLINE void PRS_ChannelPulse (unsigned int ch)
 Trigger a pulse on one PRS channel.
 
void PRS_ConnectSignal (unsigned int ch, PRS_ChType_t type, PRS_Signal_t signal)
 Connect a PRS signal to a channel.
 
int PRS_GetFreeChannel (PRS_ChType_t type)
 Search for the first free PRS channel.
 
__STATIC_INLINE uint32_t PRS_LevelGet (void)
 Get level control bit for all channels.
 
__STATIC_INLINE void PRS_LevelSet (uint32_t level, uint32_t mask)
 Set level control bit for one or more channels.
 
__STATIC_INLINE void PRS_PulseTrigger (uint32_t channels)
 Trigger a high pulse (one HFPERCLK) for one or more channels.
 
void PRS_Reset (void)
 Reset all PRS channels.
 
void PRS_SourceSignalSet (unsigned int ch, uint32_t source, uint32_t signal, PRS_Edge_TypeDef edge)
 Set a source and signal for a channel.
 

Enumeration Type Documentation

PRS Channel type.

Enumerator
prsTypeAsync 

Asynchronous channel type.

prsTypeSync 

Synchronous channel type.

Definition at line 99 of file em_prs.h.

Edge detection type.

Enumerator
prsEdgeOff 

Leave signal as is.

prsEdgePos 

Generate pulses on positive edge.

prsEdgeNeg 

Generate pulses on negative edge.

prsEdgeBoth 

Generate pulses on both edges.

Definition at line 105 of file em_prs.h.

PRS Signal.

Enumerator
prsSignalTIMER0_UF 

TIMER0 underflow Signal.

prsSignalTIMER0_OF 

TIMER0 overflow Signal.

prsSignalTIMER0_CC0 

TIMER0 capture/compare channel 0 Signal.

prsSignalTIMER0_CC1 

TIMER0 capture/compare channel 1 Signal.

prsSignalTIMER0_CC2 

TIMER0 capture/compare channel 2 Signal.

prsSignalTIMER1_UF 

TIMER1 underflow Signal.

prsSignalTIMER1_OF 

TIMER1 overflow Signal.

prsSignalTIMER1_CC0 

TIMER1 capture/compare channel 0 Signal.

prsSignalTIMER1_CC1 

TIMER1 capture/compare channel 1 Signal.

prsSignalTIMER1_CC2 

TIMER1 capture/compare channel 2 Signal.

prsSignalTIMER2_UF 

TIMER2 underflow Signal.

prsSignalTIMER2_OF 

TIMER2 overflow Signal.

prsSignalTIMER2_CC0 

TIMER2 capture/compare channel 0 Signal.

prsSignalTIMER2_CC1 

TIMER2 capture/compare channel 1 Signal.

prsSignalTIMER2_CC2 

TIMER2 capture/compare channel 2 Signal.

prsSignalACMP0_OUT 

ACMP0 Signal.

prsSignalACMP1_OUT 

ACMP1 output Signal.

prsSignalUSART0_IRTX 

USART0 IR tx Signal.

prsSignalUSART0_TXC 

USART0 tx complete Signal.

prsSignalUSART0_RXDATA 

USART0 rx data available Signal.

prsSignalUSART1_TXC 

USART1 tx complete Signal.

prsSignalUSART1_RXDATA 

USART1 rx data available Signal.

prsSignalUSART1_IRTX 

USART1 IR tx Signal.

prsSignalUSART2_TXC 

USART2 tx complete Signal.

prsSignalUSART2_RXDATA 

USART2 rx data available Signal.

prsSignalUSART2_IRTX 

USART2 IR tx Signal.

prsSignalGPIO_PIN0 

GPIO Pin 0 Signal.

prsSignalGPIO_PIN1 

GPIO Pin 1 Signal.

prsSignalGPIO_PIN2 

GPIO Pin 2 Signal.

prsSignalGPIO_PIN3 

GPIO Pin 3 Signal.

prsSignalGPIO_PIN4 

GPIO Pin 4 Signal.

prsSignalGPIO_PIN5 

GPIO Pin 5 Signal.

prsSignalGPIO_PIN6 

GPIO Pin 6 Signal.

prsSignalGPIO_PIN7 

GPIO Pin 7 Signal.

prsSignalGPIO_PIN8 

GPIO Pin 8 Signal.

prsSignalGPIO_PIN9 

GPIO Pin 9 Signal.

prsSignalGPIO_PIN10 

GPIO Pin 10 Signal.

prsSignalGPIO_PIN11 

GPIO Pin 11 Signal.

prsSignalGPIO_PIN12 

GPIO Pin 12 Signal.

prsSignalGPIO_PIN13 

GPIO Pin 13 Signal.

prsSignalGPIO_PIN14 

GPIO Pin 14 Signal.

prsSignalGPIO_PIN15 

GPIO Pin 15 Signal.

Definition at line 135 of file em_prs.h.

Function Documentation

__STATIC_INLINE void PRS_ChannelLevelSet ( unsigned int  ch,
bool  level 
)

Set the PRS channel level for one asynchronous PRS channel.

Parameters
[in]chPRS channel number.
[in]leveltrue to set the level high (1) and false to set the level low (0).

Definition at line 436 of file em_prs.h.

References PRS_LevelSet().

__STATIC_INLINE void PRS_ChannelPulse ( unsigned int  ch)

Trigger a pulse on one PRS channel.

Parameters
[in]chPRS channel number.

Definition at line 448 of file em_prs.h.

References PRS_PulseTrigger().

void PRS_ConnectSignal ( unsigned int  ch,
PRS_ChType_t  type,
PRS_Signal_t  signal 
)

Connect a PRS signal to a channel.

This function will make the PRS signal available on the specific channel. Only a single PRS signal can be connected to any given channel.

Parameters
[in]chPRS channel number.
[in]typePRS channel type. This can be either prsTypeAsync or prsTypeSync.
[in]signalThis is the PRS signal that should be placed on the channel.

Definition at line 383 of file em_prs.c.

References prsTypeAsync.

int PRS_GetFreeChannel ( PRS_ChType_t  type)

Search for the first free PRS channel.

Parameters
[in]typePRS channel type. This can be either prsTypeAsync or prsTypeSync.
Returns
Channel number >= 0 if an unused PRS channel was found. If no free PRS channel was found then -1 is returned.

Definition at line 316 of file em_prs.c.

References prsTypeAsync.

__STATIC_INLINE uint32_t PRS_LevelGet ( void  )

Get level control bit for all channels.

Returns
The current software level configuration.

Definition at line 348 of file em_prs.h.

__STATIC_INLINE void PRS_LevelSet ( uint32_t  level,
uint32_t  mask 
)

Set level control bit for one or more channels.

The level value for a channel is XORed with both the pulse possibly issued by PRS_PulseTrigger() and the PRS input signal selected for the channel(s).

Parameters
[in]levelLevel to use for channels indicated by mask. Use logical OR combination of PRS_SWLEVEL_CHnLEVEL defines for channels to set high level, otherwise 0.
[in]maskMask indicating which channels to set level for. Use logical OR combination of PRS_SWLEVEL_CHnLEVEL defines.

Definition at line 332 of file em_prs.h.

Referenced by PRS_ChannelLevelSet().

__STATIC_INLINE void PRS_PulseTrigger ( uint32_t  channels)

Trigger a high pulse (one HFPERCLK) for one or more channels.

Setting a bit for a channel causes the bit in the register to remain high for one HFPERCLK cycle. Pulse is XORed with both the corresponding bit in PRS SWLEVEL register and the PRS input signal selected for the channel(s).

Parameters
[in]channelsLogical ORed combination of channels to trigger a pulse for. Use PRS_SWPULSE_CHnPULSE defines.

Definition at line 417 of file em_prs.h.

Referenced by PRS_ChannelPulse().

void PRS_Reset ( void  )

Reset all PRS channels.

This function will reset all the PRS channel configuration.

Definition at line 345 of file em_prs.c.

void PRS_SourceSignalSet ( unsigned int  ch,
uint32_t  source,
uint32_t  signal,
PRS_Edge_TypeDef  edge 
)

Set a source and signal for a channel.

Parameters
[in]chA channel to define the signal and source for.
[in]sourceA source to select for the channel. Use one of PRS_CH_CTRL_SOURCESEL_x defines.
[in]signalA signal (for selected source) to use. Use one of PRS_CH_CTRL_SIGSEL_x defines.
[in]edgeAn edge (for selected source/signal) to generate the pulse for.

Definition at line 211 of file em_prs.c.