1 #ifndef __HARDWARE_H__
\r
2 #define __HARDWARE_H__
\r
4 #include <pic18f252.h>
\r
8 #define PROG_B TRISAbits.TRISA2 /* FPGA config */
\r
9 #define PROG_B_VAL PORTAbits.RA2 /* FPGA config */
\r
10 #define DONE PORTBbits.RB3 /* FPGA config */
\r
11 #define INIT_B PORTAbits.RA3 /* FPGA config */
\r
12 #define CCLK LATAbits.LATA5 /* FPGA config */
\r
13 #define DIN LATBbits.LATB7 /* FPGA config */
\r
14 #define _SW0 PORTBbits.RB0 /* Switch input */
\r
15 #define _SW1 PORTBbits.RB1 /* Switch input */
\r
16 #define _M_CD TRISAbits.TRISA0 /* mmc card clock disable */
\r
17 #define _M_CS PORTCbits.RC0 /* mmc card spi select */
\r
18 #define _F_CS0 PORTAbits.RA1 /* FGPA spi0 select */
\r
19 #define SCSI_HSHAKE PORTBbits.RB5 /* SCSI data request */
\r
20 #define NMI PORTBbits.RB6 /* Programmer switch */
\r
22 /* Some IO accessors. static inline somewhat broken with sdcc so
\r
23 * I use macros... sad
\r
25 #define spi_enable_fpga() do { \
\r
29 #define spi_disable_fpga() do { \
\r
33 #define spi_enable_osd() do { \
\r
37 #define spi_disable_osd() do { \
\r
41 #define spi_enable_sdcard() do { \
\r
46 #define spi_disable_sdcard() do { \
\r
52 #define check_button(void) (!_SW0)
\r
54 #define reset_fpga() do { \
\r
60 #define diskled_on() do { \
\r
61 PORTBbits.RB4 = 1; \
\r
64 #define diskled_off() do { \
\r
65 PORTBbits.RB4 = 0; \
\r
69 extern void hardware_init(void);
\r
71 extern unsigned short get_timer(unsigned short offset);
\r
72 extern char check_timer(unsigned short t);
\r
73 extern void wait_timer(unsigned short time);
\r
75 extern unsigned char do_spi(unsigned char data);
\r
76 extern void shift_fpga(unsigned char data);
\r
78 /* Backbus interface defines */
\r
79 #define BB_WRITE 0x80
\r
80 #define BB_AUTOINC 0x40
\r
82 #define BB_REG_CTRL_BASE 0x00
\r
83 #define BB_REG_CPU_BASE 0x10
\r
84 #define BB_REG_MEM_BASE 0x20
\r
85 #define BB_REG_IWM_BASE 0x28
\r
86 #define BB_REG_SCSI_BASE 0x30
\r
87 #define BB_REG_SCOPE_BASE 0x38
\r
90 #endif /* __HARDWARE_H__ */
\r