?? hx_all.asm
字號:
;**************************************************************************
;** **
;** I N T E L P R O P R I E T A R Y **
;** **
;** COPYRIGHT (c) 1996, 1997 BY INTEL CORPORATION. ALL RIGHTS **
;** RESERVED. **
;**$Modtime: 19 Dec 1996 14:41:24 $
;**$Revision: 1.0 $
;***************************************************************************
; Remarks about this code:
;*************************
; The code is in an absolute format starting at location 00:4000 hex
; This location should be used if this code is to be downloded through
; a serial RS232 port to the 8x930AX\Hx board with RISM programmed in
; the EPROM. The main code starts at label "main" located at 004080.
; There is no need to include the configuration bytes in this code
; because RISM already takes care of that.
;
; If users want to adapt this code to their own board or if they want
; to change the EPROM provided with the board with their own EPROM,
; then they need to relocate the code. They need to change the
; starting location to 0FF:0000 hex and the label main to 0FF:0080.
; They will also need to program the Chip Cconfiguration Bytes.
;
; This code should run on all assebmlers provided by third party
; vendors. Minimum changes may be required. Users may need to change
; the include files, and use the ones provided by the Third party
; vendor they are using.
;$INCLUDE (8x930HX.INC) ; you may need to change this file and use
; the one provided by the tool vendor you
; are using.
;$INCLUDE (ONE_OH.INC) ; This file is provided by Intel
INCLUDE 8x930HX.INC ; Select the other format if assembling for
INCLUDE ONE_OH.INC ; Intel Compatibility
; Embedded Function definitions
FIFO_SIZE equ 008h
GET_COMMAND equ 080h
EP1_TX_FIFO_SIZE equ 40h
EP1_RX_FIFO_SIZE equ 40h
EP2_TX_FIFO_SIZE equ 08h
EP3_TX_FIFO_SIZE equ 08h
EP1_TX_LOOP_BACK_FIFO_SIZE equ 40h
EP1_RX_LOOP_BACK_FIFO_SIZE equ 40h
EP2_TX_LOOP_BACK_FIFO_SIZE equ 08h
EP2_RX_LOOP_BACK_FIFO_SIZE equ 08h
EP3_TX_LOOP_BACK_FIFO_SIZE equ 08h
EP3_RX_LOOP_BACK_FIFO_SIZE equ 08h
SETUP_PHASE equ 000h
DATA_PHASE equ 001h
STATUS_PHASE equ 002h
EP0_MAX_PACKET_SIZE equ 08h
NULL_DATA_PACKET equ 000h
; Hub definitinos
C_HUB_LOCAL_POWER EQU 0
C_HUB_OVER_CURRENT EQU 1
PORT_CONNECTION EQU 0
PORT_ENABLE EQU 1
PORT_SUSPEND EQU 2
PORT_OVER_CURRENT EQU 3
PORT_RESET EQU 4
PORT_POWER EQU 8
PORT_LOW_SPEED EQU 9
C_PORT_CONNECTION EQU 16
C_PORT_ENABLE EQU 17
C_PORT_SUSPEND EQU 18
C_PORT_OVER_CURRENT EQU 19
C_PORT_RESET EQU 20
DISABLE_PORT_CMD EQU 00h
ENABLE_PORT_CMD EQU 01h
RESET_ENABLE_PORT_CMD EQU 02h
SUSPEND_PORT_CMD EQU 03h
RESUME_PORT_CMD EQU 04h
CLEAR_PCSC_MASK EQU 0FEh
CLEAR_PESC_MASK EQU 0FDh
CLEAR_PSSC_MASK EQU 0FBh
CLEAR_RSTSC_MASK EQU 0EFH
CLEAR_OVISC_MASK EQU 0F7h
EMBEDDED_PORT_NUMBER EQU 4h
;extern InitilizeEmbeddedFunction:CODE
;extern FifoWatchDog:CODE
;extern FUNCTION_ISR:CODE
;extern EmbeddedFunctionSofRoutine:CODE
;extern FUNCTION_SUSPEND_ROUTINE:CODE, FUNCTION_RESUME_ROUTINE:CODE
;extern STACK_DATA:PDATA
;public FwValue, RWUTimer
public END_VECTORS,RESET_VECTOR
;***************
; Program origin
;****************
ORG 00:4000h ; Change to ORG 0FF:0000h for your
; own EPROM/design
RESET_VECTOR: LJMP main
INT0_VECTOR: LJMP $
ds 5
TIM0_VECTOR: LJMP $
ds 5
INT1_VECTOR: LJMP $
ds 5
TIM1_VECTOR: LJMP $
ds 5
SER_VECTOR: LJMP $
ds 5
TIM2_VECTOR: LJMP $
ds 5
PCA_VECTOR: LJMP $
ds 13
SOF_VECTOR: LJMP SOF_ISR1
ds 5
USB_FUNC_VECTOR: LJMP FUNCTION_ISR
ds 5
SUS_RSM_VECTOR: LJMP SUSPEND_RESUME_ISR
ds 25h
TRAP_VECTOR: LJMP $
END_VECTORS:
;SEGMENT HUB_EP0_CODE_SEGMENT
;MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
;M---------------------------------------------------------------------M
;M MAIN M
;M---------------------------------------------------------------------M
;MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
ORG 00:4080H ; Change to 0FF:0080 for your own
; EPROM/design
main:
mov SP, #LOW (STACK_DATA)
mov SPH, #HIGH(STACK_DATA) ; Set the stack to start @ 00:0500h
; mov SP, #00h
; mov SPH, #02h ; Set the stack to start @ 00:0500h
mov DPXL, #0ffh ; Set DPXL to point at the FLASH device
; to access constants
inc FTLOCK_FLG1
lCall INIT_VARIABLES ; Initialize the RAM space as required
lCall INIT_USB
Lcall InitilizeHubVariables
;----------------------------------------
;--- Enable Function Interrupts
;----------------------------------------
;----------------------------------------
;--- Enable HUB Interrupts
;----------------------------------------
mov EPINDEX, #80h ; Select Hub EP1
mov EPCON, #03Fh ; CNTL, ENable all
mov HIE, #03h ; Enable the USB FunctionHUB EP0
orl IEN1, #07h ; Enable HUB/SOF ISR
mov EPINDEX, #00h
; Resume is set here
mov RWUTimer1, #00h ; CLear RWU Timer
mov EmbeddedFunctionInReset, #00h ; Used to track when we are sending a reset to the Embdeeded function.
; setb IEN1.2 ; ENable Suspend/Resume ISR
setb EA ; Enable Interrupts.
;------------------------------------------------------------------
SETB LC
; CLR LC ; Increase the clock speed so we can go with this.
; (KLS) SET LC will reduce current draw
; by dropping the clk frequency by 75%
; Default mode..
ljmp ActiveLoop ; Jump over the ISR stubs to the main loop.
;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
;A---------------------------------------------------------------------A
;A ACTIVE LOOP A
;A---------------------------------------------------------------------A
;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
;COMMENT *------------------------------------------------------------
;ISR Registers
;IF the user makes this into an ISR, they will need to save certain registers
;upon entry into this code. The firmware has been writen such that the
;only registers which are modified in this code are A, R0, R1 & EPINDEX.
;While DPX is used within the code, it is saved locally only when needed.
;This will allow the ISR to run slightly faster.
;--------------------------------------------------------------------*
;
;COMMENT *------------------------------------------------------------
;Function name : ActiveLoop
;Brief Description : This routine simply sets and clears P1.3 at a periodic rate
; : It purpose is to let the user know the part is alive.
;
;Regs preserved : No reg. is saved
;--------------------------------------------------------------------*
;SCOPE
ActiveLoop:
;------------------------------------------------------------------
;-- Check to see if a Suspend/Resume Event is pending.
;------------------------------------------------------------------
; mov A, SuspendResumeFlag1
; jz HeartBeat
; lcall SuspendCode
;------------------------------------------------------------------
;-- Heart Beat
;------------------------------------------------------------------
HeartBeat:
; Debug code to toggle Port 3.3 when a disable event is detected
mov HPINDEX, #1
mov A, HPSC
anl A, #017h
jz NO_SC
cpl P3.4
cpl P3.4
cpl P3.4
cpl P3.4
cpl P3.4
cpl P3.4
NO_SC:
mov WR0, Heart1_1
inc WR0, #1
mov Heart1_1, WR0
cmp WR0, #7FFFh
jl ClearBit
setb P1.3
sjmp ActiveLoop
ClearBit:
clr P1.3
sjmp ActiveLoop
;----------------------------------------------------------------
;SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
;SS SUSPEND/RESUME ISR
;SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
;----------------------------------------------------------------
;COMMENT *------------------------------------------------------------
;Function name : SUSPEND_RESUME_ISR
;BrieS Description : Service the SUSPEND_RESUME Interrupt
; :
;Regs preserved : Reg. A, B & EPINDEX are saved
;--------------------------------------------------------------------*
;SCOPE
SUSPEND_RESUME_ISR:
push PSW
push PSW1
lcall FUNCTION_SUSPEND_ROUTINE
push ACC
push DR0
mov P1, #33h
mov R11, RWUTimer1 ; If timmer is zero, do a normal suspend.
orl R11, RWUTimer1+1
JZ DoSuspend ; Otherwise wait a delay and then resume.
DoRWU:
push WR2
mov WR2, RWUTimer1
mov WR0, #0
WaitLoop:
dec DR0, #1h
cpl P1.1
jne WaitLoop
setb RWU
D1:
jb RWU, D1 ; Wait until RWU is done.
pop WR2
sjmp RESUME_CODE
DoSuspend:
setb PD
nop
nop
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -