PRS - Peripheral Reflex System

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.

Functions

void PRS_SourceSignalSet (unsigned int ch, uint32_t source, uint32_t signal, PRS_Edge_TypeDef edge)
 Set a source and signal for a channel.
 
void PRS_SourceAsyncSignalSet (unsigned int ch, uint32_t source, uint32_t signal)
 Set the source and asynchronous signal for a channel.
 
void PRS_GpioOutputLocation (unsigned int ch, unsigned int location)
 Send the output of a PRS channel to a GPIO pin.
 
int PRS_GetFreeChannel (PRS_ChType_t type)
 Search for the first free PRS channel.
 
void PRS_Reset (void)
 Reset all PRS channels.
 
void PRS_ConnectSignal (unsigned int ch, PRS_ChType_t type, PRS_Signal_t signal)
 Connect a PRS signal to a channel.
 
void PRS_LevelSet (uint32_t level, uint32_t mask)
 Set level control bit for one or more channels.
 
uint32_t PRS_LevelGet (void)
 Get level control bit for all channels.
 
uint32_t PRS_Values (PRS_ChType_t type)
 Get the PRS channel values for all channels.
 
bool PRS_ChannelValue (unsigned int ch, PRS_ChType_t type)
 Get the PRS channel value for a single channel.
 
void PRS_PulseTrigger (uint32_t channels)
 Trigger a high pulse (one HFPERCLK) for one or more channels.
 
void PRS_ChannelLevelSet (unsigned int ch, bool level)
 Set the PRS channel level for one asynchronous PRS channel.
 
void PRS_ChannelPulse (unsigned int ch)
 Trigger a pulse on one PRS channel.
 

Macros

#define PRS_SYNC_CHAN_COUNT   PRS_CHAN_COUNT
 PRS Synchronous channel count.
 
#define PRS_ASYNC_CHAN_COUNT   PRS_CHAN_COUNT
 PRS Asynchronous channel count.
 
#define PRS_ASYNC_SUPPORTED   1
 PRS asynchronous support.
 

Enumerations

enum  PRS_ChType_t {
  prsTypeAsync,
  prsTypeSync
}
 PRS Channel type.
 
enum  PRS_Edge_TypeDef {
  prsEdgeOff,
  prsEdgePos,
  prsEdgeNeg,
  prsEdgeBoth
}
 Edge detection type.
 
enum  PRS_Signal_t {
  prsSignalNone = PRS_CH_CTRL_SOURCESEL_NONE | (0x0 << _PRS_CH_CTRL_SIGSEL_SHIFT),
  prsSignalSW = PRS_CH_CTRL_SOURCESEL_NONE | (0x1 << _PRS_CH_CTRL_SIGSEL_SHIFT),
  prsSignalPRS_CH0 = PRS_PRS_CH0,
  prsSignalPRS_CH1 = PRS_PRS_CH1,
  prsSignalPRS_CH2 = PRS_PRS_CH2,
  prsSignalPRS_CH3 = PRS_PRS_CH3,
  prsSignalPRS_CH4 = PRS_PRS_CH4,
  prsSignalPRS_CH5 = PRS_PRS_CH5,
  prsSignalPRS_CH6 = PRS_PRS_CH6,
  prsSignalPRS_CH7 = PRS_PRS_CH7,
  prsSignalPRS_CH8 = PRS_PRS_CH8,
  prsSignalPRS_CH9 = PRS_PRS_CH9,
  prsSignalPRS_CH10 = PRS_PRS_CH10,
  prsSignalPRS_CH11 = PRS_PRS_CH11,
  prsSignalPRS_CH12 = PRS_PRS_CH12,
  prsSignalPRS_CH13 = PRS_PRS_CH13,
  prsSignalPRS_CH14 = PRS_PRS_CH14,
  prsSignalPRS_CH15 = PRS_PRS_CH15,
  prsSignalPRS_CH16 = PRS_PRS_CH16,
  prsSignalPRS_CH17 = PRS_PRS_CH17,
  prsSignalPRS_CH18 = PRS_PRS_CH18,
  prsSignalPRS_CH19 = PRS_PRS_CH19,
  prsSignalPRS_CH20 = PRS_PRS_CH20,
  prsSignalPRS_CH21 = PRS_PRS_CH21,
  prsSignalPRS_CH22 = PRS_PRS_CH22,
  prsSignalPRS_CH23 = PRS_PRS_CH23,
  prsSignalADC0_SINGLE = PRS_ADC0_SINGLE,
  prsSignalADC0_SCAN = PRS_ADC0_SCAN,
  prsSignalADC1_SINGLE = PRS_ADC1_SINGLE,
  prsSignalADC1_SCAN = PRS_ADC1_SCAN,
  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,
  prsSignalTIMER3_UF = PRS_TIMER3_UF,
  prsSignalTIMER3_OF = PRS_TIMER3_OF,
  prsSignalTIMER3_CC0 = PRS_TIMER3_CC0,
  prsSignalTIMER3_CC1 = PRS_TIMER3_CC1,
  prsSignalTIMER3_CC2 = PRS_TIMER3_CC2,
  prsSignalTIMER1_CC3 = PRS_TIMER1_CC3,
  prsSignalTIMER4_UF = PRS_TIMER4_UF,
  prsSignalTIMER4_OF = PRS_TIMER4_OF,
  prsSignalTIMER4_CC0 = PRS_TIMER4_CC0,
  prsSignalTIMER4_CC1 = PRS_TIMER4_CC1,
  prsSignalTIMER4_CC2 = PRS_TIMER4_CC2,
  prsSignalTIMER5_UF = PRS_TIMER5_UF,
  prsSignalTIMER5_OF = PRS_TIMER5_OF,
  prsSignalTIMER5_CC0 = PRS_TIMER5_CC0,
  prsSignalTIMER5_CC1 = PRS_TIMER5_CC1,
  prsSignalTIMER5_CC2 = PRS_TIMER5_CC2,
  prsSignalTIMER6_UF = PRS_TIMER6_UF,
  prsSignalTIMER6_OF = PRS_TIMER6_OF,
  prsSignalTIMER6_CC0 = PRS_TIMER6_CC0,
  prsSignalTIMER6_CC1 = PRS_TIMER6_CC1,
  prsSignalTIMER6_CC2 = PRS_TIMER6_CC2,
  prsSignalLETIMER0_CH0 = PRS_LETIMER0_CH0,
  prsSignalLETIMER0_CH1 = PRS_LETIMER0_CH1,
  prsSignalLETIMER1_CH0 = PRS_LETIMER1_CH0,
  prsSignalLETIMER1_CH1 = PRS_LETIMER1_CH1,
  prsSignalPCNT0_TCC = PRS_PCNT0_TCC,
  prsSignalPCNT0_UFOF = PRS_PCNT0_UFOF,
  prsSignalPCNT0_DIR = PRS_PCNT0_DIR,
  prsSignalPCNT1_TCC = PRS_PCNT1_TCC,
  prsSignalPCNT1_UFOF = PRS_PCNT1_UFOF,
  prsSignalPCNT1_DIR = PRS_PCNT1_DIR,
  prsSignalPCNT2_TCC = PRS_PCNT2_TCC,
  prsSignalPCNT2_UFOF = PRS_PCNT2_UFOF,
  prsSignalPCNT2_DIR = PRS_PCNT2_DIR,
  prsSignalCRYOTIMER_PERIOD = PRS_CRYOTIMER_PERIOD,
  prsSignalRTC_OF = PRS_RTC_OF,
  prsSignalRTC_COMP0 = PRS_RTC_COMP0,
  prsSignalRTC_COMP1 = PRS_RTC_COMP1,
  prsSignalRTC_COMP2 = PRS_RTC_COMP2,
  prsSignalRTC_COMP3 = PRS_RTC_COMP3,
  prsSignalRTC_COMP4 = PRS_RTC_COMP4,
  prsSignalRTC_COMP5 = PRS_RTC_COMP5,
  prsSignalRTCC_CCV0 = PRS_RTCC_CCV0,
  prsSignalRTCC_CCV1 = PRS_RTCC_CCV1,
  prsSignalRTCC_CCV2 = PRS_RTCC_CCV2,
  prsSignalACMP0_OUT = PRS_ACMP0_OUT,
  prsSignalACMP1_OUT = PRS_ACMP1_OUT,
  prsSignalACMP2_OUT = PRS_ACMP2_OUT,
  prsSignalACMP3_OUT = PRS_ACMP3_OUT,
  prsSignalVDAC0_CH0 = PRS_VDAC0_CH0,
  prsSignalVDAC0_CH1 = PRS_VDAC0_CH1,
  prsSignalVDAC0_OPA0 = PRS_VDAC0_OPA0,
  prsSignalVDAC0_OPA1 = PRS_VDAC0_OPA1,
  prsSignalVDAC0_OPA2 = PRS_VDAC0_OPA2,
  prsSignalVDAC0_OPA3 = PRS_VDAC0_OPA3,
  prsSignalLESENSE_SCANRES0 = PRS_LESENSE_SCANRES0,
  prsSignalLESENSE_SCANRES1 = PRS_LESENSE_SCANRES1,
  prsSignalLESENSE_SCANRES2 = PRS_LESENSE_SCANRES2,
  prsSignalLESENSE_SCANRES3 = PRS_LESENSE_SCANRES3,
  prsSignalLESENSE_SCANRES4 = PRS_LESENSE_SCANRES4,
  prsSignalLESENSE_SCANRES5 = PRS_LESENSE_SCANRES5,
  prsSignalLESENSE_SCANRES6 = PRS_LESENSE_SCANRES6,
  prsSignalLESENSE_SCANRES7 = PRS_LESENSE_SCANRES7,
  prsSignalLESENSE_SCANRES8 = PRS_LESENSE_SCANRES8,
  prsSignalLESENSE_SCANRES9 = PRS_LESENSE_SCANRES9,
  prsSignalLESENSE_SCANRES10 = PRS_LESENSE_SCANRES10,
  prsSignalLESENSE_SCANRES11 = PRS_LESENSE_SCANRES11,
  prsSignalLESENSE_SCANRES12 = PRS_LESENSE_SCANRES12,
  prsSignalLESENSE_SCANRES13 = PRS_LESENSE_SCANRES13,
  prsSignalLESENSE_SCANRES14 = PRS_LESENSE_SCANRES14,
  prsSignalLESENSE_SCANRES15 = PRS_LESENSE_SCANRES15,
  prsSignalLESENSE_DEC0 = PRS_LESENSE_DEC0,
  prsSignalLESENSE_DEC1 = PRS_LESENSE_DEC1,
  prsSignalLESENSE_DEC2 = PRS_LESENSE_DEC2,
  prsSignalLESENSE_DECCMP = PRS_LESENSE_DECCMP,
  prsSignalLESENSE_MEASACT = PRS_LESENSE_MEASACT,
  prsSignalUSART0_TXC = PRS_USART0_TXC,
  prsSignalUSART0_RXDATAV = PRS_USART0_RXDATAV,
  prsSignalUSART0_IRTX = PRS_USART0_IRTX,
  prsSignalUSART0_RTS = PRS_USART0_RTS,
  prsSignalUSART0_TX = PRS_USART0_TX,
  prsSignalUSART0_CS = PRS_USART0_CS,
  prsSignalUSART1_TXC = PRS_USART1_TXC,
  prsSignalUSART1_RXDATAV = PRS_USART1_RXDATAV,
  prsSignalUSART1_RTS = PRS_USART1_RTS,
  prsSignalUSART1_TX = PRS_USART1_TX,
  prsSignalUSART1_CS = PRS_USART1_CS,
  prsSignalUSART2_TXC = PRS_USART2_TXC,
  prsSignalUSART2_RXDATAV = PRS_USART2_RXDATAV,
  prsSignalUSART2_IRTX = PRS_USART2_IRTX,
  prsSignalUSART2_RTS = PRS_USART2_RTS,
  prsSignalUSART2_TX = PRS_USART2_TX,
  prsSignalUSART2_CS = PRS_USART2_CS,
  prsSignalUSART3_TXC = PRS_USART3_TXC,
  prsSignalUSART3_RXDATAV = PRS_USART3_RXDATAV,
  prsSignalUSART3_RTS = PRS_USART3_RTS,
  prsSignalUSART3_TX = PRS_USART3_TX,
  prsSignalUSART3_CS = PRS_USART3_CS,
  prsSignalUSART4_TXC = PRS_USART4_TXC,
  prsSignalUSART4_RXDATAV = PRS_USART4_RXDATAV,
  prsSignalUSART4_RTS = PRS_USART4_RTS,
  prsSignalUSART4_TX = PRS_USART4_TX,
  prsSignalUSART4_CS = PRS_USART4_CS,
  prsSignalUSART5_TXC = PRS_USART5_TXC,
  prsSignalUSART5_RXDATAV = PRS_USART5_RXDATAV,
  prsSignalUSART5_RTS = PRS_USART5_RTS,
  prsSignalUSART5_TX = PRS_USART5_TX,
  prsSignalUSART5_CS = PRS_USART5_CS,
  prsSignalUART0_TXC = PRS_UART0_TXC,
  prsSignalUART0_RXDATAV = PRS_UART0_RXDATAV,
  prsSignalUART0_RTS = PRS_UART0_RTS,
  prsSignalUART0_TX = PRS_UART0_TX,
  prsSignalUART0_CS = PRS_UART0_CS,
  prsSignalUART1_TXC = PRS_UART1_TXC,
  prsSignalUART1_RXDATAV = PRS_UART1_RXDATAV,
  prsSignalUART1_RTS = PRS_UART1_RTS,
  prsSignalUART1_TX = PRS_UART1_TX,
  prsSignalUART1_CS = PRS_UART1_CS,
  prsSignalUSB_SOF = PRS_USB_SOF,
  prsSignalUSB_SOFSR = PRS_USB_SOFSR,
  prsSignalCM4_TXEV = PRS_CM4_TXEV,
  prsSignalCM4_ICACHEPCHITSOF = PRS_CM4_ICACHEPCHITSOF,
  prsSignalCM4_ICACHEPCMISSESOF = PRS_CM4_ICACHEPCMISSESOF,
  prsSignalWTIMER0_UF = PRS_WTIMER0_UF,
  prsSignalWTIMER0_OF = PRS_WTIMER0_OF,
  prsSignalWTIMER0_CC0 = PRS_WTIMER0_CC0,
  prsSignalWTIMER0_CC1 = PRS_WTIMER0_CC1,
  prsSignalWTIMER0_CC2 = PRS_WTIMER0_CC2,
  prsSignalWTIMER1_UF = PRS_WTIMER1_UF,
  prsSignalWTIMER1_OF = PRS_WTIMER1_OF,
  prsSignalWTIMER1_CC0 = PRS_WTIMER1_CC0,
  prsSignalWTIMER1_CC1 = PRS_WTIMER1_CC1,
  prsSignalWTIMER1_CC2 = PRS_WTIMER1_CC2,
  prsSignalWTIMER1_CC3 = PRS_WTIMER1_CC3,
  prsSignalWTIMER2_UF = PRS_WTIMER2_UF,
  prsSignalWTIMER2_OF = PRS_WTIMER2_OF,
  prsSignalWTIMER2_CC0 = PRS_WTIMER2_CC0,
  prsSignalWTIMER2_CC1 = PRS_WTIMER2_CC1,
  prsSignalWTIMER2_CC2 = PRS_WTIMER2_CC2,
  prsSignalWTIMER3_UF = PRS_WTIMER3_UF,
  prsSignalWTIMER3_OF = PRS_WTIMER3_OF,
  prsSignalWTIMER3_CC0 = PRS_WTIMER3_CC0,
  prsSignalWTIMER3_CC1 = PRS_WTIMER3_CC1,
  prsSignalWTIMER3_CC2 = PRS_WTIMER3_CC2,
  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
}
 PRS Signal.
 

Function Documentation

◆ PRS_SourceSignalSet()

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.

◆ PRS_SourceAsyncSignalSet()

void PRS_SourceAsyncSignalSet ( unsigned int  ch,
uint32_t  source,
uint32_t  signal 
)

Set the source and asynchronous signal for a channel.

Asynchronous reflexes are not clocked on HFPERCLK and can be used even in EM2/EM3. There is a limitation to reflexes operating in asynchronous mode in that they can only be used by a subset of the reflex consumers. See the PRS chapter in the reference manual for the complete list of supported asynchronous signals and consumers.

Note
This function is not supported on EFM32GxxxFyyy parts. In asynchronous mode, the edge detector only works in EM0 and should not be used. The EDSEL parameter in PRS_CHx_CTRL register is set to 0 (OFF) by default.
Parameters
[in]chA channel to define the source and asynchronous signal for.
[in]sourceA source to select for the channel. Use one of PRS_CH_CTRL_SOURCESEL_x defines.
[in]signalAn asynchronous signal (for selected source) to use. Use one of the PRS_CH_CTRL_SIGSEL_x defines that support asynchronous operation.

◆ PRS_GpioOutputLocation()

void PRS_GpioOutputLocation ( unsigned int  ch,
unsigned int  location 
)

Send the output of a PRS channel to a GPIO pin.

This function is used to send the output of a PRS channel to a GPIO pin. Note that there are certain restrictions to where a PRS channel can be routed. Consult the datasheet of the device to see if a channel can be routed to the requested GPIO pin.

Parameters
[in]chPRS channel number.
[in]locationPRS routing location.

◆ PRS_GetFreeChannel()

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.

◆ PRS_Reset()

void PRS_Reset ( void  )

Reset all PRS channels.

This function will reset all the PRS channel configuration.

◆ PRS_ConnectSignal()

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.

◆ PRS_LevelSet()

void PRS_LevelSet ( uint32_t  level,
uint32_t  mask 
)
inline

Set level control bit for one or more channels.

The level value for a channel is XORed with both the pulse possibly issued by