1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef SENSOR_CONFIG_CONTROLLER_H 10 #define SENSOR_CONFIG_CONTROLLER_H 11 12 #include "sensor_config_parser.h" 13 14 #define LENGTH_NUMBER 32 15 16 enum SensorCalculateType { 17 SENSOR_CFG_CALC_TYPE_NONE = 0, 18 SENSOR_CFG_CALC_TYPE_SET = 1, // To Support:1.Bitwise AND "&" 2.Bitwise OR "|" 19 SENSOR_CFG_CALC_TYPE_REVERT = 2, // To Support:1.Bitwise REVERT '~' 20 SENSOR_CFG_CALC_TYPE_XOR = 3, // To Support:1.Bitwise XOR "^" 21 SENSOR_CFG_CALC_TYPE_LEFT_SHIFT = 4, // To Support:1.Left shift << 22 SENSOR_CFG_CALC_TYPE_RIGHT_SHIFT = 5, // To Support:1.Right shift >> 23 }; 24 25 enum SensorOpsType { 26 SENSOR_OPS_TYPE_NOP = 0, 27 SENSOR_OPS_TYPE_READ = 1, 28 SENSOR_OPS_TYPE_WRITE = 2, 29 SENSOR_OPS_TYPE_READ_CHECK = 3, 30 SENSOR_OPS_TYPE_UPDATE_BITWISE = 4, 31 SENSOR_OPS_TYPE_EXTBUFF_READ = 5, 32 SENSOR_OPS_TYPE_EXTBUFF_WRITE = 6, 33 }; 34 35 struct SensorOpsCall { 36 enum SensorOpsType type; 37 int32_t (*ops)(struct SensorBusCfg *busCfg, struct SensorRegCfg *cfgItem); 38 }; 39 40 int32_t SetSensorRegCfgArray(struct SensorBusCfg *busCfg, const struct SensorRegCfgGroupNode *group); 41 int32_t SetSensorRegCfgArrayByBuff(struct SensorBusCfg *busCfg, const struct SensorRegCfgGroupNode *group, 42 uint8_t *buff, int16_t len); 43 int32_t ReadSensorRegCfgArray(struct SensorBusCfg *busCfg, const struct SensorRegCfgGroupNode *group, 44 int32_t index, uint8_t *buf, int32_t len); 45 int32_t WriteSensorRegCfgArray(struct SensorBusCfg *busCfg, const struct SensorRegCfgGroupNode *group, 46 int32_t index, int32_t len); 47 #endif /* SENSOR_CONFIG_CONTROLLER_H */