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

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

?? usb_ch9.asm

?? USB HID mouse device firmware source code using PIC s MCU
?? ASM
?? 第 1 頁 / 共 4 頁
字號:
;                            Software License Agreement
;
; The software supplied herewith by Microchip Technology Incorporated (the "Company")
; for its PICmicro(r) Microcontroller is intended and supplied to you, the Company's
; customer, for use solely and exclusively on Microchip PICmicro Microcontroller
; products.
;
; The software is owned by the Company and/or its supplier, and is protected under
; applicable copyright laws. All rights are reserved. Any use in violation of the
; foregoing restrictions may subject the user to criminal sanctions under applicable
; laws, as well as to civil liability for the breach of the terms and conditions of
; this license.
;
; THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, WHETHER EXPRESS,
; IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE
; COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
; CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
;
; ###############################################################################
;   filename:           USB_CH9.ASM
;
; Implements the chapter 9 enumeration commands for Microchip's
; PIC16C7x5 parts.
;
; ###############################################################################
;
;   Author(s):          Dan Butler and Reston Condit
;   Company:            Microchip Technology Inc
;
;   Revision:           1.21
;   Date:               08 August 2001
;   Assembled using     MPASM 2.61
;   Revision History:
;   23 August 2000      DZB Changed descriptor pointers to 16 bits.
;   24 August 2000      DZB Moved EP1 & 2 configuration from USBReset
;                           to Set_Configuration to implement requirement in
;                           USB V1.1 spec paragraph 5.3.1.2
;   28 August 2000      DZB Force data toggle on OUT packets in PutUSB
;   20 March 2001       DZB Reduced use of common RAM
;   20 March 2001       DZB Put and Get use their own temp variable (GPtemp) to
;                           avoid collisions with the ISR's use of temp.
;   29 March 2001       DZB Fixed saving of bank bits in GetUSB
;   02 May 2001         DZB Implemented SHOW_ENUM_STATUS to show enumeration
;                           status on the PORTB LEDs: 0- Powered, 1- Default,
;                           2- addressed, 3- configured, 4- sleep, 
;                           5- EP0 Activity, 6- EP1 Activity, 7- EP2 Activity
;   03 August 2001      RAC Made distinct GetEP and PutEP macros for endpoints 1 
;                           and 2.  These functions are GetEP1, GetEP2, PutEP1, and 
;                           PutEP2.  Instances of the these macros are created in
;                           usb_ch9.asm.
;   08 August 2001      RAC Corrected various banking and paging issues.
;   15 August           RAC Added Report_desc_index function in descript.asm.
;                           This function allows more than one report descriptor
;                           to be used. 
;
;################################################################################
;
;    include files:
;       P16C765.inc     Rev 1.00
;       usb_defs.inc    Rev 1.00
;
;################################################################################

#include <p16C765.inc>
#include "usb_defs.inc"

    errorlevel -302 ; supress "register not in bank0, check page bits" message

#define SHOW_ENUM_STATUS

unbanked    udata_shr   ; these will get assigned to unbanked RAM (0x70-0x7F)
temp        res     1   ; short term temp register used in Get Interface
GPtemp      res     1   ; temporary storage location used in Get and PutEPn

    global  BufferDescriptor
    global  BufferData
    global  temp
    global  temp2
    global  EP0_maxLength
    global  EP0_start
    global  EP0_end

bank2   udata
BufferDescriptor    res     3
BufferData          res     8
USBMaskedInterrupts res     1
USB_Curr_Config     res     1
USB_status_device   res     1   ; status of device
USB_dev_req         res     1
USB_address_pending res     1
USBMaskedErrors     res     1
PIDs                res     1
EP0_start           res     2   ; pointer to first byte of data to send
EP0_end             res     1   ; pointer to last byte of data to send
EP0_maxLength       res     1
temp2               res     1
bufindex            res     1
USB_Interface       res     3   ; allow 3 interfaces to have alternate endpoints
inner               res     1
outer               res     1
dest_ptr            res     1   ; used in buffer copies for Get and
source_ptr          res     1   ; Put USB calls
hid_dest_ptr        res     1   ; used in buffer copies for HIDSetReport
hid_source_ptr      res     1   ;
counter             res     1
bytecounter         res     1   ; saved copy that will be returned in W
RP_save             res     1   ; save bank bits while copying buffers
IS_IDLE             res     1
USB_USTAT           res     1   ; copy of the USTAT register before clearing TOK_DNE

    global  USB_Curr_Config    
    global  USB_status_device
    global  USB_dev_req
    global  USB_Interface

#ifdef      COUNTERRORS
USB_PID_ERR         res     2   ; 16 bit counters for each error condition
USB_CRC5_ERR        res     2
USB_CRC16_ERR       res     2
USB_DFN8_ERR        res     2
USB_BTO_ERR         res     2
USB_WRT_ERR         res     2
USB_OWN_ERR         res     2
USB_BTS_ERR         res     2
#endif

    extern  Config_desc_index
    extern  Descriptions
    extern  string_index
    extern  String0
    extern  String0_end
    extern  ClassSpecificRequest
    extern  Check_Class_Specific_IN
    extern  Get_Report_Descriptor
    extern  Get_HID_Descriptor
    extern  DeviceDescriptor
    extern  StringDescriptions

; **********************************************************************
; This section contains the functions to interface with the main 
; application.
; **********************************************************************

interface	code

; **********************************************************************
; GETEP1 and GETEP2
;
; Note:  These functions are, in reality, macros defined in usb_defs.inc.
;        To save ROM, delete the instances below that you will not need.
;
; Enter with buffer pointer in IRP+FSR.  
; Checks the semaphore for the OUT endpoint, and copies the buffer 
; if available.  Restores the bank bits as we found them.
;
; Returns the bytecount in the W register and return status in the carry
; bit as follows:
; 0 - no buffer available,
; 1 - Buffer copied and buffer made available for next transfer.
; 
; The number of bytes moved is returned in W reg.
; **********************************************************************

	GETEP1		; create instance of GETEP1
	GETEP2		; create instance of GETEP2

; **********************************************************************
; PUTEP1 and PUTEP2
;
; Note:  These functions are, in reality, macros defined in usb_defs.inc.
;        To save ROM, delete the instances below that you will not need.
;
; Enter with bytecount in W and buffer pointer in IRP+FSR.
; the bytecount is encoded in the lower nybble of W.
;
; Tests the owns bit for the IN side of the specified Endpoint.
; If we own the buffer, the buffer pointed to by the FSR is copied
; to the EPn In buffer, then the owns bit is set so the data will be
; TX'd next time polled.  
;
; Returns the status in the carry bit as follows:
; 1 - buffer available and copied.
; 0 - buffer not available (try again later)
; **********************************************************************
	PUTEP1      ; create instance of PUTEP1
	PUTEP2      ; create instance of PUTEP2

; *********************************************************************
; Stall Endpoint.
; Sets the stall bit in the Endpoint Control Register.  For the control
; Endpoint, this implements a Protocol stall and is used when the request
; is invalid for the current device state.  For non-control Endpoints,
; this is a Functional Stall, meaning that the device needs outside 
; intervention and trying again later won't help until it's been serviced.
; enter with endpoint # to stall in Wreg.
; *********************************************************************
StallUSBEP
    bsf     STATUS,IRP      ; select banks 2/3
    andlw   0x03            ; try to keep things under control
    addlw   low UEP0        ; add address of endpoint control reg
    movwf   FSR
    bsf     INDF,EP_STALL   ; set stall bit
    return

; *********************************************************************
; Unstall Endpoint.
; Sets the stall bit in the Endpoint Control Register.  For the control
; Endpoint, this implements a Protocol stall and is used when the request
; is invalid for the current device state.  For non-control Endpoints,
; this is a Functional Stall, meaning that the device needs outside 
; intervention and trying again later won't help until it's been serviced.
; enter with endpoint # to stall in Wreg.
; *********************************************************************
UnstallUSBEP
    bsf     STATUS,IRP      ; select banks 2/3
    andlw   0x03            ; try to keep things under control
    addlw   low UEP0        ; add address of endpoint control reg
    movwf   FSR
    bcf     INDF,EP_STALL   ; clear stall bit
    return

; *********************************************************************
; CheckSleep
; Checks the USB Sleep bit.  If the bit is set, the
; Endpoint, this implements a Protocol stall and is used when the request
; is invalid for the current device state.  For non-control Endpoints,
; this is a Functional Stall, meaning that the device needs outside 
; intervention and trying again later won't help until it's been serviced.
; enter with endpoint # to stall in Wreg.
; *********************************************************************
CheckSleep
    global  CheckSleep

    banksel IS_IDLE
    btfss   IS_IDLE,0       ; test the bus idle bit
    goto    nosleeptoday

#ifdef SHOW_ENUM_STATUS
    banksel PORTB
    bsf     PORTB,4         ; turn on LED 4 to indicate we've gone to sleep
    banksel UIR
#endif
    bsf     STATUS,RP0      ; point to bank 3
    bcf     UIR,ACTIVITY
    bsf     UIE,ACTIVITY    ; enable the USB activity interrupt
    bsf     UCTRL,SUSPND    ; put USB regulator and transciever in low power state
    sleep                   ; and go to sleep
    nop
    bcf     UCTRL,SUSPND
    bcf     UIR,UIDLE
    bsf     UIE,UIDLE
    bcf     UIR,ACTIVITY
    bcf     UIE,ACTIVITY
#ifdef SHOW_ENUM_STATUS
    banksel PORTB
    bcf     PORTB,4         ; turn off LED 4 to indicate we're back.
#endif

nosleeptoday
    return

; *********************************************************************
; Remote Wakeup
; Checks USB_status_device to see if the host enabled Remote Wakeup
; If so, perform Remote wakeup and disable remote wakeup feature
; It is called by PortBChange
; *********************************************************************
RemoteWakeup
    global  RemoteWakeup

    banksel USB_status_device    
    btfss   USB_status_device, 1
    goto    RemoteEnd

    clrf    inner
    movlw   0xB0
    movwf   outer

    bsf     STATUS, RP0     ; BANK 3
    bsf     UCTRL, 2        ; RESUME SIGNALING
    bcf     STATUS, RP0     ; BANK 2

    incfsz  inner,f         ; DELAY over 10mS
    goto    $-1
    incfsz  outer,f
    goto    $-3

    bsf     STATUS,RP0
    bcf     UCTRL, 2        ; Clear Resume bit
    bcf     STATUS,RP0
    bcf     USB_status_device, 1    ; Disable Remote Wakeup
    
RemoteEnd
    return


; *********************************************************************
; USB Soft Detach
; Clears the DEV_ATT bit, electrically disconnecting the device to the bus.
; This removes the device from the bus, then reconnects so it can be
; re-enumerated by the host.  This is envisioned as a last ditch effort
; by the software.
; *********************************************************************
SoftDetachUSB
    global  SoftDetachUSB

    banksel UCTRL
    bcf     UCTRL,DEV_ATT   ; clear attach bit

    bcf     STATUS, RP0     ; bank 2
    
    clrf    outer
    clrf    inner

    incfsz  inner,f
    goto    $-1
    incfsz  outer,f
    goto    $-3

    pagesel InitUSB
    call    InitUSB         ; reinitialize the USB peripheral
    return


; ******************************************************************
; Init USB
; Initializes the USB peripheral, sets up the interrupts
; ******************************************************************
InitUSB
    global  InitUSB

    banksel USWSTAT
    clrf    USWSTAT         ; default to powered state
    movlw   0x01            ; mask all USB interrupts except reset
    movwf   UIE
    clrf    UIR             ; clear all USB Interrupt flags
    movlw   0x08            ; Device attached
    movwf   UCTRL

    bcf     STATUS, RP0     ; bank 2
    clrf    USB_Curr_Config
    movlw   1
    movwf   USB_status_device
    clrf    USB_Interface
    clrf    USB_Interface+1
    clrf    USB_Interface+2
    movlw   0xFF
    movwf   USB_dev_req     ; no device requests in process
#ifdef COUNTERRORS
    clrf    USB_PID_ERR
    clrf    USB_PID_ERR+1
    clrf    USB_CRC5_ERR
    clrf    USB_CRC5_ERR+1
    clrf    USB_CRC16_ERR
    clrf    USB_CRC16_ERR+1
    clrf    USB_DFN8_ERR
    clrf    USB_DFN8_ERR+1
    clrf    USB_BTO_ERR
    clrf    USB_BTO_ERR+1
    clrf    USB_WRT_ERR
    clrf    USB_WRT_ERR+1
    clrf    USB_OWN_ERR
    clrf    USB_OWN_ERR+1
    clrf    USB_BTS_ERR
    clrf    USB_BTS_ERR+1
#endif

    banksel PIR1            ; bank 0
    bcf     PIR1,USBIF      ; clear the USB flag
    bsf     STATUS,RP0      ; bank 1
    bsf     PIE1,USBIE      ; enable usb interrupt
    bsf     INTCON, 6       ; enable global and peripheral interrupts
    bsf     INTCON, 7
#ifdef SHOW_ENUM_STATUS
    bcf     STATUS,RP0      ; select bank 0
    bsf     PORTB,0         ; set bit zero to indicate Powered status
#endif
    return


; ******************************************************************
; DeInit USB
; Shuts down the USB peripheral, clears the interrupt enable.
; ******************************************************************
DeInitUSB
    global  DeInitUSB

    banksel UCTRL
    bcf     UCTRL,DEV_ATT   ; D+/D- go high Z
    bsf     UCTRL,SUSPND    ; Place USB module in low power mode.

    clrf    USWSTAT         ; set device state to powered.

    bcf     STATUS,RP1      ; select bank 1
    bcf     PIE1,USBIE      ; clear USB interrupt enable
#ifdef SHOW_ENUM_STATUS
    bcf     STATUS,RP0
    movlw   0x01
    movwf   PORTB           ; clear all lights except powered
    bsf     STATUS,RP0
#endif

    return


core    code
; The functions below are the core functions
; ******************************************************************
; USB interrupt triggered, Why?
; Poll the USB interrupt flags to find the cause.
; ******************************************************************
ServiceUSBInt
    global  ServiceUSBInt

    banksel UIR
    movf    UIR,w           ; get the USB interrupt register
    andwf   UIE,w           ; mask off the disabled interrupts
    bcf     STATUS, RP0     ; BANK 2
    btfsc   STATUS,Z        ; is there any unmasked interrupts?
    goto    ExitServiceUSBInt ; no, bail out.

    pagesel TokenDone
    movwf   USBMaskedInterrupts
    btfsc   USBMaskedInterrupts,TOK_DNE    ; was it a token done?
    call    TokenDone
    banksel USBMaskedInterrupts
    btfsc   USBMaskedInterrupts,USB_RST
    call    USBReset
    btfsc   USBMaskedInterrupts,STALL
    call    USBStall
    btfsc   USBMaskedInterrupts,UERR
    call    USBError
    btfsc   USBMaskedInterrupts,UIDLE
    call    USBSleep
    btfsc   USBMaskedInterrupts,ACTIVITY

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美一级二级三级| 亚洲一区二区成人在线观看| 国产精品久久久久一区| 三级久久三级久久| 丁香婷婷综合五月| 日韩一区二区在线免费观看| 中文字幕在线不卡一区二区三区| 免费观看久久久4p| 欧美视频在线观看一区二区| 久久久久久亚洲综合影院红桃 | 国产午夜亚洲精品羞羞网站| 有坂深雪av一区二区精品| 国产毛片一区二区| 91精品在线麻豆| 一区二区三区**美女毛片| 成人小视频免费观看| 在线综合+亚洲+欧美中文字幕| 亚洲天堂精品在线观看| 国产精品 欧美精品| 欧美mv日韩mv国产| 亚洲成a人v欧美综合天堂下载| 99精品偷自拍| 日韩美女精品在线| 91影院在线免费观看| 国产精品色哟哟网站| 国产99精品在线观看| 337p日本欧洲亚洲大胆色噜噜| 日日噜噜夜夜狠狠视频欧美人| 日本电影亚洲天堂一区| 国产精品久久久久aaaa| 国产精品中文字幕一区二区三区| 日韩美女在线视频| 国产乱码精品1区2区3区| 久久久久国产精品厨房| 福利一区二区在线观看| 久久精品视频一区二区三区| 老司机午夜精品| 欧美大黄免费观看| 国产精品中文欧美| 欧美极品另类videosde| eeuss鲁片一区二区三区在线观看| 国产精品欧美一区喷水| 色综合网色综合| 一卡二卡欧美日韩| 欧美高清视频一二三区 | 国产精品香蕉一区二区三区| 久久久久久综合| 成人午夜看片网址| 亚洲日本va午夜在线影院| 色天使色偷偷av一区二区| 亚洲综合偷拍欧美一区色| 欧美人妖巨大在线| 麻豆成人免费电影| 久久久亚洲精品一区二区三区| 国产精品一区二区三区四区| 中文字幕av一区二区三区免费看| 色综合色狠狠天天综合色| 肉丝袜脚交视频一区二区| 国产亚洲精品aa午夜观看| 播五月开心婷婷综合| 一区二区三区中文在线观看| 91精品国产一区二区| 国产精一品亚洲二区在线视频| 国产亚洲欧美日韩在线一区| 99久久99久久久精品齐齐| 亚洲国产综合91精品麻豆| 日韩精品中文字幕一区 | 毛片不卡一区二区| 欧美国产成人精品| 欧美性色黄大片手机版| 国产资源精品在线观看| 亚洲免费视频成人| 日韩亚洲欧美高清| 不卡高清视频专区| 亚洲国产成人精品视频| 精品粉嫩aⅴ一区二区三区四区 | 亚洲欧洲成人精品av97| 色94色欧美sute亚洲线路一久| 日本三级亚洲精品| 国产精品欧美久久久久无广告 | 大白屁股一区二区视频| 日韩精品国产欧美| 国产精品免费丝袜| 精品免费99久久| 欧美人xxxx| 99久久夜色精品国产网站| 麻豆国产91在线播放| 亚洲精品欧美二区三区中文字幕| 欧美成人video| 欧美日韩卡一卡二| 91蜜桃在线观看| 国产乱码精品一品二品| 日本不卡在线视频| 亚洲另类中文字| 国产精品国产三级国产普通话99 | 国产精品不卡在线| 久久网站热最新地址| 欧美美女直播网站| 日本精品一区二区三区四区的功能| 国内精品久久久久影院一蜜桃| 亚洲国产精品久久艾草纯爱| 亚洲欧洲日产国产综合网| www久久精品| 欧美一区二区啪啪| 欧美男男青年gay1069videost | 亚洲综合在线免费观看| 国产精品乱码人人做人人爱| 久久久99精品久久| 久久亚洲综合色一区二区三区| 日韩视频免费观看高清在线视频| 欧美系列亚洲系列| 欧美在线你懂得| 欧美亚洲自拍偷拍| 欧美亚日韩国产aⅴ精品中极品| 99re在线视频这里只有精品| 99国内精品久久| 色网综合在线观看| 欧美在线视频全部完| 久久综合久久99| 欧美mv和日韩mv的网站| 精品少妇一区二区三区视频免付费 | 青青草97国产精品免费观看无弹窗版 | 亚洲人成亚洲人成在线观看图片| 国产精品精品国产色婷婷| 国产精品欧美一级免费| 亚洲欧美综合另类在线卡通| 亚洲欧洲精品天堂一级| 亚洲精品老司机| 亚洲午夜电影网| 日韩一区精品字幕| 久久er精品视频| 国产福利精品一区二区| 不卡在线视频中文字幕| 93久久精品日日躁夜夜躁欧美| 色天天综合色天天久久| 51精品秘密在线观看| 精品国产a毛片| 日本一区二区三级电影在线观看| 国产欧美精品国产国产专区| 国产精品传媒视频| 夜夜嗨av一区二区三区网页| 日本中文一区二区三区| 国产毛片精品一区| 91视频国产资源| 欧美精选一区二区| 久久精品夜色噜噜亚洲aⅴ| 亚洲欧美另类在线| 美女免费视频一区二区| 懂色av一区二区三区免费看| 精品视频资源站| 久久久久久久免费视频了| 亚洲乱码国产乱码精品精的特点| 午夜久久久久久电影| 国产成人精品一区二区三区网站观看| 成人爱爱电影网址| 欧美一区二区不卡视频| 国产精品久久久久久久久搜平片| 国产一区二区三区免费| 在线精品视频免费播放| 久久久综合视频| 亚洲成人av一区二区三区| 国产盗摄精品一区二区三区在线 | 日韩精品专区在线影院观看| 国产精品美女久久久久久久久 | 日韩一区二区三区观看| 国产精品久久久久久久久免费樱桃 | 欧美日韩中文字幕一区| 国产欧美一区二区精品秋霞影院| 午夜精品久久一牛影视| 成人视屏免费看| 日韩欧美一区二区三区在线| 亚洲色图19p| 国产成人小视频| 日韩欧美电影在线| 天堂在线亚洲视频| 一本一本大道香蕉久在线精品| 久久嫩草精品久久久精品一| 亚洲mv在线观看| 在线观看国产日韩| 亚洲欧美一区二区三区国产精品| 国产精品99久久久久| 日韩欧美国产小视频| 亚洲高清不卡在线观看| 91麻豆蜜桃一区二区三区| 国产精品区一区二区三区| 裸体在线国模精品偷拍| 制服.丝袜.亚洲.另类.中文| 亚洲成在人线免费| 91成人网在线| 亚洲精品网站在线观看| av影院午夜一区| 国产精品福利在线播放| 国产激情视频一区二区在线观看| 日韩欧美视频在线| 麻豆成人av在线| 717成人午夜免费福利电影| 亚洲高清在线精品| 欧美日韩国产精品自在自线| 亚洲福利电影网| 欧美日韩一区二区三区视频|