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 #define SHIFT_BITS 8 16 17 enum SensorCalculateType { 18 SENSOR_CFG_CALC_TYPE_NONE = 0, 19 SENSOR_CFG_CALC_TYPE_SET = 1, // To Support:1.Bitwise AND "&" 2.Bitwise OR "|" 20 SENSOR_CFG_CALC_TYPE_REVERT = 2, // To Support:1.Bitwise REVERT '~' 21 SENSOR_CFG_CALC_TYPE_XOR = 3, // To Support:1.Bitwise XOR "^" 22 SENSOR_CFG_CALC_TYPE_LEFT_SHIFT = 4, // To Support:1.Left shift << 23 SENSOR_CFG_CALC_TYPE_RIGHT_SHIFT = 5, // To Support:1.Right shift >> 24 }; 25 26 enum SensorOpsType { 27 SENSOR_OPS_TYPE_NOP = 0, 28 SENSOR_OPS_TYPE_READ = 1, 29 SENSOR_OPS_TYPE_WRITE = 2, 30 SENSOR_OPS_TYPE_READ_CHECK = 3, 31 SENSOR_OPS_TYPE_UPDATE_BITWISE = 4, 32 SENSOR_OPS_TYPE_EXTBUFF_READ = 5, 33 SENSOR_OPS_TYPE_EXTBUFF_WRITE = 6, 34 }; 35 36 struct SensorOpsCall { 37 enum SensorOpsType type; 38 int32_t (*ops)(struct SensorBusCfg *busCfg, struct SensorRegCfg *cfgItem); 39 }; 40 41 int32_t SetSensorRegCfgArray(struct SensorBusCfg *busCfg, const struct SensorRegCfgGroupNode *group); 42 int32_t SetSensorRegCfgArrayByBuff(struct SensorBusCfg *busCfg, const struct SensorRegCfgGroupNode *group, 43 uint8_t *buff, int16_t len); 44 int32_t ReadSensorRegCfgArray(struct SensorBusCfg *busCfg, const struct SensorRegCfgGroupNode *group, 45 int32_t index, uint8_t *buf, int32_t len); 46 int32_t WriteSensorRegCfgArray(struct SensorBusCfg *busCfg, const struct SensorRegCfgGroupNode *group, 47 int32_t index, int32_t len); 48 #endif /* SENSOR_CONFIG_CONTROLLER_H */