]> git.sur5r.net Git - freertos/blob - Demo/CORTEX_LM3S811_KEIL/LuminaryCode/src/pwm.h
Start to re-arrange files to include FreeRTOS+ in main download.
[freertos] / Demo / CORTEX_LM3S811_KEIL / LuminaryCode / src / pwm.h
1 //*****************************************************************************\r
2 //\r
3 // pwm.h - API function protoypes for Pulse Width Modulation (PWM) ports\r
4 //\r
5 // Copyright (c) 2005,2006 Luminary Micro, Inc.  All rights reserved.\r
6 //\r
7 // Software License Agreement\r
8 //\r
9 // Luminary Micro, Inc. (LMI) is supplying this software for use solely and\r
10 // exclusively on LMI's Stellaris Family of microcontroller products.\r
11 //\r
12 // The software is owned by LMI and/or its suppliers, and is protected under\r
13 // applicable copyright laws.  All rights are reserved.  Any use in violation\r
14 // of the foregoing restrictions may subject the user to criminal sanctions\r
15 // under applicable laws, as well as to civil liability for the breach of the\r
16 // terms and conditions of this license.\r
17 //\r
18 // THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED\r
19 // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF\r
20 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.\r
21 // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR\r
22 // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.\r
23 //\r
24 // This is part of revision 816 of the Stellaris Driver Library.\r
25 //\r
26 //*****************************************************************************\r
27 \r
28 #ifndef __PWM_H__\r
29 #define __PWM_H__\r
30 \r
31 #ifdef __cplusplus\r
32 extern "C"\r
33 {\r
34 #endif\r
35 \r
36 //*****************************************************************************\r
37 //\r
38 // The following defines are passed to PWMGenConfigure() as the ulConfig\r
39 // parameter and specify the configuration of the PWM generator.\r
40 //\r
41 //*****************************************************************************\r
42 #define PWM_GEN_MODE_DOWN       0x00000000  // Down count mode\r
43 #define PWM_GEN_MODE_UP_DOWN    0x00000002  // Up/Down count mode\r
44 #define PWM_GEN_MODE_SYNC       0x00000038  // Synchronous updates\r
45 #define PWM_GEN_MODE_NO_SYNC    0x00000000  // Immediate updates\r
46 #define PWM_GEN_MODE_DBG_RUN    0x00000004  // Continue running in debug mode\r
47 #define PWM_GEN_MODE_DBG_STOP   0x00000000  // Stop running in debug mode\r
48 \r
49 //*****************************************************************************\r
50 //\r
51 // Defines for enabling, disabling, and clearing PWM generator interrupts and\r
52 // triggers.\r
53 //\r
54 //*****************************************************************************\r
55 #define PWM_INT_CNT_ZERO        0x00000001  // Int if COUNT = 0\r
56 #define PWM_INT_CNT_LOAD        0x00000002  // Int if COUNT = LOAD\r
57 #define PWM_INT_CNT_AU          0x00000004  // Int if COUNT = CMPA U\r
58 #define PWM_INT_CNT_AD          0x00000008  // Int if COUNT = CMPA D\r
59 #define PWM_INT_CNT_BU          0x00000010  // Int if COUNT = CMPA U\r
60 #define PWM_INT_CNT_BD          0x00000020  // Int if COUNT = CMPA D\r
61 #define PWM_TR_CNT_ZERO         0x00000100  // Trig if COUNT = 0\r
62 #define PWM_TR_CNT_LOAD         0x00000200  // Trig if COUNT = LOAD\r
63 #define PWM_TR_CNT_AU           0x00000400  // Trig if COUNT = CMPA U\r
64 #define PWM_TR_CNT_AD           0x00000800  // Trig if COUNT = CMPA D\r
65 #define PWM_TR_CNT_BU           0x00001000  // Trig if COUNT = CMPA U\r
66 #define PWM_TR_CNT_BD           0x00002000  // Trig if COUNT = CMPA D\r
67 \r
68 //*****************************************************************************\r
69 //\r
70 // Defines for enabling, disabling, and clearing PWM interrupts.\r
71 //\r
72 //*****************************************************************************\r
73 #define PWM_INT_GEN_0           0x00000001  // Generator 0 interrupt\r
74 #define PWM_INT_GEN_1           0x00000002  // Generator 1 interrupt\r
75 #define PWM_INT_GEN_2           0x00000004  // Generator 2 interrupt\r
76 #define PWM_INT_FAULT           0x00010000  // Fault interrupt\r
77 \r
78 //*****************************************************************************\r
79 //\r
80 // Defines to identify the generators within a module.\r
81 //\r
82 //*****************************************************************************\r
83 #define PWM_GEN_0               0x00000040  // Offset address of Gen0\r
84 #define PWM_GEN_1               0x00000080  // Offset address of Gen1\r
85 #define PWM_GEN_2               0x000000C0  // Offset address of Gen2\r
86 \r
87 #define PWM_GEN_0_BIT           0x00000001  // Bit-wise ID for Gen0\r
88 #define PWM_GEN_1_BIT           0x00000002  // Bit-wise ID for Gen1\r
89 #define PWM_GEN_2_BIT           0x00000004  // Bit-wise ID for Gen2\r
90 \r
91 //*****************************************************************************\r
92 //\r
93 // Defines to identify the outputs within a module.\r
94 //\r
95 //*****************************************************************************\r
96 #define PWM_OUT_0               0x00000040  // Encoded offset address of PWM0\r
97 #define PWM_OUT_1               0x00000041  // Encoded offset address of PWM1\r
98 #define PWM_OUT_2               0x00000082  // Encoded offset address of PWM2\r
99 #define PWM_OUT_3               0x00000083  // Encoded offset address of PWM3\r
100 #define PWM_OUT_4               0x000000C4  // Encoded offset address of PWM4\r
101 #define PWM_OUT_5               0x000000C5  // Encoded offset address of PWM5\r
102 \r
103 #define PWM_OUT_0_BIT           0x00000001  // Bit-wise ID for PWM0\r
104 #define PWM_OUT_1_BIT           0x00000002  // Bit-wise ID for PWM1\r
105 #define PWM_OUT_2_BIT           0x00000004  // Bit-wise ID for PWM2\r
106 #define PWM_OUT_3_BIT           0x00000008  // Bit-wise ID for PWM3\r
107 #define PWM_OUT_4_BIT           0x00000010  // Bit-wise ID for PWM4\r
108 #define PWM_OUT_5_BIT           0x00000020  // Bit-wise ID for PWM5\r
109 \r
110 //*****************************************************************************\r
111 //\r
112 // API Function prototypes\r
113 //\r
114 //*****************************************************************************\r
115 extern void PWMGenConfigure(unsigned long ulBase, unsigned long ulGen,\r
116                             unsigned long ulConfig);\r
117 extern void PWMGenPeriodSet(unsigned long ulBase, unsigned long ulGen,\r
118                             unsigned long ulPeriod);\r
119 extern unsigned long PWMGenPeriodGet(unsigned long ulBase,\r
120                                      unsigned long ulGen);\r
121 extern void PWMGenEnable(unsigned long ulBase, unsigned long ulGen);\r
122 extern void PWMGenDisable(unsigned long ulBase, unsigned long ulGen);\r
123 extern void PWMPulseWidthSet(unsigned long ulBase, unsigned long ulPWMOut,\r
124                              unsigned long ulWidth);\r
125 extern unsigned long PWMPulseWidthGet(unsigned long ulBase,\r
126                                       unsigned long ulPWMOut);\r
127 extern void PWMDeadBandEnable(unsigned long ulBase, unsigned long ulGen,\r
128                               unsigned short usRise, unsigned short usFall);\r
129 extern void PWMDeadBandDisable(unsigned long ulBase, unsigned long ulGen);\r
130 extern void PWMSyncUpdate(unsigned long ulBase, unsigned long ulGenBits);\r
131 extern void PWMSyncTimeBase(unsigned long ulBase, unsigned long ulGenBits);\r
132 extern void PWMOutputState(unsigned long ulBase, unsigned long ulPWMOutBits,\r
133                            tBoolean bEnable);\r
134 extern void PWMOutputInvert(unsigned long ulBase, unsigned long ulPWMOutBits,\r
135                             tBoolean bInvert);\r
136 extern void PWMOutputFault(unsigned long ulBase, unsigned long ulPWMOutBits,\r
137                            tBoolean bFaultKill);\r
138 extern void PWMGenIntRegister(unsigned long ulBase, unsigned long ulGen,\r
139                               void (*pfIntHandler)(void));\r
140 extern void PWMGenIntUnregister(unsigned long ulBase, unsigned long ulGen);\r
141 extern void PWMFaultIntRegister(unsigned long ulBase,\r
142                                 void (*pfIntHandler)(void));\r
143 extern void PWMFaultIntUnregister(unsigned long ulBase);\r
144 extern void PWMGenIntTrigEnable(unsigned long ulBase, unsigned long ulGen,\r
145                                 unsigned long ulIntTrig);\r
146 extern void PWMGenIntTrigDisable(unsigned long ulBase, unsigned long ulGen,\r
147                                  unsigned long ulIntTrig);\r
148 extern unsigned long PWMGenIntStatus(unsigned long ulBase, unsigned long ulGen,\r
149                                      tBoolean bMasked);\r
150 extern void PWMGenIntClear(unsigned long ulBase, unsigned long ulGen,\r
151                            unsigned long ulInts);\r
152 extern void PWMIntEnable(unsigned long ulBase, unsigned long ulGenFault);\r
153 extern void PWMIntDisable(unsigned long ulBase, unsigned long ulGenFault);\r
154 extern void PWMFaultIntClear(unsigned long ulBase);\r
155 extern unsigned long PWMIntStatus(unsigned long ulBase, tBoolean bMasked);\r
156 \r
157 #ifdef __cplusplus\r
158 }\r
159 #endif\r
160 \r
161 #endif // __PWM_H__\r