这篇教程C++ ssp_spi_sync函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ssp_spi_sync函数的典型用法代码示例。如果您正苦于以下问题:C++ ssp_spi_sync函数的具体用法?C++ ssp_spi_sync怎么用?C++ ssp_spi_sync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ssp_spi_sync函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: k330_gyro_get_tempchar k330_gyro_get_temp(struct ssp_data *data){ char chTemp = 0; int iRet = 0; struct ssp_msg *msg; if (!(data->uSensorState & (1 << GYROSCOPE_SENSOR))) goto exit; msg = kzalloc(sizeof(*msg), GFP_KERNEL); msg->cmd = GYROSCOPE_TEMP_FACTORY; msg->length = 1; msg->options = AP2HUB_READ; msg->buffer = &chTemp; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 3000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Gyro Temp Timeout!!/n", __func__); goto exit; } ssp_dbg("[SSP]: %s - %d/n", __func__, chTemp);exit: return chTemp;}
开发者ID:davidmueller13,项目名称:davidskernel_lt03lte_tw_5.1.1,代码行数:28,
示例2: temphumidity_crc_checkstatic ssize_t temphumidity_crc_check(struct device *dev, struct device_attribute *attr, char *buf){ char chTempBuf = 0xff; int iRet = 0; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); msg->cmd = TEMPHUMIDITY_CRC_FACTORY; msg->length = 1; msg->options = AP2HUB_READ; msg->buffer = &chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 1000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Temphumidity check crc Timeout!! %d/n", __func__, iRet); goto exit; } pr_info("[SSP] : %s -Check_CRC : %d/n", __func__, chTempBuf); exit: if (chTempBuf == 1) return sprintf(buf, "%s/n", "OK"); else if (chTempBuf == 2) return sprintf(buf, "%s/n", "NG_NC"); else return sprintf(buf, "%s/n", "NG");}
开发者ID:GalaxyTab4,项目名称:android_kernel_samsung_matissewifi.bak,代码行数:33,
示例3: mpu6500_gyro_get_tempshort mpu6500_gyro_get_temp(struct ssp_data *data){ char chTempBuf[2] = { 0}; unsigned char reg[2]; short temperature = 0; int iRet = 0; struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); goto exit; } msg->cmd = GYROSCOPE_TEMP_FACTORY; msg->length = 2; msg->options = AP2HUB_READ; msg->buffer = chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 3000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Gyro Temp Timeout!!/n", __func__); goto exit; } reg[0] = chTempBuf[1]; reg[1] = chTempBuf[0]; temperature = (short) (((reg[0]) << 8) | reg[1]); ssp_dbg("[SSP]: %s - %d/n", __func__, temperature); exit: return temperature;}
开发者ID:BigBot96,项目名称:android_kernel_samsung_gts2wifi,代码行数:33,
示例4: ssp_temp_taskvoid ssp_temp_task(struct work_struct *work) { struct ssp_big *big; struct ssp_msg *msg; char *buffer; int buf_len, packet_len, residue, iRet = 0, index = 0, i = 0, buffindex = 0; big = container_of(work, struct ssp_big, work); buf_len = big->length > DATA_PACKET_SIZE ? DATA_PACKET_SIZE : big->length; buffer = kzalloc(buf_len, GFP_KERNEL); residue = big->length; mutex_lock(&big->data->bulk_temp_read_lock); if (big->data->bulk_buffer == NULL) big->data->bulk_buffer = kzalloc(sizeof(struct shtc1_buffer), GFP_KERNEL); big->data->bulk_buffer->len = big->length / 12; while (residue > 0) { packet_len = residue > DATA_PACKET_SIZE ? DATA_PACKET_SIZE : residue; msg = kzalloc(sizeof(*msg), GFP_KERNEL); msg->cmd = MSG2SSP_AP_GET_BIG_DATA; msg->length = packet_len; msg->options = AP2HUB_READ | (index++ << SSP_INDEX); msg->data = big->addr; msg->buffer = buffer; msg->free_buffer = 0; iRet = ssp_spi_sync(big->data, msg, 1000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Fail to receive data %d/n", __func__, iRet); break; } // 12 = 1 chunk size for ks79.shin // order is thermistor Bat, thermistor PA, Temp, Humidity, Baro, Gyro // each data consist of 2bytes i = 0; while (packet_len - i >= 12) { ssp_dbg("[SSP]: %s %d %d %d %d %d %d", __func__, *((s16 *) (buffer + i + 0)), *((s16 *) (buffer + i + 2)), *((s16 *) (buffer + i + 4)), *((s16 *) (buffer + i + 6)), *((s16 *) (buffer + i + 8)), *((s16 *) (buffer +i + 10))); big->data->bulk_buffer->batt[buffindex] = *((u16 *) (buffer + i + 0)); big->data->bulk_buffer->chg[buffindex] = *((u16 *) (buffer + i + 2)); big->data->bulk_buffer->temp[buffindex] = *((s16 *) (buffer + i + 4)); big->data->bulk_buffer->humidity[buffindex] = *((u16 *) (buffer + i + 6)); big->data->bulk_buffer->baro[buffindex] = *((s16 *) (buffer + i + 8)); big->data->bulk_buffer->gyro[buffindex] = *((s16 *) (buffer + i + 10)); buffindex++; i += 12; } residue -= packet_len; } if (iRet == SUCCESS) report_bulk_comp_data(big->data); mutex_unlock(&big->data->bulk_temp_read_lock); kfree(buffer); kfree(big); ssp_dbg("[SSP]: %s done/n", __func__);}
开发者ID:ench0,项目名称:android_kernel_samsung_hltet,代码行数:60,
示例5: hub_thm_get_adcstatic int hub_thm_get_adc(struct ssp_data *data, u32 channel){ u32 adc = 0; int iRet = 0; struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); return ERROR; } msg->cmd = MSG2SSP_AP_GET_THERM; msg->length = 2; msg->options = AP2HUB_READ; msg->data = channel; msg->buffer = (char *) &adc; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 1000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - i2c fail %d/n", __func__, iRet); return iRet; } return adc;}
开发者ID:halaszk,项目名称:android_kernel_samsung_lt03,代码行数:25,
示例6: get_fuserom_dataint get_fuserom_data(struct ssp_data *data){ int ret = 0; char buffer[3] = { 0, }; struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); return -ENOMEM; } msg->cmd = MSG2SSP_AP_FUSEROM; msg->length = 3; msg->options = AP2HUB_READ; msg->buffer = buffer; msg->free_buffer = 0; ret = ssp_spi_sync(data, msg, 1000); if (ret) { data->uFuseRomData[0] = buffer[0]; data->uFuseRomData[1] = buffer[1]; data->uFuseRomData[2] = buffer[2]; } else { data->uFuseRomData[0] = 0; data->uFuseRomData[1] = 0; data->uFuseRomData[2] = 0; return FAIL; } pr_info("[SSP] FUSE ROM Data %d , %d, %d/n", data->uFuseRomData[0], data->uFuseRomData[1], data->uFuseRomData[2]); return SUCCESS;}
开发者ID:GAXUSXX,项目名称:G935FGaXusKernel2,代码行数:35,
示例7: bmi058_gyro_get_tempshort bmi058_gyro_get_temp(struct ssp_data *data){ char chTempBuf = 0; short temperature = 0; int iRet = 0; struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); return -ENOMEM; } msg->cmd = GYROSCOPE_TEMP_FACTORY; msg->length = 1; msg->options = AP2HUB_READ; msg->buffer = &chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 3000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Gyro Temp Timeout!!/n", __func__); goto exit; } temperature = (short)chTempBuf; ssp_dbg("[SSP]: %s - %d/n", __func__, temperature); exit: return temperature;}
开发者ID:MikeForeskin,项目名称:Vindicator-S6,代码行数:29,
示例8: get_grip_factory_datastatic int get_grip_factory_data(struct ssp_data *data, int cmd, char *buffer, int len){ struct ssp_msg *msg; int ret = 0; msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); return -ENOMEM; } msg->cmd = cmd; msg->options = AP2HUB_READ; msg->buffer = buffer; msg->length = len; msg->free_buffer = 0; ret = ssp_spi_sync(data, msg, SYNC_TIME); if (ret != SUCCESS) { pr_err("[SSP]: %s - %d CMD fail %d/n", __func__, cmd, ret); return -EIO; } return SUCCESS;}
开发者ID:GAXUSXX,项目名称:G935FGaXusKernel2,代码行数:27,
示例9: accel_hw_selftest_showstatic ssize_t accel_hw_selftest_show(struct device *dev, struct device_attribute *attr, char *buf){ char chTempBuf[8] = { 2, 0, }; s8 init_status = 0, result = -1; u16 diff_axis[3] = { 0, }; int iRet; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg; msg = kzalloc(sizeof(*msg), GFP_KERNEL); msg->cmd = ACCELEROMETER_FACTORY; msg->length = sizeof(chTempBuf); msg->options = AP2HUB_READ; msg->data = chTempBuf[0]; msg->buffer = chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 3000); if (iRet != SUCCESS) { pr_err("[SSP] %s - accel hw selftest Timeout!!/n", __func__); return sprintf(buf, "%d,%d,%d,%d/n", -5, 0, 0, 0); } init_status = chTempBuf[0]; diff_axis[0] = (s16)((chTempBuf[2] << 8) + chTempBuf[1]); diff_axis[1] = (s16)((chTempBuf[4] << 8) + chTempBuf[3]); diff_axis[2] = (s16)((chTempBuf[6] << 8) + chTempBuf[5]); result = chTempBuf[7]; pr_info("[SSP] %s - %d, %d, %d, %d, %d/n", __func__, init_status, result, diff_axis[0], diff_axis[1], diff_axis[2]); return sprintf(buf, "%d,%d,%d,%d/n", result, diff_axis[0], diff_axis[1], diff_axis[2]);}
开发者ID:friedrich420,项目名称:S6_AEL_Kernel_Multivariant_LL-5.1.1,代码行数:35,
示例10: mobeam_stop_setvoid mobeam_stop_set(struct ssp_data *data){ int iRet, iReties = 0; struct ssp_msg *msg; u8 buffer = 0;retries: msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP]: %s - failed to allocate memory/n", __func__); return; } msg->cmd = MSG2SSP_AP_MOBEAM_STOP; msg->length = 1; msg->options = AP2HUB_READ; msg->buffer = &buffer; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 1000); if (iRet != SUCCESS) { pr_err("[SSP] %s fail %d/n", __func__, iRet); if (iReties++ < 2) { pr_err("[SSP] %s fail, retry/n", __func__); mdelay(5); goto retries; } } else { is_beaming = BEAMING_OFF; pr_info("[SSP] %s - success(%u)/n", __func__, is_beaming); } return;}
开发者ID:MikeForeskin,项目名称:Vindicator-S6-MM,代码行数:33,
示例11: eeprom_check_showstatic ssize_t eeprom_check_show(struct device *dev, struct device_attribute *attr, char *buf){ char chTempBuf = 0; int iRet = 0; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); msg->cmd = PRESSURE_FACTORY; msg->length = 1; msg->options = AP2HUB_READ; msg->buffer = &chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 3000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Pressure Selftest Timeout!!/n", __func__); goto exit; } ssp_dbg("[SSP]: %s - %u/n", __func__, chTempBuf); exit: return snprintf(buf, PAGE_SIZE, "%d", chTempBuf);}
开发者ID:Svard73,项目名称:SM-T700-T705-Kernel,代码行数:26,
示例12: ssp_send_big_library_taskvoid ssp_send_big_library_task(struct work_struct *work){ struct ssp_big *big = container_of(work, struct ssp_big, work); struct ssp_sensorhub_data *hub_data = big->data->hub_data; struct ssp_msg *msg; int buf_len, residue = big->length, ret = 0, index = 0, pos = 0; while (residue > 0) { buf_len = residue > DATA_PACKET_SIZE ? DATA_PACKET_SIZE : residue; msg = kzalloc(sizeof(*msg), GFP_KERNEL); msg->cmd = MSG2SSP_AP_SET_BIG_DATA; msg->length = buf_len; msg->options = AP2HUB_WRITE | (index++ << SSP_INDEX); msg->data = big->addr; msg->buffer = hub_data->big_send_events.library_data + pos; msg->free_buffer = 0; ret = ssp_spi_sync(big->data, msg, 1000); if (ret != SUCCESS) { sensorhub_err("send big data err(%d)", ret); return; } pos += buf_len; residue -= buf_len; sensorhub_info("send big data (%5d / %5d)", pos, big->length); } complete(&hub_data->big_write_done);}
开发者ID:android-armv7a-belalang-tempur,项目名称:N900-Exynos-kernel-4.3,代码行数:33,
示例13: get_hw_offsetint get_hw_offset(struct ssp_data *data){ int iRet = 0; char buffer[3] = { 0, }; struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); msg->cmd = MSG2SSP_AP_GET_MAGNETIC_HWOFFSET; msg->length = 3; msg->options = AP2HUB_READ; msg->buffer = buffer; msg->free_buffer = 0; data->magoffset.x = 0; data->magoffset.y = 0; data->magoffset.z = 0; iRet = ssp_spi_sync(data, msg, 1000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - i2c fail %d/n", __func__, iRet); iRet = ERROR; } data->magoffset.x = buffer[0]; data->magoffset.y = buffer[1]; data->magoffset.z = buffer[2]; pr_info("[SSP]: %s: x: %d, y: %d, z: %d/n", __func__, (s8)data->magoffset.x, (s8)data->magoffset.y, (s8)data->magoffset.z); return iRet;}
开发者ID:StarKissed,项目名称:Note-4-AEL-Kernel,代码行数:33,
示例14: mcu_sleep_factorytest_storessize_t mcu_sleep_factorytest_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size){ struct ssp_data *data = dev_get_drvdata(dev); int iRet = 0; struct ssp_msg *msg; if (sysfs_streq(buf, "1")) { msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); return -ENOMEM; } msg->cmd = MCU_SLEEP_FACTORY; msg->length = FACTORY_DATA_MAX; msg->options = AP2HUB_READ; msg->buffer = buffer; msg->free_buffer = 0; // iRet = ssp_spi_async(data, msg); iRet = ssp_spi_sync(data, msg, 10000); } else { pr_err("[SSP]: %s - invalid value %d/n", __func__, *buf); return -EINVAL; } ssp_dbg("[SSP]: MCU Sleep Factory Test Start! - %d/n", iRet); return size;}
开发者ID:MikeForeskin,项目名称:Vindicator-S6-MM,代码行数:32,
示例15: gyro_selftest_dps_storestatic ssize_t gyro_selftest_dps_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count){ int iNewDps = 0; int iRet = 0; char chTempBuf = 0; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg; if (!(data->uSensorState & (1 << GYROSCOPE_SENSOR))) goto exit; msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); goto exit; } msg->cmd = GYROSCOPE_DPS_FACTORY; msg->length = 1; msg->options = AP2HUB_READ; msg->buffer = &chTempBuf; msg->free_buffer = 0; sscanf(buf, "%d", &iNewDps); if (iNewDps == GYROSCOPE_DPS250) msg->options |= 0 << SSP_GYRO_DPS; else if (iNewDps == GYROSCOPE_DPS500) msg->options |= 1 << SSP_GYRO_DPS; else if (iNewDps == GYROSCOPE_DPS2000) msg->options |= 2 << SSP_GYRO_DPS; else { msg->options |= 1 << SSP_GYRO_DPS; iNewDps = GYROSCOPE_DPS500; } iRet = ssp_spi_sync(data, msg, 3000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Gyro Selftest DPS Timeout!!/n", __func__); goto exit; } if (chTempBuf != SUCCESS) { pr_err("[SSP]: %s - Gyro Selftest DPS Error!!/n", __func__); goto exit; } data->uGyroDps = (unsigned int)iNewDps; pr_err("[SSP]: %s - %u dps stored/n", __func__, data->uGyroDps);exit: return count;}
开发者ID:MikeForeskin,项目名称:Vindicator-S6,代码行数:55,
示例16: magnetic_logging_showstatic ssize_t magnetic_logging_show(struct device *dev, struct device_attribute *attr, char *buf){ char buffer[21] = {0, }; int ret = 0; int logging_data[8] = {0, }; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg; msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); goto exit; } msg->cmd = MSG2SSP_AP_GEOMAG_LOGGING; msg->length = 21; msg->options = AP2HUB_READ; msg->buffer = buffer; msg->free_buffer = 0; ret = ssp_spi_sync(data, msg, 1000); if (ret != SUCCESS) { pr_err("[SSP] %s - Magnetic logging data Timeout!! %d/n", __func__, ret); goto exit; } logging_data[0] = buffer[0]; /* ST1 Reg */ logging_data[1] = (short)((buffer[3] << 8) + buffer[2]); logging_data[2] = (short)((buffer[5] << 8) + buffer[4]); logging_data[3] = (short)((buffer[7] << 8) + buffer[6]); logging_data[4] = buffer[1]; /* ST2 Reg */ logging_data[5] = (short)((buffer[9] << 8) + buffer[8]); logging_data[6] = (short)((buffer[11] << 8) + buffer[10]); logging_data[7] = (short)((buffer[13] << 8) + buffer[12]); return snprintf(buf, PAGE_SIZE, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d/n", logging_data[0], logging_data[1], logging_data[2], logging_data[3], logging_data[4], logging_data[5], logging_data[6], logging_data[7], data->uFuseRomData[0], data->uFuseRomData[1], data->uFuseRomData[2]);exit: return snprintf(buf, PAGE_SIZE, "-1,0,0,0,0,0,0,0,0,0,0/n");}
开发者ID:GAXUSXX,项目名称:G935FGaXusKernel2,代码行数:48,
示例17: accel_reactive_alert_storestatic ssize_t accel_reactive_alert_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size){ int iRet = 0; char chTempBuf = 1; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg; if (sysfs_streq(buf, "1")) ssp_dbg("[SSP]: %s - on/n", __func__); else if (sysfs_streq(buf, "0")) ssp_dbg("[SSP]: %s - off/n", __func__); else if (sysfs_streq(buf, "2")) { ssp_dbg("[SSP]: %s - factory/n", __func__); data->bAccelAlert = 0; msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); return -ENOMEM; } msg->cmd = ACCELEROMETER_FACTORY; msg->length = 1; msg->options = AP2HUB_READ; msg->data = chTempBuf; msg->buffer = &chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 3000); data->bAccelAlert = chTempBuf; if (iRet != SUCCESS) { pr_err("[SSP]: %s - accel Selftest Timeout!!/n", __func__); goto exit; } ssp_dbg("[SSP]: %s factory test success!/n", __func__); } else { pr_err("[SSP]: %s - invalid value %d/n", __func__, *buf); return -EINVAL; }exit: return size;}
开发者ID:zydroid,项目名称:kernel-g9208-s6,代码行数:46,
示例18: magnetic_check_cntlstatic ssize_t magnetic_check_cntl(struct device *dev, struct device_attribute *attr, char *strbuf){ bool bSuccess = false; int ret; char chTempBuf[22] = { 0, }; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg; if (!data->uMagCntlRegData) { bSuccess = true; } else { pr_info("[SSP] %s - check cntl register before selftest", __func__); msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); return -ENOMEM; } msg->cmd = GEOMAGNETIC_FACTORY; msg->length = 22; msg->options = AP2HUB_READ; msg->buffer = chTempBuf; msg->free_buffer = 0; ret = ssp_spi_sync(data, msg, 1000); if (ret != SUCCESS) { pr_err("[SSP] %s - spi sync failed due to Timeout!! %d/n", __func__, ret); } data->uMagCntlRegData = chTempBuf[21]; bSuccess = !data->uMagCntlRegData; } pr_info("[SSP] %s - CTRL : 0x%x/n", __func__, data->uMagCntlRegData); data->uMagCntlRegData = 1; /* reset the value */ return sprintf(strbuf, "%s,%d,%d,%d/n", (bSuccess ? "OK" : "NG"), (bSuccess ? 1 : 0), 0, 0);}
开发者ID:GAXUSXX,项目名称:G935FGaXusKernel2,代码行数:45,
示例19: accel_hw_selftest_showstatic ssize_t accel_hw_selftest_show(struct device *dev, struct device_attribute *attr, char *buf){ char chTempBuf[8] = { 2, 0, }; s8 init_status = 0, result = -1; s16 shift_ratio[3] = { 0, }; int iRet; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg; msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); goto exit; } msg->cmd = ACCELEROMETER_FACTORY; msg->length = 8; msg->options = AP2HUB_READ; msg->data = chTempBuf[0]; msg->buffer = chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 7000); if (iRet != SUCCESS) { pr_err("[SSP] %s - accel hw selftest Timeout!!/n", __func__); goto exit; } init_status = chTempBuf[0]; shift_ratio[0] = (s16)((chTempBuf[2] << 8) + chTempBuf[1]); shift_ratio[1] = (s16)((chTempBuf[4] << 8) + chTempBuf[3]); shift_ratio[2] = (s16)((chTempBuf[6] << 8) + chTempBuf[5]); result = chTempBuf[7]; pr_info("[SSP] %s - %d, %d, %d, %d, %d/n", __func__, init_status, result, shift_ratio[0], shift_ratio[1], shift_ratio[2]); return sprintf(buf, "%d,%d.%d,%d.%d,%d.%d/n", result, shift_ratio[0] / 10, shift_ratio[0] % 10, shift_ratio[1] / 10, shift_ratio[1] % 10, shift_ratio[2] / 10, shift_ratio[2] % 10);exit: return sprintf(buf, "%d,%d,%d,%d/n", -5, 0, 0, 0);}
开发者ID:zydroid,项目名称:kernel-g9208-s6,代码行数:44,
示例20: ssp_read_big_library_taskvoid ssp_read_big_library_task(struct work_struct *work){ struct ssp_big *big = container_of(work, struct ssp_big, work); struct ssp_sensorhub_data *hub_data = big->data->hub_data; struct ssp_msg *msg; int buf_len, residue, ret = 0, index = 0, pos = 0; mutex_lock(&hub_data->big_events_lock); if (hub_data->big_events.library_data) kfree(hub_data->big_events.library_data); residue = big->length; hub_data->big_events.library_length = big->length; hub_data->big_events.library_data = kzalloc(big->length, GFP_ATOMIC); while (residue > 0) { buf_len = residue > DATA_PACKET_SIZE ? DATA_PACKET_SIZE : residue; msg = kzalloc(sizeof(*msg), GFP_ATOMIC); msg->cmd = MSG2SSP_AP_GET_BIG_DATA; msg->length = buf_len; msg->options = AP2HUB_READ | (index++ << SSP_INDEX); msg->data = big->addr; msg->buffer = hub_data->big_events.library_data + pos; msg->free_buffer = 0; ret = ssp_spi_sync(big->data, msg, 1000); if (ret != SUCCESS) { sensorhub_err("read big data err(%d)", ret); break; } pos += buf_len; residue -= buf_len; sensorhub_info("read big data (%5d / %5d)", pos, big->length); } hub_data->is_big_event = true; wake_up(&hub_data->sensorhub_wq); kfree(big); mutex_unlock(&hub_data->big_events_lock);}
开发者ID:GAXUSXX,项目名称:G935FGaXusKernel2,代码行数:44,
示例21: proximity_default_trim_showstatic ssize_t proximity_default_trim_show(struct device *dev, struct device_attribute *attr, char *buf){#if 0 struct ssp_data *data = dev_get_drvdata(dev); int iRet, iReties = 0; struct ssp_msg *msg; u8 buffer[8] = {0,}; int trim;retries: msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP]: %s - failed to allocate memory/n", __func__); return FAIL; } msg->cmd = MSG2SSP_AP_PROX_GET_TRIM; msg->length = 1; msg->options = AP2HUB_READ; msg->buffer = buffer; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 1000); if (iRet != SUCCESS) { pr_err("[SSP] %s fail %d/n", __func__, iRet); if (iReties++ < 2) { pr_err("[SSP] %s fail, retry/n", __func__); mdelay(5); goto retries; } return FAIL; } trim = (int)buffer[0];#else int trim; trim = 12;#endif pr_info("[SSP] %s - %d /n", __func__, trim); return snprintf(buf, PAGE_SIZE, "%d/n", trim);}
开发者ID:ShedrockN4,项目名称:wiliteneo,代码行数:43,
示例22: accel_hw_selftest_showstatic ssize_t accel_hw_selftest_show(struct device *dev, struct device_attribute *attr, char *buf){ char chTempBuf[8] = { 2, 0, }; s8 init_status = 0, result = -1; s16 shift_ratio[3] = { 0, }; int iRet; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg; msg = kzalloc(sizeof(*msg), GFP_KERNEL); msg->cmd = ACCELEROMETER_FACTORY; msg->length = 8; msg->options = AP2HUB_READ; msg->data = chTempBuf[0]; msg->buffer = chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 3000); if (iRet != SUCCESS) { pr_err("[SSP] %s - accel hw selftest Timeout!!/n", __func__); return sprintf(buf, "%d,%d,%d,%d/n", -5, 0, 0, 0); } init_status = chTempBuf[0]; shift_ratio[0] = (s16)((chTempBuf[2] << 8) + chTempBuf[1]); shift_ratio[1] = (s16)((chTempBuf[4] << 8) + chTempBuf[3]); shift_ratio[2] = (s16)((chTempBuf[6] << 8) + chTempBuf[5]); result = chTempBuf[7]; pr_info("[SSP] %s - %d, %d, %d, %d, %d/n", __func__, init_status, result, shift_ratio[0], shift_ratio[1], shift_ratio[2]);#if defined (CONFIG_SEC_PATEK_PROJECT) if (data->ap_rev >= MAXIM_MAX21103_REV) return sprintf(buf, "%d,%d,%d,%d/n", result, shift_ratio[0] , shift_ratio[1] , shift_ratio[2] ); else return sprintf(buf, "%d,%d.%d,%d.%d,%d.%d/n", result, shift_ratio[0] / 10, shift_ratio[0] % 10, shift_ratio[1] / 10, shift_ratio[1] % 10, shift_ratio[2] / 10, shift_ratio[2] % 10);#endif}
开发者ID:GalaxyTab4,项目名称:android_kernel_samsung_matissewifi.bak,代码行数:43,
示例23: get_hub_adcs16 get_hub_adc(struct ssp_data *data, u32 chan) { s16 adc = -1; int iRet = 0; struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); msg->cmd = MSG2SSP_AP_GET_THERM; msg->length = 2; msg->options = AP2HUB_READ; msg->data = chan; msg->buffer = (char *) &adc; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 1000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - i2c fail %d/n", __func__, iRet); iRet = ERROR; } return adc;}
开发者ID:GalaxyTab4,项目名称:android_kernel_samsung_matissewifi.bak,代码行数:22,
示例24: gesture_get_selftest_showstatic ssize_t gesture_get_selftest_show(struct device *dev, struct device_attribute *attr, char *buf){ s16 raw_A = 0, raw_B = 0, raw_C = 0, raw_D = 0; int iRet = 0; char chTempBuf[8] = { 0, }; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); msg->cmd = GESTURE_FACTORY; msg->length = 8; msg->options = AP2HUB_READ; msg->buffer = chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 2000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Gesture Selftest Timeout!!/n", __func__); goto exit; } printk("%x %x %x %x %x %x %x %x /n", chTempBuf[0], chTempBuf[1], chTempBuf[2], chTempBuf[3], chTempBuf[4], chTempBuf[5], chTempBuf[6], chTempBuf[7]); raw_A = ((((s16)chTempBuf[0]) << 8) + ((s16)chTempBuf[1])) - 1023; raw_B = ((((s16)chTempBuf[2]) << 8) + ((s16)chTempBuf[3])) - 1023; raw_C = ((((s16)chTempBuf[4]) << 8) + ((s16)chTempBuf[5])) - 1023; raw_D = ((((s16)chTempBuf[6]) << 8) + ((s16)chTempBuf[7])) - 1023; pr_info("[SSP] %s: self test A = %d, B = %d, C = %d, D = %d/n", __func__, raw_A, raw_B, raw_C, raw_D);exit: return sprintf(buf, "%d,%d,%d,%d/n", raw_A, raw_B, raw_C, raw_D);}
开发者ID:GAXUSXX,项目名称:G935FGaXusKernel2,代码行数:37,
示例25: magnetic_get_selfteststatic ssize_t magnetic_get_selftest(struct device *dev, struct device_attribute *attr, char *buf){ s8 iResult[4] = {-1, -1, -1, -1}; char bufSelftset[22] = {0, }; char bufAdc[4] = {0, }; s16 iSF_X = 0, iSF_Y = 0, iSF_Z = 0; s16 iADC_X = 0, iADC_Y = 0, iADC_Z = 0; s32 dMsDelay = 20; int iRet = 0, iSpecOutRetries = 0; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg; pr_info("[SSP] %s in/n", __func__); /* STATUS */ if ((data->uFuseRomData[0] == 0) || (data->uFuseRomData[0] == 0xff) || (data->uFuseRomData[1] == 0) || (data->uFuseRomData[1] == 0xff) || (data->uFuseRomData[2] == 0) || (data->uFuseRomData[2] == 0xff)) iResult[0] = -1; else iResult[0] = 0;Retry_selftest: msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); goto exit; } msg->cmd = GEOMAGNETIC_FACTORY; msg->length = 22; msg->options = AP2HUB_READ; msg->buffer = bufSelftset; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 1000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Magnetic Selftest Timeout!! %d/n", __func__, iRet); goto exit; } /* read 6bytes data registers */ iSF_X = (s16)((bufSelftset[13] << 8) + bufSelftset[14]); iSF_Y = (s16)((bufSelftset[15] << 8) + bufSelftset[16]); iSF_Z = (s16)((bufSelftset[17] << 8) + bufSelftset[18]); /* DAC (store Cntl Register value to check power down) */ iResult[2] = bufSelftset[21]; iSF_X = (s16)(((iSF_X * data->uFuseRomData[0]) >> 7) + iSF_X); iSF_Y = (s16)(((iSF_Y * data->uFuseRomData[1]) >> 7) + iSF_Y); iSF_Z = (s16)(((iSF_Z * data->uFuseRomData[2]) >> 7) + iSF_Z); pr_info("[SSP] %s: self test x = %d, y = %d, z = %d/n", __func__, iSF_X, iSF_Y, iSF_Z); if ((iSF_X >= GM_SELFTEST_X_SPEC_MIN) && (iSF_X <= GM_SELFTEST_X_SPEC_MAX)) pr_info("[SSP] x passed self test, expect -30<=x<=30/n"); else pr_info("[SSP] x failed self test, expect -30<=x<=30/n"); if ((iSF_Y >= GM_SELFTEST_Y_SPEC_MIN) && (iSF_Y <= GM_SELFTEST_Y_SPEC_MAX)) pr_info("[SSP] y passed self test, expect -30<=y<=30/n"); else pr_info("[SSP] y failed self test, expect -30<=y<=30/n"); if ((iSF_Z >= GM_SELFTEST_Z_SPEC_MIN) && (iSF_Z <= GM_SELFTEST_Z_SPEC_MAX)) pr_info("[SSP] z passed self test, expect -400<=z<=-50/n"); else pr_info("[SSP] z failed self test, expect -400<=z<=-50/n"); /* SELFTEST */ if ((iSF_X >= GM_SELFTEST_X_SPEC_MIN) && (iSF_X <= GM_SELFTEST_X_SPEC_MAX) && (iSF_Y >= GM_SELFTEST_Y_SPEC_MIN) && (iSF_Y <= GM_SELFTEST_Y_SPEC_MAX) && (iSF_Z >= GM_SELFTEST_Z_SPEC_MIN) && (iSF_Z <= GM_SELFTEST_Z_SPEC_MAX)) iResult[1] = 0; if ((iResult[1] == -1) && (iSpecOutRetries++ < 5)) { pr_err("[SSP] %s, selftest spec out. Retry = %d", __func__, iSpecOutRetries); goto Retry_selftest; } iSpecOutRetries = 10; /* ADC */ memcpy(&bufAdc[0], &dMsDelay, 4); data->buf[GEOMAGNETIC_RAW].x = 0; data->buf[GEOMAGNETIC_RAW].y = 0; data->buf[GEOMAGNETIC_RAW].z = 0; if (!(atomic_read(&data->aSensorEnable) & (1 << GEOMAGNETIC_RAW))) send_instruction(data, ADD_SENSOR, GEOMAGNETIC_RAW,//.........这里部分代码省略.........
开发者ID:LGaljo,项目名称:android_kernel_samsung_s3ve3g,代码行数:101,
示例26: magnetic_get_selfteststatic ssize_t magnetic_get_selftest(struct device *dev, struct device_attribute *attr, char *buf){ char chTempBuf[22] = { 0, }; int iRet = 0; s8 id = 0, x = 0, y1 = 0, y2 = 0, dir = 0; s16 sx = 0, sy = 0, ohx = 0, ohy = 0, ohz = 0; s8 err[7] = {-1, }; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); msg->cmd = GEOMAGNETIC_FACTORY; msg->length = 22; msg->options = AP2HUB_READ; msg->buffer = chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 1000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Magnetic Selftest Timeout!! %d/n", __func__, iRet); goto exit; } id = (s8)(chTempBuf[0]); err[0] = (s8)(chTempBuf[1]); err[1] = (s8)(chTempBuf[2]); err[2] = (s8)(chTempBuf[3]); x = (s8)(chTempBuf[4]); y1 = (s8)(chTempBuf[5]); y2 = (s8)(chTempBuf[6]); err[3] = (s8)(chTempBuf[7]); dir = (s8)(chTempBuf[8]); err[4] = (s8)(chTempBuf[9]); ohx = (s16)((chTempBuf[10] << 8) + chTempBuf[11]); ohy = (s16)((chTempBuf[12] << 8) + chTempBuf[13]); ohz = (s16)((chTempBuf[14] << 8) + chTempBuf[15]); err[6] = (s8)(chTempBuf[16]); sx = (s16)((chTempBuf[17] << 8) + chTempBuf[18]); sy = (s16)((chTempBuf[19] << 8) + chTempBuf[20]); err[5] = (s8)(chTempBuf[21]); if (unlikely(id != 0x2)) err[0] = -1; if (unlikely(x < -30 || x > 30)) err[3] = -1; if (unlikely(y1 < -30 || y1 > 30)) err[3] = -1; if (unlikely(y2 < -30 || y2 > 30)) err[3] = -1; if (unlikely(sx < 17 || sy < 22)) err[5] = -1; if (unlikely(ohx < -600 || ohx > 600)) err[6] = -1; if (unlikely(ohy < -600 || ohy > 600)) err[6] = -1; if (unlikely(ohz < -600 || ohz > 600)) err[6] = -1; pr_info("[SSP] %s/n" "[SSP] Test1 - err = %d, id = %d/n" "[SSP] Test3 - err = %d/n" "[SSP] Test4 - err = %d, offset = %d,%d,%d/n" "[SSP] Test5 - err = %d, direction = %d/n" "[SSP] Test6 - err = %d, sensitivity = %d,%d/n" "[SSP] Test7 - err = %d, offset = %d,%d,%d/n" "[SSP] Test2 - err = %d/n", __func__, err[0], id, err[2], err[3], x, y1, y2, err[4], dir, err[5], sx, sy, err[6], ohx, ohy, ohz, err[1]);exit: return sprintf(buf, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d/n", err[0], id, err[2], err[3], x, y1, y2, err[4], dir, err[5], sx, sy, err[6], ohx, ohy, ohz, err[1]);}
开发者ID:StarKissed,项目名称:Note-4-AEL-Kernel,代码行数:76,
示例27: bmi058_gyro_selftest_showstatic ssize_t bmi058_gyro_selftest_show(struct device *dev, struct device_attribute *attr, char *buf){ char chTempBuf[19] = { 0,}; u8 bist=0, selftest = 0; int datax_check = 0; int datay_check = 0; int dataz_check = 0; s16 iCalData[3] = {0,}; int iRet = 0; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); goto exit; } msg->cmd = GYROSCOPE_FACTORY; msg->length = 19; msg->options = AP2HUB_READ; msg->buffer = chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 3000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Gyro Selftest Timeout!!/n", __func__); goto exit; } data->uTimeOutCnt = 0; pr_err("[SSP]%d %d %d %d %d %d %d %d %d %d %d %d %d/n", chTempBuf[0], chTempBuf[1], chTempBuf[2], chTempBuf[3], chTempBuf[4], chTempBuf[5], chTempBuf[6], chTempBuf[7], chTempBuf[8], chTempBuf[9], chTempBuf[10], chTempBuf[11], chTempBuf[12]); /* Should I get bist? */ selftest = chTempBuf[0]; if (selftest == 0) bist = 1; else bist =0; datax_check = (int)((chTempBuf[4] << 24) + (chTempBuf[3] <<16) +(chTempBuf[2] << 8) + chTempBuf[1]); datay_check = (int)((chTempBuf[8] << 24) + (chTempBuf[7] <<16) +(chTempBuf[6] << 8) + chTempBuf[5]); dataz_check = (int)((chTempBuf[12] << 24) + (chTempBuf[11] <<16) +(chTempBuf[10] << 8) + chTempBuf[9]); iCalData[0] = (s16)((chTempBuf[14] << 8) + chTempBuf[13]); iCalData[1] = (s16)((chTempBuf[16] << 8) + chTempBuf[15]); iCalData[2] = (s16)((chTempBuf[18] << 8) + chTempBuf[17]); //shift_ratio[1] = (s16)((chTempBuf[4] << 8) +chTempBuf[3]); //total_count = (int)((chTempBuf[11] << 24) +(chTempBuf[10] << 16) + (chTempBuf[9] << 8) +chTempBuf[8]); pr_info("[SSP] gyro bist: %d, selftest: %d/n", bist, selftest); pr_info("[SSP] gyro X: %d, Y: %d, Z: %d/n", datax_check, datay_check, dataz_check); pr_info("[SSP] iCalData X: %d, Y: %d, Z: %d/n", iCalData[0], iCalData[1], iCalData[2]); //pr_info("[SSP] avg %+8ld %+8ld %+8ld (LSB)/n", avg[0], avg[1], avg[2]); if ((datax_check <= SELFTEST_LIMITATION_OF_ERROR) && (datay_check <= SELFTEST_LIMITATION_OF_ERROR) && (dataz_check <= SELFTEST_LIMITATION_OF_ERROR)) { pr_info("[SENSOR]: %s - Gyro zero rate OK!- Gyro selftest Pass/n", __func__); //bmg160_get_caldata(data); save_gyro_caldata(data, iCalData); } else { pr_info("[SENSOR]: %s - Gyro zero rate NG!- Gyro selftest fail!/n", __func__); selftest |= 1; } #if 0 /*Do Not saveing gyro cal after selftest NOW at BMI058*/ if (likely(!ret_val)) { save_gyro_caldata(data, iCalData); } else { pr_err("[SSP] ret_val != 0, gyrocal is 0 at all axis/n"); data->gyrocal.x = 0; data->gyrocal.y = 0; data->gyrocal.z = 0; } #endifexit: pr_info("%d,%d,%d.%03d,%d.%03d,%d.%03d/n", selftest ? 0 : 1, bist, (datax_check / 1000), (datax_check % 1000), (datay_check / 1000), (datay_check % 1000), (dataz_check / 1000), (dataz_check % 1000)); return sprintf(buf, "%d,%d,%d.%03d,%d.%03d,%d.%03d," "%d,%d,%d,%d,%d,%d,%d,%d" "/n", selftest ? 0 : 1, bist, (datax_check / 1000), (datax_check % 1000), (datay_check / 1000), (datay_check % 1000), (dataz_check / 1000), (dataz_check % 1000), iRet ,iRet ,iRet ,iRet ,iRet ,iRet ,iRet ,iRet);}
开发者ID:MikeForeskin,项目名称:Vindicator-S6,代码行数:98,
示例28: k6ds3tr_gyro_selfteststatic ssize_t k6ds3tr_gyro_selftest(struct device *dev, struct device_attribute *attr, char *buf){ char chTempBuf[36] = { 0,}; u8 initialized = 0; s8 hw_result = 0; int i = 0, j = 0, total_count = 0, ret_val = 0, gyro_lib_dl_fail = 0; long avg[3] = {0,}, rms[3] = {0,}; int gyro_bias[3] = {0,}, gyro_rms[3] = {0,}; s16 shift_ratio[3] = {0,}; //self_diff value s16 iCalData[3] = {0,}; char a_name[3][2] = { "X", "Y", "Z" }; int iRet = 0; int dps_rms[3] = { 0, }; u32 temp = 0; int bias_thresh = DEF_BIAS_LSB_THRESH_SELF; int fifo_ret = 0; int cal_ret = 0; struct ssp_data *data = dev_get_drvdata(dev); s16 st_zro[3] = {0, }; s16 st_bias[3] = {0, }; int gyro_fifo_avg[3] = {0,}, gyro_self_zro[3] = {0,}; int gyro_self_bias[3] = {0,}, gyro_self_diff[3] = {0,}; struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); goto exit; } msg->cmd = GYROSCOPE_FACTORY; msg->length = 36; msg->options = AP2HUB_READ; msg->buffer = chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 7000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Gyro Selftest Timeout!!/n", __func__); ret_val = 1; goto exit; } data->uTimeOutCnt = 0; pr_err("[SSP]%d %d %d %d %d %d %d %d %d %d %d %d/n", chTempBuf[0], chTempBuf[1], chTempBuf[2], chTempBuf[3], chTempBuf[4], chTempBuf[5], chTempBuf[6], chTempBuf[7], chTempBuf[8], chTempBuf[9], chTempBuf[10], chTempBuf[11]); initialized = chTempBuf[0]; shift_ratio[0] = (s16)((chTempBuf[2] << 8) + chTempBuf[1]); shift_ratio[1] = (s16)((chTempBuf[4] << 8) + chTempBuf[3]); shift_ratio[2] = (s16)((chTempBuf[6] << 8) + chTempBuf[5]); hw_result = (s8)chTempBuf[7]; total_count = (int)((chTempBuf[11] << 24) + (chTempBuf[10] << 16) + (chTempBuf[9] << 8) + chTempBuf[8]); avg[0] = (long)((chTempBuf[15] << 24) + (chTempBuf[14] << 16) + (chTempBuf[13] << 8) + chTempBuf[12]); avg[1] = (long)((chTempBuf[19] << 24) + (chTempBuf[18] << 16) + (chTempBuf[17] << 8) + chTempBuf[16]); avg[2] = (long)((chTempBuf[23] << 24) + (chTempBuf[22] << 16) + (chTempBuf[21] << 8) + chTempBuf[20]); rms[0] = (long)((chTempBuf[27] << 24) + (chTempBuf[26] << 16) + (chTempBuf[25] << 8) + chTempBuf[24]); rms[1] = (long)((chTempBuf[31] << 24) + (chTempBuf[30] << 16) + (chTempBuf[29] << 8) + chTempBuf[28]); rms[2] = (long)((chTempBuf[35] << 24) + (chTempBuf[34] << 16) + (chTempBuf[33] << 8) + chTempBuf[32]); st_zro[0] = (s16)((chTempBuf[25] << 8) + chTempBuf[24]); st_zro[1] = (s16)((chTempBuf[27] << 8) + chTempBuf[26]); st_zro[2] = (s16)((chTempBuf[29] << 8) + chTempBuf[28]); st_bias[0] = (s16)((chTempBuf[31] << 8) + chTempBuf[30]); st_bias[1] = (s16)((chTempBuf[33] << 8) + chTempBuf[32]); st_bias[2] = (s16)((chTempBuf[35] << 8) + chTempBuf[34]);//.........这里部分代码省略.........
开发者ID:MikeForeskin,项目名称:Vindicator-S6-MM,代码行数:101,
示例29: ssp_dump_taskvoid ssp_dump_task(struct work_struct *work) {#ifdef CONFIG_SENSORS_SSP_BBD pr_err("[SSPBBD]:TODO:%s()/n", __func__);#else struct ssp_big *big; struct file *dump_file; struct ssp_msg *msg; char *buffer; char strFilePath[60]; struct timeval cur_time; int iTimeTemp; mm_segment_t fs; int buf_len, packet_len, residue, iRet = 0, index = 0 ,iRetTrans=0 ,iRetWrite=0; big = container_of(work, struct ssp_big, work); pr_err("[SSP]: %s - start ssp dumping (%d)(%d)/n", __func__,big->data->bMcuDumpMode,big->data->uDumpCnt); big->data->uDumpCnt++; wake_lock(&big->data->ssp_wake_lock); fs = get_fs(); set_fs(get_ds()); if(big->data->bMcuDumpMode == true) { do_gettimeofday(&cur_time); iTimeTemp = (int) cur_time.tv_sec; sprintf(strFilePath, "%s%d.txt", DUMP_FILE_PATH, iTimeTemp); dump_file = filp_open(strFilePath, O_RDWR | O_CREAT | O_APPEND, 0666); if (IS_ERR(dump_file)) { pr_err("[SSP]: %s - Can't open dump file/n", __func__); set_fs(fs); iRet = PTR_ERR(dump_file); wake_unlock(&big->data->ssp_wake_lock); kfree(big); return; } } else dump_file = NULL; buf_len = big->length > DATA_PACKET_SIZE ? DATA_PACKET_SIZE : big->length; buffer = kzalloc(buf_len, GFP_KERNEL); residue = big->length; while (residue > 0) { packet_len = residue > DATA_PACKET_SIZE ? DATA_PACKET_SIZE : residue; msg = kzalloc(sizeof(*msg), GFP_KERNEL); msg->cmd = MSG2SSP_AP_GET_BIG_DATA; msg->length = packet_len; msg->options = AP2HUB_READ | (index++ << SSP_INDEX); msg->data = big->addr; msg->buffer = buffer; msg->free_buffer = 0; iRetTrans = ssp_spi_sync(big->data, msg, 1000); if (iRetTrans != SUCCESS) { pr_err("[SSP]: %s - Fail to receive data %d (%d)/n", __func__, iRetTrans,residue); break; } if(big->data->bMcuDumpMode == true) { iRetWrite = vfs_write(dump_file, (char __user *) buffer, packet_len, &dump_file->f_pos); if (iRetWrite < 0) { pr_err("[SSP]: %s - Can't write dump to file/n", __func__); break; } } residue -= packet_len; } if(big->data->bMcuDumpMode == true && (iRetTrans != SUCCESS || iRetWrite < 0) ) { char FAILSTRING[100]; sprintf(FAILSTRING,"FAIL OCCURED(%d)(%d)(%d)",iRetTrans,iRetWrite,big->length); vfs_write(dump_file, (char __user *) FAILSTRING, strlen(FAILSTRING),&dump_file->f_pos); } big->data->bDumping = false; if(big->data->bMcuDumpMode == true) filp_close(dump_file, current->files); set_fs(fs); wake_unlock(&big->data->ssp_wake_lock); kfree(buffer); kfree(big); pr_err("[SSP]: %s done/n", __func__);#endif}
开发者ID:MikeForeskin,项目名称:Vindicator-S6,代码行数:95,
示例30: mpu6500_gyro_selfteststatic ssize_t mpu6500_gyro_selftest(struct device *dev, struct device_attribute *attr, char *buf){ char chTempBuf[36] = { 0,}; u8 initialized = 0; s8 hw_result = 0; int i = 0, j = 0, total_count = 0, ret_val = 0; long avg[3] = {0,}, rms[3] = {0,}; int gyro_bias[3] = {0,}, gyro_rms[3] = {0,}; s16 shift_ratio[3] = {0,}; s16 iCalData[3] = {0,}; char a_name[3][2] = { "X", "Y", "Z" }; int iRet = 0; int dps_rms[3] = { 0, }; u32 temp = 0; int bias_thresh = DEF_BIAS_LSB_THRESH_SELF_6500; struct ssp_data *data = dev_get_drvdata(dev); struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL); if (msg == NULL) { pr_err("[SSP] %s, failed to alloc memory for ssp_msg/n", __func__); goto exit; } msg->cmd = GYROSCOPE_FACTORY; msg->length = 36; msg->options = AP2HUB_READ; msg->buffer = chTempBuf; msg->free_buffer = 0; iRet = ssp_spi_sync(data, msg, 7000); if (iRet != SUCCESS) { pr_err("[SSP]: %s - Gyro Selftest Timeout!!/n", __func__); ret_val = 1; goto exit; } data->uTimeOutCnt = 0; pr_err("[SSP]%d %d %d %d %d %d %d %d %d %d %d %d", chTempBuf[0], chTempBuf[1], chTempBuf[2], chTempBuf[3], chTempBuf[4], chTempBuf[5], chTempBuf[6], chTempBuf[7], chTempBuf[8], chTempBuf[9], chTempBuf[10], chTempBuf[11]); initialized = chTempBuf[0]; shift_ratio[0] = (s16)((chTempBuf[2] << 8) + chTempBuf[1]); shift_ratio[1] = (s16)((chTempBuf[4] << 8) + chTempBuf[3]); shift_ratio[2] = (s16)((chTempBuf[6] << 8) + chTempBuf[5]); hw_result = (s8)chTempBuf[7]; total_count = (int)((chTempBuf[11] << 24) + (chTempBuf[10] << 16) + (chTempBuf[9] << 8) + chTempBuf[8]); avg[0] = (long)((chTempBuf[15] << 24) + (chTempBuf[14] << 16) + (chTempBuf[13] << 8) + chTempBuf[12]); avg[1] = (long)((chTempBuf[19] << 24) + (chTempBuf[18] << 16) + (chTempBuf[17] << 8) + chTempBuf[16]); avg[2] = (long)((chTempBuf[23] << 24) + (chTempBuf[22] << 16) + (chTempBuf[21] << 8) + chTempBuf[20]); rms[0] = (long)((chTempBuf[27] << 24) + (chTempBuf[26] << 16) + (chTempBuf[25] << 8) + chTempBuf[24]); rms[1] = (long)((chTempBuf[31] << 24) + (chTempBuf[30] << 16) + (chTempBuf[29] << 8) + chTempBuf[28]); rms[2] = (long)((chTempBuf[35] << 24) + (chTempBuf[34] << 16) + (chTempBuf[33] << 8) + chTempBuf[32]); pr_info("[SSP] init: %d, total cnt: %d/n", initialized, total_count); pr_info("[SSP] hw_result: %d, %d, %d, %d/n", hw_result, shift_ratio[0], shift_ratio[1], shift_ratio[2]); pr_info("[SSP] avg %+8ld %+8ld %+8ld (LSB)/n", avg[0], avg[1], avg[2]); pr_info("[SSP] rms %+8ld %+8ld %+8ld (LSB)/n", rms[0], rms[1], rms[2]); if (total_count == 0) { pr_err("[SSP] %s, total_count is 0. goto exit/n", __func__); ret_val = 2; goto exit; } if (hw_result < 0) { pr_err("[SSP] %s - hw selftest fail(%d), sw selftest skip/n", __func__, hw_result); return sprintf(buf, "-1,0,0,0,0,0,0,%d.%d,%d.%d,%d.%d,0,0,0/n", shift_ratio[0] / 10, shift_ratio[0] % 10, shift_ratio[1] / 10, shift_ratio[1] % 10, shift_ratio[2] / 10, shift_ratio[2] % 10); }//.........这里部分代码省略.........
开发者ID:BigBot96,项目名称:android_kernel_samsung_gts2wifi,代码行数:101,
注:本文中的ssp_spi_sync函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ sspi_SecBufferAlloc函数代码示例 C++ ssp_readable函数代码示例 |