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

📄 chap_9.src

📁 USB 源码 ISP1581 Device controller
💻 SRC
📖 第 1 页 / 共 5 页
字号:
; .\chap_9.SRC generated from: chap_9.c
; COMPILER INVOKED BY:
;        C:\KEIL\C51\BIN\C51.EXE chap_9.c OPTIMIZE(2,SPEED) BROWSE DEBUG OBJECTEXTEND SRC(.\chap_9.SRC)

$NOMOD51

NAME	CHAP_9

P0	DATA	080H
P1	DATA	090H
P2	DATA	0A0H
P3	DATA	0B0H
T0	BIT	0B0H.4
AC	BIT	0D0H.6
T1	BIT	0B0H.5
EA	BIT	0A8H.7
IE	DATA	0A8H
DMA_Wr_Rd	BIT	090H.4
RD	BIT	0B0H.7
ES	BIT	0A8H.4
IP	DATA	0B8H
RI	BIT	098H.0
INT0	BIT	0B0H.2
CY	BIT	0D0H.7
TI	BIT	098H.1
INT1	BIT	0B0H.3
ISP1581_RESET	BIT	090H.3
PS	BIT	0B8H.4
SP	DATA	081H
OV	BIT	0D0H.2
WR	BIT	0B0H.6
SBUF	DATA	099H
PCON	DATA	087H
ISP1581_CS	BIT	090H.2
SCON	DATA	098H
TMOD	DATA	089H
TCON	DATA	088H
RESET_IDE	BIT	090H.4
DMA_Reset	BIT	090H.4
IE0	BIT	088H.1
IE1	BIT	088H.3
AUXR	DATA	08EH
B	DATA	0F0H
DMA_Start	BIT	090H.4
ACC	DATA	0E0H
ET0	BIT	0A8H.1
ET1	BIT	0A8H.3
TF0	BIT	088H.5
HS_FS_LED	BIT	090H.0
TF1	BIT	088H.7
RB8	BIT	098H.2
TH0	DATA	08CH
EX0	BIT	0A8H.0
IT0	BIT	088H.0
TH1	DATA	08DH
TB8	BIT	098H.3
EX1	BIT	0A8H.2
IT1	BIT	088H.2
P	BIT	0D0H.0
SM0	BIT	098H.7
TL0	DATA	08AH
SM1	BIT	098H.6
TL1	DATA	08BH
SM2	BIT	098H.5
PT0	BIT	0B8H.1
PT1	BIT	0B8H.3
RS0	BIT	0D0H.3
TR0	BIT	088H.4
RS1	BIT	0D0H.4
TR1	BIT	088H.6
PX0	BIT	0B8H.0
PX1	BIT	0B8H.2
DPH	DATA	083H
DPL	DATA	082H
VBus_Sense	BIT	0A0H.4
REN	BIT	098H.4
RXD	BIT	0B0H.0
CKCON	DATA	08FH
TXD	BIT	0B0H.1
F0	BIT	0D0H.5
PSW	DATA	0D0H
?PR?USB_Debug_Mode?CHAP_9                SEGMENT CODE 
?PR?USB_Setup?CHAP_9 SEGMENT CODE 
?DT?USB_Setup?CHAP_9 SEGMENT DATA OVERLAYABLE 
?PR?Vendor_Specific_Command?CHAP_9       SEGMENT CODE 
?PR?reserved?CHAP_9  SEGMENT CODE 
?PR?get_descriptor?CHAP_9                SEGMENT CODE 
?PR?set_address?CHAP_9                   SEGMENT CODE 
?PR?set_config?CHAP_9                    SEGMENT CODE 
?PR?get_config?CHAP_9                    SEGMENT CODE 
?PR?clear_feature?CHAP_9                 SEGMENT CODE 
?DT?clear_feature?CHAP_9                 SEGMENT DATA OVERLAYABLE 
?PR?get_status?CHAP_9                    SEGMENT CODE 
?PR?set_feature?CHAP_9                   SEGMENT CODE 
?DT?set_feature?CHAP_9                   SEGMENT DATA OVERLAYABLE 
?PR?get_interface?CHAP_9                 SEGMENT CODE 
?PR?set_interface?CHAP_9                 SEGMENT CODE 
?PR?ep0in_ack?CHAP_9 SEGMENT CODE 
?PR?wait_ep0tx?CHAP_9                    SEGMENT CODE 
?PR?ep0out_ack?CHAP_9                    SEGMENT CODE 
?PR?wait_ep0rx?CHAP_9                    SEGMENT CODE 
?PR?_read_endpoint?CHAP_9                SEGMENT CODE 
?DT?_read_endpoint?CHAP_9                SEGMENT DATA OVERLAYABLE 
?CO?CHAP_9           SEGMENT CODE 
?ID?CHAP_9           SEGMENT IDATA 
?DT?CHAP_9           SEGMENT DATA 
	EXTRN	CODE (Standard_String_ID)
	EXTRN	CODE (HS_Bulk_Interface_Descriptor)
	EXTRN	CODE (Bulk_Interface_Descriptor)
	EXTRN	XDATA (D14_Cntrl_Reg)
	EXTRN	DATA (Temp)
	EXTRN	CODE (Other_Speed_Config_Descriptor)
	EXTRN	CODE (HS_Bulk_In_Descriptor)
	EXTRN	DATA (count)
	EXTRN	CODE (HS_Bulk_Out_Descriptor)
	EXTRN	CODE (Bulk_In_Descriptor)
	EXTRN	CODE (Bulk_Out_Descriptor)
	EXTRN	CODE (Init_Endpoint)
	EXTRN	DATA (Kernel_Flag)
	EXTRN	CODE (HS_Int_In_Descriptor)
	EXTRN	CODE (HS_Int_Out_Descriptor)
	EXTRN	CODE (Int_In_Descriptor)
	EXTRN	CODE (Int_Out_Descriptor)
	EXTRN	CODE (HS_Device_Descriptor)
	EXTRN	CODE (HS_Device_Qualifier)
	EXTRN	DATA (Device_Config_Value)
	EXTRN	CODE (Standard_Device_Descriptor)
	EXTRN	CODE (Standard_Config_Descriptor)
	EXTRN	CODE (?C?ICALL)
	EXTRN	CODE (?C?ICASE)
	EXTRN	CODE (?C?LSHL)
	EXTRN	CODE (?C?LSTXDATA)
	EXTRN	CODE (?C?CSTPTR)
	PUBLIC	USB_Device_Request
	PUBLIC	VID
	PUBLIC	bytecount
	PUBLIC	PID
	PUBLIC	PIO_Count
	PUBLIC	USB_Int_Flag
	PUBLIC	File_Number
	PUBLIC	Current_File
	PUBLIC	Descriptor_Ptr
	PUBLIC	FileSize
	PUBLIC	USB_Device
	PUBLIC	FIFO_Count
	PUBLIC	Endpt_FIFO
	PUBLIC	StandardDeviceRequest
	PUBLIC	_read_endpoint
	PUBLIC	wait_ep0rx
	PUBLIC	ep0out_ack
	PUBLIC	wait_ep0tx
	PUBLIC	ep0in_ack
	PUBLIC	set_interface
	PUBLIC	get_interface
	PUBLIC	set_feature
	PUBLIC	get_status
	PUBLIC	clear_feature
	PUBLIC	get_config
	PUBLIC	set_config
	PUBLIC	set_address
	PUBLIC	get_descriptor
	PUBLIC	reserved
	PUBLIC	Vendor_Specific_Command
	PUBLIC	USB_Setup
	PUBLIC	USB_Debug_Mode

	RSEG  ?DT?set_feature?CHAP_9
?set_feature?BYTE:
bRecipient?1043:   DS   1

	RSEG  ?DT?_read_endpoint?CHAP_9
?_read_endpoint?BYTE:
      endp?1744:   DS   1
       len?1745:   DS   2
       buf?1746:   DS   3

	RSEG  ?DT?clear_feature?CHAP_9
?clear_feature?BYTE:
 bRecipient?842:   DS   1

	RSEG  ?DT?USB_Setup?CHAP_9
?USB_Setup?BYTE:
       type?140:   DS   1
        req?141:   DS   1

	RSEG  ?ID?CHAP_9
     Endpt_FIFO:   DS   64
USB_Device_Request:   DS   8

	RSEG  ?DT?CHAP_9
     FIFO_Count:   DS   2
     USB_Device:   DS   4
       FileSize:   DS   8
 Descriptor_Ptr:   DS   2
   Current_File:   DS   1
    File_Number:   DS   1
   USB_Int_Flag:   DS   4
      PIO_Count:   DS   2
            PID:   DS   2
      bytecount:   DS   4
            VID:   DS   2

	RSEG  ?CO?CHAP_9
StandardDeviceRequest:
	DB	0FFH
	DW	get_status + 0
	DB	0FFH
	DW	clear_feature + 0
	DB	0FFH
	DW	reserved + 0
	DB	0FFH
	DW	set_feature + 0
	DB	0FFH
	DW	reserved + 0
	DB	0FFH
	DW	set_address + 0
	DB	0FFH
	DW	get_descriptor + 0
	DB	0FFH
	DW	reserved + 0
	DB	0FFH
	DW	get_config + 0
	DB	0FFH
	DW	set_config + 0
	DB	0FFH
	DW	get_interface + 0
	DB	0FFH
	DW	set_interface + 0
	DB	0FFH
	DW	reserved + 0
	DB	0FFH
	DW	reserved + 0
	DB	0FFH
	DW	reserved + 0
	DB	0FFH
	DW	reserved + 0

; //***********************************************************************
; //									     								                  *
; //                P H I L I P S   P R O P R I E T A R Y          		   *
; //                                                                      *
; //          COPYRIGHT (c)   1999 BY PHILIPS SINGAPORE (APIC).    		   *
; //                    --  ALL RIGHTS RESERVED  --                 		*	
; //                                                                      *
; // 	File Name	:       USBDebug.c                                    *
; // 	Author		:       Albert Goh					 					      *
; // 	Created		:      	3 March 2000                               	*
; //                  	                                                   *
; //***********************************************************************
; //***********************************************************************
; //                                                                      *
; // USBDebug has the ability to test the USB core in Bus enumeration or  *
; // in CBI/bulk mode.                                                  	*
; //                                                                      *
; //***********************************************************************
; //***********************************************************************
; //                                                                      *
; //  Module History														            *
; //  **************														            *
; //																		                  *
; //  Date   	Version			Author				Changes					      *
; //  ====	   =======			======				=======					      *
; //  030300	  0.1 			Albert				Created    				      *
; //                                                                      *
; //***********************************************************************
; 
; //***********************************************************************
; //*																		               *
; //*	                     Include Files Definition						   *
; //*																		               *
; //***********************************************************************
; 
; #include "standard.h"
; #include "Kernel.h"
; #include "D14.h"
; #include "usb.h"
; 
; extern volatile D14_CNTRL_REG xdata D14_Cntrl_Reg;
; extern void Init_D14(void);
; extern UC code Standard_Device_Descriptor[];
; extern UC code Bulk_Interface_Descriptor[];
; extern UC code Iso_Interface_Descriptor[];
; extern UC code Standard_Config_Descriptor[];
; extern UC code Standard_Manufacturer_String[];
; extern UC code Standard_Product_String[];
; extern UC code Standard_String_ID[];
; extern UC code Bulk_In_Descriptor[];
; extern UC code Bulk_Out_Descriptor[];
; extern UC code Int_In_Descriptor[];
; extern UC code Int_Out_Descriptor[];
; extern UC code Iso_In_Descriptor[];
; extern UC code Iso_Out_Descriptor[];
; extern UC code Iso_In_Zero_Descriptor[];
; extern UC code Iso_Out_Zero_Descriptor[];
; extern UC code HS_Device_Descriptor[];
; extern UC code HS_Device_Qualifier[];
; extern UC code HS_Bulk_Interface_Descriptor[];
; extern UC code HS_Bulk_In_Descriptor[];
; extern UC code HS_Bulk_Out_Descriptor[];
; extern UC code HS_Int_In_Descriptor[];
; extern UC code HS_Int_Out_Descriptor[];
; extern UC code Other_Speed_Config_Descriptor[];
; extern UI count;
; extern void Start_mSEC_Timer(Data);
; extern void Start_SEC_Timer(Data);
; extern void Check_Busy(void);
; extern void TaskFile_Update(void);
; extern UI Temp;
; extern UC Device_Config_Value;
; extern KERNEL Kernel_Flag;
; extern DMA_INT_FLAG DMA_Int_Flag;
; extern USB_INT_FLAG USB_Int_Flag;
; extern USBCBW USB_CBW;
; extern void Init_Device(void);
; extern UC code Test_Packet[];
; extern void Init_Endpoint(void);
; extern void Init_Device(void);
; extern void Set_USB(void);
; 
; //***********************************************************************
; //*																		               *
; //*	                 Prototype Routine Definition					 	   *
; //*																		               *
; //***********************************************************************
; 
; void USB_Setup(void);
; void reserved(void);
; void Send_Device_Status(void);
; void Send_Interface_Status(void);
; void Send_Endpoint_Status(void);
; 
; void Vendor_Specific_Command(void);
; void Send_Status(unsigned char tran_status);
; 
; void Set_Interface_Value(void);
; void Get_Interface_Value(void);
; void Process_Synch_Frame(void);
; 
; void get_status(void);
; void clear_feature(void);
; void set_feature(void);
; void set_address(void);
; void get_descriptor(void);
; void get_config(void);
; void set_config(void);
; void get_interface(void);
; void set_interface(void);
; 
; void Set_Descriptor(void);
; void reserved(void);
; 
; void ep0in_ack(void);
; void ep0out_ack(void);
; void wait_ep0tx(void);
; void wait_ep0rx(void);
; 
; //***********************************************************************
; //*																		               *
; //*	                     Variable Definition 							      *
; //*																		               *
; //***********************************************************************
; 
; USB_INT_FLAG  USB_Int_Flag;
; USB_DEVICE_REQ	idata	USB_Device_Request;
; USB_DEVICE		USB_Device;
; 
; UC	code	*Descriptor_Ptr;
; 
; UC	idata Endpt_FIFO[MAX_BUF];
; UI	FIFO_Count;
; UC VID[2],PID[2];
; FILESIZE FileSize;
; UI PIO_Count;
; UC	File_Number;
; UC	Current_File;
; ULI bytecount;
; 
; //USB标准请求
; code void (*StandardDeviceRequest[])(void) =
; {
; 	get_status,
; 	clear_feature,
; 	reserved,
; 	set_feature,
; 	reserved,
; 	set_address,
; 	get_descriptor,
; 	reserved,
; 	get_config,
; 	set_config,
; 	get_interface,
; 	set_interface,
; 	reserved,
; 	reserved,
; 	reserved,
; 	reserved
; };
; 
; 
; 
; //***********************************************************************
; //*																		               *
; //*	                     Routine Definition								   *
; //*																		               *
; //***********************************************************************
; 
; //***********************************************************************
; //*										    							               *
; //*	Routine 	:  USB Debug Mode                                 		   *
; //*	Input		:  USB Interrupt Register 								         *
; //*	Output	:  None                                					   *
; //*	Function	:  Branch to respective ISR                  			   *
; //*																		               *
; //***********************************************************************
; 
; void USB_Debug_Mode(void)

	RSEG  ?PR?USB_Debug_Mode?CHAP_9
USB_Debug_Mode:
	USING	0
			; SOURCE LINE # 179
; {
			; SOURCE LINE # 180
; 	//端点0接收到setup包处理      
;    	if(USB_Int_Flag.BITS.EP0SETUP)
			; SOURCE LINE # 182
	MOV  	R7,USB_Int_Flag+01H
	MOV  	A,R7
	JNB  	ACC.0,?C0001
; 	{
			; SOURCE LINE # 183
; 		EA_DISABLE;
			; SOURCE LINE # 184
	CLR  	EA
; 		USB_Setup();
			; SOURCE LINE # 185
	LCALL	USB_Setup
; 		EA_ENABLE;
			; SOURCE LINE # 186
	SETB 	EA
; 	}
			; SOURCE LINE # 187
?C0001:
; 	
; 	//挂起处理
; 	if(USB_Int_Flag.BITS.SUSP)
			; SOURCE LINE # 190
	MOV  	R7,USB_Int_Flag
	MOV  	A,R7
	RRC  	A
	RRC  	A
	RRC  	A
	ANL  	A,#01FH
	MOV  	R7,A
	MOV  	A,R7
	JNB  	ACC.0,?C0002
; 	{		
			; SOURCE LINE # 191
; 		//清除挂起标志
; 		EA_DISABLE;
			; SOURCE LINE # 193
	CLR  	EA
; 		USB_Int_Flag.BITS.SUSP = 0;
			; SOURCE LINE # 194
	MOV  	R7,USB_Int_Flag
	MOV  	A,R7
	ANL  	A,#0F7H
	MOV  	USB_Int_Flag,A
; 		EA_ENABLE;
			; SOURCE LINE # 195
	SETB 	EA
; 		//ISP1581进入挂起状态           
; 		D14_Cntrl_Reg.D14_MODE.BITS.GOSUSP = 1;
			; SOURCE LINE # 197
	MOV  	DPTR,#D14_Cntrl_Reg+0CH
	MOVX 	A,@DPTR
	MOV  	R7,A
	MOV  	A,R7
	ORL  	A,#020H
	MOV  	R7,A
	MOV  	DPTR,#D14_Cntrl_Reg+0CH
	MOV  	A,R7
	MOVX 	@DPTR,A
; 		D14_Cntrl_Reg.D14_MODE.BITS.GOSUSP = 0;
			; SOURCE LINE # 198
	MOV  	DPTR,#D14_Cntrl_Reg+0CH
	MOVX 	A,@DPTR
	MOV  	R7,A
	MOV  	A,R7
	ANL  	A,#0DFH
	MOV  	R7,A
	MOV  	DPTR,#D14_Cntrl_Reg+0CH
	MOV  	A,R7
	MOVX 	@DPTR,A
; 	}
			; SOURCE LINE # 199
?C0002:
; 	
; 	//挂起恢复处理
; 	if(USB_Int_Flag.BITS.RESUME)
			; SOURCE LINE # 202
	MOV  	R7,USB_Int_Flag
	MOV  	A,R7
	SWAP 	A
	ANL  	A,#0FH
	MOV  	R7,A
	MOV  	A,R7
	JNB  	ACC.0,?C0003
; 	{
			; SOURCE LINE # 203
; 		//清除恢复标志
; 		EA_DISABLE;
			; SOURCE LINE # 205
	CLR  	EA
; 		USB_Int_Flag.BITS.RESUME = 0;         
			; SOURCE LINE # 206
	MOV  	R7,USB_Int_Flag
	MOV  	A,R7
	ANL  	A,#0EFH
	MOV  	USB_Int_Flag,A
; 		EA_ENABLE;
			; SOURCE LINE # 207
	SETB 	EA
; 		//产生一个恢复信号
; 		D14_Cntrl_Reg.D14_MODE.BITS.SNDRSU = 1;
			; SOURCE LINE # 209
	MOV  	DPTR,#D14_Cntrl_Reg+0CH
	MOVX 	A,@DPTR
	MOV  	R7,A
	MOV  	A,R7
	ORL  	A,#040H
	MOV  	R7,A
	MOV  	DPTR,#D14_Cntrl_Reg+0CH
	MOV  	A,R7
	MOVX 	@DPTR,A
; 		D14_Cntrl_Reg.D14_MODE.BITS.SNDRSU = 0;
			; SOURCE LINE # 210
	MOV  	DPTR,#D14_Cntrl_Reg+0CH
	MOVX 	A,@DPTR
	MOV  	R7,A
	MOV  	A,R7
	ANL  	A,#0BFH
	MOV  	R7,A
	MOV  	DPTR,#D14_Cntrl_Reg+0CH
	MOV  	A,R7
	MOVX 	@DPTR,A
;    	}
			; SOURCE LINE # 211
?C0003:
; 	
; 	//高速状态
; 	if(USB_Int_Flag.BITS.HS_STAT)
			; SOURCE LINE # 214
	MOV  	R7,USB_Int_Flag
	MOV  	A,R7
	SWAP 	A
	RRC  	A
	ANL  	A,#07H
	MOV  	R7,A
	MOV  	A,R7
	JNB  	ACC.0,?C0006
; 	{

⌨️ 快捷键说明

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