本文整理汇总了C++中GYRO_LOG函数的典型用法代码示例。如果您正苦于以下问题:C++ GYRO_LOG函数的具体用法?C++ GYRO_LOG怎么用?C++ GYRO_LOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GYRO_LOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gyro_probe
static int gyro_probe(struct platform_device *pdev)
{
int err;
GYRO_LOG("+++++++++++++gyro_probe!!\n");
gyro_context_obj = gyro_context_alloc_object();
if (!gyro_context_obj)
{
err = -ENOMEM;
GYRO_ERR("unable to allocate devobj!\n");
goto exit_alloc_data_failed;
}
//init real gyroeleration driver
err = gyro_real_driver_init();
if(err)
{
GYRO_ERR("gyro real driver init fail\n");
goto real_driver_init_fail;
}
//init input dev
err = gyro_input_init(gyro_context_obj);
if(err)
{
GYRO_ERR("unable to register gyro input device!\n");
goto exit_alloc_input_dev_failed;
}
atomic_set(&(gyro_context_obj->early_suspend), 0);
gyro_context_obj->early_drv.level = EARLY_SUSPEND_LEVEL_STOP_DRAWING - 1,
gyro_context_obj->early_drv.suspend = gyro_early_suspend,
gyro_context_obj->early_drv.resume = gyro_late_resume,
register_early_suspend(&gyro_context_obj->early_drv);
GYRO_LOG("----gyro_probe OK !!\n");
return 0;
//exit_hwmsen_create_attr_failed:
//exit_misc_register_failed:
//exit_err_sysfs:
if (err)
{
GYRO_ERR("sysfs node creation error \n");
gyro_input_destroy(gyro_context_obj);
}
real_driver_init_fail:
exit_alloc_input_dev_failed:
kfree(gyro_context_obj);
exit_alloc_data_failed:
GYRO_LOG("----gyro_probe fail !!!\n");
return err;
}
示例2: gyro_real_driver_init
static int gyro_real_driver_init(void)
{
int i =0;
int err=0;
GYRO_LOG(" gyro_real_driver_init +\n");
for(i = 0; i < MAX_CHOOSE_GYRO_NUM; i++)
{
GYRO_LOG(" i=%d\n",i);
if(0 != gyroscope_init_list[i])
{
GYRO_LOG(" gyro try to init driver %s\n", gyroscope_init_list[i]->name);
err = gyroscope_init_list[i]->init();
if(0 == err)
{
GYRO_LOG(" gyro real driver %s probe ok\n", gyroscope_init_list[i]->name);
break;
}
}
}
if(i == MAX_CHOOSE_GYRO_NUM)
{
GYRO_LOG(" gyro_real_driver_init fail\n");
err=-1;
}
return err;
}
示例3: gyro_store_delay
static ssize_t gyro_store_delay(struct device* dev, struct device_attribute *attr,
const char *buf, size_t count)
{
// struct gyro_context *devobj = (struct gyro_context*)dev_get_drvdata(dev);
int delay;
int mdelay=0;
struct gyro_context *cxt = NULL;
//int err =0;
mutex_lock(&gyro_context_obj->gyro_op_mutex);
cxt = gyro_context_obj;
if(NULL == cxt->gyro_ctl.set_delay)
{
GYRO_LOG("gyro_ctl set_delay NULL\n");
mutex_unlock(&gyro_context_obj->gyro_op_mutex);
return count;
}
if (1 != sscanf(buf, "%d", &delay)) {
GYRO_ERR("invalid format!!\n");
mutex_unlock(&gyro_context_obj->gyro_op_mutex);
return count;
}
if(false == cxt->gyro_ctl.is_report_input_direct)
{
mdelay = (int)delay/1000/1000;
atomic_set(&gyro_context_obj->delay, mdelay);
}
cxt->gyro_ctl.set_delay(delay);
GYRO_LOG(" gyro_delay %d ns\n",delay);
mutex_unlock(&gyro_context_obj->gyro_op_mutex);
return count;
}
示例4: gyro_store_enable_nodata
static ssize_t gyro_store_enable_nodata(struct device* dev, struct device_attribute *attr,
const char *buf, size_t count)
{
GYRO_LOG("gyro_store_enable nodata buf=%s\n",buf);
mutex_lock(&gyro_context_obj->gyro_op_mutex);
struct gyro_context *cxt = NULL;
int err =0;
cxt = gyro_context_obj;
if(NULL == cxt->gyro_ctl.enable_nodata)
{
GYRO_LOG("gyro_ctl enable nodata NULL\n");
mutex_unlock(&gyro_context_obj->gyro_op_mutex);
return count;
}
if (!strncmp(buf, "1", 1))
{
gyro_enable_nodata(1);
}
else if (!strncmp(buf, "0", 1))
{
gyro_enable_nodata(0);
}
else
{
GYRO_ERR(" gyro_store enable nodata cmd error !!\n");
}
mutex_unlock(&gyro_context_obj->gyro_op_mutex);
}
示例5: kzalloc
static struct gyro_context *gyro_context_alloc_object(void)
{
struct gyro_context *obj = kzalloc(sizeof(*obj), GFP_KERNEL);
GYRO_LOG("gyro_context_alloc_object++++\n");
if(!obj)
{
GYRO_ERR("Alloc gyro object error!\n");
return NULL;
}
atomic_set(&obj->delay, 200); /*5Hz*/// set work queue delay time 200ms
atomic_set(&obj->wake, 0);
INIT_WORK(&obj->report, gyro_work_func);
init_timer(&obj->timer);
obj->timer.expires = jiffies + atomic_read(&obj->delay)/(1000/HZ);
obj->timer.function = gyro_poll;
obj->timer.data = (unsigned long)obj;
obj->is_first_data_after_enable = false;
obj->is_polling_run = false;
obj->is_batch_enable = false;
obj->cali_sw[GYRO_AXIS_X]=0;
obj->cali_sw[GYRO_AXIS_Y]=0;
obj->cali_sw[GYRO_AXIS_Z]=0;
mutex_init(&obj->gyro_op_mutex);
GYRO_LOG("gyro_context_alloc_object----\n");
return obj;
}
示例6: gyro_store_delay
static ssize_t gyro_store_delay(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
int64_t delay;
int64_t mdelay = 0;
int ret = 0;
struct gyro_context *cxt = NULL;
mutex_lock(&gyro_context_obj->gyro_op_mutex);
cxt = gyro_context_obj;
if (NULL == cxt->gyro_ctl.set_delay) {
GYRO_LOG("gyro_ctl set_delay NULL\n");
mutex_unlock(&gyro_context_obj->gyro_op_mutex);
return count;
}
ret = kstrtoll(buf, 10, &delay);
if (ret != 0) {
GYRO_ERR("invalid format!!\n");
mutex_unlock(&gyro_context_obj->gyro_op_mutex);
return count;
}
if (false == cxt->gyro_ctl.is_report_input_direct) {
mdelay = delay;
do_div(mdelay, 1000000);
atomic_set(&gyro_context_obj->delay, mdelay);
}
cxt->gyro_ctl.set_delay(delay);
GYRO_LOG(" gyro_delay %lld ns\n", delay);
mutex_unlock(&gyro_context_obj->gyro_op_mutex);
return count;
}
示例7: gyro_store_batch
static ssize_t gyro_store_batch(struct device* dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct gyro_context *cxt = NULL;
//int err =0;
GYRO_LOG("gyro_store_batch buf=%s\n",buf);
mutex_lock(&gyro_context_obj->gyro_op_mutex);
cxt = gyro_context_obj;
if(cxt->gyro_ctl.is_support_batch){
if (!strncmp(buf, "1", 1))
{
cxt->is_batch_enable = true;
}
else if (!strncmp(buf, "0", 1))
{
cxt->is_batch_enable = false;
}
else
{
GYRO_ERR(" gyro_store_batch error !!\n");
}
}else{
GYRO_LOG(" gyro_store_batch not support\n");
}
mutex_unlock(&gyro_context_obj->gyro_op_mutex);
GYRO_LOG(" gyro_store_batch done: %d\n", cxt->is_batch_enable);
return count;
}
示例8: gyro_store_active
static ssize_t gyro_store_active(struct device* dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct gyro_context *cxt = NULL;
//int err =0;
GYRO_LOG("gyro_store_active buf=%s\n",buf);
mutex_lock(&gyro_context_obj->gyro_op_mutex);
cxt = gyro_context_obj;
if(NULL == cxt->gyro_ctl.open_report_data)
{
GYRO_LOG("gyro_ctl enable NULL\n");
mutex_unlock(&gyro_context_obj->gyro_op_mutex);
return count;
}
if (!strncmp(buf, "1", 1))
{
// cxt->gyro_ctl.enable(1);
gyro_enable_data(1);
}
else if (!strncmp(buf, "0", 1))
{
//cxt->gyro_ctl.enable(0);
gyro_enable_data(0);
}
else
{
GYRO_ERR(" gyro_store_active error !!\n");
}
mutex_unlock(&gyro_context_obj->gyro_op_mutex);
GYRO_LOG(" gyro_store_active done\n");
return count;
}
示例9: gyro_real_enable
static int gyro_real_enable(int enable)
{
int err = 0;
struct gyro_context *cxt = NULL;
cxt = gyro_context_obj;
if (1 == enable) {
if (true == cxt->is_active_data || true == cxt->is_active_nodata) {
err = cxt->gyro_ctl.enable_nodata(1);
if (err) {
err = cxt->gyro_ctl.enable_nodata(1);
if (err) {
err = cxt->gyro_ctl.enable_nodata(1);
if (err)
GYRO_ERR("gyro enable(%d) err 3 timers = %d\n", enable, err);
}
}
GYRO_LOG("gyro real enable\n");
}
}
if (0 == enable) {
if (false == cxt->is_active_data && false == cxt->is_active_nodata) {
err = cxt->gyro_ctl.enable_nodata(0);
if (err)
GYRO_ERR("gyro enable(%d) err = %d\n", enable, err);
GYRO_LOG("gyro real disable\n");
}
}
return err;
}
示例10: kzalloc
static struct gyro_context *gyro_context_alloc_object(void)
{
struct gyro_context *obj = kzalloc(sizeof(*obj), GFP_KERNEL);
GYRO_LOG("gyro_context_alloc_object++++\n");
if (!obj) {
GYRO_ERR("Alloc gyro object error!\n");
return NULL;
}
atomic_set(&obj->delay, 200); /*5Hz, set work queue delay time 200ms */
atomic_set(&obj->wake, 0);
INIT_WORK(&obj->report, gyro_work_func);
obj->gyro_workqueue = NULL;
obj->gyro_workqueue = create_workqueue("gyro_polling");
if (!obj->gyro_workqueue) {
kfree(obj);
return NULL;
}
initTimer(&obj->hrTimer, gyro_poll);
obj->is_first_data_after_enable = false;
obj->is_polling_run = false;
obj->is_batch_enable = false;
obj->cali_sw[GYRO_AXIS_X] = 0;
obj->cali_sw[GYRO_AXIS_Y] = 0;
obj->cali_sw[GYRO_AXIS_Z] = 0;
mutex_init(&obj->gyro_op_mutex);
GYRO_LOG("gyro_context_alloc_object----\n");
return obj;
}
示例11: gyro_set_cali
static int gyro_set_cali(int data[GYRO_AXES_NUM])
{
struct gyro_context *cxt = gyro_context_obj;
GYRO_LOG(" factory gyro cali %d,%d,%d \n",data[GYRO_AXIS_X],data[GYRO_AXIS_Y],data[GYRO_AXIS_Z] );
GYRO_LOG(" original gyro cali %d,%d,%d \n",cxt->cali_sw[GYRO_AXIS_X],cxt->cali_sw[GYRO_AXIS_Y],cxt->cali_sw[GYRO_AXIS_Z]);
cxt->cali_sw[GYRO_AXIS_X] += data[GYRO_AXIS_X];
cxt->cali_sw[GYRO_AXIS_Y] += data[GYRO_AXIS_Y];
cxt->cali_sw[GYRO_AXIS_Z] += data[GYRO_AXIS_Z];
GYRO_LOG(" GYRO new cali %d,%d,%d \n",cxt->cali_sw[GYRO_AXIS_X],cxt->cali_sw[GYRO_AXIS_Y],cxt->cali_sw[GYRO_AXIS_Z]);
return 0;
}
示例12: gyro_show_active
/*----------------------------------------------------------------------------*/
static ssize_t gyro_show_active(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct gyro_context *cxt = NULL;
int div = 0;
cxt = gyro_context_obj;
GYRO_LOG("gyro show active not support now\n");
div = cxt->gyro_data.vender_div;
GYRO_LOG("gyro vender_div value: %d\n", div);
return snprintf(buf, PAGE_SIZE, "%d\n", div);
}
示例13: gyro_enable_data
static int gyro_enable_data(int enable)
{
struct gyro_context *cxt = NULL;
//int err =0;
cxt = gyro_context_obj;
if(NULL == cxt->gyro_ctl.open_report_data)
{
GYRO_ERR("no gyro control path\n");
return -1;
}
if(1 == enable)
{
GYRO_LOG("gyro enable data\n");
cxt->is_active_data =true;
cxt->is_first_data_after_enable = true;
cxt->gyro_ctl.open_report_data(1);
gyro_real_enable(enable);
if(false == cxt->is_polling_run && cxt->is_batch_enable == false)
{
if(false == cxt->gyro_ctl.is_report_input_direct)
{
mod_timer(&cxt->timer, jiffies + atomic_read(&cxt->delay)/(1000/HZ));
cxt->is_polling_run = true;
}
}
}
if(0 == enable)
{
GYRO_LOG("gyro disable \n");
cxt->is_active_data =false;
cxt->gyro_ctl.open_report_data(0);
if(true == cxt->is_polling_run)
{
if(false == cxt->gyro_ctl.is_report_input_direct)
{
cxt->is_polling_run = false;
smp_mb();
del_timer_sync(&cxt->timer);
smp_mb();
cancel_work_sync(&cxt->report);
cxt->drv_data.gyro_data.values[0] = GYRO_INVALID_VALUE;
cxt->drv_data.gyro_data.values[1] = GYRO_INVALID_VALUE;
cxt->drv_data.gyro_data.values[2] = GYRO_INVALID_VALUE;
}
}
gyro_real_enable(enable);
}
return 0;
}
示例14: gyro_register_data_path
int gyro_register_data_path(struct gyro_data_path *data)
{
struct gyro_context *cxt = NULL;
//int err =0;
cxt = gyro_context_obj;
cxt->gyro_data.get_data = data->get_data;
cxt->gyro_data.vender_div = data->vender_div;
GYRO_LOG("gyro register data path vender_div: %d\n", cxt->gyro_data.vender_div);
if(NULL == cxt->gyro_data.get_data)
{
GYRO_LOG("gyro register data path fail \n");
return -1;
}
return 0;
}
示例15: gyro_probe
static int gyro_probe(void)
{
int err;
GYRO_LOG("+++++++++++++gyro_probe!!\n");
gyro_context_obj = gyro_context_alloc_object();
if (!gyro_context_obj) {
err = -ENOMEM;
GYRO_ERR("unable to allocate devobj!\n");
goto exit_alloc_data_failed;
}
/* init real gyroeleration driver */
err = gyro_real_driver_init(pltfm_dev);
if (err) {
GYRO_ERR("gyro real driver init fail\n");
goto real_driver_init_fail;
}
err = gyro_factory_device_init();
if (err)
GYRO_ERR("gyro_factory_device_init fail\n");
/* init input dev */
err = gyro_input_init(gyro_context_obj);
if (err) {
GYRO_ERR("unable to register gyro input device!\n");
goto exit_alloc_input_dev_failed;
}
GYRO_LOG("----gyro_probe OK !!\n");
return 0;
if (err) {
GYRO_ERR("sysfs node creation error\n");
gyro_input_destroy(gyro_context_obj);
}
real_driver_init_fail:
exit_alloc_input_dev_failed:
kfree(gyro_context_obj);
exit_alloc_data_failed:
GYRO_ERR("----gyro_probe fail !!!\n");
return err;
}