romInit.s
资源名称:bcm4702.rar [点击查看]
上传用户:yuanda199
上传日期:2022-06-26
资源大小:412k
文件大小:22k
源码类别:
VxWorks
开发平台:
C/C++
- /*
- Copyright 2001, Broadcom Corporation
- All Rights Reserved.
- This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
- the contents of this file may not be disclosed to third parties, copied or
- duplicated in any form, in whole or in part, without the prior written
- permission of Broadcom Corporation.
- */
- /* romInit.s - BCM47XX ROM initialization module */
- /* modified from IDT S134 ROM initialization module */
- /* Copyright 1984-1996 Wind River Systems, Inc. */
- .data
- .globl copyright_wind_river
- /*
- DESCRIPTION
- This module contains the entry code for the VxWorks bootrom.
- The entry point romInit, is the first code executed on power-up.
- The routine sysToMonitor() jumps to romInit() to perform a
- "warm boot".
- */
- #define _ASMLANGUAGE /* used by vxworks include files */
- #include "vxWorks.h"
- #include "arch/mips/ivMips.h"
- #include "arch/mips/asmMips.h"
- #include "arch/mips/esfMips.h"
- #include "sysLib.h"
- #include "config.h"
- /* 47xx specific includes */
- #if 0
- #include "sbsdram.h"
- #include "sbextif.h"
- #endif
- #undef SDRAM_INIT
- #undef SDRAM_CONFIG
- #undef SDRAM_REFRESH
- #define SDRAM_INIT_1MX16X4 0x0419 /* 1Meg X 16 X 4 banks */
- #define SDRAM_INIT_2MX16X4 0x0c29 /* 2Meg X 16 X 4 banks */
- #define SDRAM_CONFIG 0x0000
- #define SDRAM_REFRESH 0x8040
- #define CORECLK_125_PCI_33
- #undef CORECLK_125_PCI_25
- #undef CORECLK_100_PCI_33
- #undef CORECLK_100_PCI_25
- #define WATCHDOG_OFFSET 0x40
- #define CLOCK_CTRL_N_OFFSET 0x44
- #define CLOCK_CTRL_SB_OFFSET 0x48
- #define CLOCK_CTRL_PCI_OFFSET 0x4c
- /* Clock control default values */
- #define CC_DEF_N 0x0009 /* Default values for bcm4710 */
- #define CC_DEF_100 0x04020011
- #define CC_DEF_M CC_DEF_100
- #define CC_DEF_M33 0x11030011
- #define CC_DEF_M25 0x11050011
- /* Clock control values for 125Mhz */
- #define CC_125_N 0x0802
- #define CC_125_M 0x04020009
- #define CC_125_M25 0x11090009
- #define CC_125_M33 0x11090005
- #define RAM_DST_ADRS RAM_HIGH_ADRS
- /* internals */
- .globl romInit /* start of system code */
- .globl romReboot /* sw reboot address */
- /* externals */
- .globl romStart /* system initialization routine */
- /* external defs */
- .extern end 0 /* end of program */
- .extern etext 0 /* end of text section */
- .extern _fbss 0 /* start of bss section */
- .extern _fdata 0 /* start of data section */
- .data
- /* ensure data segment is 16-byte aligned */
- .align 4
- _sdata:
- .asciiz "start of data"
- .text
- /*
- * relocate an address
- * Make the address an uncached address
- * This will trash ra!
- */
- #define RELOC(toreg,address)
- bal 9f;
- 9:;
- la toreg,address;
- addu toreg,ra;
- la ra,9b;
- subu toreg,ra
- #define RVECENT(f,n)
- b f; nop
- #define XVECENT(f,bev)
- b f; li k0,bev
- .text
- promEntry:
- romInit:
- _romInit:
- .set noreorder
- RVECENT(__romInit,0) /* PROM entry point */
- RVECENT(romReboot,1) /* software reboot */
- RVECENT(romReserved,2)
- RVECENT(romReserved,3)
- RVECENT(romReserved,4)
- RVECENT(romReserved,5)
- RVECENT(romReserved,6)
- RVECENT(romReserved,7)
- RVECENT(romReserved,8)
- RVECENT(romReserved,9)
- RVECENT(romReserved,10)
- RVECENT(romReserved,11)
- RVECENT(romReserved,12)
- RVECENT(romReserved,13)
- RVECENT(romReserved,14)
- RVECENT(romReserved,15)
- RVECENT(romReserved,16)
- RVECENT(romReserved,17)
- RVECENT(romReserved,18)
- RVECENT(romReserved,19)
- RVECENT(romReserved,20)
- RVECENT(romReserved,21)
- RVECENT(romReserved,22)
- RVECENT(romReserved,23)
- RVECENT(romReserved,24)
- RVECENT(romReserved,25)
- RVECENT(romReserved,26)
- RVECENT(romReserved,27)
- RVECENT(romReserved,28)
- RVECENT(romReserved,29)
- RVECENT(romReserved,30)
- RVECENT(romReserved,31)
- RVECENT(romReserved,32)
- RVECENT(romReserved,33)
- RVECENT(romReserved,34)
- RVECENT(romReserved,35)
- RVECENT(romReserved,36)
- RVECENT(romReserved,37)
- RVECENT(romReserved,38)
- RVECENT(romReserved,39)
- RVECENT(romReserved,40)
- RVECENT(romReserved,41)
- RVECENT(romReserved,42)
- RVECENT(romReserved,43)
- RVECENT(romReserved,44)
- RVECENT(romReserved,45)
- RVECENT(romReserved,46)
- RVECENT(romReserved,47)
- #if CPU==RC32364
- XVECENT(romExcHandle,0x380)
- #else
- RVECENT(romReserved,48)
- #endif
- RVECENT(romReserved,49)
- RVECENT(romReserved,50)
- RVECENT(romReserved,51)
- RVECENT(romReserved,52)
- RVECENT(romReserved,53)
- RVECENT(romReserved,54)
- RVECENT(romReserved,55)
- RVECENT(romReserved,56)
- RVECENT(romReserved,57)
- RVECENT(romReserved,58)
- RVECENT(romReserved,59)
- RVECENT(romReserved,60)
- RVECENT(romReserved,61)
- RVECENT(romReserved,62)
- RVECENT(romReserved,63)
- #if CPU_VAR==RC32364
- XVECENT(romExcHandle,0x200) /* bfc00200: RC32364 tlbmiss vector */
- #else
- RVECENT(romReserved,64)
- #endif
- RVECENT(romReserved,65)
- RVECENT(romReserved,66)
- RVECENT(romReserved,67)
- RVECENT(romReserved,68)
- RVECENT(romReserved,69)
- RVECENT(romReserved,70)
- RVECENT(romReserved,71)
- RVECENT(romReserved,72)
- RVECENT(romReserved,73)
- RVECENT(romReserved,74)
- RVECENT(romReserved,75)
- RVECENT(romReserved,76)
- RVECENT(romReserved,77)
- RVECENT(romReserved,78)
- RVECENT(romReserved,79)
- RVECENT(romReserved,80)
- RVECENT(romReserved,81)
- RVECENT(romReserved,82)
- RVECENT(romReserved,83)
- RVECENT(romReserved,84)
- RVECENT(romReserved,85)
- RVECENT(romReserved,86)
- RVECENT(romReserved,87)
- RVECENT(romReserved,88)
- RVECENT(romReserved,89)
- RVECENT(romReserved,90)
- RVECENT(romReserved,91)
- RVECENT(romReserved,92)
- RVECENT(romReserved,93)
- RVECENT(romReserved,94)
- RVECENT(romReserved,95)
- #if CPU_VAR==RC32364
- XVECENT(romExcHandle,0x300) /* bfc00300: RC32364 cache vector */
- #else
- RVECENT(romReserved,96)
- #endif
- RVECENT(romReserved,97)
- RVECENT(romReserved,98)
- RVECENT(romReserved,99)
- RVECENT(romReserved,100)
- RVECENT(romReserved,101)
- RVECENT(romReserved,102)
- RVECENT(romReserved,103)
- RVECENT(romReserved,104)
- RVECENT(romReserved,105)
- RVECENT(romReserved,106)
- RVECENT(romReserved,107)
- RVECENT(romReserved,108)
- RVECENT(romReserved,109)
- RVECENT(romReserved,110)
- RVECENT(romReserved,111)
- #if CPU_VAR==RC32364
- XVECENT(romExcHandle,0x380) /* bfc00380: RC32364 general vector */
- #else
- RVECENT(romReserved,112)
- #endif
- RVECENT(romReserved,113)
- RVECENT(romReserved,114)
- RVECENT(romReserved,115)
- RVECENT(romReserved,116)
- RVECENT(romReserved,116)
- RVECENT(romReserved,118)
- RVECENT(romReserved,119)
- RVECENT(romReserved,120)
- RVECENT(romReserved,121)
- RVECENT(romReserved,122)
- RVECENT(romReserved,123)
- RVECENT(romReserved,124)
- RVECENT(romReserved,125)
- RVECENT(romReserved,126)
- RVECENT(romReserved,127)
- /* We hope there are no more reserved vectors!
- * 128 * 8 == 1024 == 0x400
- * so this is address R_VEC+0x400 == 0xbfc00400
- */
- .set reorder
- .align 4
- /********************************************************************************
- *
- * romInit - entry point for VxWorks in ROM
- *
- * romInit
- * (
- * int startType
- * )
- */
- __romInit: /* force power-on startType */
- .set nomove
- # set SR and CAUSE to something sensible
- li v0,SR_BEV
- #if 0
- .set noreorder
- .set noat
- #endif
- mtc0 v0,C0_SR
- mtc0 zero,C0_CAUSE
- mtc0 zero,$18 # C0_WATCHLO
- mtc0 zero,$19 # C0_WATCHHI
- /***********
- * Initialize the hardware
- ***********/
- li t0, 2
- mtc0 $16, t0
- nop
- /* Enable "PCMCIA" chip select -- that's where LEDs reside */
- li a0, 0xb8007000
- li a1, 1
- sw a1, 0x10(a0)
- /* Enable external uart on the asynch chip select */
- sw a1, 0x20(a0) /* enable the async interface */
- li a1, 0x01020a0c /* prog wait cnt for ext uart */
- sw a1, 0x24(a0)
- RELOC(a0,Init_msg)
- bal displaymsg
- nop
- /* Core clock selection */
- #ifdef CORECLK_125_PCI_33
- li t0, CC_125_N
- li t1, CC_125_M
- li t2, CC_125_M33
- #define CORECLK_XXX_PCI_YY
- #endif
- #ifdef CORECLK_125_PCI_25
- li t0, CC_125_N
- li t1, CC_125_M
- li t2, CC_125_M25
- #define CORECLK_XXX_PCI_YY
- #endif
- #ifdef CORECLK_100_PCI_33
- li t0, CC_DEF_N
- li t1, CC_DEF_M
- li t2, CC_DEF_M33
- #define CORECLK_XXX_PCI_YY
- #endif
- #ifdef CORECLK_100_PCI_25
- li t0, CC_DEF_N
- li t1, CC_DEF_M
- li t2, CC_DEF_M25
- #define CORECLK_XXX_PCI_YY
- #endif
- #ifdef CORECLK_XXX_PCI_YY
- li a0, KSEG1ADDRASM(BCM4710_REG_EXTIF)
- lw a1, CLOCK_CTRL_N_OFFSET(a0)
- bne a1, t0, 1f
- nop
- lw a1, CLOCK_CTRL_SB_OFFSET(a0)
- bne a1, t1, 1f
- nop
- lw a1, CLOCK_CTRL_PCI_OFFSET(a0)
- beq a1, t2, 2f
- nop
- 1:
- sw t0, CLOCK_CTRL_N_OFFSET(a0)
- sw t1, CLOCK_CTRL_SB_OFFSET(a0)
- sw t2, CLOCK_CTRL_PCI_OFFSET(a0)
- RELOC(a0,clk_set)
- bal displaymsg
- /* Watchdog reset */
- li a0, KSEG1ADDRASM(BCM4710_REG_EXTIF)
- li a1, 1
- sw a1, WATCHDOG_OFFSET(a0)
- 3: b 3b
- nop
- 2:
- #endif
- RELOC(a0,Init_msg1)
- bal displaymsg
- nop
- li t0, SDRAM_INIT_2MX16X4
- li a0, 0xbf004000 /* board ID Addr */
- lbu a1, 0(a0) /* board ID */
- beq a1, 0x0e, lm_32MB /* BOARD_ID_LM_1_32MB = 0x0e */
- nop
- beq a1, 0x81, lm_32MB /* BOARD_ID_MBZ_32MB = 0x81 */
- nop
- li t0, SDRAM_INIT_1MX16X4
- lm_32MB:
- li t1, SDRAM_CONFIG
- li t2, SDRAM_REFRESH
- /* SDRAM init */
- li a0, 0xB8000f98
- li a1, 0x00030001
- sw a1, 0(a0)
- lw a1, 0(a0) /* use multiple loads to insert a delay */
- lw a1, 0(a0)
- lw a1, 0(a0)
- li a1, 0x00030000
- sw a1, 0(a0)
- lw a1, 0(a0) /* use multiple loads to insert a delay */
- lw a1, 0(a0)
- lw a1, 0(a0)
- li a1, 0x00010000
- sw a1, 0(a0)
- lw a1, 0(a0) /* use multiple loads to insert a delay */
- lw a1, 0(a0)
- lw a1, 0(a0)
- li a0, 0xB8000000 # SDRAM registers
- sw t1, 4(a0) # SDRAM config
- li a1, 0x000a
- sw a1, 0(a0) # SDRAM precharge
- li a1, 0x0009 # SDRAM refresh
- sw a1, 0(a0) # 1st refresh of power up sequence
- sw a1, 0(a0) # 2nd refresh of power up sequence
- sw a1, 0(a0) # 3rd refresh of power up sequence
- sw a1, 0(a0) # 4th refresh of power up sequence
- sw a1, 0(a0) # 5th refresh of power up sequence
- sw a1, 0(a0) # 6th refresh of power up sequence
- sw a1, 0(a0) # 7th refresh of power up sequence
- sw a1, 0(a0) # 8th refresh of power up sequence
- li a1, 0x000c
- sw a1, 0(a0) # SDRAM mode reg select
- sw t0, 0(a0) # SDRAM init
- sw t2, 8(a0) # SDRAM refresh
- /** End of 47xx SDRAM Init code **/
- RELOC(a0,sdrm_msg)
- bal displaymsg
- li a0, BOOT_CLEAR /* Says to clear memory. BOOT_NORMAL says don't. */
- /*
- * If there was some way to distinguish between a cold and warm
- * restart AND the memory system is guaranteed to be intact then
- * we could load BOOT_NORMAL instead
- */
- romReboot: /* sw reboot inherits a0 startType */
- move s0, a0 /* save startType */
- .set nomove
- /* disable all interrupts, */
- li t1, 0xfffffffe
- li t0, SR_BEV /* select boot exception handlers */
- and t0, t1 /* IE bit in status reg becomes 0 */
- li t1, ~SR_IE
- and t0, t1
- mtc0 t0, C0_SR
- /* clear software interrupts */
- mtc0 zero, C0_CAUSE
- mtc0 zero, C0_IWATCH
- mtc0 zero, C0_DWATCH
- .set move
- andi a0, s0, BOOT_CLEAR
- bal romCacheReset /*initialise caches */
- andi t0, s0, BOOT_CLEAR
- beqz t0, romWarm
- RELOC(a0,bss_msg)
- bal displaymsg
- #ifdef SDRAM_ECC
- bal romClearEdac
- nop
- b 6f
- nop
- #endif
- romWarm:
- /* zap the BSS */
- la a0,_fbss
- la a1,_end
- subu a1,a0
- srl a1,2
- li a2,0xfffffff0
- and a1,a1,a2
- li a2,0xfffffff0
- and a0,a0,a2
- move a2,zero
- bal _bfillLongs
- 6:
- RELOC(a0,stak_msg)
- bal displaymsg
- /* give us as long as possible before a clock interrupt */
- li t0, 1
- mtc0 t0, C0_COUNT
- mtc0 zero, C0_COMPARE
- RELOC(a0,roms_msg)
- bal displaymsg
- /* set stack to grow down from beginning of data and call init */
- la gp, _gp /* set global ptr from compiler */
- la sp, STACK_ADRS /* set stack to begin of data */
- subu sp, 16 /* give me some room */
- move a0, s0 /* push arg = start type */
- RELOC(t0, romStart)
- jal t0 /* never returns - starts up kernel */
- j ra /* just in case */
- 1: b 1b
- Init_msg:
- .ascii "Init"
- r_Fail:
- .ascii "Fail"
- clk_set:
- .ascii "CLKS"
- Init_msg1:
- .ascii "SDIN"
- roms_msg:
- .ascii "roms"
- sdrm_msg:
- .ascii "sdrm"
- bss_msg:
- .ascii "bss "
- stak_msg:
- .ascii "stak"
- /*******************************************************************************
- *
- * romReserved - Handle a jump to an unknown vector
- *
- * romReserved ()
- *
- */
- .ent romReserved
- romReserved:
- b romInit /* just start over */
- .end romReserved
- .ent _bfillLongs
- _bfillLongs:
- move v0,ra /* save return address */
- bltu a1,8,2f
- RELOC(t0,1f) /* run the loop from cache */
- nop
- j t0
- 1: sw a2,0(a0)
- sw a2,4(a0)
- sw a2,8(a0)
- sw a2,12(a0)
- sw a2,16(a0)
- sw a2,20(a0)
- sw a2,24(a0)
- sw a2,28(a0)
- subu a1,8
- addu a0,32
- bgeu a1,8,1b
- 2: beqz a1,2f
- 1: subu a1,1
- sw a2,0(a0)
- addu a0,4
- bnez a1,1b
- 2: j v0
- .end _bfillLongs
- /*
- * cacheop macro to automate cache operations
- * first some helpers...
- */
- #define _mincache(size, maxsize)
- .set noat ;
- sltu AT,size,maxsize;
- bnez AT,9f ;
- move size,maxsize ;
- .set at ;
- 9:
- #define _align(minaddr, maxaddr, linesize)
- .set noat;
- subu AT,linesize,1 ;
- not AT ;
- and minaddr,AT ;
- addu maxaddr,-1 ;
- and maxaddr,AT ;
- .set at
- #define CACHELINE_SIZE 16
- #define ICACHE_SIZE (8*1024)
- #define DCACHE_SIZE (4*1024)
- #define KSEG0BASE 0x80000000
- #define C0_TAGLO $28
- #define C0_TAGHI $29
- #define CACHE_OP( code, type ) ( ((code) << 2) | (type) )
- #define ICACHE_INDEX_INVALIDATE CACHE_OP(0x0, 0)
- #define ICACHE_INDEX_LOAD_TAG CACHE_OP(0x1, 0)
- #define ICACHE_INDEX_STORE_TAG CACHE_OP(0x2, 0)
- #define DCACHE_INDEX_WRITEBACK_INVALIDATE CACHE_OP(0x0, 1)
- #define DCACHE_INDEX_LOAD_TAG CACHE_OP(0x1, 1)
- #define DCACHE_INDEX_STORE_TAG CACHE_OP(0x2, 1)
- #define ICACHE_ADDR_HIT_INVALIDATE CACHE_OP(0x4, 0)
- #define ICACHE_ADDR_FILL CACHE_OP(0x5, 0)
- #define ICACHE_ADDR_FETCH_LOCK CACHE_OP(0x7, 0)
- #define DCACHE_ADDR_HIT_INVALIDATE CACHE_OP(0x4, 1)
- #define DCACHE_ADDR_HIT_WRITEBACK_INVALIDATE CACHE_OP(0x5, 1)
- #define DCACHE_ADDR_HIT_WRITEBACK CACHE_OP(0x6, 1)
- #define DCACHE_ADDR_FETCH_LOCK CACHE_OP(0x7, 1)
- /*******************************************************************************
- *
- * romCacheReset - low level initialisation of the primary caches
- *
- *
- * RETURNS: N/A
- *
- * void romCacheReset
- */
- .set mips3
- .set noreorder
- .ent romCacheReset
- romCacheReset:
- /* a0 = cache size
- * a1 = line size
- */
- li a0, ICACHE_SIZE
- li a1, CACHELINE_SIZE
- /* CFLUSH */
- mtc0 zero, C0_TAGLO
- mtc0 zero, C0_TAGHI /* TagHi is not really used */
- /* Calc an address that will correspond to the first cache line */
- li a2, KSEG0BASE
- /* Calc an address that will correspond to the last cache line */
- addu a3, a2, a0
- subu a3, a1
- /* Loop through all lines, invalidating each of them */
- 1:
- cache ICACHE_INDEX_STORE_TAG, 0(a2) /* clear tag */
- bne a2, a3, 1b
- addu a2, a1
- /* DFLUSH INV */
- /* a0 = cache size
- * a1 = line size
- */
- li a0, DCACHE_SIZE
- li a1, CACHELINE_SIZE
- mtc0 zero, C0_TAGLO
- mtc0 zero, C0_TAGHI /* TagHi is not really used */
- /* Calc an address that will correspond to the first cache line */
- li a2, KSEG0BASE
- /* Calc an address that will correspond to the last cache line */
- addu a3, a2, a0
- subu a3, a1
- /* Loop through all lines, invalidating each of them */
- 1:
- cache DCACHE_INDEX_STORE_TAG, 0(a2) /* clear tag */
- bne a2, a3, 1b
- addu a2, a1
- j ra
- .end romCacheReset
- .set mips0
- .set reorder
- /*******************************************************************************
- *
- * romClearEdac - clear error detection and correction logic
- *
- * This routine clears the memory and error detection logic by
- * doing word writes to each DRAM location. It sizes memory by
- * probing memory locations.
- */
- .ent romClearEdac
- romClearEdac:
- mfc0 v1,C0_SR /* disable parity errors */
- or v0,v1,SR_DE
- mtc0 v0,C0_SR
- move v0,ra /* save return address */
- RELOC(t0,1f) /* run the loop from cache */
- and t0,0x1fffffff
- or t0,K0BASE
- j t0
- 1:
- li a0,(LOCAL_MEM_SIZE | K1BASE )
- clearloop:
- sw zero, -4(a0)
- sw zero, -8(a0)
- sw zero, -12(a0)
- sw zero, -16(a0)
- sw zero, -20(a0)
- sw zero, -24(a0)
- sw zero, -28(a0)
- sw zero, -32(a0)
- subu a0, 32
- bne a0, K1BASE, clearloop
- nop
- done:
- mtc0 v1,C0_SR
- j v0
- .end romClearEdac
- /*******************************************************************************
- *
- * displaymsg - display a 4-character message on the alpha LEDS
- *
- */
- .globl displaymsg
- .ent displaymsg
- displaymsg:
- #if 0
- DELAY(PREDELAY)
- #endif
- li a2, MBZ_LED_ADDR_ASM
- lbu a1,0(a0) /* get char from bootrom */
- sb a1,0(a2)
- lbu a1,1(a0)
- sb a1,1(a2)
- lbu a1,2(a0)
- sb a1,2(a2)
- lbu a1,3(a0)
- sb a1,3(a2)
- #if 0
- DELAY(POSTDELAY)
- #endif
- j ra
- nop
- .end displaymsg
- /*******************************************************************************
- *
- * romExcHandle - rom based exception/interrupt handler
- *
- * This routine is invoked on an exception or interrupt while
- * the status register is using the bootstrap exception vectors.
- * It saves a state frame to a known uncached location so someone
- * can examine the data over the VME. It also displays a summary of the
- * error on the boards alphanumeric display.
- *
- * THIS ROUTIINE IS NOT CALLABLE FROM "C"
- *
- */
- #define ROM_ISP_BASE 0xa0100000
- .ent romExcHandle
- romExcHandle:
- .set noat
- li sp, ROM_ISP_BASE /* sp to known uncached location */
- SW sp, E_STK_SP-ESTKSIZE(sp) /* save sp in new intstk frame */
- subu sp, ESTKSIZE /* make new exc stk frame */
- SW k0, E_STK_K0(sp) /* save k0, (exception type) */
- SW AT, E_STK_AT(sp) /* save asmbler resvd reg */
- .set at
- SW v0, E_STK_V0(sp) /* save func return 0, used
- to hold masked cause */
- mfc0 k1, C0_BADVADDR /* read bad VA reg */
- sw k1, E_STK_BADVADDR(sp) /* save bad VA on stack */
- mfc0 k1, C0_EPC /* read exception pc */
- sw k1, E_STK_EPC(sp) /* save EPC on stack */
- mfc0 v0, C0_CAUSE /* read cause register */
- sw v0, E_STK_CAUSE(sp) /* save cause on stack */
- mfc0 k1, C0_SR /* read status register */
- sw k1, E_STK_SR(sp) /* save status on stack */
- .set noat
- mflo AT /* read entry lo reg */
- SW AT,E_STK_LO(sp) /* save entry lo reg */
- mfhi AT /* read entry hi reg */
- SW AT,E_STK_HI(sp) /* save entry hi reg */
- .set at
- SW zero, E_STK_ZERO(sp) /* save zero ?! */
- SW v1,E_STK_V1(sp) /* save func return 1 */
- SW a0,E_STK_A0(sp) /* save passed param 0 */
- SW a1,E_STK_A1(sp) /* save passed param 1 */
- SW a2,E_STK_A2(sp) /* save passed param 2 */
- SW a3,E_STK_A3(sp) /* save passed param 3 */
- SW t0,E_STK_T0(sp) /* save temp reg 0 */
- SW t1,E_STK_T1(sp) /* save temp reg 1 */
- SW t2,E_STK_T2(sp) /* save temp reg 2 */
- SW t3,E_STK_T3(sp) /* save temp reg 3 */
- SW t4,E_STK_T4(sp) /* save temp reg 4 */
- SW t5,E_STK_T5(sp) /* save temp reg 5 */
- SW t6,E_STK_T6(sp) /* save temp reg 6 */
- SW t7,E_STK_T7(sp) /* save temp reg 7 */
- SW t8,E_STK_T8(sp) /* save temp reg 8 */
- SW t9,E_STK_T9(sp) /* save temp reg 9 */
- SW s0,E_STK_S0(sp) /* save saved reg 0 */
- SW s1,E_STK_S1(sp) /* save saved reg 1 */
- SW s2,E_STK_S2(sp) /* save saved reg 2 */
- SW s3,E_STK_S3(sp) /* save saved reg 3 */
- SW s4,E_STK_S4(sp) /* save saved reg 4 */
- SW s5,E_STK_S5(sp) /* save saved reg 5 */
- SW s6,E_STK_S6(sp) /* save saved reg 6 */
- SW s7,E_STK_S7(sp) /* save saved reg 7 */
- SW s8,E_STK_FP(sp) /* save saved reg 8 */
- SW gp,E_STK_GP(sp) /* save global pointer? */
- SW ra,E_STK_RA(sp) /* save return address */
- .end romExcHandle /* that's all folks */
- #define ROMCYCLE 1180 /* 1.18us cycle */
- #define ROMMS 1000000/(ROMCYCLE*2)
- /*
- * delay for r microseconds
- */
- #define ASMRDELAY(r)
- .set noreorder;
- .set noat;
- move AT,r;
- 99:;
- bne AT,zero,99b;
- subu AT,1;
- .set at;
- .set reorder
- /*
- * delay for n milliseconds
- */
- #define DELAY(n)
- .set noat ;
- li AT,(n*ROMMS) ;
- ASMRDELAY(AT) ;
- .set at
- #define PREDELAY 1000
- #define ONDELAY 4000
- #define OFFDELAY 400
- #define POSTDELAY 1000
- #define BLIPDISPLAY(bcrrp,bcrrv)
- DELAY(ONDELAY) ;
- DELAY(OFFDELAY)
- /* Data for the display of Exception Info */
- exctypes:
- #if CPU_VAR==RC32364
- .word 0x200; .ascii "tlb "
- .word 0x300; .ascii "cach"
- .word 0x380; .ascii "gen "
- #endif /* CPU_VAR==RC32364 */
- .word 0; .ascii "????"
- r_epc: .ascii "epc "
- r_cr: .ascii "cr "
- r_sr: .ascii "sr "
- r_badvaddr:
- .ascii "badv"
- r_ra: .ascii "ra "