1
0
Fork 0
forked from len0rd/rockbox

Iriver: atomic I/O port manipulation macros, to avoid interference between normal and interrupt code. Todo: all other places that do port manipulation on ports which may also be changed from an intterupt should use that as well. It even decreases binary size a bit.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6985 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-07-02 12:18:10 +00:00
parent 8102f3da27
commit a8cadd8181
3 changed files with 57 additions and 34 deletions

View file

@ -81,25 +81,48 @@ enum {
#if CONFIG_CPU == SH7034
#define or_b(mask, address) \
asm \
("or.b\t%0,@(r0,gbr)" \
: \
asm \
("or.b %0,@(r0,gbr)" \
: \
: /* %0 */ I_CONSTRAINT((char)(mask)), \
/* %1 */ "z"(address-GBR))
#define and_b(mask, address) \
asm \
("and.b\t%0,@(r0,gbr)" \
("and.b %0,@(r0,gbr)" \
: \
: /* %0 */ I_CONSTRAINT((char)(mask)), \
: /* %0 */ I_CONSTRAINT((char)(mask)), \
/* %1 */ "z"(address-GBR))
#define xor_b(mask, address) \
asm \
("xor.b\t%0,@(r0,gbr)" \
("xor.b %0,@(r0,gbr)" \
: \
: /* %0 */ I_CONSTRAINT((char)(mask)), \
: /* %0 */ I_CONSTRAINT((char)(mask)), \
/* %1 */ "z"(address-GBR))
#elif CONFIG_CPU == MCF5249
#define or_l(mask, address) \
asm \
("or.l %0,(%1)" \
: \
: /* %0 */ "d"(mask), \
/* %1 */ "a"(address))
#define and_l(mask, address) \
asm \
("and.l %0,(%1)" \
: \
: /* %0 */ "d"(mask), \
/* %1 */ "a"(address))
#define eor_l(mask, address) \
asm \
("eor.l %0,(%1)" \
: \
: /* %0 */ "d"(mask), \
/* %1 */ "a"(address))
#endif
#ifndef SIMULATOR