From 00a0e9bdd83144e297de5759487d4eee4cbf810c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Fri, 28 Jun 2024 09:57:59 +0800 Subject: [PATCH 1/3] testStartOnce MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- .../sensor/driver/accel/sensor_accel_driver.c | 22 +++++++++++++++++ .../driver/accel/sensor_gravity_driver.c | 20 ++++++++++++++++ .../common/src/sensor_config_controller.c | 17 +++++++++++++ .../driver/common/src/sensor_config_parser.c | 24 +++++++++++++++++++ .../driver/common/src/sensor_device_manager.c | 19 +++++++++++++++ .../driver/common/src/sensor_platform_if.c | 7 ++++++ 6 files changed, 109 insertions(+) diff --git a/framework/model/sensor/driver/accel/sensor_accel_driver.c b/framework/model/sensor/driver/accel/sensor_accel_driver.c index 20cb75306..efe1d8910 100644 --- a/framework/model/sensor/driver/accel/sensor_accel_driver.c +++ b/framework/model/sensor/driver/accel/sensor_accel_driver.c @@ -17,6 +17,10 @@ #include "sensor_platform_if.h" #define HDF_LOG_TAG khdf_sensor_accel_driver +#ifdef LOG_DOMAIN +#undef LOG_DOMAIN +#endif +#define LOG_DOMAIN 0xD002516 #define HDF_ACCEL_WORK_QUEUE_NAME "hdf_accel_work_queue" @@ -31,6 +35,7 @@ static struct SensorRegCfgGroupNode *g_regCfgGroup[SENSOR_GROUP_MAX] = { NULL }; int32_t SubscribeAccelDataCallbackFunc(GravitySubscribeAccelCallback cb) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN_VALUE(cb, HDF_ERR_INVALID_PARAM); struct AccelDrvData *drvData = AccelGetDrvData(); @@ -44,6 +49,7 @@ int32_t SubscribeAccelDataCallbackFunc(GravitySubscribeAccelCallback cb) int32_t AccelRegisterChipOps(const struct AccelOpsCall *ops) { + HDF_LOGI("%{public}s", __func__); struct AccelDrvData *drvData = AccelGetDrvData(); CHECK_NULL_PTR_RETURN_VALUE(drvData, HDF_ERR_INVALID_PARAM); @@ -56,6 +62,7 @@ int32_t AccelRegisterChipOps(const struct AccelOpsCall *ops) static void AccelDataWorkEntry(void *arg) { + HDF_LOGI("%{public}s", __func__); struct AccelDrvData *drvData = NULL; struct SensorReportEvent event; @@ -84,6 +91,7 @@ static void AccelDataWorkEntry(void *arg) static void AccelTimerEntry(uintptr_t arg) { + HDF_LOGI("%{public}s", __func__); int64_t interval; int32_t ret; struct AccelDrvData *drvData = (struct AccelDrvData *)arg; @@ -103,6 +111,7 @@ static void AccelTimerEntry(uintptr_t arg) static int32_t InitAccelData(struct AccelDrvData *drvData) { + HDF_LOGI("%{public}s", __func__); if (HdfWorkQueueInit(&drvData->accelWorkQueue, HDF_ACCEL_WORK_QUEUE_NAME) != HDF_SUCCESS) { HDF_LOGE("%s: Accel init work queue failed", __func__); return HDF_FAILURE; @@ -122,6 +131,7 @@ static int32_t InitAccelData(struct AccelDrvData *drvData) static int32_t SetAccelEnable(void) { + HDF_LOGI("%{public}s", __func__); int32_t ret; struct AccelDrvData *drvData = AccelGetDrvData(); @@ -157,6 +167,7 @@ static int32_t SetAccelEnable(void) static int32_t SetAccelDisable(void) { + HDF_LOGI("%{public}s", __func__); int32_t ret; struct AccelDrvData *drvData = AccelGetDrvData(); @@ -186,6 +197,7 @@ static int32_t SetAccelDisable(void) static int32_t SetAccelBatch(int64_t samplingInterval, int64_t interval) { + HDF_LOGI("%{public}s", __func__); (void)interval; struct AccelDrvData *drvData = NULL; @@ -200,6 +212,7 @@ static int32_t SetAccelBatch(int64_t samplingInterval, int64_t interval) static int32_t SetAccelMode(int32_t mode) { + HDF_LOGI("%{public}s", __func__); if (mode <= SENSOR_WORK_MODE_DEFAULT || mode >= SENSOR_WORK_MODE_MAX) { HDF_LOGE("%s: The current mode is not supported", __func__); return HDF_FAILURE; @@ -210,6 +223,7 @@ static int32_t SetAccelMode(int32_t mode) static int32_t SetAccelOption(uint32_t option) { + HDF_LOGI("%{public}s", __func__); (void)option; return HDF_SUCCESS; } @@ -217,6 +231,7 @@ static int32_t SetAccelOption(uint32_t option) static int32_t DispatchAccel(struct HdfDeviceIoClient *client, int cmd, struct HdfSBuf *data, struct HdfSBuf *reply) { + HDF_LOGI("%{public}s", __func__); (void)client; (void)cmd; (void)data; @@ -227,6 +242,7 @@ static int32_t DispatchAccel(struct HdfDeviceIoClient *client, int32_t AccelBindDriver(struct HdfDeviceObject *device) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); struct AccelDrvData *drvData = (struct AccelDrvData *)OsalMemCalloc(sizeof(*drvData)); @@ -244,6 +260,7 @@ int32_t AccelBindDriver(struct HdfDeviceObject *device) static int32_t InitAccelOps(struct SensorCfgData *config, struct SensorDeviceInfo *deviceInfo) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN_VALUE(config, HDF_ERR_INVALID_PARAM); deviceInfo->ops.Enable = SetAccelEnable; @@ -263,6 +280,7 @@ static int32_t InitAccelOps(struct SensorCfgData *config, struct SensorDeviceInf static int32_t InitAccelAfterDetected(struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); struct SensorDeviceInfo deviceInfo; CHECK_NULL_PTR_RETURN_VALUE(config, HDF_ERR_INVALID_PARAM); @@ -294,6 +312,7 @@ static int32_t InitAccelAfterDetected(struct SensorCfgData *config) struct SensorCfgData *AccelCreateCfgData(const struct DeviceResourceNode *node) { + HDF_LOGI("%{public}s", __func__); struct AccelDrvData *drvData = AccelGetDrvData(); if (drvData == NULL || node == NULL) { @@ -341,6 +360,7 @@ BASE_CONFIG_EXIT: void AccelReleaseCfgData(struct SensorCfgData *accelCfg) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN(accelCfg); (void)DeleteSensorDevice(&accelCfg->sensorInfo); @@ -356,6 +376,7 @@ void AccelReleaseCfgData(struct SensorCfgData *accelCfg) int32_t AccelInitDriver(struct HdfDeviceObject *device) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); struct AccelDrvData *drvData = (struct AccelDrvData *)device->service; CHECK_NULL_PTR_RETURN_VALUE(drvData, HDF_ERR_INVALID_PARAM); @@ -380,6 +401,7 @@ int32_t AccelInitDriver(struct HdfDeviceObject *device) void AccelReleaseDriver(struct HdfDeviceObject *device) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN(device); struct AccelDrvData *drvData = (struct AccelDrvData *)device->service; diff --git a/framework/model/sensor/driver/accel/sensor_gravity_driver.c b/framework/model/sensor/driver/accel/sensor_gravity_driver.c index f5465c720..57a665b20 100644 --- a/framework/model/sensor/driver/accel/sensor_gravity_driver.c +++ b/framework/model/sensor/driver/accel/sensor_gravity_driver.c @@ -18,6 +18,10 @@ #include "sensor_platform_if.h" #define HDF_LOG_TAG khdf_sensor_gravity_driver +#ifdef LOG_DOMAIN +#undef LOG_DOMAIN +#endif +#define LOG_DOMAIN 0xD002516 #define HDF_GRAVITY_WORK_QUEUE_NAME "hdf_gravity_work_queue" @@ -31,6 +35,7 @@ static struct GravityDrvData *GravityGetDrvData(void) static int32_t GravitySubscribeAccelData(int32_t *accelData, int32_t size) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN_VALUE(accelData, HDF_ERR_INVALID_PARAM); if (size > GRAVITY_AXIS_NUM * sizeof(int32_t)) { @@ -47,6 +52,7 @@ static int32_t GravitySubscribeAccelData(int32_t *accelData, int32_t size) static void GravityDataWorkEntry(void *arg) { + HDF_LOGI("%{public}s", __func__); struct GravityDrvData *drvData = NULL; static int32_t GravityRawData[GRAVITY_AXIS_NUM]; struct SensorReportEvent event; @@ -79,6 +85,7 @@ static void GravityDataWorkEntry(void *arg) static void GravityTimerEntry(uintptr_t arg) { + HDF_LOGI("%{public}s", __func__); int32_t ret; struct GravityDrvData *drvData = (struct GravityDrvData *)arg; CHECK_NULL_PTR_RETURN(drvData); @@ -95,6 +102,7 @@ static void GravityTimerEntry(uintptr_t arg) static int32_t InitGravityData(struct GravityDrvData *drvData) { + HDF_LOGI("%{public}s", __func__); if (HdfWorkQueueInit(&drvData->gravityWorkQueue, HDF_GRAVITY_WORK_QUEUE_NAME) != HDF_SUCCESS) { HDF_LOGE("%s: Gravity init work queue failed", __func__); return HDF_FAILURE; @@ -113,6 +121,7 @@ static int32_t InitGravityData(struct GravityDrvData *drvData) static int32_t SetGravityEnable(void) { + HDF_LOGI("%{public}s", __func__); int32_t ret; struct GravityDrvData *drvData = GravityGetDrvData(); @@ -142,6 +151,7 @@ static int32_t SetGravityEnable(void) static int32_t SetGravityDisable(void) { + HDF_LOGI("%{public}s", __func__); int32_t ret; struct GravityDrvData *drvData = GravityGetDrvData(); @@ -165,6 +175,7 @@ static int32_t SetGravityDisable(void) static int32_t SetGravityBatch(int64_t samplingInterval, int64_t interval) { + HDF_LOGI("%{public}s", __func__); (void)interval; int64_t ms; @@ -182,6 +193,7 @@ static int32_t SetGravityBatch(int64_t samplingInterval, int64_t interval) static int32_t SetGravityMode(int32_t mode) { + HDF_LOGI("%{public}s", __func__); if (mode <= SENSOR_WORK_MODE_DEFAULT || mode >= SENSOR_WORK_MODE_MAX) { HDF_LOGE("%s: The current mode is not supported", __func__); return HDF_FAILURE; @@ -192,6 +204,7 @@ static int32_t SetGravityMode(int32_t mode) static int32_t SetGravityOption(uint32_t option) { + HDF_LOGI("%{public}s", __func__); (void)option; return HDF_SUCCESS; } @@ -199,6 +212,7 @@ static int32_t SetGravityOption(uint32_t option) static int32_t DispatchGravity(struct HdfDeviceIoClient *client, int cmd, struct HdfSBuf *data, struct HdfSBuf *reply) { + HDF_LOGI("%{public}s", __func__); (void)client; (void)cmd; (void)data; @@ -209,6 +223,7 @@ static int32_t DispatchGravity(struct HdfDeviceIoClient *client, int32_t GravityBindDriver(struct HdfDeviceObject *device) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); struct GravityDrvData *drvData = (struct GravityDrvData *)OsalMemCalloc(sizeof(*drvData)); @@ -226,6 +241,7 @@ int32_t GravityBindDriver(struct HdfDeviceObject *device) static int32_t InitGravityOps(struct SensorCfgData *config, struct SensorDeviceInfo *deviceInfo) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN_VALUE(config, HDF_ERR_INVALID_PARAM); deviceInfo->ops.Enable = SetGravityEnable; @@ -250,6 +266,7 @@ static int32_t InitGravityOps(struct SensorCfgData *config, struct SensorDeviceI static int32_t InitGravityAfterBase(struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); struct SensorDeviceInfo deviceInfo; CHECK_NULL_PTR_RETURN_VALUE(config, HDF_ERR_INVALID_PARAM); @@ -267,6 +284,7 @@ static int32_t InitGravityAfterBase(struct SensorCfgData *config) static int32_t GravityCreateCfgData(const struct DeviceResourceNode *node) { + HDF_LOGI("%{public}s", __func__); struct GravityDrvData *drvData = GravityGetDrvData(); CHECK_NULL_PTR_RETURN_VALUE(node, HDF_ERR_INVALID_PARAM); @@ -287,6 +305,7 @@ static int32_t GravityCreateCfgData(const struct DeviceResourceNode *node) int32_t GravityInitDriver(struct HdfDeviceObject *device) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); struct GravityDrvData *drvData = (struct GravityDrvData *)device->service; CHECK_NULL_PTR_RETURN_VALUE(drvData, HDF_ERR_INVALID_PARAM); @@ -313,6 +332,7 @@ int32_t GravityInitDriver(struct HdfDeviceObject *device) void GravityReleaseDriver(struct HdfDeviceObject *device) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN(device); struct GravityDrvData *drvData = (struct GravityDrvData *)device->service; diff --git a/framework/model/sensor/driver/common/src/sensor_config_controller.c b/framework/model/sensor/driver/common/src/sensor_config_controller.c index da5b05ae9..ce4c20b0c 100644 --- a/framework/model/sensor/driver/common/src/sensor_config_controller.c +++ b/framework/model/sensor/driver/common/src/sensor_config_controller.c @@ -13,9 +13,14 @@ #include "sensor_platform_if.h" #define HDF_LOG_TAG khdf_sensor_common_driver +#ifdef LOG_DOMAIN +#undef LOG_DOMAIN +#endif +#define LOG_DOMAIN 0xD002516 static int32_t SensorOpsNop(struct SensorBusCfg *busCfg, struct SensorRegCfg *cfgItem) { + HDF_LOGI("%{public}s", __func__); (void)busCfg; (void)cfgItem; return HDF_SUCCESS; @@ -23,6 +28,7 @@ static int32_t SensorOpsNop(struct SensorBusCfg *busCfg, struct SensorRegCfg *cf static int32_t SensorOpsRead(struct SensorBusCfg *busCfg, struct SensorRegCfg *cfgItem) { + HDF_LOGI("%{public}s", __func__); uint16_t value = 0; int32_t ret; @@ -34,6 +40,7 @@ static int32_t SensorOpsRead(struct SensorBusCfg *busCfg, struct SensorRegCfg *c static uint32_t GetSensorRegRealValueMask(struct SensorRegCfg *cfgItem, uint32_t *value, uint32_t busMask) { + HDF_LOGI("%{public}s", __func__); uint32_t mask = cfgItem->mask & busMask; *value = cfgItem->value & busMask; @@ -52,6 +59,7 @@ static uint32_t GetSensorRegRealValueMask(struct SensorRegCfg *cfgItem, uint32_t static int32_t SensorOpsWrite(struct SensorBusCfg *busCfg, struct SensorRegCfg *cfgItem) { + HDF_LOGI("%{public}s", __func__); uint8_t value[SENSOR_SHORT_VALUE_BUTT]; int32_t ret; uint32_t originValue; @@ -91,6 +99,7 @@ static int32_t SensorOpsWrite(struct SensorBusCfg *busCfg, struct SensorRegCfg * static int32_t SensorOpsReadCheck(struct SensorBusCfg *busCfg, struct SensorRegCfg *cfgItem) { + HDF_LOGI("%{public}s", __func__); uint32_t value = 0; uint32_t originValue; uint32_t mask; @@ -115,6 +124,7 @@ static int32_t SensorOpsReadCheck(struct SensorBusCfg *busCfg, struct SensorRegC static int32_t SensorBitwiseCalculate(struct SensorRegCfg *cfgItem, uint32_t *value, uint32_t valueMask) { + HDF_LOGI("%{public}s", __func__); uint32_t originValue; uint32_t mask; uint32_t tmp; @@ -149,6 +159,7 @@ static int32_t SensorBitwiseCalculate(struct SensorRegCfg *cfgItem, uint32_t *va static int32_t SensorOpsUpdateBitwise(struct SensorBusCfg *busCfg, struct SensorRegCfg *cfgItem) { + HDF_LOGI("%{public}s", __func__); uint32_t value = 0; uint32_t busMask = 0x000000ff; int32_t ret; @@ -176,6 +187,7 @@ static int32_t SensorOpsUpdateBitwise(struct SensorBusCfg *busCfg, struct Sensor static int32_t SensorOpsExtBuffRead(struct SensorBusCfg *busCfg, struct SensorRegCfg *cfgItem) { + HDF_LOGI("%{public}s", __func__); int32_t ret; CHECK_NULL_PTR_RETURN_VALUE(busCfg, HDF_FAILURE); @@ -192,6 +204,7 @@ static int32_t SensorOpsExtBuffRead(struct SensorBusCfg *busCfg, struct SensorRe static int32_t SensorOpsExtBuffWrite(struct SensorBusCfg *busCfg, struct SensorRegCfg *cfgItem) { + HDF_LOGI("%{public}s", __func__); int32_t ret; uint8_t *value = NULL; @@ -235,6 +248,7 @@ static struct SensorOpsCall g_doOpsCall[] = { int32_t SetSensorRegCfgArray(struct SensorBusCfg *busCfg, const struct SensorRegCfgGroupNode *group) { + HDF_LOGI("%{public}s", __func__); int32_t num = 0; uint32_t count; struct SensorRegCfg *cfgItem = NULL; @@ -274,6 +288,7 @@ int32_t SetSensorRegCfgArray(struct SensorBusCfg *busCfg, const struct SensorReg int32_t SetSensorRegCfgArrayByBuff(struct SensorBusCfg *busCfg, const struct SensorRegCfgGroupNode *group, uint8_t *buff, int16_t len) { + HDF_LOGI("%{public}s", __func__); int32_t num = 0; uint32_t count; uint8_t buffOffset = 0; @@ -319,6 +334,7 @@ int32_t SetSensorRegCfgArrayByBuff(struct SensorBusCfg *busCfg, const struct Sen int32_t ReadSensorRegCfgArray(struct SensorBusCfg *busCfg, const struct SensorRegCfgGroupNode *group, int32_t index, uint8_t *buf, int32_t len) { + HDF_LOGI("%{public}s", __func__); int32_t ret; struct SensorRegCfg *cfgItem = NULL; @@ -343,6 +359,7 @@ int32_t ReadSensorRegCfgArray(struct SensorBusCfg *busCfg, const struct SensorRe int32_t WriteSensorRegCfgArray(struct SensorBusCfg *busCfg, const struct SensorRegCfgGroupNode *group, int32_t index, int32_t len) { + HDF_LOGI("%{public}s", __func__); struct SensorRegCfg *cfgItem = NULL; CHECK_NULL_PTR_RETURN_VALUE(busCfg, HDF_FAILURE); diff --git a/framework/model/sensor/driver/common/src/sensor_config_parser.c b/framework/model/sensor/driver/common/src/sensor_config_parser.c index 98c89b07c..4f458ad83 100755 --- a/framework/model/sensor/driver/common/src/sensor_config_parser.c +++ b/framework/model/sensor/driver/common/src/sensor_config_parser.c @@ -13,6 +13,10 @@ #include "sensor_platform_if.h" #define HDF_LOG_TAG khdf_sensor_common_driver +#ifdef LOG_DOMAIN +#undef LOG_DOMAIN +#endif +#define LOG_DOMAIN 0xD002516 static char *g_sensorRegGroupName[SENSOR_GROUP_MAX] = { "initSeqConfig", @@ -22,6 +26,7 @@ static char *g_sensorRegGroupName[SENSOR_GROUP_MAX] = { static uint32_t GetSensorRegGroupNameIndex(const char *name) { + HDF_LOGI("%{public}s", __func__); uint32_t index; if (name == NULL) { @@ -39,6 +44,7 @@ static uint32_t GetSensorRegGroupNameIndex(const char *name) void ReleaseSensorAllRegConfig(struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); int32_t index; if (config == NULL || config->regCfgGroup == NULL) { @@ -60,6 +66,7 @@ void ReleaseSensorAllRegConfig(struct SensorCfgData *config) static int32_t ParseSensorRegItem(struct DeviceResourceIface *parser, const struct DeviceResourceNode *regNode, const char *groupName, struct SensorRegCfgGroupNode *group) { + HDF_LOGI("%{public}s", __func__); int32_t ret; int32_t step; uint32_t index; @@ -110,6 +117,7 @@ static int32_t ParseSensorRegItem(struct DeviceResourceIface *parser, const stru int32_t ParseSensorRegGroup(struct DeviceResourceIface *parser, const struct DeviceResourceNode *regCfgNode, const char *groupName, struct SensorRegCfgGroupNode **groupNode) { + HDF_LOGI("%{public}s", __func__); int32_t num; struct SensorRegCfgGroupNode *group = NULL; @@ -157,6 +165,7 @@ int32_t ParseSensorRegGroup(struct DeviceResourceIface *parser, const struct Dev int32_t ParseSensorRegConfig(struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); uint32_t index; const struct DeviceResourceNode *regCfgNode = NULL; struct DeviceResourceIface *parser = NULL; @@ -196,6 +205,7 @@ error: static int32_t GetSensorI2cHandle(struct SensorBusCfg *busCfg) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN_VALUE(busCfg, HDF_ERR_INVALID_PARAM); int16_t busNum = busCfg->i2cCfg.busNum; busCfg->i2cCfg.handle = I2cOpen(busNum); @@ -210,6 +220,7 @@ static int32_t GetSensorI2cHandle(struct SensorBusCfg *busCfg) #if defined(LOSCFG_DRIVERS_HDF_PLATFORM_SPI) || defined(CONFIG_DRIVERS_HDF_PLATFORM_SPI) static int32_t GetSensorSpiHandle(struct SensorBusCfg *busCfg) { + HDF_LOGI("%{public}s", __func__); int32_t ret; struct SpiDevInfo spiDevinfo; CHECK_NULL_PTR_RETURN_VALUE (busCfg, HDF_ERR_INVALID_PARAM); @@ -231,6 +242,7 @@ static int32_t GetSensorSpiHandle(struct SensorBusCfg *busCfg) int32_t GetSensorBusHandle(struct SensorBusCfg *busCfg) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN_VALUE(busCfg, HDF_ERR_INVALID_PARAM); if (busCfg->busType == SENSOR_BUS_I2C) { @@ -246,6 +258,7 @@ int32_t GetSensorBusHandle(struct SensorBusCfg *busCfg) int32_t ReleaseSensorBusHandle(struct SensorBusCfg *busCfg) { + HDF_LOGI("%{public}s", __func__); if (busCfg == NULL) { return HDF_SUCCESS; } @@ -266,6 +279,7 @@ int32_t ReleaseSensorBusHandle(struct SensorBusCfg *busCfg) int32_t DetectSensorDevice(struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); uint8_t value = 0; uint16_t chipIdReg; uint16_t chipIdValue; @@ -303,6 +317,7 @@ int32_t DetectSensorDevice(struct SensorCfgData *config) static int32_t ParseSensorString(struct DeviceResourceIface *parser, const struct DeviceResourceNode *infoNode, struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); const char *name = NULL; int32_t ret = parser->GetString(infoNode, "sensorName", &name, NULL); @@ -339,6 +354,7 @@ static int32_t ParseSensorString(struct DeviceResourceIface *parser, const struc static int32_t ParseSensorValue(struct DeviceResourceIface *parser, const struct DeviceResourceNode *infoNode, struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); uint16_t id; int32_t value; int32_t ret = parser->GetUint16(infoNode, "sensorTypeId", &id, 0); @@ -370,6 +386,7 @@ static int32_t ParseSensorValue(struct DeviceResourceIface *parser, const struct static int32_t ParseSensorInfo(struct DeviceResourceIface *parser, const struct DeviceResourceNode *infoNode, struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); int32_t ret = ParseSensorString(parser, infoNode, config); CHECK_PARSER_RESULT_RETURN_VALUE(ret, "ParseSensorString"); @@ -381,6 +398,7 @@ static int32_t ParseSensorInfo(struct DeviceResourceIface *parser, const struct static int32_t ParseSensorSpiBus(struct DeviceResourceIface *parser, const struct DeviceResourceNode *spiBusNode, struct SensorBusCfg *busConfig) { + HDF_LOGI("%{public}s", __func__); int32_t ret; ret = parser->GetUint32(spiBusNode, "maxSpeedHz", &busConfig->spiCfg.spi.maxSpeedHz, 0); @@ -398,6 +416,7 @@ static int32_t ParseSensorSpiBus(struct DeviceResourceIface *parser, const struc static int32_t ParseSensorBus(struct DeviceResourceIface *parser, const struct DeviceResourceNode *busNode, struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); int32_t ret; const struct DeviceResourceNode *spiBusNode = NULL; @@ -436,6 +455,7 @@ static int32_t ParseSensorBus(struct DeviceResourceIface *parser, const struct D static int32_t ParseSensorAttr(struct DeviceResourceIface *parser, const struct DeviceResourceNode *attrNode, struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); int32_t ret; ret = parser->GetString(attrNode, "chipName", &config->sensorAttr.chipName, NULL); CHECK_PARSER_RESULT_RETURN_VALUE(ret, "chipName"); @@ -449,6 +469,7 @@ static int32_t ParseSensorAttr(struct DeviceResourceIface *parser, const struct void ReleaseSensorDirectionConfig(struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); CHECK_NULL_PTR_RETURN(config); if (config->direction != NULL) { @@ -459,6 +480,7 @@ void ReleaseSensorDirectionConfig(struct SensorCfgData *config) int32_t ParseSensorDirection(struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); int32_t num; int32_t ret; uint32_t index; @@ -512,6 +534,7 @@ int32_t ParseSensorDirection(struct SensorCfgData *config) int32_t SensorRawDataToRemapData(struct SensorDirection *direction, int32_t *remapData, uint32_t num) { + HDF_LOGI("%{public}s", __func__); uint32_t axis; int32_t directionSign[MAX_SENSOR_AXIS_NUM]; int32_t newData[MAX_SENSOR_AXIS_NUM]; @@ -544,6 +567,7 @@ int32_t SensorRawDataToRemapData(struct SensorDirection *direction, int32_t *rem int32_t GetSensorBaseConfigData(const struct DeviceResourceNode *node, struct SensorCfgData *config) { + HDF_LOGI("%{public}s", __func__); int32_t ret; struct DeviceResourceIface *parser = NULL; const struct DeviceResourceNode *infoNode = NULL; diff --git a/framework/model/sensor/driver/common/src/sensor_device_manager.c b/framework/model/sensor/driver/common/src/sensor_device_manager.c index 29cb6e4d1..2c0e8c0c6 100644 --- a/framework/model/sensor/driver/common/src/sensor_device_manager.c +++ b/framework/model/sensor/driver/common/src/sensor_device_manager.c @@ -13,6 +13,10 @@ #include "sensor_platform_if.h" #define HDF_LOG_TAG khdf_sensor_common_driver +#ifdef LOG_DOMAIN +#undef LOG_DOMAIN +#endif +#define LOG_DOMAIN 0xD002516 #define HDF_SENSOR_INFO_MAX_BUF (4 * 1024) // 4kB for all sensor info #define HDF_SENSOR_EVENT_MAX_BUF (4 * 1024) // 4kB @@ -26,6 +30,7 @@ static struct SensorDevMgrData *GetSensorDeviceManager(void) int32_t AddSensorDevice(const struct SensorDeviceInfo *deviceInfo) { + HDF_LOGI("%{public}s", __func__); struct SensorDevInfoNode *pos = NULL; struct SensorDevInfoNode *devInfoNode = NULL; struct SensorDevMgrData *manager = GetSensorDeviceManager(); @@ -63,6 +68,7 @@ int32_t AddSensorDevice(const struct SensorDeviceInfo *deviceInfo) int32_t DeleteSensorDevice(const struct SensorBasicInfo *sensorBaseInfo) { + HDF_LOGI("%{public}s", __func__); struct SensorDevInfoNode *pos = NULL; struct SensorDevInfoNode *tmp = NULL; struct SensorDevMgrData *manager = GetSensorDeviceManager(); @@ -87,6 +93,7 @@ int32_t DeleteSensorDevice(const struct SensorBasicInfo *sensorBaseInfo) int32_t ReportSensorEvent(const struct SensorReportEvent *events) { + HDF_LOGI("%{public}s", __func__); int32_t ret; struct SensorDevMgrData *manager = NULL; struct HdfSBuf *msg = NULL; @@ -130,6 +137,7 @@ EXIT: static int32_t GetAllSensorInfo(struct HdfSBuf *data, struct HdfSBuf *reply) { + HDF_LOGI("%{public}s", __func__); int32_t count = 0; struct SensorDevInfoNode *pos = NULL; struct SensorBasicInfo *sensorInfo = NULL; @@ -161,6 +169,7 @@ static int32_t GetAllSensorInfo(struct HdfSBuf *data, struct HdfSBuf *reply) static int32_t Enable(struct SensorDeviceInfo *deviceInfo, struct HdfSBuf *data, struct HdfSBuf *reply) { + HDF_LOGI("%{public}s", __func__); (void)data; (void)reply; CHECK_NULL_PTR_RETURN_VALUE(deviceInfo, HDF_ERR_INVALID_PARAM); @@ -170,6 +179,7 @@ static int32_t Enable(struct SensorDeviceInfo *deviceInfo, struct HdfSBuf *data, static int32_t Disable(struct SensorDeviceInfo *deviceInfo, struct HdfSBuf *data, struct HdfSBuf *reply) { + HDF_LOGI("%{public}s", __func__); (void)data; (void)reply; CHECK_NULL_PTR_RETURN_VALUE(deviceInfo, HDF_ERR_INVALID_PARAM); @@ -180,6 +190,7 @@ static int32_t Disable(struct SensorDeviceInfo *deviceInfo, struct HdfSBuf *data static int32_t SetBatch(struct SensorDeviceInfo *deviceInfo, struct HdfSBuf *data, struct HdfSBuf *reply) { + HDF_LOGI("%{public}s", __func__); int64_t samplingInterval; int64_t reportInterval; (void)reply; @@ -198,6 +209,7 @@ static int32_t SetBatch(struct SensorDeviceInfo *deviceInfo, struct HdfSBuf *dat static int32_t SetMode(struct SensorDeviceInfo *deviceInfo, struct HdfSBuf *data, struct HdfSBuf *reply) { + HDF_LOGI("%{public}s", __func__); int32_t mode; (void)reply; @@ -215,6 +227,7 @@ static int32_t SetMode(struct SensorDeviceInfo *deviceInfo, struct HdfSBuf *data static int32_t SetOption(struct SensorDeviceInfo *deviceInfo, struct HdfSBuf *data, struct HdfSBuf *reply) { + HDF_LOGI("%{public}s", __func__); uint32_t option; (void)reply; @@ -232,6 +245,7 @@ static int32_t SetOption(struct SensorDeviceInfo *deviceInfo, struct HdfSBuf *da static int32_t ReadData(struct SensorDeviceInfo *deviceInfo, struct HdfSBuf *data, struct HdfSBuf *reply) { + HDF_LOGI("%{public}s", __func__); struct SensorReportEvent events; CHECK_NULL_PTR_RETURN_VALUE(deviceInfo, HDF_ERR_INVALID_PARAM); @@ -268,6 +282,7 @@ static struct SensorCmdHandleList g_sensorCmdHandle[] = { static int32_t DispatchCmdHandle(struct SensorDeviceInfo *deviceInfo, struct HdfSBuf *data, struct HdfSBuf *reply) { + HDF_LOGI("%{public}s", __func__); int32_t opsCmd; int32_t loop; int32_t count; @@ -297,6 +312,7 @@ static int32_t DispatchCmdHandle(struct SensorDeviceInfo *deviceInfo, struct Hdf static int32_t DispatchSensor(struct HdfDeviceIoClient *client, int32_t cmd, struct HdfSBuf *data, struct HdfSBuf *reply) { + HDF_LOGI("%{public}s", __func__); struct SensorDevMgrData *manager = GetSensorDeviceManager(); struct SensorDevInfoNode *pos = NULL; int32_t sensorId; @@ -336,6 +352,7 @@ static int32_t DispatchSensor(struct HdfDeviceIoClient *client, int32_t BindSensorDevManager(struct HdfDeviceObject *device) { + HDF_LOGI("%{public}s", __func__); struct SensorDevMgrData *manager = NULL; CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); @@ -356,6 +373,7 @@ int32_t BindSensorDevManager(struct HdfDeviceObject *device) int32_t InitSensorDevManager(struct HdfDeviceObject *device) { + HDF_LOGI("%{public}s", __func__); struct SensorDevMgrData *manager = NULL; CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); @@ -384,6 +402,7 @@ int32_t InitSensorDevManager(struct HdfDeviceObject *device) void ReleaseSensorDevManager(struct HdfDeviceObject *device) { + HDF_LOGI("%{public}s", __func__); struct SensorDevInfoNode *pos = NULL; struct SensorDevInfoNode *tmp = NULL; struct SensorDevMgrData *manager = NULL; diff --git a/framework/model/sensor/driver/common/src/sensor_platform_if.c b/framework/model/sensor/driver/common/src/sensor_platform_if.c index 72e6d7adb..9736b6988 100644 --- a/framework/model/sensor/driver/common/src/sensor_platform_if.c +++ b/framework/model/sensor/driver/common/src/sensor_platform_if.c @@ -12,6 +12,10 @@ #include "osal_time.h" #define HDF_LOG_TAG khdf_sensor_common_driver +#ifdef LOG_DOMAIN +#undef LOG_DOMAIN +#endif +#define LOG_DOMAIN 0xD002516 #define I2C_READ_MSG_NUM 2 #define I2C_READ_MSG_ADDR_IDX 0 @@ -26,6 +30,7 @@ int32_t ReadSensor(struct SensorBusCfg *busCfg, uint16_t regAddr, uint8_t *data, uint16_t dataLen) { + HDF_LOGI("%{public}s", __func__); int index = 0; unsigned char regBuf[I2C_REG_BUF_LEN] = {0}; struct I2cMsg msg[I2C_READ_MSG_NUM]; @@ -75,6 +80,7 @@ int32_t ReadSensor(struct SensorBusCfg *busCfg, uint16_t regAddr, uint8_t *data, int32_t WriteSensor(struct SensorBusCfg *busCfg, uint8_t *writeData, uint16_t dataLen) { + HDF_LOGI("%{public}s", __func__); struct I2cMsg msg[I2C_WRITE_MSG_NUM]; CHECK_NULL_PTR_RETURN_VALUE(busCfg, HDF_FAILURE); @@ -107,6 +113,7 @@ int32_t WriteSensor(struct SensorBusCfg *busCfg, uint8_t *writeData, uint16_t da int32_t SetSensorPinMux(uint32_t regAddr, int32_t regSize, uint32_t regValue) { + HDF_LOGI("%{public}s", __func__); uint8_t *base = NULL; if (regAddr == 0) { HDF_LOGE("%s: regAddr invalid", __func__); -- Gitee From 404bae3bdbabaeeb1c1bdeefea4dddba49e683f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Fri, 12 Jul 2024 09:52:08 +0800 Subject: [PATCH 2/3] testStartOnce MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- .../adapter/syscall/src/hdf_syscall_adapter.c | 49 +++++++++++++++++++ interfaces/inner_api/utils/hdf_dlist.h | 13 +++++ 2 files changed, 62 insertions(+) diff --git a/framework/core/adapter/syscall/src/hdf_syscall_adapter.c b/framework/core/adapter/syscall/src/hdf_syscall_adapter.c index 53feb92c1..a64f31e77 100644 --- a/framework/core/adapter/syscall/src/hdf_syscall_adapter.c +++ b/framework/core/adapter/syscall/src/hdf_syscall_adapter.c @@ -28,6 +28,10 @@ #include "osal_time.h" #define HDF_LOG_TAG hdf_syscall_adapter +#ifdef LOG_DOMAIN +#undef LOG_DOMAIN +#endif +#define LOG_DOMAIN 0xD002516 #define EPOLL_MAX_EVENT_SIZE 4 #define HDF_DEFAULT_BWR_READ_SIZE 1024 #define EVENT_READ_BUFF_GROWTH_RATE 2 @@ -41,6 +45,7 @@ static bool HaveOnlyOneElement(const struct DListHead *head) { + HDF_LOGI("%{public}s", __func__); if (head->next != head && head->next->next == head) { return true; } @@ -50,6 +55,7 @@ static bool HaveOnlyOneElement(const struct DListHead *head) static int32_t HdfDevEventGrowReadBuffer(struct HdfWriteReadBuf *buffer) { + HDF_LOGI("%{public}s", __func__); size_t newSize = buffer->readSize; if (newSize > EVENT_READ_BUFF_MAX) { @@ -70,6 +76,7 @@ static int32_t HdfDevEventGrowReadBuffer(struct HdfWriteReadBuf *buffer) static struct HdfSyscallAdapter *HdfFdToAdapterLocked(const struct HdfDevListenerThread *thread, int32_t fd) { + HDF_LOGI("%{public}s", __func__); if (thread->adapter != NULL && thread->adapter->fd == fd) { return thread->adapter; } @@ -91,6 +98,7 @@ static struct HdfSyscallAdapter *HdfFdToAdapterLocked(const struct HdfDevListene static int32_t HdfDevEventDispatchLocked( const struct HdfDevListenerThread *thread, struct HdfSyscallAdapter *adapter, const struct HdfWriteReadBuf *bwr) { + HDF_LOGI("%{public}s", __func__); struct HdfDevEventlistener *listener = NULL; struct HdfSBuf *sbuf = NULL; @@ -135,6 +143,7 @@ static int32_t HdfDevEventDispatchLocked( static int32_t HdfDevEventReadAndDispatch(struct HdfDevListenerThread *thread, int32_t fd) { + HDF_LOGI("%{public}s", __func__); struct HdfWriteReadBuf bwr = {0}; int32_t ret = HDF_SUCCESS; @@ -188,6 +197,7 @@ FINISH: static int32_t AssignPfds(struct HdfDevListenerThread *thread, struct pollfd **pfds, uint16_t *pfdSize) { + HDF_LOGI("%{public}s", __func__); struct pollfd *pfdPtr = *pfds; uint16_t pfdCount = 0; @@ -221,6 +231,7 @@ static int32_t AssignPfds(struct HdfDevListenerThread *thread, struct pollfd **p static void SetThreadName(void) { + HDF_LOGI("%{public}s", __func__); char newTitle[THREAD_NAME_LEN_MAX] = {0}; int32_t tid = syscall(SYS_gettid); @@ -238,6 +249,7 @@ static void SetThreadName(void) #define POLL_WAIT_TIME_MS 100 static int32_t HdfDevEventListenTask(void *para) { + HDF_LOGI("%{public}s", __func__); struct HdfDevListenerThread *thread = (struct HdfDevListenerThread *)para; struct pollfd *pfds = NULL; uint16_t pfdSize = 0; @@ -293,6 +305,7 @@ EXIT: static int32_t HdfAdapterStartListenIoctl(int fd) { + HDF_LOGI("%{public}s", __func__); int32_t ret = ioctl(fd, HDF_LISTEN_EVENT_START, 0); if (ret) { HDF_LOGE("%{public}s: failed to notify drv(%{public}d) of start %{public}d %{public}s", @@ -305,6 +318,7 @@ static int32_t HdfAdapterStartListenIoctl(int fd) static int32_t HdfAdapterStopListenIoctl(int fd) { + HDF_LOGI("%{public}s", __func__); int32_t ret = ioctl(fd, HDF_LISTEN_EVENT_STOP, 0); if (ret) { HDF_LOGE("%{public}s: failed to notify drv(%{public}d) of stop %{public}d %{public}s", @@ -317,6 +331,7 @@ static int32_t HdfAdapterStopListenIoctl(int fd) static int32_t HdfAdapterExitListenIoctl(int fd) { + HDF_LOGI("%{public}s", __func__); int32_t ret = ioctl(fd, HDF_LISTEN_EVENT_EXIT, 0); if (ret) { HDF_LOGE("%{public}s: failed to notify drv(%{public}d) of exit %{public}d %{public}s", @@ -329,6 +344,7 @@ static int32_t HdfAdapterExitListenIoctl(int fd) static int32_t HdfDevListenerThreadDoInit(struct HdfDevListenerThread *thread) { + HDF_LOGI("%{public}s", __func__); if (OsalMutexInit(&thread->mutex) != HDF_SUCCESS) { HDF_LOGE("%{public}s: failed to create thread lock", __func__); return HDF_FAILURE; @@ -352,6 +368,7 @@ static int32_t HdfDevListenerThreadDoInit(struct HdfDevListenerThread *thread) static int32_t HdfDevListenerThreadInit(struct HdfDevListenerThread *thread) { + HDF_LOGI("%{public}s", __func__); switch (thread->status) { case LISTENER_STARTED: // fall-through case LISTENER_RUNNING: // fall-through @@ -373,6 +390,7 @@ static int32_t HdfDevListenerThreadInit(struct HdfDevListenerThread *thread) static int32_t GetValidPfdIndexLocked(struct HdfDevListenerThread *thread, struct HdfSyscallAdapter *adapter) { + HDF_LOGI("%{public}s", __func__); uint32_t index = 0; struct pollfd *pfds = thread->pfds; for (; index < thread->pfdSize; index++) { @@ -410,6 +428,7 @@ static int32_t GetValidPfdIndexLocked(struct HdfDevListenerThread *thread, struc static int32_t HdfAddAdapterToPfds(struct HdfDevListenerThread *thread, struct HdfSyscallAdapter *adapter) { + HDF_LOGI("%{public}s", __func__); int32_t index = GetValidPfdIndexLocked(thread, adapter); if (index < 0) { return HDF_ERR_MALLOC_FAIL; @@ -424,6 +443,7 @@ static int32_t HdfAddAdapterToPfds(struct HdfDevListenerThread *thread, struct H static int32_t HdfListenThreadInitPollFds(struct HdfDevListenerThread *thread) { + HDF_LOGI("%{public}s", __func__); struct HdfSyscallAdapter *adapter = NULL; if (thread->adapterListPtr != NULL) { DLIST_FOR_EACH_ENTRY(adapter, thread->adapterListPtr, struct HdfSyscallAdapter, listNode) { @@ -442,6 +462,7 @@ static int32_t HdfListenThreadInitPollFds(struct HdfDevListenerThread *thread) static int32_t HdfDevListenerThreadStart(struct HdfDevListenerThread *thread) { + HDF_LOGI("%{public}s", __func__); if (thread->status >= LISTENER_STARTED) { return HDF_SUCCESS; } @@ -487,6 +508,7 @@ static int32_t HdfDevListenerThreadStart(struct HdfDevListenerThread *thread) static struct HdfDevListenerThread *HdfDevListenerThreadObtain(void) { + HDF_LOGI("%{public}s", __func__); struct HdfDevListenerThread *thread = OsalMemCalloc(sizeof(struct HdfDevListenerThread)); if (thread == NULL) { return NULL; @@ -501,6 +523,7 @@ static struct HdfDevListenerThread *HdfDevListenerThreadObtain(void) static int32_t HdfIoServiceGroupThreadInit(struct HdfSyscallAdapterGroup *group) { + HDF_LOGI("%{public}s", __func__); if (group->thread == NULL) { struct HdfDevListenerThread *listenerThread = HdfDevListenerThreadObtain(); if (listenerThread == NULL) { @@ -515,6 +538,7 @@ static int32_t HdfIoServiceGroupThreadInit(struct HdfSyscallAdapterGroup *group) static int32_t HdfIoServiceGroupThreadStart(struct HdfSyscallAdapterGroup *group, int policy) { + HDF_LOGI("%{public}s", __func__); OsalMutexLock(&group->mutex); if (HdfIoServiceGroupThreadInit(group) != HDF_SUCCESS) { OsalMutexUnlock(&group->mutex); @@ -528,6 +552,7 @@ static int32_t HdfIoServiceGroupThreadStart(struct HdfSyscallAdapterGroup *group static int32_t HdfListenThreadPollAdd(struct HdfDevListenerThread *thread, struct HdfSyscallAdapter *adapter) { + HDF_LOGI("%{public}s", __func__); /* If thread is not bound to a service group, you do not need to add a poll. */ if (thread->adapterListPtr == NULL) { return HDF_SUCCESS; @@ -584,6 +609,7 @@ static int32_t HdfListenThreadPollAdd(struct HdfDevListenerThread *thread, struc static void HdfListenThreadPollDel(struct HdfDevListenerThread *thread, struct HdfSyscallAdapter *adapter) { + HDF_LOGI("%{public}s", __func__); if (thread == NULL) { DListRemove(&adapter->listNode); adapter->group = NULL; @@ -611,6 +637,7 @@ static void HdfListenThreadPollDel(struct HdfDevListenerThread *thread, struct H static void HdfDevListenerThreadFree(struct HdfDevListenerThread *thread) { + HDF_LOGI("%{public}s", __func__); OsalMutexDestroy(&thread->mutex); OsalMemFree(thread->pfds); OsalThreadDestroy(&thread->thread); @@ -619,6 +646,7 @@ static void HdfDevListenerThreadFree(struct HdfDevListenerThread *thread) static void HdfDevListenerThreadDestroy(struct HdfDevListenerThread *thread) { + HDF_LOGI("%{public}s", __func__); if (thread == NULL) { return; } @@ -673,6 +701,7 @@ static void HdfDevListenerThreadDestroy(struct HdfDevListenerThread *thread) static int32_t HdfSyscallAdapterDispatch( struct HdfObject *object, int32_t code, struct HdfSBuf *data, struct HdfSBuf *reply) { + HDF_LOGI("%{public}s", __func__); if (object == NULL) { HDF_LOGE("Input object is null"); return HDF_FAILURE; @@ -710,6 +739,7 @@ static int32_t HdfSyscallAdapterDispatch( static int TrytoLoadIoService(const char *serviceName, char *devNodePath, char *realPath) { + HDF_LOGI("%{public}s", __func__); if (HdfLoadDriverByServiceName(serviceName) != HDF_SUCCESS) { HDF_LOGE("%{public}s: load %{public}s driver failed", __func__, serviceName); return HDF_DEV_ERR_NO_DEVICE; @@ -730,6 +760,7 @@ static int TrytoLoadIoService(const char *serviceName, char *devNodePath, char * struct HdfIoService *HdfIoServiceAdapterObtain(const char *serviceName) { + HDF_LOGI("%{public}s", __func__); struct HdfSyscallAdapter *adapter = NULL; struct HdfIoService *ioService = NULL; char *nodePath = NULL; @@ -789,6 +820,7 @@ OUT: void HdfIoServiceAdapterRecycle(struct HdfIoService *service) { + HDF_LOGI("%{public}s", __func__); struct HdfSyscallAdapter *adapter = (struct HdfSyscallAdapter *)service; if (adapter != NULL) { HdfDevListenerThreadDestroy(adapter->thread); @@ -804,6 +836,7 @@ void HdfIoServiceAdapterRecycle(struct HdfIoService *service) static int32_t HdfIoServiceThreadBindLocked(struct HdfSyscallAdapter *adapter) { + HDF_LOGI("%{public}s", __func__); if (adapter->thread == NULL) { struct HdfDevListenerThread *listenerthread = HdfDevListenerThreadObtain(); if (listenerthread == NULL) { @@ -817,6 +850,7 @@ static int32_t HdfIoServiceThreadBindLocked(struct HdfSyscallAdapter *adapter) static int32_t HdfIoServiceStartListen(struct HdfSyscallAdapter *adapter, int policy) { + HDF_LOGI("%{public}s", __func__); if (HdfIoServiceThreadBindLocked(adapter) != HDF_SUCCESS) { HDF_LOGE("%{public}s: Failed to bind a thread to SyscallAdapter", __func__); return HDF_FAILURE; @@ -828,6 +862,7 @@ static int32_t HdfIoServiceStartListen(struct HdfSyscallAdapter *adapter, int po static bool AddListenerToAdapterLocked(struct HdfSyscallAdapter *adapter, struct HdfDevEventlistener *listener) { + HDF_LOGI("%{public}s", __func__); struct HdfDevEventlistener *it = NULL; DLIST_FOR_EACH_ENTRY(it, &adapter->listenerList, struct HdfDevEventlistener, listNode) { if (it == listener) { @@ -842,6 +877,7 @@ static bool AddListenerToAdapterLocked(struct HdfSyscallAdapter *adapter, struct int32_t HdfDeviceRegisterEventListenerWithSchedPolicy( struct HdfIoService *target, struct HdfDevEventlistener *listener, int policy) { + HDF_LOGI("%{public}s", __func__); if (target == NULL || listener == NULL) { return HDF_ERR_INVALID_PARAM; } @@ -883,11 +919,13 @@ int32_t HdfDeviceRegisterEventListenerWithSchedPolicy( int32_t HdfDeviceRegisterEventListener(struct HdfIoService *target, struct HdfDevEventlistener *listener) { + HDF_LOGI("%{public}s", __func__); return HdfDeviceRegisterEventListenerWithSchedPolicy(target, listener, SCHED_OTHER); } int32_t HdfDeviceUnregisterEventListener(struct HdfIoService *target, struct HdfDevEventlistener *listener) { + HDF_LOGI("%{public}s", __func__); if (target == NULL || listener == NULL) { return HDF_ERR_INVALID_PARAM; } @@ -913,6 +951,7 @@ int32_t HdfDeviceUnregisterEventListener(struct HdfIoService *target, struct Hdf struct HdfIoServiceGroup *HdfIoServiceGroupObtain(void) { + HDF_LOGI("%{public}s", __func__); struct HdfSyscallAdapterGroup *adapterGroup = OsalMemCalloc(sizeof(struct HdfSyscallAdapterGroup)); if (adapterGroup == NULL) { return NULL; @@ -929,6 +968,7 @@ struct HdfIoServiceGroup *HdfIoServiceGroupObtain(void) void HdfIoServiceGroupRecycle(struct HdfIoServiceGroup *group) { + HDF_LOGI("%{public}s", __func__); if (group == NULL) { return; } @@ -955,6 +995,7 @@ void HdfIoServiceGroupRecycle(struct HdfIoServiceGroup *group) int32_t HdfIoServiceGroupRegisterListenerWithSchedPolicy( struct HdfIoServiceGroup *group, struct HdfDevEventlistener *listener, int policy) { + HDF_LOGI("%{public}s", __func__); if (group == NULL || listener == NULL) { return HDF_ERR_INVALID_PARAM; } @@ -1006,11 +1047,13 @@ FINISH: int32_t HdfIoServiceGroupRegisterListener(struct HdfIoServiceGroup *group, struct HdfDevEventlistener *listener) { + HDF_LOGI("%{public}s", __func__); return HdfIoServiceGroupRegisterListenerWithSchedPolicy(group, listener, SCHED_OTHER); } static int32_t GetListenerCount(struct HdfDevListenerThread *thread) { + HDF_LOGI("%{public}s", __func__); struct HdfDevEventlistener *listener = NULL; int32_t count = 0; @@ -1036,6 +1079,7 @@ static int32_t GetListenerCount(struct HdfDevListenerThread *thread) int32_t HdfIoServiceGroupUnregisterListener(struct HdfIoServiceGroup *group, struct HdfDevEventlistener *listener) { + HDF_LOGI("%{public}s", __func__); if (group == NULL || listener == NULL) { return HDF_ERR_INVALID_PARAM; } @@ -1063,6 +1107,7 @@ int32_t HdfIoServiceGroupUnregisterListener(struct HdfIoServiceGroup *group, str int32_t HdfIoServiceGroupAddService(struct HdfIoServiceGroup *group, struct HdfIoService *service) { + HDF_LOGI("%{public}s", __func__); if (group == NULL || service == NULL) { return HDF_ERR_INVALID_PARAM; } @@ -1115,6 +1160,7 @@ int32_t HdfIoServiceGroupAddService(struct HdfIoServiceGroup *group, struct HdfI void HdfIoServiceGroupRemoveService(struct HdfIoServiceGroup *group, struct HdfIoService *service) { + HDF_LOGI("%{public}s", __func__); if (group == NULL || service == NULL) { return; } @@ -1139,6 +1185,7 @@ void HdfIoServiceGroupRemoveService(struct HdfIoServiceGroup *group, struct HdfI int HdfIoserviceGetListenerCount(const struct HdfIoService *service) { + HDF_LOGI("%{public}s", __func__); if (service == NULL) { return 0; } @@ -1153,6 +1200,7 @@ int HdfIoserviceGetListenerCount(const struct HdfIoService *service) int HdfIoserviceGroupGetListenerCount(const struct HdfIoServiceGroup *group) { + HDF_LOGI("%{public}s", __func__); if (group == NULL) { return 0; } @@ -1170,6 +1218,7 @@ int HdfIoserviceGroupGetListenerCount(const struct HdfIoServiceGroup *group) int HdfIoserviceGroupGetServiceCount(const struct HdfIoServiceGroup *group) { + HDF_LOGI("%{public}s", __func__); if (group == NULL) { return 0; } diff --git a/interfaces/inner_api/utils/hdf_dlist.h b/interfaces/inner_api/utils/hdf_dlist.h index e4db08549..b3c71b439 100644 --- a/interfaces/inner_api/utils/hdf_dlist.h +++ b/interfaces/inner_api/utils/hdf_dlist.h @@ -33,6 +33,12 @@ #define HDF_LIST_H #include "hdf_base.h" +#include "hdf_log.h" + +#ifdef LOG_DOMAIN +#undef LOG_DOMAIN +#endif +#define LOG_DOMAIN 0xD002516 #ifdef __cplusplus extern "C" { @@ -55,6 +61,7 @@ struct DListHead { */ static inline void DListHeadInit(struct DListHead *head) { + HDF_LOGI("%{public}s", __func__); head->next = head; head->prev = head; } @@ -68,6 +75,7 @@ static inline void DListHeadInit(struct DListHead *head) */ static inline bool DListIsEmpty(const struct DListHead *head) { + HDF_LOGI("%{public}s", __func__); return (head->next == head) ? true : false; } /** @@ -80,6 +88,7 @@ static inline bool DListIsEmpty(const struct DListHead *head) */ static inline void DListRemove(struct DListHead *entry) { + HDF_LOGI("%{public}s", __func__); entry->prev->next = entry->next; entry->next->prev = entry->prev; @@ -98,6 +107,7 @@ static inline void DListRemove(struct DListHead *entry) */ static inline void DListInsertHead(struct DListHead *entry, struct DListHead *head) { + HDF_LOGI("%{public}s", __func__); entry->next = head->next; entry->prev = head; @@ -116,6 +126,7 @@ static inline void DListInsertHead(struct DListHead *entry, struct DListHead *he */ static inline void DListInsertTail(struct DListHead *entry, struct DListHead *head) { + HDF_LOGI("%{public}s", __func__); entry->next = head; entry->prev = head->prev; @@ -134,6 +145,7 @@ static inline void DListInsertTail(struct DListHead *entry, struct DListHead *he */ static inline void DListMerge(struct DListHead *list, struct DListHead *head) { + HDF_LOGI("%{public}s", __func__); list->next->prev = head; list->prev->next = head->next; @@ -152,6 +164,7 @@ static inline void DListMerge(struct DListHead *list, struct DListHead *head) */ static inline int DListGetCount(const struct DListHead *head) { + HDF_LOGI("%{public}s", __func__); struct DListHead *next = head->next; int count = 0; while (next != head) { -- Gitee From 93be04606692939a5b302a6f8dea39b6c8d4faa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Fri, 12 Jul 2024 11:33:43 +0800 Subject: [PATCH 3/3] testStartOnce MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- interfaces/inner_api/utils/hdf_dlist.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/interfaces/inner_api/utils/hdf_dlist.h b/interfaces/inner_api/utils/hdf_dlist.h index b3c71b439..e4db08549 100644 --- a/interfaces/inner_api/utils/hdf_dlist.h +++ b/interfaces/inner_api/utils/hdf_dlist.h @@ -33,12 +33,6 @@ #define HDF_LIST_H #include "hdf_base.h" -#include "hdf_log.h" - -#ifdef LOG_DOMAIN -#undef LOG_DOMAIN -#endif -#define LOG_DOMAIN 0xD002516 #ifdef __cplusplus extern "C" { @@ -61,7 +55,6 @@ struct DListHead { */ static inline void DListHeadInit(struct DListHead *head) { - HDF_LOGI("%{public}s", __func__); head->next = head; head->prev = head; } @@ -75,7 +68,6 @@ static inline void DListHeadInit(struct DListHead *head) */ static inline bool DListIsEmpty(const struct DListHead *head) { - HDF_LOGI("%{public}s", __func__); return (head->next == head) ? true : false; } /** @@ -88,7 +80,6 @@ static inline bool DListIsEmpty(const struct DListHead *head) */ static inline void DListRemove(struct DListHead *entry) { - HDF_LOGI("%{public}s", __func__); entry->prev->next = entry->next; entry->next->prev = entry->prev; @@ -107,7 +98,6 @@ static inline void DListRemove(struct DListHead *entry) */ static inline void DListInsertHead(struct DListHead *entry, struct DListHead *head) { - HDF_LOGI("%{public}s", __func__); entry->next = head->next; entry->prev = head; @@ -126,7 +116,6 @@ static inline void DListInsertHead(struct DListHead *entry, struct DListHead *he */ static inline void DListInsertTail(struct DListHead *entry, struct DListHead *head) { - HDF_LOGI("%{public}s", __func__); entry->next = head; entry->prev = head->prev; @@ -145,7 +134,6 @@ static inline void DListInsertTail(struct DListHead *entry, struct DListHead *he */ static inline void DListMerge(struct DListHead *list, struct DListHead *head) { - HDF_LOGI("%{public}s", __func__); list->next->prev = head; list->prev->next = head->next; @@ -164,7 +152,6 @@ static inline void DListMerge(struct DListHead *list, struct DListHead *head) */ static inline int DListGetCount(const struct DListHead *head) { - HDF_LOGI("%{public}s", __func__); struct DListHead *next = head->next; int count = 0; while (next != head) { -- Gitee