#ifndef TRI_H #define TRI_H // trinity specific (must be moved somewhere else) #define bmCap0_I2C 0x01 // has I2C bus #define bmCap0_SER 0x02 // has serial ports (2) #define bmCap0_EPR 0x04 // has flash EEPROM #define bmCap0_RAM 0x08 // has 32k SRAM #define bmCap0_JTG 0x10 // has standard JTAG #define bmCap1_LED 0x01 #define bmCap1_LCD 0x02 #define bmCap1_EXP 0x04 #define bmCap1_LXP 0x08 #define bmCap1_SDR 0x10 // ================================================================================================ // LCD stuff // ================================================================================================ #ifdef LCD_7565 #include #endif #ifdef LCD_44780 #include #endif // ================================================================================================ // USB interrupt hooks // ================================================================================================ extern void (*sudav) (void); extern void (*ep0ack) (void); // sudav used instead extern void (*ep0out) (void); // sudav used instead extern void (*ep0in ) (void); // sudav used instead extern void (*ep1out) (void); extern void (*ep1in ) (void); extern void (*ep2inout) (void); // JTAG host->device extern void (*ep4inout) (void); // JTAG device->host extern void (*ep6inout) (void); // for slave fifo or gpif highspeed transfer extern void (*ep8inout) (void); // for slave fifo or gpif highspeed transfer extern bool (*DR_VendorCommand)(); // ================================================================================================ // global variables // ================================================================================================ extern xdata BYTE devSerialNumber [8]; extern xdata BYTE devCapabilities [8]; extern xdata BYTE devIdentifier [8]; extern BYTE xdata sig[2]; extern BYTE xdata crc[2]; extern xdata DEVICE_DSCR xdata *pDscrDevice; extern xdata DEVICEQUAL_DSCR xdata *pDscrDeviceQual; extern xdata CONFIG_DSCR xdata *pDscrMainConfig; extern xdata CONFIG_DSCR xdata *pDscrOthrConfig; extern xdata CONFIG_DSCR xdata *pDscrFsConfig; extern xdata CONFIG_DSCR xdata *pDscrHsConfig; extern data STRING_DSCR xdata *pDscrString; // ============================================================================ // ============================================================================ // ============================================================================ // // IMPORTANT !!!! // // Keep this include file synchronized with jtag_state.s51 and Delphi // sources !!! // // ============================================================================ // ============================================================================ // ============================================================================ // ============================================================================ // JTAG states (Lattice VME values) // ============================================================================ #define TS_RESET 0 #define TS_IDLE 1 #define TS_IRPAUSE 2 #define TS_DRPAUSE 3 #define TS_IRSHIFT 4 #define TS_DRSHIFT 5 #define TS_DRCAPT 6 #define TS_IREXIT1 7 #define TS_DREXIT1 8 // ============================================================================ // // ENDPOINT 0 request codes // // reserved by cypress: // 0x00 - 0x0C // 0xA0 - 0xAF // // ============================================================================ // ---------------------------------------------------------------------------- // JTAG commands 0xC0 - 0xCF // ---------------------------------------------------------------------------- // interface commands // ------------------------------- #define CMD_JTAG_INIT 0xC0 // initialize JTAG interface #define CMD_JTAG_RESET 0xC1 // reset JTAG interface #define CMD_JTAG_ENABLE 0xC2 // enable physical I/O #define CMD_JTAG_STATUS 0xC3 // get JTAG status // SVF,VME,... commands // ------------------------------- #define CMD_JTAG_ENDIR 0xC8 // #define CMD_JTAG_ENDDR 0xC9 // #define CMD_JTAG_STATE 0xCA // #define CMD_JTAG_TRST 0xCB // // ------------------------------- #define CMD_JTAG_TEST 0xCF // // ---------------------------------------------------------------------------- // Trinity configuration commands 0xE0 - 0xE7 // ---------------------------------------------------------------------------- #define CMD_TRI_CAPS 0xE0 // get/set trinity board capabilities #define CMD_TRI_SERIAL 0xE1 // get/set trinity board serial #define CMD_TRI_IDENTIFIER 0xE2 // get/set trinity board identifier // ---------------------------------------------------------------------------- // Trinity base peripheral commands 0xD0 - 0xDF // ---------------------------------------------------------------------------- #define CMD_TRI_IIC 0xD0 // IIC read/write #define CMD_TRI_SER 0xD8 // serial read/write // ---------------------------------------------------------------------------- // LCD/LED commands // ---------------------------------------------------------------------------- #define CMD_LCD_LED 0x40 // #define CMD_LCD_CLS 0x50 // #define CMD_LCD_GOTOXY 0x51 // #define CMD_LCD_PUTC 0x52 // #define CMD_LCD_PUTS 0x53 // // ============================================================================= // // ENDPOINT 1 request codes // // // ============================================================================= #define CMD_IIC_WRITE 0x00 // IIC write #define CMD_IIC_READ 0x00 // IIC read #define CMD_IIC_READ_RSW 0x01 // IIC read w/ repeated start cond. 16 #define CMD_IIC_READ_RSB 0x02 // IIC read w/ repeated start cond. 8 #define CMD_IIC_WAIT 0x1F // wait for a device // (e.g: wait for eeprom write finish) #define CMD_EEP_WRITE 0x20 // EEPROM write #define CMD_EEP_READ 0x20 // EEPROM read // ============================================================================= // // ENDPOINT 2 request codes // // ============================================================================= // ----------------------------------------------------------------------------- // JTAG commands 0xC0 - 0xCF // // These commands may transfer huge amount of data or take long time to run, // so they are implemented as EP2 commands. // ---------------------------------------------------------------------------- // interface commands // ------------------------------- #define CMD_JTAG_SCAN 0xC0 // scan JTAG chain // SVF,VME,... commands // ------------------------------- #define CMD_JTAG_SIR 0xC1 // write/read #define CMD_JTAG_SDR 0xC2 // write/read #define CMD_JTAG_RUN 0xC3 // #define CMD_JTAG_SDW 0xC4 // write only #endif