Commit 79712e31 authored by Michael Quigley's avatar Michael Quigley
Browse files

fixed bug, updated tests for more messages.

parent 27c24f84
......@@ -242,7 +242,10 @@ bool poll_recv(struct ttd_ring_channel_group* rx_group, int* curr_ind, struct ip
if( !check_rx_slot_available(recv_msg) ) //if message exists
{
*msg = recv_msg;
inc_rx_slot(curr_chan);
if( recv_msg->msg_type == msg_type_request )
{
inc_rx_slot(curr_chan);
}
return true;
}
}
......@@ -266,11 +269,9 @@ noinline struct ipc_message *async_recv(struct ttd_ring_channel *rx, unsigned lo
}
else
{
//printk(KERN_ERR "MESSAGE ID RECEIVED IS: %lx\n", recv_msg->msg_id);
//printk(KERN_ERR "MESSAGE ID FOR CONTEXT IS: %lx\n", msg_id);
printk(KERN_ERR "CALLING YIELD TO\n");
if( recv_msg->msg_type == msg_type_response )
{
printk(KERN_ERR "CALLING YIELD TO\n");
THCYieldToId((uint32_t) recv_msg->msg_id, (uint32_t) msg_id);
}
else
......@@ -281,10 +282,10 @@ noinline struct ipc_message *async_recv(struct ttd_ring_channel *rx, unsigned lo
}
else
{
//printk(KERN_ERR "spin yield\n");
THCYieldAndSave((uint32_t) msg_id);
}
}
}
printk(KERN_ERR "REMOVING ID: %d\n", (uint32_t) msg_id);
awe_mapper_remove_id((uint32_t)msg_id);
inc_rx_slot(rx);
......
......@@ -29,7 +29,7 @@ int ipc_dispatch_loop(struct ttd_ring_channel_group* rx_group, int max_recv_ct)
{
recv_ct++;
printk(KERN_ERR "poll_recv returned\n");
//printk(KERN_ERR "poll_recv returned\n");
//check if curr_msg corresponds to existing awe in this thread
if( curr_msg->msg_type == msg_type_response )
{
......
......@@ -4,6 +4,7 @@
#include "ipc_dispatch.h"
#include "thread_fn_util.h"
#include <awe-mapper.h>
#include <linux/delay.h>
static struct ttd_ring_channel* channel;
......@@ -39,33 +40,38 @@ int thread1_fn1(void* group)
channel = rcg->chans[0];
thc_init();
DO_FINISH_(1,{
DO_FINISH_(thread1_fn,{
while (num_transactions < TRANSACTIONS) {
printk(KERN_ERR "num_transactions: %d\n", num_transactions);
ASYNC(
printk(KERN_ERR "id created\n");
id_num = awe_mapper_create_id();
printk(KERN_ERR "ID_NUM: %d\n", id_num);
printk(KERN_ERR "id returned\n");
num_transactions++;
add_nums_async(num_transactions, 1,(unsigned long) id_num, ADD_2_FN);
);
ASYNC(
id_num = awe_mapper_create_id();
printk(KERN_ERR "ID_NUM: %d\n", id_num);
add_nums_async(num_transactions, 2,(unsigned long) id_num, ADD_10_FN);
);
if( (num_transactions) % THD3_INTERVAL == 0 )
{
ASYNC(
printk(KERN_ERR "id created\n");
id_num = awe_mapper_create_id();
printk(KERN_ERR "id returned\n");
num_transactions++;
add_nums_async(num_transactions, 2,(unsigned long) id_num, ADD_10_FN);
);
}
ASYNC(
printk(KERN_ERR "id created\n");
id_num = awe_mapper_create_id();
printk(KERN_ERR "ID_NUM: %d\n", id_num);
printk(KERN_ERR "id returned\n");
num_transactions++;
add_nums_async(num_transactions, 3,(unsigned long) id_num, ADD_2_FN);
);
num_transactions++;
}});
pr_err("Complete\n");
msleep(5);
}
printk(KERN_ERR "done with transactions\n");
});
printk(KERN_ERR "lcd async exiting module and deleting ptstate");
thc_done();
......
......@@ -14,6 +14,7 @@ static int add_2_fn(struct ttd_ring_channel* chan, struct ipc_message* msg)
{
unsigned long result = msg->reg1 + msg->reg2;
struct ipc_message* out_msg = get_send_slot(chan);
transaction_complete(msg);
out_msg->reg1 = result;
out_msg->msg_id = msg->msg_id;
out_msg->fn_type = ADD_2_FN;
......@@ -32,7 +33,7 @@ static int add_10_fn(struct ttd_ring_channel* thread1_chan, struct ipc_message*
struct ipc_message* thread1_result;
unsigned long saved_msg_id = msg->msg_id;
unsigned long new_msg_id = awe_mapper_create_id();
transaction_complete(msg);
thread3_msg->fn_type = msg->fn_type;
thread3_msg->reg1 = msg->reg1;
thread3_msg->reg2 = msg->reg2;
......@@ -41,6 +42,7 @@ static int add_10_fn(struct ttd_ring_channel* thread1_chan, struct ipc_message*
send(thread3_chan,thread3_msg);
msg = async_recv(thread3_chan, new_msg_id);
transaction_complete(msg);
thread1_result = get_send_slot(thread1_chan);
thread1_result->fn_type = msg->fn_type;
......@@ -73,7 +75,7 @@ int thread2_fn1(void* group)
thc_init();
rx_group = (struct ttd_ring_channel_group*)group;
rx_group->chans[0]->dispatch_fn = thread1_dispatch_fn;
ipc_dispatch_loop(rx_group, 3);
ipc_dispatch_loop(rx_group, TRANSACTIONS + 50);
thc_done();
return 1;
......
......@@ -13,12 +13,16 @@ static struct ttd_ring_channel_group* rx_group;
static int add_10_fn(struct ttd_ring_channel* chan, struct ipc_message* msg)
{
msleep(1000);
unsigned long result = msg->reg1 + msg->reg2 + 10;
unsigned long msg_id = msg->msg_id;
unsigned long reg1 = msg->reg1;
unsigned long reg2 = msg->reg2;
transaction_complete(msg);
msleep(5);
unsigned long result = reg1 + reg2 + 10;
struct ipc_message* out_msg = get_send_slot(chan);
printk(KERN_ERR "got to thread3\n");
out_msg->reg1 = result;
out_msg->msg_id = msg->msg_id;
out_msg->msg_id = msg_id;
out_msg->fn_type = ADD_10_FN;
out_msg->msg_type = msg_type_response;
send(chan, out_msg);
......@@ -44,7 +48,7 @@ int thread3_fn1(void* group)
thc_init();
rx_group = (struct ttd_ring_channel_group*)group;
rx_group->chans[0]->dispatch_fn = thread2_dispatch_fn;
ipc_dispatch_loop(rx_group, 1);
ipc_dispatch_loop(rx_group, TRANSACTIONS / THD3_INTERVAL);
thc_done();
return 1;
......
......@@ -3,7 +3,8 @@
#define ADD_2_FN 1
#define ADD_10_FN 2
#define TRANSACTIONS 1
#define TRANSACTIONS 300
#define THD3_INTERVAL 31
int thread1_fn1(void* data);
int thread2_fn1(void* data);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment