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

Merge branch 'internal'

This commit is contained in:
internal 2022-10-26 15:58:36 +02:00
commit 83a6dc3a1d
14 changed files with 1398 additions and 19 deletions

View File

@ -1,5 +1,6 @@
kernelver ?= $(shell uname -r)
KDIR ?= /lib/modules/$(kernelver)/build
MDIR ?= /lib/modules/$(kernelver)
KDIR ?= $(MDIR)/build
PWD := $(shell pwd)
MODDEFS := CONFIG_DVB_CORE=m CONFIG_DVB_DDBRIDGE=m CONFIG_DVB_DRXK=m CONFIG_DVB_TDA18271C2DD=m CONFIG_DVB_CXD2099=m CONFIG_DVB_LNBP21=m CONFIG_DVB_STV090x=m CONFIG_DVB_STV6110x=m CONFIG_DVB_STV0367=m CONFIG_DVB_TDA18212=m CONFIG_DVB_STV0367DD=m CONFIG_DVB_TDA18212DD=m CONFIG_DVB_OCTONET=m CONFIG_DVB_CXD2843=m CONFIG_DVB_STV0910=m CONFIG_DVB_STV6111=m CONFIG_DVB_LNBH25=m CONFIG_DVB_MXL5XX=m CONFIG_DVB_NET=y DDDVB=y
@ -29,10 +30,11 @@ dep:
DIR=`pwd`; (cd $(TOPDIR); make KBUILD_EXTMOD=$$DIR dep)
install: all
$(MAKE) -C $(KDIR) KBUILD_EXTMOD=$(PWD) modules_install
$(MAKE) -C $(KDIR) KBUILD_EXTMOD=$(PWD) INSTALL_MOD_PATH=$(MDIR) modules_install
depmod $(kernelver)
clean:
rm -rf */.*.o.d */*.o */*.ko */*.mod.c */.*.cmd .tmp_versions Module* modules*
$(MAKE) -C apps clean

View File

@ -1,4 +1,20 @@
all: cit citin flashprog modt ddtest setmod ddflash setmod2 pls setmod3 modconfig ddinfo getiq
TARGETS = cit citin flashprog modt ddtest setmod ddflash setmod2 pls setmod3 modconfig ddinfo getiq modtest test.ts
all: $(TARGETS)
CFLAGS = -g -Wall -Wno-unused -Wno-format
FFMPEG := $(shell command -v ffmpeg 2> /dev/null)
modtest: modtest.c
$(CC) -o modtest modtest.c -I../include/ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
test.ts:
ifndef FFMPEG
$(error "ffmpeg is not available please install to create test.ts")
endif
ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 \
-f lavfi -i sine=f=440:b=4 -shortest -metadata \
service_provider="DD" -metadata service_name="Test" test.ts
cit: cit.c
$(CC) -o cit cit.c -lpthread
@ -18,9 +34,19 @@ setmod3: setmod3.c
modconfig: modconfig.c
$(CC) -o modconfig modconfig.c -I../include/
clean:
rm cit citin flashprog modt ddtest setmod ddflash setmod2 pls setmod3 modconfig ddinfo getiq
%: %.c
$(CC) $(CFLAGS) -I../ddbridge -I../include/ $< -o $@
%.o: %.c
$(CC) $(CFLAGS) -I../ddbridge -o $@ $<
clean:
for f in $(TARGETS) *.o *~ ; do \
if [ -e "$$f" ]; then \
rm "$$f" || exit 1; \
fi \
done

View File

@ -276,10 +276,10 @@ int mci_cmd(int dev, struct mci_command *cmd)
memset(&msg, 0, sizeof(msg));
msg.link = 0;
memcpy(&msg.cmd, cmd, sizeof(msg.cmd));
//dump((uint8_t *) &msg.cmd, sizeof(msg.cmd));
//dump((const uint8_t *) &msg.cmd, sizeof(msg.cmd));
ret = ioctl(dev, IOCTL_DDB_MCI_CMD, &msg);
if (ret < 0) {
dprintf(2, "mci_cmd error %d\n", errno);
dprintf(2, "mci_cmd error %d (%s)\n", errno, strerror(errno));
return ret;
}
status = msg.res.status;
@ -458,7 +458,7 @@ int mci_lic(int dev)
printf("MATYPE1: %02x\n", res->bb_header.matype_1);
printf("MATYPE2: %02x\n", res->bb_header.matype_2);
}
dump(&res->license, sizeof(res->license));
dump((const uint8_t *)&res->license, sizeof(res->license));
return ret;
}

1313
apps/modtest.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -147,7 +147,7 @@ int main(int argc, char **argv)
if (gold != 0xffffffff) {
if (gold < 0x3ffff) {
root = gold2root(gold);
printf("gold = %llu (0x%05x) root = %llu (0x%05x)\n",
printf("gold = %u (0x%05x) root = %u (0x%05x)\n",
gold, gold, root, root);
} else
printf("Invalid gold code specified.\n");

View File

@ -3,7 +3,7 @@
#
ddbridge-objs = ddbridge-main.o ddbridge-hw.o ddbridge-i2c.o ddbridge-ns.o ddbridge-modulator.o ddbridge-core.o ddbridge-io.o ddbridge-ci.o ddbridge-max.o ddbridge-mci.o ddbridge-sx8.o ddbridge-m4.o dvb_netstream.o
octonet-objs = octonet-main.o ddbridge-hw.o ddbridge-i2c.o ddbridge-ns.o ddbridge-modulator.o ddbridge-core.o ddbridge-io.o ddbridge-ci.o ddbridge-max.o ddbridge-mci.o ddbridge-sx8.o ddbridge-m4.o dvb_netstream.o
octonet-objs = octonet-main.o ddbridge-hw.o ddbridge-i2c.o ddbridge-ns.o ddbridge-core.o ddbridge-io.o ddbridge-ci.o ddbridge-max.o ddbridge-mci.o ddbridge-sx8.o ddbridge-m4.o dvb_netstream.o
obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o
obj-$(CONFIG_DVB_OCTONET) += octonet.o

View File

@ -370,7 +370,7 @@ static int dma_alloc(struct pci_dev *pdev, struct ddb_dma *dma, int dir)
if (!dma->vbuf[i])
return -ENOMEM;
}
if (((u64)dma->vbuf[i] & 0xfff))
if (((uintptr_t) dma->vbuf[i] & 0xfff))
dev_err(&pdev->dev, "DMA memory at %px not aligned!\n", dma->vbuf[i]);
}
return 0;
@ -534,7 +534,9 @@ static int ddb_output_start_unlocked(struct ddb_output *output)
ddbwritel(dev, 0, DMA_BUFFER_CONTROL(output->dma));
}
if (output->port->class == DDB_PORT_MOD) {
#ifndef CONFIG_MACH_OCTONET
err = ddbridge_mod_output_start(output);
#endif
} else {
if (output->port->input[0]->port->class == DDB_PORT_LOOP)
con = (1UL << 13) | 0x14;
@ -578,9 +580,11 @@ static void ddb_output_stop_unlocked(struct ddb_output *output)
{
struct ddb *dev = output->port->dev;
#ifndef CONFIG_MACH_OCTONET
if (output->port->class == DDB_PORT_MOD)
ddbridge_mod_output_stop(output);
else
#endif
ddbwritel(dev, 0, TS_CONTROL(output));
if (output->dma) {
ddbwritel(dev, 0, DMA_BUFFER_CONTROL(output->dma));
@ -1062,7 +1066,11 @@ static struct dvb_device dvbdev_ci = {
static long mod_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
#ifndef CONFIG_MACH_OCTONET
return ddb_dvb_usercopy(file, cmd, arg, ddbridge_mod_do_ioctl);
#else
return 0;
#endif
}
static const struct file_operations mod_fops = {
@ -1228,6 +1236,7 @@ static int demod_attach_stv0367dd(struct ddb_input *input)
return 0;
}
#ifdef CONFIG_DVB_DRXK
static int tuner_attach_tda18271(struct ddb_input *input)
{
struct i2c_adapter *i2c = &input->port->i2c->adap;
@ -1246,6 +1255,7 @@ static int tuner_attach_tda18271(struct ddb_input *input)
}
return 0;
}
#endif
static int tuner_attach_tda18212dd(struct ddb_input *input)
{
@ -1530,7 +1540,9 @@ static void dvb_input_detach(struct ddb_input *input)
dvb_netstream_release(&dvb->dvbns);
fallthrough;
case 0x20:
#ifdef CONFIG_DVB_NET
dvb_net_release(&dvb->dvbnet);
#endif
fallthrough;
case 0x12:
dvbdemux->dmx.remove_frontend(&dvbdemux->dmx,
@ -1709,9 +1721,11 @@ static int dvb_input_attach(struct ddb_input *input)
return ret;
dvb->attached = 0x12;
#ifdef CONFIG_DVB_NET
ret = dvb_net_init(adap, &dvb->dvbnet, dvb->dmxdev.demux);
if (ret < 0)
return ret;
#endif
dvb->attached = 0x20;
if (input->port->dev->ns_num) {
@ -2720,10 +2734,12 @@ static void ddb_ports_init(struct ddb *dev)
ddb_input_init(port, 2 * i + 1, 1, 2 * p + 1);
break;
case DDB_MOD:
#ifndef CONFIG_MACH_OCTONET
ddb_output_init(port, i);
ddb_irq_set(dev, 0, i + rm->irq_base_rate,
&ddbridge_mod_rate_handler,
&dev->output[i]);
#endif
break;
default:
break;
@ -4455,8 +4471,10 @@ int ddb_init(struct ddb *dev)
if (ddb_i2c_init(dev) < 0)
goto fail;
ddb_ports_init(dev);
#ifndef CONFIG_MACH_OCTONET
if (dev->link[0].info->type == DDB_MOD)
ddbridge_mod_init(dev);
#endif
if (ddb_buffers_alloc(dev) < 0) {
dev_info(dev->dev,
"Could not allocate buffer memory\n");

View File

@ -84,7 +84,7 @@ int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
/****************************************************************************/
/****************************************************************************/
static void __devexit ddb_irq_disable(struct ddb *dev)
static void ddb_irq_disable(struct ddb *dev)
{
if (dev->link[0].info->regmap->irq_version == 2) {
ddbwritel(dev, 0x00000000, INTERRUPT_V2_CONTROL);
@ -114,7 +114,7 @@ static void __devexit ddb_msi_exit(struct ddb *dev)
#endif
}
static void __devexit ddb_irq_exit(struct ddb *dev)
static void ddb_irq_exit(struct ddb *dev)
{
ddb_irq_disable(dev);
if (dev->msi == 2)

View File

@ -101,6 +101,8 @@
#define MCI_STATUS_OK (0x00)
#define MCI_STATUS_UNSUPPORTED (0x80)
#define MCI_STATUS_BUSY (0xFA)
#define MCI_STATUS_HARDWARE_ERROR (0xFB)
#define MCI_STATUS_INVALID_PARAMETER (0xFC)
#define MCI_STATUS_RETRY (0xFD)
#define MCI_STATUS_NOT_READY (0xFE)

View File

@ -643,7 +643,7 @@ static int mod_set_attenuator(struct ddb *dev, u32 Value)
.mod_stream = 0,
.mod_setup_output = {
.connector = MOD_CONNECTOR_F,
.num_channels = 24,
.num_channels = dev->link[0].info->port_num,
.unit = MOD_UNIT_DBUV,
.channel_power = 9000 - Value * 100,
},
@ -1909,6 +1909,7 @@ int ddbridge_mod_do_ioctl(struct file *file, unsigned int cmd, void *parg)
return ret;
}
#if 0
static int mod_init_2_1(struct ddb *dev, u32 Frequency)
{
int i, streams = dev->link[0].info->port_num;
@ -1920,6 +1921,7 @@ static int mod_init_2_1(struct ddb *dev, u32 Frequency)
}
return 0;
}
#endif
static int mod_init_2(struct ddb *dev, u32 Frequency)
{

View File

@ -260,8 +260,8 @@
#define LNB_CMD_DISEQC 6
#define LNB_CMD_SCIF 7
#define LNB_BUSY BIT_ULL(4)
#define LNB_TONE BIT_ULL(15)
#define LNB_BUSY (1ULL << 4)
#define LNB_TONE (1ULL << 15)
#define LNB_INTERRUPT_BASE 4

View File

@ -1282,8 +1282,11 @@ static int dvb_net_set_mac (struct net_device *dev, void *p)
struct dvb_net_priv *priv = netdev_priv(dev);
struct sockaddr *addr=p;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0))
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
#else
eth_hw_addr_set(dev, addr->sa_data);
#endif
if (netif_running(dev))
schedule_work(&priv->restart_net_feed_wq);
@ -1381,8 +1384,11 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype)
dvbnet->dvbdev->adapter->num, if_num);
net->addr_len = 6;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0))
memcpy(net->dev_addr, dvbnet->dvbdev->adapter->proposed_mac, 6);
#else
eth_hw_addr_set(net, dvbnet->dvbdev->adapter->proposed_mac);
#endif
dvbnet->device[if_num] = net;
priv = netdev_priv(net);

View File

@ -391,7 +391,9 @@ ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, size_t*
idx = (idx + curpktlen + DVB_RINGBUFFER_PKTHDRSIZE) % rbuf->size;
}
consumed = (idx - rbuf->pread) % rbuf->size;
consumed = idx - rbuf->pread;
if (consumed < 0)
consumed += rbuf->size;
while((dvb_ringbuffer_avail(rbuf) - consumed) > DVB_RINGBUFFER_PKTHDRSIZE) {

View File

@ -1,3 +1,11 @@
#include <linux/version.h>
#if (KERNEL_VERSION(3, 8, 0) <= LINUX_VERSION_CODE)
#define __devexit
#define __devinit
#define __devinitconst
#endif
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif