X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=ROM2%2Fvend.h;h=9e01aaa62e5a5d8446619b46666071e4f39ab47a;hb=c9763dcb182398266bae1c6a7a848beec1cba35d;hp=7094266b3a10aa3f93456ce3b49c910cff135633;hpb=0f822a5a37e6e17e027b5a83b8d231a6c0de13eb;p=uccvend-snackrom.git diff --git a/ROM2/vend.h b/ROM2/vend.h index 7094266..9e01aaa 100644 --- a/ROM2/vend.h +++ b/ROM2/vend.h @@ -2,47 +2,41 @@ #define _VEND_H_ #include "ports.h" - -/* FIXME: are these typedefs right for m68hc11-gcc? */ -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned long u32; -typedef signed long s32; -typedef u8 bool; -typedef u16 addr_t; +#include "types.h" +#include "asm.h" /* addresses of these set at link time */ -#define buffered_addr_h(a) \ - extern volatile u8* _##a - -buffered_addr_h(switch_input); -buffered_addr_h(misc_input); -buffered_addr_h(home_sensors); -buffered_addr_h(changer_output); -buffered_addr_h(misc_output); - -/******* from display.c *******/ - -/* scrolling modes */ -#define WRAP_SCROLL_L 1 /* scroll to the left */ -#define WRAP_SCROLL_R 1 /* scroll to the right */ -#define WRAP_ALTERNATE 2 /* alternate between text */ - -extern char current_message[1024]; - -void display_init(); -void set_msg(char* newmsg); -void set_wrap_mode(u8 new_wrap_mode); -void display_refresh(); +/* 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; } + +buffered_addr(switch_input); +buffered_addr(misc_input); +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; } + +/******* from helpers.c *******/ void delay(u16 ms); /******** Some meaningful bits ******/ #define PORTA_DISP_RESET 0x80 /* active low */ +#define PORTD_KEYPAD_ROW 0x20 /* clear for row 0, set for row 1 */ /* Address 3800 bits */ #define A3800_DISPLAY_WRITE 0x04 +/******* from main.c *******/ +int __attribute__((noreturn)) main (void); + #endif /* _VEND_H_ */