void InitMcbspGpio(void)
{
	InitMcbspaGpio();
	#if DSP28_MCBSPB
	  InitMcbspbGpio();
	#endif               // end DSP28_MCBSPB
}
//
// Main
//
void main(void)
{
//
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the F2837xS_SysCtrl.c file.
//
   InitSysCtrl();

//
// Step 2. Initialize GPIO:
// This example function is found in the F2837xS_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// For this example, only enable the GPIO for McBSP-A
//
   InitMcbspaGpio();

//
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
//
   DINT;

//
// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the F2837xS_PieCtrl.c file.
//
   InitPieCtrl();

//
// Disable CPU interrupts and clear all CPU interrupt flags:
//
   IER = 0x0000;
   IFR = 0x0000;

//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example.  This is useful for debug purposes.
// The shell ISR routines are found in F2837xS_DefaultIsr.c.
// This function is found in F2837xS_PieVect.c.
//
   InitPieVectTable();

//
// Step 4. User specific code
//
   init_mcbsp_spi();
   sdata1 = 0x55aa;
   sdata2 = 0xaa55;

//
// Main loop to transfer 32-bit words through MCBSP in SPI mode periodically
//
   for(;;)
   {
        mcbsp_xmit(sdata1,sdata2);

        //
        // Master waits until RX data is ready
        //
        while( McbspaRegs.SPCR1.bit.RRDY == 0 ) {}
        rdata2 = McbspaRegs.DRR2.all;   // Read DRR2 first.
        rdata1 = McbspaRegs.DRR1.all;   // Then read DRR1 to complete
                                        // receiving of data.

        //
        // Check that correct data is received.
        //
        if((rdata2 != sdata2)&&(rdata1 != sdata1))
        {
            error( );
        }

        delay_loop();

        sdata1^=0xFFFF;
        sdata2^=0xFFFF;

       __asm("    nop");                // Good place for a breakpoint
   }
}
//
// Main
//
void main(void)
{
//
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the F2837xS_SysCtrl.c file.
//
   InitSysCtrl();

//
// Step 2. Initialize GPIO:
// This example function is found in the F2837xS_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// Setup only the GP I/O only for McBSP-A functionality
//
   InitMcbspaGpio();

//
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
//
   DINT;

//
// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the F2837xS_PieCtrl.c file.
//
   InitPieCtrl();

//
// Disable CPU interrupts and clear all CPU interrupt flags:
//
   IER = 0x0000;
   IFR = 0x0000;

//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example.  This is useful for debug purposes.
// The shell ISR routines are found in F2837xS_DefaultIsr.c.
// This function is found in F2837xS_PieVect.c.
//
   InitPieVectTable();

//
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
//
   EALLOW;    // Allow access to EALLOW protected registers
   PieVectTable.MCBSPA_RX_INT = &Mcbsp_RxINTA_ISR;
   PieVectTable.MCBSPA_TX_INT = &Mcbsp_TxINTA_ISR;
   EDIS;      // Disable access to EALLOW protected registers

//
// Step 4. Initialize the Device Peripherals:
//
   mcbsp_init_dlb();      // For this example, only initialize the Mcbsp

//
// Step 5. User specific code, enable interrupts:
//
   sdata = 0;
   rdata_point = sdata;

//
// Enable interrupts required for this example
//
   PieCtrlRegs.PIECTRL.bit.ENPIE = 1;   // Enable the PIE block
   PieCtrlRegs.PIEIER6.bit.INTx5 = 1;   // Enable PIE Group 6, INT 5
   PieCtrlRegs.PIEIER6.bit.INTx6 = 1;   // Enable PIE Group 6, INT 6
   IER = 0x20;                          // Enable CPU INT6
   EINT;                                // Enable Global Interrupts

//
// Step 6. IDLE loop. Just sit and loop forever (optional):
//
   for(;;);
}
Exemplo n.º 4
0
void InitMcbspGpio(void)
{
    InitMcbspaGpio();
}