diff --git a/arch/x86/scc/icc.c b/arch/x86/scc/icc.c index 05292396..2cb97066 100644 --- a/arch/x86/scc/icc.c +++ b/arch/x86/scc/icc.c @@ -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); diff --git a/kernel/Makefile b/kernel/Makefile index fdddee71..f70f6a77 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -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 diff --git a/kernel/mailbox.c b/kernel/mailbox.c new file mode 100644 index 00000000..f34f9e1a --- /dev/null +++ b/kernel/mailbox.c @@ -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 +#include +#include +#include +#include +#include +#include +#ifdef CONFIG_ROCKCREEK +#include + +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 diff --git a/kernel/main.c b/kernel/main.c index daf7f3af..ac65706f 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -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();