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

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

?? usb_ch9.asm

?? 采用pic16c745 pic16c765開發(fā)的usb ps2鼠標(biāo)程序
?? ASM
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
; ******************************************************************
Get_Interface_Status        ; starts in bank 2
    bsf     STATUS, RP0     ; bank 3
    movf    BD0IAL,w        ; get buffer pointer
    movwf   FSR
    clrf    INDF
    incf    FSR,f
    clrf    INDF

    movlw   0x02
    movwf   BD0IBC          ; set byte count to 2
    movlw   0xC8
    movwf   BD0IST          ; Data 1 packet, set owns bit
    return

; ******************************************************************
; Returns the Endpoint stall bit via a 2 byte in buffer
; ******************************************************************
Get_Endpoint_Status         ; starts in bank 2
    movlw   0x0f
    andwf   BufferData+wIndex,w    ; get endpoint, strip off direction bit
    xorlw   0x01            ; is it EP1?
    btfsc   STATUS,Z
    goto    get_EP1_status

    movlw   0x0f
    andwf   BufferData+wIndex,w    ; get endpoint, strip off direction bit
    xorlw   0x02            ; is it EP2?
    btfss   STATUS,Z
    goto    wrongstate

get_EP2_status
    bcf     STATUS,C
    bsf     STATUS,RP0
    btfsc   UEP2,EP_STALL
    bsf     STATUS,C
    goto    build_status_buffer

get_EP1_status
    bcf     STATUS,C
    bsf     STATUS,RP0
    btfsc   UEP1,EP_STALL
    bsf     STATUS,C
         
build_status_buffer
    movf    BD0IAL,w        ; get address of buffer
    movwf   FSR
    clrf    INDF            ; clear byte 0 in buffer
    rlf     INDF,f          ; rotate in carry bit (EP_stall bit)
    incf    FSR,f           ; bump pointer
    clrf    INDF            ; clear byte

    movlw   0x02
    movwf   BD0IBC          ; set byte count to 2
    movlw   0xC8
    movwf   BD0IST          ; Data 1 packet, set owns bit
    return


; *********************************************************************
; The low order byte of wValue now has the new device address as assigned
; from the host.  Save it in the UADDR, transition to the ADDRESSED state
; and clear the current configuration.
; This assumes the SIE has already sent the status stage of the transaction
; as implied by Figure 3-35 of the DOS (Rev A-7)
; ******************************************************************
Set_Address     ; starts in bank 2
    movlw   SET_ADDRESS
    movwf   USB_dev_req            ; currently processing a get descriptor request
    movf    BufferData+wValue,w    ; new address in low order byte of wValue
    movwf   USB_address_pending

    bsf     STATUS, RP0
    clrf    BD0IBC
    movlw   0xc8
    movwf   BD0IST          ; write the whole mess back
    return

finish_set_address          ; starts in bank 2
    clrf    USB_dev_req     ; no request pending
    clrf    USB_Curr_Config ; make sure current configuration is 0
    movf    USB_address_pending,w
    bsf     STATUS, RP0
    movwf   UADDR           ; set the device address
    btfsc   STATUS,Z        ; was address 0?
    goto    endfinishsetaddr    ; yes: don't change state

    movlw   ADDRESS_STATE   ; non-zero: transition to addressed state
    movwf   USWSTAT         ; transition to addressed state
#ifdef SHOW_ENUM_STATUS
    banksel PORTB
    bsf     PORTB,2         ; set bit 2 to indicate Addressed state
    banksel USWSTAT         ; not necessary, Send_0LenPkt resets bank bits
#endif

endfinishsetaddr
    return

; ******************************************************************
; only feature valid for device feature is Device Remote wakeup
; ******************************************************************
Clear_Device_Feature        ; starts in bank2
    movf    BufferData+wValue,w
    xorlw   0x01            ; was it a Device Remote wakeup? If not, return STALL,
    btfss   STATUS,Z        ; since we only implement this feature on this device.
    goto    wrongstate

right_state_clear_feature
    bcf     USB_status_device,1 ; set device remote wakeup
    call    Send_0Len_pkt
    return

; ******************************************************************
; Only endpoint feature is Endpoint halt.
; ******************************************************************
Clear_Endpoint_Feature  ; starts in bank 2
    movlw   0x0f
    andwf   BufferData+wIndex,w ; mask off the EP number bits
    xorlw   0x01            ; is it EP1?
    btfsc   STATUS,Z
    goto    ClearEP1

    movlw   0x0f
    andwf   BufferData+wIndex,w ; mask off the EP number bits
    xorlw   0x02            ; is it EP2?
    btfss   STATUS,Z
    goto    wrongstate

ClearEP2
    bsf     STATUS, RP0
    bcf     UEP2,EP_STALL       ; set the stall bit
    goto    clear_endpoint_end  ; skip the second stall
ClearEP1
    bsf     STATUS, RP0
    bcf     UEP1,EP_STALL   ; set the stall bit

clear_endpoint_end
    call    Send_0Len_pkt
    return

Clear_Interface_Feature     ; starts in bank2
    return

; ******************************************************************
; only feature valid for device feature is Device Remote wakeup
; ******************************************************************
Set_Device_Feature  ; starts in bank 2
    movf    BufferData+wValue,w ; get high order byte of wValue    
    xorlw   0x01            ; was it a Device Remote wakeup?
    btfss   STATUS,Z
    goto    wrongstate      ; request error
    bsf     USB_status_device,1 ; set device remote wakeup
    call    Send_0Len_pkt
    return

; ******************************************************************
; Only endpoint feature is Endpoint halt.
; ******************************************************************
Set_Endpoint_Feature            ; starts in bank 2
    movlw   0x0f
    andwf   BufferData+wIndex,w ; mask off the EP number bits
    xorlw   0x01            ; is it EP1?
    btfsc   STATUS,Z
    goto    StallEP1

    movlw   0x0f
    andwf   BufferData+wIndex,w ; mask off the EP number bits
    xorlw   0x02            ; is it EP2?
    btfss   STATUS,Z
    goto    wrongstate

StallEP2
    bsf     STATUS, RP0
    bsf     UEP2,EP_STALL   ; set the stall bit
    goto    StallEnd        ; skip the second stall

StallEP1
    bsf     STATUS, RP0
    bsf     UEP1,EP_STALL   ; set the stall bit
StallEnd
    call    Send_0Len_pkt
    return

Set_Interface_Feature       ; starts in bank 2
    goto    wrongstate      ; invalid request
    return

; ********************************************************************
; Get configuration returns a single byte Data1 packet indicating the 
; configuration in use.
; Default State    - undefined
; Addressed State  - returns 0
; Configured state - returns current configured state.
; ******************************************************************
Get_Configuration           ; starts in bank 2
    bsf     STATUS, RP0
    movf    low BD0IAL,w    ; get address of buffer
    movwf   FSR
    bcf     STATUS, RP0
    bsf     STATUS,IRP      ; indirectly to banks 2-3
    movf    USB_Curr_Config,w
    movwf   INDF            ; write byte to buffer
    bsf     STATUS, RP0
    movlw   0x01
    movwf   BD0IBC          ; set byte count to 1
    movlw   0xc8            ; DATA1 packet, DTS enabled
    movwf   BD0IST          ; give buffer back to SIE
    return

; ******************************************************************
; Set configuration uses the configuration selected by the low order
; byte of wValue.  Sets up a zero length data1 packet as a reply.
; ******************************************************************
Set_Configuration           ; starts in bank 2
; All we do is set a meaningless number.  This'll 
; need more code here to actually give meaning to each configuration
; we choose.
    movf    BufferData+wValue,w ; is it a valid configuration?
    sublw   NUM_CONFIGURATIONS    
    btfss   STATUS,C        ; if config <= num configs, request appears valid
    goto    wrongstate

    movf    BufferData+wValue,w    
    movwf   USB_Curr_Config ; store new state in configuration

    btfsc   STATUS,Z        ; was the configuration zero?
    goto    AckSetConfigCmd ; yes: stay in the addressed state

    bsf     STATUS, RP0     ; bank 3
    movlw   CONFIG_STATE    ; No: transition to configured
    movwf   USWSTAT         ; save new state.
#ifdef SHOW_ENUM_STATUS
    banksel PORTB
    bsf     PORTB,3         ; set bit 3 to show configured
;    banksel USWSTAT         ; not necessary, Send_0LenPkt resets bank bits
#endif

AckSetConfigCmd
    call    Send_0Len_pkt

; These configure the EP1 and EP2  endpoints.  Change these as necessary
; for your application.
    banksel BD1OST
    movlw   0x88            ; set own bit of EP1 (SIE can write)
    movwf   BD1OST
    movlw   USB_Buffer+0x10 ; Endpoint 1 OUT gets a buffer
    movwf   BD1OAL          ; set up buffer address
    movlw   8
    movwf   BD1OBC          ; set byte count

    movlw   0x48            ; set own bit of EP1 (PIC can write)
    movwf   BD1IST        
    movlw   USB_Buffer+0x18 ; Endpoint 1 IN gets a buffer
    movwf   BD1IAL          ; set up buffer address

    movlw   0x88            ; set own bit of EP2 (SIE can write)
    movwf   BD2OST
    movlw   USB_Buffer+0x20 ; Endpoint 2 OUT gets a buffer
    movwf   BD2OAL          ; set up buffer address
    movlw   8
    movwf   BD2OBC          ; set byte count

    movlw   0x48            ; set own bit of EP2 (PIC can write)
    movwf   BD2IST
    movlw   USB_Buffer+0x20 ; EP1 In and EP2 In share a buffer
    movwf   BD2IAL          ; set up buffer address
; Set up the Endpoint Control Registers.  The following patterns are defined
; ENDPT_DISABLED - endpoint not used
; ENDPT_IN_ONLY  - endpoint supports IN transactions only
; ENDPT_OUT_ONLY - endpoint supports OUT transactions only
; ENDPT_CONTROL     - Supports IN, OUT and CONTROL transactions - Only use with EP0
; ENDPT_NON_CONTROL - Supports both IN and OUT transactions
    movlw   ENDPT_NON_CONTROL
    movwf   UEP1            ; enable EP's 1 and 2 for In and Outs...
    movlw   ENDPT_NON_CONTROL
    movwf   UEP2

;    pagesel SetConfiguration    ; call SetConfiguration etc. after configuration changed
;    movf    USB_Curr_Config,w   ; if you have multiple configurations
;    call    SetConfiguration
;    pagesel Set_Configuration
    return


; ********************************************************************
; Get interface returns a single byte Data1 packet indicating the 
; interface in use.
; Default State    - undefined
; Addressed State  - Not valid - returns stall
; Configured state - returns current configured state.
; ******************************************************************
Get_Interface   ; STARTS IN BANK 2
    bsf     STATUS, RP0
    movf    USWSTAT,w       ; Not valid in the addressed state
    bcf     STATUS,RP0      ; bank 2
    andlw   0x03
    xorlw   ADDRESS_STATE
    btfsc   STATUS,Z
    goto    wrongstate

    movf    BufferData+wIndex,w ; get interface ID
    addlw   low USB_Interface
    movwf   FSR
    bsf     STATUS,IRP
    movf    INDF,w        
    movwf   temp            ; store in temp register
    
    bsf     STATUS,RP0      ; bank 3
    movf    BD0IAL,w        ; get address of buffer
    movwf   FSR
    movf    temp,w          ; load temp
    movwf   INDF            ; write byte to buffer

    movlw   0x01
    movwf   BD0IBC          ; set byte count to 1
    movlw   0xc8            ; DATA1 packet, DTS enabled
    movwf   BD0IST          ; give buffer back to SIE
    return

; ******************************************************************
; Set configuration uses the configuration selected by the low order
; byte of wValue.  Sets up a zero length data1 packet as a reply.
; ******************************************************************
Set_Interface   ; start bank 2
    bsf     STATUS, RP0
    movf    USWSTAT,w       ; test to make sure we're configured
    bcf     STATUS,RP0      ; bank2
    andlw   0x03
    xorlw   CONFIG_STATE
    btfss   STATUS,Z
    goto    wrongstate

    bcf     STATUS, RP0
    movf    BufferData+wIndex,w ; get interface
    addlw   USB_Interface   ; add offset to array
    movwf   FSR
    bsf     STATUS,IRP      ; indirectly to banks 2-3
    movf    BufferData+wValue,w ; get alternate interface
    movwf   INDF            ; store in array
; All we do is set a meaningless number.  This'll 
; need more code here to actually give meaning to each configuration
; we choose.

    call    Send_0Len_pkt
    return

; *********************************************************************
; copies the next chunk of buffer descriptor over to the EP0 In buffer.
; Inputs:
;    EP0_start - points to first byte of configuration table to transfer
;    EP0_end - total number of bytes to transfer
;    EP0_maxLength - maximum number of bytes that can be sent during
;    a single transfer
;
; toggles the data0/1 bit before setting the UOWN bit over to SIE.
; ******************************************************************
copy_descriptor_to_EP0
    global  copy_descriptor_to_EP0
    banksel BD0IAL
    bankisel BD0IAL
    movf    BD0IAL,w        ; get buffer address
    movwf   FSR 
    banksel bufindex
    clrf    bufindex        ; bufindex = 0
gdd_loop
    movf    bufindex,w      ; while (bufindex < EP0_maxLength)
    subwf   EP0_maxLength,w ;    && (EP0_start < EP0_end)
    btfsc   STATUS,Z
    goto    end_gdd_loop

    decfsz  EP0_end, f
    goto    gdd_copy_loop
    goto    end_gdd_loop_short_packet

gdd_copy_loop
    pagesel Descriptions
    call    Descriptions
    pagesel gdd_copy_loop
    movwf   INDF
    
    incf    bufindex,f    
    incf    FSR,f
    incfsz  EP0_start,f
    goto    gdd_loop
    incf    EP0_start+1,f
    goto    gdd_loop

end_gdd_loop_short_packet
    clrf    USB_dev_req     ; we're sending a short packet, clear the device request
end_gdd_loop
    movf    bufindex,w      ; write number of bytes to byte count
    bsf     STATUS,RP0      ; Bank 3
    movwf   BD0IBC
    movlw   (0x01<<DATA01)  ; toggle data0/1 bit
    xorwf   BD0IST,w
    andlw   (0x01<<DATA01)  ; clear PID bits
    iorlw   0x88            ; set OWN and DTS bits
    movwf   BD0IST          ; write the whole mess back
    pagesel copy_descriptor_to_EP0
    return
; *********************************************************************
; SetConfiguration
; 
; This function is called when the host issues a Set Configuration 
; command.  The housekeeping within USB is handled within the CH9 commands
; This function should be filled in to give meaning to the command within
; the application.
;
; SetConfiguration is called from within the ISR so this function should
; be kept as short as possible.
; *********************************************************************
SetConfiguration
    global  SetConfiguration
    return

; *********************************************************************
; Vendor Specific calls
; control is transferred here when bmRequestType bits 5 & 6 = 10 indicating
; the request is a vendor specific request.  This function then would 
; interpret the bRequest field to determine what action is required.
; The end of each vendor specific command should be terminated with a 
; return.  
; *********************************************************************
CheckVendor    
    global  CheckVendor
    return  ; *** remove this line and uncomment out the remainder    

    end




?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
3atv在线一区二区三区| 国产三级精品三级在线专区| 国产一区二区久久| 性久久久久久久| 亚洲色图.com| 怡红院av一区二区三区| 国产精品大尺度| 中文字幕一区二区三区乱码在线 | 精品欧美一区二区三区精品久久| 欧美日韩视频在线一区二区 | 4438x成人网最大色成网站| 色综合久久天天综合网| 91论坛在线播放| 不卡在线观看av| 波多野结衣中文字幕一区二区三区| 韩国精品主播一区二区在线观看| 日本伊人午夜精品| 久久精品噜噜噜成人av农村| 日日夜夜免费精品| 日韩在线a电影| 肉色丝袜一区二区| 日韩精品一二三四| 久久成人久久爱| 麻豆91精品视频| 视频一区视频二区中文| 视频一区二区不卡| 日本不卡视频一二三区| 国产又粗又猛又爽又黄91精品| 久久se精品一区精品二区| 蜜桃av噜噜一区| 久草热8精品视频在线观看| 日本欧美一区二区| 国产成人夜色高潮福利影视| 国产成人av影院| 国产精品自拍三区| 色综合网色综合| 欧美三级日韩在线| 欧美成人精品1314www| 欧美sm极限捆绑bd| 欧美日韩免费高清一区色橹橹 | 久久久综合激的五月天| 国产蜜臀97一区二区三区 | 国产主播一区二区| 丁香婷婷综合激情五月色| 在线观看免费一区| 欧美精品视频www在线观看| 欧美精品在线视频| 精品卡一卡二卡三卡四在线| 国产欧美一区二区三区鸳鸯浴| 亚洲人一二三区| 日日夜夜精品视频免费| 国产高清精品网站| 91久久奴性调教| 欧美一区二区三区不卡| 国产精品卡一卡二| 亚洲一二三区在线观看| 午夜精品福利一区二区蜜股av| 蜜桃91丨九色丨蝌蚪91桃色| 91在线丨porny丨国产| 欧美日韩视频一区二区| 中文成人综合网| 亚洲成a人片在线不卡一二三区 | 色中色一区二区| 欧美日产在线观看| 欧美大肚乱孕交hd孕妇| 亚洲美女少妇撒尿| 极品销魂美女一区二区三区| 91国在线观看| 精品国产91洋老外米糕| 国产精品久久久久久久久晋中| 视频一区欧美日韩| 成人动漫av在线| 精品久久久久久无| 亚洲欧美日韩一区| 天堂资源在线中文精品| 99久久免费视频.com| 欧美高清精品3d| 国产精品久久免费看| 蜜臀久久99精品久久久画质超高清| 国产91精品一区二区麻豆亚洲| 精品久久久久久久久久久院品网| 亚洲精品国产一区二区精华液| 亚洲va欧美va人人爽午夜| 国产精品亚洲一区二区三区妖精| 色婷婷一区二区| 国产色产综合色产在线视频| 亚洲成人自拍偷拍| 欧美亚洲精品一区| 欧美婷婷六月丁香综合色| 欧美精品一区二区三区一线天视频 | 国产精品免费免费| 亚洲国产精品久久久久秋霞影院| 国产一区不卡精品| 精品国产人成亚洲区| 国产精品色噜噜| 懂色av中文字幕一区二区三区| 欧美一卡二卡在线| 日韩精品一区在线| 精品入口麻豆88视频| 亚洲精品成人少妇| 成人免费福利片| 日韩欧美中文字幕精品| 亚洲国产综合人成综合网站| 精品一区二区三区蜜桃| 欧美伦理视频网站| 亚洲午夜私人影院| 色婷婷精品久久二区二区蜜臀av| 欧美大白屁股肥臀xxxxxx| 亚洲国产wwwccc36天堂| 色综合久久综合中文综合网| 中文字幕精品一区二区精品绿巨人| 日韩国产精品久久久| 欧洲激情一区二区| 国产欧美一区二区在线| 国产在线播精品第三| 欧洲亚洲精品在线| 一区2区3区在线看| 国产成人免费视频精品含羞草妖精| 欧美v日韩v国产v| 日韩va亚洲va欧美va久久| 欧美优质美女网站| 丝袜亚洲另类欧美| 91精品一区二区三区久久久久久 | 亚洲国产精华液网站w | 成人黄页在线观看| 国产日本欧洲亚洲| 91同城在线观看| 亚洲精品视频在线观看免费| 色88888久久久久久影院野外| 亚洲欧美在线视频| 97se亚洲国产综合自在线不卡 | 亚洲精品一线二线三线| 精品一区二区日韩| 国产亚洲欧美中文| 国产99一区视频免费| 精品影院一区二区久久久| 欧美xxxxx牲另类人与| 这里是久久伊人| 色欧美88888久久久久久影院| 日韩va亚洲va欧美va久久| 久久男人中文字幕资源站| 欧美日韩一区不卡| 成人国产视频在线观看 | 久久激情综合网| 国产女同互慰高潮91漫画| 欧美精品 国产精品| 欧美性大战久久久久久久蜜臀| 欧美一级爆毛片| 国产91在线观看| 一区二区三区四区国产精品| 欧美亚洲免费在线一区| 美美哒免费高清在线观看视频一区二区 | 国产一区二区h| 欧美喷潮久久久xxxxx| 韩日av一区二区| 久久久精品天堂| caoporen国产精品视频| 中文字幕在线不卡一区二区三区| 欧洲激情一区二区| 亚洲国产欧美在线人成| 精品国产污污免费网站入口| 成人av免费在线观看| 日韩精品亚洲一区二区三区免费| 88在线观看91蜜桃国自产| 国产精品99久久久久久似苏梦涵 | 麻豆精品一区二区| 麻豆中文一区二区| 欧美日韩国产天堂| 国产传媒一区在线| 日韩美女精品在线| 在线观看视频一区二区| 国产一区二区导航在线播放| 亚洲人精品一区| 日本一区二区免费在线观看视频| 在线免费观看日韩欧美| 国产精品一区二区黑丝| 一个色综合网站| 久久先锋影音av鲁色资源| 在线亚洲免费视频| 国产精品正在播放| 亚洲精选一二三| 久久综合成人精品亚洲另类欧美 | 97精品国产97久久久久久久久久久久| 成人动漫精品一区二区| 天堂成人国产精品一区| 自拍偷在线精品自拍偷无码专区| 精品在线播放午夜| 91香蕉视频黄| 欧美国产一区视频在线观看| 国产精品18久久久久久久久久久久| 国产精品中文欧美| 欧美午夜精品一区二区三区 | 国产精品国产三级国产a| 中文字幕一区二区三区在线不卡| 亚洲已满18点击进入久久| 亚洲欧美另类小说视频| 日本视频一区二区| 6080国产精品一区二区| 夜夜精品浪潮av一区二区三区| 91免费版pro下载短视频|