www.ti.com
Bootloader Code Listing (V3.0)
// 'A' or 'a' and lock
while(SciaRegs.SCIFFCT.bit.ABD != 1) {}
// After autobaud lock, clear the CDC bit
SciaRegs.SCIFFCT.bit.CDC = 0;
while(SciaRegs.SCIRXST.bit.RXRDY != 1) { }
byteData = SciaRegs.SCIRXBUF.bit.RXDT;
SciaRegs.SCITXBUF = byteData;
return;
}
//#################################################
// Uint16 SCIA_GetWordData(void)
//-----------------------------------------------
// This routine fetches two bytes from the SCI-A
// port and puts them together to form a single
// 16-bit value.
It is assumed that the host is
// sending the data in the order LSB followed by MSB.
//-----------------------------------------------
Uint16 SCIA_GetWordData()
{
Uint16 wordData;
Uint16 byteData;
wordData = 0x0000;
byteData = 0x0000;
// Fetch the LSB and verify back to the host
while(SciaRegs.SCIRXST.bit.RXRDY != 1) { }
wordData =
(Uint16)SciaRegs.SCIRXBUF.bit.RXDT;
SciaRegs.SCITXBUF = wordData;
// Fetch the MSB and verify back to the host
while(SciaRegs.SCIRXST.bit.RXRDY != 1) { }
byteData =
(Uint16)SciaRegs.SCIRXBUF.bit.RXDT;
SciaRegs.SCITXBUF = byteData;
// form the wordData from the MSB:LSB
wordData |= (byteData << 8);
return wordData;
}
// EOF-------
SPRU722C – November 2004 – Revised October 2006
Bootloader Code Overview
73