X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=ROM2%2Fvend.h;h=aa6409dd064b401c23a06913d22d66e30fb23420;hb=caf0c7e19f65db08f81413320f11a8d5a8bea5d2;hp=4584f5e77c8010f179057351750c1168c8f411d9;hpb=5e3c2f43539caefc1b99eedc491dde9e31e61c9e;p=uccvend-snackrom.git diff --git a/ROM2/vend.h b/ROM2/vend.h index 4584f5e..aa6409d 100644 --- a/ROM2/vend.h +++ b/ROM2/vend.h @@ -1,6 +1,8 @@ #ifndef _VEND_H_ #define _VEND_H_ +#include "ports.h" + /* FIXME: are these typedefs right for m68hc11-gcc? */ typedef unsigned char u8; typedef signed char s8; @@ -9,43 +11,51 @@ typedef signed short s16; typedef unsigned long u32; typedef signed long s32; typedef u8 bool; -typedef u16 addr_t; +typedef u16 addr_t; + +/* 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_h(a) \ + extern volatile u8* _##a; \ + extern inline void set_##a(u8 b); \ + extern inline void bset_##a(u8 m); \ + extern inline void bclr_##a(u8 m); \ + +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); + +void spi_enable(); +void spi_disable(); /******* 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 */ +#define WRAP_SCROLL_R 2 /* scroll to the right */ +#define WRAP_ALTERNATE 3 /* alternate between text */ -extern char current_message[1024]; +extern char current_message[256]; +void display_init(); void set_msg(char* newmsg); void set_wrap_mode(u8 new_wrap_mode); void display_refresh(); -/******* from helpers.c *******/ -#define buffered_port_h(p) \ - void outb_##p(u8 b); \ - void bset_##p(u8 mask); \ - void bclr_##p(u8 mask); - -void outb(u16 port, u8 byte); -void bset(u16 addr, u8 mask); -void bclr(u16 addr, u8 mask); - -buffered_port_h(3800); - void delay(u16 ms); -/******** Some IO Ports ******/ -#define PORTA 0x1000 +/******** Some meaningful bits ******/ #define PORTA_DISP_RESET 0x80 /* active low */ - -#define SPCR 0x1028 /* Serial Peripheral Control Register */ -#define SPCR_SPE 0x40 /* Serial Peripheral System Enable */ +#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_ */