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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM7_STR75x_IAR/] [STLibrary/] [inc/] [75x_tim.h] - Blame information for rev 609

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 577 jeremybenn
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
2
* File Name          : 75x_tim.h
3
* Author             : MCD Application Team
4
* Date First Issued  : 03/10/2006
5
* Description        : This file contains all the functions prototypes for the
6
*                      TIM software library.
7
********************************************************************************
8
* History:
9
* 07/17/2006 : V1.0
10
* 03/10/2006 : V0.1
11
********************************************************************************
12
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
14
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
15
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
16
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
17
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18
*******************************************************************************/
19
 
20
/* Define to prevent recursive inclusion -------------------------------------*/
21
#ifndef __75x_TIM_H
22
#define __75x_TIM_H
23
 
24
/* Includes ------------------------------------------------------------------*/
25
#include "75x_map.h"
26
 
27
/* Exported types ------------------------------------------------------------*/
28
typedef struct
29
{
30
  u16 TIM_Mode;              /* Timer Mode */
31
  u16 TIM_Prescaler;         /* Prescaler value */
32
  u16 TIM_ClockSource;       /* Timer clock source */
33
  u16 TIM_ExtCLKEdge;        /* External clock edge */
34
  u16 TIM_CounterMode;       /* Counter mode: Up/Down, Edge aligned or center aligned */
35
  u16 TIM_Period;            /* Period value */
36
  u16 TIM_Channel;           /* Timer Channel: 1, 2 or All */
37
  u16 TIM_Pulse1;            /* PWM or OCM Channel 1 pulse length */
38
  u16 TIM_Pulse2;            /* PWM or OCM Channel 2 pulse length */
39
  u16 TIM_RepetitivePulse;   /* OPM Repetitive pulse state: enable or disable */
40
  u16 TIM_Polarity1;         /* PWM, OCM or OPM Channel 1 polarity */
41
  u16 TIM_Polarity2;         /* PWM or OCM  Channel 2 polarity */
42
  u16 TIM_IC1Selection;      /* Input Capture 1 selection: TI1 or TI2 */
43
  u16 TIM_IC2Selection;      /* Input Capture 2 selection: TI1 or TI2 */
44
  u16 TIM_IC1Polarity;       /* Input Capture 1 polarity */
45
  u16 TIM_IC2Polarity;       /* Input Capture 2 polarity */
46
  u16 TIM_PWMI_ICSelection;  /* PWM Input Capture selection: TI1 or TI2 */
47
  u16 TIM_PWMI_ICPolarity;   /* PWM Input Capture Polarity */
48
} TIM_InitTypeDef;
49
 
50
/* Master and slave synchronized Timer peripherals */
51
typedef enum
52
{
53
  PWM_Master  = 0x01,
54
  TIM0_Master,
55
  TIM1_Master,
56
  TIM2_Master
57
}Master_TypeDef;
58
 
59
typedef enum
60
{
61
  PWM_Slave  = 0x05,
62
  TIM0_Slave,
63
  TIM1_Slave,
64
  TIM2_Slave
65
}Slave_TypeDef;
66
 
67
/* Exported constants --------------------------------------------------------*/
68
/* TIM modes */
69
#define TIM_Mode_OCTiming    0x0001
70
#define TIM_Mode_OCActive    0x0002
71
#define TIM_Mode_OCInactive  0x0003
72
#define TIM_Mode_OCToggle    0x0004
73
#define TIM_Mode_PWM         0x0005
74
#define TIM_Mode_PWMI        0x0006
75
#define TIM_Mode_IC          0x0007
76
#define TIM_Mode_Encoder1    0x0008
77
#define TIM_Mode_Encoder2    0x0009
78
#define TIM_Mode_Encoder3    0x000A
79
#define TIM_Mode_OPM_PWM     0x000B
80
#define TIM_Mode_OPM_Toggle  0x000C
81
#define TIM_Mode_OPM_Active  0x000D
82
 
83
/* TIM Clock Source */
84
#define TIM_ClockSource_Internal  0x0001
85
#define TIM_ClockSource_TI11      0x0002
86
#define TIM_ClockSource_TI12      0x0003
87
#define TIM_ClockSource_TI22      0x0004
88
#define TIM_ClockSource_TI21      0x0005
89
 
90
/* TIM External Clock Edge */
91
#define TIM_ExtCLKEdge_Falling  0x0001
92
#define TIM_ExtCLKEdge_Rising   0x0002
93
 
94
/* TIM Counter Mode */
95
#define TIM_CounterMode_Up              0x0000
96
#define TIM_CounterMode_Down            0x0010
97
#define TIM_CounterMode_CenterAligned1  0x0020
98
#define TIM_CounterMode_CenterAligned2  0x0040
99
#define TIM_CounterMode_CenterAligned3  0x0060
100
 
101
/* TIM Channel */
102
#define TIM_Channel_1    0x0001
103
#define TIM_Channel_2    0x0002
104
#define TIM_Channel_ALL  0x0003
105
 
106
/* TIM Polarity channel 1 */
107
#define TIM_Polarity1_High  0x0001
108
#define TIM_Polarity1_Low   0x0002
109
 
110
/* TIM Polarity channel 2 */
111
#define TIM_Polarity2_High  0x0001
112
#define TIM_Polarity2_Low   0x0002
113
 
114
#define TIM_RepetitivePulse_Disable  0x0005
115
#define TIM_RepetitivePulse_Enable   0x0006
116
 
117
/* TIM Input Capture channel 1 Selection */
118
#define TIM_IC1Selection_TI1  0x0001
119
#define TIM_IC1Selection_TI2  0x0002
120
 
121
/* TIM Input Capture channel 2 Selection */
122
#define TIM_IC2Selection_TI1  0x0001
123
#define TIM_IC2Selection_TI2  0x0002
124
 
125
/* TIM Input Capture channel 1 Polarity */
126
#define  TIM_IC1Polarity_Falling  0x0001
127
#define  TIM_IC1Polarity_Rising   0x0002
128
 
129
/* TIM Input Capture channel 2 Polarity */
130
#define  TIM_IC2Polarity_Falling  0x0001
131
#define  TIM_IC2Polarity_Rising   0x0002
132
 
133
/* TIM PWM Input IC Selection */
134
#define TIM_PWMI_ICSelection_TI1  0x0001
135
#define TIM_PWMI_ICSelection_TI2  0x0002
136
 
137
/*  TIM PWM Input IC Polarity */
138
#define TIM_PWMI_ICPolarity_Falling  0x0003
139
#define TIM_PWMI_ICPolarity_Rising   0x0004
140
 
141
/* TIM interrupt sources */
142
#define TIM_IT_IC1           0x0004
143
#define TIM_IT_IC2           0x0008
144
#define TIM_IT_OC1           0x0100
145
#define TIM_IT_OC2           0x0200
146
#define TIM_IT_Update        0x0001
147
#define TIM_IT_GlobalUpdate  0x1001
148
 
149
/* TIM DMA sources */
150
#define TIM_DMASource_IC1     0x0004
151
#define TIM_DMASource_IC2     0x0008
152
#define TIM_DMASource_OC1     0x0100
153
#define TIM_DMASource_OC2     0x0200
154
#define TIM_DMASource_Update  0x0001
155
 
156
/* TIM DMA Base address */
157
#define TIM_DMABase_CR    0x0000
158
#define TIM_DMABase_SCR   0x0800
159
#define TIM_DMABase_IMCR  0x1000
160
#define TIM_DMABase_OMR1  0x1800
161
#define TIM_DMABase_RSR   0x3000
162
#define TIM_DMABase_RER   0x3800
163
#define TIM_DMABase_ISR   0x4000
164
#define TIM_DMABase_CNT   0x4800
165
#define TIM_DMABase_PSC   0x5000
166
#define TIM_DMABase_ARR   0x6000
167
#define TIM_DMABase_OCR1  0x6800
168
#define TIM_DMABase_OCR2  0x7000
169
#define TIM_DMABase_ICR1  0x9800
170
#define TIM_DMABase_ICR2  0xA000
171
 
172
/* TIM Flags */
173
#define TIM_FLAG_IC1     0x0004
174
#define TIM_FLAG_IC2     0x0008
175
#define TIM_FLAG_OC1     0x0100
176
#define TIM_FLAG_OC2     0x0200
177
#define TIM_FLAG_Update  0x0001
178
 
179
/*  TIM_ForcedAction */
180
#define TIM_ForcedAction_Active    0x000A
181
#define TIM_ForcedAction_InActive  0x0008
182
 
183
/* TIM synchronization action */
184
#define TIM_SynchroAction_Enable  0x0100
185
#define TIM_SynchroAction_Update  0x0200
186
#define TIM_SynchroAction_Reset   0x0000
187
#define TIM_SynchroAction_OC      0x0300
188
 
189
/* TIM synchronization mode */
190
#define TIM_SynchroMode_Gated    0x0010
191
#define TIM_SynchroMode_Trigger  0x0018
192
#define TIM_SynchroMode_External 0x0008
193
#define TIM_SynchroMode_Reset    0x0000
194
 
195
/* OCRM bit states */
196
#define TIM_OCRMState_Enable   0x0005
197
#define TIM_OCRMState_Disable  0x0006
198
 
199
/* Exported macro ------------------------------------------------------------*/
200
/* Exported functions --------------------------------------------------------*/
201
void TIM_DeInit(TIM_TypeDef *TIMx);
202
void TIM_Init(TIM_TypeDef* TIMx, TIM_InitTypeDef* TIM_InitStruct);
203
void TIM_StructInit(TIM_InitTypeDef *TIM_InitStruct);
204
void TIM_Cmd(TIM_TypeDef *TIMx, FunctionalState Newstate);
205
void TIM_ITConfig(TIM_TypeDef *TIMx, u16 TIM_IT, FunctionalState Newstate);
206
void TIM_PreloadConfig(TIM_TypeDef* TIMx, u16 TIM_Channel, FunctionalState Newstate);
207
void TIM_DMAConfig(u16 TIM_DMASources, u16 TIM_OCRMState, u16 TIM_DMABase);
208
void TIM_DMACmd(u16 TIM_DMASources, FunctionalState Newstate);
209
void TIM_ClockSourceConfig(TIM_TypeDef *TIMx, u16 TIM_ClockSource,
210
                           u16 TIM_ExtCLKEdge);
211
void TIM_SetPrescaler(TIM_TypeDef* TIMx, u16 Prescaler);
212
void TIM_SetPeriod(TIM_TypeDef* TIMx, u16 Period);
213
void TIM_SetPulse(TIM_TypeDef* TIMx, u16 TIM_Channel, u16 Pulse);
214
u16 TIM_GetICAP1(TIM_TypeDef *TIMx);
215
u16 TIM_GetICAP2(TIM_TypeDef *TIMx);
216
u16 TIM_GetPWMIPulse(TIM_TypeDef *TIMx);
217
u16 TIM_GetPWMIPeriod(TIM_TypeDef *TIMx);
218
void TIM_DebugCmd(TIM_TypeDef *TIMx, FunctionalState Newstate);
219
void TIM_CounterModeConfig(TIM_TypeDef* TIMx, u16 TIM_CounterMode);
220
void TIM_ForcedOCConfig(TIM_TypeDef* TIMx, u16 TIM_Channel,
221
                        u16 TIM_ForcedAction);
222
void TIM_ResetCounter(TIM_TypeDef* TIMx);
223
void TIM_SynchroConfig(Master_TypeDef Master, Slave_TypeDef Slave,
224
                       u16 TIM_SynchroAction, u16 TIM_SynchroMode);
225
FlagStatus TIM_GetFlagStatus(TIM_TypeDef* TIMx, u16 TIM_FLAG);
226
void TIM_ClearFlag(TIM_TypeDef* TIMx, u16 TIM_FLAG);
227
ITStatus TIM_GetITStatus(TIM_TypeDef* TIMx, u16 TIM_IT);
228
void TIM_ClearITPendingBit(TIM_TypeDef* TIMx, u16 TIM_IT);
229
 
230
#endif /* __75x_TIM_H */
231
 
232
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/

powered by: WebSVN 2.1.0

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