Compare commits

...

3 commits

Author SHA1 Message Date
Stephan I. Böttcher
ca814c5d13 Merge branch 'master' of forge.bexus.org:Stephan/irena-arm 2025-02-24 16:43:23 +01:00
Stephan I. Böttcher
bae32f9710 i2c_addr: fix parse 2025-02-24 16:43:01 +01:00
stephan
0cb890f34b Makefile: add BOX NMAHEPAM and SETH
git-svn-id: svn+ssh://asterix.ieap.uni-kiel.de/home/subversion/stephan/solo/eda/arm@9279 bc5caf13-1734-44f8-af43-603852e9ee25
2025-02-24 15:20:42 +00:00

18
i2c.c
View file

@ -95,7 +95,7 @@ int i2c_addr(struct command *cmd, const struct command_par *par)
{
unsigned int what = (unsigned int)(par->par);
unsigned int a = -1;
unsigned int n = 0;
unsigned int n = -1;
unsigned int how = 0;
if (what & 2) {
how = alt_cmd_inj;
@ -103,15 +103,19 @@ int i2c_addr(struct command *cmd, const struct command_par *par)
n = i2c_size;
}
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);
if (e)
return parser_error_message(cmd, e);
e = parse_expression_square(cmd, &n, optional_brackets | optional_open);
n <<= 16;
if (a < 0x0100)
n = (n<<8) | (a<<16) | 0x4000;
n |= i2c_register | what & 1;
if (!e)
if (n < 0x10000) {
n <<= 16;
n |= 0x4000;
}
else
n=0;
if (a < 0x0100)
n = ((n & 0xffff0000) << 8) | (a << 16) | 0x4000;
n |= i2c_register | what & 1;
switch (n & 0x4001) {
case 0x0001:
a = 0;