Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LT_PMBusRail.h
Go to the documentation of this file.
1 /*!
2 LTC PMBus Support
3 
4 @verbatim
5 
6 This PMBus code does not cover the entire PMBus command set. The intention
7 is to cover the common commands. It was written for LTC PMBus devices,
8 and may not perform properly with other PMBus devices.
9 
10 @endverbatim
11 
12 
13 Copyright 2018(c) Analog Devices, Inc.
14 
15 All rights reserved.
16 
17 Redistribution and use in source and binary forms, with or without
18 modification, are permitted provided that the following conditions are met:
19  - Redistributions of source code must retain the above copyright
20  notice, this list of conditions and the following disclaimer.
21  - Redistributions in binary form must reproduce the above copyright
22  notice, this list of conditions and the following disclaimer in
23  the documentation and/or other materials provided with the
24  distribution.
25  - Neither the name of Analog Devices, Inc. nor the names of its
26  contributors may be used to endorse or promote products derived
27  from this software without specific prior written permission.
28  - The use of this software may or may not infringe the patent rights
29  of one or more patent holders. This license does not release you
30  from the requirement that you obtain separate licenses from these
31  patent holders to use this software.
32  - Use of the software either in source or binary form, must be run
33  on or directly connected to an Analog Devices Inc. component.
34 
35 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
36 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
37 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
38 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
39 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
40 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
41 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
42 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
43 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
44 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 */
46 
47 /*! @file
48  @ingroup LT_PMBusRail
49  Library Header File for LT_PMBusRail
50 */
51 
52 #ifndef PMBUSRAIL_H_
53 #define PMBUSRAIL_H_
54 
55 #include <stdbool.h>
56 #include <stdint.h>
57 #include <string.h>
58 #include <math.h>
59 #include "LT_PMBus.h"
60 
61 typedef struct
62 {
63  uint8_t address; // or char strVal[20];
64  uint8_t *pages;
65  uint8_t noOfPages;
66  bool controller;
67  bool multiphase;
68  uint32_t capabilities;
69 } tRailDef;
70 
71 //! PMBusRail communication. For Multiphase Rails.
73 {
74  private:
75 
76  LT_PMBus *pmbus_;
77  uint8_t railAddress_;
78  uint8_t model_[9];
79 
80  protected:
82 
83  public:
84 
85  //! Construct a LT_PMBus.
86  LT_PMBusRail(LT_PMBus *pmbus, //!< SMBus for communication. Use the PEC or non-PEC version.
87  uint8_t railAddress, //!< The rail address.
88  tRailDef **railDef); //!< A list of addresses with pages that make up the rail. NULL terminated.
89 
90  ~LT_PMBusRail();
91 
92  //! Change the pmbus
93  void changePMBus(LT_PMBus *pmbus);
94 
95  //! Get ther rail address
96  uint8_t getAddress();
97 
98  //! Ask if devices is a PSM controller
99  bool isController ();
100 
101  //! Get the number of pages in the rail
102  uint8_t getNoPages();
103 
104  //! Ask if the rail is multiphase
105  bool isMultiphase();
106 
107  //! Get a list of capabilities
108  uint32_t getCapabilities();
109 
110  //! Ask if the rail has the given capability
111  uint32_t hasCapability(uint32_t capability);
112 
113  //! Merge a rail into this one. No delete of incomming rail.
114  void merge(LT_PMBusRail *rail //!< Rail to merge
115  );
116 
117  //! Set the output voltage of a polyphase rail
118  //! @return void
119  void setVout(float voltage //!< Rail voltage
120  );
121 
122  //! Read the input voltage of a polyphase rail
123  //! @return voltage
124  float readVin(bool polling //!< true for polling
125  );
126 
127  //! Read the output voltage of a polyphase rail
128  //! @return voltage
129  float readVout(bool polling //!< true for polling
130  );
131 
132  //! Read the input current of a polyphase rail
133  //! @return current
134  float readIin(bool polling //!< true for polling
135  );
136 
137  //! Read the output current of a polyphase rail
138  //! @return current
139  float readIout(bool polling //!< true for polling
140  );
141 
142  //! Read the input power of a polyphase rail
143  //! @return current
144  float readPin(bool polling //!< true for polling
145  );
146 
147  //! Read the output power of a polyphase rail
148  //! @return current
149  float readPout(bool polling //!< true for polling
150  );
151 
152  //! Read the external temperature of a polyphase rail
153  //! @return current
154  float readExternalTemperature(bool polling //!< true for polling
155  );
156 
157  //! Read the internal temperature of a polyphase rail
158  //! @return current
159  float readInternalTemperature(bool polling //!< true for polling
160  );
161 
162  //! Read the efficiency (calculated)
163  //! @return efficiency or zero if not supported
164  float readEfficiency(bool polling //!< true for polling
165  );
166 
167  //! Read the average duty cycle
168  //! @return duty cycle or zero if not supported
169  float readDutyCycle(bool polling //!< true for polling
170  );
171 
172  //! Read the phase balance (calculated)
173  //! @return phase balance as 100 * (max-min)/total current
174  float readPhaseBalance(bool polling //!< true for polling
175  );
176 
177  //! Read the transient
178  //! @return a value in ms.
179  float readTransient(bool polling //!< true for polling
180  );
181 
182  //! Read the status word of a polyphase rail
183  //! @return word
184  uint16_t readStatusWord();
185 
186  //! Read the special of a polyphase rail
187  //! @return word
188  uint16_t readMfrSpecialId();
189 
190  //! Clear faults of polyphase rail
191  //! @return void
192  void clearFaults();
193 
194  //! Sequence on a polyphase rail
195  //! @return void
196  void sequenceOn();
197 
198  //! Turn off a polyphase rail
199  //! @return void
200  void immediateOff();
201 
202  //! Sequence off a polyphase rail
203  //! @return void
204  void sequenceOff();
205 
206  //! Margin high polyphase rail
207  //! @return void
208  void marginHigh();
209 
210  //! Margin low polyphase rail
211  //! @return void
212  void marginLow();
213 
214  //! Margin off polyphase rail
215  //! @return void
216  void marginOff();
217 
218 };
219 
220 #endif /* PMBUS_H_ */
221 
float readExternalTemperature(bool polling)
Read the external temperature of a polyphase rail.
float readTransient(bool polling)
Read the transient.
uint8_t noOfPages
Definition: LT_PMBusRail.h:65
uint16_t readMfrSpecialId()
Read the special of a polyphase rail.
float readEfficiency(bool polling)
Read the efficiency (calculated)
void sequenceOn()
Sequence on a polyphase rail.
uint8_t getAddress()
Get ther rail address.
void changePMBus(LT_PMBus *pmbus)
Change the pmbus.
bool controller
Definition: LT_PMBusRail.h:66
float readIin(bool polling)
Read the input current of a polyphase rail.
uint32_t hasCapability(uint32_t capability)
Ask if the rail has the given capability.
float readPhaseBalance(bool polling)
Read the phase balance (calculated)
void merge(LT_PMBusRail *rail)
Merge a rail into this one. No delete of incomming rail.
static LT_PMBus * pmbus
Definition: DC2875A.ino:82
uint32_t capabilities
Definition: LT_PMBusRail.h:68
bool multiphase
Definition: LT_PMBusRail.h:67
float readInternalTemperature(bool polling)
Read the internal temperature of a polyphase rail.
static LT_PMBusRail * rail
Definition: DC1989A.ino:92
tRailDef ** railDef_
Definition: LT_PMBusRail.h:81
void marginHigh()
Margin high polyphase rail.
bool isController()
Ask if devices is a PSM controller.
void clearFaults()
Clear faults of polyphase rail.
uint8_t getNoPages()
Get the number of pages in the rail.
uint32_t getCapabilities()
Get a list of capabilities.
void sequenceOff()
Sequence off a polyphase rail.
uint16_t readStatusWord()
Read the status word of a polyphase rail.
bool isMultiphase()
Ask if the rail is multiphase.
void marginOff()
Margin off polyphase rail.
float readDutyCycle(bool polling)
Read the average duty cycle.
float readPin(bool polling)
Read the input power of a polyphase rail.
float readVin(bool polling)
Read the input voltage of a polyphase rail.
void immediateOff()
Turn off a polyphase rail.
uint8_t address
Definition: LT_PMBusRail.h:63
void setVout(float voltage)
Set the output voltage of a polyphase rail.
LTC PMBus Support.
float readPout(bool polling)
Read the output power of a polyphase rail.
uint8_t * pages
Definition: LT_PMBusRail.h:64
static float voltage
Definition: DC2289AA.ino:71
void marginLow()
Margin low polyphase rail.
float readIout(bool polling)
Read the output current of a polyphase rail.
PMBusRail communication. For Multiphase Rails.
Definition: LT_PMBusRail.h:72
float readVout(bool polling)
Read the output voltage of a polyphase rail.
LT_PMBusRail(LT_PMBus *pmbus, uint8_t railAddress, tRailDef **railDef)
Construct a LT_PMBus.
PMBus communication.
Definition: LT_PMBus.h:370