Commit 443c1228 authored by Steven Toth's avatar Steven Toth Committed by Mauro Carvalho Chehab

V4L/DVB (12923): SAA7164: Add support for the NXP SAA7164 silicon

This patch adds support for all of the known shipping Hauppauge HVR-2200
and HVR-2250 boards. Digital TV ATSC/QAM and DVB-T is enabled at this
time. Both tuners are supported.

Volatiles and typedefs need rework, the rest is coding style compliant.
Signed-off-by: default avatarSteven Toth <stoth@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 9afef394
0 -> Unknown
1 -> Generic Rev2
2 -> Generic Rev3
3 -> Hauppauge WinTV-HVR2250 [0070:8880,0070:8810]
4 -> Hauppauge WinTV-HVR2200 [0070:8980]
5 -> Hauppauge WinTV-HVR2200 [0070:8900]
6 -> Hauppauge WinTV-HVR2200 [0070:8901]
7 -> Hauppauge WinTV-HVR2250 [0070:88A1,0070:8891]
......@@ -690,6 +690,8 @@ source "drivers/media/video/ivtv/Kconfig"
source "drivers/media/video/cx18/Kconfig"
source "drivers/media/video/saa7164/Kconfig"
config VIDEO_M32R_AR
tristate "AR devices"
depends on M32R && VIDEO_V4L1
......
......@@ -157,6 +157,7 @@ obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o
obj-$(CONFIG_VIDEO_AU0828) += au0828/
obj-$(CONFIG_USB_VIDEO_CLASS) += uvc/
obj-$(CONFIG_VIDEO_SAA7164) += saa7164/
obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o
......
config VIDEO_SAA7164
tristate "NXP SAA7164 support"
depends on DVB_CORE && PCI && I2C
depends on HOTPLUG # due to FW_LOADER
select I2C_ALGOBIT
select FW_LOADER
select VIDEO_TUNER
select VIDEO_TVEEPROM
select VIDEOBUF_DVB
select DVB_TDA10048 if !DVB_FE_CUSTOMISE
select DVB_S5H1411 if !DVB_FE_CUSTOMISE
select MEDIA_TUNER_TDA18271 if !DVB_FE_CUSTOMIZE
---help---
This is a video4linux driver for NXP SAA7164 based
TV cards.
To compile this driver as a module, choose M here: the
module will be called saa7164
saa7164-objs := saa7164-cards.o saa7164-core.o saa7164-i2c.o saa7164-dvb.o \
saa7164-fw.o saa7164-bus.o saa7164-cmd.o saa7164-api.o \
saa7164-buffer.o
obj-$(CONFIG_VIDEO_SAA7164) += saa7164.o
EXTRA_CFLAGS += -Idrivers/media/video
EXTRA_CFLAGS += -Idrivers/media/common/tuners
EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m)
This diff is collapsed.
/*
* Driver for the NXP SAA7164 PCIe bridge
*
* Copyright (c) 2009 Steven Toth <stoth@kernellabs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "saa7164.h"
/* The PCI address space for buffer handling looks like this:
+-u32 wide-------------+
| +
+-u64 wide------------------------------------+
+ +
+----------------------+
| CurrentBufferPtr + Pointer to current PCI buffer >-+
+----------------------+ |
| Unused + |
+----------------------+ |
| Pitch + = 188 (bytes) |
+----------------------+ |
| PCI buffer size + = pitch * number of lines (312) |
+----------------------+ |
|0| Buf0 Write Offset + |
+----------------------+ v
|1| Buf1 Write Offset + |
+----------------------+ |
|2| Buf2 Write Offset + |
+----------------------+ |
|3| Buf3 Write Offset + |
+----------------------+ |
... More write offsets |
+---------------------------------------------+ |
+0| set of ptrs to PCI pagetables + |
+---------------------------------------------+ |
+1| set of ptrs to PCI pagetables + <--------+
+---------------------------------------------+
+2| set of ptrs to PCI pagetables +
+---------------------------------------------+
+3| set of ptrs to PCI pagetables + >--+
+---------------------------------------------+ |
... More buffer pointers | +----------------+
+->| pt[0] TS data |
| +----------------+
|
| +----------------+
+->| pt[1] TS data |
| +----------------+
| etc
*/
/* Allocate a new buffer structure and associated PCI space in bytes.
* len must be a multiple of sizeof(u64)
*/
struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_tsport *port,
u32 len)
{
struct saa7164_buffer *buf = 0;
struct saa7164_dev *dev = port->dev;
int i;
if ((len == 0) || (len >= 65536) || (len % sizeof(u64))) {
log_warn("%s() SAA_ERR_BAD_PARAMETER\n", __func__);
goto ret;
}
buf = kzalloc(sizeof(struct saa7164_buffer), GFP_KERNEL);
if (buf == NULL) {
log_warn("%s() SAA_ERR_NO_RESOURCES\n", __func__);
goto ret;
}
buf->port = port;
buf->flags = SAA7164_BUFFER_FREE;
/* TODO: arg len is being ignored */
buf->pci_size = SAA7164_PT_ENTRIES * 0x1000;
buf->pt_size = (SAA7164_PT_ENTRIES * sizeof(u64)) + 0x1000;
/* Allocate contiguous memory */
buf->cpu = pci_alloc_consistent(port->dev->pci, buf->pci_size,
&buf->dma);
if (!buf->cpu)
goto fail1;
buf->pt_cpu = pci_alloc_consistent(port->dev->pci, buf->pt_size,
&buf->pt_dma);
if (!buf->pt_cpu)
goto fail2;
/* init the buffers to a known pattern, easier during debugging */
memset(buf->cpu, 0xff, buf->pci_size);
memset(buf->pt_cpu, 0xff, buf->pt_size);
dprintk(DBGLVL_BUF, "%s() allocated buffer @ 0x%p\n", __func__, buf);
dprintk(DBGLVL_BUF, " pci_cpu @ 0x%llx dma @ 0x%llx len = 0x%x\n",
(u64)buf->cpu, (u64)buf->dma, buf->pci_size);
dprintk(DBGLVL_BUF, " pt_cpu @ 0x%llx pt_dma @ 0x%llx len = 0x%x\n",
(u64)buf->pt_cpu, (u64)buf->pt_dma, buf->pt_size);
/* Format the Page Table Entries to point into the data buffer */
for (i = 0 ; i < SAA7164_PT_ENTRIES; i++) {
*(buf->pt_cpu + i) = buf->dma + (i * 0x1000); /* TODO */
dprintk(DBGLVL_BUF, " pt[%02d] = 0x%llx -> 0x%llx\n",
i, (u64)buf->pt_cpu, (u64)*(buf->pt_cpu));
}
goto ret;
fail2:
pci_free_consistent(port->dev->pci, buf->pci_size, buf->cpu, buf->dma);
fail1:
kfree(buf);
buf = 0;
ret:
return buf;
}
int saa7164_buffer_dealloc(struct saa7164_tsport *port,
struct saa7164_buffer *buf)
{
struct saa7164_dev *dev = port->dev;
if ((buf == 0) || (port == 0))
return SAA_ERR_BAD_PARAMETER;
dprintk(DBGLVL_BUF, "%s() deallocating buffer @ 0x%p\n", __func__, buf);
if (buf->flags != SAA7164_BUFFER_FREE)
log_warn(" freeing a non-free buffer\n");
pci_free_consistent(port->dev->pci, buf->pci_size, buf->cpu, buf->dma);
pci_free_consistent(port->dev->pci, buf->pt_size, buf->pt_cpu,
buf->pt_dma);
kfree(buf);
return SAA_OK;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Driver for the NXP SAA7164 PCIe bridge
*
* Copyright (c) 2009 Steven Toth <stoth@kernellabs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/io.h>
#include "saa7164.h"
static int i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num)
{
struct saa7164_i2c *bus = i2c_adap->algo_data;
struct saa7164_dev *dev = bus->dev;
int i, retval = 0;
dprintk(DBGLVL_I2C, "%s(num = %d)\n", __func__, num);
for (i = 0 ; i < num; i++) {
dprintk(DBGLVL_I2C, "%s(num = %d) addr = 0x%02x len = 0x%x\n",
__func__, num, msgs[i].addr, msgs[i].len);
if (msgs[i].flags & I2C_M_RD) {
/* Unsupported - Yet*/
printk(KERN_ERR "%s() Unsupported - Yet\n", __func__);
continue;
} else if (i + 1 < num && (msgs[i + 1].flags & I2C_M_RD) &&
msgs[i].addr == msgs[i + 1].addr) {
/* write then read from same address */
retval = saa7164_api_i2c_read(bus, msgs[i].addr,
msgs[i].len, msgs[i].buf,
msgs[i+1].len, msgs[i+1].buf
);
i++;
if (retval < 0)
goto err;
} else {
/* write */
retval = saa7164_api_i2c_write(bus, msgs[i].addr,
msgs[i].len, msgs[i].buf);
}
if (retval < 0)
goto err;
}
return num;
err:
return retval;
}
static int attach_inform(struct i2c_client *client)
{
struct saa7164_i2c *bus = i2c_get_adapdata(client->adapter);
struct saa7164_dev *dev = bus->dev;
dprintk(DBGLVL_I2C, "%s i2c attach [addr=0x%x,client=%s]\n",
client->driver->driver.name, client->addr, client->name);
if (!client->driver->command)
return 0;
return 0;
}
static int detach_inform(struct i2c_client *client)
{
struct saa7164_dev *dev = i2c_get_adapdata(client->adapter);
dprintk(DBGLVL_I2C, "i2c detach [client=%s]\n", client->name);
return 0;
}
void saa7164_call_i2c_clients(struct saa7164_i2c *bus, unsigned int cmd,
void *arg)
{
if (bus->i2c_rc != 0)
return;
i2c_clients_command(&bus->i2c_adap, cmd, arg);
}
static u32 saa7164_functionality(struct i2c_adapter *adap)
{
return I2C_FUNC_I2C;
}
static struct i2c_algorithm saa7164_i2c_algo_template = {
.master_xfer = i2c_xfer,
.functionality = saa7164_functionality,
};
/* ----------------------------------------------------------------------- */
static struct i2c_adapter saa7164_i2c_adap_template = {
.name = "saa7164",
.owner = THIS_MODULE,
.id = I2C_HW_B_SAA7164,
.algo = &saa7164_i2c_algo_template,
.client_register = attach_inform,
.client_unregister = detach_inform,
};
static struct i2c_client saa7164_i2c_client_template = {
.name = "saa7164 internal",
};
int saa7164_i2c_register(struct saa7164_i2c *bus)
{
struct saa7164_dev *dev = bus->dev;
dprintk(DBGLVL_I2C, "%s(bus = %d)\n", __func__, bus->nr);
memcpy(&bus->i2c_adap, &saa7164_i2c_adap_template,
sizeof(bus->i2c_adap));
memcpy(&bus->i2c_algo, &saa7164_i2c_algo_template,
sizeof(bus->i2c_algo));
memcpy(&bus->i2c_client, &saa7164_i2c_client_template,
sizeof(bus->i2c_client));
bus->i2c_adap.dev.parent = &dev->pci->dev;
strlcpy(bus->i2c_adap.name, bus->dev->name,
sizeof(bus->i2c_adap.name));
bus->i2c_algo.data = bus;
bus->i2c_adap.algo_data = bus;
i2c_set_adapdata(&bus->i2c_adap, bus);
i2c_add_adapter(&bus->i2c_adap);
bus->i2c_client.adapter = &bus->i2c_adap;
if (0 == bus->i2c_rc) {
printk(KERN_ERR "%s: i2c bus %d registered\n",
dev->name, bus->nr);
} else
printk(KERN_ERR "%s: i2c bus %d register FAILED\n",
dev->name, bus->nr);
return bus->i2c_rc;
}
int saa7164_i2c_unregister(struct saa7164_i2c *bus)
{
i2c_del_adapter(&bus->i2c_adap);
return 0;
}
/*
* Driver for the NXP SAA7164 PCIe bridge
*
* Copyright (c) 2009 Steven Toth <stoth@kernellabs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* TODO: Retest the driver with errors expressed as negatives */
/* Result codes */
#define SAA_OK 0
#define SAA_ERR_BAD_PARAMETER 0x09
#define SAA_ERR_NO_RESOURCES 0x0c
#define SAA_ERR_NOT_SUPPORTED 0x13
#define SAA_ERR_BUSY 0x15
#define SAA_ERR_READ 0x17
#define SAA_ERR_TIMEOUT 0x1f
#define SAA_ERR_OVERFLOW 0x20
#define SAA_ERR_EMPTY 0x22
#define SAA_ERR_NOT_STARTED 0x23
#define SAA_ERR_ALREADY_STARTED 0x24
#define SAA_ERR_NOT_STOPPED 0x25
#define SAA_ERR_ALREADY_STOPPED 0x26
#define SAA_ERR_INVALID_COMMAND 0x3e
#define SAA_ERR_NULL_PACKET 0x59
/* Errors and flags from the silicon */
#define PVC_ERRORCODE_UNKNOWN 0x00
#define PVC_ERRORCODE_INVALID_COMMAND 0x01
#define PVC_ERRORCODE_INVALID_CONTROL 0x02
#define PVC_ERRORCODE_INVALID_DATA 0x03
#define PVC_ERRORCODE_TIMEOUT 0x04
#define PVC_ERRORCODE_NAK 0x05
#define PVC_RESPONSEFLAG_ERROR 0x01
#define PVC_RESPONSEFLAG_OVERFLOW 0x02
#define PVC_RESPONSEFLAG_RESET 0x04
#define PVC_RESPONSEFLAG_INTERFACE 0x08
#define PVC_RESPONSEFLAG_CONTINUED 0x10
#define PVC_CMDFLAG_INTERRUPT 0x02
#define PVC_CMDFLAG_INTERFACE 0x04
#define PVC_CMDFLAG_SERIALIZE 0x08
#define PVC_CMDFLAG_CONTINUE 0x10
/* Silicon Commands */
#define GET_DESCRIPTORS_CONTROL 0x01
#define GET_STRING_CONTROL 0x03
#define GET_LANGUAGE_CONTROL 0x05
#define SET_POWER_CONTROL 0x07
#define GET_FW_VERSION_CONTROL 0x09
#define SET_DEBUG_LEVEL_CONTROL 0x0B
#define GET_DEBUG_DATA_CONTROL 0x0C
#define GET_PRODUCTION_INFO_CONTROL 0x0D
/* cmd defines */
#define SAA_CMDFLAG_CONTINUE 0x10
#define SAA_CMD_MAX_MSG_UNITS 256
/* Some defines */
#define SAA_BUS_TIMEOUT 50
#define SAA_DEVICE_TIMEOUT 5000
#define SAA_DEVICE_MAXREQUESTSIZE 256
/* Register addresses */
#define SAA_DEVICE_VERSION 0x30
#define SAA_DOWNLOAD_FLAGS 0x34
#define SAA_DOWNLOAD_FLAG 0x34
#define SAA_DOWNLOAD_FLAG_ACK 0x38
#define SAA_DATAREADY_FLAG 0x3C
#define SAA_DATAREADY_FLAG_ACK 0x40
/* Boot loader register and bit definitions */
#define SAA_BOOTLOADERERROR_FLAGS 0x44
#define SAA_DEVICE_IMAGE_SEARCHING 0x01
#define SAA_DEVICE_IMAGE_LOADING 0x02
#define SAA_DEVICE_IMAGE_BOOTING 0x03
#define SAA_DEVICE_IMAGE_CORRUPT 0x04
#define SAA_DEVICE_MEMORY_CORRUPT 0x08
#define SAA_DEVICE_NO_IMAGE 0x10
/* Register addresses */
#define SAA_DEVICE_2ND_VERSION 0x50
#define SAA_DEVICE_2ND_DOWNLOADFLAG_OFFSET 0x54
/* Register addresses */
#define SAA_SECONDSTAGEERROR_FLAGS 0x64
/* Bootloader regs and flags */
#define SAA_DEVICE_DEADLOCK_DETECTED_OFFSET 0x6C
#define SAA_DEVICE_DEADLOCK_DETECTED 0xDEADDEAD
/* Basic firmware status registers */
#define SAA_DEVICE_SYSINIT_STATUS_OFFSET 0x70
#define SAA_DEVICE_SYSINIT_STATUS 0x70
#define SAA_DEVICE_SYSINIT_MODE 0x74
#define SAA_DEVICE_SYSINIT_SPEC 0x78
#define SAA_DEVICE_SYSINIT_INST 0x7C
#define SAA_DEVICE_SYSINIT_CPULOAD 0x80
#define SAA_DEVICE_SYSINIT_REMAINHEAP 0x84
#define SAA_DEVICE_DOWNLOAD_OFFSET 0x1000
#define SAA_DEVICE_BUFFERBLOCKSIZE 0x1000
#define SAA_DEVICE_2ND_BUFFERBLOCKSIZE 0x100000
#define SAA_DEVICE_2ND_DOWNLOAD_OFFSET 0x200000
/* Descriptors */
#define CS_INTERFACE 0x24
/* Descriptor subtypes */
#define VC_INPUT_TERMINAL 0x02
#define VC_OUTPUT_TERMINAL 0x03
#define VC_SELECTOR_UNIT 0x04
#define VC_PROCESSING_UNIT 0x05
#define FEATURE_UNIT 0x06
#define TUNER_UNIT 0x09
#define ENCODER_UNIT 0x0A
#define EXTENSION_UNIT 0x0B
#define VC_TUNER_PATH 0xF0
#define PVC_HARDWARE_DESCRIPTOR 0xF1
#define PVC_INTERFACE_DESCRIPTOR 0xF2
#define PVC_INFRARED_UNIT 0xF3
#define DRM_UNIT 0xF4
#define GENERAL_REQUEST 0xF5
/* Format Types */
#define VS_FORMAT_TYPE 0x02
#define VS_FORMAT_TYPE_I 0x01
#define VS_FORMAT_UNCOMPRESSED 0x04
#define VS_FRAME_UNCOMPRESSED 0x05
#define VS_FORMAT_MPEG2PS 0x09
#define VS_FORMAT_MPEG2TS 0x0A
#define VS_FORMAT_MPEG4SL 0x0B
#define VS_FORMAT_WM9 0x0C
#define VS_FORMAT_DIVX 0x0D
#define VS_FORMAT_VBI 0x0E
#define VS_FORMAT_RDS 0x0F
/* Device extension commands */
#define EXU_REGISTER_ACCESS_CONTROL 0x00
#define EXU_GPIO_CONTROL 0x01
#define EXU_GPIO_GROUP_CONTROL 0x02
#define EXU_INTERRUPT_CONTROL 0x03
/* State Transition and args */
#define SAA_STATE_CONTROL 0x03
#define SAA_DMASTATE_STOP 0x00
#define SAA_DMASTATE_ACQUIRE 0x01
#define SAA_DMASTATE_PAUSE 0x02
#define SAA_DMASTATE_RUN 0x03
/* Hardware registers */
/*
* Driver for the NXP SAA7164 PCIe bridge
*
* Copyright (c) 2009 Steven Toth <stoth@kernellabs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* TODO: Cleanup and shorten the namespace */
/* Some structues are passed directly to/from the firmware and
* have strict alignment requirements. This is one of them.
*/
typedef struct {
u8 bLength;
u8 bDescriptorType;
u8 bDescriptorSubtype;
u16 bcdSpecVersion;
u32 dwClockFrequency;
u32 dwClockUpdateRes;
u8 bCapabilities;
u32 dwDeviceRegistersLocation;
u32 dwHostMemoryRegion;
u32 dwHostMemoryRegionSize;
u32 dwHostHibernatMemRegion;
u32 dwHostHibernatMemRegionSize;
} __attribute__((packed)) tmComResHWDescr_t;
/* This is DWORD aligned on windows but I can't find the right
* gcc syntax to match the binary data from the device.
* I've manually padded with Reserved[3] bytes to match the hardware,
* but this could break if GCC decies to pack in a different way.
*/
typedef struct {
u8 bLength;
u8 bDescriptorType;
u8 bDescriptorSubtype;
u8 bFlags;
u8 bInterfaceType;
u8 bInterfaceId;
u8 bBaseInterface;
u8 bInterruptId;
u8 bDebugInterruptId;
u8 BARLocation;
u8 Reserved[3];
} tmComResInterfaceDescr_t;
typedef struct {
u64 CommandRing;
u64 ResponseRing;
u32 CommandWrite;
u32 CommandRead;
u32 ResponseWrite;
u32 ResponseRead;
} tmComResBusDescr_t;
typedef enum {
NONE = 0,
TYPE_BUS_PCI = 1,
TYPE_BUS_PCIe = 2,
TYPE_BUS_USB = 3,
TYPE_BUS_I2C = 4
} tmBusType_t;
typedef struct {
tmBusType_t Type;
u16 m_wMaxReqSize;
u8 *m_pdwSetRing;
u32 m_dwSizeSetRing;
u8 *m_pdwGetRing;
u32 m_dwSizeGetRing;
u32 *m_pdwSetWritePos;
u32 *m_pdwSetReadPos;
u32 *m_pdwGetWritePos;
u32 *m_pdwGetReadPos;
/* All access is protected */
struct mutex lock;
} tmComResBusInfo_t;
typedef struct {
u8 id;
u8 flags;
u16 size;
u32 command;
u16 controlselector;
u8 seqno;
} __attribute__((packed)) tmComResInfo_t;
typedef enum {
SET_CUR = 0x01,
GET_CUR = 0x81,
GET_MIN = 0x82,
GET_MAX = 0x83,
GET_RES = 0x84,
GET_LEN = 0x85,
GET_INFO = 0x86,
GET_DEF = 0x87
} tmComResCmd_t;
struct cmd {
u8 seqno;
u32 inuse;
u32 timeout;
u32 signalled;
struct mutex lock;
wait_queue_head_t wait;
};
typedef struct {
u32 pathid;
u32 size;
void *descriptor;
} tmDescriptor_t;
typedef struct {
u8 len;
u8 type;
u8 subtype;
u8 unitid;
} __attribute__((packed)) tmComResDescrHeader_t;
typedef struct {
u8 len;
u8 type;
u8 subtype;
u8 unitid;
u32 devicetype;
u16 deviceid;
u32 numgpiopins;
u8 numgpiogroups;
u8 controlsize;
} __attribute__((packed)) tmComResExtDevDescrHeader_t;
typedef struct {
u32 pin;
u8 state;
} __attribute__((packed)) tmComResGPIO_t;
typedef struct {
u8 len;
u8 type;
u8 subtype;
u8 pathid;
} __attribute__((packed)) tmComResPathDescrHeader_t;
/* terminaltype */
typedef enum {
ITT_ANTENNA = 0x0203,
LINE_CONNECTOR = 0x0603,
SPDIF_CONNECTOR = 0x0605,
COMPOSITE_CONNECTOR = 0x0401,
SVIDEO_CONNECTOR = 0x0402,
COMPONENT_CONNECTOR = 0x0403,
STANDARD_DMA = 0xF101
} tmComResTermType_t;
typedef struct {
u8 len;
u8 type;
u8 subtype;
u8 terminalid;
u16 terminaltype;
u8 assocterminal;
u8 iterminal;
u8 controlsize;
} __attribute__((packed)) tmComResAntTermDescrHeader_t;
typedef struct {
u8 len;
u8 type;
u8 subtype;
u8 unitid;
u8 sourceid;
u8 iunit;
u32 tuningstandards;
u8 controlsize;
u32 controls;
} __attribute__((packed)) tmComResTunerDescrHeader_t;
typedef enum {
/* the buffer does not contain any valid data */
TM_BUFFER_FLAG_EMPTY,
/* the buffer is filled with valid data */
TM_BUFFER_FLAG_DONE,
/* the buffer is the dummy buffer - TODO??? */
TM_BUFFER_FLAG_DUMMY_BUFFER
} tmBufferFlag_t;
typedef struct {
u64 *pagetablevirt;
u64 pagetablephys;
u16 offset;
u8 *context;
u64 timestamp;
tmBufferFlag_t BufferFlag_t;
u32 lostbuffers;
u32 validbuffers;
u64 *dummypagevirt;
u64 dummypagephys;
u64 *addressvirt;
} tmBuffer_t;
typedef struct {
u32 bitspersample;
u32 samplesperline;
u32 numberoflines;
u32 pitch;
u32 linethreshold;
u64 **pagetablelistvirt;
u64 *pagetablelistphys;
u32 numpagetables;
u32 numpagetableentries;
} tmHWStreamParameters_t;
typedef struct {
tmHWStreamParameters_t HWStreamParameters_t;
u64 qwDummyPageTablePhys;
u64 *pDummyPageTableVirt;
} tmStreamParameters_t;
typedef struct {
u8 len;
u8 type;
u8 subtyle;
u8 unitid;
u16 terminaltype;
u8 assocterminal;
u8 sourceid;
u8 iterminal;
u32 BARLocation;
u8 flags;
u8 interruptid;
u8 buffercount;
u8 metadatasize;
u8 numformats;
u8 controlsize;
} __attribute__((packed)) tmComResDMATermDescrHeader_t;
/*
*
* Description:
* This is the transport stream format header.
*
* Settings:
* bLength - The size of this descriptor in bytes.
* bDescriptorType - CS_INTERFACE.
* bDescriptorSubtype - VS_FORMAT_MPEG2TS descriptor subtype.
* bFormatIndex - A non-zero constant that uniquely identifies the
* format.
* bDataOffset - Offset to TSP packet within MPEG-2 TS transport
* stride, in bytes.
* bPacketLength - Length of TSP packet, in bytes (typically 188).
* bStrideLength - Length of MPEG-2 TS transport stride.
* guidStrideFormat - A Globally Unique Identifier indicating the
* format of the stride data (if any). Set to zeros
* if there is no Stride Data, or if the Stride
* Data is to be ignored by the application.
*
*/
typedef struct {
u8 len;
u8 type;
u8 subtype;
u8 bFormatIndex;
u8 bDataOffset;
u8 bPacketLength;
u8 bStrideLength;
u8 guidStrideFormat[16];
} __attribute__((packed)) tmComResTSFormatDescrHeader_t;
This diff is collapsed.
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