PRS
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.
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.
|
|
__STATIC_INLINE bool | PRS_ChannelValue (unsigned int ch, PRS_ChType_t type) |
Get the PRS channel value for a single 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.
|
|
void | PRS_GpioOutputLocation (unsigned int ch, unsigned int location) |
Send the output of a PRS channel to a GPIO pin.
|
|
__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_SourceAsyncSignalSet (unsigned int ch, uint32_t source, uint32_t signal) |
Set the source and asynchronous signal for a channel.
|
|
void | PRS_SourceSignalSet (unsigned int ch, uint32_t source, uint32_t signal, PRS_Edge_TypeDef edge) |
Set a source and signal for a channel.
|
|
__STATIC_INLINE uint32_t | PRS_Values ( PRS_ChType_t type) |
Get the PRS channel values for all channels.
|
|
Enumeration Type Documentation
enum PRS_ChType_t |
enum PRS_Edge_TypeDef |
enum PRS_Signal_t |
PRS Signal.
Definition at line
134
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] ch
PRS channel number. [in] level
true to set the level high (1) and false to set the level low (0).
Definition at line
435
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] ch
PRS channel number.
Definition at line
447
of file
em_prs.h
.
References PRS_PulseTrigger() .
__STATIC_INLINE bool PRS_ChannelValue | ( | unsigned int |
ch,
|
PRS_ChType_t |
type
|
||
) |
Get the PRS channel value for a single channel.
- Parameters
-
[in] ch
PRS channel number. [in] type
PRS channel type. This can be either prsTypeAsync or prsTypeSync .
- Returns
- The current PRS channel output value. This is either 0 or 1.
Definition at line
396
of file
em_prs.h
.
References PRS_Values() .
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] ch
PRS channel number. [in] type
PRS channel type. This can be either prsTypeAsync or prsTypeSync . [in] signal
This is the PRS signal that should be placed on the channel.
Definition at line
382
of file
em_prs.c
.
References prsTypeAsync .
Referenced by PRS_SourceAsyncSignalSet() .
int PRS_GetFreeChannel | ( | PRS_ChType_t |
type
|
) |
Search for the first free PRS channel.
- Parameters
-
[in] type
PRS 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
315
of file
em_prs.c
.
References prsTypeAsync .
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] ch
PRS channel number. [in] loc
PRS routing location.
Definition at line
282
of file
em_prs.c
.
__STATIC_INLINE uint32_t PRS_LevelGet | ( | void |
|
) |
Get level control bit for all channels.
- Returns
- The current software level configuration.
Definition at line
347
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] level
Level 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] mask
Mask indicating which channels to set level for. Use logical OR combination of PRS_SWLEVEL_CHnLEVEL defines.
Definition at line
331
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] channels
Logical ORed combination of channels to trigger a pulse for. Use PRS_SWPULSE_CHnPULSE defines.
Definition at line
416
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
344
of file
em_prs.c
.
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] ch
A channel to define the source and asynchronous signal for. [in] source
A source to select for the channel. Use one of PRS_CH_CTRL_SOURCESEL_x defines. [in] signal
An asynchronous signal (for selected source
) to use. Use one of the PRS_CH_CTRL_SIGSEL_x defines that support asynchronous operation.
Definition at line
257
of file
em_prs.c
.
References PRS_ConnectSignal() , and prsTypeAsync .
Referenced by adcDeInit() , ezradio_hal_GpioInit() , MIC_deInit() , and MIC_init() .
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] ch
A channel to define the signal and source for. [in] source
A source to select for the channel. Use one of PRS_CH_CTRL_SOURCESEL_x defines. [in] signal
A signal (for selected source
) to use. Use one of PRS_CH_CTRL_SIGSEL_x defines.[in] edge
An edge (for selected source/signal) to generate the pulse for.
Definition at line
210
of file
em_prs.c
.
__STATIC_INLINE uint32_t PRS_Values | ( | PRS_ChType_t |
type
|
) |
Get the PRS channel values for all channels.
- Parameters
-
[in] type
PRS channel type. This can be either prsTypeAsync or prsTypeSync .
- Returns
- The current PRS channel output values for all channels as a bitset.
Definition at line
368
of file
em_prs.h
.
References prsTypeAsync .
Referenced by PRS_ChannelValue() .