/******************************************************************************* * FILENAME * blink.c * * DESCRIPTION * DSK DSP Program * * Rev 2.10 03 Jun 2000 T.J.Dillon - removed SDRAM parameters * *******************************************************************************/ #include #include #include #include #include #include #include #define DELAY_TIME 500 /******************************************************************************* * Function prototypes *******************************************************************************/ void delay_msec(Uint32 msec); /******************************************************************************* * Global variables * *******************************************************************************/ TIMER_Handle hTimer; TIMER_Config myTimerConfig = { 0x00000300, /* CTL register - CPU CLK/4 */ 0xFFFFFFFF, /* PRD register */ 0x00000000 /* CNT register */ }; /******************************************************************************* * FUNCTION : main * * ARGUMENTS : * VOID * * DESCRIPTION : * The code is just a blinker test function * *******************************************************************************/ void main() { Uint32 i; /* Initialize the chip support and board support libraries, required */ CSL_init(); BSL_init(); /* DSP initialization */ IRQ_globalDisable(); for(i=0;i<32;i++){ IRQ_disable(i); /* Disable and clear all IRQ events */ IRQ_clear(i); /* except reset and NMI interrupts */ } /******************************************************************************\ * CONFIGURE EMIF * \******************************************************************************/ EMIF_configArgs(0x00003300, /* EMIF global control register */ 0xFFFFFF30, /* CE0 - SDRAM */ 0xFFFFFF23, /* CE1 - 32-bit asynch */ 0xFFFFFF23, /* CE2 - 32-bit asynch on daughterboard */ 0xFFFFFF23, /* CE3 - 32-bit asynch on daughterboard */ 0x07117000, /* SDRAM control register (100 MHz) */ 0x0000061A, /* SDRAM Timing register */ 0x00054519 /* SDRAM Extension register */ ); /******************************************************************************\ * INITIALIZE TIMER * \******************************************************************************/ hTimer = TIMER_open(TIMER_DEVANY, TIMER_OPEN_RESET); TIMER_config(hTimer, &myTimerConfig); TIMER_start(hTimer); TIMER_pause(hTimer); /***************************************************************************** * Begin LED counting sequence ****************************************************************************/ delay_msec(50); LED_off(LED_ALL); /* Turn off all user LEDs */ delay_msec(DELAY_TIME); LED_on(LED_1); /* Display 1 on LEDs */ delay_msec(DELAY_TIME); LED_off(LED_ALL); /* Display 2 on LEDs */ LED_on(LED_2); delay_msec(DELAY_TIME); LED_off(LED_ALL); /* Display 3 on LEDs */ LED_on(LED_1); LED_on(LED_2); delay_msec(DELAY_TIME); LED_off(LED_ALL); /* Display 4 on LEDs */ LED_on(LED_3); delay_msec(DELAY_TIME); LED_off(LED_ALL); /* Display 5 on LEDs */ LED_on(LED_1); LED_on(LED_3); delay_msec(DELAY_TIME); LED_off(LED_ALL); /* Display 6 on LEDs */ LED_on(LED_2); LED_on(LED_3); delay_msec(DELAY_TIME); /***************************************************************************** * Flash LEDS forever (Display 7) *****************************************************************************/ for (;;){ LED_off(LED_ALL); delay_msec(DELAY_TIME); LED_on(LED_ALL); delay_msec(DELAY_TIME); } } /******************************************************************************* * FUNCTION : delay_msec * * ARGUMENTS : * Uint32 msec <-- Period to delay in milliseconds * * DESCRIPTION : * * * OUTPUTS : * VOID * *******************************************************************************/ void delay_msec(Uint32 msec){ /* Assume 150 MHz CPU, timer peirod = 4/150 MHz */ Uint32 timer_limit; Uint32 timer_start; timer_limit = ((Uint32)msec*9375)<<2; timer_start = TIMER_getCount(hTimer); TIMER_resume(hTimer); while ( (TIMER_getCount(hTimer) - timer_start) < timer_limit ); TIMER_pause(hTimer); }