*/
#include <cpu/irq.h>
+#include <drv/timer.h>
#include "io/lm3s.h"
-#include "drv/timer_lm3s.h"
-extern unsigned long ticks;
-
-int main(void)
+static void led_init(void)
{
- kdbg_init();
- timer_hw_init();
-
/* Enable the GPIO port that is used for the on-board LED */
SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOG;
/*
/* Enable the GPIO pin for the LED */
GPIO_PORTG_DIR_R = 0x04;
GPIO_PORTG_DEN_R = 0x04;
+}
+
+static void led_on(void)
+{
+ GPIO_PORTG_DATA_R |= 0x04;
+}
+
+static void led_off(void)
+{
+ GPIO_PORTG_DATA_R &= ~0x04;
+}
+
+static NORETURN void spinner_thread(void)
+{
+ char spinner[] = {'/', '-', '\\', '|'};
+ int i;
+
+ kputs("\n");
+ for(i = 0; ; i++)
+ {
+ kprintf("BeRTOS is up & running: %c\r",
+ spinner[i % countof(spinner)]);
+ timer_delay(100);
+ }
+}
+
+int main(void)
+{
+ IRQ_ENABLE;
+ led_init();
+
+ proc_testSetup();
+ proc_testRun();
+ proc_new(spinner_thread, NULL, KERN_MINSTACKSIZE, NULL);
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;
+ led_on();
+ timer_delay(250);
+ led_off();
+ timer_delay(250);
}
}