;;Established date:
;;********************************************************************
;;*********************Valiable Section*******************************
;;********************************************************************
DATA. SECTION 'DATA'
;;--------------------------------------------------------------------
;;PUSH & POP
M_ACCBAK DB ?
M_STABAK DB ?
M_MP0BAK DB ?
M_MP1BAK DB ?
M_TBLPBAK DB ?
;;--------------------------------------------------------------------
M_TBLPFIFO DB ? ;;save TBLP.
M_Temp1 DB ?
M_Temp2 DB ?
M_STALL DB ?
M_ReportIndex DB ? ;;report index
M_DescriptorLength DB ? ;;save the length of descriptir
M_DataPacketLength DB ? ;;save the length of Data Packet
M_FIFOBAK0 DB ? ;;save FIFO data
M_FIFOBAK1 DB ?
M_FIFOBAK2 DB ?
M_FIFOBAK3 DB ?
M_FIFOBAK4 DB ?
M_FIFOBAK5 DB ?
M_FIFOBAK6 DB ?
M_FIFOBAK7 DB ?
M_FIFOAddress DB ? ;;save FIFO's address
M_IdleTime DB ?
M_DeviceAddress DB ?
M_EndpointNO DB ?
M_DataLengthL DB ?
M_DataLengthH DB ?
;;----------------------------------------------------
M_TMR_MS DB ?
M_AD_COUNT DB ?
M_AD_BUF0 DB ?
M_AD_BUF1 DB ?
M_AD_BUF2 DB ?
M_AD_BUF3 DB ?
M_AD_BUF4 DB ?
M_AD_BUF5 DB ?
M_AD_BUF6 DB ?
M_AD_BUF7 DB ?
;;---------------------------------------------------
M_Flag0 DB ?
F_AddressStatus EQU M_Flag0.0 ;;Address status flag
F_ConfigurationStatus EQU M_FLAG0.1
F_ControlEvent EQU M_FLAG0.2 ;;Setup was already?(0:no setup 1:setup)
F_SetupData EQU M_FLAG0.3 ;;Setup Data flag
F_SendData EQU M_FLAG0.4 ;;send Data flag
F_RemoteWakeup EQU M_FLAG0.5 ;;suport remote wakeup(1)
F_RdHighTable EQU M_FLAG0.6 ;;If F_RdHighTable is 1 then indicated read high byte of table. If F_RdHighTable is 0 then indicated read low byte of table.
F_BufferFull EQU M_FLAG0.7 ;;if the buffer is full,then this flag set 1
M_FLAG1 DB ?
F_SendContinue EQU M_FLAG1.0 ;;flag of send data not load finally.
F_DataUpdate EQU M_FLAG1.1 ;;flag of data which in FIFO was updata.(????)
F_ReportProtocol EQU M_FLAG1.2
;;F_TimerInterruptEnable EQU M_FLAG1.3
;;F_Polling EQU M_FLAG1.4
F_AD_FULL EQU M_FLAG1.5 ;;flag of AD receive end for 8 byte
;;********************************************************************
;;*********************Constant Section*******************************
;;********************************************************************
@USB_Req EQU 0H
@USB_Tx EQU 1H
@Clear EQU 2H
@SetupToken EQU 5H
@Ready EQU 6H
@Packet0 EQU 7H
;;
F_Suspend EQU USC.0
F_USBReset EQU USC.2 ;;if the flag is 1 indicated USB device attached.
F_Resume EQU USC.3
;;
F_AccessEP0 EQU USR.0
F_AccessEP1 EQU USR.1
;;
F_USBClockOn EQU UCC.3
F_Suspend2 EQU UCC.4 ;;This bit is used for decreasing power consumption in suspend mode.(it is only used in 82K96E)
F_FsysClock EQU UCC.6
;;
;;P_RXD EQU PB2
;;P_TXD EQU PB3
;;P_RTS EQU PA0
;;
T_RequestType EQU M_FIFOBAK0
T_RequestNUM EQU M_FIFOBAK1
T_ValueL EQU M_FIFOBAK2
T_ValueH EQU M_FIFOBAK3
T_IndexL EQU M_FIFOBAK4
T_IndexH EQU M_FIFOBAK5
T_LengthL EQU M_FIFOBAK6
T_LengthH EQU M_FIFOBAK7
;;
C_RequestType EQU 60H ;;setup common's Requeset Type
C_FIFOSize EQU 08H ;;Max FIFO count in one packet
C_RamAddress EQU 40H ;;The start address of general data register is 40H
C_RamNumber EQU 0C0H ;;The number of general data register is 192
C_Addr_Wakeup EQU 23H
C_STALL EQU 24H
C_SIES EQU 25H
C_MISC EQU 26H
C_FIFO0Address EQU 28H
C_FIFO1Address EQU 29H
C_InterfaceNO EQU 02H ;Interface Number=2
C_LanguageIDL EQU 09H
C_LanguageIDH EQU 04H
C_DeviceDescriptorLength EQU 12H
C_ConfigurationDesLength EQU 22H
C_ReportDescriptorLength EQU 35H
C_HIDDescriptorLength EQU 09H
C_ReportType EQU 04H ;Report Type
C_SetReport EQU 01H
C_ReportSize EQU 08H
C_DataBits EQU 09H
C_ReceiveBufferSize EQU 1FH
;;for transmit delay time
C_TrBaudRate9600L EQU 68H
C_TrBaudRate9600H EQU 01H
C_ReBaudRate9600L EQU 0C7H
C_ReBaudRate9600H EQU 0FEH
C_INTC0 EQU 09H
C_INTC1 EQU 03H
C_ACSR EQU 00H ;Fsys/8
C_ADCR EQU 08H ;PB0->AD
C_TMR1L EQU 0A0H
C_TMR1H EQU 15H ;65536-12MHz*5ms
C_TMR1C EQU 80H
C_TMR_MS EQU 10 ;5ms*50=250ms
;;*********************************************************************
M_PUSH MACRO
MOV M_ACCBAK,A
MOV A,STATUS
MOV M_STABAK,A
MOV A,MP0
MOV M_MP0BAK,A
MOV A,MP1
MOV M_MP1BAK,A
MOV A,TBLP
MOV M_TBLPBAK,A
ENDM
;;********************************************************************
M_POP MACRO
MOV A,M_STABAK
MOV STATUS,A
MOV A,M_MP0BAK
MOV MP0,A
MOV A,M_MP1BAK
MOV MP1,A
MOV A,M_TBLPBAK
MOV TBLP,A
MOV A,M_ACCBAK
ENDM
;;*********************************************************************