All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 89200827 authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan

Moving stuff around, configuration for build.

parent 9120bff6
......@@ -17,31 +17,56 @@ config LCD_PING_PONG_SENDER
---help---
Sender for the ping-pong LCD IPC test
config LCD_CS_INIT
tristate "LCD client-server test (init module)"
depends on LCD_CS_CLIENT
depends on LCD_CS_SERVER
depends on LCD
# config LCD_CS_INIT
# tristate "LCD client-server test (init module)"
# depends on LCD_CS_CLIENT
# depends on LCD_CS_SERVER
# depends on LCD
# default m
# ---help---
# Init code to start the LCD client-server test
# config LCD_CS_CLIENT
# tristate "LCD client-server test (client)"
# depends on LCD
# default m
# ---help---
# Client module for the LCD client-server test
# config LCD_CS_SERVER
# tristate "LCD client-server test (server)"
# depends on LCD
# default m
# ---help---
# Server module for the LCD client-server test
config LCD_IPC_AUTO
bool "Build automobile ipc test"
config LCD_AUTO_CUSTOMER
tristate "LCD automobile ipc test (customer)"
depends on LCD_IPC_AUTO
default m
---help---
Init code to start the LCD client-server test
Auto customer module for ipc test
config LCD_CS_CLIENT
tristate "LCD client-server test (client)"
depends on LCD
config LCD_AUTO_DEALER
tristate "LCD automobile ipc test (dealer)"
depends on LCD_IPC_AUTO
default m
---help---
Client module for the LCD client-server test
Auto dealer module for ipc test
config LCD_CS_SERVER
tristate "LCD client-server test (server)"
depends on LCD
config LCD_AUTO_MANUFACTURER
tristate "LCD automobile ipc test (manufacturer)"
depends on LCD_IPC_AUTO
default m
---help---
Server module for the LCD client-server test
Auto manufacturer module for ipc test
config RUN_IN_LCD
bool "Run client-server in LCD"
bool "Run automobile ipc test modules in LCDs"
depends on LCD_IPC_AUTO
default false
---help---
Set to true to run client and server in lcd.
\ No newline at end of file
Set to true to run ipc auto modules in lcds.
\ No newline at end of file
obj-y += ipc-client-server/
obj-y += ipc-ping-pong/
obj-$(LCD_IPC_AUTO) += ipc-auto/
#obj-y += ipc-ping-pong/
obj-m += client.o server.o cs-init.o
obj-$(CONFIG_LCD_AUTO_CUSTOMER) += customer.o
obj-$(CONFIG_LCD_AUTO_DEALER) += dealer.o
obj-$(CONFIG_LCD_AUTO_MANUFACTURER) += manufacturer.o
/**
* customer.c - car buyer subsystem for test
*
*
* Authors: Anton Burtsev <aburtsev@flux.utah.edu>
* Charles Jacobsen <charlesj@cs.utah.edu>
*
* Copyright: University of Utah
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include "common.h"
#include "dealer.h"
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Auto buyer (LCD test)");
#if CONFIG_RUN_IN_LCD
int customer_init(void)
#else
static int __init customer_init(void)
#endif
{
struct automobile *a;
a = dealer_buy_car();
if (!a) {
AU_ERR("bad car");
return -1;
}
AU_MSG("got a %d-door car with %d cylinders",
a->doors, a->engine->cylinders);
dealer_return_car(a);
AU_MSG("customer initialized (and done)");
return 0;
}
#if CONFIG_RUN_IN_LCD
void customer_exit(void)
#else
static void __init customer_exit(void)
#endif
{
AU_MSG("customer exited");
}
#if !CONFIG_RUN_IN_LCD
module_init(customer_init);
module_exit(customer_exit);
#endif
/**
* manufacturer.c - car manufacturer subsystem for test
*
*
* Authors: Anton Burtsev <aburtsev@flux.utah.edu>
* Charles Jacobsen <charlesj@cs.utah.edu>
*
* Copyright: University of Utah
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include "common.h"
#include "dealer.h"
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Auto manufacturer (LCD test)");
static struct engine * mk_engine(int cylinders)
{
struct engine *e;
AU_MSG("making %d-cylinder engine", cylinders);
e = kmalloc(sizeof(*e), GFP_KERNEL);
if (!e)
AU_ERR("no memory for engine");
return e;
}
static struct automobile * mk_automobile(struct engine *e, int doors)
{
struct automobile *a;
if (!e) {
AU_ERR("engine is null");
return NULL;
}
AU_MSG("making %d-door auto with %d-cylinder engine",
doors, e->cylinders);
a = kmalloc(sizeof(*a), GFP_KERNEL);
if (!a) {
AU_ERR("no memory for auto");
return NULL;
}
a->engine = e;
a->doors = doors;
return a;
}
static void free_engine(struct engine *e)
{
if (!e) {
AU_ERR("engine is null");
return;
}
AU_MSG("freeing %d-cylinder engine", e->cylinders);
kfree(e);
}
static void free_automobile(struct automobile *a)
{
if (!a) {
AU_ERR("auto is null");
return;
}
AU_MSG("freeing %d-door auto", a->doors);
kfree(a);
}
static struct manufacturer_interface mi = {
.mk_engine = mk_engine;
.mk_automobile = mk_automobile;
.free_engine = free_engine;
.free_automobile = free_automobile;
};
#if CONFIG_RUN_IN_LCD
int manufacturer_init(void)
#else
static int __init manufacturer_init(void)
#endif
{
int ret;
ret = dealer_register_manufacturer(&mi);
if (ret) {
AU_ERR("registering manufacturer");
return -1;
}
AU_MSG("manufacturer registered and initialized");
return 0;
}
#if CONFIG_RUN_IN_LCD
void manufacturer_exit(void)
#else
static void __init manufacturer_exit(void)
#endif
{
AU_MSG("manufacturer exited");
}
#if !CONFIG_RUN_IN_LCD
module_init(manufacturer_init);
module_exit(manufacturer_exit);
#endif
Markdown is supported
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