diff --git a/arch/x86/scc/icc.c b/arch/x86/scc/icc.c index ecb71e3a..e0825836 100644 --- a/arch/x86/scc/icc.c +++ b/arch/x86/scc/icc.c @@ -210,7 +210,7 @@ int icc_halt(void) return 0; } -#define ROUNDS 100000 +#define ROUNDS 10000 int icc_mail_ping( void ) { @@ -271,6 +271,61 @@ int icc_mail_ping( void ) return 0; } + +int icc_mail_ping_irq( void ) +{ + /* return if not core 0 */ + if( my_ue ) return; + + uint32_t flags; + uint64_t timer; + int rem_rank = (my_ue+1)%2; + int i; + iRCCE_MAIL_HEADER* recv_header = NULL; + + kprintf( "Hello from mail_ping ... \n" ); + + // disable interrupts + flags = irq_nested_disable(); + + for( i=0; itag == 1 ) { - iRCCE_mail_send( 0, 2, 0, NULL, header->source ); - } - else if( header->tag == iRCCE_ANYLENGTH ) { + switch( header->tag ) { + case iRCCE_ANYLENGTH: recv_buffer = (char*)kmalloc( header->size ); - iRCCE_irecv( recv_buffer, header->size, header->source, NULL ); - iRCCE_mail_send( 0, 2, 0, NULL, header->source ); - } - else if( header->tag == iRCCE_ANYLENGTH_PIGGYBACK ) { - iRCCE_mail_send( 0, 2, 0, NULL, header->source ); + iRCCE_irecv(recv_buffer, header->size, + header->source, NULL ); + iRCCE_mail_send(0, 2, 0, NULL, header->source); + break; + + case iRCCE_ANYLENGTH_PIGGYBACK: + iRCCE_mail_send(0, 2, 0, NULL, header->source); + break; + + case PING_REQ: + iRCCE_mail_send(0, PING_RESP, 0, NULL, header->source); + break; } + iRCCE_mail_release( &header ); } } diff --git a/kernel/tests.c b/kernel/tests.c index e3528a7b..6d5a0e72 100644 --- a/kernel/tests.c +++ b/kernel/tests.c @@ -88,7 +88,8 @@ static int STDCALL foo(void* arg) #ifdef CONFIG_ROCKCREEK int STDCALL mail_ping(void* arg) { - icc_mail_ping(); + // icc_mail_ping(); + icc_mail_ping_irq(); icc_halt(); return 0;