• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ec_read函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: acpi_create_gnvs

void acpi_create_gnvs(global_nvs_t *gnvs)
{
	gnvs_ = gnvs;

	/*
	 * Disable 3G in suspend by default.
	 * Provide option to enable for http://crosbug.com/p/7925
	 */
	gnvs->s33g = 0;

	/* Disable USB ports in S3 by default */
	gnvs->s3u0 = 0;
	gnvs->s3u1 = 0;

	/* Disable USB ports in S5 by default */
	gnvs->s5u0 = 0;
	gnvs->s5u1 = 0;

	/* IGD Displays */
	gnvs->ndid = 3;
	gnvs->did[0] = 0x80000100;
	gnvs->did[1] = 0x80000240;
	gnvs->did[2] = 0x80000410;
	gnvs->did[3] = 0x80000410;
	gnvs->did[4] = 0x00000005;

	acpi_update_thermal_table(gnvs);

	gnvs->chromeos.vbt2 = ec_read(0xcb) ? ACTIVE_ECFW_RW : ACTIVE_ECFW_RO;
}
开发者ID:tidatida,项目名称:coreboot,代码行数:30,代码来源:acpi_tables.c


示例17: load_scm_model_init

static int load_scm_model_init(struct platform_device *sdev)
{
	u8 data;
	int result;

	/* allow userland write sysfs file  */
	dev_attr_bluetooth.store = store_bluetooth;
	dev_attr_wlan.store = store_wlan;
	dev_attr_threeg.store = store_threeg;
	dev_attr_bluetooth.attr.mode |= S_IWUSR;
	dev_attr_wlan.attr.mode |= S_IWUSR;
	dev_attr_threeg.attr.mode |= S_IWUSR;

	/* disable hardware control by fn key */
	result = ec_read(MSI_STANDARD_EC_SCM_LOAD_ADDRESS, &data);
	if (result < 0)
		return result;

	result = ec_write(MSI_STANDARD_EC_SCM_LOAD_ADDRESS,
		data | MSI_STANDARD_EC_SCM_LOAD_MASK);
	if (result < 0)
		return result;

	/* initial rfkill */
	result = rfkill_init(sdev);
	if (result < 0)
		return result;

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


示例18: omnibook_ec_read

static int omnibook_ec_read(const struct omnibook_operation *io_op, u8 * data)
{
	int retval;

#ifdef CONFIG_ACPI_EC
	if (likely(!acpi_disabled)) {
		retval = ec_read((u8) io_op->read_addr, data);
		if (io_op->read_mask)
			*data &= io_op->read_mask;
//		dprintk("ACPI EC read at %lx success %i.\n", io_op->read_addr, retval);
		return retval;
	}
#endif
	spin_lock_irq(&omnibook_ec_lock);
	retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF);
	if (retval)
		goto end;
	outb(OMNIBOOK_EC_CMD_READ, OMNIBOOK_EC_SC);
	retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF);
	if (retval)
		goto end;
	outb((u8) io_op->read_addr, OMNIBOOK_EC_DATA);
	retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_OBF);
	if (retval)
		goto end;
	*data = inb(OMNIBOOK_EC_DATA);
	if (io_op->read_mask)
		*data &= io_op->read_mask;
      end:
	spin_unlock_irq(&omnibook_ec_lock);
//	dprintk("Custom EC read at %lx success %i.\n", io_op->read_addr, retval);
	return retval;
}
开发者ID:jmesmon,项目名称:omnibook,代码行数:33,代码来源:ec.c


示例19: crt_video_output_set

static int crt_video_output_set(struct output_device *od)
{
	unsigned long status = od->request_state;
	int value;

	if (status == BIT_CRT_DETECT_PLUG) {
		if (ec_read(REG_CRT_DETECT) == BIT_CRT_DETECT_PLUG) {
			/* open CRT */
			outb(0x21, 0x3c4);
			value = inb(0x3c5);
			value &= ~(1 << 7);
			outb(0x21, 0x3c4);
			outb(value, 0x3c5);
		}
	} else {
		/* close CRT */
		outb(0x21, 0x3c4);
		value = inb(0x3c5);
		value |= (1 << 7);
		outb(0x21, 0x3c4);
		outb(value, 0x3c5);
	}

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


示例20: ec_it8518_enable_wake_events

void ec_it8518_enable_wake_events(void)
{
	/*
	 * Set the bit in ECRAM that will enable the Lid switch as a wake source
	 */
	u8 reg8 = ec_read(EC_WAKE_SRC_ENABLE);
	ec_write(EC_WAKE_SRC_ENABLE, reg8 | EC_LID_WAKE_ENABLE);
}
开发者ID:kmalkki,项目名称:coreboot,代码行数:8,代码来源:ec.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ec_write函数代码示例发布时间:2022-05-30
下一篇:
C++ ec函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap