examples/lpc2378/main.c \
bertos/drv/timer.c \
bertos/drv/timer_test.c \
+ bertos/drv/ser.c \
+ bertos/cpu/arm/drv/ser_lpc2.c \
bertos/cpu/arm/drv/vic_lpc2.c \
bertos/cpu/arm/drv/timer_lpc2.c \
bertos/mware/event.c \
+ bertos/kern/kfile.c \
bertos/kern/proc.c \
bertos/kern/proc_test.c \
bertos/kern/monitor.c \
#include <cpu/irq.h>
#include <cfg/debug.h>
#include <drv/timer.h>
+#include <drv/ser.h>
#include <io/lpc23xx.h>
+#define PRIO_HIGH 1
+#define PRIO_LOW 0
+
#define STATUS_LED (1<<19)
#define LED_ON() do { IOCLR1 = STATUS_LED; } while (0)
#define LED_OFF() do { IOSET1 = STATUS_LED; } while (0)
+static Serial ser_port;
+
static void init(void)
{
IRQ_ENABLE;
kdbg_init();
timer_init();
proc_init();
+
timer_delay(3000);
kprintf("NXP LPC2378 BeRTOS port test\n");
timer_delay(3000);
/* Turn off boot led */
- IODIR0 = (1<<21);
- IOCLR0 = (1<<21);
+ IODIR0 = (1<<21);
+ IOCLR0 = (1<<21);
/* Init status led */
IODIR1 |= STATUS_LED;
LED_OFF();
}
+static void NORETURN ser_prompt(void)
+{
+ char buf[32];
+ int i;
+
+ ser_init(&ser_port, SER_UART1);
+ ser_setbaudrate(&ser_port, 115200);
+
+ /* BeRTOS "echo" terminal */
+ kfile_printf(&ser_port.fd, "\n\rBeRTOS echo terminal\n\r");
+ proc_setPri(proc_current(), PRIO_HIGH);
+ for (i = 0; ; i++)
+ {
+ kfile_printf(&ser_port.fd, "\n\r[%03d] BeRTOS:~$ ", i);
+ kfile_gets_echo(&ser_port.fd, buf, sizeof(buf), true);
+ kfile_printf(&ser_port.fd, "%s", buf);
+ }
+}
+
static void NORETURN bertos_up(void)
{
char spinner[] = {'/', '-', '\\', '|'};
{
LED_ON();
timer_delay(250);
-
+
LED_OFF();
timer_delay(250);
}
init();
proc_testRun();
proc_new(bertos_up, NULL, KERN_MINSTACKSIZE * 3, NULL);
+ proc_new(ser_prompt, NULL, KERN_MINSTACKSIZE * 3, NULL);
proc_new(status, NULL, 0, NULL);
while (1)
{
return 0;
}
-