Commit 5142a242 authored by Alejandro Mery's avatar Alejandro Mery
Browse files

fexc: fix fex compiler to accept port:powerN GPIOs

parent bcde0fc7
...@@ -257,15 +257,31 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script) ...@@ -257,15 +257,31 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script)
continue; continue;
} }
perror("malloc"); perror("malloc");
} else if (memcmp("port:P", p, 6) == 0) { } else if (memcmp("port:", p, 5) == 0) {
/* GPIO */ /* GPIO */
p += 6; p += 5;
if (*p < 'A' || *p > 'Z') if (p[0] == 'P' &&
(p[1] < 'A' || p[1] > 'I'))
;
else if (*p != 'P' &&
memcmp(p, "power", 5) != 0)
; ;
else { else {
char *end; char *end;
int port = *p++ - 'A' + 1; int port;
long v = strtol(p, &end, 10); long v;
if (*p == 'P') {
/* port:PXN */
port = p[1] - 'A' + 1;
p += 2;
} else {
/* port:powerN */
port = 0xffff;
p += 5;
}
v = strtol(p, &end, 10);
if (end == p) if (end == p)
goto invalid_char_at_p; goto invalid_char_at_p;
else if (v<0 || v>255) { else if (v<0 || v>255) {
......
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