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

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

?? usbhidio.asm

?? vb下usb通訊的例子
?? ASM
?? 第 1 頁 / 共 4 頁
字號:
     mov A, [bRequest]          ; load bRequest

; Get Status               bRequest = 0
     cmp A, get_status
     jz GetDeviceStatus

; Get Descriptor               bRequest = 6
     cmp A, get_descriptor
     jz GetDescriptor

; Get Configuration          bRequest = 8
     cmp A, get_configuration
     jz GetConfiguration

;Stall unsupported requests.
     jmp SendStall

;Device to host with interface as recipient
RequestType81:
     mov A, [bRequest]     ; load bRequest

; Get Status               bRequest = 0
      cmp A, get_status
      jz GetInterfaceStatus

; Get Interface returns the selected alternate setting.
;  This firmware supports no alternate settings.
; Get Interface                 bRequest = 10   *** not supported ***

;The HID class defines one more request for bmRequestType=10000001
; Get Descriptor                bRequest = 6
      cmp A, get_descriptor
      jz GetDescriptor

;Stall unsupported functions
      jmp SendStall

;Device to host with endpoint as recipient
RequestType82:
     mov A, [bRequest]          ; load bRequest
; Get Status               bRequest = 0
     cmp A, get_status
      jz GetEndpointStatus

; Get Descriptor               bRequest = 6
     cmp A, get_descriptor
     jz GetDescriptor
; Sync Frame                  bRequest = 12   *** not supported ***

;Stall unsupported functions.
     jmp SendStall


;Check for HID class requests

;Host to device with endpoint as recipient
RequestType21:
      mov A, [bRequest]      ; load bRequest

; Set Report               bRequest = 9
     cmp A, set_report
     jz SetReport

; Set Idle                    bRequest = 10
      cmp A, set_idle
      jz SetIdle

; Set Protocol               bRequest = 11
      cmp A, set_protocol
      jz SetProtocol

;Stall unsupported requests
     jmp SendStall

RequestType22:
        mov A, [bRequest]      ; load bRequest

; Set Report               bRequest = 9
     cmp A, set_report     
     jz SetReport

;Stall unsupported requests
     jmp SendStall


;Device to host with endpoint as recipient
RequestTypeA1:
        mov A, [bRequest]      ; load bRequest

; Get Report               bRequest = 1
        cmp A, get_report
        jz GetReport

; Get Idle                 bRequest = 2
        cmp A, get_idle
        jz GetIdle

; Get Protocol             bRequest = 3
        cmp A, get_protocol
        jz GetProtocol

;Stall unsupported requests
        jmp SendStall

;----------------------------------------------------------------------
;Control transfer, stage three
;Process the request.
;----------------------------------------------------------------------

;The host controls whether or not a device can request a remote wakeup.

; Disable the remote wakeup capability.
ClearRemoteWakeup:
        mov A, [wValue]
        cmp A, device_remote_wakeup
        jnz SendStall
;Handshake by sending a data packet
        call Send0ByteDataPacket
        mov A, DISABLE_REMOTE_WAKEUP
        mov [remote_wakeup_status], A
        ret

; Enable the remote wakeup capability.
SetRemoteWakeup:
        mov A, [wValue]
        cmp A, device_remote_wakeup
;If not a match, stall.
        jnz SendStall
;Handshake by sending a 0-byte data packet
        call Send0ByteDataPacket
;Perform the request.
        mov A, ENABLE_REMOTE_WAKEUP
        mov [remote_wakeup_status], A
        ret

SetAddress:
; Set the device address to match wValue in the Setup packet.
;Complete the requested action after completing the transaction.
;Handshake by sending a 0-byte data packet.
        call Send0ByteDataPacket
;Perform the request
        mov A, [wValue]
        iowr USB_Device_Address
        ret

SetConfiguration:
;Unconfigured: wValue=0, configured: wValue=1.
;Also clear any stall condition and set Data 0/1 to Data0.
;Handshake by sending a 0-byte data packet.
      call Send0ByteDataPacket
;Save the configuration status.
      mov A, [wValue]
      mov [configuration_status], A
;Clear any stall condtion
      mov A, 0
      mov [endpoint_stall], A
;Set data 0/1 to Data0
      iord USB_EP1_TX_Config
      and A, ~DataToggle

;Set the configuration status.
     iowr USB_EP1_TX_Config     
     mov A, [configuration_status]
     cmp A, 0
;If configured, jump.
     jnz device_configured

;If unconfigured:
;Disable Endpoint 1
     iord USB_EP1_TX_Config
     and A, EFh
     iowr USB_EP1_TX_Config
;Disable Endpoint 1 interrupts.
     mov A, [interrupt_mask]
     and A, EFh
     mov [interrupt_mask], A
     jmp done_configuration

;If configured:
device_configured:
;Send NAK in response to IN packets
     iord USB_EP1_TX_Config
     and A,7Fh
;Enable Endpoint 1
     or A, 10h
     iowr USB_EP1_TX_Config
;Enable interrupts: Endpoint 1 and GPIO
     mov A, [interrupt_mask]
     or A, 50h
     mov [interrupt_mask], A
;Send NAK in response to Endpoint 0 OUT packets.
     iord USB_Status_Control
     and A,0EFh
     iowr USB_Status_Control
done_configuration:
        ret

ClearEndpointStall:
;Clear the stall (halt) condition for Endpoint 1.
;wValue = 0.
        mov A, [wValue]
        cmp A, endpoint_stalled
;If endpoint_stalled = 0, the endpoint isn't stalled
;and there's nothing to clear. Return a Stall for the request.
        jnz SendStall
;
;Clear Endpoint 1 stall
;Handshake by sending a 0-byte data packet
      call Send0ByteDataPacket
;Clear the stall condition
      mov A,0
      mov [endpoint_stall], A
;Set Data 0/1 to Data0
      iord USB_EP1_TX_Config
      and A, ~DataToggle
      iowr USB_EP1_TX_Config
;Send NAK in response to Endpoint 0 OUT packets.
      iord USB_Status_Control
      and A,0EFh
      iowr USB_Status_Control
      ret

;Stall Endpoint 1
SetEndpointStall:
;wValue = 0.
        mov A, [wValue]
        cmp A, endpoint_stalled
;If endpoint_stalled = 1, the endpoint is already stalled,
;so return a Stall for this request.
        jnz SendStall
;Handshake by sending a 0-byte data packet.
        call Send0ByteDataPacket
;Stall the endpoint.
        mov A,1         
        mov [endpoint_stall], A
        mov A, 30h
        iowr USB_EP1_TX_Config
        ret

GetDeviceStatus:
;Device Status is a 2-byte value.
;Bit 0 must be 0 (bus-powered).
;Bit 1 is remote wakeup: 0=disabled, 1=enabled.
;All other bits are unused.
;Return to status bytes to the host.
        mov A, 2
        mov [data_count], A
;control_read_table holds the two possible values for device status.
;Get the address of the first value.
        mov A, (get_dev_status_table - control_read_table)
;Add an index value to select the correct value.
        add A, [remote_wakeup_status]
;Send the value.
        jmp SendDescriptor

GetDescriptor:
;The high byte of wValue contains the descriptor type.
;The low byte of wValue contains the descriptor index.

        mov A, [wValueHi]               ; load descriptor type

;Test for standard descriptor types first.
;Supported descriptor types are device, configuration, string.
;Unsupported descriptor types are interface, endpoint.

; Get Descriptor (device)               wValueHi = 1
     cmp A, device
     jz GetDeviceDescriptor
; Get Descriptor (configuration)        wValueHi = 2
     cmp A, configuration
     jz GetConfigurationDescriptor
; Get Descriptor (string)               wValueHi = 3
     cmp A, string
     jz GetStringDescriptor

; Test for HID-class descriptor types.
; Get Descriptor (HID)                  wValueHi = 21h
        cmp A, HID
        jz GetHIDDescriptor
; Get Descriptor (report)               wValueHi = 22h  
     cmp A, report
     jz GetReportDescriptor
; Get Descriptor (physical)             wValueHi = 23h  *** not supported ***
;Stall unsupported requests.
     jmp SendStall

GetConfiguration:
;Send the current device configuration.
;0 = unconfigured, 1 = configured.

;Send 1 byte
        mov A, 1
        mov [data_count], A
;Get the address of the data to send.
        mov A, (get_configuration_status_table - control_read_table)
;Add an index to point to the correct configuration.
        add A, [configuration_status]
;Send the data.
        jmp SendDescriptor

GetInterfaceStatus:
;Interface status is 2 bytes, which are always 0.
;Send 2 bytes.
        mov A, 2
        mov [data_count], A
;Get the address of the data to send.
        mov A, (get_interface_status_table - control_read_table)
;Send the data.
        jmp SendDescriptor

GetEndpointStatus:
;Endpoint status is 2 bytes.
;Bit 0 = 0 when the endpoint is not stalled.
;Bit 0 = 1 when the endpoint is stalled.
;All other bits are unused.
;Send 2 bytes.
        mov A, 2
        mov [data_count], A
;Get the stall status.
        mov A, [endpoint_stall]
;Shift left to get an index (0 or 2) to point to data
;in the endpoint status table
        asl A
;Get the address of the data to send.
        add A, (get_endpoint_status_table - control_read_table)
;Send the data.
        jmp SendDescriptor

SetReport:
;The CY7C63000 doesn't support interrupt-mode OUT transfers.
;So the host uses Control transfers with Set_Report requests
;to get data from the device.

;Get the report data.

;For debugging: set Port 0, bit 0 =1 to show that we're here.
;      iord Port0_Data
;      or a, 1
;      iowr Port0_Data

;Find out how many bytes to read. This value is in WLength.
;Save the length in data_count.
     mov A, [wLength]
     mov [data_count], A

;Enable receiving data at Endpoint 0 by setting the EnableOuts bit
;The bit clears following any Setup or OUT transaction.
     iord USB_Status_Control
     or A, 10h
;Clear the StatusOuts bit to disable automatic sending of ACK after
;receiving a valid status packet in a Control read (IN) transfer.
;Otherwise, the USB engine will respond to a data OUT packet with a Stall.
     and A, F7h
     iowr USB_Status_Control
;Now we're ready to receive the report data.
;An Endpoint 0 OUT interrupt indicates the arrival of the report data.
ret

SetIdle:
        jmp SendStall   ; *** not supported ***

SetProtocol:
;Switches between a boot protocol (wValue=0) and report protocol (wValue=1).
;This firmware doesn't distinguish between protocols.
        mov A, [wValue]
        mov [protocol_status], A
        call Send0ByteDataPacket
        ret

GetReport:
;Sends a report to the host.
;The high byte of wValue contains the report type. 
;The low byte of wValue contains the report ID.
;Not supported (Use interrupt transfers to send data.)
     jmp SendStall

GetReportDescriptor:
;Save the descriptor length
     mov A, (end_hid_report_desc_table - hid_report_desc_table)
     mov [data_count], A
;Get the descriptor's starting address.
     mov A, (hid_report_desc_table - control_read_table)
     call SendDescriptor

      ret

GetIdle:
;Not supported
        jmp SendStall

GetProtocol:
;Send the current protocol status.
;Send 1 byte.
        mov A, 1
        mov [data_count], A
;Get the address of the data to send.
        mov A, (get_protocol_status_table - control_read_table)
;Add an index that points to the correct data.
        add A, [protocol_status]
;Send the data.
        jmp SendDescriptor
        
; Standard Get Descriptor routines
;
;Send the device descriptor.
GetDeviceDescriptor:
;Get the length of the descriptor
;(stored in the first byte in the device descriptor table).
        mov A, 0
       index device_desc_table
        mov [data_count], A
;Get the starting address of the descriptor.
        mov A, (device_desc_table - control_read_table)
;Send the descriptor.
        jmp SendDescriptor

GetConfigurationDescriptor:
;Send the configuration descriptor.
;Get the length of the descriptor.
     mov A, (end_config_desc_table - config_desc_table)
      mov [data_count], A

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产激情二区三区| 午夜精品视频一区| 一区二区三国产精华液| 日本中文字幕一区| 99精品国产一区二区三区不卡| 欧美日韩国产精品成人| 国产精品视频线看| 紧缚奴在线一区二区三区| 色悠悠久久综合| 久久久美女毛片| 午夜一区二区三区在线观看| av电影在线观看不卡| 欧美成人三级在线| 性做久久久久久免费观看| 99视频一区二区| 久久久久高清精品| 久久国产精品第一页| 精品视频一区三区九区| 国产精品久久久久久久久图文区 | 日韩免费观看2025年上映的电影 | 欧美影视一区二区三区| 欧美激情综合网| 国产在线精品一区二区| 精品日韩av一区二区| 青青草成人在线观看| 欧美亚洲国产bt| 一区二区三区在线免费观看| youjizz久久| 国产视频不卡一区| 国产精品亚洲一区二区三区妖精| 欧美一区二区三区婷婷月色| 视频一区视频二区中文字幕| 精品1区2区3区| 亚洲国产精品久久一线不卡| 欧美性感一类影片在线播放| 一级中文字幕一区二区| 色狠狠色狠狠综合| 亚洲综合视频在线观看| 色噜噜狠狠成人网p站| 亚洲精品乱码久久久久久久久| www.欧美.com| 亚洲视频一区二区免费在线观看 | 亚洲精品久久久蜜桃| a级精品国产片在线观看| 国产精品电影一区二区三区| 99这里都是精品| 亚洲欧美日韩一区二区| 在线观看亚洲精品| 日韩中文字幕不卡| 精品久久久久香蕉网| 国产成人日日夜夜| 国产精品三级视频| 色素色在线综合| 五月婷婷综合在线| 欧美电视剧在线观看完整版| 国产成人午夜精品影院观看视频| 最新高清无码专区| 欧美日韩久久不卡| 久久er99精品| 成人欧美一区二区三区黑人麻豆 | 亚洲一区二区三区中文字幕在线| 欧美亚洲国产一区二区三区va| 美女免费视频一区二区| 国产校园另类小说区| 91丨国产丨九色丨pron| 五月天一区二区三区| 久久亚洲精华国产精华液 | 亚洲黄一区二区三区| 这里只有精品99re| 国产激情视频一区二区在线观看| 亚洲视频在线一区观看| 欧美一卡2卡3卡4卡| 国产白丝精品91爽爽久久| 亚洲电影中文字幕在线观看| 精品国产乱码久久久久久老虎| 99精品视频一区| 美日韩一级片在线观看| 一区二区三区中文在线观看| 精品99一区二区三区| 91色九色蝌蚪| 国产一区二区精品久久| 亚洲一区二区三区在线播放| 久久蜜桃av一区精品变态类天堂| 91论坛在线播放| 国内精品久久久久影院色 | 亚洲激情在线播放| 久久精品免视看| 91精品国产综合久久久久久漫画| 国产suv一区二区三区88区| 青娱乐精品视频在线| 一区二区三区四区在线播放| 国产亚洲综合在线| 日韩美女一区二区三区| 欧美午夜片在线看| 91影院在线观看| 国产成人久久精品77777最新版本| 日韩av一区二区三区| 亚洲男女毛片无遮挡| 国产精品五月天| 久久久夜色精品亚洲| 91精品国产麻豆国产自产在线 | 亚洲国产aⅴ成人精品无吗| 国产精品丝袜黑色高跟| 久久综合久久综合久久综合| 欧美一区二区三区在线| 欧美日韩美女一区二区| 91久久免费观看| 91色.com| 91成人免费电影| 一本久久a久久免费精品不卡| 99久久99久久精品免费看蜜桃| 国产黄人亚洲片| 国产福利视频一区二区三区| 国产一区二区三区四区在线观看| 美腿丝袜亚洲色图| 久久99热99| 国产资源精品在线观看| 紧缚奴在线一区二区三区| 精品一区二区成人精品| 国产精品自拍三区| 国产精品一区二区久激情瑜伽| 国产福利一区二区三区在线视频| 国产一区 二区 三区一级| 国产一区二区三区免费| 国产精品一二一区| 99久久99久久综合| 欧美自拍偷拍午夜视频| 91麻豆精品91久久久久久清纯| 日韩一区二区精品在线观看| 日韩欧美中文字幕精品| 久久精品欧美一区二区三区麻豆 | 99久久精品免费看国产| 99精品在线免费| 欧美人妇做爰xxxⅹ性高电影| 欧美高清一级片在线| 日韩亚洲欧美一区二区三区| 精品成a人在线观看| 欧美国产日韩在线观看| 亚洲乱码中文字幕| 日韩精品免费专区| 韩国女主播成人在线观看| av一区二区三区黑人| 欧美性一二三区| 精品福利av导航| 最新中文字幕一区二区三区| 亚洲一区精品在线| 国产综合久久久久久鬼色| 91在线云播放| 日韩一区二区三区观看| 欧美激情一区二区三区蜜桃视频 | 欧美高清在线视频| 亚洲一区二区三区视频在线| 国产在线日韩欧美| 91在线国产福利| 欧美一卡在线观看| 日韩美女精品在线| 免费人成网站在线观看欧美高清| 成人免费视频播放| 欧美精品在欧美一区二区少妇| 国产欧美一区二区精品仙草咪| 依依成人综合视频| 国产精品中文有码| 欧美日韩一区精品| 久久久久久久久久久99999| 亚洲一区二区三区四区不卡| 国产99久久久久久免费看农村| 91成人免费在线视频| 欧美激情一区在线观看| 日韩高清中文字幕一区| av不卡在线观看| 欧美变态凌虐bdsm| 亚洲一区二区三区四区中文字幕| 国产夫妻精品视频| 欧美一二三四区在线| 夜夜夜精品看看| 99精品久久只有精品| 久久久精品日韩欧美| 日本欧洲一区二区| 欧美曰成人黄网| 国产精品丝袜在线| 国产成人精品亚洲777人妖| 欧美一区二区三区色| 亚洲国产三级在线| 91日韩在线专区| 日韩一区在线看| 成人午夜精品在线| 久久综合资源网| 麻豆一区二区99久久久久| 欧美日韩高清一区| 亚洲一区二区三区四区的| 色婷婷综合久久久| 亚洲欧美在线视频观看| 成人做爰69片免费看网站| 久久久久久9999| 国产美女一区二区三区| 久久精品一区二区三区不卡| 久久99蜜桃精品| 精品国产99国产精品| 久久精品国内一区二区三区| 欧美一区二区啪啪|