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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? usbhidio.asm

?? USB 編程必備.詳細(xì)說明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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区四区精品在线视频| 日韩国产高清影视| 欧美日韩1234| 国产精品一区二区三区乱码 | 99国产一区二区三精品乱码| 日本视频一区二区三区| 国产精品福利一区| 亚洲精品一区二区三区在线观看| 97久久精品人人澡人人爽| 久久av资源网| 日韩电影在线观看电影| 中国av一区二区三区| 欧美v日韩v国产v| 欧美日韩国产高清一区二区| 成人黄色一级视频| 黄色小说综合网站| 五月天丁香久久| 亚洲色大成网站www久久九九| 欧美成人精品福利| 欧美精品三级在线观看| 色综合久久久久综合99| 大美女一区二区三区| 免费成人av在线播放| 樱桃国产成人精品视频| 国产精品麻豆久久久| 国产午夜精品一区二区三区嫩草| 4438x成人网最大色成网站| 欧美网站大全在线观看| 91麻豆国产在线观看| 成人午夜伦理影院| 成人视屏免费看| 国产精品一区2区| 国产乱码精品一区二区三区av | 欧美日韩久久久| 91老师国产黑色丝袜在线| 高清不卡一区二区在线| 国产一区二区三区免费看| 卡一卡二国产精品| 毛片av一区二区三区| 日本成人中文字幕在线视频| 日韩在线a电影| 亚洲成人免费电影| 日本最新不卡在线| 毛片不卡一区二区| 欧美bbbbb| 久久精品av麻豆的观看方式| 久99久精品视频免费观看| 久久99国产精品久久| 韩国女主播一区二区三区| 狠狠狠色丁香婷婷综合激情 | 欧美在线观看一区| 欧美亚洲动漫制服丝袜| 欧美在线观看18| 欧美精品在线观看播放| 欧美一区二区人人喊爽| 精品理论电影在线| 国产日韩一级二级三级| 国产精品电影一区二区三区| 一区二区三区中文字幕电影 | 欧美亚洲综合一区| 欧美日韩一级二级| 日韩一级片在线播放| 精品国产伦一区二区三区观看体验 | 欧美在线视频日韩| 91精品蜜臀在线一区尤物| 欧美一区二区三区在线看| 日韩精品一区二区三区在线观看| 精品av久久707| 国产精品国产三级国产aⅴ无密码| 亚洲色图丝袜美腿| 日韩激情视频网站| 国产suv一区二区三区88区| www.色综合.com| 欧美日韩精品是欧美日韩精品| 欧美一区二区三区在线电影 | 欧美r级在线观看| 国产精品视频免费| 亚洲chinese男男1069| 久久99久久精品| av亚洲精华国产精华精| 制服.丝袜.亚洲.另类.中文| 久久久久久久久久久久电影 | 国产一区二区在线看| 成人免费va视频| 欧美精品日韩综合在线| 国产日韩欧美精品综合| 亚洲v中文字幕| 国产不卡免费视频| 3d成人h动漫网站入口| 国产精品色呦呦| 强制捆绑调教一区二区| 91尤物视频在线观看| 91精品国产综合久久久久久| 国产目拍亚洲精品99久久精品| 一个色综合av| 国产伦理精品不卡| 欧美日韩免费视频| 亚洲国产精品v| 六月丁香婷婷久久| 在线观看视频91| 国产欧美日韩在线| 爽好多水快深点欧美视频| www.视频一区| 久久亚洲精品小早川怜子| 午夜精品一区二区三区三上悠亚| 国产一区二区剧情av在线| 欧美揉bbbbb揉bbbbb| 中文字幕精品三区| 毛片一区二区三区| 欧美日本乱大交xxxxx| 1024亚洲合集| 国产精品一区二区视频| 欧美一级久久久| 亚洲va天堂va国产va久| 成人国产一区二区三区精品| 欧美xingq一区二区| 视频精品一区二区| 在线观看网站黄不卡| 亚洲特级片在线| 国产大陆a不卡| 久久先锋影音av鲁色资源网| 青青青爽久久午夜综合久久午夜| 欧美图片一区二区三区| 亚洲男女一区二区三区| 91色婷婷久久久久合中文| 国产亚洲欧美日韩俺去了| 国模娜娜一区二区三区| 欧美一级理论片| 秋霞成人午夜伦在线观看| 这里只有精品视频在线观看| 亚洲综合自拍偷拍| 91麻豆国产在线观看| 亚洲欧美一区二区在线观看| 成人免费高清在线| 日本一区二区免费在线观看视频| 日本aⅴ亚洲精品中文乱码| 3d动漫精品啪啪1区2区免费| 日韩电影在线免费| 日韩一区二区在线观看| 日韩 欧美一区二区三区| 欧美一二三四区在线| 免费一区二区视频| 精品国产网站在线观看| 国产乱码精品一区二区三区忘忧草 | 亚洲免费电影在线| 91亚洲大成网污www| 亚洲女厕所小便bbb| 91福利小视频| 午夜精品视频在线观看| 欧美日韩精品一区二区天天拍小说| 亚洲成人动漫在线免费观看| 91精品国产综合久久精品| 日本免费在线视频不卡一不卡二| 日韩欧美一区在线观看| 国产在线精品一区二区| 国产精品久久久久久户外露出| 国产69精品久久久久毛片| 亚洲视频香蕉人妖| 欧美日本国产一区| 裸体健美xxxx欧美裸体表演| 91麻豆精品国产自产在线观看一区| 麻豆传媒一区二区三区| 久久久久久免费| 91丨九色porny丨蝌蚪| 一区二区三区产品免费精品久久75| 欧美日韩国产成人在线免费| 久久av老司机精品网站导航| 国产午夜久久久久| 欧洲精品在线观看| 蜜臀av国产精品久久久久| 中文无字幕一区二区三区| 欧美在线999| 久久爱另类一区二区小说| 中文字幕一区二区视频| 欧美色综合久久| 国产精品一区一区三区| 艳妇臀荡乳欲伦亚洲一区| 日韩一级片网站| av在线播放成人| 日本不卡1234视频| 国产精品乱码久久久久久| 欧美久久久久久久久久| 国产电影精品久久禁18| 亚洲国产精品久久久久秋霞影院| 精品日产卡一卡二卡麻豆| 91丨porny丨国产入口| 免费看精品久久片| 亚洲欧美一区二区三区国产精品 | 亚洲激情在线播放| 精品久久久影院| 91国偷自产一区二区三区观看| 免费在线观看成人| 亚洲欧美国产三级| 久久久久国产一区二区三区四区| 色嗨嗨av一区二区三区| 国产乱码精品一区二区三 | 久久狠狠亚洲综合| 亚洲最新视频在线观看| 中文字幕 久热精品 视频在线 | 国产精品欧美综合在线|