Commit 1ddd9781 authored by Michael Quigley's avatar Michael Quigley
Browse files

added awe-mapper

parent 0b11c2f9
*.o
*.mod
*.mod.c
*.swp
*.ko
*.order
*.symvers
*.cmd
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
/*
* awe-mapper.c
*
* This file is part of the asynchronous ipc for xcap.
* This file is responsible for providing mappings
* between an integer identifier and a pointer to
* an awe struct.
*
* Author: Michael Quigley
* Date: January 2016
*/
#include <linux/bug.h>
#include "awe-mapper.h"
#define AWE_TABLE_COUNT 4
/*
* NOTE: This implementation right now is just a ring buffer.
* In the future, we probably want to change this to something
* like a red black tree or a B-tree to account for differing
* storage size requirements.
*/
static void* awe_table[AWE_TABLE_COUNT];
static uint32_t used_slots = 0;
//The address of this is used to indicate that something is
//allocated and not set to an awe_ptr yet.
static uint32_t allocated_marker = 0;
/*
* Initilaizes awe mapper.
*/
void awe_mapper_init(void){/*Does nothing for now.*/}
/*
* Uninitilaizes awe mapper.
*/
void awe_mapper_uninit(void){/*Does nothing for now.*/}
static bool is_slot_allocated(uint32_t id)
{
return awe_table[id] != NULL;
}
/*
* Returns new available id.
*/
uint32_t awe_mapper_create_id(void)
{
static uint32_t next_id = 0;
BUG_ON((used_slots >= AWE_TABLE_COUNT) && "Too many slots have been requested.");
do
{
next_id = (next_id + 1) % AWE_TABLE_COUNT;
}
while( is_slot_allocated(next_id) );
awe_table[next_id] = &allocated_marker;
used_slots++;
return next_id;
}
/*
* Marks provided id as available
*/
void awe_mapper_remove_id(uint32_t id)
{
BUG_ON(id >= AWE_TABLE_COUNT);
if(used_slots > 0)
{
used_slots--;
}
awe_table[id] = NULL;
}
/*
* Links awe_ptr with id.
*/
void awe_mapper_set_id(uint32_t id, void* awe_ptr)
{
BUG_ON(id >= AWE_TABLE_COUNT);
awe_table[id] = awe_ptr;
}
/*
* Returns awe_ptr that corresponds to id.
*/
void* awe_mapper_get_awe_ptr(uint32_t id)
{
BUG_ON(id >= AWE_TABLE_COUNT);
return awe_table[id];
}
/*
* awe-mapper.h
*
* This file is part of the asynchronous ipc for xcap.
* This file is responsible for providing mappings
* between an integer identifier and a pointer to
* an awe struct.
*
* Author: Michael Quigley
* Date: January 2016
*/
//#include <stddef.h>
//#include <stdint.h>
//#include <stdbool.h>
#include <linux/types.h>
#ifndef AWE_MAPPER_H
#define AWE_MAPPER_H
/*
* Initilaizes awe mapper.
*/
void awe_mapper_init(void);
/*
* Uninitilaizes awe mapper.
*/
void awe_mapper_uninit(void);
/*
* Returns new available id.
*/
uint32_t awe_mapper_create_id(void);
/*
* Marks provided id as available
*/
void awe_mapper_remove_id(uint32_t id);
/*
* Links awe_ptr with id.
*/
void awe_mapper_set_id(uint32_t id, void* awe_ptr);
/*
* Returns awe_ptr that corresponds to id.
*/
void* awe_mapper_get_awe_ptr(uint32_t id);
#endif
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -4,10 +4,11 @@ ccflags-y += -O0 -I/users/mquigley/fast-ipc-module/current/IPC -fno-ipa-cp -fno-
EXTRA_CFLAGS=-DDEBUG_OUTPUT
INC_DIR = ../../IPC
CFLAGS_ipc.o = -O2 -DPOLL
CFLAGS_ring-channel.o = -I$(INC_DIR)
CFLAGS_ring-channel.o = -I$(INC_DIR)
CFLAGS_awe-mapper.o = -I/users/mquigley/fast-ipc-module/current/awe-mapper
DEPS= $(INC_DIR)/ipc.h
rpc_testing-objs := ../../IPC/ipc.o ../../ring-chan/ring-channel.o callee.o caller.o rpc_test.o
rpc_testing-objs := ../../IPC/ipc.o ../../ring-chan/ring-channel.o ../../awe-mapper/awe-mapper.o callee.o caller.o rpc_test.o
KDIR := /lib/modules/`uname -r`/build
......@@ -17,3 +18,4 @@ clean:
make -C $(KDIR) M=$(PWD) clean
rm ../../IPC/ipc.o
rm ../../ring-chan/ring-channel.o
rm ../../awe-mapper/awe-mapper.o
#include <linux/random.h>
#include <linux/slab.h>
#include "../../awe-mapper/awe-mapper.h"
#include "rpc.h"
#include <lcd-domains/thc.h>
#include <lcd-domains/thcinternal.h>
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
/users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/timing.ko
/users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/../../IPC/ipc.o /users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/../../ring-chan/ring-channel.o /users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/timing_setup.o
File mode changed from 100644 to 100755
0xe08ef6b3 connect_channels /users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/timing EXPORT_SYMBOL
0xb44f97c9 get_send_slot /users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/timing EXPORT_SYMBOL
0x75052fed free_channel /users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/timing EXPORT_SYMBOL
0x6f332415 create_channel /users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/timing EXPORT_SYMBOL
0x28c0d4c6 send /users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/timing EXPORT_SYMBOL
0x7ab9320d ipc_start_thread /users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/timing EXPORT_SYMBOL
0x34e50186 transaction_complete /users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/timing EXPORT_SYMBOL
0x97e12de2 recv /users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/timing EXPORT_SYMBOL
kernel//users/sbauer/ipc/ramstore/fast-ipc-module/current/tests/timing/timing.ko
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