123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- #ifndef __SENSOR_TBL_H__
- #define __SENSOR_TBL_H__
- #include <stdint.h>
- #include "bmc_conf.h"
- /**
- ** @brief HAL Error code definitions
- ***/
- typedef enum
- {
- /* HAL Error codes */
- HAL_ERR_NONE, /* No error */
- HAL_ERR_READ, /* Error in reading device */
- HAL_ERR_WRITE, /* Error in writing to device*/
- HAL_ERR_FUNC_NOT_SUPPORTED, /* Function called is not supported */
- } hal_status_codes_e;
- /**
- ** @brief HAL Supported Hardware functions
- ***/
- typedef enum
- {
- HAL_DEVICE_READ, /* General Read function */
- HAL_DEVICE_WRITE, /* General Write function */
- /* Special I2C functions */
- HAL_I2C_READ_REG, /* Read I2C register */
- HAL_I2C_READ_WRITE, /* Read/Write I2C */
- /* Special GPIO functions */
- HAL_SET_GPIO_DIR, /* GPIO Set direction */
- HAL_GET_GPIO_DIR, /* GPIO Get direction */
- HAL_SET_GPIO_POL, /* GPIO Set Polarity */
- HAL_GET_GPIO_POL, /* GPIO Get Polarity */
- HAL_SET_GPIO_OUTPUT_REG, /* GPIO Set output data register */
- } hal_func_codes_e;
- /**
- ** @brief This structure necessary hardware information to access any device
- ***/
- typedef struct
- {
- hal_status_codes_e status_code; /* HAL api's status codes */
- hal_func_codes_e func; /* Hardware function */
- union {
- uint8_t *pbyte; /* All HAL apis return data
- in bytes using this pointer */
- uint16_t *pword; /* All HAL apis return data accesed
- in words using this pointer */
- };
- int read_len; /* bytes to read */
- uint8_t *pwrite_buf; /* All HAL apis write data
- from this buffer */
- int write_len; /* bytes to write */
- // hal_dev_properties_t dev_prop; /* Device properties information */
- // hal_dev_type_e dev_type; /* Type of the device */
- //
- // hal_i2c_t i2c; /* Hold I2C information */
- // hal_gpio_t gpio; /* Hold GPIO information */
- // hal_mmap_t mmap; /* Hold memory mapped information */
- // hal_adc_t adc; /* Hold ADC information */
- //
- // hal_fanpwm_t fan; /* Hold FanPwm information Added by winston for fanpwm */
- // hal_peci_t peci; /* Hold PECI information Added by winston for peci */
- // hal_lpcuart_t lpcuart; /* Hold LPCUART information Added by jcchiu for lpcuart */
- // hal_intsensor_t intsensor; /* Hold Interrupt Sensor information */
- // hal_nmsensor_t nmsensor; /* Hold Interrupt Sensor information */
- } hal_t;
- typedef enum {
- MonitorOnStandby,
- NotMonitorOnStandby
- }monit_sta_t;
- /**
- ** @brief HAL read/write/init function type definition
- ***/
- typedef int (*phal_hndlr_t) (hal_t *phal);
- /**
- ** @brief HAL Device Table
- ***/
- typedef struct
- {
- uint8_t sensor_number;
- uint8_t poweron_delay; //scan this sensor after poweron_delay seconds, when bmc power on.
- uint8_t reset_delay; //scan this sensor after reset_delay senconds, when cpu reset.
- uint8_t monitor_interval; //Monitoring this sensor every monitor_interval seconds.
- monit_sta_t monitor_state; //whether monitoring this sensor when standby.
- phal_hndlr_t device_read;
- phal_hndlr_t device_write;
- phal_hndlr_t device_init;
- } sensor_tbl_t;
- #endif /* __SENSOR_TBL_H__ */
|