use interrupts+anylength_call now

This commit is contained in:
Simon Pickartz 2011-06-09 04:23:17 -07:00
parent fbd30d8f5a
commit f6fed124b6
6 changed files with 57 additions and 34 deletions

View file

@ -235,10 +235,9 @@ void irq_handler(struct state *s)
void (*handler) (struct state * s);
// at first, we check our work queues
if( s->int_no == 124 ) {
kprintf( "Got remote interrupt!\n" );
// if( s->int_no == 124 ) {
check_workqueues();
}
// }
/*
* Find out if we have a custom handler to run for this

View file

@ -41,6 +41,28 @@
#ifdef CONFIG_ROCKCREEK
#include <asm/iRCCE_lib.h>
#include <asm/SCC_API.h>
static int send_irq(int ue) {
int tmp, x, y, z, addr;
z = Z_PID(RC_COREID[ue]);
x = X_PID(RC_COREID[ue]);
y = Y_PID(RC_COREID[ue]);
addr = CRB_ADDR(x,y) + (z==0 ? GLCFG0 : GLCFG1);
// send interrupt to ue
do {
NOP1;
tmp=ReadConfigReg(addr);
} while(tmp & 2);
tmp |= 2;
SetConfigReg(addr, tmp);
return 0;
}
static int iRCCE_push_send_request(iRCCE_SEND_REQUEST *request) {
@ -240,12 +262,18 @@ int iRCCE_isend(
iRCCE_mail_send( send_size,
iRCCE_ANYLENGTH_PIGGYBACK,
0, privbuf, dest );
NOP8;
NOP8;
send_irq( dest );
return iRCCE_SUCCESS;
}
// we need an extra isend-call
else {
iRCCE_mail_send( send_size, iRCCE_ANYLENGTH,
0, NULL, dest );
NOP8;
NOP8;
send_irq( dest );
return iRCCE_isend_general( privbuf, send_size,
dest, request );
}

View file

@ -187,7 +187,6 @@ int iRCCE_mail_recv(
int iRCCE_mail_release(
iRCCE_MAIL_HEADER** header
) {
// put header in garbage collection
if( (iRCCE_mail_garbage.first == NULL)
&& (iRCCE_mail_garbage.last == NULL ) ) {

View file

@ -232,30 +232,32 @@ int icc_ping(int ue)
return 0;
}
#define MAIL_MSG_SIZE 20
int icc_mail_ping( void )
{
kprintf( "Hello from mail_ping ... \n" );
uint32_t flags;
uint64_t timer;
int remote_rank = (my_ue+1)%2;
char send_buffer[MAIL_MSG_SIZE];
int length = MAIL_MSG_SIZE;
if( my_ue ) {
return 0;
}
kprintf( "Hello from mail_ping ... \n" );
// disable interrupts
flags = irq_nested_disable();
// 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 );
// start anylength send
iRCCE_isend( send_buffer, -length, remote_rank, NULL );
// wait for response
iRCCE_MAIL_HEADER* mail;
@ -349,25 +351,27 @@ void icc_check(void)
void icc_mail_check(void)
{
iRCCE_MAIL_HEADER* header;
int res, count = 0;
// if( !my_ue ) return;
kprintf( "Hello from icc_mail_check() \n" );
iRCCE_MAIL_HEADER* header = NULL;
int res;
char* recv_buffer;
// empty mailbox and interpret headers
do {
res = iRCCE_mail_recv( &header );
while( (res = iRCCE_mail_recv( &header )) == iRCCE_SUCCESS ) {
if( header->tag == 1 ) {
kprintf( "Received mail_ping request ...\n" );
iRCCE_mail_send( 0, 2, 0, NULL, header->source );
}
count++;
iRCCE_mail_release( &header );
} while( res == iRCCE_SUCCESS );
else if( header->tag == 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_mail_release( &header );
}
kprintf( "received %d headers!\n", count );
}
#endif

View file

@ -28,19 +28,14 @@
#include <asm/icc.h>
int STDCALL mail_ping(void* arg) {
kprintf( "### Hello from mail_ping\n" );
icc_mail_ping();
kprintf( "### mail_ping finished\n" );
return 0;
}
int mailbox_test_init(void)
{
char* argv[] = {"/bin/mailbox", NULL};
create_kernel_task(NULL, mail_ping, argv);
create_kernel_task(NULL, mail_ping, NULL);
return 0;
}

View file

@ -113,12 +113,10 @@ int main(void)
sleep(5);
list_root();
// test_init();
kprintf( "starting mailbox ...\n " );
mailbox_test_init();
per_core(current_task)->status = TASK_IDLE;
reschedule();
while(1);
while(1) {
#ifdef CONFIG_ROCKCREEK
icc_halt();