merge
This commit is contained in:
commit
7045bc208b
6 changed files with 56 additions and 20 deletions
|
@ -53,6 +53,7 @@ typedef struct {
|
|||
int icc_init(void);
|
||||
int icc_ping(int ue);
|
||||
void icc_check(void);
|
||||
void icc_mail_check(void);
|
||||
int icc_halt(void);
|
||||
int icc_mail_ping(void);
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ void irq_handler(struct state *s)
|
|||
void (*handler) (struct state * s);
|
||||
|
||||
// at first, we check our work queues
|
||||
check_workqueues();
|
||||
if( s->int_no == 124 ) check_workqueues();
|
||||
|
||||
/*
|
||||
* Find out if we have a custom handler to run for this
|
||||
|
|
|
@ -235,36 +235,50 @@ 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_ue ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// iRCCE is not thread save => disable interrupts
|
||||
flags = irq_nested_disable();
|
||||
|
||||
// start timer
|
||||
uint64_t timer = rdtsc();
|
||||
|
||||
// send mail
|
||||
iRCCE_mail_send( 0, my_ue, 0, NULL, remote_rank );
|
||||
|
||||
// wait for mail from remote rank
|
||||
// start timer
|
||||
timer = rdtsc();
|
||||
|
||||
iRCCE_mail_send( 0, 1, 0, NULL, remote_rank );
|
||||
kprintf( "Sent pingrequest to %d ...\n", remote_rank );
|
||||
|
||||
|
||||
// wake up receiver
|
||||
icc_send_irq( remote_rank );
|
||||
|
||||
// wait for response
|
||||
iRCCE_MAIL_HEADER* mail;
|
||||
do {
|
||||
iRCCE_mail_recv( &mail );
|
||||
} while( !mail );
|
||||
|
||||
timer = rdtsc() - timer;
|
||||
|
||||
kprintf( "Received mail in %d ticks!\n", timer );
|
||||
// stop timer
|
||||
timer = rdtsc() - timer;
|
||||
|
||||
if( mail->tag == 2 ) {
|
||||
kprintf( "Response received in %d ticks!\n", timer );
|
||||
}
|
||||
else {
|
||||
kprintf( "Response didn't arrive!\n" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// show content
|
||||
iRCCE_mailbox_print_header( mail );
|
||||
|
||||
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);
|
||||
|
@ -331,4 +345,24 @@ void icc_check(void)
|
|||
iRCCE_isend_push();
|
||||
}
|
||||
|
||||
void icc_mail_check(void)
|
||||
{
|
||||
if( !my_ue ) return ;
|
||||
|
||||
iRCCE_MAIL_HEADER* header;
|
||||
int res;
|
||||
|
||||
kprintf( "Hello from icc_mail_check() \n" );
|
||||
// empty mailbox and interpret headers
|
||||
do {
|
||||
res = iRCCE_mail_recv( &header );
|
||||
if( header->tag == 1 ) {
|
||||
kprintf( "Received mail_ping request ...\n" );
|
||||
iRCCE_mail_send( 0, 2, 0, NULL, header->source );
|
||||
}
|
||||
|
||||
iRCCE_mail_release( &header );
|
||||
} while( res == iRCCE_SUCCESS );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -40,7 +40,6 @@ int STDCALL mail_ping(void* arg) {
|
|||
int mailbox_test_init(void)
|
||||
{
|
||||
char* argv[] = {"/bin/mailbox", NULL};
|
||||
kprintf( "### Hello from mailbox_test_init\n" );
|
||||
create_kernel_task(NULL, mail_ping, argv);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -114,11 +114,12 @@ int main(void)
|
|||
|
||||
sleep(5);
|
||||
list_root();
|
||||
//test_init();
|
||||
// test_init();
|
||||
mailbox_test_init();
|
||||
per_core(current_task)->status = TASK_IDLE;
|
||||
reschedule();
|
||||
|
||||
|
||||
while(1) {
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
icc_halt();
|
||||
|
|
Loading…
Add table
Reference in a new issue