Commit e015c63b authored by Alejandro Mery's avatar Alejandro Mery
Browse files

bin2fex: output some single datums in hexa

parent 32a346a4
...@@ -32,6 +32,29 @@ ...@@ -32,6 +32,29 @@
#define PTR(B, OFF) (void*)((char*)(B)+(OFF)) #define PTR(B, OFF) (void*)((char*)(B)+(OFF))
/**
*/
static int name_in_list(const char *s, const char **list)
{
size_t l = strlen(s);
{ /* remove trailing digits */
const char *p = &s[l-1];
while (l && *p >= '0' && *p <= '9') {
l--;
p--;
}
}
while (*list) {
if (memcmp(s, *list, l) == 0)
return 1;
list++;
}
return 0;
}
/** /**
*/ */
static inline int decompile_gpio(struct script_section *section, static inline int decompile_gpio(struct script_section *section,
...@@ -76,6 +99,14 @@ static inline int decompile_single(struct script_section *section, ...@@ -76,6 +99,14 @@ static inline int decompile_single(struct script_section *section,
int length, FILE *out) int length, FILE *out)
{ {
int ok = 1; int ok = 1;
static const char *hexa_entries[] = {
"dram_baseaddr", "dram_zq", "dram_tpr", "dram_emr",
"g2d_size",
"rtp_press_threshold", "rtp_sensitive_level",
"ctp_twi_addr", "csi_twi_addr", "csi_twi_addr_b", "tkey_twi_addr",
"lcd_gamma_tbl_",
"gsensor_twi_addr",
NULL };
if (length != 1) { if (length != 1) {
pr_err("%s.%s: invalid length %d (assuming %d)\n", pr_err("%s.%s: invalid length %d (assuming %d)\n",
...@@ -83,7 +114,12 @@ static inline int decompile_single(struct script_section *section, ...@@ -83,7 +114,12 @@ static inline int decompile_single(struct script_section *section,
ok = 0; ok = 0;
} }
fprintf(out, "%s\t= %d\n", entry->name, *d); fprintf(out, "%s\t= ", entry->name);
if (name_in_list(entry->name, hexa_entries))
fprintf(out, "0x%x", *d);
else
fprintf(out, "%d", *d);
fputc('\n', out);
return ok; return ok;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment