...
This commit is contained in:
parent
d0d62f5021
commit
47d9b41520
3 changed files with 81 additions and 11 deletions
|
@ -491,7 +491,7 @@ __inline void* mmnif_shmalloc()
|
|||
/* We choose a arbitrary address first
|
||||
* until i know how to properly allocate shared memory
|
||||
*/
|
||||
RCCE_shmalloc_init(0x80000000,48*8192);
|
||||
// RCCE_shmalloc_init(0x80000000,48*8192);
|
||||
//mpb_start_address = RCCE_shmalloc(mpb_size*MMNIF_CORES);
|
||||
//mpb_start_address = 0x8000000+ mpb_size * (own_ip_address - router_ip_address);
|
||||
//SHMalloc(&mpb_start_address);
|
||||
|
@ -841,7 +841,7 @@ err_t mmnif_init(struct netif* netif)
|
|||
DEBUGPRINTF("mmnif init(): allocating shared memory failed\n");
|
||||
return ERR_MEM;
|
||||
}
|
||||
memset(mmnif->rx_buff, 0, (sizeof(mm_rx_buffer_t) + MMNIF_RX_QUEUELEN* MMNIF_RX_BUFFERLEN)* (MMNIF_CORES-1));
|
||||
memset(mmnif->rx_buff, 0, sizeof(mm_rx_buffer_t) + MMNIF_RX_QUEUELEN* MMNIF_RX_BUFFERLEN);
|
||||
|
||||
/* init the lock for the hdr
|
||||
*/
|
||||
|
@ -1101,8 +1101,9 @@ static int mmnif_wait(struct netif* netif, uint32_t poll, int budget)
|
|||
*/
|
||||
int mmnif_worker(void* e)
|
||||
{
|
||||
#ifdef MMNIF_DEUBG
|
||||
DEBUGPRINTF("Waiting for work to do!!!\n");
|
||||
|
||||
#endif
|
||||
while (active)
|
||||
mmnif_wait(mmnif_dev,0,MMNIF_WORKER_BUDGET);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
C_source := main.c tasks.c syscall.c tests.c echo.c ping.c init.c
|
||||
C_source := main.c tasks.c syscall.c tests.c echo.c ping.c init.c server.c client.c
|
||||
MODULE := kernel
|
||||
|
||||
include $(TOPDIR)/Makefile.inc
|
||||
|
|
|
@ -26,6 +26,15 @@
|
|||
#include <metalsvm/syscall.h>
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
#include <asm/icc.h>
|
||||
#include "server.h"
|
||||
#include "client.h"
|
||||
#include <asm/RCCE_lib.h>
|
||||
#include <asm/RCCE.h>
|
||||
#include <asm/RCCE_lib.h>
|
||||
#include <asm/iRCCE.h>
|
||||
#include <asm/iRCCE_lib.h>
|
||||
|
||||
#include <asm/SCC_API.h>
|
||||
#endif
|
||||
|
||||
static sem_t consuming, producing;
|
||||
|
@ -119,27 +128,87 @@ static int STDCALL join_test(void* arg)
|
|||
|
||||
void ping_send_now();
|
||||
|
||||
__inline int get_core_no(void)
|
||||
{
|
||||
unsigned int tmp;
|
||||
unsigned int pid;
|
||||
unsigned int x,y,z;
|
||||
/* Determine the local IP address from the core number in the
|
||||
* tile ID register
|
||||
*/
|
||||
tmp = ReadConfigReg(local_crb + RCK_TILEID);
|
||||
x = (tmp>>3) & 0x0f; /* bits 06:03 */
|
||||
y = (tmp>>7) & 0x0f; /* bits 10:07 */
|
||||
z = (tmp ) & 0x07; /* bits 02:00 */
|
||||
pid = 12*y + 2*x + z;
|
||||
/* Add 1 to the processor ID to avoid *.*.*.0 IP addresses */
|
||||
return pid;
|
||||
}
|
||||
|
||||
void* server_task(void* e)
|
||||
{
|
||||
int i = 0;
|
||||
char msg[7][60] ={"Hello you0 i have muc fun thogh!","Hello you1 here is a little smily for you!","Hello you2 whaaaaaaaaaaaaaaaaaaaaaaaaats uuuuuuuuuuuuuuuuuuuuuuuuuuuuup!","Hello you3! see this? this is fun ufun funfunfunfunf","Hello you4!"
|
||||
,"Hello you5! ogogogogoogoggoogogogogogog","Hello you6!AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAa"};
|
||||
|
||||
server_init(5555,2);
|
||||
Sleep(500);
|
||||
srv_sendBuffer(0,"Hello you!",sizeof("Hello you!"));
|
||||
Sleep(800);
|
||||
|
||||
while(1)
|
||||
{
|
||||
srv_sendBuffer(0,msg[i],sizeof(msg[i]));
|
||||
i = (++i) % 7;
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* client_task(void* e)
|
||||
{
|
||||
client_init();
|
||||
Sleep(1000);
|
||||
while (
|
||||
cli_ConnectTo("192.168.0.1",5555,0));
|
||||
Sleep(1000);
|
||||
cli_sendBuffer("Hallo Welt",sizeof("Hallo Welt"));
|
||||
Sleep(2000);
|
||||
while(1)
|
||||
{
|
||||
cli_sendBuffer(netbuffer,sizeof(netbuffer));
|
||||
Sleep(1000);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int test_init(void)
|
||||
{
|
||||
char* argv[] = {"/bin/tests", NULL};
|
||||
if ("get_core_no())
|
||||
create_kernel_task(NULL,server_task,NULL);
|
||||
else
|
||||
create_kernel_task(NULL,client_task,NULL);
|
||||
|
||||
sem_init(&producing, 1);
|
||||
sem_init(&consuming, 0);
|
||||
mailbox_int32_init(&mbox);
|
||||
// char* argv[] = {"/bin/tests", NULL};
|
||||
|
||||
create_kernel_task(NULL, foo, "Hello from foo1\n");
|
||||
// sem_init(&producing, 1);
|
||||
// sem_init(&consuming, 0);
|
||||
// mailbox_int32_init(&mbox);
|
||||
|
||||
// create_kernel_task(NULL, foo, "Hello from foo1\n");
|
||||
//create_kernel_task(NULL, join_test, NULL);
|
||||
//create_kernel_task(NULL, producer, NULL);
|
||||
//create_kernel_task(NULL, consumer, NULL);
|
||||
//create_kernel_task(NULL, ping, NULL);
|
||||
//create_user_task(NULL, "/bin/hello", argv);
|
||||
create_user_task(NULL, "/bin/tests", argv);
|
||||
// create_user_task(NULL, "/bin/tests", argv);
|
||||
//create_user_task(NULL, "/bin/jacobi", argv);
|
||||
//create_user_task(NULL, "/bin/jacobi", argv);
|
||||
|
||||
#ifdef CONFIG_LWIP
|
||||
// use ping to test LWIP
|
||||
ping_send_now();
|
||||
// ping_send_now();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue