X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=examples%2Flm3s1968%2Flm3s1968.c;h=6316ad18373e09b0c9c1e795c35538b945f2c255;hb=b8a137380f022b894587295607cc4dc3f0e7fb00;hp=514f255ca5201c080cfd51e87ae3fc4448a1580f;hpb=24c21c92d29b76a3f0de0a107f4bafef7bb0f812;p=bertos.git diff --git a/examples/lm3s1968/lm3s1968.c b/examples/lm3s1968/lm3s1968.c index 514f255c..6316ad18 100644 --- a/examples/lm3s1968/lm3s1968.c +++ b/examples/lm3s1968/lm3s1968.c @@ -26,24 +26,43 @@ * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. * - * Copyright 2007 Develer S.r.l. (http://www.develer.com/) + * Copyright 2010 Develer S.r.l. (http://www.develer.com/) * * --> * - * \version $Id$ + * \brief LM3S1968 Cortex-M3 testcase * - * \author Manuele Fanelli - * - * \brief LM3S168 porting test. + * \author Andrea Righi */ -#include "bertos/cpu/detect.h" +#include +#include "io/lm3s.h" +#include "drv/timer.h" + +extern unsigned long ticks; -int main (void) +int main(void) { - int c; + timer_hw_init(); + + /* Enable the GPIO port that is used for the on-board LED */ + SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOG; + /* + * Perform a dummy read to insert a few cycles delay before enabling + * the peripheral. + */ + (void)SYSCTL_RCGC2_R; + /* Enable the GPIO pin for the LED */ + GPIO_PORTG_DIR_R = 0x04; + GPIO_PORTG_DEN_R = 0x04; - for (;;) - c++; - return 0; + while(1) + { + /* Turn on the LED */ + if ((ticks & 0x04) == 0x04) + GPIO_PORTG_DATA_R |= 0x04; + /* Turn off the LED */ + else if ((ticks & 0x04) == 0) + GPIO_PORTG_DATA_R &= ~0x04; + } }