Milos RTOS v0.3.4a
Real Time Operating System
ethtest/main.c
Go to the documentation of this file.
00001 #include <core/system.h>
00002 #include <core/thread.h>
00003 #include <core/device.h>
00004 #include <net/netif.h>
00005 #include <net/socket.h>
00006 
00007 __STATIC __PTERMINAL appTerm;
00008 
00009 /*
00010  * Thread 1
00011  */
00012 __VOID threadTest1(__VOID)
00013 {
00014     __PDEVICE eth;
00015     __PNETIF ethif;
00016     __PSOCKET sock;
00017 
00018     eth = __deviceFind("eth1");
00019     ethif = __netifInit(__NETIF_ETH, eth, __NULL, __NULL, __NULL);
00020 
00021     if (ethif)
00022     {
00023         sock = __socketCreate(__SOCK_TYPE_UDP, 6000);
00024         appTerm = __terminalCreate("udpterm", sock, sock, 200, "udpterm> ", __TERMINAL_DEBUG_COMMANDS);
00025         __terminalStart(appTerm);
00026     }
00027 
00028     for (;;)
00029     {
00030         __threadSleep(1);
00031     }
00032 }
00033 
00034 /*
00035  * Thread 2
00036  */
00037 __VOID threadTest2(__VOID)
00038 {
00039     for (;;)
00040     {
00041         __threadSleep(1);
00042     }
00043 }
00044 
00048 __VOID appEntry(__VOID)
00049 {
00050     __threadCreate("test1", threadTest1, 80, 1024, 1, __NULL);
00051     __threadCreate("test2", threadTest2, 81, 512, 1, __NULL);
00052 }
00053 
00057 int main(void)
00058 {
00059     __systemInit(appEntry);
00060     return 0;
00061 }
 All Data Structures Files Functions Variables Typedefs Defines