URL
https://opencores.org/ocsvn/plasma/plasma/trunk
[/] [plasma/] [trunk/] [kernel/] [dlltest.c] - Diff between revs 359 and 416
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 359 |
Rev 416 |
Line 1... |
Line 1... |
// dlltest.c
|
// dlltest.c
|
// Compile this program with "make dlltest".
|
// Compile this program with "make dlltest".
|
// Then ftp test.bin to /flash/bin/dlltest.
|
// Then ftp dlltest.axf to /flash/bin/dlltest.
|
// Then from a telnet prompt type "dlltest".
|
// Then from a telnet prompt type "dlltest".
|
#include "dll.h"
|
#include "dll.h"
|
|
|
|
int a, b=7;
|
|
|
void SocketReceive(IPSocket *socket)
|
int main(int argc, char *argv[])
|
{
|
{
|
|
int i=40;
|
|
printf("Hello from dlltest! a=%d b=%d\n", a, b);
|
|
if(argc > 1)
|
|
printf("arg=%s\n", argv[1]);
|
|
printf("Enter a number\n");
|
|
scanf("%d", &i);
|
|
printf("i=%d\n", i);
|
|
return 0;
|
}
|
}
|
|
|
|
|
void MyThread(void *sock)
|
|
{
|
|
char buf[80];
|
|
int i, bytes;
|
|
IPSocket *socket = sock;
|
|
|
|
for(i = 0; i < 10; ++i)
|
|
{
|
|
bytes = IPRead(socket, buf, sizeof(buf)-1);
|
|
buf[bytes] = 0;
|
|
IPPrintf(socket, "%d %s\n", i, buf);
|
|
OS_ThreadSleep(100);
|
|
}
|
|
socket->funcPtr = socket->userFunc; //restore socket receive function
|
|
}
|
|
|
|
|
|
// Function shouldn't block
|
|
void Start(IPSocket *socket, char *argv[])
|
|
{
|
|
IPPrintf(socket, "Hello from dlltest\n");
|
|
socket->userFunc = socket->funcPtr; //remember prev socket receive func
|
|
socket->funcPtr = SocketReceive; //new socket receive function
|
|
OS_ThreadCreate("MyThread", MyThread, socket, 100, 0);
|
|
}
|
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.