X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=ROM2%2Fvend.h;h=a756e25259666393fa62bb643ef8ba3899fb06a5;hb=cef1445c4f1ebaa38f9e6561b4fd15f164a27dcd;hp=9e01aaa62e5a5d8446619b46666071e4f39ab47a;hpb=c9763dcb182398266bae1c6a7a848beec1cba35d;p=uccvend-snackrom.git diff --git a/ROM2/vend.h b/ROM2/vend.h index 9e01aaa..a756e25 100644 --- a/ROM2/vend.h +++ b/ROM2/vend.h @@ -5,16 +5,16 @@ #include "types.h" #include "asm.h" -/* addresses of these set at link time */ -/* to add more addresses, define them here with buffered_addr_h, in helpers.c +/* addresses of these set at link time + * to add more addresses, define them here with buffered_addr_h, in helpers.c * with buffered_addr, and also in LDFLAGS in the Makefile */ #define buffered_addr(a) \ extern volatile u8* _##a; \ u8 a; \ extern inline void set_##a(u8 b) { a = *_##a = b; } \ - extern inline void bset_##a(u8 m) { a |= m; *_##a = a; } \ - extern inline void bclr_##a(u8 m) { a &= ~m ; *_##a = a; } + extern inline void bset_##a(const u8 m) { bset(&a, m); *_##a = a; } \ + extern inline void bclr_##a(const u8 m) { bclr(&a, m); *_##a = a; } buffered_addr(switch_input); buffered_addr(misc_input); @@ -22,11 +22,10 @@ buffered_addr(home_sensors); buffered_addr(changer_output); buffered_addr(misc_output); -extern inline void spi_enable() { _io_ports[M6811_SPCR] |= M6811_SPE; } -extern inline void spi_disable() { _io_ports[M6811_SPCR] &= ~M6811_SPE; } +extern inline void spi_enable() { bset((void*)&_io_ports[M6811_SPCR], M6811_SPE); } +extern inline void spi_disable() { bclr((void*)&_io_ports[M6811_SPCR], M6811_SPE); } /******* from helpers.c *******/ - void delay(u16 ms); /******** Some meaningful bits ******/