• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2022 Beken Corporation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #include <common/bk_err.h>
22 
23 typedef enum {
24 	PWM_ID_0 = 0, /**< pwm id 0 */
25 	PWM_ID_1,     /**< pwm id 1 */
26 	PWM_ID_2,     /**< pwm id 2 */
27 	PWM_ID_3,     /**< pwm id 3 */
28 	PWM_ID_4,     /**< pwm id 4 */
29 	PWM_ID_5,     /**< pwm id 5 */
30 	PWM_ID_MAX    /**< pwm id max */
31 } pwm_id_t;
32 
33 typedef enum {
34 	PWM_SCLK_CLK32 = 0,  /**< PWM source clock dco */
35 	PWM_SCLK_XTAL,       /**< PWM source clock xtal 26M */
36 } pwm_src_clk_t;
37 
38 typedef enum
39 {
40 	SYS_SEL_PWM0 = 0,
41 	SYS_SEL_PWM1,
42 } sys_sel_pwm_t;
43 
44 typedef enum {
45 	PWM_CAPTURE_POS = 0,  /**< Calculate cycles between two post edges */
46 	PWM_CAPTURE_NEG,      /**< Calculate cycles between two negtive edges */
47 	PWM_CAPTURE_EDGE,     /**< Calculate cycles between two edges (post or negative) */
48 	PWM_CAPTURE_MAX,      /**< Invalid capture mode */
49 } pwm_capture_edge_t;
50 
51 typedef uint8_t pwm_unit_t;
52 typedef uint8_t pwm_chan_t;
53 
54 #define BK_ERR_PWM_HAL_CLOCK (BK_ERR_PWM_HAL_BASE - 1)
55 
56 #ifdef __cplusplus
57 }
58 #endif
59