Contiki-NG
Loading...
Searching...
No Matches
nrf_802154_platform_timestamper.c
1/*
2 * Copyright (c) 2026, RISE Research Institutes of Sweden AB
3 * All rights reserved.
4 *
5 * Author: Joakim Eriksson <joakim.eriksson@ri.se>
6 *
7 * SPDX-License-Identifier: BSD-3-Clause
8 *
9 * Timestamper platform for nrf_802154 on nRF54L15.
10 * Sets up DPPI connections for frame timestamping via TIMER10.
11 *
12 * On nRF54L15 all peripherals are in the same domain, so cross-domain
13 * connections are no-ops. Local domain connections subscribe TIMER10
14 * CAPTURE to the specified DPPI channel.
15 */
16
17#include "platform/nrf_802154_platform_timestamper.h"
18#include "nrf.h"
19
20#define HP_TIMER NRF_TIMER10
21#define TIMESTAMP_CC 3
22/*---------------------------------------------------------------------------*/
23void
24nrf_802154_platform_timestamper_init(void)
25{
26 /* Nothing to do at init. */
27}
28/*---------------------------------------------------------------------------*/
29void
30nrf_802154_platform_timestamper_cross_domain_connections_setup(void)
31{
32 /* On nRF54L15 all radio peripherals are in the same domain. No-op. */
33}
34/*---------------------------------------------------------------------------*/
35void
36nrf_802154_platform_timestamper_cross_domain_connections_clear(void)
37{
38 /* No-op. */
39}
40/*---------------------------------------------------------------------------*/
41void
42nrf_802154_platform_timestamper_local_domain_connections_setup(uint32_t dppi_ch)
43{
44 /* Subscribe TIMER10 CAPTURE[3] to the specified DPPI channel. */
45 HP_TIMER->SUBSCRIBE_CAPTURE[TIMESTAMP_CC] =
46 ((uint32_t)TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos) |
47 (dppi_ch << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos);
48}
49/*---------------------------------------------------------------------------*/
50void
51nrf_802154_platform_timestamper_local_domain_connections_clear(uint32_t dppi_ch)
52{
53 (void)dppi_ch;
54 HP_TIMER->SUBSCRIBE_CAPTURE[TIMESTAMP_CC] = 0;
55}
56/*---------------------------------------------------------------------------*/
57bool
58nrf_802154_platform_timestamper_captured_timestamp_read(uint64_t *p_captured)
59{
60 /* Read the value captured in TIMER10 CC[3] by the DPPI event. */
61 *p_captured = (uint64_t)HP_TIMER->CC[TIMESTAMP_CC];
62 return true;
63}
64/*---------------------------------------------------------------------------*/