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 <soc/soc.h> 22 23 //TODO place all auto-generated Registers here!!! 24 25 #define PWM_R_BASE (SOC_PWM_REG_BASE) 26 27 #define PWM_R_CTRL (PWM_R_BASE) 28 29 #define PWM_R_INT_STATUS (PWM_R_BASE + 4 * 0x1) 30 31 #define PWM_F_EN (BIT(0)) 32 #define PWM_F_EN_M (BIT(0)) 33 #define PWM_F_EN_V 0x1 34 #define PWM_F_EN_S 0 35 #define PWM_F_EN_MS(_ch) (PWM_F_EN_S + 4 * (_ch)) 36 37 #define PWM_F_INT_EN (BIT(1)) 38 #define PWM_F_INT_EN_M (BIT(1)) 39 #define PWM_F_INT_EN_V 0x1 40 #define PWM_F_INT_EN_S 0x1 41 #define PWM_F_INT_EN_MS(_ch) (PWM_F_INT_EN_S + 4 * (_ch)) 42 43 #define PWM_V_MODE_IDLE 0x0 44 #define PWM_V_MODE_PWM 0x1 45 #define PWM_V_MODE_TIMER 0x2 46 #define PWM_V_MODE_COUNTER 0x3 47 #define PWM_V_MODE_CAPTURE_POS 0x4 48 #define PWM_V_MODE_CAPTURE_NEG 0x5 49 #define PWM_V_MODE_CAPTURE_EDGE 0x6 50 51 #define PWM_R_INT_ST_CAPTURE_EDGE (PWM_R_BASE + (0x4 * 1)) 52 53 #define PWM_F_INT_ST (BIT(0)) 54 #define PWM_F_INT_ST_M (BIT(0)) 55 #define PWM_F_INT_ST_V 0x1 56 #define PWM_F_INT_ST_S 0 57 #define PWM_F_INT_ST_MS(_ch) (PWM_F_INT_ST_S + 1 * (_ch)) 58 59 #ifdef __cplusplus 60 } 61 #endif 62