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


C++ ec_read函数代码示例

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


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

示例1: ec_init_idle_mode

/* make ec goto idle mode */
static int ec_init_idle_mode(void)
{
	int timeout;
	unsigned char status = 0;
	int ret = 0;

	ec_query_seq(CMD_INIT_IDLE_MODE);

	/* make the action take active */
	timeout = EC_CMD_TIMEOUT;
	status = ec_read(REG_POWER_MODE) & FLAG_IDLE_MODE;
	while (timeout--) {
		if (status) {
			udelay(EC_REG_DELAY);
			break;
		}
		status = ec_read(REG_POWER_MODE) & FLAG_IDLE_MODE;
		udelay(EC_REG_DELAY);
	}
	if (timeout <= 0) {
		printk(KERN_ERR "ec rom fixup : can't check out the status.\n");
		ret = -EINVAL;
	} else
		printk(KERN_INFO "(%d/%d)0xf710 :  0x%x\n", timeout,
			   EC_CMD_TIMEOUT - timeout, ec_read(REG_POWER_MODE));

	printk(KERN_INFO "entering idle mode ok...................\n");

	return ret;
}
开发者ID:tinyclub,项目名称:preempt-rt-linux,代码行数:31,代码来源:yeeloong_ecrom.c

示例2: mainboard_smi_hotkey

static void mainboard_smi_hotkey(u8 hotkey)
{
	u8 reg8;

	switch (hotkey) {
	case 0x3b: break; // Fn+F1
	case 0x3c: break; // Fn+F2
	case 0x3d: break; // Fn+F3
	case 0x3e: break; // Fn+F4
	case 0x3f: break; // Fn+F5
	case 0x40:        // Fn+F6 (Decrease Display Brightness)
		   reg8 = ec_read(0x17);
		   reg8 = (reg8 > 8) ? (reg8 - 8) : 0;
		   ec_write(0x17, reg8);
		   return;
	case 0x41:        // Fn+F7 (Increase Display Brightness)
		   reg8 = ec_read(0x17);
		   reg8 += 8;
		   reg8 = (reg8 >= MAX_LCD_BRIGHTNESS) ? MAX_LCD_BRIGHTNESS : reg8;
		   ec_write(0x17, reg8);
		   return;
	case 0x42: break; // Fn+F8
	case 0x43: break; // Fn+F9
	case 0x44: break; // Fn+F10
	case 0x57: break; // Fn+F11
	case 0x58: break; // Fn+F12
	}
	printk(BIOS_DEBUG, "EC hotkey: %02x\n", hotkey);
}
开发者ID:killbug2004,项目名称:coreboot,代码行数:29,代码来源:smihandler.c

示例3: get_battery_temp

static int get_battery_temp(void)
{
	int value;

	value = (ec_read(REG_BAT_TEMPERATURE_HIGH) << 8) |
		(ec_read(REG_BAT_TEMPERATURE_LOW));

	return value * 1000;
}
开发者ID:RealizeItDream,项目名称:Webee210-WRT,代码行数:9,代码来源:yeeloong_laptop.c

示例4: get_battery_voltage

static int get_battery_voltage(void)
{
	int value;

	value = (ec_read(REG_BAT_VOLTAGE_HIGH) << 8) |
		(ec_read(REG_BAT_VOLTAGE_LOW));

	return value;
}
开发者ID:RealizeItDream,项目名称:Webee210-WRT,代码行数:9,代码来源:yeeloong_laptop.c

示例5: get_fan_rpm

static int get_fan_rpm(void)
{
	int value = 0;

	value = FAN_SPEED_DIVIDER /
	    (((ec_read(REG_FAN_SPEED_HIGH) & 0x0f) << 8) |
	     ec_read(REG_FAN_SPEED_LOW));

	return value;
}
开发者ID:RealizeItDream,项目名称:Webee210-WRT,代码行数:10,代码来源:yeeloong_laptop.c

示例6: get_battery_current

static int get_battery_current(void)
{
	int value;

	value = (ec_read(REG_BAT_CURRENT_HIGH) << 8) |
		(ec_read(REG_BAT_CURRENT_LOW));

	if (value & 0x8000)
		value = 0xffff - value;

	return value;
}
开发者ID:RealizeItDream,项目名称:Webee210-WRT,代码行数:12,代码来源:yeeloong_laptop.c

示例7: ec_init_reset_mode

/* enable the chip reset mode */
static int ec_init_reset_mode(void)
{
	int timeout;
	unsigned char status = 0;
	int ret = 0;

	/* make chip goto reset mode */
	ret = ec_query_seq(CMD_INIT_RESET_MODE);
	if (ret < 0) {
		printk(KERN_ERR "ec init reset mode failed.\n");
		goto out;
	}

	/* make the action take active */
	timeout = EC_CMD_TIMEOUT;
	status = ec_read(REG_POWER_MODE) & FLAG_RESET_MODE;
	while (timeout--) {
		if (status) {
			udelay(EC_REG_DELAY);
			break;
		}
		status = ec_read(REG_POWER_MODE) & FLAG_RESET_MODE;
		udelay(EC_REG_DELAY);
	}
	if (timeout <= 0) {
		printk(KERN_ERR "ec rom fixup : can't check reset status.\n");
		ret = -EINVAL;
	} else
		printk(KERN_INFO "(%d/%d)reset 0xf710 :  0x%x\n", timeout,
			   EC_CMD_TIMEOUT - timeout, status);

	/* set MCU to reset mode */
	udelay(EC_REG_DELAY);
	status = ec_read(REG_PXCFG);
	status |= (1 << 0);
	ec_write(REG_PXCFG, status);
	udelay(EC_REG_DELAY);

	/* disable FWH/LPC */
	udelay(EC_REG_DELAY);
	status = ec_read(REG_LPCCFG);
	status &= ~(1 << 7);
	ec_write(REG_LPCCFG, status);
	udelay(EC_REG_DELAY);

	printk(KERN_INFO "entering reset mode ok..............\n");

 out:
	return ret;
}
开发者ID:tinyclub,项目名称:preempt-rt-linux,代码行数:51,代码来源:yeeloong_ecrom.c

示例8: ec_exit_reset_mode

/* make ec exit from reset mode */
static void ec_exit_reset_mode(void)
{
	unsigned char regval;

	udelay(EC_REG_DELAY);
	regval = ec_read(REG_LPCCFG);
	regval |= (1 << 7);
	ec_write(REG_LPCCFG, regval);
	regval = ec_read(REG_PXCFG);
	regval &= ~(1 << 0);
	ec_write(REG_PXCFG, regval);
	printk(KERN_INFO "exit reset mode ok..................\n");

	return;
}
开发者ID:tinyclub,项目名称:preempt-rt-linux,代码行数:16,代码来源:yeeloong_ecrom.c

示例9: acpi_ec_read_io

static ssize_t acpi_ec_read_io(struct file *f, char __user *buf,
			       size_t count, loff_t *off)
{
	/* Use this if support reading/writing multiple ECs exists in ec.c:
	 * struct acpi_ec *ec = ((struct seq_file *)f->private_data)->private;
	 */
	unsigned int size = EC_SPACE_SIZE;
	u8 *data = (u8 *) buf;
	loff_t init_off = *off;
	int err = 0;

	if (*off >= size)
		return 0;
	if (*off + count >= size) {
		size -= *off;
		count = size;
	} else
		size = count;

	while (size) {
		err = ec_read(*off, &data[*off - init_off]);
		if (err)
			return err;
		*off += 1;
		size--;
	}
	return count;
}
开发者ID:1111saeid,项目名称:jb_kernel_3.0.16_htc_golfu,代码行数:28,代码来源:ec_sys.c

示例10: get_backlight_brightness

/* backlight */
static int get_backlight_brightness(struct backlight_device *b)
{
	u8 value;
	ec_read(OT_EC_BL_BRIGHTNESS_ADDRESS, &value);

	return value;
}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:8,代码来源:intel_oaktrail.c

示例11: lensl_ec_read_procmem

ssize_t lensl_ec_read_procmem(struct file *file, char __user *buffer,
		size_t count, loff_t *offset)
{
	int err, len = 0;
	u8 i, result;
	char ec_buf[EC_MAX * 3 + (EC_MAX / 16 + (EC_MAX % 16 ? 1 : 0)) * 4 + 1];
	int off = *offset;

	if (off < 0 || off >= sizeof(ec_buf) || count <= 0) {
		return 0;
	}
	if (count > sizeof(ec_buf) || count + off > sizeof(ec_buf)) {
		count = sizeof(ec_buf) - off;
	}

	/* note: ec_read at i = 255 locks up my SL300 hard. -AR */
	for (i = 0; i < EC_MAX; i++) {
		if (!(i % 16)) {
			if (i)
				len += sprintf(ec_buf+len, "\n");
			len += sprintf(ec_buf+len, "%02X:", i);
		}
		err = ec_read(i, &result);
		if (!err)
			len += sprintf(ec_buf+len, " %02X", result);
		else
			len += sprintf(ec_buf+len, " **");
	}
	len += sprintf(ec_buf+len, "\n");
	copy_to_user(buffer, ec_buf + off, count);
	*offset += count;
	return count;
}
开发者ID:xuzhen,项目名称:lenovo-sl-laptop,代码行数:33,代码来源:lenovo-sl-laptop.c

示例12: get_fan_pwm_enable

static int get_fan_pwm_enable(void)
{
	int level, mode;

	level = ec_read(REG_FAN_SPEED_LEVEL);
	mode = ec_read(REG_FAN_AUTO_MAN_SWITCH);

	if (level == MAX_FAN_SPEED && mode == BIT_FAN_MANUAL)
		mode = 0;
	else if (mode == BIT_FAN_MANUAL)
		mode = 1;
	else
		mode = 2;

	return mode;
}
开发者ID:RealizeItDream,项目名称:Webee210-WRT,代码行数:16,代码来源:yeeloong_laptop.c

示例13: get_recovery_mode_switch

/*
 * The recovery-switch is virtual on Stout and is handled via the EC.
 * Stout recovery mode is only valid if RTC_PWR_STS is set and the EC
 * indicated the recovery keys were pressed. We use a global flag for
 * rec_mode to be used after RTC_POWER_STS has been cleared. This function
 * is complicated by romstage support, which can't use a global variable.
 * Note, rec_mode is the only time the EC is in RO mode, otherwise, RW.
 */
int get_recovery_mode_switch(void)
{
#ifdef __PRE_RAM__
	device_t dev = PCI_DEV(0, 0x1f, 0);
#else
	static int ec_in_rec_mode = 0;
	static int ec_rec_flag_good = 0;
	device_t dev = dev_find_slot(0, PCI_DEVFN(0x1f,0));
#endif

	u8 ec_status = ec_read(EC_STATUS_REG);
	u8 reg8 = pci_read_config8(dev, GEN_PMCON_3);

	printk(BIOS_SPEW,"%s:  EC status:%#x   RTC_BAT: %x\n",
			__func__, ec_status, reg8 & RTC_BATTERY_DEAD);

#ifdef __PRE_RAM__
	return (((reg8 & RTC_BATTERY_DEAD) != 0) &&
	         ((ec_status & 0x3) == EC_IN_RECOVERY_MODE));
#else
	if (!ec_rec_flag_good) {
		ec_in_rec_mode = (((reg8 & RTC_BATTERY_DEAD) != 0) &&
		                     ((ec_status & 0x3) == EC_IN_RECOVERY_MODE));
		ec_rec_flag_good = 1;
	}
	return ec_in_rec_mode;
#endif
}
开发者ID:AdriDlu,项目名称:coreboot,代码行数:36,代码来源:chromeos.c

示例14: acpi_ec_read_io

static ssize_t acpi_ec_read_io(struct file *f, char __user *buf,
			       size_t count, loff_t *off)
{
	/* Use this if support reading/writing multiple ECs exists in ec.c:
	 * struct acpi_ec *ec = ((struct seq_file *)f->private_data)->private;
	 */
	unsigned int size = EC_SPACE_SIZE;
	loff_t init_off = *off;
	int err = 0;

	if (*off >= size)
		return 0;
	if (*off + count >= size) {
		size -= *off;
		count = size;
	} else
		size = count;

	while (size) {
		u8 byte_read;
		err = ec_read(*off, &byte_read);
		if (err)
			return err;
		if (put_user(byte_read, buf + *off - init_off)) {
			if (*off - init_off)
				return *off - init_off; /* partial read */
			return -EFAULT;
		}
		*off += 1;
		size--;
	}
	return count;
}
开发者ID:01org,项目名称:thunderbolt-software-kernel-tree,代码行数:33,代码来源:ec_sys.c

示例15: set_device_state

static ssize_t set_device_state(const char *buf, size_t count, u8 mask)
{
	int status;
	u8 wdata = 0, rdata;
	int result;

	if (sscanf(buf, "%i", &status) != 1 || (status < 0 || status > 1))
		return -EINVAL;

	/* read current device state */
	result = ec_read(MSI_STANDARD_EC_COMMAND_ADDRESS, &rdata);
	if (result < 0)
		return -EINVAL;

	if (!!(rdata & mask) != status) {
		/* reverse device bit */
		if (rdata & mask)
			wdata = rdata & ~mask;
		else
			wdata = rdata | mask;

		result = ec_write(MSI_STANDARD_EC_COMMAND_ADDRESS, wdata);
		if (result < 0)
			return -EINVAL;
	}

	return count;
}
开发者ID:A2109devs,项目名称:lenovo_a2109a_kernel,代码行数:28,代码来源:msi-laptop.c


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