⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c4sdcc.h

📁 Xilinx USB JTAG 下載端程式
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef _FW_H#define _FW_H#include "fx2regs.h"#define INTERRUPT_0  __interrupt#define INTERRUPT(x) __interrupt(x)#define AUTOPTR1H  APTR1H#define AUTOPTR1L  APTR1Lextern void putchar(char c);// delay for approximately 4 cyclesextern void udelay1(void);// delay for approximately usecs (max 255) microsecondsextern void udelay (unsigned char usecs);// delay for approximately msecs millisecondsextern void mdelay (unsigned short msecs);extern void EZUSB_Delay1us(void) _naked;#define SYNCDELAY EZUSB_Delay1us()#define bmRWAKEUP bmBIT7#define bmDISCOE bmBIT2#define CPUCS_48MHZ bmBIT3//-----------------------------------------------------------------------------//   File:      FX2.h//   Contents:   EZ-USB FX2 constants, macros, datatypes, globals, and library//            function prototypes.////   Copyright (c) 2000 Cypress Semiconductor, All rights reserved//-----------------------------------------------------------------------------#ifndef FX2_H     //Header sentry#define FX2_H#define INTERNAL_DSCR_ADDR 0x0080   // Relocate Descriptors to 0x80#define bmSTRETCH 0x07#define FW_STRETCH_VALUE 0x0      // Set stretch to 0 in frameworks                           // Note: a RevE eratta states that stretch must=0 to set OUTxBC//-----------------------------------------------------------------------------// Constants//-----------------------------------------------------------------------------#define   TRUE    1#define FALSE   0#define DEVICE_DSCR      0x01      // Descriptor type: Device#define CONFIG_DSCR      0x02      // Descriptor type: Configuration#define STRING_DSCR      0x03      // Descriptor type: String#define INTRFC_DSCR      0x04      // Descriptor type: Interface#define ENDPNT_DSCR      0x05      // Descriptor type: End Point#define DEVQUAL_DSCR     0x06      // Descriptor type: Device Qualifier#define OTHERSPEED_DSCR  0x07      // Descriptor type: Other Speed Configuration#define bmBUSPWR  bmBIT7         // Config. attribute: Bus powered#define bmSELFPWR bmBIT6         // Config. attribute: Self powered#define bmRWU     bmBIT5         // Config. attribute: Remote Wakeup#define bmEPOUT   bmBIT7#define bmEPIN    0x00#define EP_CONTROL   0x00        // End Point type: Control#define EP_ISO       0x01        // End Point type: Isochronous#define EP_BULK      0x02        // End Point type: Bulk#define EP_INT       0x03        // End Point type: Interrupt#define SUD_SIZE            8      // Setup data packet size////////////////////////////////////////////////////////////////////////////////Added for HID#define SETUP_MASK				0x60	//Used to mask off request type#define SETUP_STANDARD_REQUEST	0		//Standard Request#define SETUP_CLASS_REQUEST		0x20	//Class Request#define SETUP_VENDOR_REQUEST	0x40	//Vendor Request#define SETUP_RESERVED_REQUEST 	0x60	//Reserved or illegal request//////////////////////////////////////////////////////////////////////////////#define SC_GET_STATUS         0x00   // Setup command: Get Status#define SC_CLEAR_FEATURE      0x01   // Setup command: Clear Feature#define SC_RESERVED            0x02   // Setup command: Reserved#define SC_SET_FEATURE         0x03   // Setup command: Set Feature#define SC_SET_ADDRESS         0x05   // Setup command: Set Address#define SC_GET_DESCRIPTOR      0x06   // Setup command: Get Descriptor#define SC_SET_DESCRIPTOR      0x07   // Setup command: Set Descriptor#define SC_GET_CONFIGURATION   0x08   // Setup command: Get Configuration#define SC_SET_CONFIGURATION   0x09   // Setup command: Set Configuration#define SC_GET_INTERFACE      0x0a   // Setup command: Get Interface#define SC_SET_INTERFACE      0x0b   // Setup command: Set Interface#define SC_SYNC_FRAME         0x0c   // Setup command: Sync Frame#define SC_ANCHOR_LOAD         0xa0   // Setup command: Anchor load   #define GD_DEVICE          0x01  // Get descriptor: Device#define GD_CONFIGURATION   0x02  // Get descriptor: Configuration#define GD_STRING          0x03  // Get descriptor: String#define GD_INTERFACE       0x04  // Get descriptor: Interface#define GD_ENDPOINT        0x05  // Get descriptor: Endpoint#define GD_DEVICE_QUALIFIER 0x06  // Get descriptor: Device Qualifier#define GD_OTHER_SPEED_CONFIGURATION 0x07  // Get descriptor: Other Configuration#define GD_INTERFACE_POWER 0x08  // Get descriptor: Interface Power#define GD_HID	            0x21	// Get descriptor: HID#define GD_REPORT	         0x22	// Get descriptor: Report#define GS_DEVICE          0x80  // Get Status: Device#define GS_INTERFACE       0x81  // Get Status: Interface#define GS_ENDPOINT        0x82  // Get Status: End Point#define FT_DEVICE          0x00  // Feature: Device#define FT_ENDPOINT        0x02  // Feature: End Point#define I2C_IDLE              0     // I2C Status: Idle mode#define I2C_SENDING           1     // I2C Status: I2C is sending data#define I2C_RECEIVING         2     // I2C Status: I2C is receiving data#define I2C_PRIME             3     // I2C Status: I2C is receiving the first byte of a string#define I2C_STOP              5     // I2C Status: I2C waiting for stop completion#define I2C_BERROR            6     // I2C Status: I2C error; Bit Error#define I2C_NACK              7     // I2C Status: I2C error; No Acknowledge#define I2C_OK                8     // I2C positive return code#define I2C_WAITSTOP          9     // I2C Status: Wait for STOP complete/*-----------------------------------------------------------------------------   Macros-----------------------------------------------------------------------------*/#define MSB(x) ((unsigned char)(((unsigned short) x) >> 8))#define LSB(x) ((unsigned char)(((unsigned short) x) & 0xFF))#define SWAP_ENDIAN(word)   ((BYTE*)&word)[0] ^= ((BYTE*)&word)[1];\                     ((BYTE*)&word)[1] ^= ((BYTE*)&word)[0];\                     ((BYTE*)&word)[0] ^= ((BYTE*)&word)[1]#define EZUSB_IRQ_ENABLE()   EIUSB = 1#define EZUSB_IRQ_DISABLE()   EIUSB = 0#define EZUSB_IRQ_CLEAR()   EXIF &= ~0x10      // IE2_#define EZUSB_STALL_EP0()            EP0CS |= bmEPSTALL#define EZUSB_STALL_EP(ep_id)             // fx2bug#define EZUSB_UNSTALL_EP(ep_id)           // fx2bug#define   EZUSB_GET_EP_STATUS(ep_id)      // fx2bug#define EZUSB_SET_EP_BYTES(ep_id,count)   // fx2bug// WRITEDELAY() has been replaced by SYNCDELAY; macro in fx2sdly.h// ...it is here for backwards compatibility...// the WRITEDELAY macro compiles to the time equivalent of 3 NOPs.// It is used in the frameworks to allow for write recovery time// requirements of certain registers.  This is only necessary for// EZ-USB FX parts.  See the EZ-USB FX TRM for// more information on write recovery time issues.#define WRITEDELAY() {char writedelaydummy = 0;}// if this firmware will never run on an EZ-USB FX part replace// with:// #define WRITEDELAY()// macro to reset and endpoint data toggle#define EZUSB_RESET_DATA_TOGGLE(ep)     TOGCTL = (((ep & 0x80) >> 3) + (ep & 0x0F));\                                        TOGCTL |= bmRESETTOGGLE#define EZUSB_ENABLE_RSMIRQ()      (EICON |= 0x20)      // Enable Resume Interrupt (EPFI_)#define EZUSB_DISABLE_RSMIRQ()      (EICON &= ~0x20)   // Disable Resume Interrupt (EPFI_)#define EZUSB_CLEAR_RSMIRQ()      (EICON &= ~0x10)   // Clear Resume Interrupt Flag (PFI_)#define EZUSB_GETI2CSTATUS()      (I2CPckt.status)#define EZUSB_CLEARI2CSTATUS()      if((I2CPckt.status == I2C_BERROR) || (I2CPckt.status == I2C_NACK))\                              I2CPckt.status = I2C_IDLE;#define EZUSB_ENABLEBP()         (BREAKPT |= bmBPEN)    // TGE fx2bug#define EZUSB_DISABLEBP()         (BREAKPT &= ~bmBPEN)  // TGE fx2bug#define EZUSB_CLEARBP()            (BREAKPT |= bmBREAK) // TGE fx2bug#define EZUSB_BP(addr)            BPADDRH = (BYTE)(((WORD)addr >> 8) & 0xff);\                                  BPADDRL = (BYTE)addr                              // TGE fx2bug#define EZUSB_EXTWAKEUP()      (((WAKEUPCS & bmWU2) && (WAKEUPCS & bmWU2EN)) ||\                                ((WAKEUPCS & bmWU) &&  (WAKEUPCS & bmWUEN)))#define EZUSB_HIGHSPEED()      (USBCS & bmHSM)//-----------------------------------------------------------------------------// Datatypes//-----------------------------------------------------------------------------#if 0typedef unsigned char   BYTE;typedef unsigned short   WORD;#endif typedef unsigned long   DWORD;typedef bit            BOOL;#define  INT0_VECT   0#define  TMR0_VECT   1#define  INT1_VECT   2

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -