blob: 4c04210bda6f9610f61561990be4bce0f9e53fa0 [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2005
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35
36/*****************************************************************************
37 *
38 * Filename:
39 * ---------
40 * pwm_hw.h
41 *
42 * Project:
43 * --------
44 * Maui_Software
45 *
46 * Description:
47 * ------------
48 * This file is intended for PWM driver.
49 *
50 * Author:
51 * -------
52 * -------
53 *
54 *============================================================================
55 * HISTORY
56 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
57 *------------------------------------------------------------------------------
58 * removed!
59 * removed!
60 * removed!
61 *
62 * removed!
63 * removed!
64 * removed!
65 *
66 * removed!
67 * removed!
68 * removed!
69 *
70 * removed!
71 * removed!
72 * removed!
73 *
74 * removed!
75 * removed!
76 * removed!
77 *
78 * removed!
79 * removed!
80 * removed!
81 *
82 * removed!
83 * removed!
84 * removed!
85 *
86 * removed!
87 * removed!
88 * removed!
89 *
90 * removed!
91 * removed!
92 * removed!
93 *
94 * removed!
95 * removed!
96 * removed!
97 *
98 * removed!
99 * removed!
100 * removed!
101 *
102 * removed!
103 * removed!
104 * removed!
105 *
106 * removed!
107 * removed!
108 * removed!
109 *
110 * removed!
111 * removed!
112 * removed!
113 *
114 * removed!
115 * removed!
116 * removed!
117 *
118 * removed!
119 * removed!
120 * removed!
121 * removed!
122 * removed!
123 * removed!
124 * removed!
125 * removed!
126 * removed!
127 * removed!
128 * removed!
129 * removed!
130 * removed!
131 * removed!
132 * removed!
133 * removed!
134 * removed!
135 * removed!
136 * removed!
137 * removed!
138 * removed!
139 * removed!
140 * removed!
141 * removed!
142 * removed!
143 * removed!
144 * removed!
145 * removed!
146 * removed!
147 * removed!
148 * removed!
149 * removed!
150 * removed!
151 * removed!
152 * removed!
153 * removed!
154 * removed!
155 * removed!
156 * removed!
157 * removed!
158 * removed!
159 *------------------------------------------------------------------------------
160 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
161 *============================================================================
162 ****************************************************************************/
163#ifndef PWM_HW_H
164#define PWM_HW_H
165#include "drv_features_pwm.h"
166#include "reg_base.h"
167#ifndef DRV_PWM_OFF
168#if !defined(DRV_PWM_RWG)
169#define PWM1_CTRL (PWM_base+0x0000) /* PWM Control */
170#define PWM1_COUNT (PWM_base+0x0004) /* PWM max counter value */
171#define PWM1_THRESHOLD (PWM_base+0x0008) /* PWM threshold value */
172#if 0
173/* under construction !*/
174#endif
175#define PWM1_PWR_OFF 0x0020
176#if defined(DRV_PWM_PWM2)
177 #define PWM2_CTRL (PWM_base+0x000C) /* PWM Control */
178 #define PWM2_COUNT (PWM_base+0x0010) /* PWM max counter value */
179 #define PWM2_THRESHOLD (PWM_base+0x0014) /* PWM threshold value */
180#if 0
181/* under construction !*/
182#endif
183 #define PWM2_PWR_OFF 0x0400
184#if defined(DRV_PWM_PWM3)
185 #define PWM3_CTRL (PWM_base+0x0018) /* PWM Control */
186 #define PWM3_COUNT (PWM_base+0x001C) /* PWM max counter value */
187 #define PWM3_THRESHOLD (PWM_base+0x0020) /* PWM threshold value */
188#if defined(DRV_PWM_PWM4)
189 #define PWM4_CTRL (PWM_base+0x0024) /* PWM Control */
190 #define PWM4_COUNT (PWM_base+0x0028) /* PWM max counter value */
191 #define PWM4_THRESHOLD (PWM_base+0x002C) /* PWM threshold value */
192#endif /*DRV_PWM_PWM4*/
193
194#endif /*DRV_PWM_PWM3*/
195#endif /*DRV_PWM_PWM2*/
196#endif // DRV_PWM_OFF
197
198#define PWM_CTRL_EN 0x8000
199#define PWM_CTRL_CLK_1 0x0000
200#define PWM_CTRL_CLK_2 0x0001
201#define PWM_CTRL_CLK_4 0x0002
202#define PWM_CTRL_CLK_8 0x0003
203
204#if defined(DRV_PWM_CLK_SEL)
205 #define PWM_CTRL_CLKSEL 0x0004
206#endif /*DRV_PWM_CLK_SEL*/
207
208/*==================Macro====================*/
209#define PWM_SetCountValue(count) *(volatile kal_uint16 *)PWM1_COUNT = count
210#define PWM_SetThres(thres) *(volatile kal_uint16 *)PWM1_THRESHOLD = thres
211#if defined(DRV_PWM_PWM2)
212 #define PWM2_SetCountValue(count) *(volatile kal_uint16 *)PWM2_COUNT = count
213 #define PWM2_SetThres(thres) *(volatile kal_uint16 *)PWM2_THRESHOLD = thres
214#if defined(DRV_PWM_PWM3)
215 #define PWM3_SetCountValue(count) *(volatile kal_uint16 *)PWM3_COUNT = count
216 #define PWM3_SetThres(thres) *(volatile kal_uint16 *)PWM3_THRESHOLD = thres
217#if defined(DRV_PWM_PWM4)
218 #define PWM4_SetCountValue(count) *(volatile kal_uint16 *)PWM4_COUNT = count
219 #define PWM4_SetThres(thres) *(volatile kal_uint16 *)PWM4_THRESHOLD = thres
220#endif /*DRV_PWM_PWM4*/
221#endif /*DRV_PWM_PWM3*/
222#endif /*DRV_PWM_PWM2*/
223
224#endif /* !defined(DRV_PWM_RWG) */
225
226
227#endif
228