1 /*
2  * Copyright (C) 2017-2020 Alibaba Group Holding Limited
3  */
4 
5 /******************************************************************************
6  * @file       drv/baud_calc.h
7  * @brief      Header File for the PWM capture uart bandrate Driver
8  * @version    V1.0
9  * @date       9. Oct 2020
10  * @model      baud_calc
11  ******************************************************************************/
12 
13 #ifndef _DRV_BAUD_CALC_H_
14 #define _DRV_BAUD_CALC_H_
15 
16 #include <stdint.h>
17 #include <drv/common.h>
18 #include <soc.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /**
25   \brief       Baud rate calculation(Algorithm level)
26   \param[in]   idx        PWM idx
27   \param[in]   channel    Channel num
28   \return      Error code(-1) or Baudare value
29 */
30 int drv_calc_baud_adjust(uint32_t idx, uint32_t channel);
31 
32 /**
33   \brief       Baud rate calculation(Capture level)
34   \param[in]   idx        PWM idx
35   \param[in]   channel    Channel num
36   \return      Error code(-1) or Baudare value
37 */
38 int drv_calc_baud_original(uint32_t idx, uint32_t channel);
39 
40 #ifdef __cplusplus
41 }
42 #endif
43 
44 #endif /* _DRV_BAUD_CALC_H_ */
45