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

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

?? usbhidio.asm

?? VB和USB通訊示例
?? ASM
?? 第 1 頁 / 共 4 頁
字號(hào):
;Filename: usbhidio.asm
;Version: 1.3
;Date: 11/5/99
;Copyright 1999 by Jan Axelson (jan@lvr.com)
;
;Chip: Cypress Semiconductor CY7C63001 USB Microcontroller
;Assembler: cyasm.exe
;Purpose: demonstrates USB communications with an HID-class device
;Description:
;Handles all required standard USB and HID-class requests.
;Receives data from the host in output reports
;using interrupt transfers on Endpoint 1.
;Sends data to the host in input reports
;using control transfers on Endpoint 0.
;(The chip doesn't support OUT transfers on Endpoint 1.)
;I used Cypress Semiconductor's js50.asm joystick example code as a base 
;in creating this program.
;The companion host software is the Visual-Basic project usbhidio.vbp.
;For more information, visit Lakeview Research at http://www.lvr.com .
;Send comments, bug reports, etc. to jan@lvr.com .

;Changes:

;V1.3: 11/20/99
;The length of the string descriptors is now correct.
;(Thanks, John Hyde)
;Changed the control_read routine to prevent error when sending a 
;multiple of 8 bytes.
;(Thanks, Dave Wright)

;V1.2:
;added watchdog resets in wait loops,
;took out the watchdog reset in the 1-msec. timer ISR.

;V1.1:
;Clears the watchdog only in the main routine
;(so the watchdog will detect if the main routine crashes).
;Additions to the comments.

;V1.0:
;Clears the Watchdog timer on 1-msec. interrupt.
;(Not needed on the development board, but needed for stand-alone.)
;The Endpoint 1 ISR now sets bit 7 of Endpoint 1 TX config to 1.
;(The bit is cleared on EP1 interrupt.)

;======================================================================
;assembler directives (equates)
;======================================================================

;----------------------------------------------------------------------
;I/O registers
;----------------------------------------------------------------------

;I/O ports
Port0_Data:            equ     00h      ; GPIO data port 0
Port1_Data:            equ     01h      ; GPIO data port 1
Port0_Interrupt:       equ     04h      ; Interrupt enable for port 0
Port1_Interrupt:       equ     05h      ; Interrupt enable for port 1
Port0_Pullup:          equ     08h      ; Pullup resistor control for port 0
Port1_Pullup:          equ     09h      ; Pullup resistor control for port 1

;USB ports
USB_EP0_TX_Config:      equ     10h     ; USB EP0 transmit configuration
USB_EP1_TX_Config:      equ     11h     ; USB EP1 transmit configuration
USB_Device_Address:     equ     12h     ; USB device address assigned by host
USB_Status_Control:     equ     13h     ; USB status and control register
USB_EP0_RX_Status:      equ     14h     ; USB EP0 receive status

;Control ports
Global_Interrupt:       equ     20h     ; Global interrupt enable
Watchdog:               equ     21h     ; clear watchdog Timer
Timer:                  equ     23h     ; free-running Timer

;GPIO Isink registers
Port0_Isink:            equ     30h
Port0_Isink0:           equ     30h
Port0_Isink1:           equ     31h
Port0_Isink2:           equ     32h
Port0_Isink3:           equ     33h
Port0_Isink4:           equ     34h
Port0_Isink5:           equ     35h
Port0_Isink6:           equ     36h
Port0_Isink7:           equ     37h
Port1_Isink:            equ     38h
Port1_Isink0:           equ     38h
Port1_Isink1:           equ     39h
Port1_Isink2:           equ     3Ah
Port1_Isink3:           equ     3Bh

;Control port
Status_Control:         equ     FFh

;----------------------------------------------------------------------
;Register bit values
;----------------------------------------------------------------------

;CPU Status and Control (Status_Control)
RunBit:                 equ     1h     ; CPU Run bit
USBReset:               equ    20h     ; USB Bus Reset bit
WatchDogReset:          equ    40h     ; Watchdog Reset bit

; USB EP1 transmit configuration (USB_EP1_TX_Config)
DataToggle:               equ     40h     ; Data 0/1 bit

DISABLE_REMOTE_WAKEUP:  equ   0         ; bit[1] = 0
ENABLE_REMOTE_WAKEUP:   equ   2         ; bit[1] = 1

;----------------------------------------------------------------------
;Interrupt masks
;----------------------------------------------------------------------

;The timer-only mask enables the 1-millisecond timer interrupt.
TIMER_ONLY:               equ      4h

;The enumerate mask enables the following interrupts:
;1-millisecond timer, USB Endpoint 0
ENUMERATE_MASK:          equ     0Ch

;The runtime mask enables the following interrupts:
;1-millisecond timer, USB Endpoint 0, USB Endpoint 1, GPIO
RUNTIME_MASK:          equ     5Ch

;----------------------------------------------------------------------
; USB Constants
; from the USB Spec v1.1
;----------------------------------------------------------------------

;standard request codes
get_status:             equ   0
clear_feature:          equ   1
set_feature:            equ   3
set_address:            equ   5
get_descriptor:         equ   6
set_descriptor:         equ   7
get_configuration:      equ   8
set_configuration:      equ   9
get_interface:          equ  10
set_interface:          equ  11
synch_frame:            equ  12

; standard descriptor types
device:              equ  1
configuration:       equ  2
string:              equ  3
interface:           equ  4
endpoint:            equ  5

; standard feature selectors
endpoint_stalled:       equ  0              ; recipient endpoint
device_remote_wakeup:   equ  1              ; recipient device

;----------------------------------------------------------------------
;HID-class descriptors
;from HID Class Definition v1.1 Draft
;----------------------------------------------------------------------

;Class-specific descriptor types from section 7.1 Standard Requests
HID:                    equ  21h
report:                 equ  22h
physical:               equ  23h
  
;Class-specific request codes from section 7.2 Class Specific Requests
get_report:             equ   1
get_idle:               equ   2
get_protocol:           equ   3
set_report:             equ   9
set_idle:               equ  10
set_protocol:           equ  11

;----------------------------------------------------------------------
;USB buffer bytes
;----------------------------------------------------------------------

;Control Endpoint 0 buffer
Endpoint_0:             equ  70h        ; control endpoint
Endpoint0_Byte0:        equ  70h        ; Endpoint 0, byte 0
Endpoint0_Byte1:        equ  71h        ; Endpoint 0 byte 1
Endpoint0_Byte2:        equ  72h        ; Endpoint 0 byte 2
Endpoint0_Byte3:        equ  73h        ; Endpoint 0 byte 3
Endpoint0_Byte4:        equ  74h        ; Endpoint 0 byte 4
Endpoint0_Byte5:        equ  75h        ; Endpoint 0 byte 5
Endpoint0_Byte6:        equ  76h        ; Endpoint 0 byte 6
Endpoint0_Byte7:        equ  77h        ; Endpoint 0 byte 7


;Endpoint 0 SETUP packet bytes
bmRequestType:          equ  70h
bRequest:               equ  71h
wValue:                 equ  72h        ; default wValue (8 bits)
wValueHi:               equ  73h
wIndex:                 equ  74h        ; default wIndex (8 bits)
wIndexHi:               equ  75h
wLength:                equ  76h        ; default wLength (8 bits)
wLengthHi:              equ  77h

;Endpoint 1 buffer
endpoint_1:             equ  78h
Endpoint1_Byte0:        equ  78h        ; Endpoint 1, byte 0
Endpoint1_Byte1:        equ  79h        ; Endpoint 1 byte 1
Endpoint1_Byte2:        equ  7Ah        ; Endpoint 1 byte 2
Endpoint1_Byte3:        equ  7Bh        ; Endpoint 1 byte 3
Endpoint1_Byte4:        equ  7Ch        ; Endpoint 1 byte 4
Endpoint1_Byte5:        equ  7Dh        ; Endpoint 1 byte 5
Endpoint1_Byte6:        equ  7Eh        ; Endpoint 1 byte 6
Endpoint1_Byte7:        equ  7Fh        ; Endpoint 1 byte 7

;----------------------------------------------------------------------
; Variables stored in data memory
;----------------------------------------------------------------------
;USB status
remote_wakeup_status:   equ  30h          ;0=disabled, 2-enabled
configuration_status:   equ  31h          ;0=unconfigured, 1=configured
;idle_status:           equ  33h          ;support SetIdle and GetIdle
protocol_status:        equ  34h          ;0=boot protocol, 1=report protocol

;Other variables:
suspend_counter:        equ  35h          ;number of idle bus milliseconds 
loop_temp:              equ  37h          ;temporary loop variable
start_send:             equ  32h          ;0=false, 1=true

;Received data:
Data_Byte0:               equ  38h
Data_Byte1:               equ  39h
Data_Byte2:               equ  3Ah
Data_Byte3:               equ  3Bh
Data_Byte4:               equ  3Ch
Data_Byte5:               equ  3Dh
Data_Byte6:               equ  3Eh
Data_Byte7:               equ  3Fh

temp:                   equ  25h
start_time:             equ  21h
testbit:                equ  22h
interrupt_mask:         equ  20h
endp0_data_toggle:      equ  23h
loop_counter:           equ  24h
data_start:             equ  27h
data_count:             equ  28h
endpoint_stall:         equ  29h

;======================================================================
;interrupt vectors
;======================================================================

org  00h                ; Reset vector; begin here after a reset.
jmp  Reset

org  02h                ; 128-microsecond interrupt
jmp  DoNothing_ISR

org  04h                ; 1024-millisecond interrupt 
jmp  One_mSec_ISR

org  06h                ; Endpoint 0 interrupt 
jmp  USB_EP0_ISR

org  08h                ; Endpoint 1 interrupt 
jmp  USB_EP1_ISR

org  0Ah                ; reserved interrupt 
jmp  Reset

org  0Ch                ; general purpose I/O interrupt 
jmp  GPIO_ISR           ; not used

org  0Eh                ; Wakeup_ISR or resume interrupt 
jmp  DoNothing_ISR      ; not used

ORG  10h

;======================================================================
;Interrupt routines
;======================================================================

;----------------------------------------------------------------------
; 128-microsecond interrupt, Cext
; Unused. If this interrupt occurs, just push the accumulator (because
; ipret pops it) and re-enable the interrupts.
;----------------------------------------------------------------------

DoNothing_ISR:
     push A
     ;Enable interrupts and return
     mov A,[interrupt_mask]
     ipret Global_Interrupt

;----------------------------------------------------------------------
; 1-millisecond interrupt
; Check to see if the chip is in suspend mode and take appropriate action.
; Copy values to Endpoint 1's buffer for sending.
;----------------------------------------------------------------------

One_mSec_ISR:
     push A
iowr Watchdog
;Find out if enumeration is complete.
;If enumerating is in progress, loop_temp = 0.
     mov A, [loop_temp]
     cmp A, 0h
;If enumeration is still in progress, jump.
     jz not_main
;Enumeration has ended, so decrement the loop counter
;(so it no longer = 0).
     dec [loop_temp]

not_main:                         
;Check for bus activity.
     iord USB_Status_Control
     and A, 01h
     cmp A,0h
;If no bus activity, increment the suspend counter.
     jz Inc_counter
;If bus activity detected, clear the bus-activity bit,
     iord USB_Status_Control
     and A, 0FEh
     iowr USB_Status_Control
;and clear the suspend counter.
     mov A, 0h
     mov [suspend_counter], A
     jmp Suspend_end

Inc_counter:
;Keep track of the amount of time with no bus activity.
     inc [suspend_counter]
;Get the number of milliseconds the bus has been idle.
     mov A, [suspend_counter]
;Has it been 3 milliseconds?
     cmp A, 03h
;If no, there's nothing else to do.
     jnz Suspend_end
;If yes, put the chip in Suspend mode.
;Clear the Suspend counter.
     mov A, 0h
     mov [suspend_counter], A
;Enable pullups on Port 1; disable the output DAC.
     mov A, 0h
     iowr Port1_Pullup
     mov A, 0ffh
     iowr Port1_Data
;Set the Suspend bit. 
     iord Status_Control
     or A, 08h
     iowr Status_Control
;The chip is now in Suspend mode. 
;On exiting Suspend mode, the chip will begin 
;executing instructions here:
     nop     
;Disable pullups on Port 1. Enable the output DAC.
     mov A, 0ffh
     iowr Port1_Pullup
     mov A, 0h
     iowr Port1_Data

Suspend_end:
;Is endpoint 1 enabled?
     iord USB_EP1_TX_Config
     cmp A,0
;If no, do nothing.
     jz Select
;If yes, is start_send = 1?
;(Start_send adds a short delay after enumeration.)
     mov A, [start_send]
     cmp A, 01h
;If no, do nothing
     jnz Select
;If yes, send data:
     jmp send_value

send_value:
;Copies values from RAM into Endpoint 1's buffer
;and enables sending the bytes on the next poll.

;disable Endpoint 1 interrupts
     mov A,[interrupt_mask]
     and A, EFh
     mov [interrupt_mask],A
     iowr Global_Interrupt

;Copy values from RAM to Endpoint 1's buffer for transmitting to the host.
;Two bytes:
     mov A, [Data_Byte0]
     mov [Endpoint1_Byte0], A
     mov A, [Data_Byte1]
     mov [Endpoint1_Byte1], A
;Add more bytes if the report format specifies it:
;     mov A, [Data_Byte2]

;     mov [Endpoint1_Byte2], A
;     mov A, [Data_Byte3]
;     mov [Endpoint1_Byte3], A
;     mov A, [Data_Byte4]
;     mov [Endpoint1_Byte4], A
;     mov A, [Data_Byte5]
;     mov [Endpoint1_Byte5], A
;     mov A, [Data_Byte6]
;     mov [Endpoint1_Byte6], A
;     mov A, [Data_Byte7]
;     mov [Endpoint1_Byte7], A

;Other things to try:
;Set the value at Port 0 to equal byte 0 in Endpoint 1's buffer:
;     iord Port0_Data
;     mov [Endpoint1_Byte0], A

;Or set a value here and copy to Endpoint 1's buffer, byte 1:
;     mov A, A5h
;      mov [Endpoint1_Byte1], A

;Configure Endpoint 1's transmit register 
;so that the bytes will transmit on the next poll.
     iord USB_EP1_TX_Config
;Don't change the Data 0/1 bit.
     and A,40h
;Set bits 4 and 7 to 1 enable transmitting.
;The low nibble is the number of data bytes (2).
     or A,92h
     iowr USB_EP1_TX_Config

Select:
;Enable Endpoint 1 interrupts.
     mov A,[interrupt_mask]
     or A, 10h

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品资源网站| 色婷婷av一区二区| 亚洲一区二区精品视频| 欧美α欧美αv大片| 99久久综合色| 在线一区二区视频| 风间由美一区二区av101| 精品国产区一区| 一区二区三区欧美久久| 制服.丝袜.亚洲.中文.综合| 成人免费三级在线| 另类专区欧美蜜桃臀第一页| 亚洲最快最全在线视频| 中文字幕精品一区| 久久久久久久久久电影| 精品久久一区二区三区| 欧美乱妇15p| 欧美色男人天堂| 91黄色小视频| 波多野结衣一区二区三区| 国产在线看一区| 极品美女销魂一区二区三区免费| 亚洲www啪成人一区二区麻豆| 亚洲欧美日韩小说| 亚洲婷婷国产精品电影人久久| 国产精品久久久久一区二区三区| 国产欧美日韩另类视频免费观看| 久久综合久久综合久久| 久久精品综合网| 中文一区在线播放| 国产日韩精品一区二区浪潮av| 国产清纯在线一区二区www| 久久综合99re88久久爱| 国产婷婷色一区二区三区| 亚洲第四色夜色| 亚洲一区二区三区视频在线播放| 亚洲制服丝袜在线| 日韩黄色片在线观看| 蜜桃视频一区二区三区在线观看| 美腿丝袜亚洲色图| 国产在线视频一区二区| 粉嫩av一区二区三区粉嫩| 91美女片黄在线观看| 欧美三级资源在线| 精品日韩av一区二区| 国产精品传媒视频| 亚洲天堂成人网| 美腿丝袜亚洲三区| 成人午夜视频在线观看| 色爱区综合激月婷婷| 日韩一二三区不卡| 综合中文字幕亚洲| 三级在线观看一区二区| 成人免费精品视频| 91精品国产综合久久婷婷香蕉| 久久在线免费观看| 一区二区三区精密机械公司| 日韩精品一区第一页| 成人一级黄色片| 国产福利91精品| 91精品国产入口在线| 国产精品不卡在线| 久久精品国产亚洲aⅴ| 9色porny自拍视频一区二区| 91精品国产综合久久久久久漫画 | 日韩avvvv在线播放| 福利电影一区二区| 欧美一区在线视频| 亚洲欧美自拍偷拍| 九色综合国产一区二区三区| 久久亚洲影视婷婷| 伊人色综合久久天天人手人婷| 久草精品在线观看| 欧美老年两性高潮| 亚洲欧美日韩中文字幕一区二区三区 | 色综合久久久网| 国产日产欧美精品一区二区三区| 丝袜美腿高跟呻吟高潮一区| 91在线精品一区二区| 国产婷婷色一区二区三区四区 | 99精品视频一区二区三区| 日韩精品一区二区三区视频在线观看| 亚洲成人av一区| 91国产丝袜在线播放| 亚洲人精品午夜| 色综合色综合色综合| 国产精品国产三级国产普通话三级 | 激情伊人五月天久久综合| 日韩亚洲国产中文字幕欧美| 免费观看久久久4p| 日韩免费成人网| 精彩视频一区二区三区| 久久蜜臀中文字幕| 韩国精品主播一区二区在线观看| 精品精品欲导航| 国产99久久久国产精品潘金网站| 久久综合色一综合色88| 国产成人aaaa| 国产精品白丝av| 国产午夜精品久久久久久久| 成人午夜在线视频| 亚洲女同ⅹxx女同tv| 在线不卡中文字幕播放| 免费黄网站欧美| 国产人久久人人人人爽| 91麻豆免费看| 日韩电影免费在线看| 精品999在线播放| 成人h动漫精品| 亚洲高清免费观看高清完整版在线观看| 欧美偷拍一区二区| 久久av资源网| 亚洲人成7777| 日韩一区二区三区在线| 国产福利一区在线| 亚洲精品欧美在线| 日韩欧美国产电影| 99精品国产99久久久久久白柏| 日韩黄色免费网站| 中文字幕欧美激情| 日韩午夜精品视频| 91在线观看成人| 青青草原综合久久大伊人精品优势| 中文字幕久久午夜不卡| 欧美一区二区三区四区在线观看 | 亚洲成人自拍一区| 欧美激情一区二区三区全黄| 91精品一区二区三区在线观看| 日韩视频永久免费| 成人性生交大片免费看视频在线| 亚洲v精品v日韩v欧美v专区| 中文字幕不卡在线播放| 日韩精品一区国产麻豆| 欧美日韩情趣电影| 99综合影院在线| 国产美女主播视频一区| 天堂久久一区二区三区| 亚洲欧美日韩在线播放| 久久久久久久久岛国免费| 欧美一级在线免费| 91精品1区2区| 91麻豆文化传媒在线观看| 国产91精品欧美| 久久国产尿小便嘘嘘| 丝袜国产日韩另类美女| 亚洲综合成人在线视频| 亚洲色图视频网| 中文字幕精品一区二区精品绿巨人| 精品久久久久久久久久久久包黑料| 欧美制服丝袜第一页| 色综合一个色综合亚洲| 不卡的av在线| 91免费视频网址| 99久久婷婷国产精品综合| av在线综合网| 91久久久免费一区二区| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 欧美日韩国产乱码电影| 欧美午夜一区二区| 欧美肥胖老妇做爰| 欧美高清性hdvideosex| 欧美一级日韩不卡播放免费| 日韩一级免费观看| 久久影院午夜论| 欧美国产精品一区二区| 中文字幕人成不卡一区| 亚洲欧美日本在线| 亚洲电影在线播放| 丝袜美腿亚洲色图| 国产麻豆成人精品| 成人av在线观| 欧美精品久久99| 国产亚洲午夜高清国产拍精品| www久久久久| 一区二区三区四区乱视频| 丝袜美腿亚洲一区| 国产999精品久久| 色综合久久99| 精品精品国产高清a毛片牛牛| 中文一区在线播放| 五月综合激情婷婷六月色窝| 国产在线精品国自产拍免费| 91麻豆福利精品推荐| 日韩午夜在线影院| 自拍偷拍亚洲综合| 美女脱光内衣内裤视频久久影院| 不卡一卡二卡三乱码免费网站| 91国偷自产一区二区三区成为亚洲经典 | 国产婷婷色一区二区三区四区| 欧美成人一区二区三区片免费 | 蜜桃久久久久久久| 国产传媒日韩欧美成人| 在线亚洲高清视频| 久久综合资源网| 婷婷久久综合九色综合绿巨人| 国产成人8x视频一区二区| 91精品午夜视频| 亚洲中国最大av网站| 成人中文字幕合集| 精品国产乱码久久|