📄 function.lst
字号:
574 013B SetInterface_wait:
575 013B 2000 R CALL Send_Hand_Shake
576 013C 2800 E JMP USB_EP0_ISR_END
577 013D
578 013D ;-----------------------------------------------------------
579 013D ; Get Interface
580 013D ;-----------------------------------------------------------
581 013D GetInterface:
582 013D 0001 clr wdt
583 013E 0700 E mov A,USB_Interface_Alt
584 013F 0080 E mov FIFO_OUT1,A
585 0140
586 0140 0F01 mov A,01H
587 0141 0080 E mov FIFO_SendLen,A
588 0142
589 0142 GetInterface_Loop:
590 0142 0001 clr wdt
591 0143 2000 R call Check_Real_Cmd
592 0144 3C00 E sz bFlag_Real_Cmd
593 0145 2800 R jmp GetInterface_End
594 0146 0001 clr wdt
595 0147 2000 R call FIFO0_WR_CHECK
"File: FUNCTION.ASM Holtek Cross-Assembler Version 2.86 Page 11
596 0148 3800 E SNZ bFlag_FIFO_Ready
597 0149 2800 R JMP GetInterface_Loop
598 014A
599 014A 2000 R CALL Write_FIFO0
600 014B
601 014B GetInterface_End:
602 014B 2800 E JMP USB_EP0_ISR_END
603 014C
604 014C ;-----------------------------------------------------------
605 014C ; Get Status
606 014C ; For Get Status (DEVICE,INTERFACE,ENDPOINT) , if self-powered and remote wakeup need to modify
607 014C ; return 2 bytes (00 00)
608 014C ;-----------------------------------------------------------
609 014C GetStatus:
610 014C 0001 clr wdt
611 014D 0F02 mov a,02H
612 014E 0080 E mov FIFO_SendLen,a
613 014F
614 014F 0F00 mov a,00H
615 0150 0080 E mov FIFO_Out1,a
616 0151 0080 E mov FIFO_Out2,a
617 0152
618 0152 GetStatus_Loop:
619 0152 0001 clr wdt
620 0153 2000 R call Check_Real_Cmd
621 0154 3C00 E sz bFlag_Real_Cmd
622 0155 2800 R jmp GetStatus_End
623 0156 0001 clr wdt
624 0157
625 0157 2000 R call FIFO0_WR_CHECK
626 0158 3800 E SNZ bFlag_FIFO_Ready
627 0159 2800 R JMP GetStatus_Loop
628 015A
629 015A 2000 R CALL Write_FIFO0
630 015B
631 015B GetStatus_End:
632 015B 2800 E JMP USB_EP0_ISR_END
633 015C
634 015C ;-----------------------------------------------------------
635 015C ; Get Status (Endpoint)
636 015C ;-----------------------------------------------------------
637 015C GetStatus_Endpoint:
638 015C 0001 clr wdt
639 015D 0F02 mov a,02H
640 015E 0080 E mov FIFO_SendLen,a
641 015F
642 015F 0F7F mov a,07FH
643 0160 0600 E and a,FIFO_wIndexL
644 0161
645 0161 2000 R call GetPipeBit
646 0162 0080 E mov FIFO_TEMP,a
647 0163 0724 mov a,STALL
648 0164 0600 E and a,FIFO_TEMP
649 0165 0080 E mov FIFO_TEMP,a
650 0166
651 0166 1F00 E clr FIFO_Out1
652 0167 1080 E sz FIFO_TEMP
653 0168 3000 E set FIFO_Out1.0
654 0169
655 0169 1F00 E clr FIFO_Out2
"File: FUNCTION.ASM Holtek Cross-Assembler Version 2.86 Page 12
656 016A
657 016A 2800 R jmp GetStatus_Loop
658 016B
659 016B
660 016B GetStatus_Endpoint_End:
661 016B 2800 E JMP USB_EP0_ISR_END
662 016C ;-----------------------------------------------------------
663 016C ; Clear Feature : The HT82A822R return ACK without ERROR
664 016C ; bmRequest: 00 Device
665 016C ; 02 EndPoint
666 016C ; bRequest 01 CLEAR_FEATURE
667 016C ; wValue 0000 clear ENDPOINT0 HALT
668 016C ; 0001 clear REMOTE_WAKEUP
669 016C ; wIndex 0000
670 016C ; wLength 0000
671 016C ;-----------------------------------------------------------
672 016C ClearFeature:
673 016C ;;----2007-01-10 for Vista DTM----
674 016C 0700 E mov a,FIFO_wValueL
675 016D 0C01 xor a,01H
676 016E 390A snz z
677 016F 2800 R JMP SendStall0
678 0170 ;set b_wakeup
679 0170 ;clr bRmtWakeup
680 0170 ;;------------------------------
681 0170 0001 clr wdt
682 0171 2000 R CALL Send_Hand_Shake
683 0172 ClearFeature_Loop:
684 0172 ClearFeature_End:
685 0172 2800 E JMP USB_EP0_ISR_END
686 0173 ;-----------------------------------------------------------
687 0173 ; Clear Feature (Endpoint)
688 0173 ;-----------------------------------------------------------
689 0173 ClearFeature_Endpoint:
690 0173 0001 clr wdt
691 0174
692 0174
693 0174 3800 E snz bFlag_SetConfiguration_Ready
694 0175 2800 R JMP SendStall0
695 0176
696 0176 0F7F mov a,07FH
697 0177 0600 E and a,FIFO_wIndexL
698 0178
699 0178 2000 R call GetPipeBit
700 0179
701 0179 0080 E mov FIFO_TEMP,a
702 017A 0180 E CPL FIFO_TEMP
703 017B 0724 mov a,STALL
704 017C 0600 E AND a,FIFO_TEMP
705 017D 00A4 mov STALL,a
706 017E
707 017E 2000 R CALL Send_Hand_Shake
708 017F
709 017F
710 017F ClearFeature_Endpoint_End:
711 017F 2800 E JMP USB_EP0_ISR_END
712 0180
713 0180 ;-----------------------------------------------------------
714 0180 ; Set Feature
715 0180 ;-----------------------------------------------------------
"File: FUNCTION.ASM Holtek Cross-Assembler Version 2.86 Page 13
716 0180 SetFeature:
717 0180 ;;----2007-01-10 for Vista DTM----
718 0180 0700 E mov a,FIFO_wValueH
719 0181 0C00 xor a,00H
720 0182 3D0A sz z
721 0183 2800 R JMP SetFeature_1
722 0184
723 0184 0700 E mov a,FIFO_wValueH
724 0185 0A81 sub a,81H ;target-now
725 0186 380A snz C
726 0187 2800 R jmp SendStall0 ;<81H
727 0188 ;>81H
728 0188 0700 E mov a,FIFO_wValueH
729 0189 0A84 sub a,84H ;target-now
730 018A 3C0A sz C
731 018B 2800 R jmp SendStall0 ;>84H
732 018C
733 018C 0700 E mov a,FIFO_wValueL
734 018D 0C00 xor a,00H
735 018E 390A snz z
736 018F 2800 R JMP SendStall0
737 0190 2800 R jmp SetFeature_2 ;<84H
738 0191
739 0191 SetFeature_1:
740 0191 0700 E mov a,FIFO_wValueL
741 0192 0C01 xor a,01H
742 0193 390A snz z
743 0194 2800 R JMP SendStall0
744 0195
745 0195 SetFeature_2:
746 0195
747 0195 ;;----------------------------------
748 0195 2000 R CALL Send_Hand_Shake
749 0196 SetFeature_Loop:
750 0196 SetFeature_End:
751 0196 2800 E JMP USB_EP0_ISR_END
752 0197 ;-----------------------------------------------------------
753 0197 ; Set Feature (Endpoint)
754 0197 ;-----------------------------------------------------------
755 0197 SetFeature_Endpoint:
756 0197 0001 clr wdt
757 0198 3800 E snz bFlag_SetConfiguration_Ready
758 0199 2800 R JMP SendStall0
759 019A
760 019A 0F7F mov a,07FH
761 019B 0600 E and a,FIFO_wIndexL
762 019C
763 019C 2000 R call GetPipeBit
764 019D
765 019D 0080 E mov FIFO_TEMP,A
766 019E 0724 mov a,STALL
767 019F 0500 E or a,FIFO_TEMP
768 01A0 00A4 mov STALL,a
769 01A1
770 01A1 2000 R CALL Send_Hand_Shake
771 01A2
772 01A2 SetFeature_Endpoint_End:
773 01A2 2800 E JMP USB_EP0_ISR_END
774 01A3 ;-----------------------------------------------------------
775 01A3 ; Get Descriptor
"File: FUNCTION.ASM Holtek Cross-Assembler Version 2.86 Page 14
776 01A3 ;-----------------------------------------------------------
777 01A3 GetDescriptor:
778 01A3 0001 clr wdt
779 01A4 3400 E CLR bFlag_RD_HTable
780 01A5 3400 E CLR bFlag_wait_control_out
781 01A6
782 01A6 0700 E MOV A,FIFO_WvalueH ;80 06 00 01
783 01A7 0C01 XOR A,device
784 01A8 3D0A SZ Z
785 01A9 2800 R JMP GetDeviceDescriptor
786 01AA
787 01AA 0700 E MOV A,FIFO_WvalueH ;80 06 00 02
788 01AB 0C02 XOR A,configuration
789 01AC 3D0A SZ Z
790 01AD 2800 R JMP GetConfigurationDescriptor
791 01AE
792 01AE 0700 E MOV A,FIFO_WvalueH ;80 06 00 03
793 01AF 0C03 XOR A,string
794 01B0 3D0A SZ Z
795 01B1 2800 R JMP GetStringDescriptor
796 01B2
797 01B2
798 01B2 ;------------------------------------------------------
799 01B2 ;Then test for HID class Descriptor
800 01B2 ;------------------------------------------------------
801 01B2 0700 E MOV A,FIFO_wIndexL
802 01B3 0C03 XOR A,03H ;Check Interface Number No.3
803 01B4 390A SNZ Z
804 01B5 2800 R JMP SendStall0
805 01B6
806 01B6 0700 E MOV A,FIFO_WvalueH ;81 06 00 22
807 01B7 0C22 XOR A,report
808 01B8 3D0A SZ Z
809 01B9 2800 R JMP GetReportDescriptor
810 01BA
811 01BA 0700 E MOV A,FIFO_WvalueH ;81 06 00 21
812 01BB 0C21 XOR A,HID
813 01BC 3D0A SZ Z
814 01BD 2800 R JMP GetHIDDescriptor
815 01BE
816 01BE
817 01BE
818 01BE 2800 R JMP SendStall0 ;can't parser
819 01BF
820 01BF ;-----------------------------------------------------------
821 01BF ; GetConfiguration
822 01BF ;-----------------------------------------------------------
823 01BF GetConfiguration:
824 01BF 0001 clr wdt
825 01C0 0F01 mov a,01H
826 01C1 0080 E mov FIFO_SendLen,a
827 01C2
828 01C2 0700 E mov a,USB_Configuration
829 01C3 0080 E mov FIFO_OUT1,a
830 01C4 GetConfiguration_Loop:
831 01C4 0001 clr wdt
832 01C5 2000 R call Check_Real_Cmd
833 01C6 3C00 E sz bFlag_Real_Cmd
834 01C7 2800 R jmp GetConfiguration_End
835 01C8 0001 clr wdt
"File: FUNCTION.ASM Holtek Cross-Assembler Version 2.86 Page 15
836 01C9 2000 R call FIFO0_WR_CHECK
837 01CA 3800 E SNZ bFlag_FIFO_Ready
838 01CB 2800 R JMP GetConfiguration_Loop
839 01CC
840 01CC 2000 R CALL Write_FIFO0
841 01CD GetConfiguration_End:
842 01CD 2800 E JMP USB_EP0_ISR_END
843 01CE
844 01CE
845 01CE
846 01CE ;------------------------------------------------------
847 01CE ;Report
848 01CE ;------------------------------------------------------
849 01CE SetReport:
850 01CE 0001 clr wdt
851 01CF 0700 E mov a,FIFO_wValueH
852 01D0 0C02 xor a,set_output_report
853 01D1 3D0A sz z
854 01D2 2800 R jmp SetOutputReport
855 01D3
856 01D3 2800 E JMP USB_EP0_ISR_END
857 01D4 SetReport_End:
858 01D4
859 01D4 SetOutputReport:
860 01D4 0001 clr wdt
861 01D5 ;check interface
862 01D5 0700 E mov a,FIFO_wIndexL
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -