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:
rjkm 2021-09-19 19:06:35 +02:00
commit 81793729e6
8 changed files with 17 additions and 83 deletions

View File

@ -2336,15 +2336,9 @@ static void input_write_dvb(struct ddb_input *input,
} }
} }
#ifdef DDB_USE_WORK
static void input_work(struct work_struct *work)
{
struct ddb_dma *dma = container_of(work, struct ddb_dma, work);
#else
static void input_tasklet(unsigned long data) static void input_tasklet(unsigned long data)
{ {
struct ddb_dma *dma = (struct ddb_dma *)data; struct ddb_dma *dma = (struct ddb_dma *)data;
#endif
struct ddb_input *input = (struct ddb_input *)dma->io; struct ddb_input *input = (struct ddb_input *)dma->io;
struct ddb *dev = input->port->dev; struct ddb *dev = input->port->dev;
unsigned long flags; unsigned long flags;
@ -2377,17 +2371,10 @@ static void input_handler(unsigned long data)
* just copy pointers and ACK. So, there is no need to go * just copy pointers and ACK. So, there is no need to go
* through the tasklet scheduler. * through the tasklet scheduler.
*/ */
#ifdef DDB_USE_WORK
if (input->redi)
queue_work(ddb_wq, &dma->work);
else
input_work(&dma->work);
#else
if (input->redi) if (input->redi)
tasklet_schedule(&dma->tasklet); tasklet_schedule(&dma->tasklet);
else else
input_tasklet(data); input_tasklet(data);
#endif
} }
#else #else
@ -2396,23 +2383,13 @@ static void input_handler(void *data)
struct ddb_input *input = (struct ddb_input *)data; struct ddb_input *input = (struct ddb_input *)data;
struct ddb_dma *dma = input->dma; struct ddb_dma *dma = input->dma;
#ifdef DDB_USE_WORK
queue_work(ddb_wq, &dma->work);
#else
input_tasklet((unsigned long)dma); input_tasklet((unsigned long)dma);
#endif
} }
#endif #endif
#ifdef DDB_USE_WORK
static void output_work(struct work_struct *work)
{
struct ddb_dma *dma = container_of(work, struct ddb_dma, work);
#else
static void output_tasklet(unsigned long data) static void output_tasklet(unsigned long data)
{ {
struct ddb_dma *dma = (struct ddb_dma *)data; struct ddb_dma *dma = (struct ddb_dma *)data;
#endif
struct ddb_output *output = (struct ddb_output *)dma->io; struct ddb_output *output = (struct ddb_output *)dma->io;
struct ddb *dev = output->port->dev; struct ddb *dev = output->port->dev;
unsigned long flags; unsigned long flags;
@ -2454,11 +2431,7 @@ static void output_handler(void *data)
struct ddb_output *output = (struct ddb_output *)data; struct ddb_output *output = (struct ddb_output *)data;
struct ddb_dma *dma = output->dma; struct ddb_dma *dma = output->dma;
#ifdef DDB_USE_WORK
queue_work(ddb_wq, &dma->work);
#else
tasklet_schedule(&dma->tasklet); tasklet_schedule(&dma->tasklet);
#endif
} }
#endif #endif
@ -2489,11 +2462,7 @@ static void ddb_dma_init(struct ddb_io *io, int nr, int out, int irq_nr)
spin_lock_init(&dma->lock); spin_lock_init(&dma->lock);
init_waitqueue_head(&dma->wq); init_waitqueue_head(&dma->wq);
if (out) { if (out) {
#ifdef DDB_USE_WORK
INIT_WORK(&dma->work, output_work);
#else
tasklet_init(&dma->tasklet, output_tasklet, (unsigned long)dma); tasklet_init(&dma->tasklet, output_tasklet, (unsigned long)dma);
#endif
dma->regs = rm->odma->base + rm->odma->size * nr; dma->regs = rm->odma->base + rm->odma->size * nr;
dma->bufregs = rm->odma_buf->base + rm->odma_buf->size * nr; dma->bufregs = rm->odma_buf->base + rm->odma_buf->size * nr;
if (io->port->dev->link[0].info->type == DDB_MOD && if (io->port->dev->link[0].info->type == DDB_MOD &&
@ -2507,11 +2476,7 @@ static void ddb_dma_init(struct ddb_io *io, int nr, int out, int irq_nr)
dma->div = 1; dma->div = 1;
} }
} else { } else {
#ifdef DDB_USE_WORK
INIT_WORK(&dma->work, input_work);
#else
tasklet_init(&dma->tasklet, input_tasklet, (unsigned long)dma); tasklet_init(&dma->tasklet, input_tasklet, (unsigned long)dma);
#endif
dma->regs = rm->idma->base + rm->idma->size * nr; dma->regs = rm->idma->base + rm->idma->size * nr;
dma->bufregs = rm->idma_buf->base + rm->idma_buf->size * nr; dma->bufregs = rm->idma_buf->base + rm->idma_buf->size * nr;
dma->num = dma_buf_num; dma->num = dma_buf_num;
@ -2705,21 +2670,12 @@ void ddb_ports_release(struct ddb *dev)
for (i = 0; i < dev->port_num; i++) { for (i = 0; i < dev->port_num; i++) {
port = &dev->port[i]; port = &dev->port[i];
#ifdef DDB_USE_WORK
if (port->input[0] && port->input[0]->dma)
cancel_work_sync(&port->input[0]->dma->work);
if (port->input[1] && port->input[1]->dma)
cancel_work_sync(&port->input[1]->dma->work);
if (port->output && port->output->dma)
cancel_work_sync(&port->output->dma->work);
#else
if (port->input[0] && port->input[0]->dma) if (port->input[0] && port->input[0]->dma)
tasklet_kill(&port->input[0]->dma->tasklet); tasklet_kill(&port->input[0]->dma->tasklet);
if (port->input[1] && port->input[1]->dma) if (port->input[1] && port->input[1]->dma)
tasklet_kill(&port->input[1]->dma->tasklet); tasklet_kill(&port->input[1]->dma->tasklet);
if (port->output && port->output->dma) if (port->output && port->output->dma)
tasklet_kill(&port->output->dma->tasklet); tasklet_kill(&port->output->dma->tasklet);
#endif
} }
} }
@ -2823,9 +2779,6 @@ irqreturn_t ddb_irq_handler(int irq, void *dev_id)
irq_handle_msg(dev, s); irq_handle_msg(dev, s);
if (s & 0x0fffff00) { if (s & 0x0fffff00) {
irq_handle_io(dev, s); irq_handle_io(dev, s);
#ifdef DDB_TEST_THREADED
ret = IRQ_WAKE_THREAD;
#endif
} }
} while ((s = ddbreadl(dev, INTERRUPT_STATUS))); } while ((s = ddbreadl(dev, INTERRUPT_STATUS)));
@ -2873,15 +2826,6 @@ irqreturn_t ddb_irq_handler_v2(int irq, void *dev_id)
return ret; return ret;
} }
#ifdef DDB_TEST_THREADED
static irqreturn_t irq_thread(int irq, void *dev_id)
{
/* struct ddb *dev = (struct ddb *) dev_id; */
return IRQ_HANDLED;
}
#endif
/****************************************************************************/ /****************************************************************************/
/****************************************************************************/ /****************************************************************************/
/****************************************************************************/ /****************************************************************************/

View File

@ -255,17 +255,9 @@ static int __devinit ddb_irq_init(struct ddb *dev)
return stat; return stat;
} }
} else { } else {
#ifdef DDB_TEST_THREADED
stat = request_threaded_irq(pci_irq_vector(dev->pdev, 0),
dev->pdev->irq, ddb_irq_handler,
irq_thread,
irq_flag,
"ddbridge", (void *)dev);
#else
stat = request_irq(pci_irq_vector(dev->pdev, 0), stat = request_irq(pci_irq_vector(dev->pdev, 0),
ddb_irq_handler, ddb_irq_handler,
irq_flag, "ddbridge", (void *)dev); irq_flag, "ddbridge", (void *)dev);
#endif
if (stat < 0) if (stat < 0)
return stat; return stat;
} }

View File

@ -23,9 +23,6 @@
#ifndef _DDBRIDGE_H_ #ifndef _DDBRIDGE_H_
#define _DDBRIDGE_H_ #define _DDBRIDGE_H_
/* #define DDB_USE_WORK */
/*#define DDB_TEST_THREADED*/
#include <linux/version.h> #include <linux/version.h>
#if (KERNEL_VERSION(3, 8, 0) <= LINUX_VERSION_CODE) #if (KERNEL_VERSION(3, 8, 0) <= LINUX_VERSION_CODE)
@ -205,11 +202,7 @@ struct ddb_dma {
u32 div; u32 div;
u32 bufval; u32 bufval;
#ifdef DDB_USE_WORK
struct work_struct work;
#else
struct tasklet_struct tasklet; struct tasklet_struct tasklet;
#endif
spinlock_t lock; /* DMA lock */ spinlock_t lock; /* DMA lock */
wait_queue_head_t wq; wait_queue_head_t wq;
int running; int running;

View File

@ -12,6 +12,7 @@
#include <stdint.h> #include <stdint.h>
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
#include <inttypes.h>
char line_start[16] = ""; char line_start[16] = "";
char line_end[16] = "\r"; char line_end[16] = "\r";
@ -427,7 +428,10 @@ int main(int argc, char **argv)
get_ts = 0; get_ts = 0;
break; break;
case 'h': case 'h':
fprintf(fout,"ddzap [-d delivery_system] [-p polarity] [-c config_dir] [-f frequency(Hz)]\n" fprintf(fout,"ddzap [-d delivery_system] [-p polarity] [-c config_dir]\n"
" [-f frequency(Hz for terr./kHz for SAT)]\n"
" [-m 16APSK/32APSK/64APSK/128APSK/256APSK]\n"
" (only needed for higher modulations than 8PSK) on some cards\n"
" [-b bandwidth(Hz)] [-s symbol_rate(Hz)]\n" " [-b bandwidth(Hz)] [-s symbol_rate(Hz)]\n"
" [-g gold_code] [-r root_code] [-i id] [-n device_num]\n" " [-g gold_code] [-r root_code] [-i id] [-n device_num]\n"
" [-o (write dvr to stdout)]\n" " [-o (write dvr to stdout)]\n"
@ -503,9 +507,10 @@ int main(int argc, char **argv)
str = dddvb_get_strength(fe); str = dddvb_get_strength(fe);
cnr = dddvb_get_cnr(fe); cnr = dddvb_get_cnr(fe);
printf("stat=%02x, str=%lld.%03llddB, snr=%lld.%03llddB \n", printf("stat=%02x, str=%" PRId64 ".%03udBm, "
stat, (long long int)str/1000, (long long int) abs(str%1000), "snr=%" PRId64 ".%03uddB \n",
(long long int) cnr/1000, (long long int)abs(cnr%1000)); stat, str/1000, abs(str%1000),
cnr/1000, abs(cnr%1000));
sleep(1); sleep(1);
} }
} else { } else {

View File

@ -41,7 +41,7 @@ int parse_config(struct dddvb *dd, char *name, char *sec,
memcpy(fname + config_len, "dddvb.conf", 11); memcpy(fname + config_len, "dddvb.conf", 11);
if ((f = fopen (fname, "r")) == NULL) { if ((f = fopen (fname, "r")) == NULL) {
printf("config file %s not found\n", fname); dprintf(2, "config file %s not found\n", fname);
return -1; return -1;
} }

View File

@ -8,7 +8,7 @@ LIBDDDVB_EXPORTED struct dddvb *global_dd = NULL;
LIBDDDVB_EXPORTED pthread_mutex_t dddvb_mutex = PTHREAD_MUTEX_INITIALIZER; LIBDDDVB_EXPORTED pthread_mutex_t dddvb_mutex = PTHREAD_MUTEX_INITIALIZER;
void __attribute__ ((constructor)) setup(void) { void __attribute__ ((constructor)) setup(void) {
printf("SETUP\n"); //printf("SETUP\n");
} }
LIBDDDVB_EXPORTED struct dddvb_fe *dddvb_fe_alloc_num(struct dddvb *dd, uint32_t type, uint32_t num) LIBDDDVB_EXPORTED struct dddvb_fe *dddvb_fe_alloc_num(struct dddvb *dd, uint32_t type, uint32_t num)

View File

@ -231,7 +231,7 @@ static int set_en50607(struct dddvb_fe *fe, uint32_t freq, uint32_t sr,
uint32_t input = 3 & (sat >> 6); uint32_t input = 3 & (sat >> 6);
int fd = fe->fd; int fd = fe->fd;
//printf("input = %u, sat = %u\n", input, sat&0x3f); dbgprintf(DEBUG_DVB, "input = %u, sat = %u\n", input, sat&0x3f);
hor &= 1; hor &= 1;
cmd.msg[1] = slot << 3; cmd.msg[1] = slot << 3;
cmd.msg[1] |= ((t >> 8) & 0x07); cmd.msg[1] |= ((t >> 8) & 0x07);
@ -323,7 +323,7 @@ static int tune_sat(struct dddvb_fe *fe)
if (input != DDDVB_UNDEF) { if (input != DDDVB_UNDEF) {
input = 3 & (input >> 6); input = 3 & (input >> 6);
printf("input = %u\n", input); dbgprintf(DEBUG_DVB, "input = %u\n", input);
} }
diseqc(fe->fd, lnb, fe->param.param[PARAM_POL], hi); diseqc(fe->fd, lnb, fe->param.param[PARAM_POL], hi);
set_fe_input(fe, freq, fe->param.param[PARAM_SR], ds, input); set_fe_input(fe, freq, fe->param.param[PARAM_SR], ds, input);
@ -349,7 +349,7 @@ static int tune_c(struct dddvb_fe *fe)
struct dtv_properties c; struct dtv_properties c;
int ret; int ret;
printf("tune_c()\n"); dbgprintf(DEBUG_DVB, "tune_c()\n");
set_property(fe->fd, DTV_DELIVERY_SYSTEM, SYS_DVBC_ANNEX_A); set_property(fe->fd, DTV_DELIVERY_SYSTEM, SYS_DVBC_ANNEX_A);
c.num = ARRAY_SIZE(p); c.num = ARRAY_SIZE(p);
@ -376,7 +376,7 @@ static int tune_j83b(struct dddvb_fe *fe)
struct dtv_properties c; struct dtv_properties c;
int ret; int ret;
printf("tune_j83b()\n"); dbgprintf(DEBUG_DVB, "tune_j83b()\n");
set_property(fe->fd, DTV_DELIVERY_SYSTEM, SYS_DVBC_ANNEX_B); set_property(fe->fd, DTV_DELIVERY_SYSTEM, SYS_DVBC_ANNEX_B);
c.num = ARRAY_SIZE(p); c.num = ARRAY_SIZE(p);
@ -542,7 +542,7 @@ static int tune(struct dddvb_fe *fe)
{ {
int ret; int ret;
printf("tune()\n"); dbgprintf(DEBUG_DVB, "tune()\n");
switch (fe->param.param[PARAM_MSYS]) { switch (fe->param.param[PARAM_MSYS]) {
case SYS_DVBS: case SYS_DVBS:
case SYS_DVBS2: case SYS_DVBS2:

View File

@ -13,7 +13,7 @@ int sendlen(int sock, char *buf, int len)
for (todo = len; todo; todo -= done, buf += done) for (todo = len; todo; todo -= done, buf += done)
if ((done = send(sock, buf, todo, 0)) < 0) { if ((done = send(sock, buf, todo, 0)) < 0) {
printf("sendlen error\n"); dprintf(2, "sendlen error\n");
return done; return done;
} }
return len; return len;