7 #include <BoardConsole.h>
15 #include <lwip/inet.h>
37 static void setupLEDs() {
41 static void litLED(
int led,
int value) {
42 if ((led > 4) || (led < 1))
59 static void ledTask(
void *p) {
63 case 0: litLED(1, 1); litLED(2, 0); litLED(3, 0); litLED(4, 0);
break;
64 case 1: litLED(1, 0); litLED(2, 1); litLED(3, 0); litLED(4, 0);
break;
65 case 2: litLED(1, 0); litLED(2, 0); litLED(3, 1); litLED(4, 0);
break;
66 case 3: litLED(1, 0); litLED(2, 0); litLED(3, 0); litLED(4, 1);
break;
75 #ifdef SHOW_SIMPLE_TASKS
76 static void simpleTask1(
void *p) {
85 static void simpleTask2(
void *p) {
96 static void badTask(
void *x) {
98 char * p = (
char *) 0x10000000;
103 static const char msg[] =
"Hello world - from fwrite!\r\n";
109 static struct netif board_netif;
114 static void net_init() {
121 inet_aton(
"192.168.1.2", &board_ip.addr);
123 inet_aton(
"255.255.255.0", &netmask.addr);
129 fprintf(
stderr,
"net_init: netif_add(lpc17xx_if_init) failed.\r\n");
135 printf(
"Starting DHCP query\n");
136 dhcp_start(&board_netif);
145 static void lwip_task(
void * p) {
150 uint32_t currentIP = board_netif.ip_addr.addr;
154 sys_check_timeouts();
155 if (board_netif.ip_addr.addr != currentIP) {
156 currentIP = board_netif.ip_addr.addr;
157 printf(
"got an IP address: %i.%i.%i.%i\n",
158 (board_netif.ip_addr.addr >> 0) & 0xff,
159 (board_netif.ip_addr.addr >> 8) & 0xff,
160 (board_netif.ip_addr.addr >> 16) & 0xff,
161 (board_netif.ip_addr.addr >> 24) & 0xff);
166 void ENET_IRQHandler() {
167 uint32_t status =
LPC_EMAC->IntStatus;
186 printf(
"Hello world - from stdio!\r\n");
188 f1 = fopen(
"/dev/stdout",
"w");
189 fprintf(
stderr,
"f1 = %p\r\n", f1);
190 fwrite(msg, 1,
sizeof(msg), f1);
191 f2 = fopen(
"/romfs/test.txt",
"r");
192 c = fread(buf, 1, 32, f2);
193 fwrite(buf, 1, c, f1);
195 FILE * f3 = fopen(
"/host/TEST.TXT",
"r");
196 c = fread(buf, 1, 32, f3);
197 fwrite(buf, 1, c, f1);
210 printf(
"Test: %f\n", 12.3456f);
212 #ifdef SHOW_SIMPLE_TASKS