Lines Matching refs:buf
15 static int ivm_calc_crc(unsigned char *buf, int len) in ivm_calc_crc() argument
30 byte = buf[i]; in ivm_calc_crc()
58 static int ivm_get_value(unsigned char *buf, int len, char *name, int off, in ivm_get_value() argument
64 if ((buf[off + 0] != buf[off + 2]) && in ivm_get_value()
65 (buf[off + 2] != buf[off + 4])) { in ivm_get_value()
69 val = buf[off + 0] + (buf[off + 1] << 8); in ivm_get_value()
103 unsigned char *buf) in ivm_findinventorystring() argument
125 if (buf[addr] == '\r') in ivm_findinventorystring()
136 for (; (buf[addr] != '\r') && in ivm_findinventorystring()
137 ((buf[addr] != ';') || (!stop)) && in ivm_findinventorystring()
141 convert_char (buf[addr])); in ivm_findinventorystring()
153 (buf[addr] != '\r')) { in ivm_findinventorystring()
169 if (ivm_findinventorystring(which, valbuf, len, buf) == 0) { \
173 static int ivm_check_crc(unsigned char *buf, int block) in ivm_check_crc() argument
178 crc = ivm_calc_crc(buf, CONFIG_SYS_IVM_EEPROM_PAGE_LEN - 2); in ivm_check_crc()
179 crceeprom = (buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN - 1] + \ in ivm_check_crc()
180 buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN - 2] * 256); in ivm_check_crc()
191 static int process_mac(unsigned char *valbuf, unsigned char *buf, in process_mac() argument
195 unsigned long val = (buf[4] << 16) + (buf[5] << 8) + buf[6]; in process_mac()
200 memcpy(mac, buf+1, 6); in process_mac()
220 static int ivm_analyze_block2(unsigned char *buf, int len) in ivm_analyze_block2() argument
226 sprintf((char *)valbuf, "%pM", buf + 1); in ivm_analyze_block2()
229 count = (buf[10] << 24) + in ivm_analyze_block2()
230 (buf[11] << 16) + in ivm_analyze_block2()
231 (buf[12] << 8) + in ivm_analyze_block2()
232 buf[13]; in ivm_analyze_block2()
240 int ivm_analyze_eeprom(unsigned char *buf, int len) in ivm_analyze_eeprom() argument
246 if (ivm_check_crc(buf, 0) != 0) in ivm_analyze_eeprom()
249 ivm_get_value(buf, CONFIG_SYS_IVM_EEPROM_PAGE_LEN, in ivm_analyze_eeprom()
251 val = ivm_get_value(buf, CONFIG_SYS_IVM_EEPROM_PAGE_LEN, in ivm_analyze_eeprom()
259 ivm_get_value(buf, CONFIG_SYS_IVM_EEPROM_PAGE_LEN, in ivm_analyze_eeprom()
292 if (ivm_check_crc(&buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN * 2], 2) != 0) in ivm_analyze_eeprom()
294 ivm_analyze_block2(&buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN * 2], in ivm_analyze_eeprom()
300 static int ivm_populate_env(unsigned char *buf, int len) in ivm_populate_env() argument
306 if (ivm_check_crc(buf, 2)) in ivm_populate_env()
308 page2 = &buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN*2]; in ivm_populate_env()
333 int ivm_read_eeprom(unsigned char *buf, int len) in ivm_read_eeprom() argument
341 ret = i2c_read(CONFIG_SYS_IVM_EEPROM_ADR, 0, 1, buf, len); in ivm_read_eeprom()
347 return ivm_populate_env(buf, len); in ivm_read_eeprom()