Lines Matching full:channels

71  * @param channels Details about channels
74 static void ppi_ipc_to_rtc(union rtc_sync_channels channels, bool setup) in ppi_ipc_to_rtc() argument
76 nrf_ipc_event_t ipc_evt = nrf_ipc_receive_event_get(channels.ch.ipc_in); in ppi_ipc_to_rtc()
77 uint32_t task_addr = z_nrf_rtc_timer_capture_task_address_get(channels.ch.rtc); in ppi_ipc_to_rtc()
80 nrfx_gppi_task_endpoint_setup(channels.ch.ppi, task_addr); in ppi_ipc_to_rtc()
81 nrf_ipc_publish_set(NRF_IPC, ipc_evt, channels.ch.ppi); in ppi_ipc_to_rtc()
83 nrfx_gppi_task_endpoint_clear(channels.ch.ppi, task_addr); in ppi_ipc_to_rtc()
90 * @param channels Details about channels
93 static void ppi_rtc_to_ipc(union rtc_sync_channels channels, bool setup) in ppi_rtc_to_ipc() argument
95 uint32_t evt_addr = z_nrf_rtc_timer_compare_evt_address_get(channels.ch.rtc); in ppi_rtc_to_ipc()
96 nrf_ipc_task_t ipc_task = nrf_ipc_send_task_get(channels.ch.ipc_out); in ppi_rtc_to_ipc()
99 nrf_ipc_subscribe_set(NRF_IPC, ipc_task, channels.ch.ppi); in ppi_rtc_to_ipc()
100 nrfx_gppi_event_endpoint_setup(channels.ch.ppi, evt_addr); in ppi_rtc_to_ipc()
102 nrfx_gppi_event_endpoint_clear(channels.ch.ppi, evt_addr); in ppi_rtc_to_ipc()
107 /* Free DPPI and RTC channels */
108 static void free_resources(union rtc_sync_channels channels) in free_resources() argument
113 nrfx_gppi_channels_disable(BIT(channels.ch.ppi)); in free_resources()
115 z_nrf_rtc_timer_chan_free(channels.ch.rtc); in free_resources()
117 err = nrfx_dppi_channel_free(&dppi, channels.ch.ppi); in free_resources()
135 union rtc_sync_channels channels; in rtc_cb() local
137 channels.raw = (uint32_t)user_data; in rtc_cb()
138 ppi_rtc_to_ipc(channels, false); in rtc_cb()
141 free_resources(channels); in rtc_cb()
146 ppi_ipc_to_rtc(channels, true); in rtc_cb()
159 union rtc_sync_channels channels; in remote_callback() local
162 channels.raw = (uint32_t)user_data; in remote_callback()
164 cc = z_nrf_rtc_timer_compare_read(channels.ch.rtc); in remote_callback()
167 ppi_ipc_to_rtc(channels, false); in remote_callback()
173 ppi_rtc_to_ipc(channels, true); in remote_callback()
175 z_nrf_rtc_timer_set(channels.ch.rtc, cc + cc + RTC_SYNC_ARBITRARY_DELAY, in remote_callback()
176 rtc_cb, (void *)channels.raw); in remote_callback()
179 free_resources(channels); in remote_callback()
230 union rtc_sync_channels channels; in sync_rtc_setup() local
234 err = nrfx_dppi_channel_alloc(&dppi, &channels.ch.ppi); in sync_rtc_setup()
242 nrfx_dppi_channel_free(&dppi, channels.ch.ppi); in sync_rtc_setup()
247 channels.ch.rtc = (uint8_t)sync_rtc_ch; in sync_rtc_setup()
248 channels.ch.ipc_out = CONFIG_NRF53_SYNC_RTC_IPM_OUT; in sync_rtc_setup()
249 channels.ch.ipc_in = CONFIG_NRF53_SYNC_RTC_IPM_IN; in sync_rtc_setup()
251 rv = mbox_rx_init((void *)channels.raw); in sync_rtc_setup()
256 nrfx_gppi_channels_enable(BIT(channels.ch.ppi)); in sync_rtc_setup()
259 ppi_ipc_to_rtc(channels, true); in sync_rtc_setup()
261 ppi_rtc_to_ipc(channels, true); in sync_rtc_setup()
266 z_nrf_rtc_timer_set(channels.ch.rtc, sync_cc, rtc_cb, (void *)channels.raw); in sync_rtc_setup()