📄 usb_desc.ls1
字号:
655 ; sizeof(device_descriptor), // Size of this Descriptor in Bytes
656 ; DT_DEVICE, // Descriptor Type (=1)
657 ; { 0x10, 0x01 }, //changed on April 30, 2004
658 ; // USB Spec Release Number in BCD = 1.10 0x10,0x01
659 ; //{0x01,0x00},版本号是1.0 usb
660 ; //{0x10,0x01}是字结构的赋值
661 ; 0, // Device Class Code (none)
662 ; 0, // Device Subclass Code (none)
663 ; 0, // Device Protocol Code (none)
664 ; 8, // Maximum Packet Size for EP0
665 ; { 0x83, 0x04},
666 ; // Vendor ID
667 ; {0x00, 0x00 },
668 ; // Product ID
669 ; {0x00, 0x01 },
670 ; // Device Release Number in BCD
671 ;
672 ; 1, // Index of String Desc for Manufacturer
673 ; 2, // Index of String Desc for Product
674 ; 3, // Index of String Desc for SerNo
675 ; 1 // Number of possible Configurations
676 ; }
677 ; ;
678 ;
679 ;
680 ;
681 ;
682 ; // Copy of HID class descriptor embedded in configDesc below
683 ; //HID类描述符,HID类主要的目的是识别HID通信中使用的其他描述符,可以有7个或9个字段
684 ; const uchar code hidClassDesc[] =
685 ; {
686 ; 9, // Descriptor length
687 ; 0x21, // Descriptor type (HID)
688 ; //0x21表明是人机接口类Hid;
689 ; 0x10,0x01, //changed on April 30, 2004
690 ; // HID release (1.10)
691 ; //这一次没有用到了iword结构
692 ; 0, // Country code (none) //硬件不是本地化,字段是0,
693 ; 1, // Number of HID class descriptors to follow
694 ; 0x22, // Report descriptor type (HID)
695 ; REPORT_DESC_LEN, 0 // Byte length of report descriptor
696 ; } //REPORT_DESC_LEN是设备描述符的总长度,应该是1
8个字节
697 ;
698 ; ;
699 ;
700 ; const uchar code hidClassDescSize = sizeof(hidClassDesc);
701 ;
702 ; //我固件即设备的配置描述符
703 ; const uchar code configDesc[] =
704 ; {
705 ;
706 ; 9, // Configuration descriptor length
707 ; 2, // Descriptor type (configuration)
708 ; 34, 0, // Total length of this descriptor
709 ; 1, // Number of interfaces
710 ; 1, // Configuration value
711 ; 0, // Index of string descriptor (none)
712 ; 0xC0, // Self powered, no remote wakeup
713 ; 25, // <100 mA max power consumption, 2mA steps
714 ;
715 ;
716 ;
A51 MACRO ASSEMBLER USB_DESC 10/15/2004 20:55:30 PAGE 12
717 ; /*===== Interface =====*/
718 ;
719 ; 9, // Descriptor length
720 ; 4, // Descriptor type (interface)
721 ; 0, // Number of interface
722 ; 0, // Alternate setting
723 ; 1, // Number of endpoints (except EP0)
724 ;
725 ; // if you would like to disable EP1, easily write 0 (and 1 back for EP1/display copy refr
esh enable)
726 ; 3, // Class code (HID)
727 ; 0, // Subclass (none)
728 ; 0, // Protocol (none)
729 ; 0, // Index of string descriptor (none)
730 ;
731 ;
732 ;
733 ;
734 ; /*===== HID class descriptor (copy of hidClassDesc) =====*/
735 ;
736 ; 9, // Descriptor length
737 ; 0x21, // Descriptor type (HID)
738 ; 0x10,0x01, //changed on April 30, 2004 // HID release (1.10)
739 ; 0, // Country code (none)
740 ; 1, // Number of HID class descriptors to follow
741 ; 0x22, // Report descriptor type (HID)
742 ; REPORT_DESC_LEN, 0, // Byte length of report descriptor
743 ;
744 ;
745 ;
746 ;
747 ; /*===== Endpoint descriptor =====*/
748 ;
749 ; 7, // Descriptor length (7 bytes)
750 ; 5, // Descriptor type (endpoint)
751 ; 0x81, // Address (IN1)
752 ; 3, // Attributes (interrupt)
753 ; 8, 0, // Maximum packet size (8 bytes)
754 ; 100 // Polling interval (in msec)
755 ; }
756 ; ;
757 ;
758 ;
759 ;
760 ;
761 ;
762 ;
763 ;
764 ;
765 ;
766 ; // Language IDs //字串描述符
767 ; #define SD0LEN 4
768 ; const uchar code string0Desc[] =
769 ; {
770 ; SD0LEN, DT_STRING , // Size, Type
771 ; 0x09, 0x04 // LangID Codes
772 ; }
773 ; ;
774 ;
775 ;
776 ;
777 ;
778 ;
779 ; // Manufacturer String
780 ; #define SD1LEN sizeof("ST Microelectronics")*2
781 ; const uchar code string1Desc[] =
A51 MACRO ASSEMBLER USB_DESC 10/15/2004 20:55:30 PAGE 13
782 ; {
783 ; SD1LEN, DT_STRING, // Size, Type
784 ; 'S', 0, // Unicode String
785 ; 'T', 0,
786 ; ' ', 0,
787 ; 'M', 0,
788 ; 'i', 0,
789 ; 'c', 0,
790 ; 'r', 0,
791 ; 'o', 0,
792 ; 'e', 0,
793 ; 'l', 0,
794 ; 'e', 0,
795 ; 'c', 0,
796 ; 't', 0,
797 ; 'r', 0,
798 ; 'o', 0,
799 ; 'n', 0,
800 ; 'i', 0,
801 ; 'c', 0,
802 ; 's', 0
803 ; }
804 ; ;
805 ;
806 ; // Product String
807 ; #define SD2LEN sizeof("DK3200 Evaluation Board")*2
808 ; const uchar code string2Desc[] =
809 ; {
810 ; SD2LEN, DT_STRING, // Size, Type
811 ; 'D', 0, // Unicode String
812 ; 'K', 0,
813 ; '3', 0,
814 ; '2', 0,
815 ; '0', 0,
816 ; '0', 0,
817 ; ' ', 0,
818 ; 'E', 0,
819 ; 'v', 0,
820 ; 'a', 0,
821 ; 'l', 0,
822 ; 'u', 0,
823 ; 'a', 0,
824 ; 't', 0,
825 ; 'i', 0,
826 ; 'o', 0,
827 ; 'n', 0,
828 ; ' ', 0,
829 ; 'B', 0,
830 ; 'o', 0,
831 ; 'a', 0,
832 ; 'r', 0,
833 ; 'd', 0
834 ; } ;
835 ;
836 ; // Serial Number String
837 ; #define SD3LEN sizeof("S/N:006/2008")*2
838 ; const uchar code string3Desc[] =
839 ; {
840 ; SD3LEN, DT_STRING, // Size, Type
841 ; 'S', 0, // Unicode String
842 ; '/', 0,
843 ; 'N', 0,
844 ; ':', 0,
845 ; '0', 0,
846 ; '0', 0,
847 ; '6', 0,
A51 MACRO ASSEMBLER USB_DESC 10/15/2004 20:55:30 PAGE 14
848 ; '/', 0,
849 ; '2', 0,
850 ; '0', 0,
851 ; '0', 0,
852 ; '8', 0,
853 ; };
854 ;
855 ;
856 ; const uchar code stringXDesc[2] =
857 ; {
858 ; 2, 0, // Size, Type
859 ; };
860 ;
861 ;
862 ; // Table of String Descriptors
863 ; const uchar * const code stringDescTable[] =
864 ; {
865 ; string0Desc,
866 ; string1Desc,
867 ; string2Desc,
868 ; string3Desc,
869 ; stringXDesc //no string
870 ; } ;
871 ;
872 ; /* *************************************************************************
873 ; *** ***
874 ; ** *** End of File *** **
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -