X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=ROM2%2Fvend.h;h=f2f710647e236f2d37378f4383bf09530a569437;hb=HEAD;hp=c7650ca5ac2ce665a6db31ceb83c89b555f64800;hpb=27fb8a023fa0572ef4171624781460bc59537d49;p=uccvend-snackrom.git diff --git a/ROM2/vend.h b/ROM2/vend.h index c7650ca..f2f7106 100644 --- a/ROM2/vend.h +++ b/ROM2/vend.h @@ -11,10 +11,10 @@ */ #define buffered_addr(a) \ extern volatile u8 _##a; \ - u8 a; \ + volatile u8 a; \ extern inline void set_##a(u8 b) { a = b; _##a = b; } \ - 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; } + extern inline void bset_##a(const u8 m) { bset((void*)&a, m); _##a = a; } \ + extern inline void bclr_##a(const u8 m) { bclr((void*)&a, m); _##a = a; } buffered_addr(changer_output); buffered_addr(misc_output); @@ -26,12 +26,34 @@ extern volatile u8 _misc_input; extern volatile u8 _home_sensors; #define home_sensors _home_sensors +#define is_standalone() (misc_input & 0x01) /* DIP sw 1 */ +#define must_verify() (misc_input & 0x02) /* DIP sw 2 */ +#define cant_poke() (misc_input & 0x04) /* DIP sw 3 */ + extern u16 _stack; +extern char _nvram[]; /* 2048 bytes of nvram! */ +// uncomment for testing. +//char _nvram[20]; +/* NVRAM map: + * + * START LEN + * 0x800 0x02 mic.h - current challenge + * 0x802 0x10 mic.h - current secret password + * 0x812 + * + */ /******* from helpers.c *******/ void delay(u16 ms); void my_strncpy(char* dst, char* src, u8 max_size); /* for null-term strings */ +bool my_strncmp(char* a, char* b, u8 len); void my_memcpy(char* dst, char* src, u8 size); +void my_memset(char* dst, u8 val, u16 count); +char* u82hex(u8 a); +u8 hex2u8(char msb, char lsb); +char nibble2hexchar(u8 b); +u8 hexchar2u8(char b); +bool ishex(char b); /******** Some meaningful bits ******/ #define PORTA_CHIME 0x10 /* chime is on when set */ @@ -41,7 +63,7 @@ void my_memcpy(char* dst, char* src, u8 size); #define PORTD_KEYPAD_ROW 0x20 /* clear for row 0, set for row 1 */ -#define PORTE_MOTOR_OVERCURRENT 0x01 +#define PORTE_MOTOR_NOT_OVERCURRENT 0x01 #define PORTE_MOTOR_OVERVOLTAGE 0x02 /* Address 1800 bits */ @@ -60,7 +82,8 @@ void my_memcpy(char* dst, char* src, u8 size); /******* from main.c *******/ int __attribute__((noreturn)) main (void); void __attribute__((interrupt)) rti (void); -void __attribute__((interrupt)) sci_interrupt (void); +void __attribute__((interrupt)) sci_interrupt_serial (void); +void __attribute__((interrupt)) sci_interrupt_coinmech (void); void __attribute__((interrupt)) uart_interrupt (void); /* other one liners */