Chapter 10 XGATE (S12XGATEV3)
MC9S12XE-Family Reference Manual , Rev. 1.19
Freescale Semiconductor
463
;###########################################
;#
INITIALIZE S12XE CORE
#
;###########################################
SEI
MOVB
#(RAM_START_GLOB>>12), RPAGE
;set RAM page
;###########################################
;#
INITIALIZE SCI
#
;###########################################
INIT_SCI
MOVW
#(BUS_FREQ_HZ/(16*9600)), SCIBDH;set baud rate
MOVB
#(TIE|TE), SCICR2;enable tx buffer empty interrupt
;###########################################
;#
INITIALIZE S12X_INT
#
;###########################################
INIT_INT
MOVB
#(SCI_VEC&$F0), INT_CFADDR
;switch SCI interrupts to XGATE
MOVB
#RQST|$01, INT((SCI_VEC&$0F)>>1)
;###########################################
;#
INITIALIZE XGATE
#
;###########################################
INIT_XGATE
MOVW
#XGMCTL_CLEAR, XGMCTL
;clear all XGMCTL bits
INIT_XGATE_BUSY_LOOP
TST
XGCHID
;wait until current thread is finished
BNE
INIT_XGATE_BUSY_LOOP
LDX
#XGIF
;clear all channel interrupt flags
LDD
#$FFFF
STD
2,X+
STD
2,X+
STD
2,X+
STD
2,X+
STD
2,X+
STD
2,X+
STD
2,X+
STD
2,X+
CLR
XGISPSEL
;set vector base register
MOVW
#XGATE_VECTORS_XG, XGVBR
MOVW
#$FF00, XGSWT
;clear all software triggers
;###########################################
;#
INITIALIZE XGATE VECTOR TABLE
#
;###########################################
LDAA
#128
;build XGATE vector table
LDY
#XGATE_VECTORS
INIT_XGATE_VECTAB_LOOP
MOVW
#XGATE_DUMMY_ISR_XG, 4,Y+
DBNE
A, INIT_XGATE_VECTAB_LOOP
MOVW
#XGATE_CODE_XG, RA(2*SCI_VEC)
MOVW
#XGATE_DATA_XG, RA(2*S2
;###########################################
;#
COPY XGATE CODE
#
;###########################################
COPY_XGATE_CODE
LDX
#XGATE_DATA_FLASH
COPY_XGATE_CODE_LOOP
MOVW
2,X+, 2,Y+
Because
of
an
order
from
the
United
States
International
Trade
Commission,
BGA-packaged
product
lines
and
part
numbers
indicated
here
currently
are
not
available
from
Freescale
for
import
or
sale
in
the
United
States
prior
to
September
2010:
S12XE
products
in
208
MAPBGA
packages