本文整理汇总了C++中smbus_read_byte函数的典型用法代码示例。如果您正苦于以下问题:C++ smbus_read_byte函数的具体用法?C++ smbus_read_byte怎么用?C++ smbus_read_byte使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smbus_read_byte函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
}
示例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");
}
}
示例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;
}
}
示例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);
}
示例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");
}
}
}
示例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);
}
示例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");
}
示例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
}
}
}
示例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);
}
示例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);
}
示例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. */
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}