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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM7_STR75x_GCC/] [STLibrary/] [inc/] [75x_pwm.h] - Blame information for rev 583

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_pwm.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
*                      PWM 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_PWM_H
22
#define __75x_PWM_H
23
 
24
/* Includes ------------------------------------------------------------------*/
25
#include "75x_map.h"
26
 
27
/* Exported types ------------------------------------------------------------*/
28
 
29
typedef struct
30
{
31
  u16 PWM_Mode;        /* PWM Mode */
32
  u16 PWM_Prescaler;   /* Prescaler value */
33
  u16 PWM_CounterMode; /* Counter mode: Up/Down, Edge aligned or center aligned */
34
  u16 PWM_Period;      /* Period value */
35
  u16 PWM_Complementary; /* Complementary PWM selection */
36
  u16 PWM_OCState;       /* Output compare off-state in Run mode */
37
  u16 PWM_OCNState;      /* Complementary Output compare off-state in Run mode */
38
  u16 PWM_Channel;       /* PWM Channel: 1, 2 or 3 */
39
  u16 PWM_Pulse1;        /* PWM or OCM Channel 1 pulse length */
40
  u16 PWM_Pulse2;        /* PWM or OCM Channel 2 pulse length */
41
  u16 PWM_Pulse3;        /* PWM or OCM Channel 3 pulse length */
42
  u16 PWM_Polarity1;     /* PWM, OCM or OPM Channel 1 polarity */
43
  u16 PWM_Polarity2;     /* PWM or OCM  Channel 2 polarity */
44
  u16 PWM_Polarity3;     /* PWM or OCM  Channel 3 polarity */
45
  u16 PWM_Polarity1N;    /* PWM or OCM  Channel 1N polarity */
46
  u16 PWM_Polarity2N;    /* PWM or OCM  Channel 2N polarity */
47
  u16 PWM_Polarity3N;    /* PWM or OCM  Channel 3N polarity */
48
  u16 PWM_DTRAccess;     /* Enable or disable the configuration of DTR register parameters:
49
                          DeadTime, Emergency, LOCKLevel, OSSIState, OCState and OCNState */
50
  u16 PWM_DeadTime;      /* Dead Time value */
51
  u16 PWM_Emergency;     /* Emergency selection: Enable / Disable */
52
  u16 PWM_LOCKLevel;     /* LOCK level */
53
  u16 PWM_OSSIState;     /* Off-State Selection for Idle state */
54
  u8 PWM_RepetitionCounter; /* Repetition counter value */
55
} PWM_InitTypeDef;
56
 
57
/* Exported constants --------------------------------------------------------*/
58
/* PWM modes */
59
#define PWM_Mode_OCTiming    0x0001
60
#define PWM_Mode_OCActive    0x0002
61
#define PWM_Mode_OCInactive  0x0003
62
#define PWM_Mode_OCToggle    0x0004
63
#define PWM_Mode_PWM         0x0005
64
 
65
/* PWM Counter Mode */
66
#define PWM_CounterMode_Up              0x0000
67
#define PWM_CounterMode_Down            0x0010
68
#define PWM_CounterMode_CenterAligned1  0x0020
69
#define PWM_CounterMode_CenterAligned2  0x0040
70
#define PWM_CounterMode_CenterAligned3  0x0060
71
 
72
/* PWM Channel */
73
#define PWM_Channel_1    0x0001
74
#define PWM_Channel_2    0x0002
75
#define PWM_Channel_3    0x0004
76
#define PWM_Channel_ALL  0x0007
77
 
78
/* PWM Polarity channel 1 */
79
#define PWM_Polarity1_High  0x0001
80
#define PWM_Polarity1_Low   0x0002
81
 
82
/* PWM Polarity channel 2 */
83
#define PWM_Polarity2_High  0x0001
84
#define PWM_Polarity2_Low   0x0002
85
 
86
/* PWM Polarity channel 3 */
87
#define PWM_Polarity3_High  0x0001
88
#define PWM_Polarity3_Low   0x0002
89
 
90
/* PWM Polarity channel 1N */
91
#define PWM_Polarity1N_High  0x0001
92
#define PWM_Polarity1N_Low   0x0002
93
 
94
/* PWM Polarity channel 2N */
95
#define PWM_Polarity2N_High  0x0001
96
#define PWM_Polarity2N_Low   0x0002
97
 
98
/* PWM Polarity channel 3N */
99
#define PWM_Polarity3N_High  0x0001
100
#define PWM_Polarity3N_Low   0x0002
101
 
102
/* PWM interrupt sources */
103
#define PWM_IT_OC1           0x0100
104
#define PWM_IT_OC2           0x0200
105
#define PWM_IT_OC3           0x0400
106
#define PWM_IT_Update        0x0001
107
#define PWM_IT_GlobalUpdate  0x1001
108
#define PWM_IT_Emergency     0x8000
109
 
110
/* PWM DMA sources */
111
#define PWM_DMASource_OC1        0x0100
112
#define PWM_DMASource_OC2        0x0200
113
#define PWM_DMASource_OC3        0x0400
114
#define PWM_DMASource_Update     0x0001
115
 
116
/* PWM DMA Base address */
117
#define PWM_DMABase_CR    0x0000
118
#define PWM_DMABase_SCR   0x0800
119
#define PWM_DMABase_OMR1  0x1800
120
#define PWM_DMABase_OMR2  0x2000
121
#define PWM_DMABase_RSR   0x3000
122
#define PWM_DMABase_RER   0x3800
123
#define PWM_DMABase_ISR   0x4000
124
#define PWM_DMABase_CNT   0x4800
125
#define PWM_DMABase_PSC   0x5000
126
#define PWM_DMABase_RCR   0x5800
127
#define PWM_DMABase_ARR   0x6000
128
#define PWM_DMABase_OCR1  0x6800
129
#define PWM_DMABase_OCR2  0x7000
130
#define PWM_DMABase_OCR3  0x7800
131
#define PWM_DMABase_DTR   0xB800
132
 
133
/* PWM OCM state */
134
#define PWM_OCRMState_Enable   0x0005
135
#define PWM_OCRMState_Disable  0x0006
136
 
137
/* PWM Flags */
138
#define PWM_FLAG_OC1        0x0100
139
#define PWM_FLAG_OC2        0x0200
140
#define PWM_FLAG_OC3        0x0400
141
#define PWM_FLAG_Update     0x0001
142
#define PWM_FLAG_Emergency  0x8000
143
 
144
/*  PWM_ForcedAction */
145
#define PWM_ForcedAction_Active    0x000A
146
#define PWM_ForcedAction_InActive  0x0008
147
 
148
/* PWM TRGO Mode */
149
#define PWM_TRGOMode_Enable  0x0100
150
#define PWM_TRGOMode_Update  0x0200
151
#define PWM_TRGOMode_Reset   0x0000
152
#define PWM_TRGOMode_OC      0x0300
153
 
154
/* PWM Complementary outputs Enable/Disable */
155
#define PWM_Complementary_Disable  0x0001
156
#define PWM_Complementary_Enable   0x0002
157
 
158
/* PWM DTR Access Enable/Disable */
159
#define PWM_DTRAccess_Enable  0x0001
160
#define PWM_DTRAccess_Disable 0x0002
161
 
162
/* PWM Emergency input Enable/Disable */
163
#define PWM_Emergency_Disable  0x0000
164
#define PWM_Emergency_Enable   0x1000
165
 
166
/* OC states */
167
#define PWM_OCNState_Disable   0x0001
168
#define PWM_OCNState_Enable    0x0002
169
#define PWM_OCNState_OffState  0x0003
170
 
171
/* OCN states */
172
#define PWM_OCState_Disable   0x0004
173
#define PWM_OCState_Enable    0x0005
174
#define PWM_OCState_OffState  0x0006
175
 
176
/* PWM LOCK level */
177
#define PWM_LOCKLevel_1    0x0400
178
#define PWM_LOCKLevel_2    0x0800
179
#define PWM_LOCKLevel_3    0x0C00
180
#define PWM_LOCKLevel_OFF  0x0000
181
 
182
/* Off State selection for Idle state */
183
#define PWM_OSSIState_Disable  0x0000
184
#define PWM_OSSIState_Enable   0x2000
185
 
186
/* Exported macro ------------------------------------------------------------*/
187
/* Exported functions --------------------------------------------------------*/
188
void PWM_DeInit(void);
189
void PWM_Init(PWM_InitTypeDef* PWM_InitStruct);
190
void PWM_StructInit(PWM_InitTypeDef *PWM_InitStruct);
191
void PWM_Cmd(FunctionalState Newstate);
192
void PWM_CtrlPWMOutputs(FunctionalState Newstate);
193
void PWM_ITConfig(u16 PWM_IT, FunctionalState Newstate);
194
void PWM_DMAConfig(u16 PWM_DMASources, u16 PWM_OCRMState, u16 PWM_DMABase);
195
void PWM_DMACmd(u16 PWM_DMASources, FunctionalState Newstate);
196
void PWM_SetPrescaler(u16 Prescaler);
197
void PWM_SetPeriod(u16 Period);
198
void PWM_SetPulse(u16 PWM_Channel, u16 Pulse);
199
void PWM_SetPulse1(u16 Pulse);
200
void PWM_SetPulse2(u16 Pulse);
201
void PWM_SetPulse3(u16 Pulse);
202
void PWM_DebugCmd(FunctionalState Newstate);
203
void PWM_CounterModeConfig(u16 PWM_CounterMode);
204
void PWM_ForcedOCConfig(u16 PWM_Channel, u16 PWM_ForcedAction);
205
void PWM_SetDeadTime(u16 DeadTime);
206
void PWM_ResetCounter(void);
207
void PWM_TRGOSelection(u16 PWM_TRGOMode);
208
FlagStatus PWM_GetFlagStatus(u16 PWM_FLAG);
209
void PWM_ClearFlag(u16 PWM_FLAG);
210
ITStatus PWM_GetITStatus(u16 PWM_IT);
211
void PWM_ClearITPendingBit(u16 PWM_IT);
212
 
213
#endif /* __75x_PWM_H */
214
 
215
/******************* (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.