; --------------------------------------------------------------------------------
; @Title: RTXC PowerPC demo program
; @Description: -
; @Chip: MPC860
; @Author: -
; @Copyright: (C) 1989-2014 Lauterbach GmbH, licensed for use with TRACE32(R) only
; --------------------------------------------------------------------------------
; $Id: rtxc.cmm 7821 2014-10-29 11:06:58Z kjmal $


 GLOBAL &base

 SCREEN.ON

; Emulator reset
 PRINT "resetting..."
 RESet
 WinPAGE.RESet

 PRINT "initializing..."

; mappings to fit the example which is based on the ADS860 BSP

 IF ICE()
 (
  SYStem.Option pmm OFF
  MAP.PRE 0x0--0x00fffff 
; MAP.PRE 30000000--300FFFFF 6
; MAP.PRE 0ffe00000++0fffff

 MAP.Data 0x0--0x0fffff
; map.d 270000++8ffff
; map.d 30000000--30007FFF
; map.d 0ffe00000++0fffff
 MAP.Intern
 MAP.Flag 0x0--0x0fffff
; MAP.Flag 270000++8ffff
; MAP.Flag 0ffe00000++0fffff
 MAP.Break 0x0--0x0fffff
; MAP.Break 270000++8ffff
; MAP.Break 0ffe00000++0fffff


; T32 settings
 SETUP.IMASKASM ON
 SETUP.IMASKHLL ON
 SETUP.StepBreak ON

; Stand alone internal mode
 SYStem.Mode AloneInt
 
; System settings for PPC860 probe
 &base=Data.Long(SPR:638.)

 ;disable watchdog
 Data.Set &base+0x004 %Long 0x0ffffff88
 )
 IF SIMULATOR()
 (
  SYStem.CPU mpc860
  SYStem.Up
 )

 Data.Set spr:638. %Long 0x020000000
 &base=0x20000000

 ;SIUMCR
 Data.Set &base+0x000 %Long 0x0632640

 ;TBSCR
 Data.Set &base+0x200 %Long 0x0966b0002
 ;RTCSC
 Data.Set &base+0x220 %Long 0x08a6b0002
 ;PISCR
 Data.Set &base+0x240 %Long 0x0a66b0002

 DO upm2 &base

 ;MPTPR
 Data.Set &base+0x17a %Word 0x0826b0002
 ;MAMR
 Data.Set &base+0x170 %Long 0x0c0a21114

 ;OR0
 Data.Set &base+0x104 %Long 0x0ffe00954
 ;OR1
 Data.Set &base+0x10c %Long 0x0ffff8110
 ;OR2
 Data.Set &base+0x114 %Long 0x0ffc00000
 ;OR3
 Data.Set &base+0x11c %Long 0x0ffff0000

 ;BR0
 ;Data.Set &base+100 %l 002800001
 Data.Set &base+0x100 %Long 0x0ffe00001
 ;BR1
 Data.Set &base+0x108 %Long 0x002100001
 ;BR2
 Data.Set &base+0x110 %Long 0x000000081
 ;BR3
 Data.Set &base+0x118 %Long 0x030000001

 ;DER
 ;Data.Set SPR:149. %l 0ffe77c0f
 ;Data.Set spr:149. %l 0ffffffff

 ;SRR1 
 Data.Set SPR:0x01b %Long 0x000001002
 ;ICTRL
 ;Data.Set SPR:158. %l 000000006

; now load OS and sample application
 PRINT "loading sample application..."
 Data.LOAD.Elf example.elf
;Data.LOAD.Elf example.elf /lpath

 PRINT "loading RTXC extension..."
 TASK.CONFIG rtxc

; set program counter to beginning of boot
 Register.Set PC _start

 PRINT "loading additional menu items..."
 MENU.ReProgram rtxc

 List.auto

 PRINT "load complete."

 ENDDO



