Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
e015c63b
Commit
e015c63b
authored
May 03, 2012
by
Alejandro Mery
Browse files
bin2fex: output some single datums in hexa
parent
32a346a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
bin2fex.c
View file @
e015c63b
...
@@ -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
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment