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

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

?? usbhidio.asm

?? visual basic 開發的usb hid類應用程序
?? ASM
?? 第 1 頁 / 共 4 頁
字號:
     mov A,[interrupt_mask]
     or A, 10h
     mov [interrupt_mask],A
     ipret Global_Interrupt

;----------------------------------------------------------------------
;GPIO interrupt
;Can be configured to trigger when a port bit toggles.
;Unused here.
;----------------------------------------------------------------------

GPIO_ISR:
     push A
     push X

     pop X
     mov [interrupt_mask],A
     ipret Global_Interrupt

;----------------------------------------------------------------------
;Endpoint 1 ISR
;Endpoint 1 can do IN (device to host) transfers only.
;This interrupt triggers when the host acknowledges
;receiving data from endpoint 1.
;The ISR toggles the data 0/1 bit for the next transaction and
;sets the EnableRespondToIN bit so the chip will respond to the 
;next poll of the endpoint.
;----------------------------------------------------------------------

USB_EP1_ISR:
     push A
;Toggle the data 0/1 bit so it's correct for the next transaction.
     iord USB_EP1_TX_Config  
     xor A,40h
;The interrupt clears the EnableRespondToIN bit (bit 7) in the TX Config.
;Set this bit to 1 so data will go out on the next poll.
     or A, 92h
     iowr USB_EP1_TX_Config
;Enable interrupts and return.
     mov A, [interrupt_mask]
     ipret Global_Interrupt

;----------------------------------------------------------------------
; Reset processing
; Triggers on Reset or "reserved" interrupt.
;To be safe, initialize everything.
;----------------------------------------------------------------------

Reset:
;Place the data stack pointer at the lowest address of Endpoint 0's buffer.
;This keeps the stack from writing over the USB buffers.
;The USB buffers are in high RAM;
;the data stack pointer pre-decrements on a Push instruction.

     mov A, Endpoint_0
     swap A, dsp

;Initialize to FFh
     mov A, 0ffh
     iowr Port0_Data                 ; output ones to port 0
     iowr Port1_Pullup               ; disable port 1 pullups
                                     ; select rising edge interrupts
     iowr Port1_Isink0               ; maximum isink current Port1 bit 0
     iowr Port1_Isink1               ; maximum isink current Port1 bit 1
     iowr Port1_Isink2               ; maximum isink current Port1 bit 2
     iowr Port1_Isink3               ; maximum isink current Port1 bit 3

;Initialize to 00h
     mov A, 0h
     iowr Port1_Data                 ; output zeros to port 1
     iowr Port0_Interrupt            ; disable port 0 interrupts
     iowr Port0_Pullup               ; enable port 0 pullups
     iowr Port0_Isink0               ; minimum sink current Port0 bit 0
     iowr Port0_Isink1               ; minimum sink current Port0 bit 1
     iowr Port0_Isink2               ; minimum sink current Port0 bit 2
     iowr Port0_Isink3               ; minimum sink current Port0 bit 3
     iowr Port0_Isink4               ; minimum sink current Port0 bit 4
     iowr Port0_Isink5               ; minimum sink current Port0 bit 5
     iowr Port0_Isink6               ; minimum sink current Port0 bit 6
     iowr Port0_Isink7               ; minimum sink current Port0 bit 7
     mov [Endpoint1_Byte0],A
     mov [Endpoint1_Byte1],A
     mov [Endpoint1_Byte2],A
     mov [endpoint_stall], A
     mov [remote_wakeup_status], A
     mov [configuration_status], A
     mov [loop_temp], A
     mov [start_send], A
     iowr Watchdog                   ; clear watchdog timer

;initialize values to transmit at Endpoint 1.
     mov A, A5h
     mov [Data_Byte0], A
     mov A, F0h
     mov [Data_Byte1], A

;Enable Port 1, bit 0 interrupts.
;     mov A, 01h
;     iowr Port1_Interrupt
;
;Test what kind of reset occurred: bus or watchdog?
     iord Status_Control
;Was it a bus reset?
     and A, USBReset
;If yes, jump to handle it.
     jnz BusReset
     iord Status_Control
;Was it a watchdog reset?
     and A, WatchDogReset
;If no, continue to wait for a bus reset
     jz suspendReset
;
;Watchog reset:
;A watchdog reset means that the watchdog timer
;wasn't cleared for 8.192 milliseconds.
;Wait for a bus reset to bring the system alive again.
;Enable 1-millisecond interrupt only
     mov A, TIMER_ONLY
     mov [interrupt_mask],A
     iowr Global_Interrupt
;Wait for a bus reset.
WatchdogHandler:
     jmp WatchdogHandler

suspendReset:
;Return to suspend mode to wait for a USB bus reset.
     mov A, 09h
     iowr Status_Control
     nop
     jmp suspendReset

BusReset:
;Clear all reset bits.
;Set bit 0 (the run bit).
     mov A, RunBit
     iowr Status_Control
;Set up for enumeration (Endpoint 0 and 1-millisecond interrupts enabled)
     mov A, ENUMERATE_MASK
     mov [interrupt_mask],A
     iowr Global_Interrupt

wait:
;Wait until configured.
     iord USB_EP1_TX_Config
     cmp A, 0
;Clear the watchdog timer
     iowr Watchdog
;If not configured, continue to wait.
     jz wait     
;When configured, initialize loop_temp.
;Loop_temp adds a delay in the start of transmission of data.
;The chip will respond to the first IN packet no sooner than 
;230 milliseconds after enumeration is complete.
;The delay was included in Cypress' joystick code to prevents problems 
;that occurred when power cycled off and on or the joystick was plugged
;in before the host powered up.
;I've left it in because it does no harm and 
;other hardware might have similar behavior.
;During the delay, the chip will send a NAK in response to any IN packet.
     mov A, 0ffh
     mov [loop_temp], A

;Enable endpoint 1
     iord USB_EP1_TX_Config
     or A, 92h
     iowr USB_EP1_TX_Config

;======================================================================
; The main program loop.
;======================================================================

main:
;Find out if the loop_temp delay has timed out.
;Loop_temp =0 if not timed out, FFh if timed out.
     mov A, [loop_temp]
     cmp A, 0Ah
;If no, don't enable transmitting.
     jnc no_set
;If yes, enable transmitting.
     mov A, 01h
     mov [start_send], A
no_set:
;Clear the watchdog timer.
;This has to be done at least once every 8 milliseconds!
     iowr Watchdog
     iord Port0_Data
nochange:
     jmp main

;----------------------------------------------------------------------
;The endpoint 0 ISR supports the control endpoint.
;This code enumerates and configures the hardware.
;It also responds to Set Report requests that receive data from the host.
;----------------------------------------------------------------------

USB_EP0_ISR:
     push A
     iord USB_EP0_RX_Status
;Has a Setup packet been received?
     and A, 01h
;If no, find out if it's an OUT packet.
     jz check_for_out_packet
;If yes, handle it.
;Disable endpoint 0 interrupts.
     mov A,[interrupt_mask]
     and A, 0F7h
     mov [interrupt_mask], A
     iowr Global_Interrupt
;Find out what the Setup packet contains and handle the request.
      call StageOne
;Re-enable Endpoint 0 interrupts.
     mov A, [interrupt_mask]
     or A, 08h
     mov [interrupt_mask], A
     jmp done_with_packet

check_for_out_packet:
     iord USB_EP0_RX_Status
;Is it an OUT packet?
     and A, 02h
;If no, ignore it.
     jz done_with_packet
;If yes, process the received data.
;Disable Endpoint 0 interrupts.
     mov A,[interrupt_mask]
     and A, 0F7h
     mov [interrupt_mask], A
     iowr Global_Interrupt

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

;Read the first byte in the buffer
     mov a, [Endpoint_0]
;For debugging: if the first byte =12h, bring Port 0, bit 0 high
      cmp a, 12h
      jnz not_a_match
      iord Port0_Data
      or a, 4
      iowr Port0_Data

not_a_match:

;For debugging, add 1 to each byte read
;and copy the bytes to RAM.
;These bytes will be sent back to the host.

      push X
      ;data_count holds the number of bytes left to read.
      ;X holds the index of the address to read
      ;and the index of the address to store the received data.
      ;Initialize the X register.
      mov X, 0
      
      Get_Received_Data:
      ;Find out if there are any bytes to read.
      mov A, 0
      cmp A, [data_count]
      ;Jump if nothing to read.
      jz DoneWithReceivedData

      ;Get a byte.
      mov A, [X + Endpoint_0]
      ;For debugging, increment the received value.
      ;(Endpoint 1 will send it back to the host.)
      ;If the value is 255, reset to 0.
      ;Otherwise increment it.
      cmp A, 255
      jz ResetToZero
      inc A
      jmp NewValueSet
      ResetToZero:
      mov A, 0
      NewValueSet:
      ;Save the value.
      mov [X + Data_Byte0], A
      ;Decrement the number of bytes to read.
      dec [data_count]
      ;Increment the address to read.
      inc X
      ;Do another
      jmp Get_Received_Data

      DoneWithReceivedData:
      pop X

;For debugging, set Port 0 to match the value written
;IN transfers can read this value back.
;     iowr Port0_Data

;Handshake by sending a 0-byte data packet.
call Send0ByteDataPacket

done_with_packet:
;Re-enable Endpoint 0 interrupts.
     mov A,[interrupt_mask]
     or A, 08h
     mov [interrupt_mask], A
     ipret Global_Interrupt

;========================================================================
;Control transfers
;========================================================================

;------------------------------------------------------------------------
;Control transfer, stage one.
;Find out whether the request is a standard device or HID request,
;the direction of data transfer, 
;and whether the request is to a device, interface, or endpoint.
;(from Table 9.2 in the USB spec)
;------------------------------------------------------------------------

StageOne:
;Clear the setup flag
     mov A, 00h
     iowr USB_EP0_RX_Status
;Set the StatusOuts bit to cause auto-handshake after receiving a data packet.
     mov A, 8
     iowr USB_Status_Control
;bmRequestType contains the request.
      mov A, [bmRequestType]

;Standard device requests. From the USB spec.
; host to device requests
        cmp A, 00h
        jz RequestType00                 ; bmRequestType = 00000000 device
;       cmp A, 01h                       *** not required ***  
;       jz RequestType01                 ; bmRequestType = 00000001 interface
        cmp A, 02h              
        jz RequestType02                 ; bmRequestType = 00000010 endpoint
        cmp A, 80h             
; device to host requests
        jz RequestType80                 ; bmRequestType = 10000000 device
        cmp A, 81h
        jz RequestType81                 ; bmRequestType = 10000001 interface
        cmp A, 82h
        jz RequestType82                 ; bmRequestType = 10000010 endpoint

;HID-class device requests. From the HID spec
; host to device requests
        cmp A, 21h
        jz RequestType21                 ; bmRequestType = 00100001 interface
        cmp A, 22h                       ; *** not in HID spec ***
        jz RequestType22                 ; bmRequestType = 00100010 endpoint
; device to host requests
        cmp A, A1h
        jz RequestTypeA1                 ; bmRequestType = 10100001 interface

; Stall unsupported requests
SendStall:
      mov A, A0h
     iowr USB_EP0_TX_Config
      ret

;----------------------------------------------------------------------
;Control transfer, stage two
;Find out which request it is.
;----------------------------------------------------------------------

;Host to device with device as recipient
RequestType00:

;The Remote Wakeup feature is disabled on reset.
     mov A, [bRequest]     ; load bRequest
; Clear Feature                      bRequest = 1
     cmp A, clear_feature
     jz ClearRemoteWakeup 
; Set Feature                     bRequest = 3
     cmp A, set_feature
     jz SetRemoteWakeup

; Set the device address to a non-zero value.
; Set Address                     bRequest = 5
     cmp A, set_address
     jz SetAddress

; Set Descriptor is optional.
; Set Descriptor                bRequest = 7    *** not supported ***

;If wValue is zero, the device is not configured.
;The only other legal value for this firmware is 1.
;Set Configuration           bRequest = 9
    cmp A, set_configuration
    jz SetConfiguration

;Stall unsupported requests.
    jmp SendStall


;Host to device with interface as recipient    *** not required ***
; RequestType01:
;        mov A, [bRequest]       ; load bRequest

; There are no interface features defined in the spec.
; Clear Feature                 bRequest = 1    *** not supported ***
; Set Feature                   bRequest = 3    *** not supported ***

; Set Interface is optional.
; Set Interface                 bRequest = 11   *** not supported ***

;Stall unsupported requests.
;        jmp SendStall

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

; The only standard feature defined for an endpoint is endpoint_stalled.
; Clear Feature               bRequest = 1
     cmp A, clear_feature
     jz ClearEndpointStall
; Set Feature               bRequest = 3
     cmp A, set_feature
     jz SetEndpointStall
 
;Stall unsupported functions.
    jmp SendStall

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品三级av在线播放| 一区二区三区在线播| 亚洲少妇30p| 伦理电影国产精品| 91视频91自| 亚洲精品一区二区在线观看| 综合久久给合久久狠狠狠97色| 日韩av中文字幕一区二区| 成人视屏免费看| 在线综合视频播放| 欧美激情在线观看视频免费| 丝袜美腿成人在线| 在线观看av一区二区| 国产精品理论片| 国内精品第一页| 欧美一区二区三区白人| 亚洲色图丝袜美腿| 成人一区二区三区| 久久久美女艺术照精彩视频福利播放| 亚洲午夜视频在线| 一本色道久久综合精品竹菊| 国产精品久久毛片| 国产精品一区久久久久| 欧美大片在线观看| 奇米在线7777在线精品| 91精品国产色综合久久久蜜香臀| 夜夜嗨av一区二区三区四季av | 色8久久人人97超碰香蕉987| 国产亚洲欧美激情| 国产综合色在线视频区| 日韩欧美成人午夜| 久久99精品久久久久婷婷| 欧美另类videos死尸| 亚洲一二三四区不卡| 欧美性猛交xxxx黑人交| 亚洲综合色视频| 欧美色综合久久| 午夜精品久久久久影视| 67194成人在线观看| 日本va欧美va欧美va精品| 欧美日韩国产另类不卡| 三级一区在线视频先锋| 欧美一区二区三区啪啪| 美腿丝袜亚洲一区| 精品国产一区二区精华| 国产乱码精品一区二区三| 精品久久一区二区三区| 国产麻豆视频精品| 欧美精彩视频一区二区三区| 波多野结衣的一区二区三区| 国产精品福利一区二区三区| 色欧美乱欧美15图片| 亚洲午夜视频在线观看| 日韩精品一区二区三区视频播放| 久久精品国产成人一区二区三区| 久久伊99综合婷婷久久伊| 粉嫩av一区二区三区在线播放| 综合色中文字幕| 欧美日韩在线综合| 国内一区二区视频| 中文字幕日韩精品一区| 欧美丝袜第三区| 经典三级在线一区| 国产精品成人一区二区艾草| 欧美日韩一区二区三区四区| 精品在线播放午夜| 亚洲欧洲精品一区二区三区不卡| 欧美性一级生活| 久久99久久久欧美国产| 中文字幕免费一区| 国产精品69毛片高清亚洲| 精品免费视频.| 成人av在线网站| 亚洲电影欧美电影有声小说| 精品毛片乱码1区2区3区| 国产suv精品一区二区三区| 亚洲国产综合91精品麻豆| 久久综合丝袜日本网| 91丨九色丨蝌蚪丨老版| 免费高清在线一区| 亚洲日本护士毛茸茸| 日韩三级免费观看| 色婷婷亚洲综合| 国产一区二区h| 日韩黄色免费电影| 亚洲三级理论片| 精品国产一区二区亚洲人成毛片| 精品视频在线看| 成人高清视频在线| 卡一卡二国产精品| 亚洲午夜免费电影| 中文字幕一区在线观看| 精品日韩在线一区| 欧美日韩国产一级二级| 不卡av在线网| 国产一区二区在线观看免费| 日韩精品亚洲一区| 亚洲精品国产无套在线观| 国产欧美日韩在线视频| 日韩亚洲欧美综合| 欧美嫩在线观看| 91久久精品一区二区二区| 成人免费视频视频在线观看免费| 麻豆精品蜜桃视频网站| 婷婷国产v国产偷v亚洲高清| 一区二区欧美国产| 亚洲精品日韩一| 国产精品污www在线观看| 国产欧美视频在线观看| 精品国产乱子伦一区| 欧美一区二区美女| 欧美一区二区三区小说| 欧美日韩视频不卡| 欧美三级蜜桃2在线观看| 日本韩国一区二区| 在线看国产一区二区| 色哟哟国产精品| 欧美在线免费观看视频| 在线一区二区三区四区五区| 欧日韩精品视频| 欧美在线免费观看视频| 欧美电影在哪看比较好| 欧美高清视频www夜色资源网| 欧美久久久一区| 欧美乱妇20p| 日韩免费高清av| 久久一日本道色综合| 国产精品麻豆久久久| 中文字幕在线播放不卡一区| 亚洲免费色视频| 亚洲综合色区另类av| 免费在线欧美视频| 狠狠色狠狠色综合系列| 成人国产免费视频| 91天堂素人约啪| 欧美精品自拍偷拍动漫精品| 欧美一级片在线看| 国产欧美综合色| 亚洲视频图片小说| 午夜一区二区三区在线观看| 男人的天堂亚洲一区| 成人污视频在线观看| 色av综合在线| 欧美一级在线视频| 国产精品女同一区二区三区| 亚洲精品国产第一综合99久久| 婷婷亚洲久悠悠色悠在线播放| 久久se这里有精品| 91网上在线视频| 日韩欧美激情在线| 亚洲乱码国产乱码精品精可以看| 亚洲18色成人| 成人动漫在线一区| 欧美日韩国产高清一区二区 | 国产寡妇亲子伦一区二区| 成人网页在线观看| 欧美人与禽zozo性伦| 国产亚洲一区字幕| 亚洲国产成人va在线观看天堂| 国产一区二区精品久久91| 欧美视频一区二区三区四区| 久久久亚洲欧洲日产国码αv| 亚洲综合区在线| 国产69精品久久99不卡| 欧美性感一区二区三区| 国产精品情趣视频| 麻豆精品久久久| 欧美午夜精品理论片a级按摩| 久久久久高清精品| 日韩一区欧美二区| 91麻豆国产福利精品| 久久综合色天天久久综合图片| 亚洲一区免费视频| 不卡一区二区中文字幕| 精品国产电影一区二区| 亚洲一区在线电影| 99国产精品久久久久久久久久久| 欧美va亚洲va国产综合| 亚洲va韩国va欧美va精品| 成人理论电影网| 久久久影视传媒| 青娱乐精品视频| 欧美日韩国产片| 亚洲一区二区三区小说| 成人国产精品免费网站| 久久精品亚洲乱码伦伦中文| 麻豆国产欧美一区二区三区| 欧美精品乱码久久久久久按摩| 一区二区三区欧美日韩| av爱爱亚洲一区| 国产精品毛片无遮挡高清| 粉嫩av亚洲一区二区图片| 国产婷婷一区二区| 国产成人av一区二区| 久久无码av三级| 国产精品一线二线三线精华| 久久理论电影网| 国产精品99久久久久久久vr| 久久综合网色—综合色88| 国产精品一区二区久激情瑜伽|