mirror of
https://github.com/Dasharo/zephyr.git
synced 2026-03-06 14:57:20 -08:00
drivers: timer: nrf_rtc_timer: Add z_nrf_rtc_timer_capture_task_address_get
Add function for getting address of RTC capture task. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
committed by
Carles Cufí
parent
da1bfd6ffa
commit
ec9a32481b
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017 Nordic Semiconductor ASA
|
||||
* Copyright (c) 2016-2021 Nordic Semiconductor ASA
|
||||
* Copyright (c) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
@@ -123,6 +123,23 @@ uint32_t z_nrf_rtc_timer_compare_evt_address_get(int32_t chan)
|
||||
return nrf_rtc_event_address_get(RTC, nrf_rtc_compare_event_get(chan));
|
||||
}
|
||||
|
||||
uint32_t z_nrf_rtc_timer_capture_task_address_get(int32_t chan)
|
||||
{
|
||||
#if defined(RTC_TASKS_CAPTURE_TASKS_CAPTURE_Msk)
|
||||
__ASSERT_NO_MSG(chan < CHAN_COUNT);
|
||||
if (chan == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
nrf_rtc_task_t task = offsetof(NRF_RTC_Type, TASKS_CAPTURE[chan]);
|
||||
|
||||
return nrf_rtc_task_address_get(RTC, task);
|
||||
#else
|
||||
ARG_UNUSED(chan);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool compare_int_lock(int32_t chan)
|
||||
{
|
||||
atomic_val_t prev = atomic_and(&int_mask, ~BIT(chan));
|
||||
|
||||
@@ -65,6 +65,18 @@ uint64_t z_nrf_rtc_timer_read(void);
|
||||
*/
|
||||
uint32_t z_nrf_rtc_timer_compare_evt_address_get(int32_t chan);
|
||||
|
||||
/** @brief Get CAPTURE task register address.
|
||||
*
|
||||
* Address can be used for (D)PPI.
|
||||
*
|
||||
* @note Not all platforms have CAPTURE task.
|
||||
*
|
||||
* @param chan Channel ID between 1 and CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT.
|
||||
*
|
||||
* @return Register address.
|
||||
*/
|
||||
uint32_t z_nrf_rtc_timer_capture_task_address_get(int32_t chan);
|
||||
|
||||
/** @brief Safely disable compare event interrupt.
|
||||
*
|
||||
* Function returns key indicating whether interrupt was already disabled.
|
||||
|
||||
Reference in New Issue
Block a user