feat(esp_libc): refactored POSIX timers get/set functions

- Added sys/timex.h and clock_adjtime API
This commit is contained in:
Ondrej Kosta
2026-03-31 22:32:33 +08:00
parent 4ca48c370e
commit ed2e6735ff
28 changed files with 1428 additions and 545 deletions
@@ -339,6 +339,23 @@ esp_err_t esp_eth_mac_adj_ptp_freq(esp_eth_mac_t *mac, double scale_factor);
*/
esp_err_t esp_eth_mac_adj_ptp_time(esp_eth_mac_t *mac, int32_t adj_ppb);
/**
* @brief Adjust PTP frequency relative to its current addend value by ppb
*
* Unlike esp_eth_mac_adj_ptp_time (absolute from base) or esp_eth_mac_adj_ptp_freq
* (relative by double scale factor), this adjusts the current addend by ppb:
* addend_new = current * (1 + adj_ppb / 10^9). Calling with adj_ppb=0 is a no-op.
*
* @param mac: Ethernet MAC instance
* @param adj_ppb: relative frequency adjustment in parts per billion
*
* @return
* - ESP_OK: success
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_FAIL: failure
*/
esp_err_t esp_eth_mac_adj_ptp_freq_ppb(esp_eth_mac_t *mac, int32_t adj_ppb);
/**
* @brief Set Target Time at which interrupt is invoked when PTP time exceeds this value
*
@@ -404,6 +421,16 @@ esp_err_t esp_eth_mac_set_pps_out_gpio(esp_eth_mac_t *mac, int gpio_num);
* - ESP_FAIL: failure
*/
esp_err_t esp_eth_mac_set_pps_out_freq(esp_eth_mac_t *mac, uint32_t freq_hz);
/**
* @brief Get PTP timestamp resolution
*
* @param mac: Ethernet MAC instance
*
* @return
* - PTP timestamp resolution in nanoseconds
*/
uint32_t esp_eth_mac_get_ts_resolution(esp_eth_mac_t *mac);
#endif // SOC_EMAC_IEEE1588V2_SUPPORTED
#endif // CONFIG_ETH_USE_ESP32_EMAC