add mail_ping interrupt test-scenario

This commit is contained in:
Simon Pickartz 2011-06-07 12:38:35 +02:00
parent 240abdef8c
commit 570b559b5e
2 changed files with 44 additions and 11 deletions

View file

@ -235,30 +235,46 @@ int icc_ping(int ue)
int icc_mail_ping( void )
{
uint32_t flags;
uint64_t timer;
int remote_rank = (my_ue+1)%2;
kprintf( "#### Hello from icc_mail_ping\n" );
if( !my_rank ) {
return 0;
}
// iRCCE is not thread save => disable interrupts
flags = irq_nested_disable();
// send mail
iRCCE_mail_send( 0, my_ue, 0, NULL, remote_rank );
kprintf( "### Message sent ...\n" );
// start timer
timer = rdtsc();
// wait for mail from remote rank
iRCCE_mail_send( 0, 1, 0, NULL, remote_rank );
kprintf( "Sent pingrequest to %d ...\n", remote_rank );
// wait for response
iRCCE_MAIL_HEADER* mail;
do {
iRCCE_mail_recv( &mail );
} while( !mail );
// show content
iRCCE_mailbox_print_header( mail );
// stop timer
timer = rdtsc() - timer;
if( mail->tag == 2 ) {
kprintf( "Response received in %d ticks!\n", timer );
}
else {
krpintf( "Response didn't arrive!\n" );
}
irq_nested_enable(flags);
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);
@ -325,4 +341,20 @@ void icc_check(void)
iRCCE_isend_push();
}
void icc_mail_check(void)
{
iRCCE_MAIL_HEADER* header;
int res;
// empty mailbox and interpret headers
do {
res = iRCCE_mail_recv( &header );
if( header->tag == 1 ) {
iRCCE_mail_send( 0, 2, 0, NULL, header->source );
}
iRCCE_mail_release( &header );
} while( res == iRCCE_SUCCESS );
}
#endif

View file

@ -143,7 +143,8 @@ static inline void check_workqueues(void)
uint32_t flags = irq_nested_disable();
#ifdef CONFIG_ROCKCREEK
icc_check();
//icc_check();
icc_mail_check();
#endif
irq_nested_enable(flags);