]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/Common/drivers/LuminaryMicro/lmi_timer.h
Add FreeRTOS-Plus directory.
[freertos] / FreeRTOS / Demo / Common / drivers / LuminaryMicro / lmi_timer.h
1 //*****************************************************************************\r
2 //\r
3 // timer.h - Prototypes for the timer module\r
4 //\r
5 // Copyright (c) 2005-2007 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 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 1582 of the Stellaris Peripheral Driver Library.\r
25 //\r
26 //*****************************************************************************\r
27 \r
28 #ifndef __TIMER_H__\r
29 #define __TIMER_H__\r
30 \r
31 #ifdef __cplusplus\r
32 extern "C"\r
33 {\r
34 #endif\r
35 \r
36 //*****************************************************************************\r
37 //\r
38 // Values that can be passed to TimerConfigure as the ulConfig parameter.\r
39 //\r
40 //*****************************************************************************\r
41 #define TIMER_CFG_32_BIT_OS     0x00000001  // 32-bit one-shot timer\r
42 #define TIMER_CFG_32_BIT_PER    0x00000002  // 32-bit periodic timer\r
43 #define TIMER_CFG_32_RTC        0x01000000  // 32-bit RTC timer\r
44 #define TIMER_CFG_16_BIT_PAIR   0x04000000  // Two 16-bit timers\r
45 #define TIMER_CFG_A_ONE_SHOT    0x00000001  // Timer A one-shot timer\r
46 #define TIMER_CFG_A_PERIODIC    0x00000002  // Timer A periodic timer\r
47 #define TIMER_CFG_A_CAP_COUNT   0x00000003  // Timer A event counter\r
48 #define TIMER_CFG_A_CAP_TIME    0x00000007  // Timer A event timer\r
49 #define TIMER_CFG_A_PWM         0x0000000A  // Timer A PWM output\r
50 #define TIMER_CFG_B_ONE_SHOT    0x00000100  // Timer B one-shot timer\r
51 #define TIMER_CFG_B_PERIODIC    0x00000200  // Timer B periodic timer\r
52 #define TIMER_CFG_B_CAP_COUNT   0x00000300  // Timer B event counter\r
53 #define TIMER_CFG_B_CAP_TIME    0x00000700  // Timer B event timer\r
54 #define TIMER_CFG_B_PWM         0x00000A00  // Timer B PWM output\r
55 \r
56 //*****************************************************************************\r
57 //\r
58 // Values that can be passed to TimerIntEnable, TimerIntDisable, and\r
59 // TimerIntClear as the ulIntFlags parameter, and returned from TimerIntStatus.\r
60 //\r
61 //*****************************************************************************\r
62 #define TIMER_CAPB_EVENT        0x00000400  // CaptureB event interrupt\r
63 #define TIMER_CAPB_MATCH        0x00000200  // CaptureB match interrupt\r
64 #define TIMER_TIMB_TIMEOUT      0x00000100  // TimerB time out interrupt\r
65 #define TIMER_RTC_MATCH         0x00000008  // RTC interrupt mask\r
66 #define TIMER_CAPA_EVENT        0x00000004  // CaptureA event interrupt\r
67 #define TIMER_CAPA_MATCH        0x00000002  // CaptureA match interrupt\r
68 #define TIMER_TIMA_TIMEOUT      0x00000001  // TimerA time out interrupt\r
69 \r
70 //*****************************************************************************\r
71 //\r
72 // Values that can be passed to TimerControlEvent as the ulEvent parameter.\r
73 //\r
74 //*****************************************************************************\r
75 #define TIMER_EVENT_POS_EDGE    0x00000000  // Count positive edges\r
76 #define TIMER_EVENT_NEG_EDGE    0x00000404  // Count negative edges\r
77 #define TIMER_EVENT_BOTH_EDGES  0x00000C0C  // Count both edges\r
78 \r
79 //*****************************************************************************\r
80 //\r
81 // Values that can be passed to most of the timer APIs as the ulTimer\r
82 // parameter.\r
83 //\r
84 //*****************************************************************************\r
85 #define TIMER_A                 0x000000ff  // Timer A\r
86 #define TIMER_B                 0x0000ff00  // Timer B\r
87 #define TIMER_BOTH              0x0000ffff  // Timer Both\r
88 \r
89 //*****************************************************************************\r
90 //\r
91 // Prototypes for the APIs.\r
92 //\r
93 //*****************************************************************************\r
94 extern void TimerEnable(unsigned long ulBase, unsigned long ulTimer);\r
95 extern void TimerDisable(unsigned long ulBase, unsigned long ulTimer);\r
96 extern void TimerConfigure(unsigned long ulBase, unsigned long ulConfig);\r
97 extern void TimerControlLevel(unsigned long ulBase, unsigned long ulTimer,\r
98                               tBoolean bInvert);\r
99 extern void TimerControlTrigger(unsigned long ulBase, unsigned long ulTimer,\r
100                                 tBoolean bEnable);\r
101 extern void TimerControlEvent(unsigned long ulBase, unsigned long ulTimer,\r
102                               unsigned long ulEvent);\r
103 extern void TimerControlStall(unsigned long ulBase, unsigned long ulTimer,\r
104                               tBoolean bStall);\r
105 extern void TimerRTCEnable(unsigned long ulBase);\r
106 extern void TimerRTCDisable(unsigned long ulBase);\r
107 extern void TimerPrescaleSet(unsigned long ulBase, unsigned long ulTimer,\r
108                              unsigned long ulValue);\r
109 extern unsigned long TimerPrescaleGet(unsigned long ulBase,\r
110                                       unsigned long ulTimer);\r
111 extern void TimerPrescaleMatchSet(unsigned long ulBase, unsigned long ulTimer,\r
112                                   unsigned long ulValue);\r
113 extern unsigned long TimerPrescaleMatchGet(unsigned long ulBase,\r
114                                            unsigned long ulTimer);\r
115 extern void TimerLoadSet(unsigned long ulBase, unsigned long ulTimer,\r
116                          unsigned long ulValue);\r
117 extern unsigned long TimerLoadGet(unsigned long ulBase, unsigned long ulTimer);\r
118 extern unsigned long TimerValueGet(unsigned long ulBase,\r
119                                    unsigned long ulTimer);\r
120 extern void TimerMatchSet(unsigned long ulBase, unsigned long ulTimer,\r
121                           unsigned long ulValue);\r
122 extern unsigned long TimerMatchGet(unsigned long ulBase,\r
123                                    unsigned long ulTimer);\r
124 extern void TimerIntRegister(unsigned long ulBase, unsigned long ulTimer,\r
125                              void (*pfnHandler)(void));\r
126 extern void TimerIntUnregister(unsigned long ulBase, unsigned long ulTimer);\r
127 extern void TimerIntEnable(unsigned long ulBase, unsigned long ulIntFlags);\r
128 extern void TimerIntDisable(unsigned long ulBase, unsigned long ulIntFlags);\r
129 extern unsigned long TimerIntStatus(unsigned long ulBase, tBoolean bMasked);\r
130 extern void TimerIntClear(unsigned long ulBase, unsigned long ulIntFlags);\r
131 extern void TimerQuiesce(unsigned long ulBase);\r
132 \r
133 #ifdef __cplusplus\r
134 }\r
135 #endif\r
136 \r
137 #endif // __TIMER_H__\r