|
Packit |
534379 |
// Copyright(c) 2018, Intel Corporation
|
|
Packit |
534379 |
//
|
|
Packit |
534379 |
// Redistribution and use in source and binary forms, with or without
|
|
Packit |
534379 |
// modification, are permitted provided that the following conditions are met:
|
|
Packit |
534379 |
//
|
|
Packit |
534379 |
// * Redistributions of source code must retain the above copyright notice,
|
|
Packit |
534379 |
// this list of conditions and the following disclaimer.
|
|
Packit |
534379 |
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
Packit |
534379 |
// this list of conditions and the following disclaimer in the documentation
|
|
Packit |
534379 |
// and/or other materials provided with the distribution.
|
|
Packit |
534379 |
// * Neither the name of Intel Corporation nor the names of its contributors
|
|
Packit |
534379 |
// may be used to endorse or promote products derived from this software
|
|
Packit |
534379 |
// without specific prior written permission.
|
|
Packit |
534379 |
//
|
|
Packit |
534379 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit |
534379 |
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
534379 |
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
Packit |
534379 |
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
Packit |
534379 |
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
Packit |
534379 |
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
Packit |
534379 |
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
Packit |
534379 |
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
Packit |
534379 |
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
Packit |
534379 |
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
Packit |
534379 |
// POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
534379 |
/*
|
|
Packit |
534379 |
* @file fmeinfo.h
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @brief
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
#ifndef BMC_H
|
|
Packit |
534379 |
#define BMC_H
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#include <opae/fpga.h>
|
|
Packit |
534379 |
#include "bmc_types.h"
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#ifdef __cplusplus
|
|
Packit |
534379 |
extern "C" {
|
|
Packit |
534379 |
#endif
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Load Sensor Data Records from the BMC on the FPGA.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* Query the BMC for descriptions of all sensors it supports.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @note This call creates a new SDR object and allocates memory for it. It
|
|
Packit |
534379 |
* is the responsibility of the using application to free this memory after use
|
|
Packit |
534379 |
* by calling bmcDestroySDRs() for the SDR object.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @note Calling this function with a NULL 'records' parameter will return
|
|
Packit |
534379 |
* the total number of sensors available in 'num_sensors'.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] token fpga_token object for device (FPGA_DEVICE type)
|
|
Packit |
534379 |
* @param[out] records bmc_sdr_handle pointer. Can be NULL
|
|
Packit |
534379 |
* @param[inout] num_sensors The number of sensors available from the BMC
|
|
Packit |
534379 |
* @returns FPGA_OK on success
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result bmcLoadSDRs(fpga_token token, bmc_sdr_handle *records,
|
|
Packit |
534379 |
uint32_t *num_sensors);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Free Sensor Data Records memory allocated by bmcLoadSDRs.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @note The 'records' value will be set to NULL on success.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] records bmc_sdr_handle pointer
|
|
Packit |
534379 |
* @returns FPGA_OK on success
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result bmcDestroySDRs(bmc_sdr_handle *records);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Load raw sensor readings from the BMC on the FPGA.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* Read all the raw sensor values from the BMC.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @note This call creates a new Values object and allocates memory for it. It
|
|
Packit |
534379 |
* is the responsibility of the using application to free this memory after use
|
|
Packit |
534379 |
* by calling bmcDestroySensorValues() for the Values object.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @note This call obtains a snapshot of all the sensor readings, providing
|
|
Packit |
534379 |
* readings consistent with the time the function was called.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @note Calling this function with a NULL 'values' parameter will return
|
|
Packit |
534379 |
* the total number of sensor readings available in 'num_values'.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] records bmc_sdr_handle pointer
|
|
Packit |
534379 |
* @param[in] values bmc_values_handle pointer (can be NULL)
|
|
Packit |
534379 |
* @param[inout] num_values The number of sensor readings available from the
|
|
Packit |
534379 |
* BMC
|
|
Packit |
534379 |
* @returns FPGA_OK on success
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result bmcReadSensorValues(bmc_sdr_handle records,
|
|
Packit |
534379 |
bmc_values_handle *values,
|
|
Packit |
534379 |
uint32_t *num_values);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Free Sensor Values memory allocated by bmcReadSensorValues.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @note The 'values' value will be set to NULL on success.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] values bmc_values_handle pointer
|
|
Packit |
534379 |
* @returns FPGA_OK on success
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result bmcDestroySensorValues(bmc_values_handle *values);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Return a properly scaled value for a sensor. The value will be appropriate
|
|
Packit |
534379 |
* for comparison or printing in the units specified for the sensor.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @note The raw value of the sensor (for linear sensors) is calculated using
|
|
Packit |
534379 |
* the "Mx + B * 10^exp" formula and is scaled by the specified result exponent.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @note The accuracy and tolerance values are sensor-dependent and may not
|
|
Packit |
534379 |
* be supplied. If they are not supplied, the default value is zero for both.
|
|
Packit |
534379 |
* Tolerance is in number of 1/2 raw sensor reading increments. The accuracy
|
|
Packit |
534379 |
* is given in units of 1/100%, scaled up by the accuracy exponent (i.e.,
|
|
Packit |
534379 |
* *10^exp).
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] values bmc_values_handle
|
|
Packit |
534379 |
* @param[in] sensor_number The sensor of interest
|
|
Packit |
534379 |
* @param[out] is_valid This sensor's reading is unavailable if 0
|
|
Packit |
534379 |
* @param[out] value The scaled value of this sensor's reading
|
|
Packit |
534379 |
* @returns FPGA_OK on success
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result bmcGetSensorReading(bmc_values_handle values,
|
|
Packit |
534379 |
uint32_t sensor_number, uint32_t *is_valid,
|
|
Packit |
534379 |
double *value);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Return a list of sensors whose thresholds are reported as exceeded by the
|
|
Packit |
534379 |
* BMC.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @note This call allocates an array of tripped_thresholds structures of
|
|
Packit |
534379 |
* .size 'num_tripped'. It is the responsibility of the using application to
|
|
Packit |
534379 |
* free this memory after use by calling bmcDestroyTripped() for the 'tripped'
|
|
Packit |
534379 |
* object.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] values bmc_values_handle
|
|
Packit |
534379 |
* @param[in] tripped Address where a pointer to an array of
|
|
Packit |
534379 |
* tripped_thresholds structs is stored
|
|
Packit |
534379 |
* (may be NULL)
|
|
Packit |
534379 |
* @param[out] num_tripped The number of sensors tripped
|
|
Packit |
534379 |
* @returns FPGA_OK on success
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result bmcThresholdsTripped(bmc_values_handle values,
|
|
Packit |
534379 |
tripped_thresholds **tripped,
|
|
Packit |
534379 |
uint32_t *num_tripped);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Free Sensor Values memory allocated by bmcThresholdsTripped.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @note The 'tripped' value will be set to NULL on success.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] tripped bmc_values_handle pointer
|
|
Packit |
534379 |
* @returns FPGA_OK on success
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result bmcDestroyTripped(tripped_thresholds *tripped);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Return detailed information regarding a sensor.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] values bmc_values_handle
|
|
Packit |
534379 |
* @param[in] sensor_number The sensor of interest
|
|
Packit |
534379 |
* @param[out] details A pointer to a sdr_details structure
|
|
Packit |
534379 |
* @returns FPGA_OK on success
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result bmcGetSDRDetails(bmc_values_handle values, uint32_t sensor_number,
|
|
Packit |
534379 |
sdr_details *details);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Return BMC reported microcontroller version.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] token fpga_token object for device (FPGA_DEVICE type)
|
|
Packit |
534379 |
* @param[out] version BMC microcontroller version
|
|
Packit |
534379 |
* @returns FPGA_OK on success
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result bmcGetFirmwareVersion(fpga_token token, uint32_t *version);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Return BMC reported last powerdown cause.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] token fpga_token object for device (FPGA_DEVICE type)
|
|
Packit |
534379 |
* @param[out] cause String describing last powerdown cause
|
|
Packit |
534379 |
* @returns FPGA_OK on success
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result bmcGetLastPowerdownCause(fpga_token token, char **cause);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Return BMC reported last reset cause.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] token fpga_token object for device (FPGA_DEVICE type)
|
|
Packit |
534379 |
* @param[out] cause String describing last reset cause
|
|
Packit |
534379 |
* @returns FPGA_OK on success
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result bmcGetLastResetCause(fpga_token token, char **cause);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Set BMC threshold values for a sensor.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] sdr_h bmc_sdr_handle
|
|
Packit |
534379 |
* @param[in] sensor The sensor of interest
|
|
Packit |
534379 |
* @param[in] thresh A pointer to a list of thresholds to set
|
|
Packit |
534379 |
* @returns FPGA_OK on success
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result bmcSetHWThresholds(bmc_sdr_handle sdr_h, uint32_t sensor,
|
|
Packit |
534379 |
threshold_list *thresh);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#ifdef __cplusplus
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
#endif
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#endif /* !BMC_H */
|