1
0
mirror of https://github.com/DigitalDevices/dddvb.git synced 2023-10-10 13:37:43 +02:00

compile parts of ddbridge and octonet seperately

This commit is contained in:
Ralph Metzler 2017-08-02 17:40:24 +02:00
parent 665b5ef857
commit dcddb3437d
9 changed files with 84 additions and 155 deletions

View File

@ -1,5 +1,8 @@
EXTRA_CFLAGS += -DCONFIG_DVB_CXD2843 -DCONFIG_DVB_LNBP21 -DCONFIG_DVB_STV090x -DCONFIG_DVB_STV6110x -DCONFIG_DVB_DRXK -DCONFIG_DVB_STV0910 -DCONFIG_DVB_STV6111 -DCONFIG_DVB_LNBH25 -DCONFIG_DVB_MXL5XX
ddbridge-objs = ddbridge-main.o ddbridge-hw.o ddbridge-i2c.o ddbridge-ns.o ddbridge-modulator.o ddbridge-core.o
octonet-objs = octonet-main.o ddbridge-hw.o ddbridge-i2c.o ddbridge-ns.o ddbridge-modulator.o ddbridge-core.o
obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o
obj-$(CONFIG_DVB_OCTONET) += octonet.o

View File

@ -1,19 +1,14 @@
KDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
#
# Makefile for the ddbridge device driver
#
MODDEFS := CONFIG_DVB_DDBRIDGE=m
ddbridge-objs = ddbridge-main.o ddbridge-hw.o ddbridge-i2c.o ddbridge-ns.o ddbridge-modulator.o ddbridge-core.o
octonet-objs = octonet-main.o ddbridge-hw.o ddbridge-i2c.o ddbridge-ns.o ddbridge-modulator.o ddbridge-core.o
all:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) $(MODDEFS) modules
$(MAKE) -C apps
dep:
DIR=`pwd`; (cd $(TOPDIR); make SUBDIRS=$$DIR dep)
install: all
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install
clean:
rm -rf */*.o */*.ko */*.mod.c */.*.cmd .tmp_versions Module* modules*
obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o
obj-$(CONFIG_DVB_OCTONET) += octonet.o
ccflags-y += -Idrivers/media/dvb-core/
ccflags-y += -Idrivers/media/dvb-frontends/
ccflags-y += -Idrivers/media/tuners/

View File

@ -24,22 +24,17 @@
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
DEFINE_MUTEX(redirect_lock);
#include "ddbridge.h"
static struct workqueue_struct *ddb_wq;
struct workqueue_struct *ddb_wq;
DEFINE_MUTEX(redirect_lock);
static int adapter_alloc;
module_param(adapter_alloc, int, 0444);
MODULE_PARM_DESC(adapter_alloc,
"0-one adapter per io, 1-one per tab with io, 2-one per tab, 3-one for all");
#ifdef CONFIG_PCI_MSI
static int msi = 1;
module_param(msi, int, 0444);
MODULE_PARM_DESC(msi,
" Control MSI interrupts: 0-disable, 1-enable (default)");
#endif
static int ci_bitrate = 70000;
module_param(ci_bitrate, int, 0444);
MODULE_PARM_DESC(ci_bitrate, " Bitrate in KHz for output to CI.");
@ -89,10 +84,7 @@ static struct ddb *ddbs[DDB_MAX_ADAPTER];
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
#include "ddbridge-mod.c"
#include "ddbridge-i2c.c"
#include "ddbridge-ns.c"
#include "ddbridge-hw.c"
#include "ddbridge-i2c.h"
/****************************************************************************/
/****************************************************************************/
@ -336,7 +328,7 @@ static int ddb_buffers_alloc(struct ddb *dev)
return 0;
}
static void ddb_buffers_free(struct ddb *dev)
void ddb_buffers_free(struct ddb *dev)
{
int i;
struct ddb_port *port;
@ -551,7 +543,7 @@ static void ddb_input_start(struct ddb_input *input)
}
static int ddb_dvb_ns_input_start(struct ddb_input *input)
int ddb_dvb_ns_input_start(struct ddb_input *input)
{
struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1];
@ -561,7 +553,7 @@ static int ddb_dvb_ns_input_start(struct ddb_input *input)
return ++dvb->users;
}
static int ddb_dvb_ns_input_stop(struct ddb_input *input)
int ddb_dvb_ns_input_stop(struct ddb_input *input)
{
struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1];
@ -2864,7 +2856,7 @@ static int ddb_ports_attach(struct ddb *dev)
return ret;
}
static void ddb_ports_detach(struct ddb *dev)
void ddb_ports_detach(struct ddb *dev)
{
int i;
struct ddb_port *port;
@ -3087,7 +3079,7 @@ static void ddb_dma_init(struct ddb_io *io, int nr, int out)
dma->div = INPUT_DMA_IRQ_DIV;
}
ddbwritel(io->port->dev, 0, DMA_BUFFER_ACK(dma));
pr_debug("DDBridge: init link %u, io %u, dma %u, dmaregs %08x bufregs %08x\n",
pr_info("DDBridge: init link %u, io %u, dma %u, dmaregs %08x bufregs %08x\n",
io->port->lnr, io->nr, nr, dma->regs, dma->bufregs);
}
@ -3103,7 +3095,7 @@ static void ddb_input_init(struct ddb_port *port, int nr, int pnr, int anr)
rm = io_regmap(input, 1);
input->regs = DDB_LINK_TAG(port->lnr) |
(rm->input->base + rm->input->size * nr);
pr_debug("DDBridge: init link %u, input %u, regs %08x\n",
pr_info("DDBridge: init link %u, input %u, regs %08x\n",
port->lnr, nr, input->regs);
if (dev->has_dma) {
struct ddb_regmap *rm0 = io_regmap(input, 0);
@ -3113,7 +3105,7 @@ static void ddb_input_init(struct ddb_port *port, int nr, int pnr, int anr)
if (port->lnr)
dma_nr += 32 + (port->lnr - 1) * 8;
pr_debug("DDBridge: init link %u, input %u, handler %u\n",
pr_info("DDBridge: init link %u, input %u, handler %u\n",
port->lnr, nr, dma_nr + base);
dev->handler[0][dma_nr + base] = input_handler;
dev->handler_data[0][dma_nr + base] = (unsigned long) input;
@ -3133,7 +3125,7 @@ static void ddb_output_init(struct ddb_port *port, int nr)
rm = io_regmap(output, 1);
output->regs = DDB_LINK_TAG(port->lnr) |
(rm->output->base + rm->output->size * nr);
pr_debug("DDBridge: init link %u, output %u, regs %08x\n",
pr_info("DDBridge: init link %u, output %u, regs %08x\n",
port->lnr, nr, output->regs);
if (dev->has_dma) {
struct ddb_regmap *rm0 = io_regmap(output, 0);
@ -3267,7 +3259,7 @@ static void ddb_ports_init(struct ddb *dev)
dev->port_num = p;
}
static void ddb_ports_release(struct ddb *dev)
void ddb_ports_release(struct ddb *dev)
{
int i;
struct ddb_port *port;
@ -3364,7 +3356,7 @@ static void irq_handle_io(struct ddb *dev, u32 s)
}
}
static irqreturn_t irq_handler0(int irq, void *dev_id)
irqreturn_t irq_handler0(int irq, void *dev_id)
{
struct ddb *dev = (struct ddb *) dev_id;
u32 s = ddbreadl(dev, INTERRUPT_STATUS);
@ -3381,7 +3373,7 @@ static irqreturn_t irq_handler0(int irq, void *dev_id)
return IRQ_HANDLED;
}
static irqreturn_t irq_handler1(int irq, void *dev_id)
irqreturn_t irq_handler1(int irq, void *dev_id)
{
struct ddb *dev = (struct ddb *) dev_id;
u32 s = ddbreadl(dev, INTERRUPT_STATUS);
@ -3398,7 +3390,7 @@ static irqreturn_t irq_handler1(int irq, void *dev_id)
return IRQ_HANDLED;
}
static irqreturn_t irq_handler(int irq, void *dev_id)
irqreturn_t irq_handler(int irq, void *dev_id)
{
struct ddb *dev = (struct ddb *) dev_id;
u32 s = ddbreadl(dev, INTERRUPT_STATUS);
@ -3477,7 +3469,7 @@ static irqreturn_t irq_handle_v2_n(struct ddb *dev, u32 n)
return IRQ_HANDLED;
}
static irqreturn_t irq_handler_v2(int irq, void *dev_id)
irqreturn_t irq_handler_v2(int irq, void *dev_id)
{
struct ddb *dev = (struct ddb *) dev_id;
u32 s = 0xffff & ddbreadl(dev, INTERRUPT_V2_STATUS);
@ -3691,7 +3683,7 @@ static int ddb_nsd_attach(struct ddb *dev)
return ret;
}
static void ddb_nsd_detach(struct ddb *dev)
void ddb_nsd_detach(struct ddb *dev)
{
if (!dev->link[0].info->ns_num)
return;
@ -4709,7 +4701,7 @@ static struct class ddb_class = {
.devnode = ddb_devnode,
};
static int ddb_class_create(void)
int ddb_class_create(void)
{
ddb_major = register_chrdev(0, DDB_NAME, &ddb_fops);
if (ddb_major < 0)
@ -4719,7 +4711,7 @@ static int ddb_class_create(void)
return 0;
}
static void ddb_class_destroy(void)
void ddb_class_destroy(void)
{
class_unregister(&ddb_class);
unregister_chrdev(ddb_major, DDB_NAME);
@ -4817,7 +4809,7 @@ fail:
return res;
}
static void ddb_device_destroy(struct ddb *dev)
void ddb_device_destroy(struct ddb *dev)
{
if (IS_ERR(dev->ddb_dev))
return;
@ -5091,7 +5083,7 @@ static int ddb_init_boards(struct ddb *dev)
return 0;
}
static int ddb_init(struct ddb *dev)
int ddb_init(struct ddb *dev)
{
mutex_init(&dev->link[0].flash_mutex);
if (no_init) {
@ -5151,7 +5143,7 @@ static void ddb_reset_io(struct ddb *dev, u32 reg)
ddbwritel(dev, 0x00, reg);
}
static void ddb_reset_ios(struct ddb *dev)
void ddb_reset_ios(struct ddb *dev)
{
u32 i;
struct ddb_regmap *rm = dev->link[0].info->regmap;
@ -5167,7 +5159,7 @@ static void ddb_reset_ios(struct ddb *dev)
usleep_range(5000, 6000);
}
static void ddb_unmap(struct ddb *dev)
void ddb_unmap(struct ddb *dev)
{
if (dev->regs)
iounmap(dev->regs);

View File

@ -23,87 +23,7 @@
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
static int i2c_io(struct i2c_adapter *adapter, u8 adr,
u8 *wbuf, u32 wlen, u8 *rbuf, u32 rlen)
{
struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
.buf = wbuf, .len = wlen },
{.addr = adr, .flags = I2C_M_RD,
.buf = rbuf, .len = rlen } };
return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1;
}
static int i2c_write(struct i2c_adapter *adap, u8 adr, u8 *data, int len)
{
struct i2c_msg msg = {.addr = adr, .flags = 0,
.buf = data, .len = len};
return (i2c_transfer(adap, &msg, 1) == 1) ? 0 : -1;
}
static int i2c_read(struct i2c_adapter *adapter, u8 adr, u8 *val)
{
struct i2c_msg msgs[1] = {{.addr = adr, .flags = I2C_M_RD,
.buf = val, .len = 1 } };
return (i2c_transfer(adapter, msgs, 1) == 1) ? 0 : -1;
}
static int i2c_read_regs(struct i2c_adapter *adapter,
u8 adr, u8 reg, u8 *val, u8 len)
{
struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
.buf = &reg, .len = 1 },
{.addr = adr, .flags = I2C_M_RD,
.buf = val, .len = len } };
return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1;
}
static int i2c_read_regs16(struct i2c_adapter *adapter,
u8 adr, u16 reg, u8 *val, u8 len)
{
u8 reg16[2] = { reg >> 8, reg };
struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
.buf = reg16, .len = 2 },
{.addr = adr, .flags = I2C_M_RD,
.buf = val, .len = len } };
return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1;
}
static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr, u8 reg, u8 *val)
{
struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
.buf = &reg, .len = 1},
{.addr = adr, .flags = I2C_M_RD,
.buf = val, .len = 1 } };
return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1;
}
static int i2c_read_reg16(struct i2c_adapter *adapter, u8 adr,
u16 reg, u8 *val)
{
u8 msg[2] = {reg >> 8, reg & 0xff};
struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
.buf = msg, .len = 2},
{.addr = adr, .flags = I2C_M_RD,
.buf = val, .len = 1 } };
return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1;
}
static int i2c_write_reg16(struct i2c_adapter *adap, u8 adr,
u16 reg, u8 val)
{
u8 msg[3] = {reg >> 8, reg & 0xff, val};
return i2c_write(adap, adr, msg, 3);
}
static int i2c_write_reg(struct i2c_adapter *adap, u8 adr,
u8 reg, u8 val)
{
u8 msg[2] = {reg, val};
return i2c_write(adap, adr, msg, 2);
}
#include "ddbridge.h"
static int ddb_i2c_cmd(struct ddb_i2c *i2c, u32 adr, u32 cmd)
{
@ -207,7 +127,7 @@ struct i2c_algorithm ddb_i2c_algo = {
.functionality = ddb_i2c_functionality,
};
static void ddb_i2c_release(struct ddb *dev)
void ddb_i2c_release(struct ddb *dev)
{
int i;
struct ddb_i2c *i2c;
@ -260,7 +180,7 @@ static int ddb_i2c_add(struct ddb *dev, struct ddb_i2c *i2c,
return i2c_add_adapter(adap);
}
static int ddb_i2c_init(struct ddb *dev)
int ddb_i2c_init(struct ddb *dev)
{
int stat = 0;
u32 i, j, num = 0, l, base;

View File

@ -23,13 +23,16 @@
* 02110-1301, USA
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
#define DDB_USE_WORK
/*#define DDB_TEST_THREADED*/
#include "ddbridge.h"
#include "ddbridge-regs.h"
#include "ddbridge-core.c"
#ifdef CONFIG_PCI_MSI
static int msi = 1;
module_param(msi, int, 0444);
MODULE_PARM_DESC(msi,
" Control MSI interrupts: 0-disable, 1-enable (default)");
#endif
extern struct workqueue_struct *ddb_wq;
/****************************************************************************/
/****************************************************************************/

View File

@ -23,8 +23,7 @@
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
static int ddb_dvb_ns_input_start(struct ddb_input *input);
static int ddb_dvb_ns_input_stop(struct ddb_input *input);
#include "ddbridge.h"
static u16 calc_pcs(struct dvb_ns_params *p)
{
@ -464,7 +463,7 @@ static int ns_stop(struct dvbnss *nss)
return 0;
}
static int netstream_init(struct ddb_input *input)
int netstream_init(struct ddb_input *input)
{
struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1];
struct dvb_adapter *adap = dvb->adap;

View File

@ -25,6 +25,9 @@
#ifndef _DDBRIDGE_H_
#define _DDBRIDGE_H_
#define DDB_USE_WORK
/*#define DDB_TEST_THREADED*/
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
@ -90,6 +93,8 @@
#include "lnbh25.h"
#include "mxl5xx.h"
#include "ddbridge-regs.h"
#define DDB_MAX_I2C 32
#define DDB_MAX_PORT 32
#define DDB_MAX_INPUT 64
@ -739,19 +744,39 @@ struct DDMOD_FLASH {
#define DDMOD_FLASH_MAGIC 0x5F564d5F
int ddbridge_flashread(struct ddb *dev, u32 link, u8 *buf, u32 addr, u32 len);
#define DDBRIDGE_VERSION "0.9.30"
/* linked function prototypes */
struct ddb_info *get_ddb_info(u16 vendor, u16 device, u16 subvendor, u16 subdevice);
int netstream_init(struct ddb_input *input);
int ddb_dvb_ns_input_start(struct ddb_input *input);
int ddb_dvb_ns_input_stop(struct ddb_input *input);
int ddbridge_mod_do_ioctl(struct file *file, unsigned int cmd, void *parg);
int ddbridge_mod_init(struct ddb *dev);
void ddbridge_mod_output_stop(struct ddb_output *output);
int ddbridge_mod_output_start(struct ddb_output *output);
void ddbridge_mod_rate_handler(unsigned long data);
void ddb_device_destroy(struct ddb *dev);
void ddb_nsd_detach(struct ddb *dev);
void ddb_ports_detach(struct ddb *dev);
void ddb_ports_release(struct ddb *dev);
void ddb_buffers_free(struct ddb *dev);
void ddb_unmap(struct ddb *dev);
irqreturn_t irq_handler0(int irq, void *dev_id);
irqreturn_t irq_handler1(int irq, void *dev_id);
irqreturn_t irq_handler(int irq, void *dev_id);
irqreturn_t irq_handler_v2(int irq, void *dev_id);
void ddb_reset_ios(struct ddb *dev);
int ddb_init(struct ddb *dev);
int ddb_class_create(void);
void ddb_class_destroy(void);
int ddbridge_flashread(struct ddb *dev, u32 link, u8 *buf, u32 addr, u32 len);
#define DDBRIDGE_VERSION "0.9.30"
/* linked functions */
struct ddb_info *get_ddb_info(u16 vendor, u16 device, u16 subvendor, u16 subdevice);
int ddb_i2c_init(struct ddb *dev);
void ddb_i2c_release(struct ddb *dev);
#endif

View File

@ -24,14 +24,6 @@
*/
#include "ddbridge.h"
#include "ddbridge-regs.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0))
#include <asm-generic/pci-dma-compat.h>
#else
#include <linux/pci-dma-compat.h>
#endif
#include "ddbridge-core.c"
static int __exit octonet_remove(struct platform_device *pdev)
{