2024-01-01 22:16:55 -05:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "sdkconfig.h"
|
|
|
|
#include "esp_private/systimer.h"
|
2024-06-07 09:29:44 -04:00
|
|
|
#include "hal/clk_tree_ll.h"
|
2024-01-01 22:16:55 -05:00
|
|
|
|
2024-06-07 09:29:44 -04:00
|
|
|
/**
|
|
|
|
* @brief systimer's clock source is fixed to XTAL, the fixed fractional divider is changed according to
|
|
|
|
* EFUSE_XTAL_48M_SEL. No matter 48MHz or 40MHz XTAL, the resolution of the systimer is always 16MHz.
|
|
|
|
*/
|
|
|
|
|
|
|
|
uint64_t systimer_ticks_to_us(uint64_t ticks)
|
|
|
|
{
|
|
|
|
return ticks / 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t systimer_us_to_ticks(uint64_t us)
|
|
|
|
{
|
|
|
|
return us * 16;
|
|
|
|
}
|