當前位置: 首頁>>代碼示例>>C++>>正文


C++ BITFMASK函數代碼示例

本文整理匯總了C++中BITFMASK函數的典型用法代碼示例。如果您正苦於以下問題:C++ BITFMASK函數的具體用法?C++ BITFMASK怎麽用?C++ BITFMASK使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了BITFMASK函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: mc34708_regulator_is_enabled

static int mc34708_regulator_is_enabled(struct regulator_dev *rdev)
{
	unsigned int register1;
	unsigned int register_mask;
	int id = rdev_get_id(rdev);
	unsigned int register_val = 0;

	switch (id) {
	case MC34708_SWBST:
		register_mask = BITFMASK(VUSBSEL);
		register1 = MC34708_REG_REGULATOR_MODE0;
		break;
	case MC34708_VUSB:
		register_mask = BITFMASK(VUSB_EN);
		register1 = MC34708_REG_REGULATOR_MODE0;
		break;
	default:
		return 1;
	}
	CHECK_ERROR(pmic_read_reg(register1, &register_val, register_mask));
	return (register_val != 0);
}
開發者ID:tiagolb,項目名稱:liboot-tz,代碼行數:22,代碼來源:reg-mc34708.c

示例2: mc13892_regulator_init

static int mc13892_regulator_init(struct mc13892 *mc13892)
{
	unsigned int value;
	pmic_event_callback_t power_key_event;
	int register_mask;

	printk("Initializing regulators for 3-stack.\n");
	if (mxc_cpu_is_rev(CHIP_REV_2_0) < 0)
		sw2_init.constraints.state_mem.uV = 1100000;

	/* subscribe PWRON1 event to enable ON_OFF key */
	power_key_event.param = NULL;
	power_key_event.func = (void *)power_on_evt_handler;
	pmic_event_subscribe(EVENT_PWRONI, power_key_event);

	/* Bit 4 DRM: keep VSRTC and CLK32KMCU on for all states */
	pmic_read_reg(REG_POWER_CTL0, &value, 0xffffff);
	value |= 0x000010;
	pmic_write_reg(REG_POWER_CTL0, value, 0xffffff);

	/* Set the STANDBYSECINV bit, so that STANDBY pin is
	 * interpreted as active low.
	 */
	value = BITFVAL(STANDBYSECINV, 1);
	register_mask = BITFMASK(STANDBYSECINV);
	pmic_write_reg(REG_POWER_CTL2, value, register_mask);

	mc13892_register_regulator(mc13892, MC13892_SW1, &sw1_init);
	mc13892_register_regulator(mc13892, MC13892_SW2, &sw2_init);
	mc13892_register_regulator(mc13892, MC13892_SW3, &sw3_init);
	mc13892_register_regulator(mc13892, MC13892_SW4, &sw4_init);
	mc13892_register_regulator(mc13892, MC13892_SWBST, &swbst_init);
	mc13892_register_regulator(mc13892, MC13892_VIOHI, &viohi_init);
	mc13892_register_regulator(mc13892, MC13892_VPLL, &vpll_init);
	mc13892_register_regulator(mc13892, MC13892_VDIG, &vdig_init);
	mc13892_register_regulator(mc13892, MC13892_VSD, &vsd_init);
	mc13892_register_regulator(mc13892, MC13892_VUSB2, &vusb2_init);
	mc13892_register_regulator(mc13892, MC13892_VVIDEO, &vvideo_init);
	mc13892_register_regulator(mc13892, MC13892_VAUDIO, &vaudio_init);
	mc13892_register_regulator(mc13892, MC13892_VCAM, &vcam_init);
	mc13892_register_regulator(mc13892, MC13892_VGEN1, &vgen1_init);
	mc13892_register_regulator(mc13892, MC13892_VGEN2, &vgen2_init);
	mc13892_register_regulator(mc13892, MC13892_VGEN3, &vgen3_init);
	mc13892_register_regulator(mc13892, MC13892_VUSB, &vusb_init);
	mc13892_register_regulator(mc13892, MC13892_GPO1, &gpo1_init);
	mc13892_register_regulator(mc13892, MC13892_GPO2, &gpo2_init);
	mc13892_register_regulator(mc13892, MC13892_GPO3, &gpo3_init);
	mc13892_register_regulator(mc13892, MC13892_GPO4, &gpo4_init);

	return 0;
}
開發者ID:traveller42,項目名稱:linux-2.6.28.mx233-falconwing,代碼行數:51,代碼來源:mx51_3stack_pmic_mc13892.c

示例3: pmic_batt_led_control

/*!
 * This function controls charge LED.
 *
 * @param      on   If on is ture, LED will be turned on,
 *                  or otherwise, LED will be turned off.
 *
 * @return     This function returns PMIC_SUCCESS if successful.
 */
PMIC_STATUS pmic_batt_led_control(bool on)
{
	unsigned val, mask;

	if (suspend_flag == 1)
		return PMIC_ERROR;

	val = BITFVAL(MC13783_BATT_DAC_LED_EN, on);
	mask = BITFMASK(MC13783_BATT_DAC_LED_EN);

	CHECK_ERROR(pmic_write_reg(REG_CHARGER, val, mask));

	return PMIC_SUCCESS;
}
開發者ID:despierto,項目名稱:imx_233_linux,代碼行數:22,代碼來源:pmic_battery.c

示例4: pmic_batt_set_reverse_supply

/*!
 * This function sets reverse supply mode.
 *
 * @param      enable     If enable is ture, reverse supply mode is enable,
 *                        or otherwise, reverse supply mode is disabled.
 *
 * @return     This function returns PMIC_SUCCESS if successful.
 */
PMIC_STATUS pmic_batt_set_reverse_supply(bool enable)
{
	unsigned val, mask;

	if (suspend_flag == 1)
		return PMIC_ERROR;

	val = BITFVAL(MC13783_BATT_DAC_REVERSE_SUPPLY, enable);
	mask = BITFMASK(MC13783_BATT_DAC_REVERSE_SUPPLY);

	CHECK_ERROR(pmic_write_reg(REG_CHARGER, val, mask));

	return PMIC_SUCCESS;
}
開發者ID:despierto,項目名稱:imx_233_linux,代碼行數:22,代碼來源:pmic_battery.c

示例5: pmic_batt_set_5k_pull

/*!
 * This function sets a 5K pull down at CHRGRAW.
 * To be used in the dual path charging configuration.
 *
 * @param      enable     If enable is true, 5k pull down is
 *                        enable, or otherwise, disabled.
 *
 * @return     This function returns PMIC_SUCCESS if successful.
 */
PMIC_STATUS pmic_batt_set_5k_pull(bool enable)
{
	unsigned val, mask;

	if (suspend_flag == 1)
		return PMIC_ERROR;

	val = BITFVAL(MC13783_BATT_DAC_5K, enable);
	mask = BITFMASK(MC13783_BATT_DAC_5K);

	CHECK_ERROR(pmic_write_reg(REG_CHARGER, val, mask));

	return PMIC_SUCCESS;
}
開發者ID:despierto,項目名稱:imx_233_linux,代碼行數:23,代碼來源:pmic_battery.c

示例6: pmic_batt_set_unregulated

/*!
 * This function sets unregulatored charging mode on main battery.
 *
 * @param      enable     If enable is ture, unregulated charging mode is
 *                        enable, or otherwise, disabled.
 *
 * @return     This function returns PMIC_SUCCESS if successful.
 */
PMIC_STATUS pmic_batt_set_unregulated(bool enable)
{
    unsigned val, mask;

    if (suspend_flag == 1) {
        return PMIC_ERROR;
    }

    val = BITFVAL(MC13783_BATT_DAC_UNREGULATED, enable);
    mask = BITFMASK(MC13783_BATT_DAC_UNREGULATED);

    CHECK_ERROR(pmic_write_reg(REG_CHARGER, val, mask));

    return PMIC_SUCCESS;
}
開發者ID:Timesys,項目名稱:linux-timesys,代碼行數:23,代碼來源:pmic_battery.c

示例7: mc13892_sw_stby_set_voltage

static int mc13892_sw_stby_set_voltage(struct regulator *reg, int uV)
{
	unsigned int register_val = 0, register_mask = 0;
	unsigned int register1 = 0;
	int voltage, sw = reg->id, mV = uV / 1000, hi;

	hi = mc13892_get_sw_hi_bit(sw);
	voltage = mc13892_get_voltage_value(hi, mV);

	switch (sw) {
	case MC13892_SW1:
		register1 = REG_SW_0;
		register_val = BITFVAL(SW1_STDBY, voltage);
		register_mask = BITFMASK(SW1_STDBY);
		break;
	case MC13892_SW2:
		register1 = REG_SW_1;
		register_val = BITFVAL(SW2_STDBY, voltage);
		register_mask = BITFMASK(SW2_STDBY);
		break;
	case MC13892_SW3:
		register1 = REG_SW_2;
		register_val = BITFVAL(SW3_STDBY, voltage);
		register_mask = BITFMASK(SW3_STDBY);
		break;
	case MC13892_SW4:
		register1 = REG_SW_3;
		register_val = BITFVAL(SW4_STDBY, voltage);
		register_mask = BITFMASK(SW4_STDBY);
		break;
	default:
		return -EINVAL;
	}

	return (pmic_write_reg(register1, register_val, register_mask));
}
開發者ID:R0-Developers,項目名稱:YP-R0_Kernel,代碼行數:36,代碼來源:reg-mc13892.c

示例8: pmic_batt_disable_eol

/*!
 * This function disables End-of-Life comparator.
 *
 * @return     This function returns PMIC_SUCCESS if successful.
 */
PMIC_STATUS pmic_batt_disable_eol(void)
{
	unsigned int val, mask;

	if (suspend_flag == 1)
		return PMIC_ERROR;

	val = BITFVAL(MC13783_BATT_DAC_EOL_CMP_EN,
		      MC13783_BATT_DAC_EOL_CMP_EN_DISABLE);
	mask = BITFMASK(MC13783_BATT_DAC_EOL_CMP_EN);

	CHECK_ERROR(pmic_write_reg(REG_POWER_CONTROL_0, val, mask));

	return PMIC_SUCCESS;
}
開發者ID:despierto,項目名稱:imx_233_linux,代碼行數:20,代碼來源:pmic_battery.c

示例9: pmic_batt_set_threshold

/*!
 * This function sets over voltage threshold.
 *
 * @param        threshold      value of over voltage threshold.
 *
 * @return       This function returns 0 if successful.
 */
PMIC_STATUS pmic_batt_set_threshold(int threshold)
{
	unsigned int val, mask;

	if (suspend_flag == 1)
		return PMIC_ERROR;

	if (threshold > BAT_THRESHOLD_MAX)
		return PMIC_PARAMETER_ERROR;

	val = BITFVAL(MC13783_BATT_DAC_OVCTRL, threshold);
	mask = BITFMASK(MC13783_BATT_DAC_OVCTRL);
	CHECK_ERROR(pmic_write_reg(REG_CHARGER, val, mask));
	return PMIC_SUCCESS;
}
開發者ID:despierto,項目名稱:imx_233_linux,代碼行數:22,代碼來源:pmic_battery.c

示例10: mc13892_vgen3_set_voltage

static int mc13892_vgen3_set_voltage(struct regulator *reg, int uV)
{
	unsigned int register_val = 0, register_mask = 0;
	unsigned int register1;
	int voltage, mV = uV / 1000;

	if ((mV >= 1800) && (mV < 2900))
		voltage = VGEN3_1_8V;
	else
		voltage = VGEN3_2_9V;

	register_val = BITFVAL(VGEN3, voltage);
	register_mask = BITFMASK(VGEN3);
	register1 = REG_SETTING_0;

	return (pmic_write_reg(register1, register_val, register_mask));
}
開發者ID:R0-Developers,項目名稱:YP-R0_Kernel,代碼行數:17,代碼來源:reg-mc13892.c

示例11: mc13892_bklit_set_current

PMIC_STATUS mc13892_bklit_set_current(enum lit_channel channel,
				      unsigned char level)
{
	unsigned int mask;
	unsigned int value;
	int reg;

	if (level > LIT_CURR_HI_42)
		return PMIC_PARAMETER_ERROR;
	else if (level >= LIT_CURR_HI_0) {
		CHECK_ERROR(mc13892_bklit_set_hi_current(channel, 1));
		level -= LIT_CURR_HI_0;
	}

	switch (channel) {
	case LIT_MAIN:
		value = BITFVAL(BIT_CL_MAIN, level);
		mask = BITFMASK(BIT_CL_MAIN);
		reg = REG_LED_CTL0;
		break;
	case LIT_AUX:
		value = BITFVAL(BIT_CL_AUX, level);
		mask = BITFMASK(BIT_CL_AUX);
		reg = REG_LED_CTL0;
		break;
	case LIT_KEY:
		value = BITFVAL(BIT_CL_KEY, level);
		mask = BITFMASK(BIT_CL_KEY);
		reg = REG_LED_CTL1;
		break;
	case LIT_RED:
		value = BITFVAL(BIT_CL_RED, level);
		mask = BITFMASK(BIT_CL_RED);
		reg = REG_LED_CTL2;
		break;
	case LIT_GREEN:
		value = BITFVAL(BIT_CL_GREEN, level);
		mask = BITFMASK(BIT_CL_GREEN);
		reg = REG_LED_CTL2;
		break;
	case LIT_BLUE:
		value = BITFVAL(BIT_CL_BLUE, level);
		mask = BITFMASK(BIT_CL_BLUE);
		reg = REG_LED_CTL3;
		break;
	default:
		return PMIC_PARAMETER_ERROR;
	}
	CHECK_ERROR(pmic_write_reg(reg, value, mask));

	return PMIC_SUCCESS;
}
開發者ID:YCsuperlife,項目名稱:imx53_kernel,代碼行數:52,代碼來源:pmic_light.c

示例12: mc13892_charger_update_status

static int mc13892_charger_update_status(struct mc13892_dev_info *di)
{
	int ret;
	unsigned int value;
	int online;

	ret = pmic_read_reg(REG_INT_SENSE0, &value, BITFMASK(BIT_CHG_DETS));

	if (ret == 0) {
		online = BITFEXT(value, BIT_CHG_DETS);
		if (online != di->charger_online) {
			di->charger_online = online;
			dev_info(di->charger.dev, "charger status: %s\n",
				online ? "online" : "offline");
			power_supply_changed(&di->charger);

			if (online) {
				cancel_delayed_work_sync(&di->calc_capacity);
				queue_delayed_work(di->monitor_wqueue, &di->calc_capacity,0);
			} else {
				cancel_delayed_work_sync(&di->calc_capacity);
				queue_delayed_work(di->monitor_wqueue, &di->calc_capacity, HZ * 10);
			}

			cancel_delayed_work(&di->monitor_work);
			queue_delayed_work(di->monitor_wqueue,
				&di->monitor_work, HZ / 10);
			if (online) {
				//pmic_restart_charging();
				//queue_delayed_work(chg_wq, &chg_work, 100);
				chg_wa_timer = 1;
			} else {
				//cancel_delayed_work(&chg_work);
				chg_wa_timer = 0;
		        }
	        }
	}
	
        ////////////////////////////////////////////////
         bChargerIsDCDC = false;
	
	return ret;
}
開發者ID:pocketbook,項目名稱:801,代碼行數:43,代碼來源:pmic_battery.c

示例13: max17135_hvinp_get_voltage

static int max17135_hvinp_get_voltage(struct regulator_dev *reg)
{
	unsigned int reg_val;
	unsigned int fld_val;
	int volt;

	max17135_reg_read(REG_MAX17135_HVINP, &reg_val);

	fld_val = (reg_val & BITFMASK(HVINP)) >> HVINP_LSH;

	if ((fld_val >= MAX17135_HVINP_MIN_VAL) &&
		(fld_val <= MAX17135_HVINP_MAX_VAL)) {
		volt = (fld_val * MAX17135_HVINP_STEP_uV) +
			MAX17135_HVINP_MIN_uV;
	} else {
		printk(KERN_ERR "MAX17135: HVINP voltage is out of range\n");
		volt = 0;
	}
	return volt;
}
開發者ID:lixuhui112,項目名稱:myimx6-linux,代碼行數:20,代碼來源:max17135-regulator.c

示例14: mc13892_vcam_set_voltage

static int mc13892_vcam_set_voltage(struct regulator *reg, int uV)
{
	unsigned int register_val = 0, register_mask = 0;
	unsigned int register1;
	int voltage, mV = uV / 1000;

	if ((mV >= 1800) && (mV < 2500))
		voltage = VCAM_1_8V;
	else if ((mV >= 2500) && (mV < 2600))
		voltage = VCAM_2_5V;
	else if ((mV >= 2600) && (mV < 2750))
		voltage = VCAM_2_6V;
	else
		voltage = VCAM_2_75V;

	register_val = BITFVAL(VCAM, voltage);
	register_mask = BITFMASK(VCAM);
	register1 = REG_SETTING_0;

	return (pmic_write_reg(register1, register_val, register_mask));
}
開發者ID:R0-Developers,項目名稱:YP-R0_Kernel,代碼行數:21,代碼來源:reg-mc13892.c

示例15: mc13892_vvideo_set_voltage

static int mc13892_vvideo_set_voltage(struct regulator *reg, int uV)
{
	unsigned int register_val = 0, register_mask = 0;
	unsigned int register1;
	int voltage, mV = uV / 1000;

	if ((mV >= 2500) && (mV < 2600))
		voltage = VVIDEO_2_5V;
	else if ((mV >= 2600) && (mV < 2700))
		voltage = VVIDEO_2_6V;
	else if ((mV >= 2700) && (mV < 2775))
		voltage = VVIDEO_2_7V;
	else
		voltage = VVIDEO_2_775V;

	register_val = BITFVAL(VVIDEO, voltage);
	register_mask = BITFMASK(VVIDEO);
	register1 = REG_SETTING_1;

	return (pmic_write_reg(register1, register_val, register_mask));
}
開發者ID:R0-Developers,項目名稱:YP-R0_Kernel,代碼行數:21,代碼來源:reg-mc13892.c


注:本文中的BITFMASK函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。