| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LT_PMBusDevice.h
Go to the documentation of this file.
1 /*!
2 LTC PSM Device
3
4 @verbatim
5
6 Representation of a device and its capabilities.
7
8 @endverbatim
9
10
11 Copyright 2018(c) Analog Devices, Inc.
12
13 All rights reserved.
14
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions are met:
17 - Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
19 - Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in
21 the documentation and/or other materials provided with the
22 distribution.
23 - Neither the name of Analog Devices, Inc. nor the names of its
24 contributors may be used to endorse or promote products derived
25 from this software without specific prior written permission.
26 - The use of this software may or may not infringe the patent rights
27 of one or more patent holders. This license does not release you
28 from the requirement that you obtain separate licenses from these
29 patent holders to use this software.
30 - Use of the software either in source or binary form, must be run
31 on or directly connected to an Analog Devices Inc. component.
32
33 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
34 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
35 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
36 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
37 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
38 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
39 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
40 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
41 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
42 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 */
44
45 //! @ingroup PMBus_SMBus
46 //! @{
47 //! @defgroup LT_PMBusDevice LT_PMBusDevice: Implementation of Device Detection and Capability
48 //! @}
49
50 /*! @file
51 @ingroup LT_PMBusDevice
52 Library Header File for LT_PMBusDevice
53 */
54
55 #ifndef LT_PMBusDevice_H_
56 #define LT_PMBusDevice_H_
57
58 #define HAS_VOUT 1 << 0
59 #define HAS_VIN 1 << 1
60 #define HAS_IOUT 1 << 2
61 #define HAS_IIN 1 << 3
62 #define HAS_POUT 1 << 4
63 #define HAS_PIN 1 << 5
64 #define HAS_TEMP 1 << 6
65 #define HAS_DC 1 << 7
66 #define HAS_STATUS_WORD 1 << 14
67 #define HAS_STATUS_EXT 1 << 15
68
69
70 #include <stdint.h>
71 #include "LT_PMBus.h"
72 #include "LT_PMBusRail.h"
73 #include "LT_PMBusSpeedTest.h"
74
75 class LT_PMBusDevice
76 {
77 protected:
78 LT_PMBus *pmbus_;
79 uint8_t address_;
80 uint32_t maxSpeed_;
81 uint8_t model_[9];
82
83 LT_PMBusDevice(LT_PMBus *pmbus, uint8_t address):pmbus_(pmbus), address_(address)
84 {
85 }
86
87 protected:
88
89 void probeSpeed();
90
91
92 public:
93 virtual ~LT_PMBusDevice() {}
94
95 LT_PMBus *pmbus();
96
97 LT_SMBus *smbus();
98
99 //! Change the pmbus
100 void changePMBus(LT_PMBus *pmbus);
101
102 //! Get the address
103 //! @return address
104 uint8_t getAddress ();
105
106 virtual char *getType(void);
107
108 virtual uint8_t getNumPages(void) = 0;
109
110 void setPage(uint8_t page);
111
112 //! Get the maximum speed the device can communicate with
113 //! @return speed
114 uint32_t getMaxSpeed(void);
115
116 //! Set the speed. If > 100000, enable clock stretching
117 virtual void setSpeed(uint32_t speed); //!< Speed
118
119 //! Get the supported capabilities
120 //! @return or'd list of capabilities
121 virtual uint32_t getCapabilities () = 0;
122
123 //! Is/are these capability(s) supported?
124 //! @return true if yes
125 virtual bool hasCapability(
126 uint32_t capability //!< List of capabilities
127 ) = 0;
128
129
130 //! Return a list of rails if any page is part of a rail.
131 //! @return A rail, but partially built, and may need merging with other devices. Caller must free memory.
132 virtual LT_PMBusRail **getRails() = 0;
133
134 //! Enable the Fault Log
135 virtual void enableFaultLog() {}
136
137 //! Disable the Fault Log
138 virtual void disableFaultLog() {}
139
140 //! Is there a fault log?
141 //! @return true/false
142 virtual bool hasFaultLog();
143
144 //! Get the fault log text (call must free)
145 //! @return text
146 virtual char *getFaultLog();
147
148 //! Clear the Fault Log
149 virtual void clearFaultLog() { }
150
151 /*
152 * Set the output voltage of a polyphase rail
153 *
154 * voltage: the target voltage
155 */
156 void setVout(float voltage);
157
158 /*
159 * Read the input voltage of a polyphase rail
160 *
161 * polling: poll if true
162 * return: the input voltage
163 */
164 float readVin(bool polling);
165
166 /*
167 * Read the output voltage of a polyphase rail
168 *
169 * polling: poll if true
170 * return: the output voltage
171 */
172 float readVout(bool polling);
173
174 /*
175 * Read the input current of a polyphase rail
176 *
177 * polling: poll if true
178 * return: the input current
179 */
180 float readIin(bool polling);
181
182 /*
183 * Read the output current of a polyphase rail
184 *
185 * polling: poll if true
186 * return: the output current
187 */
188 float readIout(bool polling);
189
190 /*
191 * Read the input power of a polyphase rail
192 *
193 * polling: poll if true
194 * return: the output current
195 */
196 float readPin(bool polling);
197
198 /*
199 * Read the output power of a polyphase rail
200 *
201 * polling: poll if true
202 * return: the output power
203 */
204 float readPout(bool polling);
205
206 /*
207 * Read the external temperature of a polyphase rail
208 *
209 * polling: poll if true
210 * return: the temperature
211 */
212 float readExternalTemperature(bool polling);
213
214 /*
215 * Read the internal temperature of a polyphase rail
216 *
217 * polling: poll if true
218 * return: the temperature
219 */
220 float readInternalTemperature(bool polling);
221
222 /*
223 * Read the average duty cycle of a polyphase rail
224 *
225 * polling: poll if true
226 * return: the duty cycle
227 */
228 float readDutyCycle(bool polling);
229
230 /*
231 * Read the status word of a polyphase rail
232 *
233 * return: status word
234 */
235 uint16_t readStatusWord();
236
237 /*
238 * Read the special id of a polyphase rail
239 *
240 * return: special id
241 */
242 uint16_t readMfrSpecialId();
243
244 /*
245 * Clear faults of polyphase rail
246 */
247 void clearFaults();
248
249 /*
250 * Margin high polyphase rail
251 */
252 void marginHigh();
253
254 /*
255 * Margin low polyphase rail
256 *
257 */
258 void marginLow();
259
260 /*
261 * Margin off polyphase rail
262 *
263 */
264 void marginOff();
265 };
266
267 #endif /* LT_PMBusDevice_H_ */
LT_PMBusDevice::getRails
virtual LT_PMBusRail ** getRails()=0
Return a list of rails if any page is part of a rail.
Definition: LT_PMBusDevice.cpp:129
LT_PMBusDevice::getMaxSpeed
uint32_t getMaxSpeed(void)
Get the maximum speed the device can communicate with.
Definition: LT_PMBusDevice.cpp:104
LT_PMBusDevice::readPout
float readPout(bool polling)
Definition: LT_PMBusDevice.cpp:194
LT_PMBusDevice::maxSpeed_
uint32_t maxSpeed_
Definition: LT_PMBusDevice.h:80
LT_PMBusDevice::address_
uint8_t address_
Definition: LT_PMBusDevice.h:79
LT_PMBusDevice::getAddress
uint8_t getAddress()
Get the address.
Definition: LT_PMBusDevice.cpp:87
LT_PMBusDevice::setSpeed
virtual void setSpeed(uint32_t speed)
Set the speed. If > 100000, enable clock stretching.
Definition: LT_PMBusDevice.cpp:109
LT_PMBusDevice
Definition: LT_PMBusDevice.h:75
LT_PMBusDevice::readVout
float readVout(bool polling)
Definition: LT_PMBusDevice.cpp:157
LT_PMBusDevice::readStatusWord
uint16_t readStatusWord()
Definition: LT_PMBusDevice.cpp:234
LT_PMBusDevice::getFaultLog
virtual char * getFaultLog()
Get the fault log text (call must free)
Definition: LT_PMBusDevice.cpp:139
LT_PMBusDevice::enableFaultLog
virtual void enableFaultLog()
Enable the Fault Log.
Definition: LT_PMBusDevice.h:135
LT_PMBusDevice::pmbus_
LT_PMBus * pmbus_
Definition: LT_PMBusDevice.h:78
LT_PMBusDevice::readIout
float readIout(bool polling)
Definition: LT_PMBusDevice.cpp:174
LT_PMBusRail.h
LTC PMBus Support.
LT_PMBusDevice::changePMBus
void changePMBus(LT_PMBus *pmbus)
Change the pmbus.
Definition: LT_PMBusDevice.cpp:80
LT_PMBusDevice::getType
virtual char * getType(void)
Definition: LT_PMBusDevice.cpp:93
address
static uint8_t address
Definition: DC2091A.ino:83
LT_PMBusDevice::~LT_PMBusDevice
virtual ~LT_PMBusDevice()
Definition: LT_PMBusDevice.h:93
LT_SMBus
Definition: LT_SMBus.h:61
LT_PMBusDevice::readExternalTemperature
float readExternalTemperature(bool polling)
Definition: LT_PMBusDevice.cpp:204
LT_PMBusDevice::disableFaultLog
virtual void disableFaultLog()
Disable the Fault Log.
Definition: LT_PMBusDevice.h:138
LT_PMBusDevice::pmbus
LT_PMBus * pmbus()
Definition: LT_PMBusDevice.cpp:70
LT_PMBusDevice::readMfrSpecialId
uint16_t readMfrSpecialId()
Definition: LT_PMBusDevice.cpp:244
LT_PMBusDevice::LT_PMBusDevice
LT_PMBusDevice(LT_PMBus *pmbus, uint8_t address)
Definition: LT_PMBusDevice.h:83
LT_PMBusDevice::getCapabilities
virtual uint32_t getCapabilities()=0
Get the supported capabilities.
LT_PMBusDevice::readIin
float readIin(bool polling)
Definition: LT_PMBusDevice.cpp:164
LT_PMBusDevice::readInternalTemperature
float readInternalTemperature(bool polling)
Definition: LT_PMBusDevice.cpp:214
LT_PMBusDevice::clearFaults
void clearFaults()
Definition: LT_PMBusDevice.cpp:253
LT_PMBusDevice::setVout
void setVout(float voltage)
Definition: LT_PMBusDevice.cpp:144
LT_PMBusDevice::readVin
float readVin(bool polling)
Definition: LT_PMBusDevice.cpp:150
LT_PMBusDevice::getNumPages
virtual uint8_t getNumPages(void)=0
LT_PMBusDevice::marginHigh
void marginHigh()
Definition: LT_PMBusDevice.cpp:258
LT_PMBusDevice::hasCapability
virtual bool hasCapability(uint32_t capability)=0
Is/are these capability(s) supported?
LT_PMBusDevice::readDutyCycle
float readDutyCycle(bool polling)
Definition: LT_PMBusDevice.cpp:224
LT_PMBusDevice::probeSpeed
void probeSpeed()
Definition: LT_PMBusDevice.cpp:57
LT_PMBus.h
LTC PMBus Support.
LT_PMBusDevice::model_
uint8_t model_[9]
Definition: LT_PMBusDevice.h:81
LT_PMBusSpeedTest.h
LTC PSM SpeedTest.
LT_PMBusDevice::hasFaultLog
virtual bool hasFaultLog()
Is there a fault log?
Definition: LT_PMBusDevice.cpp:134
voltage
static float voltage
Definition: DC2289AA.ino:71
LT_PMBusDevice::readPin
float readPin(bool polling)
Definition: LT_PMBusDevice.cpp:184
LT_PMBusDevice::setPage
void setPage(uint8_t page)
Definition: LT_PMBusDevice.cpp:99
LT_PMBusDevice::marginLow
void marginLow()
Definition: LT_PMBusDevice.cpp:263
LT_PMBusDevice::smbus
LT_SMBus * smbus()
Definition: LT_PMBusDevice.cpp:74
LT_PMBusDevice::marginOff
void marginOff()
Definition: LT_PMBusDevice.cpp:268
LT_PMBusRail
PMBusRail communication. For Multiphase Rails.
Definition: LT_PMBusRail.h:72
LT_PMBusDevice::clearFaultLog
virtual void clearFaultLog()
Clear the Fault Log.
Definition: LT_PMBusDevice.h:149
LT_PMBus
PMBus communication.
Definition: LT_PMBus.h:370