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

C++ smbus_read_byte函数代码示例

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

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



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

示例1: dump_smbus_registers

static inline void dump_smbus_registers(void)
{
	u32 device;

	print_debug("\n");
	for (device = 1; device < 0x80; device++) {
		int j;
		if (smbus_read_byte(device, 0) < 0)
			continue;
		printk(BIOS_DEBUG, "smbus: %02x", device);
		for (j = 0; j < 256; j++) {
			int status;
			unsigned char byte;
			status = smbus_read_byte(device, j);
			if (status < 0) {
				break;
			}
			if ((j & 0xf) == 0) {
				printk(BIOS_DEBUG, "\n%02x: ", j);
			}
			byte = status & 0xff;
			printk(BIOS_DEBUG, "%02x ", byte);
		}
		print_debug("\n");
	}
}
开发者ID:jaanek,项目名称:coreboot,代码行数:26,代码来源:romstage.c


示例2: dump_spd_registers

void dump_spd_registers(void)
{
	unsigned device;
	device = SMBUS_MEM_DEVICE_START;
	printk(BIOS_DEBUG, "\n");
	while(device <= SMBUS_MEM_DEVICE_END) {
		int status = 0;
		int i;
		printk(BIOS_DEBUG, "dimm %02x", device);
		for(i = 0; (i < 256) && (status == 0); i++) {
			unsigned char byte;
			if ((i % 20) == 0) {
				printk(BIOS_DEBUG, "\n%3d: ", i);
			}
			status = smbus_read_byte(device, i, &byte);
			if (status != 0) {
				printk(BIOS_DEBUG, "bad device\n");
				continue;
			}
			printk(BIOS_DEBUG, "%02x ", byte);
		}
		device += SMBUS_MEM_DEVICE_INC;
		printk(BIOS_DEBUG, "\n");
	}
}
开发者ID:jaanek,项目名称:coreboot,代码行数:25,代码来源:debug.c


示例3: at24rf08c_read_string

static void at24rf08c_read_string(u8 bank, u8 start, u8 len, char *result)
{
	int i;
	device_t dev;

	dev = dev_find_slot_on_smbus(1, 0x54 | bank);
	if (dev == 0) {
		printk(BIOS_WARNING, "EEPROM not found\n");
		memcpy(result, "*INVALID*", sizeof ("*INVALID*"));
		return;
	}

	for (i = 0; i < len; i++) {
		int t;
		int j;
		/* After a register write AT24RF08C (which we issued in init function) sometimes stops responding.
		   Retry several times in case of failure.
		*/
		for (j = 0; j < 100; j++) {
			t = smbus_read_byte(dev, start + i);
			if (t >= 0)
				break;
		}
		if (t < 0x20 || t > 0x7f) {
			memcpy(result, "*INVALID*", sizeof ("*INVALID*"));
			return;
		}
		result[i] = t;
	}
}
开发者ID:B-Rich,项目名称:coreboot,代码行数:30,代码来源:lenovo_serials.c


示例4: spd_read_byte

static inline int spd_read_byte(unsigned int device, unsigned int address)
{
	if (device != DIMM0)
		return 0xFF;	/* No DIMM1, don't even try. */

	return smbus_read_byte(device, address);
}
开发者ID:RafaelRMachado,项目名称:Coreboot,代码行数:7,代码来源:romstage.c


示例5: dump_spd_registers

void dump_spd_registers(void)
{
	int i;
	printk(BIOS_DEBUG, "\n");
	for (i = 0; i < DIMM_SOCKETS; i++) {
		unsigned device;
		device = DIMM0 + i;
		if (device) {
			int j;
			printk(BIOS_DEBUG, "DIMM %d: %02x", i, device);
			for (j = 0; j < 256; j++) {
				int status;
				unsigned char byte;
				if ((j & 0xf) == 0) {
					printk(BIOS_DEBUG, "\n%02x: ", j);
				}
				status = smbus_read_byte(device, j);
				if (status < 0) {
					printk(BIOS_DEBUG, "bad device\n");
					break;
				}
				byte = status & 0xff;
				printk(BIOS_DEBUG, "%02x ", byte);
			}
			printk(BIOS_DEBUG, "\n");
		}
	}
}
开发者ID:lynxis,项目名称:coreboot-signed,代码行数:28,代码来源:debug.c


示例6: spd_read_byte

int spd_read_byte(unsigned int device, unsigned int address)
{
	/* Only DIMM0 is available. */
	if (device != DIMM0)
		return 0xFF;

	return smbus_read_byte(device, address);
}
开发者ID:DarkDefender,项目名称:coreboot,代码行数:8,代码来源:romstage.c


示例7: adm1027_enable_monitoring

static void adm1027_enable_monitoring(device_t dev)
{
	int result;

	result = smbus_read_byte(dev, ADM1027_REG_CONFIG1);

	if (!(result & CFG1_RDY)) {
		printk(BIOS_DEBUG, "ADM1027: monitoring not ready\n");
		return;
	}
	result = (result | CFG1_STRT);
	result = smbus_write_byte(dev, ADM1027_REG_CONFIG1, result);

	result = smbus_read_byte(dev, ADM1027_REG_CONFIG1);
	if (!(result & CFG1_STRT)) {
		printk(BIOS_DEBUG, "ADM1027: monitoring would not enable\n");
	}
	printk(BIOS_DEBUG, "ADM1027: monitoring enabled\n");
}
开发者ID:XVilka,项目名称:coreboot,代码行数:19,代码来源:adm1027.c


示例8: lm63_init

static void lm63_init(struct device *dev)
{
	int result;
	if (dev->enabled && dev->path.type == DEVICE_PATH_I2C) {
		if (ops_smbus_bus(get_pbus_smbus(dev))) {
			if (dev->bus->dev->path.type == DEVICE_PATH_I2C)
				smbus_set_link(dev);	// it is under mux
			result = smbus_read_byte(dev, 0x03);
//                      result &= ~0x04;
			result |= 0x04;
			smbus_write_byte(dev, 0x03, result & 0xff);	// config lm63
		}
	}
}
开发者ID:canistation,项目名称:coreboot,代码行数:14,代码来源:lm63.c


示例9: smbios_mainboard_set_uuid

void smbios_mainboard_set_uuid(u8 *uuid)
{
	static char result[16];
	unsigned i;
	static int already_read;
	device_t dev;
	const int remap[16] = {
		/* UUID byteswap.  */
		3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15
	};


	if (already_read) {
		memcpy (uuid, result, 16);
		return;
	}

	memset (result, 0, sizeof (result));

	dev = dev_find_slot_on_smbus(1, 0x56);
	if (dev == 0) {
		printk(BIOS_WARNING, "eeprom not found\n");
		already_read = 1;
		memset (uuid, 0, 16);
		return;
	}

	for (i = 0; i < 16; i++) {
		int t;
		int j;
		/* After a register write AT24RF08C (which we issued in init function) sometimes stops responding.
		   Retry several times in case of failure.
		*/
		for (j = 0; j < 100; j++) {
			t = smbus_read_byte(dev, 0x12 + i);
			if (t >= 0)
				break;
		}
		if (t < 0) {
			memset (result, 0, sizeof (result));
			break;
		}
		result[remap[i]] = t;
	}

	already_read = 1;

	memcpy (uuid, result, 16);
}
开发者ID:B-Rich,项目名称:coreboot,代码行数:49,代码来源:lenovo_serials.c


示例10: spd_enable_refresh

static void spd_enable_refresh(void)
{
    /*
     * Effects:	Uses serial presence detect to set the
     *              refresh rate in the DRAMC register.
     *		see spd_set_dramc for the other values.
     * FIXME:	Check for illegal/unsupported ram configurations and abort
     */
#if HAVE_STATIC_ARRAY_SUPPORT
    static const unsigned char refresh_rates[] = {
        0x01, /* Normal        15.625 us -> 15.6 us */
        0x05, /* Reduced(.25X) 3.9 us    -> 7.8 us */
        0x05, /* Reduced(.5X)  7.8 us    -> 7.8 us */
        0x02, /* Extended(2x)  31.3 us   -> 31.2 us */
        0x03, /* Extended(4x)  62.5 us   -> 62.4 us */
        0x04, /* Extended(8x)  125 us    -> 124.8 us */
    };
#endif
    /* Find the first dimm and assume the rest are the same */
    int status;
    int byte;
    unsigned device;
    unsigned refresh_rate;
    byte = -1;
    status = -1;
    device = SMBUS_MEM_DEVICE_START;
    while ((byte < 0) && (device <= SMBUS_MEM_DEVICE_END)) {
        byte = smbus_read_byte(device, 12);
        device += SMBUS_MEM_DEVICE_INC;
    }
    if (byte < 0) {
        /* We couldn't find anything we must have no memory */
        sdram_no_memory();
    }
    byte &= 0x7f;
    /* Default refresh rate be conservative */
    refresh_rate = 5;
    /* see if the ram refresh is a supported one */
    if (byte < 6) {
#if HAVE_STATIC_ARRAY_SUPPORT
        refresh_rate = refresh_rates[byte];
#endif
    }
    byte = pcibios_read_config_byte(I440GX_BUS, I440GX_DEVFN, 0x57);
    byte &= 0xf8;
    byte |= refresh_rate;
    pcibios_write_config_byte(I440GX_BUS, I440GX_DEVFN, 0x57, byte);
}
开发者ID:0ida,项目名称:coreboot,代码行数:48,代码来源:simple_test5.c


示例11: spd_read_byte

/**
 * The onboard 64MB PC133 memory does not have a SPD EEPROM so the
 * values have to be set manually, the SO-DIMM socket is located in
 * socket0 (0x50/DIMM0), and the onboard memory is located in socket1
 * (0x51/DIMM1).
 */
static inline int spd_read_byte(unsigned device, unsigned address)
{
	int i;

	if (device == DIMM0) {
		return smbus_read_byte(device, address);
	} else if (device == DIMM1) {
		for (i = 0; i < ARRAY_SIZE(spd_table); i++) {
			if (spd_table[i].address == address)
				return spd_table[i].data;
		}
		return 0xFF; /* Return 0xFF when address is not found. */
	} else {
		return 0xFF; /* Return 0xFF on any failures. */
	}
}
开发者ID:DarkDefender,项目名称:coreboot,代码行数:22,代码来源:romstage.c


示例12: init

static void init(struct device *dev)
{
	unsigned int i;
	u32 chksum = 0;
	char block[20];
	msr_t reset;
	device_t eeprom_dev = dev_find_slot_on_smbus(1, 0x52);

	if (eeprom_dev == 0) {
		printk(BIOS_WARNING, "eeprom not found\n");
		return;
	}

	/* turn off all leds except led_ini */
	outb(0x02, 0x5a); /* bit0 - led_run */
			  /* bit1 - led_ini */
			  /* bit2 - led_err */
			  /* bit3-bit7 - write has no effect */
	outb(0x00, 0x49); /* bit0-bit6 - led_7-led_1 */
			  /* bit7 - write has no effect */

	/* read the whole block and check if checksum is okay */
	for (i = 0; i < 20; i++) {
		block[i] = smbus_read_byte(eeprom_dev, i);
		chksum += block[i];
	}

	if (chksum != 0) {
		printk(BIOS_WARNING, "wrong checksum: 0x%0x\n", chksum);
	}

	hw_rev = block[5];

	printk(BIOS_DEBUG, "hw revision: %u\n", hw_rev);

	/* Reset MFGPT7 (standby power domain) - this is done via
	 * an undocumented register */
	reset = rdmsr(0x5140002b);
	reset.lo |= 1 << 7;
	wrmsr(0x5140002b, reset);
}
开发者ID:AdriDlu,项目名称:coreboot,代码行数:41,代码来源:mainboard.c


示例13: pcal9538a_get_output_type

uint8_t pcal9538a_get_output_type(PCAL9538A *pcal, uint8_t *result){
  return smbus_read_byte(pcal->config.i2c, pcal->config.address, PCAL9538A_RA_OUT_TYPE, result);
}
开发者ID:cuspaceflight,项目名称:m3-avionics,代码行数:3,代码来源:pcal9538a.c


示例14: pcal9538a_read_outputs

uint8_t pcal9538a_read_outputs(PCAL9538A *pcal, uint8_t *result){
  return smbus_read_byte(pcal->config.i2c, pcal->config.address, PCAL9538A_RA_OUTPUT, result);
}
开发者ID:cuspaceflight,项目名称:m3-avionics,代码行数:3,代码来源:pcal9538a.c


示例15: pcal9538a_get_input_inversion

uint8_t pcal9538a_get_input_inversion(PCAL9538A *pcal, uint8_t *result){
  return smbus_read_byte(pcal->config.i2c, pcal->config.address, PCAL9538A_RA_INVERSION, result);
}
开发者ID:cuspaceflight,项目名称:m3-avionics,代码行数:3,代码来源:pcal9538a.c


示例16: spd_read_byte

static int spd_read_byte(u32 device, u32 address)
{
	int result;
	result = smbus_read_byte(device, address);
	return result;
}
开发者ID:jaanek,项目名称:coreboot,代码行数:6,代码来源:romstage.c


示例17: spd_read_byte

int spd_read_byte(unsigned int device, unsigned int address)
{
	return smbus_read_byte(device, address);
}
开发者ID:hustcalm,项目名称:coreboot-hacking,代码行数:4,代码来源:romstage.c


示例18: nic_init

static void nic_init(struct device *dev)
{
	u32 dword, old, mac_h = 0, mac_l = 0;
	int eeprom_valid = 0;
	struct southbridge_nvidia_ck804_config *conf;
	static u32 nic_index = 0;
	u8 *base;
	struct resource *res;

	res = find_resource(dev, 0x10);
	base = res2mmio(res, 0, 0);

#define NvRegPhyInterface  0xC0
#define PHY_RGMII          0x10000000

	write32(base + NvRegPhyInterface, PHY_RGMII);

	old = dword = pci_read_config32(dev, 0x30);
	dword &= ~(0xf);
	dword |= 0xf;
	if (old != dword)
		pci_write_config32(dev, 0x30, dword);

	conf = dev->chip_info;

	if (conf->mac_eeprom_smbus != 0) {
		/* Read MAC address from EEPROM at first. */
		struct device *dev_eeprom;
		dev_eeprom = dev_find_slot_on_smbus(conf->mac_eeprom_smbus,
					   conf->mac_eeprom_addr);

		if (dev_eeprom) {
			/* If that is valid we will use that. */
			unsigned char dat[6];
			int i, status;
			for (i = 0; i < 6; i++) {
				status = smbus_read_byte(dev_eeprom, i);
				if (status < 0)
					break;
				dat[i] = status & 0xff;
			}
			if (status >= 0) {
				mac_l = 0;
				for (i = 3; i >= 0; i--) {
					mac_l <<= 8;
					mac_l += dat[i];
				}
				if (mac_l != 0xffffffff) {
					mac_l += nic_index;
					mac_h = 0;
					for (i = 5; i >= 4; i--) {
						mac_h <<= 8;
						mac_h += dat[i];
					}
					eeprom_valid = 1;
				}
			}
		}
	}

	/* If that is invalid we will read that from romstrap. */
	if (!eeprom_valid) {
		u32 *mac_pos;
		mac_pos = (u32 *)0xffffffd0; /* See romstrap.inc and romstrap.ld. */
		mac_l = read32(mac_pos) + nic_index;
		mac_h = read32(mac_pos + 1);
	}
#if 1
	/* Set that into NIC MMIO. */
#define NvRegMacAddrA  0xA8
#define NvRegMacAddrB  0xAC
	write32(base + NvRegMacAddrA, mac_l);
	write32(base + NvRegMacAddrB, mac_h);
#else
	/* Set that into NIC. */
	pci_write_config32(dev, 0xa8, mac_l);
	pci_write_config32(dev, 0xac, mac_h);
#endif

	nic_index++;
}
开发者ID:RafaelRMachado,项目名称:Coreboot,代码行数:81,代码来源:nic.c


示例19: pcal9538a_get_pull_up_down

uint8_t pcal9538a_get_pull_up_down(PCAL9538A *pcal, uint8_t *result){
  return smbus_read_byte(pcal->config.i2c, pcal->config.address, PCAL9538A_RA_PUD_DIR, result);
}
开发者ID:cuspaceflight,项目名称:m3-avionics,代码行数:3,代码来源:pcal9538a.c


示例20: pcal9538a_get_pull_enabled

uint8_t pcal9538a_get_pull_enabled(PCAL9538A *pcal, uint8_t *result){
  return smbus_read_byte(pcal->config.i2c, pcal->config.address, PCAL9538A_RA_PUD_ENABLE, result);
}
开发者ID:cuspaceflight,项目名称:m3-avionics,代码行数:3,代码来源:pcal9538a.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ smd_close函数代码示例发布时间:2022-05-30
下一篇:
C++ smbfs_fullpath函数代码示例发布时间: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