?? d12_define.h
字號:
#ifndef _D12_Define_
#define _D12_Define_
#include <reg52.h>
//D12控制線定義
sbit D12_A0 = P0^0;
#define D12_WR WR
#define D12_RD RD
#define D12_Data P1
//D12控制線定義
#define SWAP(A) (((uint16)A<<8)|((uint16)A>>8))
#define LSB(B) ((uchar)((uint16)B))
#define MSB(C) ((uchar)((uint16)C>>8))
#define DSWAP(E) (((E)>>24)|(((E)>>8)&0x0000ff00)|(((E)<<8)&0x00ff0000)|((E)<<24))
#define MMSB(D) ((uchar)((uint16)(D>>12)))
//軟件標志位
//變量全局
extern uint16 Interrupter_register;
extern uchar Interrupter;
extern uchar idata Max_Lun;
extern unsigned long int wLength;
extern unsigned long int wCount;
extern unsigned long int * lpData;
extern uchar idata SD_Buffer[103];
typedef struct _SOFT_FLAG
{
uchar Enable_Control_In :1;
uchar TxtoPc :1;
uchar PctoTx :1;
uchar Not_End :1;
uchar Allow_Main_In :1;
uchar Enp4 :1;
uchar Enp5 :1;
uchar success :1;
uchar Data :1;
}SOFT_FLAG;
extern SOFT_FLAG idata Soft_Flag;
////////////////////////////
//宏定義
#define set_address 0xd0
#define enable_enp 0xd8
#define set_mode 0xf3
#define read_interrupter_register 0xf4
//中斷寄存器掩碼
#define Control_Out 0x0100
#define Control_In 0x0200
#define Enp1_Out 0x0400
#define Enp1_In 0x0800
#define Main_Out 0x1000
#define Main_In 0x2000
#define Bus_Reset 0x4000
#define Suspend_Change 0x8000
#define DMA_EOT 0x0001
//中斷寄存器掩碼
//選擇端點掩碼
#define Enp_Stop 0x02
#define Enp_Full_Empty 0x01
//選擇端點掩碼
//端點狀態掩碼
//端點狀態掩碼
//端點最后處理狀態掩碼
#define Setup_Pack 0x20
//端點最后處理狀態掩碼
#define Stand_Request 0x00
#define Class_Request 0x20
#define Mask 0x60
//標準請求的結構體
typedef struct _DEVICE_REQUEST
{
uchar bmRequestType;
uchar bRequest;
uint16 wValue;
uint16 wIndex;
uint16 wLength;
}DEVICE_REQUEST;
typedef struct _DEVICE_REQUEST_BUFFER
{
DEVICE_REQUEST Device_Request;
uchar wLength;
uchar wCount;
uchar *pData;
}DEVICE_REQUEST_BUFFER;
extern DEVICE_REQUEST_BUFFER idata Device_Request_Buffer;
typedef struct _DEVICE_DESCRIPTOR
{
uchar bLength;
uchar bDescriptorType;
uint16 bcdUSB;
uchar bDeviceClass;
uchar bDeviceSubClass;
uchar bDeviceProtocol;
uchar bMaxPackSize0;
uint16 idVendor;
uint16 idProduct;
uint16 bcdDevice;
uchar iManufacturer;
uchar iProduct;
uchar iSeriaNumber;
uchar bNumConfiguations;
}DEVICE_DESCRIPTOR;
typedef struct _CONFIGURATION_DESCRIPTOR
{
uchar bLength;
uchar bDescriptorType;
uint16 wTotalLength;
uchar bNumInterfaces;
uchar bConfigurationValue;
uchar iConfiguration;
uchar bmAttributes;
uchar ManPower;
}CONFIGURATION_DESCRIPTOR;
typedef struct _INTERFACE_DESCRIPTOR
{
uchar bLength;
uchar bDescriptorType;
uchar bInterfaceNumber;
uchar bAlternateSetting;
uchar bNumberEndpoint;
uchar bInterfaceClass;
uchar bInterfaceSubClass;
uchar bInterfaceProtocol;
uchar iInterface;
}INTERFACE_DESCRIPTOR;
typedef struct _ENDP_DESCRIPTOR
{
uchar bLength;
uchar bDescriptorType;
uchar bEndpointAddress;
uchar bmAttributes;
uint16 wMaxPacketSize;
uchar bInterval;
}ENDP_DESCRIPTOR;
typedef struct _CON_INTER_ENDP_DESCRIPTOR
{
CONFIGURATION_DESCRIPTOR Configuration_Descriptor;
INTERFACE_DESCRIPTOR Interface_Descriptor;
ENDP_DESCRIPTOR Endp_Descriptor[2];
}CON_INTER_ENDP_DESCRIPTOR;
typedef struct _CBWCB
{
uchar Operation_Code;
uchar Logical_Unit_Number;
unsigned long int LBA;
unsigned long int TPA_Length;
uchar Reserved;
uchar Control;
}CBWCB;
typedef struct _CBW
{
unsigned long int dCBWSignature;
unsigned long int dCBWTag;
unsigned long int dCBWDataTransferLength;
uchar bmCBWFlags;
uchar bCBWLUN;
uchar bCBWCBLength;
CBWCB cbwcb;
uchar :8;
uchar :8;
uchar :8;
uchar :8;
}CBW;
extern CBW cbw;
typedef struct _CSW
{
unsigned long int dCSWSignature;
unsigned long int dCSWTag;
unsigned long int dCSWDataResidue;
uchar bCSWStatus;
}CSW;
extern CSW csw;
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -