📄 usbproto.ls1
字号:
0152 00000000 409 DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
0156 00000000
015A 0000
015C 00000000 410 DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
0160 00000000
0164 0000
0166 00000000 411 DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
016A 00000000
016E 0000
0170 00000000 412 DB 000H,000H,000H,000H,000H,000H,000H,000H,000H
0174 00000000
0178 00
413
414
415 ; /*
416 ; //*************************************************************************
417 ; //
418 ; // BASBA P R O P R I E T A R Y
419 ; // -- ALL RIGHTS RESERVED --
420 ; //
421 ; // File Name: USBProto.c
422 ; // Purpose: Handles the standard USB device requests
423 ; // Author: Shuming Yu
424 ; // Created: 10 May 2003
425 ; // Modified:
426 ; // Revision: 1.0
427 ; //
428 ; //*************************************************************************
429 ; */
A51 MACRO ASSEMBLER USBPROTO 04/22/2005 11:54:46 PAGE 8
430 ;
431 ; #include <stdio.h>
432 ; #include <string.h>
433 ;
434 ; #include <reg51.h> /* special function register declarations */
435 ;
436 ; #include "d12hal.h"
437 ; #include "cmds.h"
438 ; #include "mainloop.h"
439 ; #include "usbStruc.h"
440 ; #include "USBProto.h"
441 ;
442 ; //#define NUM_ENDPOINTS 4
443 ; #define NUM_ENDPOINTS 1
444 ;
445 ; unsigned char IDLE_TIME;
446 ; /*
447 ; //#define CONFIG_DESCRIPTOR_LENGTH sizeof(USB_CONFIGURATION_DESCRIPTOR) \
448 ; // + sizeof(USB_INTERF
ACE_DESCRIPTOR) \
449 ; // + (NUM_ENDPOINTS *
sizeof(USB_ENDPOINT_DESCRIPTOR))
450 ; */
451 ; extern CONTROL_XFER ControlData;
452 ; //extern IO_REQUEST idata ioRequest;
453 ; extern EPPFLAGS bEPPflags;
454 ; //
455 ; // COPYRIGHT (c) 2003 BY BASBA USA.PPflags;
456 ; extern unsigned char idata GenEpBuf[]; //Buffer which store data got from host
457 ;
458 ; UCHAR code REPORT_DESCRIPTOR[] = {
459 ; 0x06,0x00,0xFF, //Usage Page(vendor defined)
460 ; 0x09,0x01, //Usage (I/O Device)
461 ; 0xA1,0x01, //Collection (Application)
462 ; 0x19,0x01, //Usage minimum (button1)
463 ; 0x29,0x08, //Usage maximun (button8)
464 ; 0x15,0x00, //Logic mininum (0)
465 ; 0x25,0x01, //logic maximum (1)
466 ; 0x75,0x01, //Report size (1)
467 ; 0x95,0x08, //Report count (8)
468 ; 0x81,0x02, //Input(Data,Var,Abs)
469 ; 0x19,0x01, //Usage Minimum (LED1)
470 ; 0x29,0x08, //Usage Maximum (LED8)
471 ; 0x91,0x02, //Output(Data,Var,Abs)
472 ; 0xC0 //End of collection
473 ; };
474 ;
475 ; struct CONFIG { USB_CONFIGURATION_DESCRIPTOR sConfig;
476 ; USB_INTERFACE_DESCRIPTOR sInterface;
477 ; USB_HID_DESCRIPTOR sHID;
478 ; USB_ENDPOINT_DESCRIPTOR sEndpoint;
479 ; };
480 ;
481 ; #define CONFIG_DESCRIPTOR_LENGTH sizeof(struct CONFIG)
482 ; #define REPORT_DESC_LENGTH sizeof(REPORT_DESCRIPTOR)
483 ;
484 ;
485 ; code USB_DEVICE_DESCRIPTOR DeviceDescr =
486 ; {
487 ; sizeof(USB_DEVICE_DESCRIPTOR), //BYTE bLength,
488 ; USB_DEVICE_DESCRIPTOR_TYPE, //BYTE bDescriptorType
489 ; SWAP(0x0100), //WORD bcdUSB, USB Rev1.0
490 ; 0x00, //Byte bDeviceClass
491 ; 0x00, //BYTE bDeviceSubClass
492 ; 0x00, //BYTE bDeviceProtocol
493 ; EP0_PACKET_SIZE,//BYTE bMaxPacketSize of 16
A51 MACRO ASSEMBLER USBPROTO 04/22/2005 11:54:46 PAGE 9
494 ; SWAP(0x4242), //WORD idVendor
495 ; SWAP(0x0100), //WORD idProduct
496 ; SWAP(0x0100), //WORD bcdDevice
497 ; 0x01, //BYTE iManufacturer name
498 ; 0x02, //BYTE iProduct name
499 ; 0x00, //BYTE iSerialNumber name
500 ; 0x01 //BYTE bNumConfigurations, number of configurations
501 ; };
502 ;
503 ; /*
504 ; code USB_CONFIGURATION_DESCRIPTOR ConfigDescr =
505 ; {
506 ; sizeof(USB_CONFIGURATION_DESCRIPTOR), //BYTE bLength
507 ; USB_CONFIGURATION_DESCRIPTOR_TYPE, //BYTE bDescriptorType //Assigned by USB
508 ; SWAP(CONFIG_DESCRIPTOR_LENGTH), //WORD wTotalLength
509 ; 0x01, //BYTE bNumInterfaces
510 ; 0x01, //BYTE bConfigurationValue
511 ; 0x03, //BYTE iConfiguration
512 ; 0x80, //BYTE bmAttributes, Bus powered
513 ; 50, //BYTE MaxPower, 50x2=100mA
514 ; };
515 ;
516 ; code USB_INTERFACE_DESCRIPTOR InterfaceDescr =
517 ; {
518 ; sizeof(USB_INTERFACE_DESCRIPTOR),//BYTE bLength
519 ; USB_INTERFACE_DESCRIPTOR_TYPE,//BYTE bDescriptionType, assigned by USB
520 ; 0x00, //BYTE bInterfaceNumber
521 ; 0x00, //BYTE bAlternateSetting, no alternate setting
522 ; 0x01, //BYTE bNumEndpoints, HID uses endpoint 1
523 ; 0x03, //BYTE bInterfaceClass, HID Class - 0x03
524 ; 0x00, //BYTE bInterfaceSubClass
525 ; 0x00, //BYTE bInterfaceProtocol
526 ; 0x04 //BYTE iInterface, interface name
527 ; };
528 ;
529 ; code USB_HID_DESCRIPTOR HIDDescr =
530 ; {
531 ; sizeof(USB_HID_DESCRIPTOR), //BYTE bLength;
532 ; 0x21, //BYTE bDescriptorType;
533 ; 0x0001, //WORD bcdHID;
534 ; 0x00, //BYTE bCountryCode, country localization = None;
535 ; 0x01, //BYTE bNumDescriptors, number of descriptor follow
536 ; 0x22, //BYTE bReportDescriptorType And it's a Report descriptor
537 ; SWAP(REPORT_DESC_LENGTH) //WORD wItemLength, total length of report descriptor
538 ; };
539 ;
540 ; code USB_ENDPOINT_DESCRIPTOR EP1_TXDescr =
541 ; {
542 ; sizeof(USB_ENDPOINT_DESCRIPTOR), //BYTE bLength
543 ; 0x05, //BYTE bDescriptorType, assigned by USB
544 ; 0x81, //BYTE bEndpointAddress, IN endpoint, endpoint 1
545 ; USB_ENDPOINT_TYPE_INTERRUPT, //BYTE bmAttributes, Interrupt endpoint
546 ; SWAP(EP1_PACKET_SIZE), //WORD wMaxPacketSize
547 ; 100 //Polling Time, poll over 100 ms
548 ; };
549 ; */
550 ;
551 ; struct CONFIG code sConfiguration= {
552 ; sizeof(USB_CONFIGURATION_DESCRIPTOR), //BYTE bLength
553 ; USB_CONFIGURATION_DESCRIPTOR_TYPE, //BYTE bDescriptorType //Assigned by USB
554 ; SWAP(CONFIG_DESCRIPTOR_LENGTH), //WORD wTotalLength
555 ; 0x01, //BYTE bNumInterfaces
556 ; 0x01, //BYTE bConfigurationValue
557 ; 0x03, //BYTE iConfiguration
558 ; 0x80, //BYTE bmAttributes, Bus powered
559 ; 50, //BYTE MaxPower, 50x2=100mA
A51 MACRO ASSEMBLER USBPROTO 04/22/2005 11:54:46 PAGE 10
560 ;
561 ; sizeof(USB_INTERFACE_DESCRIPTOR),//BYTE bLength
562 ; USB_INTERFACE_DESCRIPTOR_TYPE,//BYTE bDescriptionType, assigned by USB
563 ; 0x00, //BYTE bInterfaceNumber
564 ; 0x00, //BYTE bAlternateSetting, no alternate setting
565 ; 0x01, //BYTE bNumEndpoints, HID uses endpoint 1
566 ; 0x03, //BYTE bInterfaceClass, HID Class - 0x03
567 ; 0x00, //BYTE bInterfaceSubClass
568 ; 0x00, //BYTE bInterfaceProtocol
569 ; 0x04, //BYTE iInterface, interface name
570 ;
571 ; sizeof(USB_HID_DESCRIPTOR), //BYTE bLength;
572 ; 0x21, //BYTE bDescriptorType;
573 ; 0x0001, //WORD bcdHID;
574 ; 0x00, //BYTE bCountryCode, country localization = None;
575 ; 0x01, //BYTE bNumDescriptors, number of descriptor follow
576 ; 0x22, //BYTE bReportDescriptorType And it's a Report descriptor
577 ; SWAP(REPORT_DESC_LENGTH), //WORD wItemLength, total length of report descri
ptor
578 ;
579 ; sizeof(USB_ENDPOINT_DESCRIPTOR), //BYTE bLength
580 ; 0x05, //BYTE bDescriptorType, assigned by USB
581 ; 0x81, //BYTE bEndpointAddress, 0x80=IN endpoint, endpoint 1
582 ; USB_ENDPOINT_TYPE_INTERRUPT, //BYTE bmAttributes, Interrupt
583 ; SWAP(EP1_PACKET_SIZE), //WORD wMaxPacketSize
584 ; 100 //Polling Time unit ms, poll over 100 ms
585 ; };
586 ;
587 ;
588 ; code USB_ENDPOINT_DESCRIPTOR EP1_RXDescr =
589 ; {
590 ; sizeof(USB_ENDPOINT_DESCRIPTOR),
591 ; USB_ENDPOINT_DESCRIPTOR_TYPE,
592 ; 0x1,
593 ; USB_ENDPOINT_TYPE_INTERRUPT,
594 ; SWAP(EP1_PACKET_SIZE),
595 ; 10
596 ; };
597 ;
598 ; code USB_ENDPOINT_DESCRIPTOR EP2_TXDescr =
599 ; {
600 ; sizeof(USB_ENDPOINT_DESCRIPTOR),
601 ; USB_ENDPOINT_DESCRIPTOR_TYPE,
602 ; 0x82,
603 ; USB_ENDPOINT_TYPE_BULK,
604 ; SWAP(EP2_PACKET_SIZE),
605 ; 10
606 ; };
607 ;
608 ; code USB_ENDPOINT_DESCRIPTOR EP2_RXDescr =
609 ; {
610 ; sizeof(USB_ENDPOINT_DESCRIPTOR),
611 ; USB_ENDPOINT_DESCRIPTOR_TYPE,
612 ; 0x2,
613 ; USB_ENDPOINT_TYPE_BULK,
614 ; SWAP(EP2_PACKET_SIZE),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -