init0.S
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:9k
源码类别:

DVD

开发平台:

C/C++

  1. /*
  2. ** FILE
  3. ** init0.S
  4. **
  5. ** DESCRIPTION
  6. ** the bootstrap ROM code for VCD/SVCD/DVD systems.
  7. ** it located in several places and serves as the 
  8. ** exception-handler, also.
  9. */
  10. #include "regdef.h"
  11. #include "regmapa.h"
  12. #include "intdef.h"
  13. #include "pu8560.h"
  14. #include "user_init.h"
  15. #include "rommap_roma.h"
  16. //
  17. // CONSTANT
  18. // CUSTOMER_ID_STRING[16]
  19. //
  20. // Used for all code to identify the system vender
  21. //
  22. #ifndef CUSTOMER_ID_STRING
  23. #define CUSTOMER_ID_STRING  "SUNPLUS"
  24. #endif
  25. #define    RGST_BASE    0xbffe8000
  26. #define    SPURIOUS_PANIC
  27. //
  28. //    RESET:    0xbfc0_0000
  29. //
  30. // BEV0:
  31. //    TLBL:    0x8000_0000
  32. //    GENINT:    0x8000_0080
  33. // BEV1:
  34. //    TLBL:    0xbfc0_0100
  35. //    GENINT: 0xbfc0_0180
  36. //
  37.                 .text
  38.                 
  39.                 .global __romstart
  40.                 .global __boot_entry
  41.                 .extern rom_checksum_per_kbyte
  42.                 
  43.                 .extern    start
  44.                 .extern    s_gp
  45. #ifdef SPHE1000
  46.                 .global s_gp
  47.                 .rdata    
  48. s_gp:           .word   _gp
  49. #endif
  50.                 .text
  51.                 //
  52.                 // 8800 start
  53.                 //
  54.                 .ent     __romstart
  55. __romstart:
  56.                 .set    noreorder
  57.                 nop                     // required tag        
  58.                 nop
  59.                 b       __realstart
  60.                 nop
  61.                 .set        reorder
  62.                 .global     CFG_sdram_config
  63.                 .global     CFG_sdram_config_PS21
  64.                 .global     CFG_kernel
  65.                 .org        ORG_VERSION_STRING
  66.                 .asciiz     VERSION_STRING
  67.                 //recode MPEG UI Version(Kernal version move to Kernel.a)//nono 2004-4-17 17:47
  68.                 .org        ORG_MPEG_UI_VERSION
  69.                 //.asciiz     KERNEL_VERSION
  70.                 .asciiz     MPEG_UI_VERSION
  71.                 .org        ORG_BOOT_ROM_CHK_SUM
  72.                 //.asciiz     KERNEL_VERSION
  73.                 .asciiz     MPEG_UI_VERSION
  74.                 .end        __romstart
  75.                 // FATAL interrupt sources
  76.                 .extern    exception_panic            // Other sources of exception
  77.                 .extern    exception_mmu            // MMU caused exception
  78.                 .extern    intr_panic                // Spurious interrupt panic
  79.                 .extern    intr_ri_watchdog        // RI Watchdog interrupt (fatal)
  80.                 .extern    intr_sd                 // SDRAM over-range interrupt (fatal)
  81.                 .extern    intr_ls_watchdog        // LSWITCH Watchdog interrupt (fatal)
  82.                 .extern    intr_watchdog            // Watchdog timer interrupt (fatal)
  83.                 // #0
  84.                 .extern    intr_field_end
  85.                 .extern    intr_field_start
  86.                 .extern    intr_pic_end
  87.                 .extern    intr_h_pio
  88.                 .extern    intr_h_device
  89.                 .extern    intr_timer0
  90.                 .extern    intr_timer1
  91.                 .extern    intr_decerr
  92.                 .extern    intr_risc4
  93.                 .extern    intr_risc3
  94.                 .extern    intr_risc2
  95.                 .extern    intr_risc1
  96.                 // #1
  97.                 .extern    intr_timer3b
  98.                 .extern    intr_timer3a
  99.                 .extern    intr_timer2b
  100.                 .extern    intr_timer2a
  101.                 .extern    intr_tdmtx
  102.                 .extern    intr_tdmrx
  103.         
  104.                 .text
  105.                 .align  4
  106. /*
  107. ** intr_null:
  108. */
  109. intr_null:
  110.                 jr        ra                    // do nothing, just return.
  111. /*
  112. ** pseudo entry point
  113. */
  114.                 .org    ORG__boot_entry
  115. __boot_entry:
  116.                 .set    noreorder
  117.                 nop
  118.                 nop
  119.                 b       __realstart
  120.                 nop
  121.                 .set    reorder
  122. /*
  123. ** EXCEPTION ENTRY POINT: 8000_0080
  124. **
  125. ** when STATUS.BEV = 0
  126. */
  127.                 .org    ORG__exception_bev0
  128.                 .global    __exception_bev0
  129. __exception_bev0:
  130. #if 0
  131.                 // fall thru __exception_arise
  132. #include "intdrv.S"
  133. #else
  134.                 .extern    __exception_arise
  135.                 j        __exception_arise
  136. #endif                
  137.                 //
  138.                 // SDRAM configuration table, currently not used
  139.                 //
  140.                 .org        ORG_CFG_sdram_config
  141. CFG_sdram_config:        
  142. #if defined(SPHE8202)||defined(SPHE1000)
  143. #include "sdram.h"
  144.                 .short      CFG_SDRAM_OUT           // 90
  145.                 .short      CFG_SDRAM_IN            // 92
  146.                 .short      CFG_SDRAM_IN_DLY        // 94
  147.                 .short      CFG_SDRAM_PADCTRL       // 96
  148.                 
  149. CFG_sdram_config_PS21:                
  150.                 .short      CFG_SDRAM_OUT_PS21      // 98
  151.                 .short      CFG_SDRAM_IN_PS21       // 9a
  152.                 .short      CFG_SDRAM_IN_DLY_PS21   // 9c
  153.                 .short      CFG_SDRAM_PADCTRL_PS21  // 9e
  154. #else
  155.                 // 8200
  156.                 .short      (1<<3)|(0)              // 90: OUT0
  157.                 .short      (3<<3)|(1)              // 92: IN0
  158.                 .short      (0<<3)|(0)              // 94: OUT1 (not used now)
  159.                 .short      (2<<3)|(1)              // 96: IN1  (not used now)
  160.                 .short      (0<<3)|(0)              // 98: OUT2 (not used now)
  161.                 .short      (2<<3)|(1)              // 9a: IN2  (not used now)
  162. #endif
  163.                 .org        ORG_CFG_kernel0
  164. CFG_kernel0:    .byte       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  165. CFG_kernel1:    .byte       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  166.                 .org        ORG_CUSTOMER_ID_STRING
  167. CFG_customers:  .asciiz     CUSTOMER_ID_STRING
  168.                 .text
  169.                 .align  4
  170. //
  171. // invalidate data cache
  172. //
  173.                 .global invalidate_dcache
  174.                 .ent    invalidate_dcache
  175. invalidate_dcache:
  176.                 // invalidate/reset data cache
  177.                 mfc0    v1, C0_CCTL
  178.                 andi    v0, v1, 0xFFFC      // mask LSB=0
  179.                 ori     v1, 0x0003
  180.                 mtc0    v0, C0_CCTL         //
  181.                 nop; nop
  182.                 nop; nop
  183.                 mtc0    v1, C0_CCTL         //
  184.                 nop; nop
  185.                 nop; nop
  186.                 jr     ra
  187.                 .end    invalidate_dcache
  188. //
  189. // reserved external filled data area
  190. //
  191.                 .org        ORG_reserved_area
  192.                 .asciiz     "reserved area"
  193.                 .org        ORG_CFG_kernel2
  194. CFG_kernel2:    .byte       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  195. CFG_kernel3:    .byte       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  196. CFG_kernel4:    .byte       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  197. CFG_kernel5:    .byte       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  198. //
  199. // __realstart
  200. //
  201.                 .ent    __realstart
  202. __realstart:
  203. #ifdef    EJTAG_DEBUG
  204.                 mfc0    t0, C0_STATUS
  205.                 li      t1, 0x02000000
  206.                 or      t0, t1
  207.                 mtc0    t0, C0_STATUS
  208.                 nop
  209.                 nop
  210.                 la      t0, 0xa1100000        // write to the maic address
  211.                 sw      zero, 0(t0)         
  212.                 la      t2, 0x10101010        // check data pattern
  213. 1:
  214.                 lw      t1, 0(t0)
  215.                 bne     t2, t1, 1b
  216.                 la      t0, 0xa1100004        // load t1 with address
  217.                 lw      t1, 0(t0)
  218.                 nop
  219.                 jr    t1
  220. #endif    /*EJTAG_DEBUG*/
  221.                 jal     invalidate_idcache
  222. #ifdef BOOT_LOAD //terry,2005/1/30 09:23PM
  223.                 li     a0,ROMB_CHK_SUM_ST
  224.                 li     a1,ROMB_CHK_SUM_END
  225.                 jal    rom_checksum_per_kbyte
  226.                 
  227.                 beqz    v0,2f
  228.                 li      t1,0x88000000+ROMB_START  // real romB code address
  229.                 jr      t1
  230. 2:
  231. #endif
  232.                 //
  233.                 // jump to cached region
  234.                 //                
  235.                 la      t0, start
  236.                 jr      t0
  237.                 .end    __realstart
  238.                 .ent    invalidate_idcache
  239.                 .global invalidate_idcache
  240. invalidate_idcache:
  241.                 //
  242.                 // invalidate/reset cache
  243.                 //
  244.                 .set    noreorder
  245.                 mtc0    zero, C0_CCTL
  246.                 li      t0, 0x00000073      // ??
  247.                 mtc0    t0, C0_CCTL
  248.                 nop; nop
  249.                 li      t0, 0x00000010      // ??
  250.                 mtc0    t0, C0_CCTL
  251.                 .set    reorder
  252.                 nop; nop
  253.                 jr      ra
  254.                 .end    invalidate_idcache