/*H***************************************************************************** * * $Archive:: $ * $Revision:: $ * $Date:: $ * $Author:: $ * * DESCRIPTION: * Contains the initializations functions for the mcbsp of the TMS320C5410 * * GLOBALS * * PUBLIC FUNCTIONS: * * PRIVATE FUNCTIONS: * * USAGE/LIMITATIONS: * * NOTES: * * AUTHOR: Patrick Cresap, 2000 * *H***************************************************************************/ #define mcbsp5410_c /*---- compilation control switches ----------------------------------------*/ /***************************************************************************** * INCLUDE FILES *****************************************************************************/ /*---- system and platform files -------------------------------------------*/ /*---- program files -------------------------------------------------------*/ #include "mcbsp5410.h" /***************************************************************************** * EXTERNAL REFERENCE *****************************************************************************/ /*---- data declarations ---------------------------------------------------*/ /*---- function prototypes -------------------------------------------------*/ /***************************************************************************** * PUBLIC DECLARATIONS *****************************************************************************/ /*---- data declarations ---------------------------------------------------*/ volatile unsigned int *SerPortSubAddPtr = (unsigned int *) 0x0038; volatile unsigned int *SerPortSubAddDataPtr = (unsigned int *) 0x0039; /***************************************************************************** * PRIVATE DECLARATIONS *****************************************************************************/ /*---- context -------------------------------------------------------------*/ /*---- data declarations ---------------------------------------------------*/ /*---- function prototypes -------------------------------------------------*/ /*---- macros --------------------------------------------------------------*/ /***************************************************************************** * PUBLIC FUNCTION DEFINITIONS *****************************************************************************/ void SerialPortInit( void ) { unsigned int temp; write_mcbsp0_subreg( SPCR1_sa, I_SPCR1); write_mcbsp0_subreg( SPCR2_sa, I_SPCR2); write_mcbsp0_subreg( RCR1_sa, I_RCR1); write_mcbsp0_subreg( RCR2_sa, I_RCR2); write_mcbsp0_subreg( XCR1_sa, I_XCR1); write_mcbsp0_subreg( XCR2_sa, I_XCR2); /* Enable Reciever */ read_mcbsp0_subreg( SPCR1_sa, &temp); temp |= RRST_s; write_mcbsp0_subreg( SPCR1_sa, temp); /* Enable Transmitter */ read_mcbsp0_subreg( SPCR2_sa, &temp); temp |= XRST_s; write_mcbsp0_subreg( SPCR2_sa, temp); write_mcbsp0_subreg( PCR_sa, I_PCR); } void write_mcbsp0_subreg( unsigned int reg_add, unsigned int reg_val ) { *SerPortSubAddPtr = reg_add; *SerPortSubAddDataPtr = reg_val; } void read_mcbsp0_subreg( unsigned int reg_add, unsigned int *reg_val ) { *SerPortSubAddPtr = reg_add; *reg_val = *SerPortSubAddDataPtr; }