1 /* 2 * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /******************************************************************************* 8 * NOTICE 9 * The hal is not public api, don't use in application code. 10 * See readme.md in hal/include/hal/readme.md 11 ******************************************************************************/ 12 13 #pragma once 14 15 #include <stdint.h> 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 typedef struct mcpwm_dev_t *mcpwm_soc_handle_t; // MCPWM SOC layer handle 22 23 /** 24 * @brief HAL layer configuration 25 */ 26 typedef struct { 27 int group_id; // Indicate the MCPWM hardware group 28 } mcpwm_hal_init_config_t; 29 30 /** 31 * Context that should be maintained by both the driver and the HAL 32 */ 33 typedef struct { 34 mcpwm_soc_handle_t dev; // MCPWM SOC layer handle 35 } mcpwm_hal_context_t; 36 37 /** 38 * @brief Initialize the internal state of the HAL. 39 * 40 * @param hal Context of the HAL layer. 41 * @param init_config Configuration for the HAL to be used only once. 42 */ 43 void mcpwm_hal_init(mcpwm_hal_context_t *hal, const mcpwm_hal_init_config_t *init_config); 44 45 /** 46 * @brief Deinitialize the HAL driver. 47 * 48 * @param hal Context of the HAL layer. 49 */ 50 void mcpwm_hal_deinit(mcpwm_hal_context_t *hal); 51 52 /** 53 * @brief Reset MCPWM timer 54 * 55 * @param hal Context of the HAL layer. 56 * @param timer_id Timer ID 57 */ 58 void mcpwm_hal_timer_reset(mcpwm_hal_context_t *hal, int timer_id); 59 60 /** 61 * @brief Reset MCPWM operator 62 * 63 * @param hal Context of the HAL layer. 64 * @param oper_id Operator ID 65 */ 66 void mcpwm_hal_operator_reset(mcpwm_hal_context_t *hal, int oper_id); 67 68 /** 69 * @brief Reset MCPWM generator 70 * 71 * @param hal Context of the HAL layer. 72 * @param oper_id Operator ID 73 * @param gen_id Generator ID 74 */ 75 void mcpwm_hal_generator_reset(mcpwm_hal_context_t *hal, int oper_id, int gen_id); 76 77 #ifdef __cplusplus 78 } 79 #endif 80