亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? usbhidio.asm

?? visual basic 開發的usb hid類應用程序
?? ASM
?? 第 1 頁 / 共 4 頁
字號:
;Get the starting address of the descriptor.
     mov A, (config_desc_table - control_read_table)
;Send the descriptor.
     jmp SendDescriptor

GetStringDescriptor:
;Use the string index to find out which string it is.
     mov A, [wValue]
     cmp A, 0h
     jz LanguageString
     cmp A, 01h
     jz ManufacturerString
     cmp A, 02h
     jz ProductString
;     cmp A, 03h
;     jz SerialNumString
;     cmp A, 04h
;     jz ConfigurationString
;     cmp A, 05h
;     jz InterfaceString
; No other strings supported
      jmp SendStall

SendDescriptor:
;The starting address of the descriptor is in the accumulator. Save it.
        mov [data_start], A
;Get the descriptor length.
        call get_descriptor_length
;Send the descriptor.
        call control_read
        ret

;Send the requested string.
;For each, store the descriptor length in data_count, then send the descriptor.
LanguageString:
     mov A, (USBStringDescription1 - USBStringLanguageDescription)
      mov [data_count], A
     mov A, (USBStringLanguageDescription - control_read_table)
      jmp SendDescriptor
ManufacturerString:     
     mov A, ( USBStringDescription2 - USBStringDescription1)
      mov [data_count], A
     mov A, (USBStringDescription1 - control_read_table)
      jmp SendDescriptor
ProductString:
     mov A, ( USBStringDescription3 - USBStringDescription2)
      mov [data_count], A
     mov A, (USBStringDescription2 - control_read_table)
      jmp SendDescriptor
;SerialNumString:
;     mov A, ( USBStringDescription4 - USBStringDescription3)
;      mov [data_count], A
;     mov A, (USBStringDescription3 - control_read_table)
;      jmp SendDescriptor
;ConfigurationString:
;     mov A, ( USBStringDescription5 - USBStringDescription4)
;      mov [data_count], A
;     mov A, (USBStringDescription4 - control_read_table)
;      jmp SendDescriptor
;InterfaceString:
;     mov A, ( USBStringEnd - USBStringDescription5)
;      mov [data_count], A
;     mov A, (USBStringDescription5 - control_read_table)
;      jmp SendDescriptor

; HID class Get Descriptor routines
;
GetHIDDescriptor:
;Send the HID descriptor.
;Get the length of the descriptor.
     mov A, (Endpoint_Descriptor - Class_Descriptor)
      mov [data_count], A
;Get the descriptor's starting address.
     mov A, ( Class_Descriptor - control_read_table)
;Send the descriptor.
      call SendDescriptor
      ret

;======================================================================
;USB support routines
;======================================================================

get_descriptor_length:
;The host sometimes lies about the number of bytes it
; wants from a descriptor.
;A request to get a descriptor should return the smaller of the number 
;of bytes requested or the actual length of the descriptor.
;Get the requested number of bytes to send
     mov A, [wLengthHi]
;If the requested high byte is >0, 
;ignore the high byte and use the firmware's value.
;(255 bytes is the maximum allowed.)
     cmp A, 0
     jnz use_actual_length
;If the low byte =0, use the firmware's value.
     mov A, [wLength]
     cmp A, 0
     jz use_actual_length
;If the requested number of bytes => the firmware's value,
;use the firmware's value.
     cmp A, [data_count]
     jnc use_actual_length
;If the requested number of bytes < the firmware's value,
;use the requested number of bytes.
     mov [data_count], A
use_actual_length:
        ret

Send0ByteDataPacket:
;Send a data packet with 0 bytes.
;Use this handshake after receiving an OUT data packet.
;Enable responding to IN packets and set Data 0/1 to Data 1.
     mov A, C0h
     iowr USB_EP0_TX_Config
;Enable interrupts.
     mov A, [interrupt_mask]
     iowr Global_Interrupt
WaitForDataToTransfer:
;Wait for the data to transfer.
;Clear the watchdog timer
     iowr Watchdog
;Bit 7 of USB_EP0_TX_Config is cleared when the host acknowledges
;receiving the data.
     iord USB_EP0_TX_Config
     and A, 80h
     jnz WaitForDataToTransfer
     ret

control_read: 
;Do a Control Read transfer.
;The device receives a Setup packet in the Setup stage,
;sends 1 or more data packets (IN) in the Data stage,
;and receives a 0-length data packet (OUT) in the Status stage.
;Before calling this routine, the firmware must set 2 values:
;data_start is the starting address of the descriptor to send,
;expressed as an offset from the control read table.
;data_count is the number of bytes in the descriptor.
     push X
;Set the Data 0/1 bit to 0.
     mov A, 00h
     mov [endp0_data_toggle], A

control_read_data_stage:
     mov X, 00h
     mov A, 00h
     mov [loop_counter], A

;Clear the Setup bit.
     iowr USB_EP0_RX_Status
;Check the Setup bit.
     iord USB_EP0_RX_Status
     and A, 01h
;If not cleared, another setup packet has arrived, 
;so exit the routine.
     jnz control_read_status_stage

;Set the StatusOuts bit to 1 to enable auto-ACK of the OUT Status stage.
     mov A, 08h
     iowr USB_Status_Control
;If there is no data to send, prepare a 0-length data packet.
;(The host might require a final 0-length packet if the descriptor is 
;a multiple of 8 bytes.)
     mov A, [data_count]
     cmp A, 00h
     jz dma_load_done

dma_load_loop:
;Copy up to 8 bytes for transmitting into Endpoint 0's buffer
;and increment/decrement the various counting variables.

;Place the byte to send in the accumulator:
;(control_read_table) + (data_start).
     mov A, [data_start]
     index control_read_table
;Place the byte in Endpoint 0's buffer.
     mov [X + Endpoint_0], A
;Increment the offset of the data being sent.
     inc [data_start]
;Increment the offset of Endpoint 0's buffer.
     inc X
;Increment the number of bytes stored in the buffer.
     inc [loop_counter]
;Decrement the number of bytes left to send.
     dec [data_count]
;If the count = 0, there's no more data to load.
     jz dma_load_done
;If 8 bytes haven't been loaded into the buffer, get another byte.
;If 8 bytes have been loaded, it's the maximum for the transaction,
;so send the data.
     mov A, [loop_counter]
     cmp A, 08h
     jnz dma_load_loop

dma_load_done:
;Send the data.

;Check the Setup bit.
;If it's not 0, another Setup packet has arrived, 
;so exit the routine.
     iord USB_EP0_RX_Status
     and A, 01h
     jnz control_read_status_stage

;Set the bits in the USB_EP0_TX_Config register.
;Toggle the Data 0/1 bit.
     mov A, [endp0_data_toggle]
     xor A, 40h
     mov [endp0_data_toggle], A
;Enable responding to IN token packets.
     or A, 80h
;The low 4 bits hold the number of bytes to send.
     or A, [loop_counter]
     iowr USB_EP0_TX_Config
;Enable interrupts
     mov A, [interrupt_mask]
     iowr Global_Interrupt

wait_control_read:

;Clear the watchdog timer
     iowr Watchdog

;Wait for the data to transfer and the host to acknowledge,
;indicated by Bit 7 = 0.
     iord USB_EP0_TX_Config
     and A, 80h
;When all of the transaction's data has transferred, 
;find out if there is more data to send in the transfer.
     jz control_read_data_stage
;Find out if the host has sent an OUT packet to acknowledge 
;and end the transfer.
     iord USB_EP0_RX_Status
     and A, 02h
     jz wait_control_read

control_read_status_stage:
;The transfer is complete.
     pop X
     mov A, [interrupt_mask]
     iowr Global_Interrupt
     ret

;======================================================================
;Lookup Tables
;Contain the descriptors and the codes for status indicators.
;The firmware accesses the information by referencing a specific
;table's address as an offset from the control_read_table.
;======================================================================

control_read_table:

device_desc_table:
     db 12h          ; Descriptor length (18 bytes)
     db 01h          ; Descriptor type (Device)
     db 10h,01h      ; Complies with USB Spec. Release (0110h = release 1.10)
     db 00h          ; Class code (0)
     db 00h          ; Subclass code (0)
     db 00h          ; Protocol (No specific protocol)
     db 08h          ; Max. packet size for EP0 (8 bytes)
     db 25h,09h      ; Vendor ID (Lakeview Research, 0925h)
     db 34h,12h      ; Product ID (1234)
     db 01h,00h      ; Device release number (0001)
     db 01h          ; Mfr string descriptor index
     db 02h          ; Product string descriptor index
     db 00h          ; Serial Number string descriptor index (None)
     db 01h          ; Number of possible configurations (1)
end_device_desc_table:

config_desc_table:
     db 09h          ; Descriptor length (9 bytes)
     db 02h          ; Descriptor type (Configuration)
     db 22h,00h      ; Total data length (34 bytes)
     db 01h          ; Interface supported (1)
     db 01h          ; Configuration value (1)
     db 00h          ; Index of string descriptor (None)
     db 80h          ; Configuration (Bus powered)
     db 32h          ; Maximum power consumption (100mA)

Interface_Descriptor:
     db 09h          ; Descriptor length (9 bytes)
     db 04h          ; Descriptor type (Interface)
     db 00h          ; Number of interface (0) 
     db 00h          ; Alternate setting (0)
     db 01h          ; Number of interface endpoint (1)
     db 03h          ; Class code ()                    
     db 00h          ; Subclass code ()                 
     db 00h          ; Protocol code ()
     db 00h          ; Index of string()       

Class_Descriptor:
     db 09h          ; Descriptor length (9 bytes)
     db 21h          ; Descriptor type (HID)
     db 00h,01h      ; HID class release number (1.00)
     db 00h          ; Localized country code (None)
     db 01h          ; # of HID class dscrptr to follow (1)
     db 22h          ; Report descriptor type (HID)
                     ; Total length of report descriptor
     db (end_hid_report_desc_table - hid_report_desc_table),00h

Endpoint_Descriptor:
     db 07h          ; Descriptor length (7 bytes)
     db 05h          ; Descriptor type (Endpoint)
     db 81h          ; Encoded address (Respond to IN, 1 endpoint)
     db 03h          ; Endpoint attribute (Interrupt transfer)
     db 06h,00h      ; Maximum packet size (6 bytes)
     db 0Ah          ; Polling interval (10 ms)
      
end_config_desc_table:

;----------------------------------------------------------------------
;The HID-report descriptor table
;----------------------------------------------------------------------

hid_report_desc_table:   
     db 06h, A0h, FFh      ;         Usage Page (vendor defined) FFA0
     db 09h, 01h     ;               Usage (vendor defined)
     db A1h, 01h     ;               Collection (Application)
     db 09h, 02h     ;               Usage (vendor defined)
     db A1h, 00h     ;               Collection (Physical)
     db 06h, A1h, FFh ;               Usage Page (vendor defined) 

;The input report
     db 09h, 03h     ;               usage - vendor defined
     db 09h, 04h     ;               usage - vendor defined
     db 15h, 80h     ;               Logical Minimum (-128)
     db 25h, 7Fh     ;               Logical Maximum (127)
     db 35h, 00h     ;               Physical Minimum (0)
     db 45h, FFh;                    Physical Maximum (255)
;    db 66h, 00h, 00h;               Unit (None (2 bytes))
     db 75h, 08h     ;               Report Size (8)  (bits)
     db 95h, 02h     ;               Report Count (2)  (fields)
     db 81h, 02h     ;               Input (Data, Variable, Absolute)  

;The output report
     db 09h, 05h     ;               usage - vendor defined
     db 09h, 06h     ;               usage - vendor defined
     db 15h, 80h     ;               Logical Minimum (-128)
     db 25h, 7Fh     ;               Logical Maximum (127)
     db 35h, 00h     ;               Physical Minimum (0)
     db 45h, FFh     ;               Physical Maximum (255)
;    db 66h, 00h, 00h;               Unit (None (2 bytes))
     db 75h, 08h     ;               Report Size (8)  (bits)
     db 95h, 02h     ;               Report Count (2)  (fields)
     db 91h, 02h     ;               Output (Data, Variable, Absolute)  

     db C0h          ;               End Collection

     db C0h          ;               End Collection

end_hid_report_desc_table:

;----------------------------------------------------------------------
;String Descriptors
;----------------------------------------------------------------------

;Define the strings

; string 0
USBStringLanguageDescription:
    db 04h          ; Length
    db 03h          ; Type (3=string)
    db 09h          ; Language:  English
    db 04h          ; Sub-language: US
; string 1

;The Length value for each string =
;((number of characters) * 2) + 2

USBStringDescription1:     ; IManufacturerName
    db 1Ah          ; Length
    db 03h          ; Type (3=string)
    dsu "USB Complete" ;

; string 2
USBStringDescription2:     ; IProduct
    db 16h          ; Length
    db 03h          ; Type (3=string)
    dsu "HID Sample"  ;

;string 3
;If the firmware contains a serial number, it must be unique
;for each device or the devices may not enumerate properly.
USBStringDescription3:     ; serial number

; string 4                 
;USBStringDescription4:     ; configuration string descriptor
;    db 16h          ; Length
;    db 03h          ; Type (3=string)
;    dsu "Sample HID"  ;

;string 5
;USBStringDescription5:     ; configuration string descriptor
;    db 32h          ; Length
;    db 03h          ; Type (3=string)
;    dsu "EndPoint1 Interrupt Pipe"  ;

USBStringEnd:

;----------------------------------------------------------------------
;Status information.
;The status can be either device, interface, or endpoint.
;An index selects the correct value.
;----------------------------------------------------------------------
get_dev_status_table:
        db      00h, 00h        ; remote wakeup disabled, bus powered
        db      02h, 00h        ; remote wakeup enabled, bus powered
get_interface_status_table:
        db      00h, 00h        ; always return both bytes zero
get_endpoint_status_table:
        db      00h, 00h        ; not stalled
        db      01h, 00h        ; stalled
get_configuration_status_table:
        db      00h             ; not configured
        db      01h             ; configured
get_protocol_status_table:
        db      00h             ; boot protocol
        db      01h             ; report protocol

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人一区二区三区| 亚洲国产精品影院| 免费人成在线不卡| 国产精品久久久久影院老司| 国产精品国产三级国产aⅴ入口| 99re8在线精品视频免费播放| 成人激情黄色小说| 日韩片之四级片| 亚洲一二三专区| k8久久久一区二区三区 | 亚洲一区二区三区小说| 日本欧美一区二区| 91色.com| 欧美激情综合在线| 国产酒店精品激情| 精品少妇一区二区三区在线播放 | 国产精品初高中害羞小美女文| 日本不卡一区二区| 欧美在线观看18| 亚洲丝袜制服诱惑| 成人av在线电影| 久久久三级国产网站| 久久国产精品99久久人人澡| 欧美日韩日日夜夜| 亚洲动漫第一页| 欧美日韩一区高清| 五月婷婷综合在线| 欧美三区在线观看| 亚洲高清三级视频| 欧美性色aⅴ视频一区日韩精品| 国产精品对白交换视频| 成人av先锋影音| 亚洲国产精品99久久久久久久久| 国产一区二区日韩精品| 久久精品视频一区二区| 国产精品亚洲综合一区在线观看| 久久免费偷拍视频| 成人一级片网址| 国产精品久久三| 成人综合激情网| 亚洲婷婷国产精品电影人久久| 99精品久久免费看蜜臀剧情介绍| 亚洲日本va午夜在线影院| 97国产一区二区| 亚洲国产精品久久久男人的天堂 | 亚洲综合免费观看高清完整版在线 | 久久99精品久久久| 337p粉嫩大胆色噜噜噜噜亚洲| 九九精品一区二区| 日本一区二区三区在线不卡| www.色精品| 一二三四社区欧美黄| 欧美日韩高清一区二区三区| 蜜臀va亚洲va欧美va天堂| wwwwxxxxx欧美| 97se亚洲国产综合自在线不卡| 亚洲一区二区成人在线观看| 欧美一级理论性理论a| 国产伦精一区二区三区| 亚洲日本青草视频在线怡红院| 在线观看欧美精品| 精品在线一区二区| 亚洲欧美综合色| 7777精品伊人久久久大香线蕉| 国产一区中文字幕| 亚洲尤物在线视频观看| 精品国产乱码久久久久久夜甘婷婷| 成人一区在线观看| 亚洲国产一二三| 久久这里都是精品| 欧美吻胸吃奶大尺度电影| 日韩制服丝袜av| 国产精品国产成人国产三级 | 欧美精品一区二区三区在线| 丰满少妇在线播放bd日韩电影| 亚洲午夜羞羞片| 国产欧美日韩精品一区| 欧美精品在线一区二区| av高清久久久| 成人深夜在线观看| 麻豆精品一区二区三区| 一区二区三区在线播| 国产亚洲欧美激情| 6080国产精品一区二区| 91麻豆文化传媒在线观看| 韩国av一区二区| 亚洲gay无套男同| 中文字幕在线观看不卡视频| 日韩精品一区二区三区三区免费 | 337p亚洲精品色噜噜噜| 波多野结衣的一区二区三区| 精品一区二区三区视频| 香蕉久久夜色精品国产使用方法| 国产亚洲午夜高清国产拍精品 | 国产精品久久国产精麻豆99网站| 91精品国产综合久久婷婷香蕉| 成人a级免费电影| 国产一区在线观看视频| 强制捆绑调教一区二区| 亚洲成人av电影| 一区二区三区在线视频观看| 国产欧美一区二区精品婷婷| 精品日韩一区二区三区 | 亚洲国产精品激情在线观看| 精品久久久久久久久久久院品网| 欧美日本不卡视频| 欧美日韩在线直播| 欧美浪妇xxxx高跟鞋交| 欧美最新大片在线看| 91看片淫黄大片一级在线观看| 成人午夜精品在线| 国产盗摄视频一区二区三区| 国内精品国产成人| 狠狠久久亚洲欧美| 韩国欧美国产1区| 国产美女主播视频一区| 麻豆成人综合网| 精品一二线国产| 国产一区二区三区四区五区美女| 日韩av一级电影| 琪琪久久久久日韩精品| 久久精品久久99精品久久| 精品一区二区在线免费观看| 国产一区二区在线观看视频| 国产v综合v亚洲欧| 成人av片在线观看| 91精彩视频在线观看| 欧美日韩综合色| 欧美一区二区日韩| 精品99久久久久久| 久久久久久久精| 一区二区中文字幕在线| 亚洲黄色片在线观看| 午夜免费久久看| 久久99久久99小草精品免视看| 国产美女娇喘av呻吟久久| 成人激情小说网站| 欧美性生活一区| 日韩欧美在线观看一区二区三区| 精品奇米国产一区二区三区| 欧美国产综合一区二区| 夜夜嗨av一区二区三区| 蜜桃一区二区三区在线观看| 国产91精品欧美| 欧美日韩激情一区二区三区| 精品国产在天天线2019| 亚洲欧美成aⅴ人在线观看| 丝袜国产日韩另类美女| 从欧美一区二区三区| 欧美羞羞免费网站| 久久久久97国产精华液好用吗| 综合欧美一区二区三区| 日韩电影在线免费观看| 粉嫩aⅴ一区二区三区四区五区| 欧美午夜一区二区三区免费大片| 精品国产1区二区| 亚洲欧美另类小说视频| 美女精品一区二区| www.日韩精品| 精品国产3级a| 性感美女极品91精品| 国产成人免费视频网站| 欧美久久久久久久久| 中文字幕一区二区三| 免费亚洲电影在线| 欧美午夜精品电影| 国产日产精品1区| 日本欧美大码aⅴ在线播放| 91麻豆国产福利在线观看| 欧美成人激情免费网| 亚洲一区二区三区美女| 不卡一区中文字幕| 久久男人中文字幕资源站| 日韩经典一区二区| 91国内精品野花午夜精品| 国产喂奶挤奶一区二区三区| 欧美aaaaaa午夜精品| 在线区一区二视频| 中文字幕一区在线| 国产成人免费在线视频| 欧美精品一区男女天堂| 首页欧美精品中文字幕| 在线观看欧美精品| 有坂深雪av一区二区精品| 成人激情图片网| 国产欧美日韩三区| 国产精品夜夜嗨| 久久精品人人做人人爽人人| 久久精品国产99| 日韩精品最新网址| 全部av―极品视觉盛宴亚洲| 欧美欧美欧美欧美首页| 亚洲一区免费在线观看| 欧美性猛交xxxxxx富婆| 亚洲码国产岛国毛片在线| 色综合色综合色综合| 亚洲免费毛片网站| 在线观看视频欧美| 三级久久三级久久| 欧美一区二区三区四区五区 |