Skip to content

Commit

Permalink
debug: ppi_trace: use nrfx_gppi to support nRF54L
Browse files Browse the repository at this point in the history
This commit changes implementation of the ppi_trace module
so that it is based on nrfx_gppi as provided since nrfx 3.8.0.
The functions provided by nrfx_gppi library on the nRF54L devices
provide ability to connect events and tasks which cross the power
domains through PPIB bridges.

Most of the functions simply use the nrfx_gppi API, but
`ppi_trace_dppi_ch_trace` is a special one. The nRF54L devices have
multiple DPPIC controllers, so the function `ppi_trace_dppi_ch_trace`
is given an additional parameter that identifies the DPPIC controller.
The channel number is not enough. The function prototype must now
be provided conditionally only for SoCs equipped with DPPI.

GPIOTE can directly subscribe only to DPPI channels of this DPPIC
controller which is in the same power domain. Neither Device Tree nor
nrfx provide such information. That's why `get_dppic_for_gpiote`
function is used internally. It allows handling the case within
`ppi_trace_dppi_ch_trace` function where GPIOTE can subscribe to DPPI
channel directly. The nrfx_gppi API cannot be used for this purpose.

Signed-off-by: Andrzej Kuros <[email protected]>
  • Loading branch information
ankuns committed Dec 3, 2024
1 parent 16880dd commit 38ce2b3
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 140 deletions.
13 changes: 12 additions & 1 deletion include/debug/ppi_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
#define __PPI_TRACE_H

#include <stdint.h>
#include <nrfx.h>

#if defined(DPPI_PRESENT)
#include <nrfx_dppi.h>
#endif

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -48,6 +53,8 @@ void *ppi_trace_config(uint32_t pin, uint32_t evt);
*/
void *ppi_trace_pair_config(uint32_t pin, uint32_t start_evt, uint32_t stop_evt);

#if defined(DPPI_PRESENT)

/** @brief Configure and enable a PPI trace pin for tracing a DPPI channel.
*
* This function allows to trace DPPI triggers without knowing any events being the source of the
Expand All @@ -60,12 +67,16 @@ void *ppi_trace_pair_config(uint32_t pin, uint32_t start_evt, uint32_t stop_evt)
*
* @param pin Pin to use for tracing.
* @param dppi_ch DPPI channel number to be traced on the pin.
* @param dppic Identifies the instance of DPPIC controller that the @c dppi_ch channel
* belongs to.
*
* @retval 0 The configuration succeeded.
* @retval -ENOMEM The configuration failed, due to lack of necessary resources.
* @retval -ENOTSUP The function is not supported on current hardware platform.
*/
int ppi_trace_dppi_ch_trace(uint32_t pin, uint32_t dppi_ch);
int ppi_trace_dppi_ch_trace(uint32_t pin, uint32_t dppi_ch, const nrfx_dppi_t *dppic);

#endif /* DPPI_PRESENT */

/** @brief Enable PPI trace pin.
*
Expand Down
7 changes: 6 additions & 1 deletion subsys/debug/ppi_trace/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
config PPI_TRACE
bool "Enable PPI trace"
select NRFX_GPIOTE
select NRFX_GPPI
select NRFX_PPI if HAS_HW_NRF_PPI
select NRFX_DPPI if HAS_HW_NRF_DPPIC
select NRFX_DPPI0 if SOC_SERIES_NRF53X
select NRFX_DPPI00 if SOC_SERIES_NRF54LX
select NRFX_DPPI10 if SOC_SERIES_NRF54LX
select NRFX_DPPI20 if SOC_SERIES_NRF54LX
select NRFX_DPPI30 if SOC_SERIES_NRF54LX
help
Enable PPI trace module which enables forwarding hardware events to
GPIOs.
Expand Down
Loading

0 comments on commit 38ce2b3

Please sign in to comment.