Generic PPI Layer

group nrfx_gppi

Helper layer that provides the common functionality of PPI and DPPI drivers.

Use PPI and DPPI drivers directly. This layer is provided only to help create generic code that can be built for SoCs equipped with either of these peripherals. When using this layer, take into account that there are significant differences between the PPI and DPPI interfaces that affect the behavior of this layer.

One difference is that PPI allows associating of one task or event with more than one channel, whereas DPPI does not allow this. In DPPI, the second association overwrites the first one. Consequently, this helper layer cannot be used in applications that need to connect a task or event to multiple channels.

Another difference is that in DPPI one channel can be associated with multiple tasks and multiple events, while in PPI this is not possible (with the exception of the association of a second task as a fork). Because of this difference, it is important to clear the previous endpoints of the channel that is to be reused with some different ones. Otherwise, the behavior of this helper layer will be different, depending on the actual interface used: in DPPI the channel configuration will be extended with the new endpoints, and in PPI the new endpoints will replace the previous ones.

Enums

enum nrfx_gppi_channel_group_t

Generic PPI channel groups.

Values:

enumerator NRFX_GPPI_CHANNEL_GROUP0

Channel group 0.

enumerator NRFX_GPPI_CHANNEL_GROUP1

Channel group 1.

enumerator NRFX_GPPI_CHANNEL_GROUP2

Channel group 2.

enumerator NRFX_GPPI_CHANNEL_GROUP3

Channel group 3.

enumerator NRFX_GPPI_CHANNEL_GROUP4

Channel group 4.

enumerator NRFX_GPPI_CHANNEL_GROUP5

Channel group 5.

enum nrfx_gppi_task_t

Generic PPI tasks.

Values:

enumerator NRFX_GPPI_TASK_CHG0_EN

Task for enabling channel group 0

enumerator NRFX_GPPI_TASK_CHG0_DIS

Task for disabling channel group 0

enumerator NRFX_GPPI_TASK_CHG1_EN

Task for enabling channel group 1

enumerator NRFX_GPPI_TASK_CHG1_DIS

Task for disabling channel group 1

enumerator NRFX_GPPI_TASK_CHG2_EN

Task for enabling channel group 2

enumerator NRFX_GPPI_TASK_CHG2_DIS

Task for disabling channel group 2

enumerator NRFX_GPPI_TASK_CHG3_EN

Task for enabling channel group 3

enumerator NRFX_GPPI_TASK_CHG3_DIS

Task for disabling channel group 3

enumerator NRFX_GPPI_TASK_CHG4_EN

Task for enabling channel group 4

enumerator NRFX_GPPI_TASK_CHG4_DIS

Task for disabling channel group 4

enumerator NRFX_GPPI_TASK_CHG5_EN

Task for enabling channel group 5

enumerator NRFX_GPPI_TASK_CHG5_DIS

Task for disabling channel group 5

Functions

bool nrfx_gppi_channel_check(uint8_t channel)

Function for checking if a given channel is enabled.

Parameters:
  • channel[in] Channel to check.

Return values:
  • true – The channel is enabled.

  • false – The channel is not enabled.

void nrfx_gppi_channels_disable_all(void)

Function for disabling all channels.

void nrfx_gppi_channels_enable(uint32_t mask)

Function for enabling multiple channels.

The bits in mask value correspond to particular channels. This means that writing 1 to bit 0 enables channel 0, writing 1 to bit 1 enables channel 1, etc.

Parameters:
  • mask[in] Channel mask.

void nrfx_gppi_channels_disable(uint32_t mask)

Function for disabling multiple channels.

The bits in mask value correspond to particular channels. This means that writing 1 to bit 0 disables channel 0, writing 1 to bit 1 disables channel 1, etc.

Parameters:
  • mask[in] Channel mask.

void nrfx_gppi_event_endpoint_setup(uint8_t channel, uint32_t eep)

Function for associating a given channel with the specified event register.

This function sets the DPPI publish configuration for a given event or sets the PPI event endpoint register.

Parameters:
  • channel[in] Channel to which to assign the event.

  • eep[in] Address of the event register.

void nrfx_gppi_task_endpoint_setup(uint8_t channel, uint32_t tep)

Function for associating a given channel with the specified task register.

This function sets the DPPI subscribe configuration for a given task or sets the PPI task endpoint register.

Parameters:
  • channel[in] Channel to which to assign the task.

  • tep[in] Address of the task register.

void nrfx_gppi_channel_endpoints_setup(uint8_t channel, uint32_t eep, uint32_t tep)

Function for setting up the event and task endpoints for a given channel.

Parameters:
  • channel[in] Channel to which the given endpoints are assigned.

  • eep[in] Address of the event register.

  • tep[in] Address of the task register.

void nrfx_gppi_channel_endpoints_clear(uint8_t channel, uint32_t eep, uint32_t tep)

Function for clearing the event and task endpoints for a given channel.

Parameters:
  • channel[in] Channel to which the given endpoints are assigned.

  • eep[in] Address of the event register.

  • tep[in] Address of the task register.

void nrfx_gppi_event_endpoint_clear(uint8_t channel, uint32_t eep)

Function for clearing the DPPI publish configuration for a given event register or for clearing the PPI event endpoint register.

Parameters:
  • channel[in] Channel for which to clear the event endpoint. Not used in DPPI.

  • eep[in] Address of the event register. Not used in PPI.

void nrfx_gppi_task_endpoint_clear(uint8_t channel, uint32_t tep)

Function for clearing the DPPI subscribe configuration for a given task register or for clearing the PPI task endpoint register.

Parameters:
  • channel[in] Channel from which to disconnect the task enpoint. Not used in DPPI.

  • tep[in] Address of the task register. Not used in PPI.

void nrfx_gppi_fork_endpoint_setup(uint8_t channel, uint32_t fork_tep)

Function for setting up the task endpoint for a given PPI fork or for associating the DPPI channel with an additional task register.

Parameters:
  • channel[in] Channel to which the given fork endpoint is assigned.

  • fork_tep[in] Address of the task register.

void nrfx_gppi_fork_endpoint_clear(uint8_t channel, uint32_t fork_tep)

Function for clearing the task endpoint for a given PPI fork or for clearing the DPPI subscribe register.

Parameters:
  • channel[in] Channel for which to clear the fork endpoint. Not used in DPPI.

  • fork_tep[in] Address of the task register. Not used in PPI.

void nrfx_gppi_channels_group_set(uint32_t channel_mask, nrfx_gppi_channel_group_t channel_group)

Function for setting multiple channels in a channel group.

Parameters:
  • channel_mask[in] Channels to be set in the group.

  • channel_group[in] Channel group.

void nrfx_gppi_channels_include_in_group(uint32_t channel_mask, nrfx_gppi_channel_group_t channel_group)

Function for including multiple channels in a channel group.

Parameters:
  • channel_mask[in] Channels to be included in the group.

  • channel_group[in] Channel group.

void nrfx_gppi_channels_remove_from_group(uint32_t channel_mask, nrfx_gppi_channel_group_t channel_group)

Function for removing multiple channels from a channel group.

Parameters:
  • channel_mask[in] Channels to be removed from the group.

  • channel_group[in] Channel group.

void nrfx_gppi_group_clear(nrfx_gppi_channel_group_t channel_group)

Function for removing all channels from a channel group.

Parameters:
  • channel_group[in] Channel group.

void nrfx_gppi_group_enable(nrfx_gppi_channel_group_t channel_group)

Function for enabling a channel group.

Parameters:
  • channel_group[in] Channel group.

void nrfx_gppi_group_disable(nrfx_gppi_channel_group_t channel_group)

Function for disabling a group.

Parameters:
  • channel_group[in] Channel group.

void nrfx_gppi_task_trigger(nrfx_gppi_task_t task)

Function for activating a task.

Parameters:
  • task[in] Task to be activated.

uint32_t nrfx_gppi_task_address_get(nrfx_gppi_task_t task)

Function for returning the address of a specific task register.

Parameters:
  • task[in] PPI or DPPI task.

Returns:

Address of the requested task register.

nrfx_gppi_task_t nrfx_gppi_group_disable_task_get(nrfx_gppi_channel_group_t group)

Function for returning the address of a channel group disable task.

Parameters:
  • group[in] Channel group.

Returns:

Disable task address of the specified group.

nrfx_gppi_task_t nrfx_gppi_group_enable_task_get(nrfx_gppi_channel_group_t group)

Function for returning the address of a channel group enable task.

Parameters:
  • group[in] Channel group.

Returns:

Enable task address of the specified group.

nrfx_err_t nrfx_gppi_channel_alloc(uint8_t *p_channel)

Function for allocating a channel.

Parameters:
  • p_channel[out] After successful allocation, index of the allocated channel.

Return values:
  • NRFX_SUCCESS – Channel was successfully allocated.

  • NRFX_ERROR_NO_MEM – There is no available channel to be used.

  • NRFX_ERROR_NOT_SUPPORTED – Driver is not enabled.

nrfx_err_t nrfx_gppi_channel_free(uint8_t channel)

Function for freeing a channel.

Parameters:
  • channel[in] (D)PPI channel to be freed.

Return values:
  • NRFX_SUCCESS – The channel was successfully freed.

  • NRFX_ERROR_INVALID_PARAM – The specified channel is not allocated or is not user-configurable.

  • NRFX_ERROR_NOT_SUPPORTED – Driver is not enabled.

nrfx_err_t nrfx_gppi_group_alloc(nrfx_gppi_channel_group_t *p_group)

Function for allocating a channel group.

Parameters:
  • p_group[out] Pointer to the (D)PPI channel group that has been allocated.

Return values:
  • NRFX_SUCCESS – The channel group was successfully allocated.

  • NRFX_ERROR_NO_MEM – There is no available channel group to be used.

  • NRFX_ERROR_NOT_SUPPORTED – Driver is not enabled.

nrfx_err_t nrfx_gppi_group_free(nrfx_gppi_channel_group_t group)

Function for freeing a channel group.

Parameters:
  • group[in] (D)PPI channel group to be freed.

Return values:
  • NRFX_SUCCESS – The channel was successfully freed.

  • NRFX_ERROR_INVALID_PARAM – The specified channel is not allocated or is not user-configurable.

  • NRFX_ERROR_NOT_SUPPORTED – Driver is not enabled.