📄 fs7805.h
字号:
/*
*********************************************************************************************************
* File: fs7805.H
* Contents: fs7805 register declarations and bit mask definitions
*
* $Date: 04/06/06 Kimi v0.1
04/13/07 lshi v0.2
*
* Copyright (c) 2006 Fameg, Inc. All rights reserved
*********************************************************************************************************
*/
#ifndef __FS7805_H__
#define __FS7805_H__
#ifdef ALLOCATE_EXTERN
#define EXTERN
#define _AT_ _at_
#else
#define EXTERN extern
#define _AT_ ;/ ## /
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef true
#define true 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef false
#define false 0
#endif
/*
*********************************************************************************************************
* DATA TYPES
* (Compiler Specific)
*********************************************************************************************************
*/
typedef unsigned char BOOLEAN;
typedef unsigned char INT8U; // Unsigned 8 bit quantity
typedef signed char INT8S; // Signed 8 bit quantity
typedef unsigned int INT16U; // Unsigned 16 bit quantity
typedef unsigned int UINT16; // Unsigned 16 bit quantity
typedef signed int INT16S; // Signed 16 bit quantity
typedef unsigned long INT32U; // Unsigned 32 bit quantity
typedef unsigned long UINT32; // Unsigned 32 bit quantity
typedef signed long INT32S; // Signed 32 bit quantity
typedef float FP32; // Single precision floating point
typedef unsigned char STATUS; // Unsigned 8 bit quantity
typedef unsigned char BYTE; // Unsigned 8 bit quantity
#define WORD INT16U
#define DWORD INT32U
typedef UINT16 *PUINT16;//指针类型
#define bool char
#define BOOL char
typedef BYTE *PBYTE;
typedef enum {COPY_ALL, COPY_DIRTY, COPY_CLEAN} TCOPY_MODE;
typedef union __TDATACAST__
{
unsigned char ucByte[sizeof(unsigned long)/sizeof(unsigned char) ];
unsigned short usByte[sizeof(unsigned long)/sizeof(unsigned short)];
unsigned long ulByte[sizeof(unsigned long)/sizeof(unsigned long) ];
}
TDataCast;
#define bmBIT0 0x01
#define bmBIT1 0x02
#define bmBIT2 0x04
#define bmBIT3 0x08
#define bmBIT4 0x10
#define bmBIT5 0x20
#define bmBIT6 0x40
#define bmBIT7 0x80
#define SC_GET_STATUS 0x00 // Setup command: Get Status
#define SC_CLEAR_FEATURE 0x01 // Setup command: Clear Feature
#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_SYNCH_FRAME 0x0c // Setup command: Sync Frame
#define BULKONLY_GET_MAX_LUN 254
#define BULKONLY_RESET 255
/*
*********************************************************************************************************
* VENDOR REQUESTS
*********************************************************************************************************
*/
#define VR_UPLOAD 0xc0 // Download Firmware into program memory
#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 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
/*
*********************************************************************************************************
* VENDOR REQUESTS TYPE
*********************************************************************************************************
*/
#define VR_DOWNLOAD 0x40 // Download Firmware into program memory
#define DSCR_DEVICE_LEN 18
#define DSCR_CONFIGURATION_LEN 9
#define DSCR_INTERFACE_LEN 9
#define DSCR_ENDPOINT_LEN 7
#define DSCR_DEVICE_QUALIFIER_LEN 10
#define DSCR_CONFIGURATION_TOTALLEN 32
#define DSCR_STRING0_LEN 4
#define DSCR_STRING1_LEN 12
#define DSCR_STRING2_LEN 28
#define DSCR_STRING3_LEN 22
/*
*********************************************************************************************************
* DEFINE ENDPOINT MACRO
*********************************************************************************************************
*/
#define bmEP_TYPE_ISO 0x01
#define bmEP_TYPE_BULK 0x02
#define bmEP_TYPE_INT 0x03
#define bmEP_MAP_EP1 0x01 // Endpoint Number 1
#define bmEP_MAP_EP2 0x02 // Endpoint Number 2
#define bmEP_MAP_EP3 0x03 // Endpoint Number 3
#define bmEP_MAP_EP4 0x04 // Endpoint Number 4
#define bmEP_MAP_EP5 0x05 // Endpoint Number 5
#define bmEP_MAP_EP6 0x06 // Endpoint Number 6
#define bmEP_MAP_EP7 0x07 // Endpoint Number 7
#define bmEP_MAP_EP8 0x08 // Endpoint Number 8
#define bmEP_MAP_EP9 0x09 // Endpoint Number 9
#define bmEP_MAP_EP10 0x0a // Endpoint Number 10
#define bmEP_MAP_EP11 0x0b // Endpoint Number 11
#define bmEP_MAP_EP12 0x0c // Endpoint Number 12
#define bmEP_MAP_EP13 0x0d // Endpoint Number 13
#define bmEP_MAP_EP14 0x0e // Endpoint Number 14
#define bmEP_MAP_EP15 0x0f // Endpoint Number 15
#define DMA_FIFOA0 0xEC00 // 512 Byte Data FIFO A0
#define DMA_FIFOA1 0xEE00 // 512 Byte Data FIFO A1
#define DMA_FIFOB0 0xF000 // 512 Byte Data FIFO B0
#define DMA_FIFOB1 0xF200 // 512 Byte Data FIFO B1
#define DMA_FIFOC0 0xF400 // 512 Byte Data FIFO C0
#define DMA_FIFOC1 0xF600 // 512 Byte Data FIFO C1
#define DMA_FIFOD0 0xF800 // 512 Byte Data FIFO D0
#define DMA_FIFOD1 0xFA00 // 512 Byte Data FIFO D1
/*
*********************************************************************************************************
* DEFINE ENDPOINT TYPE
*********************************************************************************************************
*/
#define EP1CS EPACS
#define EP1CTRL EPACTRL
#define EP1FIFOCS EPAFIFOCS
#define EP1CNT0L EPACNT0L
#define EP1CNT1L EPACNT1L
#define EP1CNTH EPACNTH
#define bmEP1INT bmEPAINT
#define bmEP1MAP bmEP_MAP_EP1
#define EP2CS EPCCS
#define EP2CTRL EPCCTRL
#define EP2FIFOCS EPCFIFOCS
#define EP2CNT0L EPCCNT0L
#define EP2CNT1L EPCCNT1L
#define EP2CNTH EPCCNTH
#define bmEP2INT bmEPCINT
#define bmEP2MAP bmEP_MAP_EP2
#define ATAPI_STATUS_BUSY_BIT 0x80
void McuInit();
void TdInit (void);
void init_udma_read();
void init_udma_write();
void UsbInit (void);
void Timer0Init();
#define LSB(word) (BYTE)((WORD)word &0x00FF)
#define SSB(word) (BYTE)(((UINT32)(word) >> 8) & 0x0000ff)
#define MSB(word) (BYTE)(((WORD)word >> 8) & 0x00FF)
EXTERN BOOL Rwuen, Selfpwr;
#undef EXTERN
#undef _AT_
/*
*********************************************************************************************************
* MISCELLANEOUS
*********************************************************************************************************
*/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -