OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM7_AT91FR40008_GCC/] [tc.h] - Blame information for rev 577

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 577 jeremybenn
//*----------------------------------------------------------------------------
2
//*         ATMEL Microcontroller Software Support  -  ROUSSET  -
3
//*----------------------------------------------------------------------------
4
//* The software is delivered "AS IS" without warranty or condition of any
5
//* kind, either express, implied or statutory. This includes without
6
//* limitation any warranty or condition with respect to merchantability or
7
//* fitness for any particular purpose, or against the infringements of
8
//* intellectual property rights of others.
9
//*-----------------------------------------------------------------------------
10
//* File Name           : tc.h
11
//* Object              : Timer Counter Header File
12
//*
13
//* 1.0 01/04/00 JCZ    : Creation
14
//* 1.0 01/09/00 JPP    : modification TC_BEEVT, TC_BEEVT_SET_OUTPUT,
15
//*                       TC_BEEVT_CLEAR_OUTPUT, TC_BEEVT_TOGGLE_OUTPUT
16
//*-----------------------------------------------------------------------------
17
 
18
#ifndef tc_h
19
#define tc_h
20
 
21
//#include    "periph/stdc/std_c.h"
22
//#include    "periph/pio/lib_pio.h"
23
 
24
/*-------------------------------------------*/
25
/* Timer User Interface Structure Definition */
26
/*-------------------------------------------*/
27
 
28
typedef struct
29
{
30
    at91_reg        TC_CCR ;        /* Control Register */
31
    at91_reg        TC_CMR ;        /* Mode Register */
32
    at91_reg        Reserved0 ;
33
    at91_reg        Reserved1 ;
34
    at91_reg        TC_CV ;         /* Counter value */
35
    at91_reg        TC_RA ;         /* Register A */
36
    at91_reg        TC_RB ;         /* Register B */
37
    at91_reg        TC_RC ;         /* Register C */
38
    at91_reg        TC_SR ;         /* Status Register */
39
    at91_reg        TC_IER ;        /* Interrupt Enable Register */
40
    at91_reg        TC_IDR ;        /* Interrupt Disable Register */
41
    at91_reg        TC_IMR ;        /* Interrupt Mask Register */
42
    at91_reg        Reserved2 ;
43
    at91_reg        Reserved3 ;
44
    at91_reg        Reserved4 ;
45
    at91_reg        Reserved5 ;
46
} StructTC ;
47
 
48
#define NB_TC_CHANNEL       3
49
 
50
typedef struct
51
{
52
    StructTC        TC[NB_TC_CHANNEL] ;
53
    at91_reg        TC_BCR ;        /* Block Control Register */
54
    at91_reg        TC_BMR ;        /* Block Mode Register  */
55
} StructTCBlock ;
56
 
57
/*--------------------------------------------------------*/
58
/* TC_CCR: Timer Counter Control Register Bits Definition */
59
/*--------------------------------------------------------*/
60
#define TC_CLKEN            0x1
61
#define TC_CLKDIS           0x2
62
#define TC_SWTRG            0x4
63
 
64
/*---------------------------------------------------------------*/
65
/* TC_CMR: Timer Counter Channel Mode Register Bits Definition   */
66
/*---------------------------------------------------------------*/
67
 
68
/*-----------------*/
69
/* Clock Selection */
70
/*-----------------*/
71
#define TC_CLKS                  0x7
72
#define TC_CLKS_MCK2             0x0
73
#define TC_CLKS_MCK8             0x1
74
#define TC_CLKS_MCK32            0x2
75
#define TC_CLKS_MCK128           0x3
76
#define TC_CLKS_MCK1024          0x4
77
 
78
#define TC_CLKS_SLCK             0x4
79
 
80
#define TC_CLKS_XC0              0x5
81
#define TC_CLKS_XC1              0x6
82
#define TC_CLKS_XC2              0x7
83
 
84
 
85
/*-----------------*/
86
/* Clock Inversion */
87
/*-----------------*/
88
#define TC_CLKI             0x8
89
 
90
/*------------------------*/
91
/* Burst Signal Selection */
92
/*------------------------*/
93
#define TC_BURST            0x30
94
#define TC_BURST_NONE       0x0
95
#define TC_BUSRT_XC0        0x10
96
#define TC_BURST_XC1        0x20
97
#define TC_BURST_XC2        0x30
98
 
99
/*------------------------------------------------------*/
100
/* Capture Mode : Counter Clock Stopped with RB Loading */
101
/*------------------------------------------------------*/
102
#define TC_LDBSTOP          0x40
103
 
104
/*-------------------------------------------------------*/
105
/* Waveform Mode : Counter Clock Stopped with RC Compare */
106
/*-------------------------------------------------------*/
107
#define TC_CPCSTOP          0x40
108
 
109
/*-------------------------------------------------------*/
110
/* Capture Mode : Counter Clock Disabled with RB Loading */
111
/*--------------------------------------------------------*/
112
#define TC_LDBDIS           0x80
113
 
114
/*--------------------------------------------------------*/
115
/* Waveform Mode : Counter Clock Disabled with RC Compare */
116
/*--------------------------------------------------------*/
117
#define TC_CPCDIS           0x80
118
 
119
/*------------------------------------------------*/
120
/* Capture Mode : External Trigger Edge Selection */
121
/*------------------------------------------------*/
122
#define TC_ETRGEDG                  0x300
123
#define TC_ETRGEDG_EDGE_NONE        0x0
124
#define TC_ETRGEDG_RISING_EDGE      0x100
125
#define TC_ETRGEDG_FALLING_EDGE     0x200
126
#define TC_ETRGEDG_BOTH_EDGE        0x300
127
 
128
/*-----------------------------------------------*/
129
/* Waveform Mode : External Event Edge Selection */
130
/*-----------------------------------------------*/
131
#define TC_EEVTEDG                  0x300
132
#define TC_EEVTEDG_EDGE_NONE        0x0
133
#define TC_EEVTEDG_RISING_EDGE      0x100
134
#define TC_EEVTEDG_FALLING_EDGE     0x200
135
#define TC_EEVTEDG_BOTH_EDGE        0x300
136
 
137
/*--------------------------------------------------------*/
138
/* Capture Mode : TIOA or TIOB External Trigger Selection */
139
/*--------------------------------------------------------*/
140
#define TC_ABETRG                   0x400
141
#define TC_ABETRG_TIOB              0x0
142
#define TC_ABETRG_TIOA              0x400
143
 
144
/*------------------------------------------*/
145
/* Waveform Mode : External Event Selection */
146
/*------------------------------------------*/
147
#define TC_EEVT                     0xC00
148
#define TC_EEVT_TIOB                0x0
149
#define TC_EEVT_XC0                 0x400
150
#define TC_EEVT_XC1                 0x800
151
#define TC_EEVT_XC2                 0xC00
152
 
153
/*--------------------------------------------------*/
154
/* Waveform Mode : Enable Trigger on External Event */
155
/*--------------------------------------------------*/
156
#define TC_ENETRG                   0x1000
157
 
158
/*----------------------------------*/
159
/* RC Compare Enable Trigger Enable */
160
/*----------------------------------*/
161
#define TC_CPCTRG                   0x4000
162
 
163
/*----------------*/
164
/* Mode Selection */
165
/*----------------*/
166
#define TC_WAVE                     0x8000
167
#define TC_CAPT                     0x0
168
 
169
/*-------------------------------------*/
170
/* Capture Mode : RA Loading Selection */
171
/*-------------------------------------*/
172
#define TC_LDRA                     0x30000
173
#define TC_LDRA_EDGE_NONE           0x0
174
#define TC_LDRA_RISING_EDGE         0x10000
175
#define TC_LDRA_FALLING_EDGE        0x20000
176
#define TC_LDRA_BOTH_EDGE           0x30000
177
 
178
/*-------------------------------------------*/
179
/* Waveform Mode : RA Compare Effect on TIOA */
180
/*-------------------------------------------*/
181
#define TC_ACPA                     0x30000
182
#define TC_ACPA_OUTPUT_NONE         0x0
183
#define TC_ACPA_SET_OUTPUT          0x10000
184
#define TC_ACPA_CLEAR_OUTPUT        0x20000
185
#define TC_ACPA_TOGGLE_OUTPUT       0x30000
186
 
187
/*-------------------------------------*/
188
/* Capture Mode : RB Loading Selection */
189
/*-------------------------------------*/
190
#define TC_LDRB                     0xC0000
191
#define TC_LDRB_EDGE_NONE           0x0
192
#define TC_LDRB_RISING_EDGE         0x40000
193
#define TC_LDRB_FALLING_EDGE        0x80000
194
#define TC_LDRB_BOTH_EDGE           0xC0000
195
 
196
/*-------------------------------------------*/
197
/* Waveform Mode : RC Compare Effect on TIOA */
198
/*-------------------------------------------*/
199
#define TC_ACPC                     0xC0000
200
#define TC_ACPC_OUTPUT_NONE         0x0
201
#define TC_ACPC_SET_OUTPUT          0x40000
202
#define TC_ACPC_CLEAR_OUTPUT        0x80000
203
#define TC_ACPC_TOGGLE_OUTPUT       0xC0000
204
 
205
/*-----------------------------------------------*/
206
/* Waveform Mode : External Event Effect on TIOA */
207
/*-----------------------------------------------*/
208
#define TC_AEEVT                    0x300000
209
#define TC_AEEVT_OUTPUT_NONE        0x0
210
#define TC_AEEVT_SET_OUTPUT         0x100000
211
#define TC_AEEVT_CLEAR_OUTPUT       0x200000
212
#define TC_AEEVT_TOGGLE_OUTPUT      0x300000
213
 
214
/*-------------------------------------------------*/
215
/* Waveform Mode : Software Trigger Effect on TIOA */
216
/*-------------------------------------------------*/
217
#define TC_ASWTRG                   0xC00000
218
#define TC_ASWTRG_OUTPUT_NONE       0x0
219
#define TC_ASWTRG_SET_OUTPUT        0x400000
220
#define TC_ASWTRG_CLEAR_OUTPUT      0x800000
221
#define TC_ASWTRG_TOGGLE_OUTPUT     0xC00000
222
 
223
/*-------------------------------------------*/
224
/* Waveform Mode : RB Compare Effect on TIOB */
225
/*-------------------------------------------*/
226
#define TC_BCPB                     0x1000000
227
#define TC_BCPB_OUTPUT_NONE         0x0
228
#define TC_BCPB_SET_OUTPUT          0x1000000
229
#define TC_BCPB_CLEAR_OUTPUT        0x2000000
230
#define TC_BCPB_TOGGLE_OUTPUT       0x3000000
231
 
232
/*-------------------------------------------*/
233
/* Waveform Mode : RC Compare Effect on TIOB */
234
/*-------------------------------------------*/
235
#define TC_BCPC                     0xC000000
236
#define TC_BCPC_OUTPUT_NONE         0x0
237
#define TC_BCPC_SET_OUTPUT          0x4000000
238
#define TC_BCPC_CLEAR_OUTPUT        0x8000000
239
#define TC_BCPC_TOGGLE_OUTPUT       0xC000000
240
 
241
/*-----------------------------------------------*/
242
/* Waveform Mode : External Event Effect on TIOB */
243
/*-----------------------------------------------*/
244
#define TC_BEEVT                    0x30000000      //* bit 29-28
245
#define TC_BEEVT_OUTPUT_NONE        0x0
246
#define TC_BEEVT_SET_OUTPUT         0x10000000      //* bit 29-28  01
247
#define TC_BEEVT_CLEAR_OUTPUT       0x20000000      //* bit 29-28  10
248
#define TC_BEEVT_TOGGLE_OUTPUT      0x30000000      //* bit 29-28  11
249
 
250
/*- -----------------------------------------------*/
251
/* Waveform Mode : Software Trigger Effect on TIOB */
252
/*-------------------------------------------------*/
253
#define TC_BSWTRG                   0xC0000000
254
#define TC_BSWTRG_OUTPUT_NONE       0x0
255
#define TC_BSWTRG_SET_OUTPUT        0x40000000
256
#define TC_BSWTRG_CLEAR_OUTPUT      0x80000000
257
#define TC_BSWTRG_TOGGLE_OUTPUT     0xC0000000
258
 
259
/*------------------------------------------------------*/
260
/* TC_SR: Timer Counter Status Register Bits Definition */
261
/*------------------------------------------------------*/
262
#define TC_COVFS            0x1         /* Counter Overflow Status */
263
#define TC_LOVRS            0x2         /* Load Overrun Status */
264
#define TC_CPAS             0x4         /* RA Compare Status */
265
#define TC_CPBS             0x8         /* RB Compare Status */
266
#define TC_CPCS             0x10        /* RC Compare Status */
267
#define TC_LDRAS            0x20        /* RA Loading Status */
268
#define TC_LDRBS            0x40        /* RB Loading Status */
269
#define TC_ETRGS            0x80        /* External Trigger Status */
270
#define TC_CLKSTA           0x10000     /* Clock Status */
271
#define TC_MTIOA            0x20000     /* TIOA Mirror */
272
#define TC_MTIOB            0x40000     /* TIOB Status */
273
 
274
/*--------------------------------------------------------------*/
275
/* TC_BCR: Timer Counter Block Control Register Bits Definition */
276
/*--------------------------------------------------------------*/
277
#define TC_SYNC             0x1         /* Synchronisation Trigger */
278
 
279
/*------------------------------------------------------------*/
280
/*  TC_BMR: Timer Counter Block Mode Register Bits Definition */
281
/*------------------------------------------------------------*/
282
#define TC_TC0XC0S          0x3        /* External Clock Signal 0 Selection */
283
#define TC_TCLK0XC0         0x0
284
#define TC_NONEXC0          0x1
285
#define TC_TIOA1XC0         0x2
286
#define TC_TIOA2XC0         0x3
287
 
288
#define TC_TC1XC1S          0xC        /* External Clock Signal 1 Selection */
289
#define TC_TCLK1XC1         0x0
290
#define TC_NONEXC1          0x4
291
#define TC_TIOA0XC1         0x8
292
#define TC_TIOA2XC1         0xC
293
 
294
#define TC_TC2XC2S          0x30       /* External Clock Signal 2 Selection */
295
#define TC_TCLK2XC2         0x0
296
#define TC_NONEXC2          0x10
297
#define TC_TIOA0XC2         0x20
298
#define TC_TIOA1XC2         0x30
299
 
300
#endif /* tc_h */
301
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.