Lines Matching refs:field
13 static void __eeprom_field_print_bin(const struct eeprom_field *field, in __eeprom_field_print_bin() argument
17 int from = reverse ? field->size - 1 : 0; in __eeprom_field_print_bin()
18 int to = reverse ? 0 : field->size - 1; in __eeprom_field_print_bin()
20 printf(PRINT_FIELD_SEGMENT, field->name); in __eeprom_field_print_bin()
22 printf("%02x%s", field->buf[i], delimiter); in __eeprom_field_print_bin()
24 printf("%02x\n", field->buf[i]); in __eeprom_field_print_bin()
27 static int __eeprom_field_update_bin(struct eeprom_field *field, in __eeprom_field_update_bin() argument
36 if (len > field->size * 2) in __eeprom_field_update_bin()
39 memset(field->buf, 0, field->size); in __eeprom_field_update_bin()
42 for (j = 0; j < field->size; j++) { in __eeprom_field_update_bin()
62 field->buf[j] = byte; in __eeprom_field_update_bin()
69 static int __eeprom_field_update_bin_delim(struct eeprom_field *field, in __eeprom_field_update_bin_delim() argument
85 if (count > field->size) in __eeprom_field_update_bin_delim()
89 for (i = 0; tok && i < field->size; i++) { in __eeprom_field_update_bin_delim()
95 field->buf[i] = (unsigned char)val; in __eeprom_field_update_bin_delim()
112 void eeprom_field_print_bin(const struct eeprom_field *field) in eeprom_field_print_bin() argument
114 __eeprom_field_print_bin(field, "", false); in eeprom_field_print_bin()
123 int eeprom_field_update_bin(struct eeprom_field *field, char *value) in eeprom_field_update_bin() argument
125 return __eeprom_field_update_bin(field, value, false); in eeprom_field_update_bin()
135 int eeprom_field_update_reserved(struct eeprom_field *field, char *value) in eeprom_field_update_reserved() argument
137 return __eeprom_field_update_bin_delim(field, value, " "); in eeprom_field_update_reserved()
154 void eeprom_field_print_bin_rev(const struct eeprom_field *field) in eeprom_field_print_bin_rev() argument
156 __eeprom_field_print_bin(field, "", true); in eeprom_field_print_bin_rev()
170 int eeprom_field_update_bin_rev(struct eeprom_field *field, char *value) in eeprom_field_update_bin_rev() argument
172 return __eeprom_field_update_bin(field, value, true); in eeprom_field_update_bin_rev()
185 void eeprom_field_print_mac(const struct eeprom_field *field) in eeprom_field_print_mac() argument
187 __eeprom_field_print_bin(field, ":", false); in eeprom_field_print_mac()
197 int eeprom_field_update_mac(struct eeprom_field *field, char *value) in eeprom_field_update_mac() argument
199 return __eeprom_field_update_bin_delim(field, value, ":"); in eeprom_field_update_mac()
206 void eeprom_field_print_ascii(const struct eeprom_field *field) in eeprom_field_print_ascii() argument
210 sprintf(format, "%%.%ds\n", field->size); in eeprom_field_print_ascii()
211 printf(PRINT_FIELD_SEGMENT, field->name); in eeprom_field_print_ascii()
212 printf(format, field->buf); in eeprom_field_print_ascii()
222 int eeprom_field_update_ascii(struct eeprom_field *field, char *value) in eeprom_field_update_ascii() argument
224 if (strlen(value) >= field->size) { in eeprom_field_update_ascii()
225 printf("%s: new data too long\n", field->name); in eeprom_field_update_ascii()
229 strncpy((char *)field->buf, value, field->size - 1); in eeprom_field_update_ascii()
230 field->buf[field->size - 1] = '\0'; in eeprom_field_update_ascii()
245 void eeprom_field_print_reserved(const struct eeprom_field *field) in eeprom_field_print_reserved() argument
248 printf("(%d bytes)\n", field->size); in eeprom_field_print_reserved()