www.ti.com
Bootloader Code Listing (V3.0)
CopyData();
return EntryAddr;
}
//#################################################
// void SCIA_Init(void)
//----------------------------------------------
// Initialize the SCI-A port for communications
// with the host.
//----------------------------------------------
inline void SCIA_Init()
{
// Enable the SCI-A clocks
EALLOW;
SysCtrlRegs.PCLKCR0.bit.SCIAENCLK=1;
SysCtrlRegs.LOSPCP.all = 0x0002;
SciaRegs.SCIFFTX.all=0x8000;
// 1 stop bit, No parity, 8-bit character
// No loopback
SciaRegs.SCICCR.all = 0x0007;
// Enable TX, RX, Use internal SCICLK
SciaRegs.SCICTL1.all = 0x0003;
// Disable RxErr, Sleep, TX Wake,
// Disable Rx Interrupt, Tx Interrupt
SciaRegs.SCICTL2.all = 0x0000;
// Relinquish SCI-A from reset
SciaRegs.SCICTL1.all = 0x0023;
// Enable pull-ups on SCI-A pins
// GpioCtrlRegs.GPAPUD.bit.GPIO28 = 0;
// GpioCtrlRegs.GPAPUD.bit.GPIO29 = 0;
GpioCtrlRegs.GPAPUD.all &= 0xCFFFFFFF;
// Enable the SCI-A pins
// GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 1;
// GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 1;
GpioCtrlRegs.GPAMUX2.all |= 0x05000000;
// Input qual for SCI-A RX is asynch
GpioCtrlRegs.GPAQSEL2.bit.GPIO28 = 3;
EDIS;
return;
}
//#################################################
// void SCIA_AutobaudLock(void)
//------------------------------------------------
// Perform autobaud lock with the host.
// Note that if autobaud never occurs
// the program will hang in this routine as there
// is no timeout mechanism included.
//------------------------------------------------
inline void SCIA_AutobaudLock()
{
Uint16 byteData;
// Must prime baud register with >= 1
SciaRegs.SCILBAUD = 1;
// Prepare for autobaud detection
// Set the CDC bit to enable autobaud detection
// and clear the ABD bit
SciaRegs.SCIFFCT.bit.CDC = 1;
SciaRegs.SCIFFCT.bit.ABDCLR = 1;
// Wait until you correctly read an
72
Bootloader Code Overview
SPRU722C – November 2004 – Revised October 2006