當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。