?? chap_9.src
字號(hào):
; SOURCE LINE # 457
MOV A,count+01H
ORL A,count
JZ ?C0043
; {
; SOURCE LINE # 458
; D14_Cntrl_Reg.D14_DATA_PORT_LSB = *Descriptor_Ptr;
; SOURCE LINE # 459
MOV R6,Descriptor_Ptr
MOV R7,Descriptor_Ptr+01H
MOV DPL,R7
MOV DPH,R6
CLR A
MOVC A,@A+DPTR
MOV R7,A
MOV DPTR,#D14_Cntrl_Reg+020H
MOV A,R7
MOVX @DPTR,A
; count--;
; SOURCE LINE # 460
MOV A,count+01H
DEC count+01H
JNZ ?C0220
DEC count
?C0220:
; Descriptor_Ptr++;
; SOURCE LINE # 461
INC Descriptor_Ptr+01H
MOV A,Descriptor_Ptr+01H
JNZ ?C0221
INC Descriptor_Ptr
?C0221:
; }
; SOURCE LINE # 462
SJMP ?C0042
?C0043:
; //選擇高速還是全速端點(diǎn)1IN描述符
; if(Kernel_Flag.BITS.HS_FS_State == FULL_SPEED)
; SOURCE LINE # 464
MOV R7,Kernel_Flag+03H
MOV A,R7
JNB ACC.0,?C0044
; Descriptor_Ptr = &Int_In_Descriptor[0]; //set pointer to interface descriptor
; SOURCE LINE # 465
MOV R6,#HIGH (Int_In_Descriptor)
MOV R7,#LOW (Int_In_Descriptor)
MOV Descriptor_Ptr,R6
MOV Descriptor_Ptr+01H,R7
?C0044:
; if(Kernel_Flag.BITS.HS_FS_State == HIGH_SPEED)
; SOURCE LINE # 466
MOV R7,Kernel_Flag+03H
MOV A,R7
JB ACC.0,?C0045
; Descriptor_Ptr = &HS_Int_In_Descriptor[0]; //set pointer to interface descriptor
; SOURCE LINE # 467
MOV R6,#HIGH (HS_Int_In_Descriptor)
MOV R7,#LOW (HS_Int_In_Descriptor)
MOV Descriptor_Ptr,R6
MOV Descriptor_Ptr+01H,R7
?C0045:
; count = *Descriptor_Ptr; //read in descriptor length
; SOURCE LINE # 468
MOV R6,Descriptor_Ptr
MOV R7,Descriptor_Ptr+01H
MOV DPL,R7
MOV DPH,R6
CLR A
MOVC A,@A+DPTR
MOV R7,A
MOV R6,#00H
MOV count,R6
MOV count+01H,R7
?C0046:
; //寫(xiě)入端點(diǎn)1IN描述符
; while(count != 0)
; SOURCE LINE # 470
MOV A,count+01H
ORL A,count
JZ ?C0047
; {
; SOURCE LINE # 471
; D14_Cntrl_Reg.D14_DATA_PORT_LSB = *Descriptor_Ptr;
; SOURCE LINE # 472
MOV R6,Descriptor_Ptr
MOV R7,Descriptor_Ptr+01H
MOV DPL,R7
MOV DPH,R6
CLR A
MOVC A,@A+DPTR
MOV R7,A
MOV DPTR,#D14_Cntrl_Reg+020H
MOV A,R7
MOVX @DPTR,A
; count--;
; SOURCE LINE # 473
MOV A,count+01H
DEC count+01H
JNZ ?C0222
DEC count
?C0222:
; Descriptor_Ptr++;
; SOURCE LINE # 474
INC Descriptor_Ptr+01H
MOV A,Descriptor_Ptr+01H
JNZ ?C0223
INC Descriptor_Ptr
?C0223:
; }
; SOURCE LINE # 475
SJMP ?C0046
?C0047:
; //選擇高速還是全速端點(diǎn)1OUT描述符
; if(Kernel_Flag.BITS.HS_FS_State == FULL_SPEED)
; SOURCE LINE # 477
MOV R7,Kernel_Flag+03H
MOV A,R7
JNB ACC.0,?C0048
; Descriptor_Ptr = &Int_Out_Descriptor[0]; //set pointer to interface descriptor
; SOURCE LINE # 478
MOV R6,#HIGH (Int_Out_Descriptor)
MOV R7,#LOW (Int_Out_Descriptor)
MOV Descriptor_Ptr,R6
MOV Descriptor_Ptr+01H,R7
?C0048:
; if(Kernel_Flag.BITS.HS_FS_State == HIGH_SPEED)
; SOURCE LINE # 479
MOV R7,Kernel_Flag+03H
MOV A,R7
JB ACC.0,?C0049
; Descriptor_Ptr = &HS_Int_Out_Descriptor[0]; //set pointer to interface descriptor
; SOURCE LINE # 480
MOV R6,#HIGH (HS_Int_Out_Descriptor)
MOV R7,#LOW (HS_Int_Out_Descriptor)
MOV Descriptor_Ptr,R6
MOV Descriptor_Ptr+01H,R7
?C0049:
; count = *Descriptor_Ptr; //read in descriptor length
; SOURCE LINE # 481
MOV R6,Descriptor_Ptr
MOV R7,Descriptor_Ptr+01H
MOV DPL,R7
MOV DPH,R6
CLR A
MOVC A,@A+DPTR
MOV R7,A
MOV R6,#00H
MOV count,R6
MOV count+01H,R7
?C0050:
; //寫(xiě)入端點(diǎn)1OUT描述符
; while(count != 0)
; SOURCE LINE # 483
MOV A,count+01H
ORL A,count
JZ ?C0051
; {
; SOURCE LINE # 484
; D14_Cntrl_Reg.D14_DATA_PORT_LSB = *Descriptor_Ptr;
; SOURCE LINE # 485
MOV R6,Descriptor_Ptr
MOV R7,Descriptor_Ptr+01H
MOV DPL,R7
MOV DPH,R6
CLR A
MOVC A,@A+DPTR
MOV R7,A
MOV DPTR,#D14_Cntrl_Reg+020H
MOV A,R7
MOVX @DPTR,A
; count--;
; SOURCE LINE # 486
MOV A,count+01H
DEC count+01H
JNZ ?C0224
DEC count
?C0224:
; Descriptor_Ptr++;
; SOURCE LINE # 487
INC Descriptor_Ptr+01H
MOV A,Descriptor_Ptr+01H
JNZ ?C0225
INC Descriptor_Ptr
?C0225:
; }
; SOURCE LINE # 488
SJMP ?C0050
?C0051:
; //選擇高速還是全速端點(diǎn)2IN描述符
; if(Kernel_Flag.BITS.HS_FS_State == FULL_SPEED)
; SOURCE LINE # 490
MOV R7,Kernel_Flag+03H
MOV A,R7
JNB ACC.0,?C0052
; Descriptor_Ptr = &Bulk_In_Descriptor[0]; //set pointer to interface descriptor
; SOURCE LINE # 491
MOV R6,#HIGH (Bulk_In_Descriptor)
MOV R7,#LOW (Bulk_In_Descriptor)
MOV Descriptor_Ptr,R6
MOV Descriptor_Ptr+01H,R7
?C0052:
; if(Kernel_Flag.BITS.HS_FS_State == HIGH_SPEED)
; SOURCE LINE # 492
MOV R7,Kernel_Flag+03H
MOV A,R7
JB ACC.0,?C0053
; Descriptor_Ptr = &HS_Bulk_In_Descriptor[0]; //set pointer to interface descriptor
; SOURCE LINE # 493
MOV R6,#HIGH (HS_Bulk_In_Descriptor)
MOV R7,#LOW (HS_Bulk_In_Descriptor)
MOV Descriptor_Ptr,R6
MOV Descriptor_Ptr+01H,R7
?C0053:
; count = *Descriptor_Ptr; //read in descriptor length
; SOURCE LINE # 494
MOV R6,Descriptor_Ptr
MOV R7,Descriptor_Ptr+01H
MOV DPL,R7
MOV DPH,R6
CLR A
MOVC A,@A+DPTR
MOV R7,A
MOV R6,#00H
MOV count,R6
MOV count+01H,R7
?C0054:
; //寫(xiě)入端點(diǎn)2IN描述符
; while(count != 0)
; SOURCE LINE # 496
MOV A,count+01H
ORL A,count
JZ ?C0055
; {
; SOURCE LINE # 497
; D14_Cntrl_Reg.D14_DATA_PORT_LSB = *Descriptor_Ptr;
; SOURCE LINE # 498
MOV R6,Descriptor_Ptr
MOV R7,Descriptor_Ptr+01H
MOV DPL,R7
MOV DPH,R6
CLR A
MOVC A,@A+DPTR
MOV R7,A
MOV DPTR,#D14_Cntrl_Reg+020H
MOV A,R7
MOVX @DPTR,A
; count--;
; SOURCE LINE # 499
MOV A,count+01H
DEC count+01H
JNZ ?C0226
DEC count
?C0226:
; Descriptor_Ptr++;
; SOURCE LINE # 500
INC Descriptor_Ptr+01H
MOV A,Descriptor_Ptr+01H
JNZ ?C0227
INC Descriptor_Ptr
?C0227:
; }
; SOURCE LINE # 501
SJMP ?C0054
?C0055:
; //選擇高速還是全速端點(diǎn)2OUT描述符
; if(Kernel_Flag.BITS.HS_FS_State == FULL_SPEED)
; SOURCE LINE # 503
MOV R7,Kernel_Flag+03H
MOV A,R7
JNB ACC.0,?C0056
; Descriptor_Ptr = &Bulk_Out_Descriptor[0]; //set pointer to interface descriptor
; SOURCE LINE # 504
MOV R6,#HIGH (Bulk_Out_Descriptor)
MOV R7,#LOW (Bulk_Out_Descriptor)
MOV Descriptor_Ptr,R6
MOV Descriptor_Ptr+01H,R7
?C0056:
; if(Kernel_Flag.BITS.HS_FS_State == HIGH_SPEED)
; SOURCE LINE # 505
MOV R7,Kernel_Flag+03H
MOV A,R7
JB ACC.0,?C0057
; Descriptor_Ptr = &HS_Bulk_Out_Descriptor[0]; //set pointer to interface descriptor
; SOURCE LINE # 506
MOV R6,#HIGH (HS_Bulk_Out_Descriptor)
MOV R7,#LOW (HS_Bulk_Out_Descriptor)
MOV Descriptor_Ptr,R6
MOV Descriptor_Ptr+01H,R7
?C0057:
; count = *Descriptor_Ptr; //read in descriptor length
; SOURCE LINE # 507
MOV R6,Descriptor_Ptr
MOV R7,Descriptor_Ptr+01H
MOV DPL,R7
MOV DPH,R6
CLR A
MOVC A,@A+DPTR
MOV R7,A
MOV R6,#00H
MOV count,R6
MOV count+01H,R7
?C0058:
; //寫(xiě)入端點(diǎn)2OUT描述符
; while(count != 0)
; SOURCE LINE # 509
MOV A,count+01H
ORL A,count
JZ ?C0037
; {
; SOURCE LINE # 510
; D14_Cntrl_Reg.D14_DATA_PORT_LSB = *Descriptor_Ptr;
; SOURCE LINE # 511
MOV R6,Descriptor_Ptr
MOV R7,Descriptor_Ptr+01H
MOV DPL,R7
MOV DPH,R6
CLR A
MOVC A,@A+DPTR
MOV R7,A
MOV DPTR,#D14_Cntrl_Reg+020H
MOV A,R7
MOVX @DPTR,A
; count--;
; SOURCE LINE # 512
MOV A,count+01H
DEC count+01H
JNZ ?C0228
DEC count
?C0228:
; Descriptor_Ptr++;
; SOURCE LINE # 513
INC Descriptor_Ptr+01H
MOV A,Descriptor_Ptr+01H
JNZ ?C0229
INC Descriptor_Ptr
?C0229:
; }
; SOURCE LINE # 514
SJMP ?C0058
; }
; SOURCE LINE # 515
?C0037:
; //使端點(diǎn)有效
; D14_Cntrl_Reg.D14_CONTROL_FUNCTION.BITS.VENDP = 1; //validate FIFO
; SOURCE LINE # 517
MOV DPTR,#D14_Cntrl_Reg+028H
MOVX A,@DPTR
MOV R7,A
MOV A,R7
ORL A,#08H
MOV R7,A
MOV DPTR,#D14_Cntrl_Reg+028H
MOV A,R7
MOVX @DPTR,A
; wait_ep0tx();
; SOURCE LINE # 518
LCALL wait_ep0tx
; ep0out_ack();
; SOURCE LINE # 519
LCALL ep0out_ack
; }
; SOURCE LINE # 520
; break;
; SOURCE LINE # 521
RET
;
; case 3: //獲取字符串描述符
; SOURCE LINE # 523
?C0060:
; Descriptor_Ptr = &Standard_String_ID[0]; //set pointer to interface descriptor
; SOURCE LINE # 524
MOV R6,#HIGH (Standard_String_ID)
MOV R7,#LOW (Standard_String_ID)
MOV Descriptor_Ptr,R6
MOV Descriptor_Ptr+01H,R7
; count = *Descriptor_Ptr; //get length
; SOURCE LINE # 525
MOV R6,Descriptor_Ptr
MOV R7,Descriptor_Ptr+01H
MOV DPL,R7
MOV DPH,R6
CLR A
MOVC A,@A+DPTR
MOV R7,A
MOV R6,#00H
MOV count,R6
MOV count+01H,R7
; D14_Cntrl_Reg.D14_ENDPT_INDEX = 1;
; SOURCE LINE # 526
MOV DPTR,#D14_Cntrl_Reg+02CH
MOV A,#01H
MOVX @DPTR,A
; if(USB_Device_Request.wLength < count)
; SOURCE LINE # 527
MOV R0,#LOW (USB_Device_Request+06H)
MOV A,@R0
MOV R6,A
INC R0
MOV A,@R0
MOV R7,A
CLR C
MOV A,R7
SUBB A,count+01H
MOV A,R6
SUBB A,count
JNC ?C0061
; count = USB_Device_Request.wLength; //get the remaining length
; SOURCE LINE # 528
MOV R0,#LOW (USB_Device_Request+06H)
MOV A,@R0
MOV count,A
INC R0
MOV A,@R0
MOV count+01H,A
?C0061:
; D14_Cntrl_Reg.D14_BUFFER_LENGTH_LSB = count;
; SOURCE LINE # 529
MOV R7,count+01H
MOV DPTR,#D14_Cntrl_Reg+01CH
MOV A,R7
MOVX @DPTR,A
; D14_Cntrl_Reg.D14_BUFFER_LENGTH_MSB = 0;
; SOURCE LINE # 530
MOV DPTR,#D14_Cntrl_Reg+01DH
CLR A
MOVX @DPTR,A
?C0062:
; //send string ID
; while(count != 0)
; SOURCE LINE # 532
MOV A,count+01H
ORL A,count
JZ ?C0063
; {
; SOURCE LINE # 533
; D14_Cntrl_Reg.D14_DATA_PORT_LSB = *Descriptor_Ptr; //fill up FIFO
; SOURCE LINE # 534
MOV R6,Descriptor_Ptr
MOV R7,Descriptor_Ptr+01H
MOV DPL,R7
MOV DPH,R6
CLR A
MOVC A,@A+DPTR
MOV R7,A
MOV DPTR,#D14_Cntrl_Reg+020H
MOV A,R7
MOVX @DPTR,A
; Descriptor_Ptr++;
; SOURCE LINE # 535
INC Descriptor_Ptr+01H
MOV A,Descriptor_Ptr+01H
JNZ ?C0230
INC Descriptor_Ptr
?C0230:
; count--;
; SOURCE LINE # 536
MOV A,count+01H
DEC count+01H
JNZ ?C0231
DEC count
?C0231:
; }
; SOURCE LINE # 537
SJMP ?C0062
?C0063:
; wait_ep0tx();
; SOURCE LINE # 538
LCALL wait_ep0tx
; ep0out_ack();
; SOURCE LINE # 539
LCALL ep0out_ack
; break;
; SOURCE LINE # 540
RET
;
;
; case 4:
; SOURCE LINE # 543
?C0064:
; reserved();
; SOURCE LINE # 544
LCALL reserved
; break;
; SOURCE LINE # 545
RET
;
; case 5: //獲取端點(diǎn)描述符
; SOURCE LINE # 547
?C0065:
; Temp = 0;
; SOURCE LINE # 548
MOV Temp,#00H
MOV Temp+01H,#00H
; if((USB_Device_Request.wValue & 0x00ff) > 0x0001)
; SOURCE LINE # 549
MOV R0,#LOW (USB_Device_Request+02H)
MOV A,@R0
MOV R6,A
INC R0
MOV A,@R0
MOV R7,A
MOV R6,#00H
SETB C
MOV A,R7
SUBB A,#01H
MOV A,R6
SUBB A,#00H
JC ?C0066
; {
; SOURCE LINE # 550
; D14_Cntrl_Reg.D14_CONTROL_FUNCTION.BITS.STALL = 1;
; SOURCE LINE # 551
MOV DPTR,#D14_Cntrl_Reg+028H
MOVX A,@DPTR
MOV R7,A
MOV A,R7
ORL A,#01H
MOV R7,A
MOV DPTR,#D14_Cntrl_Reg+028H
MOV A,R7
MOVX @DPTR,A
?C0067:
; while(!USB_Int_Flag.BITS.EP0SETUP)
; SOURCE LINE # 552
MOV R7,USB_Int_Flag+01H
MOV A,R7
JB ACC.0,?C0068
; {
; SOURCE LINE # 553
; //讀取ISP1581中斷寄存器
; USB_Int_Flag.VALUE |= D14_Cntrl_Reg.D14_INT.VALUE;
; SOURCE LINE # 555
MOV DPTR,#D14_Cntrl_Reg+018H
MOVX A,@DPTR
MOV R4,A
INC DPTR
MOVX A,@DPTR
MOV R5,A
INC DPTR
MOVX A,@DPTR
MOV R6,A
INC DPTR
MOVX A,@DPTR
MOV R7,A
MOV A,USB_Int_Flag+03H
ORL A,R7
MOV USB_Int_Flag+03H,A
MOV A,USB_Int_Flag+02H
ORL A,R6
MOV USB_Int_Flag+02H,A
MOV A,USB_Int_Flag+01H
ORL A,R5
MOV USB_Int_Flag+01H,A
MOV A,USB_Int_Flag
ORL A,R4
MOV USB_Int_Flag,A
; //回寫(xiě)ISP1581中斷寄存器
; D14_Cntrl_Reg.D14_INT.VALUE = USB_Int_Flag.VALUE;
; SOURCE LINE # 557
MOV R7,USB_Int_Flag+03H
MOV R6,USB_Int_Flag+02H
MOV R5,USB_Int_Flag+01H
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -