PRS - Peripheral Reflex System#
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.
Example#
This example demonstrates how to configure the Peripheral Reflex System (PRS) to connect a producer (TIMER0 overflow) directly to a consumer (GPIO pin toggle) without CPU intervention.
#include "sl_hal_prs.h"
#include "sl_hal_timer.h"
#include "sl_hal_gpio.h"
#include "sl_clock_manager.h"
void prs_example(void)
{
// Enable PRS and TIMER0 clocks
sl_clock_manager_enable_bus_clock(SL_BUS_CLOCK_PRS);
sl_clock_manager_enable_bus_clock(SL_BUS_CLOCK_TIMER0);
// Configure GPIO pin as output (e.g., Port D, Pin 1)
sl_gpio_t gpio;
gpio.port = SL_GPIO_PORT_D;
gpio.pin = 1;
sl_hal_gpio_set_pin_mode(&gpio, SL_GPIO_MODE_PUSH_PULL, 0);
// Configure TIMER0 (basic up-counting mode, overflow at 0xFFFF)
sl_hal_timer_init_t timer_init = {0};
timer_init.count_mode = SL_HAL_TIMER_MODE_UP;
timer_init.clock_select = SL_HAL_TIMER_CLKSEL_HFPERCLK;
timer_init.prescaler = SL_HAL_TIMER_PRESCALER_DIV1;
sl_hal_timer_init(TIMER0, &timer_init);
sl_hal_timer_enable(TIMER0);
sl_hal_timer_set_top(TIMER0, 0xFFFF);
sl_hal_timer_start(TIMER0);
// Configure PRS channel 0: TIMER0 overflow as async producer
uint8_t prs_channel = 0;
sl_hal_prs_async_connect_channel_producer(prs_channel, SL_HAL_PRS_ASYNC_TIMER0_OF);
// Route PRS output to GPIO pin (Port D, Pin 1)
sl_hal_prs_pin_output(prs_channel, SL_HAL_PRS_TYPE_ASYNC, SL_GPIO_PORT_D, 1);
// Now, whenever TIMER0 overflows, PRS will toggle the GPIO pin without CPU intervention
}
Modules#
sl_hal_prs_async_channel_init_t
sl_hal_prs_sync_channel_init_t
Enumerations#
Logic functions that can be used when combining two PRS channels.
Async PRS Signals.
Sync PRS Signals.
PRS Consumers.
Functions#
Configure Async channel.
Configure Sync channel.
Search for the first free PRS channel.
Reset all PRS channels.
Connect a peripheral consumer to a PRS channel.
Send the output of a PRS channel to a GPIO pin.
Set level control bit for one channel.
Get level control bit for a channel.
Get the PRS channel value for one channel.
Trigger a high pulse (one HFPERCLK) for one channel.
Set PRS signal for an async channel.
Set PRS signal for a sync channel.
Combine two PRS channels using a logic function.
Macros#
PRS Synchronous channel count.
PRS Asynchronous channel count.
PRS sync initializer.
Enumeration Documentation#
sl_hal_prs_channel_type_t#
sl_hal_prs_channel_type_t
PRS Channel type.
Enumerator | |
---|---|
SL_HAL_PRS_TYPE_ASYNC | Asynchronous channel type. |
SL_HAL_PRS_TYPE_SYNC | Synchronous channel type. |
sl_hal_prs_logic_t#
sl_hal_prs_logic_t
Logic functions that can be used when combining two PRS channels.
Enumerator | |
---|---|
SL_HAL_PRS_LOGIC_ZERO | Logical 0. |
SL_HAL_PRS_LOGIC_A_NOR_B | A NOR B. |
SL_HAL_PRS_LOGIC_NOT_A_AND_B | (!A) NOR B. |
SL_HAL_PRS_LOGIC_NOT_A | !A. |
SL_HAL_PRS_LOGIC_A_AND_NOT_B | A AND (!B). |
SL_HAL_PRS_LOGIC_NOT_B | !B. |
SL_HAL_PRS_LOGIC_A_XOR_B | A XOR B. |
SL_HAL_PRS_LOGIC_A_NAND_B | A NAND B. |
SL_HAL_PRS_LOGIC_A_AND_B | A AND B. |
SL_HAL_PRS_LOGIC_A_XNOR_B | A XNOR B. |
SL_HAL_PRS_LOGIC_B | B. |
SL_HAL_PRS_LOGIC_NOT_A_OR_B | (!A) OR B. |
SL_HAL_PRS_LOGIC_A | A. |
SL_HAL_PRS_LOGIC_A_OR_NOT_B | A OR (!B). |
SL_HAL_PRS_LOGIC_A_OR_B | A OR B. |
SL_HAL_PRS_LOGIC_ONE | Logical 1. |
sl_hal_prs_async_producer_signal_t#
sl_hal_prs_async_producer_signal_t
Async PRS Signals.
Enumerator | |
---|---|
SL_HAL_PRS_ASYNC_NONE | No Signal. |
SL_HAL_PRS_ASYNC_USART0_CS | USART0 CS Signal. |
SL_HAL_PRS_ASYNC_USART0_IRTX | USART0 IRTX Signal. |
SL_HAL_PRS_ASYNC_USART0_RTS | USART0 RTS Signal. |
SL_HAL_PRS_ASYNC_USART0_RXDATA | USART0 RXDATA Signal. |
SL_HAL_PRS_ASYNC_USART0_TX | USART0 TX Signal. |
SL_HAL_PRS_ASYNC_USART0_TXC | USART0 TXC Signal. |
SL_HAL_PRS_ASYNC_USART1_CS | USART1 CS Signal. |
SL_HAL_PRS_ASYNC_USART1_IRTX | USART1 IRTX Signal. |
SL_HAL_PRS_ASYNC_USART1_RTS | USART1 RTS Signal. |
SL_HAL_PRS_ASYNC_USART1_RXDATA | USART1 RXDATA Signal. |
SL_HAL_PRS_ASYNC_USART1_TX | USART1 TX Signal. |
SL_HAL_PRS_ASYNC_USART1_TXC | USART1 TXC Signal. |
SL_HAL_PRS_ASYNC_TIMER0_UF | TIMER0 UF Signal. |
SL_HAL_PRS_ASYNC_TIMER0_OF | TIMER0 OF Signal. |
SL_HAL_PRS_ASYNC_TIMER0_CC0 | TIMER0 CC0 Signal. |
SL_HAL_PRS_ASYNC_TIMER0_CC1 | TIMER0 CC1 Signal. |
SL_HAL_PRS_ASYNC_TIMER0_CC2 | TIMER0 CC2 Signal. |
SL_HAL_PRS_ASYNC_TIMER1_UF | TIMER1 UF Signal. |
SL_HAL_PRS_ASYNC_TIMER1_OF | TIMER1 OF Signal. |
SL_HAL_PRS_ASYNC_TIMER1_CC0 | TIMER1 CC0 Signal. |
SL_HAL_PRS_ASYNC_TIMER1_CC1 | TIMER1 CC1 Signal. |
SL_HAL_PRS_ASYNC_TIMER1_CC2 | TIMER1 CC2 Signal. |
SL_HAL_PRS_ASYNC_IADC0_SCANENTRYDONE | IADC0 SCANENTRYDONE Signal. |
SL_HAL_PRS_ASYNC_IADC0_SCANTABLEDONE | IADC0 SCANTABLEDONE Signal. |
SL_HAL_PRS_ASYNC_IADC0_SINGLEDONE | IADC0 SINGLEDONE Signal. |
SL_HAL_PRS_ASYNC_LETIMER0_CH0 | LETIMER0 CH0 Signal. |
SL_HAL_PRS_ASYNC_LETIMER0_CH1 | LETIMER0 CH1 Signal. |
SL_HAL_PRS_ASYNC_RTCC_CCV0 | RTCC CCV0 Signal. |
SL_HAL_PRS_ASYNC_RTCC_CCV1 | RTCC CCV1 Signal. |
SL_HAL_PRS_ASYNC_RTCC_CCV2 | RTCC CCV2 Signal. |
SL_HAL_PRS_ASYNC_BURTC_COMP | BURTC COMP Signal. |
SL_HAL_PRS_ASYNC_BURTC_OVERFLOW | BURTC OVERFLOW Signal. |
SL_HAL_PRS_ASYNC_GPIO_PIN0 | GPIO PIN0 Signal. |
SL_HAL_PRS_ASYNC_GPIO_PIN1 | GPIO PIN1 Signal. |
SL_HAL_PRS_ASYNC_GPIO_PIN2 | GPIO PIN2 Signal. |
SL_HAL_PRS_ASYNC_GPIO_PIN3 | GPIO PIN3 Signal. |
SL_HAL_PRS_ASYNC_GPIO_PIN4 | GPIO PIN4 Signal. |
SL_HAL_PRS_ASYNC_GPIO_PIN5 | GPIO PIN5 Signal. |
SL_HAL_PRS_ASYNC_GPIO_PIN6 | GPIO PIN6 Signal. |
SL_HAL_PRS_ASYNC_GPIO_PIN7 | GPIO PIN7 Signal. |
SL_HAL_PRS_ASYNC_TIMER2_UF | TIMER2 UF Signal. |
SL_HAL_PRS_ASYNC_TIMER2_OF | TIMER2 OF Signal. |
SL_HAL_PRS_ASYNC_TIMER2_CC0 | TIMER2 CC0 Signal. |
SL_HAL_PRS_ASYNC_TIMER2_CC1 | TIMER2 CC1 Signal. |
SL_HAL_PRS_ASYNC_TIMER2_CC2 | TIMER2 CC2 Signal. |
SL_HAL_PRS_ASYNC_TIMER3_UF | TIMER3 UF Signal. |
SL_HAL_PRS_ASYNC_TIMER3_OF | TIMER3 OF Signal. |
SL_HAL_PRS_ASYNC_TIMER3_CC0 | TIMER3 CC0 Signal. |
SL_HAL_PRS_ASYNC_TIMER3_CC1 | TIMER3 CC1 Signal. |
SL_HAL_PRS_ASYNC_TIMER3_CC2 | TIMER3 CC2 Signal. |
SL_HAL_PRS_ASYNC_CORE_CTIOUT0 | CORE CTIOUT0 Signal. |
SL_HAL_PRS_ASYNC_CORE_CTIOUT1 | CORE CTIOUT1 Signal. |
SL_HAL_PRS_ASYNC_CORE_CTIOUT2 | CORE CTIOUT2 Signal. |
SL_HAL_PRS_ASYNC_CORE_CTIOUT3 | CORE CTIOUT3 Signal. |
SL_HAL_PRS_ASYNC_CMUL_CLKOUT0 | CMUL CLKOUT0 Signal. |
SL_HAL_PRS_ASYNC_CMUL_CLKOUT1 | CMUL CLKOUT1 Signal. |
SL_HAL_PRS_ASYNC_CMUL_CLKOUT2 | CMUL CLKOUT2 Signal. |
SL_HAL_PRS_ASYNC_PRORTC_CCV0 | PRORTC CCV0 Signal. |
SL_HAL_PRS_ASYNC_PRORTC_CCV1 | PRORTC CCV1 Signal. |
SL_HAL_PRS_ASYNC_ACMP0_OUT | ACMP0 OUT Signal. |
SL_HAL_PRS_ASYNC_ACMP1_OUT | ACMP1 OUT Signal. |
SL_HAL_PRS_ASYNC_USART2_CS | USART2 CS Signal. |
SL_HAL_PRS_ASYNC_USART2_IRTX | USART2 IRTX Signal. |
SL_HAL_PRS_ASYNC_USART2_RTS | USART2 RTS Signal. |
SL_HAL_PRS_ASYNC_USART2_RXDATA | USART2 RXDATA Signal. |
SL_HAL_PRS_ASYNC_USART2_TX | USART2 TX Signal. |
SL_HAL_PRS_ASYNC_USART2_TXC | USART2 TXC Signal. |
SL_HAL_PRS_ASYNC_BUFC_THR0 | BUFC THR0 Signal. |
SL_HAL_PRS_ASYNC_BUFC_THR1 | BUFC THR1 Signal. |
SL_HAL_PRS_ASYNC_BUFC_THR2 | BUFC THR2 Signal. |
SL_HAL_PRS_ASYNC_BUFC_THR3 | BUFC THR3 Signal. |
SL_HAL_PRS_ASYNC_BUFC_CNT0 | BUFC CNT0 Signal. |
SL_HAL_PRS_ASYNC_BUFC_CNT1 | BUFC CNT1 Signal. |
SL_HAL_PRS_ASYNC_BUFC_FULL | BUFC FULL Signal. |
sl_hal_prs_sync_producer_signal_t#
sl_hal_prs_sync_producer_signal_t
Sync PRS Signals.
Enumerator | |
---|---|
SL_HAL_PRS_SYNC_NONE | No Signal. |
SL_HAL_PRS_SYNC_TIMER0_UF | TIMER0 UF Signal. |
SL_HAL_PRS_SYNC_TIMER0_OF | TIMER0 OF Signal. |
SL_HAL_PRS_SYNC_TIMER0_CC0 | TIMER0 CC0 Signal. |
SL_HAL_PRS_SYNC_TIMER0_CC1 | TIMER0 CC1 Signal. |
SL_HAL_PRS_SYNC_TIMER0_CC2 | TIMER0 CC2 Signal. |
SL_HAL_PRS_SYNC_TIMER1_UF | TIMER1 UF Signal. |
SL_HAL_PRS_SYNC_TIMER1_OF | TIMER1 OF Signal. |
SL_HAL_PRS_SYNC_TIMER1_CC0 | TIMER1 CC0 Signal. |
SL_HAL_PRS_SYNC_TIMER1_CC1 | TIMER1 CC1 Signal. |
SL_HAL_PRS_SYNC_TIMER1_CC2 | TIMER1 CC2 Signal. |
SL_HAL_PRS_SYNC_IADC0_SCANENTRYDONE | IADC0 SCANENTRYDONE Signal. |
SL_HAL_PRS_SYNC_IADC0_SCANTABLEDONE | IADC0 SCANTABLEDONE Signal. |
SL_HAL_PRS_SYNC_IADC0_SINGLEDONE | IADC0 SINGLEDONE Signal. |
SL_HAL_PRS_SYNC_TIMER2_UF | TIMER2 UF Signal. |
SL_HAL_PRS_SYNC_TIMER2_OF | TIMER2 OF Signal. |
SL_HAL_PRS_SYNC_TIMER2_CC0 | TIMER2 CC0 Signal. |
SL_HAL_PRS_SYNC_TIMER2_CC1 | TIMER2 CC1 Signal. |
SL_HAL_PRS_SYNC_TIMER2_CC2 | TIMER2 CC2 Signal. |
SL_HAL_PRS_SYNC_TIMER3_UF | TIMER3 UF Signal. |
SL_HAL_PRS_SYNC_TIMER3_OF | TIMER3 OF Signal. |
SL_HAL_PRS_SYNC_TIMER3_CC0 | TIMER3 CC0 Signal. |
SL_HAL_PRS_SYNC_TIMER3_CC1 | TIMER3 CC1 Signal. |
SL_HAL_PRS_SYNC_TIMER3_CC2 | TIMER3 CC2 Signal. |
sl_hal_prs_consumer_event_t#
sl_hal_prs_consumer_event_t
PRS Consumers.
Enumerator | |
---|---|
SL_HAL_PRS_CONSUMER_NONE | No PRS consumer. |
SL_HAL_PRS_CONSUMER_CMU_CALDN | CMU CALDN consumer consumer. |
SL_HAL_PRS_CONSUMER_CMU_CALUP | CMU CALUP Consumer consumer. |
SL_HAL_PRS_CONSUMER_IADC0_SCANTRIGGER | IADC0 SCANTRIGGER consumer consumer. |
SL_HAL_PRS_CONSUMER_IADC0_SINGLETRIGGER | IADC0 SINGLETRIGGER Consumer consumer. |
SL_HAL_PRS_CONSUMER_LDMAXBAR_DMAREQ0 | LDMAXBAR DMAREQ0 consumer consumer. |
SL_HAL_PRS_CONSUMER_LDMAXBAR_DMAREQ1 | LDMAXBAR DMAREQ1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_LETIMER0_CLEAR | LETIMER0 CLEAR consumer consumer. |
SL_HAL_PRS_CONSUMER_LETIMER0_START | LETIMER0 START Consumer consumer. |
SL_HAL_PRS_CONSUMER_LETIMER0_STOP | LETIMER0 STOP Consumer consumer. |
SL_HAL_PRS_CONSUMER_MODEM_DIN | MODEM DIN consumer consumer. |
SL_HAL_PRS_CONSUMER_RAC_CLR | RAC CLR consumer consumer. |
SL_HAL_PRS_CONSUMER_RAC_FORCETX | RAC FORCETX Consumer consumer. |
SL_HAL_PRS_CONSUMER_RAC_RXDIS | RAC RXDIS Consumer consumer. |
SL_HAL_PRS_CONSUMER_RAC_RXEN | RAC RXEN Consumer consumer. |
SL_HAL_PRS_CONSUMER_RAC_SEQ | RAC SEQ Consumer consumer. |
SL_HAL_PRS_CONSUMER_RAC_TXEN | RAC TXEN Consumer consumer. |
SL_HAL_PRS_CONSUMER_RTCC_CC0 | RTCC CC0 consumer consumer. |
SL_HAL_PRS_CONSUMER_RTCC_CC1 | RTCC CC1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_RTCC_CC2 | RTCC CC2 Consumer consumer. |
SL_HAL_PRS_CONSUMER_CORE_CTIIN0 | CORE CTIIN0 consumer consumer. |
SL_HAL_PRS_CONSUMER_CORE_CTIIN1 | CORE CTIIN1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_CORE_CTIIN2 | CORE CTIIN2 Consumer consumer. |
SL_HAL_PRS_CONSUMER_CORE_CTIIN3 | CORE CTIIN3 Consumer consumer. |
SL_HAL_PRS_CONSUMER_CORE_M33RXEV | CORE M33RXEV Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER0_CC0 | TIMER0 CC0 consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER0_CC1 | TIMER0 CC1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER0_CC2 | TIMER0 CC2 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER0_DTI | TIMER0 DTI Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER0_DTIFS1 | TIMER0 DTIFS1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER0_DTIFS2 | TIMER0 DTIFS2 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER1_CC0 | TIMER1 CC0 consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER1_CC1 | TIMER1 CC1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER1_CC2 | TIMER1 CC2 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER1_DTI | TIMER1 DTI Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER1_DTIFS1 | TIMER1 DTIFS1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER1_DTIFS2 | TIMER1 DTIFS2 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER2_CC0 | TIMER2 CC0 consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER2_CC1 | TIMER2 CC1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER2_CC2 | TIMER2 CC2 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER2_DTI | TIMER2 DTI Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER2_DTIFS1 | TIMER2 DTIFS1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER2_DTIFS2 | TIMER2 DTIFS2 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER3_CC0 | TIMER3 CC0 consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER3_CC1 | TIMER3 CC1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER3_CC2 | TIMER3 CC2 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER3_DTI | TIMER3 DTI Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER3_DTIFS1 | TIMER3 DTIFS1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_TIMER3_DTIFS2 | TIMER3 DTIFS2 Consumer consumer. |
SL_HAL_PRS_CONSUMER_USART0_CLK | USART0 CLK consumer consumer. |
SL_HAL_PRS_CONSUMER_USART0_IR | USART0 IR Consumer consumer. |
SL_HAL_PRS_CONSUMER_USART0_RX | USART0 RX Consumer consumer. |
SL_HAL_PRS_CONSUMER_USART0_TRIGGER | USART0 TRIGGER Consumer consumer. |
SL_HAL_PRS_CONSUMER_USART1_CLK | USART1 CLK consumer consumer. |
SL_HAL_PRS_CONSUMER_USART1_IR | USART1 IR Consumer consumer. |
SL_HAL_PRS_CONSUMER_USART1_RX | USART1 RX Consumer consumer. |
SL_HAL_PRS_CONSUMER_USART1_TRIGGER | USART1 TRIGGER Consumer consumer. |
SL_HAL_PRS_CONSUMER_WDOG0_SRC0 | WDOG0 SRC0 consumer consumer. |
SL_HAL_PRS_CONSUMER_WDOG0_SRC1 | WDOG0 SRC1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_WDOG1_SRC0 | WDOG1 SRC0 consumer consumer. |
SL_HAL_PRS_CONSUMER_WDOG1_SRC1 | WDOG1 SRC1 Consumer consumer. |
SL_HAL_PRS_CONSUMER_USART2_CLK | USART2 CLK consumer consumer. |
SL_HAL_PRS_CONSUMER_USART2_IR | USART2 IR Consumer consumer. |
SL_HAL_PRS_CONSUMER_USART2_RX | USART2 RX Consumer consumer. |
SL_HAL_PRS_CONSUMER_USART2_TRIGGER | USART2 TRIGGER Consumer consumer. |
SL_HAL_PRS_CONSUMER_SE_TAMPERSRC0 | SE TAMPERSRC0 TAMPERSRC0 Consumer Selection consumer. |
SL_HAL_PRS_CONSUMER_SE_TAMPERSRC1 | SE TAMPERSRC1 TAMPERSRC1 Consumer Selection consumer. |
SL_HAL_PRS_CONSUMER_SE_TAMPERSRC2 | SE TAMPERSRC2 TAMPERSRC2 Consumer Selection consumer. |
SL_HAL_PRS_CONSUMER_SE_TAMPERSRC3 | SE TAMPERSRC3 TAMPERSRC3 Consumer Selection consumer. |
SL_HAL_PRS_CONSUMER_SE_TAMPERSRC4 | SE TAMPERSRC4 TAMPERSRC4 Consumer Selection consumer. |
SL_HAL_PRS_CONSUMER_SE_TAMPERSRC5 | SE TAMPERSRC5 TAMPERSRC5 Consumer Selection consumer. |
SL_HAL_PRS_CONSUMER_SE_TAMPERSRC6 | SE TAMPERSRC6 TAMPERSRC6 Consumer Selection consumer. |
SL_HAL_PRS_CONSUMER_SE_TAMPERSRC7 | SE TAMPERSRC7 TAMPERSRC7 Consumer Selection consumer. |
Function Documentation#
sl_hal_prs_async_init_channel#
void sl_hal_prs_async_init_channel (const sl_hal_prs_async_channel_init_t * init)
Configure Async channel.
Type | Direction | Argument Name | Description |
---|---|---|---|
const sl_hal_prs_async_channel_init_t * | [in] | init | Pointer to configuration structure. |
sl_hal_prs_sync_init_channel#
void sl_hal_prs_sync_init_channel (const sl_hal_prs_sync_channel_init_t * init)
Configure Sync channel.
Type | Direction | Argument Name | Description |
---|---|---|---|
const sl_hal_prs_sync_channel_init_t * | [in] | init | Pointer to configuration structure. |
sl_hal_prs_get_free_channel#
sl_status_t sl_hal_prs_get_free_channel (uint8_t * channel, sl_hal_prs_channel_type_t channel_type)
Search for the first free PRS channel.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t * | [in] | channel | PRS channel number. |
sl_hal_prs_channel_type_t | [in] | channel_type | PRS channel type. This can be either SL_HAL_PRS_TYPE_ASYNC or SL_HAL_PRS_TYPE_SYNC. |
It applies for sync/async channels.
Returns
SL_STATUS_OK if an unused PRS channel was found. If no free PRS channel was found then SL_STATUS_FAIL is returned.
sl_hal_prs_reset#
void sl_hal_prs_reset (void )
Reset all PRS channels.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function will reset all the PRS channel configuration.
sl_hal_prs_connect_channel_consumer#
void sl_hal_prs_connect_channel_consumer (uint8_t channel, sl_hal_prs_channel_type_t channel_type, sl_hal_prs_consumer_event_t consumer_event)
Connect a peripheral consumer to a PRS channel.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | channel | PRS channel number. |
sl_hal_prs_channel_type_t | [in] | channel_type | PRS channel type. This can be either SL_HAL_PRS_TYPE_ASYNC or SL_HAL_PRS_TYPE_SYNC. |
sl_hal_prs_consumer_event_t | [in] | consumer_event | This is the PRS consumer. |
Different peripherals can use PRS channels as their input. This function can be used to connect a peripheral consumer to a PRS channel. Multiple consumers can be connected to a single PRS channel. It applies for sync/async channels.
sl_hal_prs_pin_output#
void sl_hal_prs_pin_output (uint8_t channel, sl_hal_prs_channel_type_t channel_type, sl_gpio_port_t port, uint8_t pin)
Send the output of a PRS channel to a GPIO pin.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | channel | PRS channel number. |
sl_hal_prs_channel_type_t | [in] | channel_type | PRS channel type. This can be either SL_HAL_PRS_TYPE_ASYNC or SL_HAL_PRS_TYPE_SYNC. |
sl_gpio_port_t | [in] | port | GPIO port |
uint8_t | [in] | pin | GPIO pin |
This function is used to send the output of a PRS channel to a GPIO pin.
Note
There are certain restrictions to where a PRS channel can be routed. Consult the datasheet of the device to see if the selected
channel
is routable to the requested gpioport
. Some devices for instance can only route the async channels 0-5 on GPIO pins PAx and PBx while async channels 6-11 can only be routed to GPIO pins PCx and PDx. It applies for sync/async channels.
sl_hal_prs_async_set_channel_swlevel#
void sl_hal_prs_async_set_channel_swlevel (uint8_t channel, bool level)
Set level control bit for one channel.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | channel | channel to set level for. Use logical OR combination of PRS_SWLEVEL_CHnLEVEL defines. |
bool | [in] | level | Level to use for channel |
The level value for a channel is XORed with both the pulse possibly issued by sl_hal_prs_async_set_channel_swpulse() and the PRS input signal selected for the channel(s).
sl_hal_prs_async_get_channel_swlevel#
bool sl_hal_prs_async_get_channel_swlevel (uint8_t channel)
Get level control bit for a channel.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | channel | Channel to get level for. |
Returns
The current software level configuration for a channel.
sl_hal_prs_get_channel_value#
bool sl_hal_prs_get_channel_value (uint8_t channel, sl_hal_prs_channel_type_t channel_type)
Get the PRS channel value for one channel.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | channel | PRS channel to get value for. |
sl_hal_prs_channel_type_t | [in] | channel_type | PRS channel type. This can be either SL_HAL_PRS_TYPE_ASYNC or SL_HAL_PRS_TYPE_SYNC. |
It applies for sync/async channels
Returns
The current PRS channel output value.
sl_hal_prs_async_set_channel_swpulse#
void sl_hal_prs_async_set_channel_swpulse (uint8_t channel)
Trigger a high pulse (one HFPERCLK) for one channel.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | channel | PRS channel to trigger a pulse. |
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).
sl_hal_prs_async_connect_channel_producer#
void sl_hal_prs_async_connect_channel_producer (uint8_t channel, sl_hal_prs_async_producer_signal_t producer_signal)
Set PRS signal for an async channel.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | channel | PRS channel number. |
sl_hal_prs_async_producer_signal_t | [in] | producer_signal | An async peripheral signal selected as a producer for PRS channel. It is a combination of source select and signal select values. |
sl_hal_prs_sync_connect_channel_producer#
void sl_hal_prs_sync_connect_channel_producer (uint8_t channel, sl_hal_prs_sync_producer_signal_t producer_signal)
Set PRS signal for a sync channel.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | channel | PRS channel number. |
sl_hal_prs_sync_producer_signal_t | [in] | producer_signal | A sync peripheral signal selected as a producer for PRS channel. It is a combination of source select and signal select values. |
sl_hal_prs_async_combine_signals#
void sl_hal_prs_async_combine_signals (uint8_t channel_a, uint8_t channel_b, sl_hal_prs_logic_t logic)
Combine two PRS channels using a logic function.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | channel_a | PRS Channel for the A input. |
uint8_t | [in] | channel_b | PRS Channel for the B input. |
sl_hal_prs_logic_t | [in] | logic | The logic function to use when combining the Channel A and Channel B. The output of the logic function is the output of Channel A. Function like AND, OR, XOR, NOT and more are available. |
This function allows you to combine the output of one PRS channel with the the signal of another PRS channel using various logic functions. Note that for series 2, config 1 devices, the hardware only allows a PRS channel to be combined with the previous channel. So for instance channel 5 can be combined only with channel 4. The logic function operates on two PRS channels called A and B. The output of PRS channel B is combined with the PRS source configured for channel A to produce an output. This output is used as the output of channel A.