2023-09-04 05:20:36 -04:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "sdkconfig.h"
|
|
|
|
#include "soc/soc_caps.h"
|
|
|
|
#include "soc/clk_tree_defs.h"
|
|
|
|
|
|
|
|
#include "esp_err.h"
|
|
|
|
#include "driver/gpio.h"
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX || SOC_GPIO_CLOCKOUT_BY_IO_MUX
|
2023-10-19 10:21:53 -04:00
|
|
|
typedef struct esp_clock_output_mapping *esp_clock_output_mapping_handle_t;
|
2023-09-04 05:20:36 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Start output specified clock signal to specified GPIO, will also
|
2023-10-19 10:21:53 -04:00
|
|
|
* initialize the clkout_mapping_ret_hdl.
|
2023-09-04 05:20:36 -04:00
|
|
|
*
|
|
|
|
* @param[in] clk_src The clock signal source to be mapped to GPIOs
|
|
|
|
* @param[in] gpio_num GPIO number to be mapped soc_root_clk signal source
|
2023-10-19 10:21:53 -04:00
|
|
|
* @param[out] clkout_mapping_ret_hdl Clock output controll handler
|
2023-09-04 05:20:36 -04:00
|
|
|
* @return
|
|
|
|
* - ESP_OK: Output specified clock signal to specified GPIO successfully
|
|
|
|
* - ESP_ERR_INVALID_ARG: Specified GPIO not supported to output internal clock
|
|
|
|
* or specified GPIO is already mapped to other internal clock source.
|
|
|
|
* - ESP_FAIL: There are no clock out signals that can be allocated.
|
|
|
|
*/
|
2023-10-19 10:21:53 -04:00
|
|
|
esp_err_t esp_clock_output_start(soc_clkout_sig_id_t clk_sig, gpio_num_t gpio_num, esp_clock_output_mapping_handle_t *clkout_mapping_ret_hdl);
|
2023-09-04 05:20:36 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Stop clock signal to GPIO outputting
|
2023-10-19 10:21:53 -04:00
|
|
|
* @param[in] clkout_mapping_hdl Clock output mapping controll handle
|
2023-09-04 05:20:36 -04:00
|
|
|
* @return
|
|
|
|
* - ESP_OK: Disable the clock output on GPIO successfully
|
|
|
|
* - ESP_ERR_INVALID_STATE The clock in handle is already in the disabled state
|
|
|
|
*/
|
2023-10-19 10:21:53 -04:00
|
|
|
esp_err_t esp_clock_output_stop(esp_clock_output_mapping_handle_t clkout_mapping_hdl);
|
2023-09-04 05:20:36 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|