当前位置: 首页>>代码示例>>C++>>正文


C++ BIT_WORD函数代码示例

本文整理汇总了C++中BIT_WORD函数的典型用法代码示例。如果您正苦于以下问题:C++ BIT_WORD函数的具体用法?C++ BIT_WORD怎么用?C++ BIT_WORD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BIT_WORD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: soundtrigger_input_init

static int soundtrigger_input_init(struct device *dev)
{
	int error = 0;

	soundtrigger_input_dev = input_allocate_device();
	if (!soundtrigger_input_dev) {
		pr_err("failed to allocate memory for input dev\n");
		error = -ENOMEM;
		goto err_dev;
	}

	soundtrigger_input_dev->name = "soundtrigger_input_dev";

	soundtrigger_input_dev->evbit[0] = BIT_MASK(EV_KEY);
	soundtrigger_input_dev->keybit[BIT_WORD(KEY_F14)] |= BIT_MASK(KEY_F14);
	soundtrigger_input_dev->keybit[BIT_WORD(KEY_F15)] |= BIT_MASK(KEY_F15);
	soundtrigger_input_dev->keybit[BIT_WORD(KEY_F16)] |= BIT_MASK(KEY_F16);
	soundtrigger_input_dev->keybit[BIT_WORD(KEY_F17)] |= BIT_MASK(KEY_F17);
	soundtrigger_input_dev->keybit[BIT_WORD(KEY_F18)] |= BIT_MASK(KEY_F18);
	error = input_register_device(soundtrigger_input_dev);
	if(error < 0) {
		pr_err("input register device failed, error_no is %d.\n", error);
		goto err_free_dev;
	}
	pr_info("input register device successful.\n");
	return 0;

err_free_dev:
	input_free_device(soundtrigger_input_dev);

err_dev:
	pr_err("error_no is %d.\n", error);

	return error;
}
开发者ID:fly2436732935,项目名称:android_kernel_honor7_PLK-AL10_PLK-TL01H_PLK-UL00_PLK-CL00_PLK-TL00,代码行数:35,代码来源:hi6402_mbhc.c

示例2: input_dev_i3s

void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
{
    input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_FINGER);
    input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_0) |
            BIT_MASK(BTN_1) | BIT_MASK(BTN_2) | BIT_MASK(BTN_3);
    input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:7,代码来源:wacom_sys.c

示例3: input_dev_i4s

void input_dev_i4s(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
{
	input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_FINGER);
	input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_0) | BIT_MASK(BTN_1) | BIT_MASK(BTN_2) | BIT_MASK(BTN_3);
	input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_4) | BIT_MASK(BTN_5) | BIT_MASK(BTN_6);
	input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
}
开发者ID:daveti,项目名称:prov-kernel,代码行数:7,代码来源:wacom_sys.c

示例4: input_dev_g4

void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
{
	input_dev->evbit[0] |= BIT_MASK(EV_MSC);
	input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL);
	input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_FINGER);
	input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_0) |
		BIT_MASK(BTN_4);
}
开发者ID:daveti,项目名称:prov-kernel,代码行数:8,代码来源:wacom_sys.c

示例5: input_dev_bamboo_pt

void input_dev_bamboo_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
{
	input_dev->absbit[BIT_WORD(ABS_MISC)] &= ~ABS_MISC;
	/* for now, BAMBOO_PT will only handle pen */
	input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) |
		BIT_MASK(BTN_STYLUS2);
	input_set_abs_params(input_dev, ABS_DISTANCE, 0,
			     wacom_wac->features->distance_max, 0, 0);
}
开发者ID:daveti,项目名称:prov-kernel,代码行数:9,代码来源:wacom_sys.c

示例6: input_dev_g

void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
{
	input_dev->evbit[0] |= BIT_MASK(EV_REL);
	input_dev->relbit[0] |= BIT_MASK(REL_WHEEL);
	input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_LEFT) |
		BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE);
	input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) |
		BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_STYLUS2);
	input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0);
}
开发者ID:daveti,项目名称:prov-kernel,代码行数:10,代码来源:wacom_sys.c

示例7: check_fd

static int check_fd(struct tslib_input *i)
{
	struct tsdev *ts = i->module.dev;
	int version;
	long evbit[BITS_TO_LONGS(EV_CNT)];
	long absbit[BITS_TO_LONGS(ABS_CNT)];
	long keybit[BITS_TO_LONGS(KEY_CNT)];

	if (ioctl(ts->fd, EVIOCGVERSION, &version) < 0) {
		fprintf(stderr, "tslib: Selected device is not a Linux input event device\n");
		return -1;
	}

	/* support version EV_VERSION 0x010000 and 0x010001
	 * this check causes more troubles than it solves here */
	if (version < EV_VERSION)
		fprintf(stderr, "tslib: Warning: Selected device uses a different version of the event protocol than tslib was compiled for\n");

	if ( (ioctl(ts->fd, EVIOCGBIT(0, sizeof(evbit)), evbit) < 0) ||
		!(evbit[BIT_WORD(EV_ABS)] & BIT_MASK(EV_ABS)) ||
		!(evbit[BIT_WORD(EV_KEY)] & BIT_MASK(EV_KEY)) ) {
		fprintf(stderr, "tslib: Selected device is not a touchscreen (must support ABS and KEY event types)\n");
		return -1;
	}

	if ((ioctl(ts->fd, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit)) < 0 ||
		!(absbit[BIT_WORD(ABS_X)] & BIT_MASK(ABS_X)) ||
		!(absbit[BIT_WORD(ABS_Y)] & BIT_MASK(ABS_Y))) {
		fprintf(stderr, "tslib: Selected device is not a touchscreen (must support ABS_X and ABS_Y events)\n");
		return -1;
	}

	/* Since some touchscreens (eg. infrared) physically can't measure pressure,
	the input system doesn't report it on those. Tslib relies on pressure, thus
	we set it to constant 255. It's still controlled by BTN_TOUCH/BTN_LEFT -
	when not touched, the pressure is forced to 0. */

	if (!(absbit[BIT_WORD(ABS_PRESSURE)] & BIT_MASK(ABS_PRESSURE)))
		i->no_pressure = 1;

	if ((ioctl(ts->fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) < 0) ||
		!(keybit[BIT_WORD(BTN_TOUCH)] & BIT_MASK(BTN_TOUCH) ||
		  keybit[BIT_WORD(BTN_LEFT)] & BIT_MASK(BTN_LEFT))) {
		fprintf(stderr, "tslib: Selected device is not a touchscreen (must support BTN_TOUCH or BTN_LEFT events)\n");
		return -1;
	}

	if (evbit[BIT_WORD(EV_SYN)] & BIT_MASK(EV_SYN))
		i->using_syn = 1;

	if (i->grab_events == GRAB_EVENTS_WANTED) {
		if (ioctl(ts->fd, EVIOCGRAB, (void *)1)) {
			fprintf(stderr, "tslib: Unable to grab selected input device\n");
			return -1;
		}
		i->grab_events = GRAB_EVENTS_ACTIVE;
	}

	return ts->fd;
}
开发者ID:gonzoua,项目名称:tslib,代码行数:60,代码来源:input-raw.c

示例8: bfilter_get_hash

int bfilter_get_hash(struct bloom_filter *bf, unsigned long hash)
{
	unsigned long *addr;
	hash = hash % bf->nbits;
	addr = bf->bitmap + BIT_WORD(hash);
	return test_bit(hash & (BITS_PER_LONG - 1), addr);
}
开发者ID:iiiyu,项目名称:oh-my-ulib,代码行数:7,代码来源:bfilter.c

示例9: copy_abs

static void copy_abs(struct input_dev *dev, unsigned int dst, unsigned int src)
{
	if (dev->absinfo && test_bit(src, dev->absbit)) {
		dev->absinfo[dst] = dev->absinfo[src];
		dev->absbit[BIT_WORD(dst)] |= BIT_MASK(dst);
	}
}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:7,代码来源:input-mt.c

示例10: retubutton_init

/**
 * Init function.
 * Allocates interrupt for power button and registers itself to input layer.
 */
static int __init retubutton_init(void)
{
	int irq;

	printk(KERN_INFO "Retu power button driver initialized\n");
	irq = RETU_INT_PWR;

	init_timer(&pwrbtn_timer);
	pwrbtn_timer.function = retubutton_timer_func;

	if (retu_request_irq(irq, &retubutton_irq, 0, "PwrOnX") < 0) {
		printk(KERN_ERR "%[email protected]%s: Cannot allocate irq\n",
		       __FUNCTION__, __FILE__);
		return -EBUSY;
	}

	pwrbtn_dev = input_allocate_device();
	if (!pwrbtn_dev)
		return -ENOMEM;

	pwrbtn_dev->evbit[0] = BIT_MASK(EV_KEY);
	pwrbtn_dev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
	pwrbtn_dev->name = "retu-pwrbutton";

	return input_register_device(pwrbtn_dev);
}
开发者ID:Aircell,项目名称:asp-kernel,代码行数:30,代码来源:retu-pwrbutton.c

示例11: input_allocate_device

static struct input_dev *alloc_and_register(void)
{
	int error;
	struct input_dev *tmp = input_allocate_device();
	if (!tmp)
		return ERR_PTR(-ENOMEM);

	tmp->name = "IR emulated Mouse";
	tmp->phys = "irmouse/input0";
	tmp->id.bustype = BUS_HOST;
	tmp->id.vendor = 0x0001;
	tmp->id.product = 0x0001;
	tmp->id.version = 0x0100;
	tmp->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
	tmp->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
		BIT_MASK(BTN_RIGHT);
	tmp->relbit[0]	= BIT_MASK(REL_X) | BIT_MASK(REL_Y);
	tmp->open = ir_input_open;
	error = input_register_device(tmp);
	if (error) {
		printk("unable to register IR-emu mouse\n");
		input_free_device(tmp);
		return ERR_PTR(error);
	}
	return tmp;

}
开发者ID:deepikateriar,项目名称:Onlive-Source-Backup,代码行数:27,代码来源:ir_main.c

示例12: amimouse_init

static int __init amimouse_init(void)
{
	int err;

	if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE))
		return -ENODEV;

	amimouse_dev = input_allocate_device();
	if (!amimouse_dev)
		return -ENOMEM;

	amimouse_dev->name = "Amiga mouse";
	amimouse_dev->phys = "amimouse/input0";
	amimouse_dev->id.bustype = BUS_AMIGA;
	amimouse_dev->id.vendor = 0x0001;
	amimouse_dev->id.product = 0x0002;
	amimouse_dev->id.version = 0x0100;

	amimouse_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
	amimouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
	amimouse_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
		BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
	amimouse_dev->open = amimouse_open;
	amimouse_dev->close = amimouse_close;

	err = input_register_device(amimouse_dev);
	if (err) {
		input_free_device(amimouse_dev);
		return err;
	}

	return 0;
}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:33,代码来源:amimouse.c

示例13: button_init

static int __init button_init(void) 
{ 
	int error; 

	if (request_irq(BUTTON_IRQ, button_interrupt, IRQ_TYPE_EDGE_BOTH , "button", NULL)) { 
//	if (request_irq(BUTTON_IRQ, button_interrupt, IRQ_TYPE_EDGE_FALLING , "button", NULL)) { 
		printk(KERN_ERR "button.c: Can't allocate irq %d\n", BUTTON_IRQ); 
        return -EBUSY; 
    } 

	button_dev = input_allocate_device(); 
	if (!button_dev) { 
		printk(KERN_ERR "button.c: Not enough memory\n"); 
		error = -ENOMEM; 
		goto err_free_irq; 
	} 

	button_dev->evbit[0] = BIT_MASK(EV_KEY); 
	button_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0); 
	button_dev->name = "button"; //input: Unspecified device as /devices/virtual/input/input7
	error = input_register_device(button_dev); 
	if (error) { 
		printk(KERN_ERR "button.c: Failed to register device\n"); 
		goto err_free_dev; 
	} 

 return 0; 

 err_free_dev: 
	input_free_device(button_dev); 
 err_free_irq: 
	free_irq(BUTTON_IRQ, button_interrupt); 
 return error; 
} 
开发者ID:hubuyu,项目名称:9-3,代码行数:34,代码来源:button.c

示例14: bfilter_clear_hash

void bfilter_clear_hash(struct bloom_filter *bf, unsigned long hash)
{
	unsigned long *addr;
	hash = hash % bf->nbits;
	addr = bf->bitmap + BIT_WORD(hash);
	clear_bit(hash & (BITS_PER_LONG - 1), addr);
}
开发者ID:iiiyu,项目名称:oh-my-ulib,代码行数:7,代码来源:bfilter.c

示例15: vmouse_input_dev_setup

static int vmouse_input_dev_setup(void)
{
    int ret = 0;
    vmouse_idev = input_allocate_device();
 
    if(vmouse_idev == NULL)
    {
        return -ENOMEM;
    }
 
    vmouse_idev->name = "vmouse";
    vmouse_idev->phys = "vmouse/input0";
	vmouse_idev->id.bustype = BUS_HOST;
	vmouse_idev->id.product = 0x0001;
	vmouse_idev->id.vendor = 0x0002;
	vmouse_idev->id.version = 0x0100;
    vmouse_idev->open = vmouse_input_dev_open;
    vmouse_idev->close = vmouse_input_dev_close;

	vmouse_idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
	vmouse_idev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
		BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_TOUCH);
	vmouse_idev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y) | BIT_MASK(REL_WHEEL) | BIT_MASK(REL_HWHEEL);
 
    ret = input_register_device(vmouse_idev);
 
    return ret;
}
开发者ID:Vassilko,项目名称:lichee,代码行数:28,代码来源:virtualmouse.c


注:本文中的BIT_WORD函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。