Subversion Repositories NaviCtrl

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 ingob 1
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
2
* File Name          : 91x_mc.h
3
* Author             : MCD Application Team
4
* Date First Issued  : 05/18/2006 : Version 1.0
5
* Description        : This file contains all the functions prototypes for the
6
*                      MC software library.
7
********************************************************************************
8
* History:
9
* 05/22/2007 : Version 1.2
10
* 05/24/2006 : Version 1.1
11
* 05/18/2006 : Version 1.0
12
********************************************************************************
13
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
14
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
15
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
16
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
17
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
18
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
19
*******************************************************************************/
20
/* Define to prevent recursive inclusion -------------------------------------*/
21
#ifndef __91x_MC_H
22
#define __91x_MC_H
23
 
24
/* Includes ------------------------------------------------------------------*/
25
#include "91x_map.h"
26
 
27
/* Exported types ------------------------------------------------------------*/
28
typedef struct
29
{
30
  u16 MC_OperatingMode;
31
  u16 MC_TachoMode;
32
  u16 MC_TachoEvent_Mode;
33
  u8  MC_Prescaler;
34
  u8  MC_ForcedPWMState;
35
  u16 MC_TachoPrescaler;
36
  u16 MC_PWMMode;
37
  u16 MC_Complementary;
38
  u16 MC_Emergency;
39
  u16 MC_Period;
40
  u16 MC_TachoPeriod;
41
  u16 MC_Channel;
42
  u16 MC_PulseU;
43
  u16 MC_PulseV;
44
  u16 MC_PulseW;
45
  u16 MC_PolarityUL;
46
  u16 MC_PolarityUH;
47
  u16 MC_PolarityVL;
48
  u16 MC_PolarityVH;
49
  u16 MC_PolarityWL;
50
  u16 MC_PolarityWH;
51
  u16 MC_TachoPolarity;
52
  u16 MC_DeadTime;
53
  u8  MC_RepetitionCounter;
54
} MC_InitTypeDef;
55
 
56
typedef enum { DOWN = 0, UP  = !DOWN} CountingStatus;
57
 
58
/* Exported constants --------------------------------------------------------*/
59
#define MC_Complementary_Enable   0x0001
60
#define MC_Complementary_Disable  0x0002
61
 
62
#define MC_HardwareOperating_Mode 0x0001
63
#define MC_SoftwareOperating_Mode 0x0002
64
 
65
#define MC_PWMClassical_Mode    0x0001
66
#define MC_PWMZeroCentered_Mode 0x0002
67
 
68
#define MC_Emergency_Enable  0x0001
69
#define MC_Emergency_Disable 0x0002
70
 
71
#define MC_Polarity_Inverted     0x0001
72
#define MC_Polarity_NonInverted  0x0002
73
 
74
#define MC_TachoOneShot_Mode     0x0001
75
#define MC_TachoContinuous_Mode  0x0002
76
 
77
#define MC_TachoEventEdge_None           0x0000
78
#define MC_TachoEventEdge_Falling        0x0001
79
#define MC_TachoEventEdge_Rising         0x0002
80
#define MC_TachoEventEdge_RisingFalling  0x0003
81
 
82
#define MC_Channel_U           0x0001
83
#define MC_Channel_V           0x0002
84
#define MC_Channel_W           0x0003
85
#define MC_Channel_ALL         0x0004
86
 
87
 
88
#define MC_TachoEvent_Hardware_Mode  0x0001
89
#define MC_TachoEvent_Software_Mode  0x0002
90
 
91
#define MC_IT_CMPW  0x0001
92
#define MC_IT_CMPV  0x0002
93
#define MC_IT_CMPU  0x0004
94
#define MC_IT_ZPC   0x0008
95
#define MC_IT_ADT   0x0010
96
#define MC_IT_OTC   0x0020
97
#define MC_IT_CPT   0x0040
98
#define MC_IT_CM0   0x0080
99
 
100
#define MC_FLAG_CMPW  0x0001
101
#define MC_FLAG_CMPV  0x0002
102
#define MC_FLAG_CMPU  0x0004
103
#define MC_FLAG_ZPC   0x0008
104
#define MC_FLAG_ADT   0x0010
105
#define MC_FLAG_OTC   0x0020
106
#define MC_FLAG_CPT   0x0040
107
#define MC_FLAG_CM0   0x0080
108
#define MC_FLAG_EST   0x0100
109
/* Exported macro ------------------------------------------------------------*/
110
/* Exported functions --------------------------------------------------------*/
111
void MC_Init(MC_InitTypeDef* MC_InitStruct);
112
void MC_DeInit(void);
113
void MC_StructInit(MC_InitTypeDef* MC_InitStruct);
114
void MC_Cmd(FunctionalState NewState);
115
void MC_CtrlPWMOutputs(FunctionalState Newstate);
116
void MC_ITConfig(u16 MC_IT, FunctionalState NewState);
117
void MC_SetPrescaler(u8 Prescaler);
118
void MC_SetPeriod(u16 MC_Period);
119
void MC_SetPulseU(u16 MC_PulseU);
120
void MC_SetPulseV(u16 MC_PulseV);
121
void MC_SetPulseW(u16 MC_PulseW);
122
void MC_SetTachoCompare(u8 MC_Compare);
123
void MC_PWMModeConfig(u16 MC_PWMMode);
124
void MC_SetDeadTime(u16 MC_DeadTime);
125
void MC_EmergencyCmd(FunctionalState NewState);
126
void MC_EmergencyClear(void);
127
u16 MC_GetPeriod(void);
128
u16 MC_GetPulseU(void);
129
u16 MC_GetPulseV(void);
130
u16 MC_GetPulseW(void);
131
u16 MC_GetTachoCapture(void);
132
void MC_ClearOnTachoCapture(FunctionalState NewState);
133
void MC_ForceDataTransfer(u8 MC_ForcedData);
134
void MC_SoftwarePreloadConfig(void);
135
void MC_SoftwareTachoCapture(void);
136
CountingStatus MC_GetCountingStatus(void);
137
FlagStatus MC_GetFlagStatus(u16 MC_FLAG);
138
void MC_ClearFlag(u16 MC_FLAG);
139
ITStatus MC_GetITStatus(u16 MC_IT);
140
void MC_ClearITPendingBit(u16 MC_IT);
141
void MC_ClearPWMCounter(void);
142
void MC_ClearTachoCounter(void);
143
 
144
#endif /* __91x_MC_H */
145
 
146
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
147