Compare commits
5 commits
f9cafce309
...
231d64480d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
231d64480d | ||
|
|
afc22b373a | ||
|
|
9da8fda8ca | ||
|
|
b261dd0a3f | ||
|
|
3879e0317d |
3 changed files with 10 additions and 13 deletions
11
altera.c
11
altera.c
|
|
@ -419,7 +419,7 @@ int altera_set_register(struct command *cmd, const struct command_par *par,
|
|||
name = namestr;
|
||||
snprintf(namestr, sizeof(namestr), "0x%04x", cc&0xdfff);
|
||||
}
|
||||
unsigned int p = 0;
|
||||
unsigned int p = cc >> 16;
|
||||
if (how & alt_cmd_read)
|
||||
cc &= ~0x4000;
|
||||
else if (!e) {
|
||||
|
|
@ -427,13 +427,8 @@ int altera_set_register(struct command *cmd, const struct command_par *par,
|
|||
cc |= 0x4000;
|
||||
if (parse_char1(cmd, '='))
|
||||
cc |= 0x4000;
|
||||
if (!(cc&0xffff0000)) {
|
||||
e = parse_expression(cmd, &p);
|
||||
if (!e)
|
||||
cc |= 0x4000 | (p<<16);
|
||||
else if (!(cc & 0x4000))
|
||||
e = 0;
|
||||
}
|
||||
if (!p && !parse_expression(cmd, &p))
|
||||
cc |= 0x4000 | (p<<16);
|
||||
}
|
||||
union {
|
||||
unsigned short s[2];
|
||||
|
|
|
|||
10
i2c.c
10
i2c.c
|
|
@ -65,12 +65,14 @@ int i2c_write(struct command *cmd, const struct command_par *par)
|
|||
unsigned int c = (unsigned int)(par->par);
|
||||
error_msg_t e = parse_flags(cmd, i2c_write_kw, &c);
|
||||
unsigned int cc = (c <<= 16) | i2c_register | 0xc001;
|
||||
if (!e && (cc & 0x03000000) != 0x03000000)
|
||||
if (!e && (cc & 0x03000000) != 0x03000000 && !(cc & 0x007e0000)) {
|
||||
// /stop and /unstuck do not use an agrument
|
||||
// /mag /acc are sufficient
|
||||
e = parse_expression_square(cmd, &c, optional_brackets);
|
||||
cc |= c<<16;
|
||||
}
|
||||
if (e)
|
||||
return parser_error_message(cmd, e);
|
||||
cc |= c<<16;
|
||||
i2c_size ++;
|
||||
return altera_set_register(cmd, par, 0, alt_cmd_inj, cc, "i2c");
|
||||
}
|
||||
|
|
@ -104,7 +106,7 @@ int i2c_addr(struct command *cmd, const struct command_par *par)
|
|||
}
|
||||
error_msg_t e = parse_expression_square(cmd, &a, optional_empty | optional_close);
|
||||
if (!e)
|
||||
e = parse_expression_square(cmd, &n, optional_brackets | optional_open);
|
||||
e = parse_expression_square(cmd, &n, optional_any | optional_open);
|
||||
if (e)
|
||||
return parser_error_message(cmd, e);
|
||||
if (n < 0x10000) {
|
||||
|
|
@ -121,7 +123,7 @@ int i2c_addr(struct command *cmd, const struct command_par *par)
|
|||
a = 0;
|
||||
case 0x4000:
|
||||
i2c_address = a;
|
||||
i2c_size = 0;
|
||||
i2c_size = n >> 24;
|
||||
break;
|
||||
case 0x4001:
|
||||
i2c_size += 1;
|
||||
|
|
|
|||
2
parser.c
2
parser.c
|
|
@ -378,7 +378,7 @@ error_msg_t parse_expression_square(struct command *cmd, unsigned int *r, int op
|
|||
if (!(optional & optional_open && isopen))
|
||||
e = expect_char(cmd, '[');
|
||||
isopen = 0;
|
||||
if (e && !(optional_open & optional_brackets))
|
||||
if (e && !(optional & optional_brackets))
|
||||
if (optional & optional_expression)
|
||||
return 0;
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue