1 /* Coldfire C Header File
2 * Copyright Freescale Semiconductor Inc
5 * 2008/05/23 Revision: 0.95
7 * (c) Copyright UNIS, a.s. 1997-2008
12 * http : www.processorexpert.com
13 * mail : info@processorexpert.com
16 #ifndef __MCF52221_GPTA_H__
17 #define __MCF52221_GPTA_H__
20 /*********************************************************************
22 * General Purpose Timer Module (GPT)
24 *********************************************************************/
26 /* Register read/write macros */
27 #define MCF_GPTA_GPTIOS (*(vuint8 *)(0x401A0000))
28 #define MCF_GPTA_GPTCFORC (*(vuint8 *)(0x401A0001))
29 #define MCF_GPTA_GPTOC3M (*(vuint8 *)(0x401A0002))
30 #define MCF_GPTA_GPTOC3D (*(vuint8 *)(0x401A0003))
31 #define MCF_GPTA_GPTCNT (*(vuint16*)(0x401A0004))
32 #define MCF_GPTA_GPTSCR1 (*(vuint8 *)(0x401A0006))
33 #define MCF_GPTA_GPTTOV (*(vuint8 *)(0x401A0008))
34 #define MCF_GPTA_GPTCTL1 (*(vuint8 *)(0x401A0009))
35 #define MCF_GPTA_GPTCTL2 (*(vuint8 *)(0x401A000B))
36 #define MCF_GPTA_GPTIE (*(vuint8 *)(0x401A000C))
37 #define MCF_GPTA_GPTSCR2 (*(vuint8 *)(0x401A000D))
38 #define MCF_GPTA_GPTFLG1 (*(vuint8 *)(0x401A000E))
39 #define MCF_GPTA_GPTFLG2 (*(vuint8 *)(0x401A000F))
40 #define MCF_GPTA_GPTC0 (*(vuint16*)(0x401A0010))
41 #define MCF_GPTA_GPTC1 (*(vuint16*)(0x401A0012))
42 #define MCF_GPTA_GPTC2 (*(vuint16*)(0x401A0014))
43 #define MCF_GPTA_GPTC3 (*(vuint16*)(0x401A0016))
44 #define MCF_GPTA_GPTPACTL (*(vuint8 *)(0x401A0018))
45 #define MCF_GPTA_GPTPAFLG (*(vuint8 *)(0x401A0019))
46 #define MCF_GPTA_GPTPACNT (*(vuint16*)(0x401A001A))
47 #define MCF_GPTA_GPTPORT (*(vuint8 *)(0x401A001D))
48 #define MCF_GPTA_GPTDDR (*(vuint8 *)(0x401A001E))
49 #define MCF_GPTA_GPTC(x) (*(vuint16*)(0x401A0010 + ((x)*0x2)))
52 /* Bit definitions and macros for MCF_GPTA_GPTIOS */
53 #define MCF_GPTA_GPTIOS_IOS0 (0x1)
54 #define MCF_GPTA_GPTIOS_IOS1 (0x2)
55 #define MCF_GPTA_GPTIOS_IOS2 (0x4)
56 #define MCF_GPTA_GPTIOS_IOS3 (0x8)
58 /* Bit definitions and macros for MCF_GPTA_GPTCFORC */
59 #define MCF_GPTA_GPTCFORC_FOC0 (0x1)
60 #define MCF_GPTA_GPTCFORC_FOC1 (0x2)
61 #define MCF_GPTA_GPTCFORC_FOC2 (0x4)
62 #define MCF_GPTA_GPTCFORC_FOC3 (0x8)
64 /* Bit definitions and macros for MCF_GPTA_GPTOC3M */
65 #define MCF_GPTA_GPTOC3M_OC3M0 (0x1)
66 #define MCF_GPTA_GPTOC3M_OC3M1 (0x2)
67 #define MCF_GPTA_GPTOC3M_OC3M2 (0x4)
68 #define MCF_GPTA_GPTOC3M_OC3M3 (0x8)
70 /* Bit definitions and macros for MCF_GPTA_GPTOC3D */
71 #define MCF_GPTA_GPTOC3D_OC3D0 (0x1)
72 #define MCF_GPTA_GPTOC3D_OC3D1 (0x2)
73 #define MCF_GPTA_GPTOC3D_OC3D2 (0x4)
74 #define MCF_GPTA_GPTOC3D_OC3D3 (0x8)
76 /* Bit definitions and macros for MCF_GPTA_GPTCNT */
77 #define MCF_GPTA_GPTCNT_CNTR(x) (((x)&0xFFFF)<<0)
79 /* Bit definitions and macros for MCF_GPTA_GPTSCR1 */
80 #define MCF_GPTA_GPTSCR1_TFFCA (0x10)
81 #define MCF_GPTA_GPTSCR1_GPTEN (0x80)
83 /* Bit definitions and macros for MCF_GPTA_GPTTOV */
84 #define MCF_GPTA_GPTTOV_TOV0 (0x1)
85 #define MCF_GPTA_GPTTOV_TOV1 (0x2)
86 #define MCF_GPTA_GPTTOV_TOV2 (0x4)
87 #define MCF_GPTA_GPTTOV_TOV3 (0x8)
89 /* Bit definitions and macros for MCF_GPTA_GPTCTL1 */
90 #define MCF_GPTA_GPTCTL1_OL0 (0x1)
91 #define MCF_GPTA_GPTCTL1_OM0 (0x2)
92 #define MCF_GPTA_GPTCTL1_OL1 (0x4)
93 #define MCF_GPTA_GPTCTL1_OM1 (0x8)
94 #define MCF_GPTA_GPTCTL1_OL2 (0x10)
95 #define MCF_GPTA_GPTCTL1_OM2 (0x20)
96 #define MCF_GPTA_GPTCTL1_OL3 (0x40)
97 #define MCF_GPTA_GPTCTL1_OM3 (0x80)
98 #define MCF_GPTA_GPTCTL1_OUTPUT0_NOTHING (0)
99 #define MCF_GPTA_GPTCTL1_OUTPUT0_TOGGLE (0x1)
100 #define MCF_GPTA_GPTCTL1_OUTPUT0_CLEAR (0x2)
101 #define MCF_GPTA_GPTCTL1_OUTPUT0_SET (0x3)
102 #define MCF_GPTA_GPTCTL1_OUTPUT1_NOTHING (0)
103 #define MCF_GPTA_GPTCTL1_OUTPUT1_TOGGLE (0x4)
104 #define MCF_GPTA_GPTCTL1_OUTPUT1_CLEAR (0x8)
105 #define MCF_GPTA_GPTCTL1_OUTPUT1_SET (0xC)
106 #define MCF_GPTA_GPTCTL1_OUTPUT2_NOTHING (0)
107 #define MCF_GPTA_GPTCTL1_OUTPUT2_TOGGLE (0x10)
108 #define MCF_GPTA_GPTCTL1_OUTPUT2_CLEAR (0x20)
109 #define MCF_GPTA_GPTCTL1_OUTPUT2_SET (0x30)
110 #define MCF_GPTA_GPTCTL1_OUTPUT3_NOTHING (0)
111 #define MCF_GPTA_GPTCTL1_OUTPUT3_TOGGLE (0x40)
112 #define MCF_GPTA_GPTCTL1_OUTPUT3_CLEAR (0x80)
113 #define MCF_GPTA_GPTCTL1_OUTPUT3_SET (0xC0)
115 /* Bit definitions and macros for MCF_GPTA_GPTCTL2 */
116 #define MCF_GPTA_GPTCTL2_EDG0A (0x1)
117 #define MCF_GPTA_GPTCTL2_EDG0B (0x2)
118 #define MCF_GPTA_GPTCTL2_EDG1A (0x4)
119 #define MCF_GPTA_GPTCTL2_EDG1B (0x8)
120 #define MCF_GPTA_GPTCTL2_EDG2A (0x10)
121 #define MCF_GPTA_GPTCTL2_EDG2B (0x20)
122 #define MCF_GPTA_GPTCTL2_EDG3A (0x40)
123 #define MCF_GPTA_GPTCTL2_EDG3B (0x80)
124 #define MCF_GPTA_GPTCTL2_INPUT0_DISABLED (0)
125 #define MCF_GPTA_GPTCTL2_INPUT0_RISING (0x1)
126 #define MCF_GPTA_GPTCTL2_INPUT0_FALLING (0x2)
127 #define MCF_GPTA_GPTCTL2_INPUT0_ANY (0x3)
128 #define MCF_GPTA_GPTCTL2_INPUT1_DISABLED (0)
129 #define MCF_GPTA_GPTCTL2_INPUT1_RISING (0x4)
130 #define MCF_GPTA_GPTCTL2_INPUT1_FALLING (0x8)
131 #define MCF_GPTA_GPTCTL2_INPUT1_ANY (0xC)
132 #define MCF_GPTA_GPTCTL2_INPUT2_DISABLED (0)
133 #define MCF_GPTA_GPTCTL2_INPUT2_RISING (0x10)
134 #define MCF_GPTA_GPTCTL2_INPUT2_FALLING (0x20)
135 #define MCF_GPTA_GPTCTL2_INPUT2_ANY (0x30)
136 #define MCF_GPTA_GPTCTL2_INPUT3_DISABLED (0)
137 #define MCF_GPTA_GPTCTL2_INPUT3_RISING (0x40)
138 #define MCF_GPTA_GPTCTL2_INPUT3_FALLING (0x80)
139 #define MCF_GPTA_GPTCTL2_INPUT3_ANY (0xC0)
141 /* Bit definitions and macros for MCF_GPTA_GPTIE */
142 #define MCF_GPTA_GPTIE_CI0 (0x1)
143 #define MCF_GPTA_GPTIE_CI1 (0x2)
144 #define MCF_GPTA_GPTIE_CI2 (0x4)
145 #define MCF_GPTA_GPTIE_CI3 (0x8)
147 /* Bit definitions and macros for MCF_GPTA_GPTSCR2 */
148 #define MCF_GPTA_GPTSCR2_PR(x) (((x)&0x7)<<0)
149 #define MCF_GPTA_GPTSCR2_PR_1 (0)
150 #define MCF_GPTA_GPTSCR2_PR_2 (0x1)
151 #define MCF_GPTA_GPTSCR2_PR_4 (0x2)
152 #define MCF_GPTA_GPTSCR2_PR_8 (0x3)
153 #define MCF_GPTA_GPTSCR2_PR_16 (0x4)
154 #define MCF_GPTA_GPTSCR2_PR_32 (0x5)
155 #define MCF_GPTA_GPTSCR2_PR_64 (0x6)
156 #define MCF_GPTA_GPTSCR2_PR_128 (0x7)
157 #define MCF_GPTA_GPTSCR2_TCRE (0x8)
158 #define MCF_GPTA_GPTSCR2_RDPT (0x10)
159 #define MCF_GPTA_GPTSCR2_PUPT (0x20)
160 #define MCF_GPTA_GPTSCR2_TOI (0x80)
162 /* Bit definitions and macros for MCF_GPTA_GPTFLG1 */
163 #define MCF_GPTA_GPTFLG1_CF0 (0x1)
164 #define MCF_GPTA_GPTFLG1_CF1 (0x2)
165 #define MCF_GPTA_GPTFLG1_CF2 (0x4)
166 #define MCF_GPTA_GPTFLG1_CF3 (0x8)
168 /* Bit definitions and macros for MCF_GPTA_GPTFLG2 */
169 #define MCF_GPTA_GPTFLG2_TOF (0x80)
171 /* Bit definitions and macros for MCF_GPTA_GPTC */
172 #define MCF_GPTA_GPTC_CCNT(x) (((x)&0xFFFF)<<0)
174 /* Bit definitions and macros for MCF_GPTA_GPTPACTL */
175 #define MCF_GPTA_GPTPACTL_PAI (0x1)
176 #define MCF_GPTA_GPTPACTL_PAOVI (0x2)
177 #define MCF_GPTA_GPTPACTL_CLK(x) (((x)&0x3)<<0x2)
178 #define MCF_GPTA_GPTPACTL_CLK_GPTPR (0)
179 #define MCF_GPTA_GPTPACTL_CLK_PACLK (0x1)
180 #define MCF_GPTA_GPTPACTL_CLK_PACLK_256 (0x2)
181 #define MCF_GPTA_GPTPACTL_CLK_PACLK_65536 (0x3)
182 #define MCF_GPTA_GPTPACTL_PEDGE (0x10)
183 #define MCF_GPTA_GPTPACTL_PAMOD (0x20)
184 #define MCF_GPTA_GPTPACTL_PAE (0x40)
186 /* Bit definitions and macros for MCF_GPTA_GPTPAFLG */
187 #define MCF_GPTA_GPTPAFLG_PAIF (0x1)
188 #define MCF_GPTA_GPTPAFLG_PAOVF (0x2)
190 /* Bit definitions and macros for MCF_GPTA_GPTPACNT */
191 #define MCF_GPTA_GPTPACNT_PACNT(x) (((x)&0xFFFF)<<0)
193 /* Bit definitions and macros for MCF_GPTA_GPTPORT */
194 #define MCF_GPTA_GPTPORT_PORTT0 (0x1)
195 #define MCF_GPTA_GPTPORT_PORTT1 (0x2)
196 #define MCF_GPTA_GPTPORT_PORTT2 (0x4)
197 #define MCF_GPTA_GPTPORT_PORTT3 (0x8)
199 /* Bit definitions and macros for MCF_GPTA_GPTDDR */
200 #define MCF_GPTA_GPTDDR_DDRT0 (0x1)
201 #define MCF_GPTA_GPTDDR_DDRT1 (0x2)
202 #define MCF_GPTA_GPTDDR_DDRT2 (0x4)
203 #define MCF_GPTA_GPTDDR_DDRT3 (0x8)
206 #endif /* __MCF52221_GPTA_H__ */