1 //*****************************************************************************
2 //
3 // peci.h - Prototypes for Platform Environment Control Interface (PECI)
4 //          driver.
5 //
6 // Copyright (c) 2010-2011 Texas Instruments Incorporated.  All rights reserved.
7 // Software License Agreement
8 //
9 // Texas Instruments (TI) is supplying this software for use solely and
10 // exclusively on TI's microcontroller products. The software is owned by
11 // TI and/or its suppliers, and is protected under applicable copyright
12 // laws. You may not combine this software with "viral" open-source
13 // software in order to form a larger program.
14 //
15 // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
16 // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
17 // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
19 // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
20 // DAMAGES, FOR ANY REASON WHATSOEVER.
21 //
22 // This is part of revision 8264 of the Stellaris Peripheral Driver Library.
23 //
24 //*****************************************************************************
25 
26 #ifndef __PECI_H__
27 #define __PECI_H__
28 
29 //*****************************************************************************
30 //
31 // If building with a C++ compiler, make all of the definitions in this header
32 // have a C binding.
33 //
34 //*****************************************************************************
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #endif
39 
40 //*****************************************************************************
41 //
42 // Values that can be passed to PECIConfigDomain, PECIEnableDomain,
43 // PECIDisableDomain, PECIReadDomainValue, PECIReadDomainMax, and
44 // PECIClearDomain as the ulDomain parameter.
45 //
46 //*****************************************************************************
47 #define PECI_DOMAIN_M0D0        0           // Microprocessor 0 / Domain 0
48 #define PECI_DOMAIN_M0D1        1           // Microprocessor 0 / Domain 1
49 #define PECI_DOMAIN_M1D0        2           // Microprocessor 1 / Domain 0
50 #define PECI_DOMAIN_M1D1        3           // Microprocessor 1 / Domain 1
51 
52 //*****************************************************************************
53 //
54 // Values that can be passed to PECIIntEnable, PECIIntDisable, and PECIIntClear
55 // as the ulIntFlags parameter and returned by PECIIntStatus.
56 //
57 //*****************************************************************************
58 #define PECI_READ               0x00000001  // End of PECI Poll
59 #define PECI_ERR                0x00000002  // Error on PECI Poll
60 #define PECI_AC                 0x00000004  // Advanced Command Complete
61 #define PECI_M0D0               0x00030000  // Microprocessor 0 / Domain 0
62 #define PECI_M0D1               0x000C0000  // Microprocessor 0 / Domain 1
63 #define PECI_M1D0               0x00300000  // Microprocessor 1 / Domain 0
64 #define PECI_M1D1               0x00C00000  // Microprocessor 1 / Domain 1
65 
66 //*****************************************************************************
67 //
68 // Additional values that can be returned by PECIIntStatus.
69 //
70 //*****************************************************************************
71 #define PECI_M0D0_MODE1_HIGH    0x00030000  // Microprocessor 0 / Domain 0
72                                             // Mode 1
73                                             // Temperature IS above HIGH
74 #define PECI_M0D0_MODE2_MID     0x00020000  // Microprocessor 0 / Domain 0
75                                             // Mode 2
76                                             // Temperature CROSSED above LOW
77 #define PECI_M0D0_MODE2_HIGH    0x00030000  // Microprocessor 0 / Domain 0
78                                             // Mode 2
79                                             // Temperature CROSSED above HIGH
80 #define PECI_M0D0_MODE3_LOW     0x00010000  // Microprocessor 0 / Domain 0
81                                             // Mode 3
82                                             // Temperature CROSSED below LOW
83 #define PECI_M0D0_MODE3_MID     0x00020000  // Microprocessor 0 / Domain 0
84                                             // Mode 3
85                                             // Temperature CROSSED above LOW or
86                                             // Temperature CROSSED below HIGH
87 #define PECI_M0D0_MODE3_HIGH    0x00030000  // Microprocessor 0 / Domain 0
88                                             // Mode 3
89                                             // Temperature CROSSED above HIGH
90 #define PECI_M0D1_MODE1_HIGH    0x00030000  // Microprocessor 0 / Domain 1
91                                             // Mode 1
92                                             // Temperature IS above HIGH
93 #define PECI_M0D1_MODE2_MID     0x00020000  // Microprocessor 0 / Domain 1
94                                             // Mode 2
95                                             // Temperature CROSSED above LOW
96 #define PECI_M0D1_MODE2_HIGH    0x00030000  // Microprocessor 0 / Domain 1
97                                             // Mode 2
98                                             // Temperature CROSSED above HIGH
99 #define PECI_M0D1_MODE3_LOW     0x00010000  // Microprocessor 0 / Domain 1
100                                             // Mode 3
101                                             // Temperature CROSSED below LOW
102 #define PECI_M0D1_MODE3_MID     0x00020000  // Microprocessor 0 / Domain 1
103                                             // Mode 3
104                                             // Temperature CROSSED above LOW or
105                                             // Temperature CROSSED below HIGH
106 #define PECI_M0D1_MODE3_HIGH    0x00030000  // Microprocessor 0 / Domain 1
107                                             // Mode 3
108                                             // Temperature CROSSED above HIGH
109 #define PECI_M1D0_MODE1_HIGH    0x00030000  // Microprocessor 1 / Domain 0
110                                             // Mode 1
111                                             // Temperature IS above HIGH
112 #define PECI_M1D0_MODE2_MID     0x00020000  // Microprocessor 1 / Domain 0
113                                             // Mode 2
114                                             // Temperature CROSSED above LOW
115 #define PECI_M1D0_MODE2_HIGH    0x00030000  // Microprocessor 1 / Domain 0
116                                             // Mode 2
117                                             // Temperature CROSSED above HIGH
118 #define PECI_M1D0_MODE3_LOW     0x00010000  // Microprocessor 1 / Domain 0
119                                             // Mode 3
120                                             // Temperature CROSSED below LOW
121 #define PECI_M1D0_MODE3_MID     0x00020000  // Microprocessor 1 / Domain 0
122                                             // Mode 3
123                                             // Temperature CROSSED above LOW or
124                                             // Temperature CROSSED below HIGH
125 #define PECI_M1D0_MODE3_HIGH    0x00030000  // Microprocessor 1 / Domain 0
126                                             // Mode 3
127                                             // Temperature CROSSED above HIGH
128 #define PECI_M1D1_MODE1_HIGH    0x00030000  // Microprocessor 1 / Domain 1
129                                             // Mode 1
130                                             // Temperature IS above HIGH
131 #define PECI_M1D1_MODE2_MID     0x00020000  // Microprocessor 1 / Domain 1
132                                             // Mode 2
133                                             // Temperature CROSSED above LOW
134 #define PECI_M1D1_MODE2_HIGH    0x00030000  // Microprocessor 1 / Domain 1
135                                             // Mode 2
136                                             // Temperature CROSSED above HIGH
137 #define PECI_M1D1_MODE3_LOW     0x00010000  // Microprocessor 1 / Domain 1
138                                             // Mode 3
139                                             // Temperature CROSSED below LOW
140 #define PECI_M1D1_MODE3_MID     0x00020000  // Microprocessor 1 / Domain 1
141                                             // Mode 3
142                                             // Temperature CROSSED above LOW or
143                                             // Temperature CROSSED below HIGH
144 #define PECI_M1D1_MODE3_HIGH    0x00030000  // Microprocessor 1 / Domain 1
145                                             // Mode 3
146                                             // Temperature CROSSED above HIGH
147 
148 //*****************************************************************************
149 //
150 // Values that can be passed to PECIIntEnable as the ulIntMode parameter.
151 //
152 //*****************************************************************************
153 #define PECI_M0D0_MODE1         0x00010000  // Domain Interrupt Mode 1
154 #define PECI_M0D0_MODE2         0x00020000  // Domain Interrupt Mode 2
155 #define PECI_M0D0_MODE3         0x00030000  // Domain Interrupt Mode 3
156 #define PECI_M0D1_MODE1         0x00040000  // Domain Interrupt Mode 1
157 #define PECI_M0D1_MODE2         0x00080000  // Domain Interrupt Mode 2
158 #define PECI_M0D1_MODE3         0x000C0000  // Domain Interrupt Mode 3
159 #define PECI_M1D0_MODE1         0x00100000  // Domain Interrupt Mode 1
160 #define PECI_M1D0_MODE2         0x00200000  // Domain Interrupt Mode 2
161 #define PECI_M1D0_MODE3         0x00300000  // Domain Interrupt Mode 3
162 #define PECI_M1D1_MODE1         0x00400000  // Domain Interrupt Mode 1
163 #define PECI_M1D1_MODE2         0x00800000  // Domain Interrupt Mode 2
164 #define PECI_M1D1_MODE3         0x00C00000  // Domain Interrupt Mode 3
165 
166 //*****************************************************************************
167 //
168 // Prototypes for the APIs.
169 //
170 //*****************************************************************************
171 extern void PECIConfigSet(unsigned long ulBase, unsigned long ulPECIClk,
172                           unsigned long ulBaud, unsigned long ulPoll,
173                           unsigned long ulOffset, unsigned long ulRetry);
174 extern void PECIConfigGet(unsigned long ulBase, unsigned long ulPECIClk,
175                           unsigned long *pulBaud, unsigned long *pulPoll,
176                           unsigned long *pulOffset, unsigned long *pulRetry);
177 extern void PECIBypassEnable(unsigned long ulBase);
178 extern void PECIBypassDisable(unsigned long ulBase);
179 extern void PECIDomainConfigSet(unsigned long ulBase, unsigned long ulDomain,
180                                 unsigned long ulHigh, unsigned long ulLow);
181 extern void PECIDomainConfigGet(unsigned long ulBase, unsigned long ulDomain,
182                                 unsigned long *pulHigh, unsigned long *pulLow);
183 extern void PECIDomainEnable(unsigned long ulBase, unsigned long ulDomain);
184 extern void PECIDomainDisable(unsigned long ulBase, unsigned long ulDomain);
185 extern unsigned long PECIDomainValueGet(unsigned long ulBase,
186                                         unsigned long ulDomain);
187 extern unsigned long PECIDomainMaxReadGet(unsigned long ulBase,
188                                           unsigned long ulDomain);
189 extern void PECIDomainValueClear(unsigned long ulBase, unsigned long ulDomain);
190 extern void PECIDomainMaxReadClear(unsigned long ulBase,
191                                    unsigned long ulDomain);
192 extern void PECIIntRegister(unsigned long ulBase, void (*pfnHandler)(void));
193 extern void PECIIntUnregister(unsigned long ulBase);
194 extern void PECIIntEnable(unsigned long ulBase, unsigned long ulIntFlags,
195                           unsigned long ulIntMode);
196 extern void PECIIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
197 extern unsigned long PECIIntStatus(unsigned long ulBase, tBoolean bMasked);
198 extern void PECIIntClear(unsigned long ulBase, unsigned long ulIntFlags);
199 extern void PECIAdvCmdSend(unsigned long ulBase, unsigned char ucCmd,
200                            unsigned char ucHidRe, unsigned char ucDomain,
201                            unsigned char ucProcAdd, unsigned long ulArg,
202                            unsigned char ucSize, unsigned long ulData0,
203                            unsigned long ulData1);
204 extern unsigned long PECIAdvCmdSendNonBlocking(unsigned long ulBase,
205                                                unsigned char ucCmd,
206                                                unsigned char ucHidRe,
207                                                unsigned char ucDomain,
208                                                unsigned char ucProcAdd,
209                                                unsigned long ulArg,
210                                                unsigned char ucSize,
211                                                unsigned long ulData0,
212                                                unsigned long ulData1);
213 extern unsigned long PECIAdvCmdStatusGet(unsigned long ulBase,
214                                          unsigned long *pulData0,
215                                          unsigned long *pulData1);
216 
217 //*****************************************************************************
218 //
219 // Mark the end of the C bindings section for C++ compilers.
220 //
221 //*****************************************************************************
222 #ifdef __cplusplus
223 }
224 #endif
225 
226 #endif // __PECI_H__
227