00001
00083 #include <stdio.h>
00084 #include <io.h>
00085
00086 #include <cfg/arch.h>
00087 #include <dev/board.h>
00088
00089 #include <sys/thread.h>
00090 #include <sys/timer.h>
00091
00092
00093
00094
00095 THREAD(Thread1, arg)
00096 {
00097
00098
00099
00100 NutThreadSetPriority(16);
00101 for (;;) {
00102 putchar('H');
00103 NutSleep(125);
00104 }
00105 }
00106
00107
00108
00109
00110 THREAD(Thread2, arg)
00111 {
00112
00113
00114
00115 NutThreadSetPriority(128);
00116 for (;;) {
00117 putchar('L');
00118 NutSleep(125);
00119 }
00120 }
00121
00122
00123
00124
00125 int main(void)
00126 {
00127 u_long baud = 115200;
00128
00129
00130
00131
00132
00133 NutRegisterDevice(&DEV_UART, 0, 0);
00134 freopen(DEV_UART_NAME, "w", stdout);
00135 _ioctl(_fileno(stdout), UART_SETSPEED, &baud);
00136
00137 puts("\nThread Test");
00138
00139
00140
00141
00142
00143 NutThreadCreate("t1", Thread1, 0, 512);
00144 NutThreadCreate("t2", Thread2, 0, 512);
00145
00146
00147
00148
00149 for (;;) {
00150 putchar('M');
00151 NutSleep(125);
00152 }
00153 }