;COMMENT /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;************************************************************************** ;** ** ;** 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. NO PART OF THIS PROGRAM OR PUBLICATION MAY ** ;** BE REPRODUCED, TRANSMITTED, TRANSCRIBED, STORED IN A ** ;** RETRIEVAL SYSTEM, OR TRANSLATED INTO ANY LANGUAGE OR COMPUTER ** ;** LANGUAGE IN ANY FORM OR BY ANY MEANS, ELECTRONIC, MECHANICAL, ** ;** MAGNETIC, OPTICAL, CHEMICAL, MANUAL, OR OTHERWISE, WITHOUT ** ;** THE PRIOR WRITTEN PERMISSION OF : ** ;** ** ;** INTEL CORPORATION ** ;** ** ;** 2200 MISSON COLLEGE BLVD ** ;** ** ;** SANTA CLARA, CALIFORNIA 95052-8119 ** ;** ** ;**$Author: kschultz $ ;**$Modtime: 09 Sep 1996 13:42:48 $ ;**$Revision: 1.0 $ ;************************************************************************** ;This software provides the code needed to execute the SV plan. Listed ; below are the ; bRequest ; 40h Get Function Address ; 41h Get Hub Address ; 42h Get First SOF after reset ; 43h Get SOF in register when Suspend command happens ; 44h Get First SOF after resume ; ; 50h Cylon pattern on the LEDs to the right ; 51h Cylon pattern on the LEDs to the Left ; 60h Set Timer Count ; 61h Set RWU Trigger - Part will wait 'X Timer counts' after suspending ; and then drive RWU onto the bus. If zero, the part will just suspend. ;These two equate statements allow the user to switch between the PLC ;and Keil assemblers. Place a 1 on the assembler that is to be used to ;assemble this file. PLC EQU 1 KEIL EQU 0 IF PLC include "8X930HX.INC" include "SWITCH.INC" ; include file for program switches ENDIF IF KEIL $include (Reg930.INC) $include (SWITCH.INC) ; include file for program switches ENDIF public VendorGetDeviceCommandExec, VendorSetDeviceCommandExec public SV_ResetRoutine ,SV_SUSPEND_ROUTINE, SV_RESUME_ROUTINE, SV_SOF_ROUTINE IF PLC extern FbRequest:DATA, FwValue:DATA extern RWUTimer:DATA extern LeftCylon:CODE, RightCylon:CODE ENDIF IF KEIL extern DATA (FbRequest), DATA (FwValue) extern DATA (RWUTimer) extern CODE (LeftCylon), CODE (RightCylon) ENDIF IF PLC DEFINE SV_CODE_SEGMENT, SPACE=CODE SEGMENT SV_CODE_SEGMENT ENDIF IF KEIL SV_CODE_SEGMENT SEGMENT CODE RSEG SV_CODE_SEGMENT ENDIF SV_ResetRoutine: push WR0 mov WR0, #0FFFFh mov FirstSOF, WR0 pop WR0 ret VendorGetDeviceCommandExec: CheckGetFunctionAddress: mov A, FbRequest cjne A, #40h, CheckGetHubAddress ; is the command Get Function Address mov TXDAT, FADDR mov TXCNTL,#01h ret CheckGetHubAddress: cjne A, #41h, CheckGetFirstSOF ; is the command Get Hub Address mov TXDAT, HADDR mov TXCNTL,#01h ret CheckGetFirstSOF: cjne A, #42h, CheckGetSuspendSOF ; is the command Get First SOF after reset mov R11, FirstSOF + 1 mov TXDAT, A mov R11, FirstSOF mov TXDAT, A mov TXCNTL,#02h ret CheckGetSuspendSOF: cjne A, #43h, CheckGetResumeSOF ; is the command Get First SOF after reset mov R11, SOFBeforeSuspend + 1 mov TXDAT, A mov R11, SOFBeforeSuspend mov TXDAT, A mov TXCNTL,#02h ret CheckGetResumeSOF: cjne A, #44h, BadGetVendorDeviceCommand ; is the command Get First SOF after reset mov R11, SOFAfterResume + 1 mov TXDAT, A mov R11, SOFAfterResume mov TXDAT, A mov TXCNTL,#02h ret ;------------------------------------------------------------------------------------- ;--------------------- VendorSetDeviceCommandExec------------------------------------- ;------------------------------------------------------------------------------------- VendorSetDeviceCommandExec: mov A, FbRequest CheckSetRWUTimer: cjne A, #60h, CheckCylonRight ; is the command Get Hub Address push WR0 mov WR0, FwValue mov RWUTimer, WR0 pop WR0 ret CheckCylonRight: cjne A, #50h, CheckCylonLeft ; is the command Cylon pattern on LEDs to the right push WR2 mov WR2, #10h call RightCylon pop WR2 ret CheckCylonLeft: cjne A, #51h, BadGetVendorDeviceCommand ; is the command Cylon pattern on LEDs to the left push WR2 mov WR2, #10h call LeftCylon pop WR2 ret BadGetVendorDeviceCommand: orl EPCON, #0C0h ret ;------------------------------------------------------------------------------------- ;--------------------- SV_SOF_ROUTINE ------------------------------------------------ ;------------------------------------------------------------------------------------- SV_SOF_ROUTINE: push WR0 ; Check to see if this is the first SOF. ; If it is then record it. Else jmp around. mov WR0, FirstSOF cmp WR0, #0FFFFh jne NotFirstSOF SaveFirstSOF: mov R1, SOFL mov R0, SOFH mov FirstSOF, WR0 NotFirstSOF: CheckResume: jnb SFACK, SV_SOF_DONE ; If this bit is not set then it's the imaginary SOF which will be fixed. ; Only check valid SOFs mov R0, ResumeOccurred cjne R0, #033h, SV_SOF_DONE mov R1, SOFL mov R0, SOFH mov SOFAfterResume, WR0 mov R0, #00h mov ResumeOccurred, R0 ;#################################################### ;#################################################### SV_SOF_DONE: pop WR0 ret ;------------------------------------------------------------------------------------- ;--------------------- SV_SUSPEND_ROUTINE -------------------------------------------- ;------------------------------------------------------------------------------------- SV_SUSPEND_ROUTINE: push ACC mov A, SOFL mov SOFBeforeSuspend+1, R11 mov A, SOFH mov SOFBeforeSuspend , R11 pop ACC ret ;------------------------------------------------------------------------------------- ;--------------------- SV_RESUME_ROUTINE --------------------------------------------- ;------------------------------------------------------------------------------------- SV_RESUME_ROUTINE: push ACC mov A, #33h mov ResumeOccurred, R11 ; Set flag so next SOF, is put into the varaible pop ACC ret ;------------------------------------------------------------------------------------- ;------------------------ DATA ------------------------------------------------------- ;------------------------------------------------------------------------------------- IF PLC DEFINE SV_PDATA_SEGMENT, SPACE=PDATA SEGMENT SV_PDATA_SEGMENT ENDIF IF KEIL SV_PDATA_SEGMENT SEGMENT EDATA RSEG SV_PDATA_SEGMENT ENDIF FirstSOF: ds 2 SOFBeforeSuspend: ds 2 SOFAfterResume: ds 2 ResumeOccurred: ds 1 END