nrfx 4.5.0
Loading...
Searching...
No Matches
Generic PPI layer

Helper layer that provides the common functionality of PPI system. More...

Topics

 Generic PPI layer configuration
 
 Generic PPI layer (legacy)
 Helper layer that provides the common functionality of PPI and DPPI drivers.
 
 GPPI Routes
 Structures and macros for handling GPPI routes in multi-domain DPPI system.
 
 GPPI structures specific to Distributed (across multiple domains) DPPI (D2PPI) architecture.
 Structures for SoC specific GPPI API.
 

Data Structures

struct  nrfx_gppi_t
 Structure which holds resources for PPI system. More...
 
struct  nrfx_gppi_resource_t
 A structure describing a DPPI resource in multi domain system. More...
 

Macros

#define NRFX_GPPI_MULTI_DOMAIN   1
 Flag indicating that DPPI system consists of multiple domains (instances).
 
#define NRFX_GPPI_FIXED_CONNECTIONS   1
 Flag indicating that there are fixed connections between PPIB and DPPI channels.
 

Typedefs

typedef uint32_t nrfx_gppi_handle_t
 Handle used for PPI connection.
 
typedef uint32_t nrfx_gppi_group_handle_t
 Handle used for PPI group resource.
 

Functions

void nrfx_gppi_init (nrfx_gppi_t *p_instance)
 Function for initializing GPPI with a structure with resources.
 
NRFX_STATIC_INLINE uint32_t nrfx_gppi_group_domain_id_get (nrfx_gppi_group_handle_t handle)
 Function for getting the domain ID from the group handle.
 
NRFX_STATIC_INLINE uint32_t nrfx_gppi_domain_id_get (uint32_t addr)
 Function for getting the domain ID from the peripheral register address.
 
NRFX_STATIC_INLINE int nrfx_gppi_ep_channel_get (uint32_t ep)
 Function for getting the channel that is used for an endpoint.
 
int nrfx_gppi_domain_channel_get (nrfx_gppi_handle_t handle, uint32_t node_id)
 Function for getting one of a channels that is used in a connection.
 
int nrfx_gppi_domain_conn_alloc (uint32_t producer, uint32_t consumer, nrfx_gppi_handle_t *p_handle)
 Function for allocating and setup a connection between two domains.
 
int nrfx_gppi_ep_attach (uint32_t ep, nrfx_gppi_handle_t handle)
 Function for attaching an endpoint to the connection.
 
int nrfx_gppi_ep_to_ch_attach (uint32_t ep, uint8_t channel)
 Function for attaching an endpoint to the channel.
 
int nrfx_gppi_conn_alloc (uint32_t eep, uint32_t tep, nrfx_gppi_handle_t *p_handle)
 Function for allocating a connection between Task and Event.
 
void nrfx_gppi_domain_conn_free (nrfx_gppi_handle_t handle)
 Function for freeing a connection between domains.
 
void nrfx_gppi_ep_clear (uint32_t ep)
 Function for clearing an endpoint.
 
void nrfx_gppi_ep_ch_clear (uint32_t ep, uint8_t channel)
 Function for clearing an endpoint.
 
void nrfx_gppi_ep_enable (uint32_t ep)
 Function for enabling an endpoint.
 
void nrfx_gppi_ep_disable (uint32_t ep)
 Function for disabling an endpoint.
 
void nrfx_gppi_conn_free (uint32_t eep, uint32_t tep, nrfx_gppi_handle_t handle)
 Function for clearing and freeing a connection.
 
void nrfx_gppi_conn_enable (nrfx_gppi_handle_t handle)
 Function for enabling a connection.
 
void nrfx_gppi_conn_disable (nrfx_gppi_handle_t handle)
 Function for disabling a connection.
 
void nrfx_gppi_channels_enable (uint32_t domain_id, uint32_t ch_mask)
 Function for enabling channels in a domain.
 
void nrfx_gppi_channels_disable (uint32_t domain_id, uint32_t ch_mask)
 Function for disabling channels in a domain.
 
bool nrfx_gppi_chan_is_enabled (uint32_t domain_id, uint32_t ch)
 Function for checking if a channel is enabled.
 
NRFX_STATIC_INLINE int nrfx_gppi_ep_chan_enable (uint32_t ep)
 Function for enabling a channel used by the endpoint.
 
NRFX_STATIC_INLINE int nrfx_gppi_ep_is_enabled (uint32_t ep)
 Function for checking if a channel assigned to the endpoint is enabled.
 
NRFX_STATIC_INLINE int nrfx_gppi_ep_chan_disable (uint32_t ep)
 Function for disabling a channel used by the endpoint.
 
int nrfx_gppi_group_alloc (uint32_t domain_id, nrfx_gppi_group_handle_t *p_handle)
 Function for allocating a group for given set of endpoints.
 
void nrfx_gppi_group_free (nrfx_gppi_group_handle_t handle)
 Function for freeing a group.
 
void nrfx_gppi_group_ch_add (nrfx_gppi_group_handle_t handle, uint32_t channel)
 Function for adding a channel to a group.
 
void nrfx_gppi_group_ch_remove (nrfx_gppi_group_handle_t handle, uint32_t channel)
 Function for removing a channel from a group.
 
NRFX_STATIC_INLINE int nrfx_gppi_group_ep_add (nrfx_gppi_group_handle_t handle, uint32_t ep)
 Function for adding a configured endpoint to a group.
 
NRFX_STATIC_INLINE int nrfx_gppi_group_ep_remove (nrfx_gppi_group_handle_t handle, uint32_t ep)
 Function for removing a configured endpoint from a group.
 
uint32_t nrfx_gppi_group_channels_get (nrfx_gppi_group_handle_t handle)
 Function for getting a mask with channels which are assigned to the group.
 
void nrfx_gppi_group_enable (nrfx_gppi_group_handle_t handle)
 Function for enabling a group.
 
void nrfx_gppi_group_disable (nrfx_gppi_group_handle_t handle)
 Function for disabling a group.
 
uint32_t nrfx_gppi_group_task_en_addr (nrfx_gppi_group_handle_t handle)
 Function for getting the enable group task address.
 
uint32_t nrfx_gppi_group_task_dis_addr (nrfx_gppi_group_handle_t handle)
 Function for getting the disable group task address.
 
int nrfx_gppi_channel_alloc (uint32_t node_id)
 Function for allocating a group channel in a specific node of the DPPI system.
 
void nrfx_gppi_channel_free (uint32_t node_id, uint8_t channel)
 Function for freeing a channel in a specific node of the DPPI system.
 
int nrfx_gppi_group_channel_alloc (uint32_t domain_id)
 Function for allocating a group channel in a specific node of the DPPI system.
 
void nrfx_gppi_group_channel_free (uint32_t domain_id, uint8_t channel)
 Function for freeing a group channel in a specific node of the DPPI system.
 
int nrfx_gppi_ext_conn_alloc (uint32_t producer, uint32_t consumer, nrfx_gppi_handle_t *p_handle, nrfx_gppi_resource_t *p_resource)
 Function for allocating and setting up a connection using an external resource.
 

Detailed Description

Helper layer that provides the common functionality of PPI system.

This is the only place where PPI system resources are managed.

There are 4 types of peripheral interconnection systems:

Function Documentation

◆ nrfx_gppi_chan_is_enabled()

bool nrfx_gppi_chan_is_enabled ( uint32_t domain_id,
uint32_t ch )

Function for checking if a channel is enabled.

Parameters
[in]domain_idDomain ID. nrfx_gppi_domain_id_get can be used to get domain_id.
[in]chChannel.
Return values
trueChannel is enabled.
falseChannel is disabled.

◆ nrfx_gppi_channel_alloc()

int nrfx_gppi_channel_alloc ( uint32_t node_id)

Function for allocating a group channel in a specific node of the DPPI system.

Function can be used to allocate a resource and use it outside of this driver.

Note
node_id parameter is used only in the system with multiple domains. nrfx_gppi_domain_id_get or target-specific header can be used to get the node ID (see nrfx_gppi_node_id_t).
If NRFX_GPPI_CONFIG_EXT_ALLOCATOR then external implementation need to be provided.
Parameters
[in]node_idTarget-specific identifier of the DPPI system node (DPPIC or PPIB).
Return values
non-negativeAllocated channel.
-ENOMEMFailed to allocate a channel.

◆ nrfx_gppi_channel_free()

void nrfx_gppi_channel_free ( uint32_t node_id,
uint8_t channel )

Function for freeing a channel in a specific node of the DPPI system.

channel must be allocated earlier using nrfx_gppi_channel_alloc. node_id must be the same as the one used in nrfx_gppi_channel_alloc for allocating that resource.

Note
If NRFX_GPPI_CONFIG_EXT_ALLOCATOR then external implementation need to be provided.
Parameters
[in]node_idTarget-specific identifier of the DPPI system node (DPPIC or PPIB).
[in]channelChannel.

◆ nrfx_gppi_channels_disable()

void nrfx_gppi_channels_disable ( uint32_t domain_id,
uint32_t ch_mask )

Function for disabling channels in a domain.

Parameters
[in]domain_idDomain ID. nrfx_gppi_domain_id_get can be used to get domain_id.
[in]ch_maskChannel mask.

◆ nrfx_gppi_channels_enable()

void nrfx_gppi_channels_enable ( uint32_t domain_id,
uint32_t ch_mask )

Function for enabling channels in a domain.

Parameters
[in]domain_idDomain ID. nrfx_gppi_domain_id_get can be used to get domain_id.
[in]ch_maskChannel mask.

◆ nrfx_gppi_conn_alloc()

int nrfx_gppi_conn_alloc ( uint32_t eep,
uint32_t tep,
nrfx_gppi_handle_t * p_handle )

Function for allocating a connection between Task and Event.

Function performs nrfx_gppi_domain_conn_alloc followed by the configuration of endpoints.

Parameters
[in]eepEvent endpoint address.
[in]tepTask endpoint address.
[out]p_handleHandle used to control the connection.
Return values
0Successful connection allocation.
-ENOMEMThere is not enough resources to allocate the connection.
-EINVALeep or tep is already configured to be used by the DPPI.

◆ nrfx_gppi_conn_disable()

void nrfx_gppi_conn_disable ( nrfx_gppi_handle_t handle)

Function for disabling a connection.

Function disables channels in every DPPI instance which belongs to the connection.

Parameters
[in]handleConnection handle.

◆ nrfx_gppi_conn_enable()

void nrfx_gppi_conn_enable ( nrfx_gppi_handle_t handle)

Function for enabling a connection.

Function enables channels in every DPPI instance which belongs to the connection.

Parameters
[in]handleConnection handle.

◆ nrfx_gppi_conn_free()

void nrfx_gppi_conn_free ( uint32_t eep,
uint32_t tep,
nrfx_gppi_handle_t handle )

Function for clearing and freeing a connection.

Function performs nrfx_gppi_domain_conn_free followed by clearing of endpoints.

Parameters
[in]eepEvent endpoint.
[in]tepTask endpoint.
[in]handleConnection handle.

◆ nrfx_gppi_domain_channel_get()

int nrfx_gppi_domain_channel_get ( nrfx_gppi_handle_t handle,
uint32_t node_id )

Function for getting one of a channels that is used in a connection.

A connection may consists of a number of nodes which are domains with a unique DPPI or PPIB nodes. nrfx_gppi_domain_id_get can be used to get the domain ID for a given peripheral. Node ID for PPIB is target-specific and can be found in a target-specific header file (see nrfx_gppi_node_id_t).

Parameters
[in]handleConnection handle.
[in]node_idDomain or PPIB node ID.
Return values
non-negativeConfigured channel.
-EINVALInvalid input arguments.

◆ nrfx_gppi_domain_conn_alloc()

int nrfx_gppi_domain_conn_alloc ( uint32_t producer,
uint32_t consumer,
nrfx_gppi_handle_t * p_handle )

Function for allocating and setup a connection between two domains.

In case of a multi domain DPPI, function is allocating all needed resources and configures PPIB bridges. For single domain cases (PPI or DPPI) only a channel is allocated.

Parameters
[in]producerDomain that will produce (publish) events. Not used in single domain case.
[in]consumerDomain that will consume (subsribe to) events. Not used in single domain case.
[out]p_handleHandle used to control the connection.
Return values
0On successful connection allocation.
-ENOMEMThere is not enough resources to allocate the connection.

◆ nrfx_gppi_domain_conn_free()

void nrfx_gppi_domain_conn_free ( nrfx_gppi_handle_t handle)

Function for freeing a connection between domains.

For connection within a single domain a channel is freed. For cross-domain connection channels in bridges (PPIB) are cleared and all used resources are freed.. Connection shall be disabled prior to clearing.

Note
If NRFX_GPPI_CONFIG_EXT_ALLOCATOR then external implementation need to be provided.
Parameters
[in]handleConnection handle.

◆ nrfx_gppi_domain_id_get()

NRFX_STATIC_INLINE uint32_t nrfx_gppi_domain_id_get ( uint32_t addr)

Function for getting the domain ID from the peripheral register address.

Parameters
[in]addrAddress.
Returns
Domain ID.

◆ nrfx_gppi_ep_attach()

int nrfx_gppi_ep_attach ( uint32_t ep,
nrfx_gppi_handle_t handle )

Function for attaching an endpoint to the connection.

Endpoint can be task, event, publish or subscribe register address. In order to allow attaching the endpoint it must belong to the route that connection is using. On SoC with PPI there are limitations regarding how many endpoints can be attached to a handle (channel) - 1 event and 2 tasks (1 if FORK is not present).

Parameters
[in]epEndpoint address (task or event register).
[in]handleConnection handle.
Return values
0Endpoint attached.
-EINVALEndpoint cannot be attached, i.e. it does not belong to the route.

◆ nrfx_gppi_ep_ch_clear()

void nrfx_gppi_ep_ch_clear ( uint32_t ep,
uint8_t channel )

Function for clearing an endpoint.

For DPPI it is the same as nrfx_gppi_ep_clear. For PPI it clears channel configuration.

Parameters
[in]epEndpoint address (task or event register).
[in]channelChannel.

◆ nrfx_gppi_ep_chan_disable()

NRFX_STATIC_INLINE int nrfx_gppi_ep_chan_disable ( uint32_t ep)

Function for disabling a channel used by the endpoint.

Parameters
[in]epEndpoint address (task or event register).
Return values
0Successful operation.
-EINVALEndpoint has no channel.

◆ nrfx_gppi_ep_chan_enable()

NRFX_STATIC_INLINE int nrfx_gppi_ep_chan_enable ( uint32_t ep)

Function for enabling a channel used by the endpoint.

Parameters
[in]epEndpoint address (task or event register).
Return values
0Successful operation.
-EINVALEndpoint has no channel.

◆ nrfx_gppi_ep_channel_get()

NRFX_STATIC_INLINE int nrfx_gppi_ep_channel_get ( uint32_t ep)

Function for getting the channel that is used for an endpoint.

Parameters
[in]epEndpoint address (task or event register).
Return values
non-negativeConfigured channel.
-EINVALEndpoint does not have channel.

◆ nrfx_gppi_ep_clear()

void nrfx_gppi_ep_clear ( uint32_t ep)

Function for clearing an endpoint.

Remove endpoint from DPPI channel. For PPI it searches all channel configurations and clears the first configuration where the endpoint was used. For PPI it is more time consuming so in PPI specific code nrfx_gppi_ep_ch_clear can be used.

Parameters
[in]epEndpoint address (task or event register).

◆ nrfx_gppi_ep_disable()

void nrfx_gppi_ep_disable ( uint32_t ep)

Function for disabling an endpoint.

In case of PPI function disables the channel which is used by the endpoint. In case of DPPI, function is only disabling the endpoint and does not control the channel to which the endpoint is attached.

Parameters
[in]epEndpoint address (task or event register).

◆ nrfx_gppi_ep_enable()

void nrfx_gppi_ep_enable ( uint32_t ep)

Function for enabling an endpoint.

In case of PPI function enables the channel which is used by the endpoint. In case of DPPI, function is only enabling an endpoint and does not control the channel to which the endpoint is attached.

Parameters
[in]epEndpoint address (task or event register).

◆ nrfx_gppi_ep_is_enabled()

NRFX_STATIC_INLINE int nrfx_gppi_ep_is_enabled ( uint32_t ep)

Function for checking if a channel assigned to the endpoint is enabled.

Parameters
[in]epEndpoint address (task or event register).
Return values
0Channel is enabled.
-EINVALEndpoint has no channel.
-EAGAINChannel is disabled.

◆ nrfx_gppi_ep_to_ch_attach()

int nrfx_gppi_ep_to_ch_attach ( uint32_t ep,
uint8_t channel )

Function for attaching an endpoint to the channel.

Endpoint can be task, event, publish or subscribe register address.

Parameters
[in]epEndpoint address (task or event register).
[in]channelChannel.
Return values
0Endpoint attached.
-EINVALEndpoint cannot be attached, i.e. endpoints already configured in case of PPI.

◆ nrfx_gppi_ext_conn_alloc()

NRFX_STATIC_INLINE int nrfx_gppi_ext_conn_alloc ( uint32_t producer,
uint32_t consumer,
nrfx_gppi_handle_t * p_handle,
nrfx_gppi_resource_t * p_resource )

Function for allocating and setting up a connection using an external resource.

If DPPI resource is provided then it is used in the connection and additional channel in that domain is not allocated. If connection was set up with an external resource then functions for enabling and disabling the connection are only changing state of channels that were allocated for that connection. If p is null then function is equivalent of nrfx_gppi_domain_conn_alloc.

Note
If NRFX_GPPI_CONFIG_EXT_ALLOCATOR then external implementation need to be provided.
Parameters
[in]producerDomain that will produce (publish) events.
[in]consumerDomain that will consume (subsribe to) events.
[out]p_handleHandle used to control the connection.
[in]p_resourceOptional external DPPI resource.
Return values
0Successful connection allocation.
-ENOMEMThere is not enough resources to allocate the connection.
-ENOTSUPNot supported. Supported only on multi domain system.

◆ nrfx_gppi_group_alloc()

int nrfx_gppi_group_alloc ( uint32_t domain_id,
nrfx_gppi_group_handle_t * p_handle )

Function for allocating a group for given set of endpoints.

Group can only enable or disable channels in a single DPPI so all endpoints must belong to a single domain. Use nrfx_gppi_domain_id_get with one of the endpoints that is intended to be added to that group to get domain_id.

Parameters
[in]domain_idDomain ID for the group.
[out]p_handleLocation where handle is written.
Return values
0Successful allocation of a group. handle can be used.
-EINVALEndpoints are not from the same domain.
-ENOMEMFailed to allocate a free group channel.

◆ nrfx_gppi_group_ch_add()

void nrfx_gppi_group_ch_add ( nrfx_gppi_group_handle_t handle,
uint32_t channel )

Function for adding a channel to a group.

nrfx_gppi_ep_channel_get can be used on a configured endpoint to retrieve the channel that shall be added to the group.

Parameters
[in]handleGroup handle.
[in]channelChannel.

◆ nrfx_gppi_group_ch_remove()

void nrfx_gppi_group_ch_remove ( nrfx_gppi_group_handle_t handle,
uint32_t channel )

Function for removing a channel from a group.

nrfx_gppi_ep_channel_get can be used on a configured endpoint to retrieve the channel that shall be added to the group.

Parameters
[in]handleGroup handle.
[in]channelChannel.

◆ nrfx_gppi_group_channel_alloc()

int nrfx_gppi_group_channel_alloc ( uint32_t domain_id)

Function for allocating a group channel in a specific node of the DPPI system.

Function can be used to allocate a resource and use it outside of this driver.

Note
domain_id parameter is used only in the system with multiple domains. Use nrfx_gppi_domain_id_get to get the ID.
If NRFX_GPPI_CONFIG_EXT_ALLOCATOR then external implementation need to be provided.
Parameters
[in]domain_idTarget-specific identifier of the DPPI system node.
Return values
non-negativeAllocated channel.
-ENOMEMFailed to allocate a channel.

◆ nrfx_gppi_group_channel_free()

void nrfx_gppi_group_channel_free ( uint32_t domain_id,
uint8_t channel )

Function for freeing a group channel in a specific node of the DPPI system.

channel must be allocated earlier using nrfx_gppi_group_channel_alloc. domain_id must be the same as the one used in nrfx_gppi_group_channel_alloc for allocating that resource.

Note
If NRFX_GPPI_CONFIG_EXT_ALLOCATOR then external implementation need to be provided.
Parameters
[in]domain_idTarget-specific identifier of the DPPI system node.
[in]channelChannel.

◆ nrfx_gppi_group_channels_get()

uint32_t nrfx_gppi_group_channels_get ( nrfx_gppi_group_handle_t handle)

Function for getting a mask with channels which are assigned to the group.

Parameters
[in]handleGroup handle.
Returns
Mask with bits set for channels that belong to a group.

◆ nrfx_gppi_group_disable()

void nrfx_gppi_group_disable ( nrfx_gppi_group_handle_t handle)

Function for disabling a group.

Parameters
[in]handleGroup handle.

◆ nrfx_gppi_group_domain_id_get()

NRFX_STATIC_INLINE uint32_t nrfx_gppi_group_domain_id_get ( nrfx_gppi_group_handle_t handle)

Function for getting the domain ID from the group handle.

Parameters
[in]handleGroup handle.
Returns
Domain ID.

◆ nrfx_gppi_group_enable()

void nrfx_gppi_group_enable ( nrfx_gppi_group_handle_t handle)

Function for enabling a group.

Parameters
[in]handleGroup handle.

◆ nrfx_gppi_group_ep_add()

NRFX_STATIC_INLINE int nrfx_gppi_group_ep_add ( nrfx_gppi_group_handle_t handle,
uint32_t ep )

Function for adding a configured endpoint to a group.

Endpoint must be from the same domain as group and it must already be configured to use a channel.

Parameters
[in]handleGroup handle.
[in]epEndpoint address (task or event register).
Return values
0Successful operation.
-EINVALFailed to extend the group.

◆ nrfx_gppi_group_ep_remove()

NRFX_STATIC_INLINE int nrfx_gppi_group_ep_remove ( nrfx_gppi_group_handle_t handle,
uint32_t ep )

Function for removing a configured endpoint from a group.

Endpoint must be added to the group and it must be configured to use a channel.

Parameters
[in]handleGroup handle.
[in]epEndpoint address (task or event register).
Return values
0Successful operation.
-EINVALFailed to remove from the group.

◆ nrfx_gppi_group_free()

void nrfx_gppi_group_free ( nrfx_gppi_group_handle_t handle)

Function for freeing a group.

Parameters
[in]handleGroup handle.

◆ nrfx_gppi_group_task_dis_addr()

uint32_t nrfx_gppi_group_task_dis_addr ( nrfx_gppi_group_handle_t handle)

Function for getting the disable group task address.

Parameters
[in]handleGroup handle.
Return values
Addressof the task register.

◆ nrfx_gppi_group_task_en_addr()

uint32_t nrfx_gppi_group_task_en_addr ( nrfx_gppi_group_handle_t handle)

Function for getting the enable group task address.

Parameters
[in]handleGroup handle.
Return values
Addressof the task register.

◆ nrfx_gppi_init()

void nrfx_gppi_init ( nrfx_gppi_t * p_instance)

Function for initializing GPPI with a structure with resources.

Function shall be called as early as possible to allow resource allocation. p_instance contains channel resources which need to be initialized before calling that function.

Parameters
[in]p_instanceInstance.