Commit e8fe71d1 authored by Henrique Silva's avatar Henrique Silva

Move SDR list to each respective sensor source

INA220 SDR was put in a different source file (ina220_sdr.c) because
it's too large and would polute the original source (ina220.c)
parent 47935ba9
......@@ -19,7 +19,6 @@ endif()
if (";${TARGET_MODULES};" MATCHES ";SDR;")
set(PROJ_SRCS ${PROJ_SRCS} ${MODULE_PATH}/sdr.c )
set(PROJ_SRCS ${PROJ_SRCS} ${MODULE_PATH}/sdr_list.c )
set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_SDR")
endif()
......
......@@ -631,3 +631,27 @@ void check_sensor_event( sensor_t * sensor )
ipmi_event_send(sensor, ev_type, &ev, 1);
}
}
/* Management Controller Device Locator Record 37.9 SDR Type 12h */
const SDR_type_12h_t SDR0 = {
.hdr.recID_LSB = 0x00,
.hdr.recID_MSB = 0x00,
.hdr.SDRversion = 0x51, /* IPMI protocol version */
.hdr.rectype = TYPE_12, /* record type: device locator record */
.hdr.reclength = sizeof(SDR_type_12h_t) - sizeof(SDR_entry_hdr_t),
/* record key bytes */
.slaveaddr = 0x00,
.chnum = 0x00,
.power_notification_global_init = 0x04,
.device_cap = 0x3b,
.reserved[0] = 0x00,
.reserved[1] = 0x00,
.reserved[2] = 0x00,
.entityID = 0xC1,
.entityinstance = 0x00,
.OEM = 0x00,
.IDtypelen = 0xc0 | STR_SIZE(STR(TARGET_BOARD_NAME)), /* 8 bit ASCII, number of bytes */
.IDstring = STR(TARGET_BOARD_NAME)
};
......@@ -222,6 +222,7 @@ typedef struct {
extern sensor_t sensor_array[NUM_SDR];
#define SDR_ARRAY_LENGTH (sizeof(sensor_array) / sizeof(sensor_array[0]))
const SDR_type_12h_t SDR0;
#define GET_SENSOR_TYPE(sensor) ((SDR_type_01h_t *)sensor->sdr)->sensortype
#define GET_SENSOR_NUMBER(sensor) ((SDR_type_01h_t *)sensor->sdr)->sensornum
......
This diff is collapsed.
......@@ -15,11 +15,14 @@ endif()
if (";${TARGET_MODULES};" MATCHES ";VOLTAGE_SENSOR;")
set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/ina220.c)
#INA220 SDR is in a different source because it's too large and would polute the ina220.c
set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/ina220_sdr.c)
set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_VOLTAGE_SENSOR")
endif()
if (";${TARGET_MODULES};" MATCHES ";CURRENT_SENSOR;")
set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/ina220.c)
set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/ina220_sdr.c)
set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_CURRENT_SENSOR")
endif()
......
......@@ -195,3 +195,43 @@ void vTaskHotSwap( void *Parameters )
#endif
}
}
/* AMC Hot-Swap sensor SDR */
const SDR_type_02h_t SDR_HOT_SWAP = {
.hdr.recID_LSB = 0x00, /* Filled by sdr_insert_entry() */
.hdr.recID_MSB = 0x00,
.hdr.SDRversion = 0x51,
.hdr.rectype = TYPE_02,
.hdr.reclength = sizeof(SDR_type_02h_t) - sizeof(SDR_entry_hdr_t),
.ownerID = 0x00, /* i2c address, -> SDR_Init */
.ownerLUN = 0x00, /* sensor owner LUN */
.sensornum = 0x00, /* Filled by sdr_insert_entry() */
/* record body bytes */
.entityID = 0xC1, /* entity id: AMC Module */
.entityinstance = 0x00, /* entity instance -> SDR_Init */
.sensorinit = 0x03, /* init: event generation + scanning enabled */
.sensorcap = 0xc1, /* capabilities: auto re-arm,*/
.sensortype = SENSOR_TYPE_HOT_SWAP, /* sensor type: HOT SWAP*/
.event_reading_type = 0x6f, /* sensor reading*/
.assertion_event_mask = { 0x00, /* LSB assert event mask: 3 bit value */
0x00 }, /* MSB assert event mask */
.deassertion_event_mask = { 0x00, /* LSB deassert event mask: 3 bit value */
0x00 }, /* MSB deassert event mask */
.readable_threshold_mask = 0x00, /* LSB: readable Threshold mask: no thresholds are readable: */
.settable_threshold_mask = 0x00, /* MSB: setable Threshold mask: no thresholds are setable: */
.sensor_units_1 = 0xc0, /* sensor units 1 : Does not return analog reading*/
.sensor_units_2 = 0x00, /* sensor units 2 :*/
.sensor_units_3 = 0x00, /* sensor units 3 :*/
.record_sharing[0] = 0x00,
.record_sharing[1] = 0x00,
.pos_thr_hysteresis = 0x00, /* positive going Threshold hysteresis value */
.neg_thr_hysteresis = 0x00, /* negative going Threshold hysteresis value */
.reserved1 = 0x00, /* reserved */
.reserved2 = 0x00, /* reserved */
.reserved3 = 0x00, /* reserved */
.OEM = 0x00, /* OEM reserved */
.IDtypelen = 0xc0 | STR_SIZE("HOTSWAP HANDLE"), /* 8 bit ASCII, number of bytes */
.IDstring = "HOTSWAP HANDLE" /* sensor string */
};
......@@ -42,5 +42,7 @@
TaskHandle_t vTaskHotSwap_Handle;
extern TickType_t getTickDifference(TickType_t current_time, TickType_t start_time);
extern const SDR_type_02h_t SDR_HOT_SWAP;
void vTaskHotSwap( void *Parameters );
void hotswap_init( void );
......@@ -132,6 +132,20 @@ typedef struct {
TaskHandle_t vTaskINA220_Handle;
/* INA220 SDR List */
extern const SDR_type_01h_t SDR_FMC1_VADJ;
extern const SDR_type_01h_t SDR_FMC1_12V;
extern const SDR_type_01h_t SDR_FMC1_P3V3;
extern const SDR_type_01h_t SDR_FMC1_VADJ_CURR;
extern const SDR_type_01h_t SDR_FMC1_12V_CURR;
extern const SDR_type_01h_t SDR_FMC1_P3V3_CURR;
extern const SDR_type_01h_t SDR_FMC2_VADJ;
extern const SDR_type_01h_t SDR_FMC2_12V;
extern const SDR_type_01h_t SDR_FMC2_P3V3;
extern const SDR_type_01h_t SDR_FMC2_VADJ_CURR;
extern const SDR_type_01h_t SDR_FMC2_12V_CURR;
extern const SDR_type_01h_t SDR_FMC2_P3V3_CURR;
uint8_t ina220_config(uint8_t i2c_id, t_ina220_data * data);
Bool ina220_calibrate( t_ina220_data * data );
uint16_t ina220_readvalue( t_ina220_data * data, uint8_t reg );
......
This diff is collapsed.
This diff is collapsed.
......@@ -35,6 +35,11 @@
extern TaskHandle_t vTaskLM75_Handle;
const SDR_type_01h_t SDR_LM75_uC;
const SDR_type_01h_t SDR_LM75_CLOCK_SWITCH;
const SDR_type_01h_t SDR_LM75_DCDC;
const SDR_type_01h_t SDR_LM75_RAM;
void LM75_init( void );
void vTaskLM75( void* Parameters );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment