add mailbox test

This commit is contained in:
Simon Pickartz 2011-05-31 02:55:40 -07:00
parent d1fd6d151f
commit 3cf792d250
4 changed files with 66 additions and 3 deletions

View file

@ -230,6 +230,25 @@ int icc_ping(int ue)
return 0;
}
int icc_mail_ping( void )
{
int remote_rank = (my_ue+1)%2;
// send mail
iRCCE_mail_send( 0, my_ue, 0, NULL, remote_rank );
// wait for mail from remote rank
iRCCE_MAIL_HEADER* mail;
do {
iRCCE_mail_recv( &mail );
} while( !mail );
// show content
iRCCE_mailbox_print_header( mail );
return 0;
}
static void interpret_header(icc_header_t* header, int recv_ue)
{
//kprintf("Got ICC message %d from %d\n", header->type, recv_ue);

View file

@ -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 mailbox.c
MODULE := kernel
include $(TOPDIR)/Makefile.inc

44
kernel/mailbox.c Normal file
View file

@ -0,0 +1,44 @@
/*
* Copyright 2010 Stefan Lankes, Chair for Operating Systems,
* RWTH Aachen University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of MetalSVM.
*/
#include <metalsvm/stddef.h>
#include <metalsvm/stdio.h>
#include <metalsvm/time.h>
#include <metalsvm/tasks.h>
#include <metalsvm/semaphore.h>
#include <metalsvm/mailbox.h>
#include <metalsvm/syscall.h>
#ifdef CONFIG_ROCKCREEK
#include <asm/icc.h>
int STDCALL mail_ping(void* arg) {
icc_mail_ping();
return 0;
}
int mailbox_test_init(void)
{
char* argv[] = {"/bin/mailbox", NULL};
create_user_task(NULL, "/bin/mailbox", argv);
return 0;
}
#endif

View file

@ -35,7 +35,7 @@
#endif
extern int test_init(void);
extern int mailbox_test_init(void);
/*
* Note that linker symbols are not variables, they have no memory allocated for
* maintaining a value, rather their address is their value.
@ -115,7 +115,7 @@ int main(void)
sleep(5);
list_root();
test_init();
mailbox_test_init();
per_core(current_task)->status = TASK_IDLE;
reschedule();