www.ti.com
Bootloader Code Listing (V3.0)
GpioCtrlRegs.GPADIR.bit.DSP_CTRL = 1;
GpioCtrlRegs.GPADIR.bit.HOST_CTRL = 0;
EDIS;
}
//#################################################
// void Parallel_CheckKeyVal(void)
//-----------------------------------------
// Determine if the data you are loading is in
// 8-bit or 16-bit format.
// If neither, return an error.
//
// Note that if the host never responds then
// the code will be stuck here.
That is there
// is no timeout mechanism.
//------------------------------------------
inline Uint16 Parallel_CheckKeyVal()
{
Uint16 wordData;
// Fetch a word from the parallel port and compare
// it to the defined 16-bit header format, if not check
// for a 8-bit header format.
wordData = Parallel_GetWordData_16bit();
if(wordData == SIXTEEN_BIT_HEADER)
{
// Assign GetWordData to the parallel 16bit version of the
// function.
GetWordData is a pointer to a function.
GetWordData = Parallel_GetWordData_16bit;
return SIXTEEN_BIT;
}
// If not 16-bit mode, check for 8-bit mode
// Call Parallel_GetWordData with 16-bit mode
// so you only fetch the MSB of the KeyValue and not
// two bytes.
You will ignore the upper 8-bits and combine
// the result with the previous byte to form the
// header KeyValue.
wordData = wordData & 0x00FF;
wordData |= Parallel_GetWordData_16bit() << 8;
if(wordData == EIGHT_BIT_HEADER)
{
// Assign GetWordData to the parallel 8bit version of the
// function.
GetWordData is a pointer to a function.
GetWordData = Parallel_GetWordData_8bit;
return EIGHT_BIT;
}
// Didn't find a 16-bit or an 8-bit KeyVal header so return an error.
else return ERROR;
}
//#################################################
// Uint16 Parallel_GetWordData_16bit()
// Uint16 Parallel_GetWordData_8bit()
//-----------------------------------------------
// This routine fetches a 16-bit word from the
// GP I/O port.
The 16bit function is used if the
// input 16-bits and the function fetches a
// single word and returns it to the host.
//
// The _8bit function is used if the input stream is
// an 8-bit input stream and the upper 8-bits of the
76
Bootloader Code Overview
SPRU722C – November 2004 – Revised October 2006