diff --git a/modules/sdr.c b/modules/sdr.c index 32e7284a2..14814f381 100644 --- a/modules/sdr.c +++ b/modules/sdr.c @@ -106,6 +106,9 @@ void sensor_init( void ) #ifdef MODULE_MAX6642 MAX6642_init(); #endif +#ifdef MODULE_MAX11609 + MAX11609_init(); +#endif #if defined(MODULE_INA220_CURRENT) || defined(MODULE_INA220_VOLTAGE) ina220_init(); #endif diff --git a/modules/sensors/CMakeLists.txt b/modules/sensors/CMakeLists.txt index 42c8ac670..29309eeea 100644 --- a/modules/sensors/CMakeLists.txt +++ b/modules/sensors/CMakeLists.txt @@ -38,6 +38,11 @@ if (";${TARGET_MODULES};" MATCHES ";INA3221_CURRENT;") set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_INA3221_CURRENT") endif() +if (";${TARGET_MODULES};" MATCHES ";MAX116XX;") + set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/max11609.c) + set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_MAX11609") +endif() + set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH} PARENT_SCOPE) set(PROJ_HDRS ${PROJ_HDRS} ${SENSOR_PATH} PARENT_SCOPE) set(MODULES_FLAGS "${MODULES_FLAGS}" PARENT_SCOPE) diff --git a/modules/sensors/max11609.c b/modules/sensors/max11609.c new file mode 100644 index 000000000..dc06e070b --- /dev/null +++ b/modules/sensors/max11609.c @@ -0,0 +1,65 @@ +/* FreeRTOS Includes */ +#include "FreeRTOS.h" +#include "task.h" +#include "port.h" + +/* Project Includes */ +#include "sdr.h" +#include "task_priorities.h" +#include "i2c.h" +#include "i2c_mapping.h" +#include "max11609.h" +#include "utils.h" +#include "uart_debug.h" +#include "max116xx.h" + +TaskHandle_t vTask11609_Handle; + +void vTaskMAX11609( void* Parameters ) +{ + max116xx_cfg max11609_cfg = { + .ref_sel = MAX116XX_REF_INT_ON_OUT, + .clk_sel = MAX116XX_CLK_INT, + .pol_sel = MAX116XX_UNIPOLAR, + .scan_mode = MAX116XX_SCAN_OFF_SINGLE_CONV, + .diff_mode = MAX116XX_SINGLE_ENDED, + .channel_sel = 0 + }; + const TickType_t update_period = pdMS_TO_TICKS(MAX11609_UPDATE_PERIOD); + + sensor_t * voltage_sensor; + int16_t data_voltage[1]; + mmc_err err; + + for ( ;; ) { + /* Iterate through the SDR Table to find all the MAX11609 entries */ + for ( voltage_sensor = sdr_head; voltage_sensor != NULL; voltage_sensor = voltage_sensor->next) { + if ( voltage_sensor->task_handle == NULL ) { + continue; + } + /* Check if this task should update the selected SDR */ + if ( *(voltage_sensor->task_handle) != xTaskGetCurrentTaskHandle() ) { + continue; + } + + max11609_cfg.channel_sel = ((SDR_type_01h_t*)voltage_sensor->sdr)->OEM; + err = max116xx_set_config(voltage_sensor->chipid, &max11609_cfg); + if(err != MMC_OK) continue; + + err = max116xx_read_uni(voltage_sensor->chipid, data_voltage, 1); + if (err == MMC_OK) + { + voltage_sensor->readout_value = (uint16_t)(data_voltage[0] >> 2); + } + + sensor_state_check(voltage_sensor); + check_sensor_event(voltage_sensor); + } + vTaskDelay(update_period); + } +} + +void MAX11609_init() +{ + xTaskCreate(vTaskMAX11609, "MAX11609", 256, (void *) NULL, tskMAX11609SENSOR_PRIORITY, &vTask11609_Handle); +} diff --git a/modules/sensors/max11609.h b/modules/sensors/max11609.h new file mode 100644 index 000000000..23241d933 --- /dev/null +++ b/modules/sensors/max11609.h @@ -0,0 +1,33 @@ +#ifndef MAX11609_ +#define MAX11609_ + +/** + * @brief Rate at which the MAX11609 sensors are read (in ms) + */ +#define MAX11609_UPDATE_PERIOD 200 + +#define MAX11609_CHANNEL_0 0 +#define MAX11609_CHANNEL_1 1 +#define MAX11609_CHANNEL_2 2 +#define MAX11609_CHANNEL_3 3 +#define MAX11609_CHANNEL_4 4 +#define MAX11609_CHANNEL_5 5 +#define MAX11609_CHANNEL_6 6 +#define MAX11609_CHANNEL_7 7 + +extern TaskHandle_t vTask11609_Handle; + +extern const SDR_type_01h_t SDR_MAX11609_12V_HP; + +void MAX11609_init( void ); + +/** + * @brief Monitoring task for MAX11609 sensor + * + * This task unblocks after every #MAX11609_UPDATE_PERIOD ms and updates the read from all the MAX11609 sensors listed in this module's SDR table + * + * @param Parameters Pointer to parameter list passed to task upon initialization (not used here) + */ +void vTaskMAX11609( void* Parameters ); + +#endif diff --git a/modules/sensors/sensors.h b/modules/sensors/sensors.h index 8737f3267..4d3d9fbef 100644 --- a/modules/sensors/sensors.h +++ b/modules/sensors/sensors.h @@ -58,4 +58,8 @@ #include "max6642.h" #endif +#ifdef MODULE_MAX11609 +#include "max11609.h" +#endif + #endif diff --git a/modules/task_priorities.h b/modules/task_priorities.h index 9b66ff360..cddfd87bf 100644 --- a/modules/task_priorities.h +++ b/modules/task_priorities.h @@ -39,6 +39,7 @@ #define tskMAX6642SENSOR_PRIORITY (tskIDLE_PRIORITY+3) #define tskINA220SENSOR_PRIORITY (tskIDLE_PRIORITY+3) #define tskINA3221SENSOR_PRIORITY (tskIDLE_PRIORITY+3) +#define tskMAX11609SENSOR_PRIORITY (tskIDLE_PRIORITY+3) #define tskIPMI_HANDLERS_PRIORITY (tskIDLE_PRIORITY+4) #define tskIPMI_PRIORITY (tskIDLE_PRIORITY+4) diff --git a/port/board/rtm-lamp/sdr_list.c b/port/board/rtm-lamp/sdr_list.c index 8f1e63f16..1cbc284f5 100644 --- a/port/board/rtm-lamp/sdr_list.c +++ b/port/board/rtm-lamp/sdr_list.c @@ -230,6 +230,440 @@ const SDR_type_01h_t SDR_LM75_RTM_3 = { }; #endif +#ifdef MODULE_MAX11609 +const SDR_type_01h_t SDR_MAX11609_VS1 = { + + .hdr.recID_LSB = 0x00, /* Filled by sdr_insert_entry() */ + .hdr.recID_MSB = 0x00, + .hdr.SDRversion = 0x51, + .hdr.rectype = TYPE_01, + .hdr.reclength = sizeof(SDR_type_01h_t) - sizeof(SDR_entry_hdr_t), + + .entityID = 0xC0, /* entity id: AMC Module */ + .ownerID = 0x00, /* i2c address, -> SDR_Init */ + .ownerLUN = 0x00, /* sensor owner LUN */ + .sensornum = 0x00, /* Filled by sdr_insert_entry() */ + + /* record body bytes */ + .entityinstance = 0x00, /* entity instance -> SDR_Init */ + .sensorinit = 0x7F, /* init: event generation + scanning enabled */ + .sensorcap = 0x56, /* capabilities: auto re-arm,*/ + .sensortype = SENSOR_TYPE_VOLTAGE, /* sensor type: Voltage*/ + .event_reading_type = 0x01, /* sensor reading*/ + .assertion_event_mask = 0x7A95, /* assertion event mask (All upper going-high and lower going-low events) */ + .deassertion_event_mask = 0x7A95, /* deassertion event mask (All upper going-high and lower going-low events) */ + .readable_threshold_mask = 0x3F, /* LSB: readable Threshold mask: all thresholds are readable: */ + .settable_threshold_mask = 0x00, /* MSB: setable Threshold mask: none of the thresholds are setable: */ + .sensor_units_1 = 0x00, /* sensor units 1 :*/ + .sensor_units_2 = 0x04, /* sensor units 2 :*/ + .sensor_units_3 = 0x00, /* sensor units 3 :*/ + .linearization = 0x00, /* Linearization */ + .M = 20, /* M */ + .M_tol = 0x00, /* M - Tolerance */ + .B = 0x00, /* B */ + .B_accuracy = 0x00, /* B - Accuracy */ + .acc_exp_sensor_dir = 0x02, /* Sensor direction */ + .Rexp_Bexp = 0xD0, /* R-Exp = -3 , B-Exp = 0 */ + .analog_flags = 0x03, /* Analogue characteristics flags */ + .nominal_reading = (3700/20), /* Nominal reading [(M * x + B * 10^(B_exp)) * 10^(R_exp)] = 3.7 V */ + .normal_max = (5000/20), /* Normal maximum = 5 V */ + .normal_min = (3600/20), /* Normal minimum = 3.6 V */ + .sensor_max_reading = 0xFF, /* Sensor Maximum reading */ + .sensor_min_reading = 0x00, /* Sensor Minimum reading */ + .upper_nonrecover_thr = (5119/20), /* Upper non-recoverable Threshold = 5.119 V */ + .upper_critical_thr = (5100/20), /* Upper critical Threshold = 5.1 V */ + .upper_noncritical_thr = (5050/20), /* Upper non critical Threshold = 5.05 V */ + .lower_nonrecover_thr = (3200/20), /* Lower non-recoverable Threshold = 3.2 V */ + .lower_critical_thr = (3300/20), /* Lower critical Threshold = 3.3 V */ + .lower_noncritical_thr = (3400/20), /* Lower non-critical Threshold = 3.4 V */ + .pos_thr_hysteresis = 2, /* positive going Threshold hysteresis value */ + .neg_thr_hysteresis = 2, /* negative going Threshold hysteresis value */ + .reserved1 = 0x00, /* reserved */ + .reserved2 = 0x00, /* reserved */ + .OEM = MAX11609_CHANNEL_0, /* ADC channel 0 */ + .IDtypelen = 0xc0 | STR_SIZE("VS1"), /* 8 bit ASCII, number of bytes */ + .IDstring = "VS1" /* sensor string */ +}; + +const SDR_type_01h_t SDR_MAX11609_VS2 = { + + .hdr.recID_LSB = 0x00, /* Filled by sdr_insert_entry() */ + .hdr.recID_MSB = 0x00, + .hdr.SDRversion = 0x51, + .hdr.rectype = TYPE_01, + .hdr.reclength = sizeof(SDR_type_01h_t) - sizeof(SDR_entry_hdr_t), + + .entityID = 0xC0, /* entity id: AMC Module */ + .ownerID = 0x00, /* i2c address, -> SDR_Init */ + .ownerLUN = 0x00, /* sensor owner LUN */ + .sensornum = 0x00, /* Filled by sdr_insert_entry() */ + + /* record body bytes */ + .entityinstance = 0x00, /* entity instance -> SDR_Init */ + .sensorinit = 0x7F, /* init: event generation + scanning enabled */ + .sensorcap = 0x56, /* capabilities: auto re-arm,*/ + .sensortype = SENSOR_TYPE_VOLTAGE, /* sensor type: Voltage*/ + .event_reading_type = 0x01, /* sensor reading*/ + .assertion_event_mask = 0x7A95, /* assertion event mask (All upper going-high and lower going-low events) */ + .deassertion_event_mask = 0x7A95, /* deassertion event mask (All upper going-high and lower going-low events) */ + .readable_threshold_mask = 0x3F, /* LSB: readable Threshold mask: all thresholds are readable: */ + .settable_threshold_mask = 0x00, /* MSB: setable Threshold mask: none of the thresholds are setable: */ + .sensor_units_1 = 0x00, /* sensor units 1 :*/ + .sensor_units_2 = 0x04, /* sensor units 2 :*/ + .sensor_units_3 = 0x00, /* sensor units 3 :*/ + .linearization = 0x00, /* Linearization */ + .M = 20, /* M */ + .M_tol = 0x00, /* M - Tolerance */ + .B = 0x00, /* B */ + .B_accuracy = 0x00, /* B - Accuracy */ + .acc_exp_sensor_dir = 0x02, /* Sensor direction */ + .Rexp_Bexp = 0xD0, /* R-Exp = -3 , B-Exp = 0 */ + .analog_flags = 0x03, /* Analogue characteristics flags */ + .nominal_reading = (3700/20), /* Nominal reading [(M * x + B * 10^(B_exp)) * 10^(R_exp)] = 3.7 V */ + .normal_max = (5000/20), /* Normal maximum = 5 V */ + .normal_min = (3600/20), /* Normal minimum = 3.6 V */ + .sensor_max_reading = 0xFF, /* Sensor Maximum reading */ + .sensor_min_reading = 0x00, /* Sensor Minimum reading */ + .upper_nonrecover_thr = (5119/20), /* Upper non-recoverable Threshold = 5.119 V */ + .upper_critical_thr = (5100/20), /* Upper critical Threshold = 5.1 V */ + .upper_noncritical_thr = (5050/20), /* Upper non critical Threshold = 5.05 V */ + .lower_nonrecover_thr = (3200/20), /* Lower non-recoverable Threshold = 3.2 V */ + .lower_critical_thr = (3300/20), /* Lower critical Threshold = 3.3 V */ + .lower_noncritical_thr = (3400/20), /* Lower non-critical Threshold = 3.4 V */ + .pos_thr_hysteresis = 2, /* positive going Threshold hysteresis value */ + .neg_thr_hysteresis = 2, /* negative going Threshold hysteresis value */ + .reserved1 = 0x00, /* reserved */ + .reserved2 = 0x00, /* reserved */ + .OEM = MAX11609_CHANNEL_1, /* ADC channel 1 */ + .IDtypelen = 0xc0 | STR_SIZE("VS2"), /* 8 bit ASCII, number of bytes */ + .IDstring = "VS2" /* sensor string */ +}; + +const SDR_type_01h_t SDR_MAX11609_N7V = { + + .hdr.recID_LSB = 0x00, /* Filled by sdr_insert_entry() */ + .hdr.recID_MSB = 0x00, + .hdr.SDRversion = 0x51, + .hdr.rectype = TYPE_01, + .hdr.reclength = sizeof(SDR_type_01h_t) - sizeof(SDR_entry_hdr_t), + + .entityID = 0xC0, /* entity id: AMC Module */ + .ownerID = 0x00, /* i2c address, -> SDR_Init */ + .ownerLUN = 0x00, /* sensor owner LUN */ + .sensornum = 0x00, /* Filled by sdr_insert_entry() */ + + /* record body bytes */ + .entityinstance = 0x00, /* entity instance -> SDR_Init */ + .sensorinit = 0x7F, /* init: event generation + scanning enabled */ + .sensorcap = 0x56, /* capabilities: auto re-arm,*/ + .sensortype = SENSOR_TYPE_VOLTAGE, /* sensor type: Voltage*/ + .event_reading_type = 0x01, /* sensor reading*/ + .assertion_event_mask = 0x7A95, /* assertion event mask (All upper going-high and lower going-low events) */ + .deassertion_event_mask = 0x7A95, /* deassertion event mask (All upper going-high and lower going-low events) */ + .readable_threshold_mask = 0x3F, /* LSB: readable Threshold mask: all thresholds are readable: */ + .settable_threshold_mask = 0x00, /* MSB: setable Threshold mask: none of the thresholds are setable: */ + .sensor_units_1 = 0x00, /* sensor units 1 :*/ + .sensor_units_2 = 0x04, /* sensor units 2 :*/ + .sensor_units_3 = 0x00, /* sensor units 3 :*/ + .linearization = 0x00, /* Linearization */ + .M = (uint8_t)-40, /* M */ + .M_tol = 0xC0, /* M - Tolerance */ + .B = 0x00, /* B */ + .B_accuracy = 0x00, /* B - Accuracy */ + .acc_exp_sensor_dir = 0x02, /* Sensor direction */ + .Rexp_Bexp = 0xD0, /* R-Exp = -3 , B-Exp = 0 */ + .analog_flags = 0x03, /* Analogue characteristics flags */ + .nominal_reading = (7040/40), /* Nominal reading [(M * x + B * 10^(B_exp)) * 10^(R_exp)] = 7.04 V */ + .normal_max = (7200/40), /* Normal maximum = 7.2 V */ + .normal_min = (6800/40), /* Normal minimum = 6.8 V */ + .sensor_max_reading = 0xFF, /* Sensor Maximum reading */ + .sensor_min_reading = 0x00, /* Sensor Minimum reading */ + .upper_nonrecover_thr = (8500/40), /* Upper non-recoverable Threshold = 8.5 V */ + .upper_critical_thr = (8000/40), /* Upper critical Threshold = 8 V */ + .upper_noncritical_thr = (7500/40), /* Upper non critical Threshold = 7.5 V */ + .lower_nonrecover_thr = (5500/40), /* Lower non-recoverable Threshold = 5.5 V */ + .lower_critical_thr = (6000/40), /* Lower critical Threshold = 6 V */ + .lower_noncritical_thr = (6500/40), /* Lower non-critical Threshold = 6.5 V */ + .pos_thr_hysteresis = 2, /* positive going Threshold hysteresis value */ + .neg_thr_hysteresis = 2, /* negative going Threshold hysteresis value */ + .reserved1 = 0x00, /* reserved */ + .reserved2 = 0x00, /* reserved */ + .OEM = MAX11609_CHANNEL_2, /* ADC channel 2 */ + .IDtypelen = 0xc0 | STR_SIZE("N7V"), /* 8 bit ASCII, number of bytes */ + .IDstring = "N7V" /* sensor string */ +}; + +const SDR_type_01h_t SDR_MAX11609_7V = { + + .hdr.recID_LSB = 0x00, /* Filled by sdr_insert_entry() */ + .hdr.recID_MSB = 0x00, + .hdr.SDRversion = 0x51, + .hdr.rectype = TYPE_01, + .hdr.reclength = sizeof(SDR_type_01h_t) - sizeof(SDR_entry_hdr_t), + + .entityID = 0xC0, /* entity id: AMC Module */ + .ownerID = 0x00, /* i2c address, -> SDR_Init */ + .ownerLUN = 0x00, /* sensor owner LUN */ + .sensornum = 0x00, /* Filled by sdr_insert_entry() */ + + /* record body bytes */ + .entityinstance = 0x00, /* entity instance -> SDR_Init */ + .sensorinit = 0x7F, /* init: event generation + scanning enabled */ + .sensorcap = 0x56, /* capabilities: auto re-arm,*/ + .sensortype = SENSOR_TYPE_VOLTAGE, /* sensor type: Voltage*/ + .event_reading_type = 0x01, /* sensor reading*/ + .assertion_event_mask = 0x7A95, /* assertion event mask (All upper going-high and lower going-low events) */ + .deassertion_event_mask = 0x7A95, /* deassertion event mask (All upper going-high and lower going-low events) */ + .readable_threshold_mask = 0x3F, /* LSB: readable Threshold mask: all thresholds are readable: */ + .settable_threshold_mask = 0x00, /* MSB: setable Threshold mask: none of the thresholds are setable: */ + .sensor_units_1 = 0x00, /* sensor units 1 :*/ + .sensor_units_2 = 0x04, /* sensor units 2 :*/ + .sensor_units_3 = 0x00, /* sensor units 3 :*/ + .linearization = 0x00, /* Linearization */ + .M = 40, /* M */ + .M_tol = 0x00, /* M - Tolerance */ + .B = 0x00, /* B */ + .B_accuracy = 0x00, /* B - Accuracy */ + .acc_exp_sensor_dir = 0x02, /* Sensor direction */ + .Rexp_Bexp = 0xD0, /* R-Exp = -3 , B-Exp = 0 */ + .analog_flags = 0x03, /* Analogue characteristics flags */ + .nominal_reading = (7000/40), /* Nominal reading [(M * x + B * 10^(B_exp)) * 10^(R_exp)] = 7 V */ + .normal_max = (7200/40), /* Normal maximum = 7.2 V */ + .normal_min = (6800/40), /* Normal minimum = 6.8 V */ + .sensor_max_reading = 0xFF, /* Sensor Maximum reading */ + .sensor_min_reading = 0x00, /* Sensor Minimum reading */ + .upper_nonrecover_thr = (8500/40), /* Upper non-recoverable Threshold = 8.5 V */ + .upper_critical_thr = (8000/40), /* Upper critical Threshold = 8 V */ + .upper_noncritical_thr = (7500/40), /* Upper non critical Threshold = 7.5 V */ + .lower_nonrecover_thr = (5500/40), /* Lower non-recoverable Threshold = 5.5 V */ + .lower_critical_thr = (6000/40), /* Lower critical Threshold = 6 V */ + .lower_noncritical_thr = (6500/40), /* Lower non-critical Threshold = 6.5 V */ + .pos_thr_hysteresis = 2, /* positive going Threshold hysteresis value */ + .neg_thr_hysteresis = 2, /* negative going Threshold hysteresis value */ + .reserved1 = 0x00, /* reserved */ + .reserved2 = 0x00, /* reserved */ + .OEM = MAX11609_CHANNEL_3, /* ADC channel 3 */ + .IDtypelen = 0xc0 | STR_SIZE("7V"), /* 8 bit ASCII, number of bytes */ + .IDstring = "7V" /* sensor string */ +}; + +const SDR_type_01h_t SDR_MAX11609_2V5 = { + + .hdr.recID_LSB = 0x00, /* Filled by sdr_insert_entry() */ + .hdr.recID_MSB = 0x00, + .hdr.SDRversion = 0x51, + .hdr.rectype = TYPE_01, + .hdr.reclength = sizeof(SDR_type_01h_t) - sizeof(SDR_entry_hdr_t), + + .entityID = 0xC0, /* entity id: AMC Module */ + .ownerID = 0x00, /* i2c address, -> SDR_Init */ + .ownerLUN = 0x00, /* sensor owner LUN */ + .sensornum = 0x00, /* Filled by sdr_insert_entry() */ + + /* record body bytes */ + .entityinstance = 0x00, /* entity instance -> SDR_Init */ + .sensorinit = 0x7F, /* init: event generation + scanning enabled */ + .sensorcap = 0x56, /* capabilities: auto re-arm,*/ + .sensortype = SENSOR_TYPE_VOLTAGE, /* sensor type: Voltage*/ + .event_reading_type = 0x01, /* sensor reading*/ + .assertion_event_mask = 0x7A95, /* assertion event mask (All upper going-high and lower going-low events) */ + .deassertion_event_mask = 0x7A95, /* deassertion event mask (All upper going-high and lower going-low events) */ + .readable_threshold_mask = 0x3F, /* LSB: readable Threshold mask: all thresholds are readable: */ + .settable_threshold_mask = 0x00, /* MSB: setable Threshold mask: none of the thresholds are setable: */ + .sensor_units_1 = 0x00, /* sensor units 1 :*/ + .sensor_units_2 = 0x04, /* sensor units 2 :*/ + .sensor_units_3 = 0x00, /* sensor units 3 :*/ + .linearization = 0x00, /* Linearization */ + .M = 16, /* M */ + .M_tol = 0x00, /* M - Tolerance */ + .B = 0x00, /* B */ + .B_accuracy = 0x00, /* B - Accuracy */ + .acc_exp_sensor_dir = 0x02, /* Sensor direction */ + .Rexp_Bexp = 0xD0, /* R-Exp = -3 , B-Exp = 0 */ + .analog_flags = 0x03, /* Analogue characteristics flags */ + .nominal_reading = (2480/16), /* Nominal reading [(M * x + B * 10^(B_exp)) * 10^(R_exp)] = 2.48 V */ + .normal_max = (2600/16), /* Normal maximum = 2.6 V */ + .normal_min = (2400/16), /* Normal minimum = 2.4 V */ + .sensor_max_reading = 0xFF, /* Sensor Maximum reading */ + .sensor_min_reading = 0x00, /* Sensor Minimum reading */ + .upper_nonrecover_thr = (2800/16), /* Upper non-recoverable Threshold = 2.8 V */ + .upper_critical_thr = (2700/16), /* Upper critical Threshold = 2.7 V */ + .upper_noncritical_thr = (2650/16), /* Upper non critical Threshold = 2.65 V */ + .lower_nonrecover_thr = (2200/16), /* Lower non-recoverable Threshold = 2.2 V */ + .lower_critical_thr = (2300/16), /* Lower critical Threshold = 2.3 V */ + .lower_noncritical_thr = (2350/16), /* Lower non-critical Threshold = 2.35 V */ + .pos_thr_hysteresis = 2, /* positive going Threshold hysteresis value */ + .neg_thr_hysteresis = 2, /* negative going Threshold hysteresis value */ + .reserved1 = 0x00, /* reserved */ + .reserved2 = 0x00, /* reserved */ + .OEM = MAX11609_CHANNEL_4, /* ADC channel 4 */ + .IDtypelen = 0xc0 | STR_SIZE("2V5"), /* 8 bit ASCII, number of bytes */ + .IDstring = "2V5" /* sensor string */ +}; + +const SDR_type_01h_t SDR_MAX11609_3V3 = { + + .hdr.recID_LSB = 0x00, /* Filled by sdr_insert_entry() */ + .hdr.recID_MSB = 0x00, + .hdr.SDRversion = 0x51, + .hdr.rectype = TYPE_01, + .hdr.reclength = sizeof(SDR_type_01h_t) - sizeof(SDR_entry_hdr_t), + + .entityID = 0xC0, /* entity id: AMC Module */ + .ownerID = 0x00, /* i2c address, -> SDR_Init */ + .ownerLUN = 0x00, /* sensor owner LUN */ + .sensornum = 0x00, /* Filled by sdr_insert_entry() */ + + /* record body bytes */ + .entityinstance = 0x00, /* entity instance -> SDR_Init */ + .sensorinit = 0x7F, /* init: event generation + scanning enabled */ + .sensorcap = 0x56, /* capabilities: auto re-arm,*/ + .sensortype = SENSOR_TYPE_VOLTAGE, /* sensor type: Voltage*/ + .event_reading_type = 0x01, /* sensor reading*/ + .assertion_event_mask = 0x7A95, /* assertion event mask (All upper going-high and lower going-low events) */ + .deassertion_event_mask = 0x7A95, /* deassertion event mask (All upper going-high and lower going-low events) */ + .readable_threshold_mask = 0x3F, /* LSB: readable Threshold mask: all thresholds are readable: */ + .settable_threshold_mask = 0x00, /* MSB: setable Threshold mask: none of the thresholds are setable: */ + .sensor_units_1 = 0x00, /* sensor units 1 :*/ + .sensor_units_2 = 0x04, /* sensor units 2 :*/ + .sensor_units_3 = 0x00, /* sensor units 3 :*/ + .linearization = 0x00, /* Linearization */ + .M = 16, /* M */ + .M_tol = 0x00, /* M - Tolerance */ + .B = 0x00, /* B */ + .B_accuracy = 0x00, /* B - Accuracy */ + .acc_exp_sensor_dir = 0x02, /* Sensor direction */ + .Rexp_Bexp = 0xD0, /* R-Exp = -3 , B-Exp = 0 */ + .analog_flags = 0x03, /* Analogue characteristics flags */ + .nominal_reading = (3312/16), /* Nominal reading [(M * x + B * 10^(B_exp)) * 10^(R_exp)] = 3.312 V */ + .normal_max = (3400/16), /* Normal maximum = 3.4 V */ + .normal_min = (3200/16), /* Normal minimum = 3.2 V */ + .sensor_max_reading = 0xFF, /* Sensor Maximum reading */ + .sensor_min_reading = 0x00, /* Sensor Minimum reading */ + .upper_nonrecover_thr = (3700/16), /* Upper non-recoverable Threshold = 3.7 V */ + .upper_critical_thr = (3600/16), /* Upper critical Threshold = 3.6 V */ + .upper_noncritical_thr = (3500/16), /* Upper non critical Threshold = 3.5 V */ + .lower_nonrecover_thr = (2900/16), /* Lower non-recoverable Threshold = 2.9 V */ + .lower_critical_thr = (3000/16), /* Lower critical Threshold = 3 V */ + .lower_noncritical_thr = (3100/16), /* Lower non-critical Threshold = 3.1 V */ + .pos_thr_hysteresis = 2, /* positive going Threshold hysteresis value */ + .neg_thr_hysteresis = 2, /* negative going Threshold hysteresis value */ + .reserved1 = 0x00, /* reserved */ + .reserved2 = 0x00, /* reserved */ + .OEM = MAX11609_CHANNEL_5, /* ADC channel 5 */ + .IDtypelen = 0xc0 | STR_SIZE("3V3"), /* 8 bit ASCII, number of bytes */ + .IDstring = "3V3" /* sensor string */ +}; + +const SDR_type_01h_t SDR_MAX11609_5V = { + + .hdr.recID_LSB = 0x00, /* Filled by sdr_insert_entry() */ + .hdr.recID_MSB = 0x00, + .hdr.SDRversion = 0x51, + .hdr.rectype = TYPE_01, + .hdr.reclength = sizeof(SDR_type_01h_t) - sizeof(SDR_entry_hdr_t), + + .entityID = 0xC0, /* entity id: AMC Module */ + .ownerID = 0x00, /* i2c address, -> SDR_Init */ + .ownerLUN = 0x00, /* sensor owner LUN */ + .sensornum = 0x00, /* Filled by sdr_insert_entry() */ + + /* record body bytes */ + .entityinstance = 0x00, /* entity instance -> SDR_Init */ + .sensorinit = 0x7F, /* init: event generation + scanning enabled */ + .sensorcap = 0x56, /* capabilities: auto re-arm,*/ + .sensortype = SENSOR_TYPE_VOLTAGE, /* sensor type: Voltage*/ + .event_reading_type = 0x01, /* sensor reading*/ + .assertion_event_mask = 0x7A95, /* assertion event mask (All upper going-high and lower going-low events) */ + .deassertion_event_mask = 0x7A95, /* deassertion event mask (All upper going-high and lower going-low events) */ + .readable_threshold_mask = 0x3F, /* LSB: readable Threshold mask: all thresholds are readable: */ + .settable_threshold_mask = 0x00, /* MSB: setable Threshold mask: none of the thresholds are setable: */ + .sensor_units_1 = 0x00, /* sensor units 1 :*/ + .sensor_units_2 = 0x04, /* sensor units 2 :*/ + .sensor_units_3 = 0x00, /* sensor units 3 :*/ + .linearization = 0x00, /* Linearization */ + .M = 32, /* M */ + .M_tol = 0x00, /* M - Tolerance */ + .B = 0x00, /* B */ + .B_accuracy = 0x00, /* B - Accuracy */ + .acc_exp_sensor_dir = 0x02, /* Sensor direction */ + .Rexp_Bexp = 0xD0, /* R-Exp = -3 , B-Exp = 0 */ + .analog_flags = 0x03, /* Analogue characteristics flags */ + .nominal_reading = (5024/32), /* Nominal reading [(M * x + B * 10^(B_exp)) * 10^(R_exp)] = 5.024 V */ + .normal_max = (4800/32), /* Normal maximum = 4.8 V */ + .normal_min = (5200/32), /* Normal minimum = 5.2 V */ + .sensor_max_reading = 0xFF, /* Sensor Maximum reading */ + .sensor_min_reading = 0x00, /* Sensor Minimum reading */ + .upper_nonrecover_thr = (5500/32), /* Upper non-recoverable Threshold = 5.5 V */ + .upper_critical_thr = (5400/32), /* Upper critical Threshold = 5.4 V */ + .upper_noncritical_thr = (5300/32), /* Upper non critical Threshold = 5.3 V */ + .lower_nonrecover_thr = (4300/32), /* Lower non-recoverable Threshold = 4.3 V */ + .lower_critical_thr = (4500/32), /* Lower critical Threshold = 4.5 V */ + .lower_noncritical_thr = (4600/32), /* Lower non-critical Threshold = 4.6 V */ + .pos_thr_hysteresis = 2, /* positive going Threshold hysteresis value */ + .neg_thr_hysteresis = 2, /* negative going Threshold hysteresis value */ + .reserved1 = 0x00, /* reserved */ + .reserved2 = 0x00, /* reserved */ + .OEM = MAX11609_CHANNEL_6, /* ADC channel 5 */ + .IDtypelen = 0xc0 | STR_SIZE("5V"), /* 8 bit ASCII, number of bytes */ + .IDstring = "5V" /* sensor string */ +}; + +const SDR_type_01h_t SDR_MAX11609_12V_HP = { + + .hdr.recID_LSB = 0x00, /* Filled by sdr_insert_entry() */ + .hdr.recID_MSB = 0x00, + .hdr.SDRversion = 0x51, + .hdr.rectype = TYPE_01, + .hdr.reclength = sizeof(SDR_type_01h_t) - sizeof(SDR_entry_hdr_t), + + .entityID = 0xC0, /* entity id: AMC Module */ + .ownerID = 0x00, /* i2c address, -> SDR_Init */ + .ownerLUN = 0x00, /* sensor owner LUN */ + .sensornum = 0x00, /* Filled by sdr_insert_entry() */ + + /* record body bytes */ + .entityinstance = 0x00, /* entity instance -> SDR_Init */ + .sensorinit = 0x7F, /* init: event generation + scanning enabled */ + .sensorcap = 0x56, /* capabilities: auto re-arm,*/ + .sensortype = SENSOR_TYPE_VOLTAGE, /* sensor type: Voltage*/ + .event_reading_type = 0x01, /* sensor reading*/ + .assertion_event_mask = 0x7A95, /* assertion event mask (All upper going-high and lower going-low events) */ + .deassertion_event_mask = 0x7A95, /* deassertion event mask (All upper going-high and lower going-low events) */ + .readable_threshold_mask = 0x3F, /* LSB: readable Threshold mask: all thresholds are readable: */ + .settable_threshold_mask = 0x00, /* MSB: setable Threshold mask: none of the thresholds are setable: */ + .sensor_units_1 = 0x00, /* sensor units 1 :*/ + .sensor_units_2 = 0x04, /* sensor units 2 :*/ + .sensor_units_3 = 0x00, /* sensor units 3 :*/ + .linearization = 0x00, /* Linearization */ + .M = 64, /* M */ + .M_tol = 0x00, /* M - Tolerance */ + .B = 0x00, /* B */ + .B_accuracy = 0x00, /* B - Accuracy */ + .acc_exp_sensor_dir = 0x02, /* Sensor direction */ + .Rexp_Bexp = 0xD0, /* R-Exp = -3 , B-Exp = 0 */ + .analog_flags = 0x03, /* Analogue characteristics flags */ + .nominal_reading = (12416 >> 6), /* Nominal reading [(M * x + B * 10^(B_exp)) * 10^(R_exp)] = 12.146 V */ + .normal_max = (13000 >> 6), /* Normal maximum = 13 V */ + .normal_min = (11000 >> 6), /* Normal minimum = 11 V */ + .sensor_max_reading = 0xFF, /* Sensor Maximum reading */ + .sensor_min_reading = 0x00, /* Sensor Minimum reading */ + .upper_nonrecover_thr = (16000 >> 6), /* Upper non-recoverable Threshold = 16 V */ + .upper_critical_thr = (15000 >> 6), /* Upper critical Threshold = 15 V */ + .upper_noncritical_thr = (14000 >> 6), /* Upper non critical Threshold = 14 V */ + .lower_nonrecover_thr = (8000 >> 6), /* Lower non-recoverable Threshold = 8 V */ + .lower_critical_thr = (9000 >> 6), /* Lower critical Threshold = 9 V */ + .lower_noncritical_thr = (10000 >> 6), /* Lower non-critical Threshold = 10 V */ + .pos_thr_hysteresis = 2, /* positive going Threshold hysteresis value */ + .neg_thr_hysteresis = 2, /* negative going Threshold hysteresis value */ + .reserved1 = 0x00, /* reserved */ + .reserved2 = 0x00, /* reserved */ + .OEM = MAX11609_CHANNEL_7, /* ADC channel 7 */ + .IDtypelen = 0xc0 | STR_SIZE("12V_HP"), /* 8 bit ASCII, number of bytes */ + .IDstring = "12V_HP" /* sensor string */ +}; +#endif + void rtm_sdr_init( void ) { #ifdef MODULE_HOTSWAP @@ -242,4 +676,15 @@ void rtm_sdr_init( void ) sdr_insert_entry( TYPE_01, (void *) &SDR_LM75_RTM_3, &vTaskLM75_Handle, 0, CHIP_ID_RTM_LM75_2 ); #endif +#ifdef MODULE_MAX11609 + sdr_insert_entry(TYPE_01, (void *) &SDR_MAX11609_VS1, &vTask11609_Handle, 0, CHIP_ID_RTM_MAX11609); + sdr_insert_entry(TYPE_01, (void *) &SDR_MAX11609_VS2, &vTask11609_Handle, 0, CHIP_ID_RTM_MAX11609); + sdr_insert_entry(TYPE_01, (void *) &SDR_MAX11609_N7V, &vTask11609_Handle, 0, CHIP_ID_RTM_MAX11609); + sdr_insert_entry(TYPE_01, (void *) &SDR_MAX11609_7V, &vTask11609_Handle, 0, CHIP_ID_RTM_MAX11609); + sdr_insert_entry(TYPE_01, (void *) &SDR_MAX11609_2V5, &vTask11609_Handle, 0, CHIP_ID_RTM_MAX11609); + sdr_insert_entry(TYPE_01, (void *) &SDR_MAX11609_3V3, &vTask11609_Handle, 0, CHIP_ID_RTM_MAX11609); + sdr_insert_entry(TYPE_01, (void *) &SDR_MAX11609_5V, &vTask11609_Handle, 0, CHIP_ID_RTM_MAX11609); + sdr_insert_entry(TYPE_01, (void *) &SDR_MAX11609_12V_HP, &vTask11609_Handle, 0, CHIP_ID_RTM_MAX11609); +#endif + }