Commit 067621b8 authored by Manohar Vanga's avatar Manohar Vanga

Added two test wishbone drivers

Signed-off-by: 's avatarManohar Vanga <manohar.vanga@gmail.com>
parent d163c0be
......@@ -3,11 +3,11 @@
# DName
# Device 1
1 0 0 0 0x10000000 0x1000 0 0 1 0x20111225
1 0 0 1 0x10000000 0x1000 0 0 1 0x20111225
CERN
fake1
fake-adc
# Device 2
1 0 0 1 0x20000000 0x1000 0 0 3 0x20120101
1 0 0 2 0x20000000 0x1000 0 0 3 0x20120101
CERN
fake2
fake-dac
include $(PWD)/../paths.mk
obj-m += wbtest.o
obj-m += fakeadc.o fakedac.o
EXTRA_CFLAGS += -I$(PWD)/../wishbone
......
#include <wb.h>
#define PFX "fakeadc: "
#define WB_CERN_VENDOR 0x0
#define WB_ADC_DEVICE 0x1
static struct wb_device_id fakeadc_ids[] = {
{ WB_CERN_VENDOR, WB_ADC_DEVICE},
{ 0, },
};
static int fakeadc_probe(struct wb_device *dev)
{
printk(KERN_INFO PFX "found a fake ADC device!\n");
return 0;
}
static int fakeadc_remove(struct wb_device *dev)
{
printk(KERN_INFO PFX "removed a fake ADC device!\n");
return 0;
}
static struct wb_driver fakeadc_driver = {
.name = "fakeadc",
.owner = THIS_MODULE,
.id_table = fakeadc_ids,
.probe = fakeadc_probe,
.remove = fakeadc_remove,
};
static int fakeadc_init(void)
{
int ret;
ret = wb_register_driver(&fakeadc_driver);
if (ret < 0)
return ret;
return 0;
}
static void fakeadc_exit(void)
{
wb_unregister_driver(&fakeadc_driver);
}
module_init(fakeadc_init);
module_exit(fakeadc_exit);
MODULE_AUTHOR("Manohar Vanga");
MODULE_DESCRIPTION("Fake ADC wishbone driver");
MODULE_LICENSE("GPL");
MODULE_VERSION("Apr 2011");
#include <wb.h>
#define PFX "fakedac: "
#define WB_CERN_VENDOR 0x0
#define WB_DAC_DEVICE 0x2
static struct wb_device_id fakedac_ids[] = {
{ WB_CERN_VENDOR, WB_DAC_DEVICE},
{ 0, },
};
static int fakedac_probe(struct wb_device *dev)
{
printk(KERN_INFO PFX "found a fake DAC device!\n");
return 0;
}
static int fakedac_remove(struct wb_device *dev)
{
printk(KERN_INFO PFX "removed a fake DAC device!\n");
return 0;
}
static struct wb_driver fakedac_driver = {
.name = "fakedac",
.owner = THIS_MODULE,
.id_table = fakedac_ids,
.probe = fakedac_probe,
.remove = fakedac_remove,
};
static int fakedac_init(void)
{
int ret;
ret = wb_register_driver(&fakedac_driver);
if (ret < 0)
return ret;
return 0;
}
static void fakedac_exit(void)
{
wb_unregister_driver(&fakedac_driver);
}
module_init(fakedac_init);
module_exit(fakedac_exit);
MODULE_AUTHOR("Manohar Vanga");
MODULE_DESCRIPTION("Fake DAC wishbone driver");
MODULE_LICENSE("GPL");
MODULE_VERSION("Apr 2011");
#include <wb.h>
static struct wb_device_id wbtest_ids[] = {
{ WBONE_ANY_ID, WBONE_ANY_ID},
{ 0, },
};
static int wbtest_probe(struct wb_device *dev)
{
printk(KERN_INFO "wbtest: probe\n");
return 0;
}
static int wbtest_remove(struct wb_device *dev)
{
printk(KERN_INFO "wbtest: remove\n");
return 0;
}
static void wbtest_shutdown(struct wb_device *dev)
{
printk(KERN_INFO "wbtest: shutdown\n");
return;
}
static struct wb_driver wbtest_driver = {
.name = "wbtest",
.owner = THIS_MODULE,
.id_table = wbtest_ids,
.probe = wbtest_probe,
.remove = wbtest_remove,
.shutdown = wbtest_shutdown,
};
static int wbtest_init(void)
{
int ret;
ret = wb_register_driver(&wbtest_driver);
if (ret < 0)
return ret;
return 0;
}
static void wbtest_exit(void)
{
wb_unregister_driver(&wbtest_driver);
}
module_init(wbtest_init);
module_exit(wbtest_exit);
MODULE_AUTHOR("Manohar Vanga");
MODULE_DESCRIPTION("Test Wishbone driver");
MODULE_LICENSE("GPL");
MODULE_VERSION("Apr 2011");
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