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

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

?? usbhidio.asm

?? USB 編程必備.詳細說明USB原理及控制方法.
?? ASM
?? 第 1 頁 / 共 4 頁
字號:
;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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久久久久美女| 成人综合婷婷国产精品久久蜜臀| 色欧美片视频在线观看 | 成人一二三区视频| 国产欧美综合色| 国产91精品一区二区麻豆亚洲| 欧美成人vps| 成人18视频日本| 国产精品的网站| 在线免费观看不卡av| 日韩在线播放一区二区| 精品国产一区二区三区忘忧草 | 国内成人免费视频| 久久久久久一级片| av成人免费在线观看| 一区二区欧美国产| 欧美一级片在线看| 粉嫩欧美一区二区三区高清影视| 亚洲免费观看视频| 6080国产精品一区二区| 国产传媒日韩欧美成人| 亚洲精品一二三四区| 日韩三级av在线播放| av福利精品导航| 喷水一区二区三区| 亚洲国产精品高清| 制服丝袜日韩国产| aaa亚洲精品一二三区| 婷婷亚洲久悠悠色悠在线播放| 久久免费偷拍视频| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 99久精品国产| 免费成人av在线| 亚洲免费伊人电影| 精品欧美一区二区在线观看 | 国产精品自在欧美一区| 亚洲欧美日韩一区二区| 精品成人a区在线观看| 91国偷自产一区二区使用方法| 日韩电影免费一区| 亚洲精品欧美综合四区| 久久女同性恋中文字幕| 欧美午夜精品久久久久久超碰| 精彩视频一区二区三区| 亚洲一区av在线| 亚洲欧洲av色图| 久久婷婷综合激情| 欧美日韩国产一级二级| bt欧美亚洲午夜电影天堂| 久久国产精品色| 亚洲国产另类av| 亚洲人成在线播放网站岛国| 久久综合丝袜日本网| 7777精品伊人久久久大香线蕉的 | 成人在线视频一区| 麻豆一区二区三| 亚洲精品中文在线观看| 国产三级欧美三级| 26uuu成人网一区二区三区| 91精品免费在线| 欧美日韩视频第一区| 91麻豆免费看片| proumb性欧美在线观看| 国产成a人无v码亚洲福利| 国产美女主播视频一区| 理论片日本一区| 另类综合日韩欧美亚洲| 裸体在线国模精品偷拍| 日本免费在线视频不卡一不卡二 | 国产精品少妇自拍| 久久众筹精品私拍模特| 精品久久久久久无| 日韩女优av电影| 91精品国产综合久久久蜜臀粉嫩| 欧美亚洲国产一区二区三区va| 91伊人久久大香线蕉| 成人永久免费视频| 成人免费毛片app| 丁香五精品蜜臀久久久久99网站 | 91在线无精精品入口| 成人av集中营| 99在线热播精品免费| 91麻豆国产在线观看| 色女孩综合影院| 在线视频综合导航| 欧美日韩久久不卡| 日韩网站在线看片你懂的| 日韩一区二区三| 久久青草欧美一区二区三区| 国产欧美一区二区三区网站| 国产精品三级av| 亚洲久草在线视频| 亚洲高清在线精品| 久久精品免费观看| 国产91精品露脸国语对白| 成人看片黄a免费看在线| 99久久精品国产麻豆演员表| 在线观看国产日韩| 欧美久久久影院| 欧美精品一区二区在线观看| 国产欧美1区2区3区| 亚洲欧美在线视频| 亚洲电影在线免费观看| 免费成人深夜小野草| 国产黄色成人av| 一本到不卡精品视频在线观看| 欧美在线视频不卡| 26uuu精品一区二区| 亚洲精品一二三四区| 蜜桃视频在线观看一区| 成人国产精品免费观看视频| 欧美午夜在线观看| 久久亚洲综合av| 一个色妞综合视频在线观看| 美女一区二区三区| 99re这里只有精品首页| 在线综合+亚洲+欧美中文字幕| 久久久久久久久久电影| 亚洲国产日韩精品| 国产一区二区0| 欧美色综合影院| 国产亚洲美州欧州综合国| 亚洲永久精品大片| 九一九一国产精品| 日本精品免费观看高清观看| 欧美成人欧美edvon| 亚洲精品欧美综合四区| 国产一区二三区| 欧美三级电影在线看| 中文字幕乱码亚洲精品一区| 亚洲不卡一区二区三区| 国产成人免费av在线| 欧美日韩一区精品| 综合色中文字幕| 国产精品18久久久| 日韩一级黄色片| 亚洲综合在线免费观看| 国产成人综合亚洲网站| 欧美挠脚心视频网站| 中文字幕在线一区免费| 国产美女精品一区二区三区| 91精品福利在线一区二区三区| 亚洲免费av观看| 韩国v欧美v亚洲v日本v| 91精品国产综合久久蜜臀| 一区二区三区在线看| 粉嫩aⅴ一区二区三区四区| 2023国产精华国产精品| 免费成人性网站| 日韩一区二区影院| 亚洲高清在线精品| 欧美日韩中文一区| 亚洲精品中文字幕在线观看| 91日韩一区二区三区| 中文幕一区二区三区久久蜜桃| 国产一区二区三区久久久| 日韩视频一区二区三区| 全国精品久久少妇| 91精品国产美女浴室洗澡无遮挡| 亚洲国产va精品久久久不卡综合| 欧美综合一区二区三区| 亚洲老司机在线| 91久久免费观看| 亚洲一区av在线| 欧美日韩视频在线观看一区二区三区 | 韩国精品一区二区| 日韩一级成人av| 久久精品国产久精国产| 日韩精品一区国产麻豆| 久久精品国产澳门| 欧美大片顶级少妇| 国产一区在线看| 日本一区二区三区电影| 国产99久久久国产精品潘金| 亚洲国产高清不卡| 91麻豆视频网站| 亚洲国产va精品久久久不卡综合| 欧美日韩国产精选| 天天色 色综合| 精品黑人一区二区三区久久| 国产精品中文字幕日韩精品| 国产欧美日韩中文久久| 97久久超碰国产精品| 亚洲黄色性网站| 91精品国产欧美一区二区成人| 精品一区二区在线视频| 中文子幕无线码一区tr| 色欧美片视频在线观看| 日韩成人免费在线| 国产日本欧美一区二区| 91久久线看在观草草青青| 天堂va蜜桃一区二区三区 | 亚洲丝袜制服诱惑| 91福利资源站| 青椒成人免费视频| 久久蜜桃香蕉精品一区二区三区| 成人av综合一区| 日本成人在线网站| 国产亚洲女人久久久久毛片| 欧美在线小视频|