Lines Matching full:channel
42 …nels_allocated; /**< Bitmap representing channels availability. 1 when a channel is allocated, 0 o…
60 * @brief Check whether a channel is a programmable channel and can be used by an application.
62 * @param[in] channel Channel to check.
64 * @retval true The channel is a programmable application channel.
65 * @retval false The channel is used by a stack (for example SoftDevice) or is preprogrammed.
67 __STATIC_INLINE bool is_programmable_app_channel(nrf_ppi_channel_t channel) in is_programmable_app_channel() argument
69 return ((NRFX_PPI_PROG_APP_CHANNELS_MASK & nrfx_ppi_channel_to_mask(channel)) != 0); in is_programmable_app_channel()
76 * @param[in] channel_mask Channel mask to check.
79 * @retval false At least one specified channel is used by a stack (for example SoftDevice).
89 * @brief Check whether a channel can be used by an application.
91 * @param[in] channel Channel to check.
93 * @retval true The channel can be used by an application.
94 * @retval false The channel is used by a stack (for example SoftDevice).
96 __STATIC_INLINE bool is_app_channel(nrf_ppi_channel_t channel) in is_app_channel() argument
98 return are_app_channels(nrfx_ppi_channel_to_mask(channel)); in is_app_channel()
103 * @brief Check whether a channel group can be used by an application.
118 * @brief Check whether a channel is allocated.
120 * @param[in] channel_num Channel number to check.
122 * @retval true The channel is allocated.
123 * @retval false The channel is not allocated.
125 __STATIC_INLINE bool is_allocated_channel(nrf_ppi_channel_t channel) in is_allocated_channel() argument
127 return ((m_channels_allocated & nrfx_ppi_channel_to_mask(channel)) != 0); in is_allocated_channel()
132 * @brief Set channel allocated indication.
134 * @param[in] channel_num Specifies the channel to set the "allocated" indication.
136 __STATIC_INLINE void channel_allocated_set(nrf_ppi_channel_t channel) in channel_allocated_set() argument
138 m_channels_allocated |= nrfx_ppi_channel_to_mask(channel); in channel_allocated_set()
143 * @brief Clear channel allocated indication.
145 * @param[in] channel_num Specifies the channel to clear the "allocated" indication.
147 __STATIC_INLINE void channel_allocated_clr(nrf_ppi_channel_t channel) in channel_allocated_clr() argument
149 m_channels_allocated &= ~nrfx_ppi_channel_to_mask(channel); in channel_allocated_clr()
230 nrf_ppi_channel_t channel; in nrfx_ppi_channel_alloc() local
235 for (channel = NRF_PPI_CHANNEL0; in nrfx_ppi_channel_alloc()
237 mask &= ~nrfx_ppi_channel_to_mask(channel), channel++) in nrfx_ppi_channel_alloc()
240 if ((mask & nrfx_ppi_channel_to_mask(channel)) && (!is_allocated_channel(channel))) in nrfx_ppi_channel_alloc()
242 channel_allocated_set(channel); in nrfx_ppi_channel_alloc()
243 *p_channel = channel; in nrfx_ppi_channel_alloc()
249 NRFX_LOG_INFO("Allocated channel: %d.", channel); in nrfx_ppi_channel_alloc()
259 nrfx_err_t nrfx_ppi_channel_free(nrf_ppi_channel_t channel) in nrfx_ppi_channel_free() argument
263 if (!is_programmable_app_channel(channel)) in nrfx_ppi_channel_free()
269 // First disable this channel in nrfx_ppi_channel_free()
270 nrf_ppi_channel_disable(channel); in nrfx_ppi_channel_free()
272 channel_allocated_clr(channel); in nrfx_ppi_channel_free()
280 nrfx_err_t nrfx_ppi_channel_assign(nrf_ppi_channel_t channel, uint32_t eep, uint32_t tep) in nrfx_ppi_channel_assign() argument
289 if (!is_programmable_app_channel(channel)) in nrfx_ppi_channel_assign()
293 else if (!is_allocated_channel(channel)) in nrfx_ppi_channel_assign()
299 nrf_ppi_channel_endpoint_setup(channel, eep, tep); in nrfx_ppi_channel_assign()
300 NRFX_LOG_INFO("Assigned channel: %d, event end point: %x, task end point: %x.", in nrfx_ppi_channel_assign()
301 channel, in nrfx_ppi_channel_assign()
309 nrfx_err_t nrfx_ppi_channel_fork_assign(nrf_ppi_channel_t channel, uint32_t fork_tep) in nrfx_ppi_channel_fork_assign() argument
313 if (!is_allocated_channel(channel)) in nrfx_ppi_channel_fork_assign()
319 nrf_ppi_fork_endpoint_setup(channel, fork_tep); in nrfx_ppi_channel_fork_assign()
320 NRFX_LOG_INFO("Fork assigned channel: %d, task end point: %d.", channel, fork_tep); in nrfx_ppi_channel_fork_assign()
333 nrfx_err_t nrfx_ppi_channel_enable(nrf_ppi_channel_t channel) in nrfx_ppi_channel_enable() argument
337 if (!is_app_channel(channel)) in nrfx_ppi_channel_enable()
341 else if (is_programmable_app_channel(channel) && !is_allocated_channel(channel)) in nrfx_ppi_channel_enable()
347 nrf_ppi_channel_enable(channel); in nrfx_ppi_channel_enable()
354 nrfx_err_t nrfx_ppi_channel_disable(nrf_ppi_channel_t channel) in nrfx_ppi_channel_disable() argument
358 if (!is_app_channel(channel)) in nrfx_ppi_channel_disable()
362 else if (is_programmable_app_channel(channel) && !is_allocated_channel(channel)) in nrfx_ppi_channel_disable()
368 nrf_ppi_channel_disable(channel); in nrfx_ppi_channel_disable()