OpenCores
URL https://opencores.org/ocsvn/plasma/plasma/trunk

Subversion Repositories plasma

[/] [plasma/] [trunk/] [kernel/] [dlltest.c] - Blame information for rev 402

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 359 rhoads
// dlltest.c
2
// Compile this program with "make dlltest".  
3
// Then ftp test.bin to /flash/bin/dlltest.
4
// Then from a telnet prompt type "dlltest".
5
#include "dll.h"
6
 
7
 
8
void SocketReceive(IPSocket *socket)
9
{
10
}
11
 
12
 
13
void MyThread(void *sock)
14
{
15
   char buf[80];
16
   int i, bytes;
17
   IPSocket *socket = sock;
18
 
19
   for(i = 0; i < 10; ++i)
20
   {
21
      bytes = IPRead(socket, buf, sizeof(buf)-1);
22
      buf[bytes] = 0;
23
      IPPrintf(socket, "%d %s\n", i, buf);
24
      OS_ThreadSleep(100);
25
   }
26
   socket->funcPtr = socket->userFunc;  //restore socket receive function
27
}
28
 
29
 
30
// Function shouldn't block
31
void Start(IPSocket *socket, char *argv[])
32
{
33
   IPPrintf(socket, "Hello from dlltest\n");
34
   socket->userFunc = socket->funcPtr;  //remember prev socket receive func
35
   socket->funcPtr = SocketReceive;     //new socket receive function
36
   OS_ThreadCreate("MyThread", MyThread, socket, 100, 0);
37
}
38
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.