Commit 4d270cfb authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] saa7164: Don't use typedefs

According with CodingStyle, drivers shouldn't use typedef, except on very
special cases. This is not the case of saa7164. So, convert all usecases
to struct/enum.

After changing the saa7164-types.h, all we need to do is to run those scripts
to fix all occurrences of the bad types and double check/fix everything that
might be broken after the test (of course, I did a small script to generate those scripts).

for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmBusType_t/enum tmBusType/; print " \>a \&\& mv a tmBusType; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResCmd_t/enum tmComResCmd/; print " \>a \&\& mv a tmComResCmd; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResTermType_t/enum tmComResTermType/; print " \>a \&\& mv a tmComResTermType; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmBufferFlag_t/enum tmBufferFlag/; print " \>a \&\& mv a tmBufferFlag; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResHWDescr_t/struct tmComResHWDescr/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResInterfaceDescr_t/struct tmComResInterfaceDescr/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResBusDescr_t/struct tmComResBusDescr/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmBusType_t/struct tmBusType/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResBusInfo_t/struct tmComResBusInfo/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResInfo_t/struct tmComResInfo/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResCmd_t/struct tmComResCmd/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmDescriptor_t/struct tmDescriptor/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResDescrHeader_t/struct tmComResDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResExtDevDescrHeader_t/struct tmComResExtDevDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResGPIO_t/struct tmComResGPIO/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResPathDescrHeader_t/struct tmComResPathDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResTermType_t/struct tmComResTermType/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResAntTermDescrHeader_t/struct tmComResAntTermDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResTunerDescrHeader_t/struct tmComResTunerDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmBufferFlag_t/struct tmBufferFlag/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmBuffer_t/struct tmBuffer/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmHWStreamParameters_t/struct tmHWStreamParameters/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmStreamParameters_t/struct tmStreamParameters/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResDMATermDescrHeader_t/struct tmComResDMATermDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResTSFormatDescrHeader_t/struct tmComResTSFormatDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResSelDescrHeader_t/struct tmComResSelDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResProcDescrHeader_t/struct tmComResProcDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResEncVideoBitRate_t/struct tmComResEncVideoBitRate/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResEncVideoInputAspectRatio_t/struct tmComResEncVideoInputAspectRatio/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResEncVideoGopStructure_t/struct tmComResEncVideoGopStructure/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResEncoderDescrHeader_t/struct tmComResEncoderDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResAFeatureDescrHeader_t/struct tmComResAFeatureDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResAudioDefaults_t/struct tmComResAudioDefaults/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResEncAudioBitRate_t/struct tmComResEncAudioBitRate/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResTunerStandard_t/struct tmComResTunerStandard/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResTunerStandardAuto_t/struct tmComResTunerStandardAuto/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResPSFormatDescrHeader_t/struct tmComResPSFormatDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResVBIFormatDescrHeader_t/struct tmComResVBIFormatDescrHeader/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResProbeCommit_t/struct tmComResProbeCommit/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResDebugSetLevel_t/struct tmComResDebugSetLevel/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmComResDebugGetData_t/struct tmComResDebugGetData/g; print " $i >a && mv a $i; done
for i in drivers/media/video/saa7164/*.[ch]; do perl -ne "s/tmFwInfoStruct_t/struct tmFwInfoStruct/g; print " $i >a && mv a $i; done
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 5cecdc81
This diff is collapsed.
......@@ -92,7 +92,7 @@ void saa7164_buffer_display(struct saa7164_buffer *buf)
struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port,
u32 len)
{
tmHWStreamParameters_t *params = &port->hw_streamingparams;
struct tmHWStreamParameters *params = &port->hw_streamingparams;
struct saa7164_buffer *buf = 0;
struct saa7164_dev *dev = port->dev;
int i;
......@@ -234,7 +234,7 @@ int saa7164_buffer_activate(struct saa7164_buffer *buf, int i)
int saa7164_buffer_cfg_port(struct saa7164_port *port)
{
tmHWStreamParameters_t *params = &port->hw_streamingparams;
struct tmHWStreamParameters *params = &port->hw_streamingparams;
struct saa7164_dev *dev = port->dev;
struct saa7164_buffer *buf;
struct list_head *c, *n;
......
......@@ -26,7 +26,7 @@
*/
int saa7164_bus_setup(struct saa7164_dev *dev)
{
tmComResBusInfo_t *b = &dev->bus;
struct tmComResBusInfo *b = &dev->bus;
mutex_init(&b->lock);
......@@ -54,7 +54,7 @@ int saa7164_bus_setup(struct saa7164_dev *dev)
void saa7164_bus_dump(struct saa7164_dev *dev)
{
tmComResBusInfo_t *b = &dev->bus;
struct tmComResBusInfo *b = &dev->bus;
dprintk(DBGLVL_BUS, "Dumping the bus structure:\n");
dprintk(DBGLVL_BUS, " .type = %d\n", b->Type);
......@@ -82,7 +82,7 @@ void saa7164_bus_dump(struct saa7164_dev *dev)
/* Intensionally throw a BUG() if the state of the message bus looks corrupt */
void saa7164_bus_verify(struct saa7164_dev *dev)
{
tmComResBusInfo_t *b = &dev->bus;
struct tmComResBusInfo *b = &dev->bus;
int bug = 0;
if (saa7164_readl(b->m_dwSetReadPos) > b->m_dwSizeSetRing)
......@@ -105,7 +105,7 @@ void saa7164_bus_verify(struct saa7164_dev *dev)
}
}
void saa7164_bus_dumpmsg(struct saa7164_dev *dev, tmComResInfo_t* m, void *buf)
void saa7164_bus_dumpmsg(struct saa7164_dev *dev, struct tmComResInfo* m, void *buf)
{
dprintk(DBGLVL_BUS, "Dumping msg structure:\n");
dprintk(DBGLVL_BUS, " .id = %d\n", m->id);
......@@ -121,7 +121,7 @@ void saa7164_bus_dumpmsg(struct saa7164_dev *dev, tmComResInfo_t* m, void *buf)
/*
* Places a command or a response on the bus. The implementation does not
* know if it is a command or a response it just places the data on the
* bus depending on the bus information given in the tmComResBusInfo_t
* bus depending on the bus information given in the struct tmComResBusInfo
* structure. If the command or response does not fit into the bus ring
* buffer it will be refused.
*
......@@ -129,9 +129,9 @@ void saa7164_bus_dumpmsg(struct saa7164_dev *dev, tmComResInfo_t* m, void *buf)
* SAA_OK The function executed successfully.
* < 0 One or more members are not initialized.
*/
int saa7164_bus_set(struct saa7164_dev *dev, tmComResInfo_t* msg, void *buf)
int saa7164_bus_set(struct saa7164_dev *dev, struct tmComResInfo* msg, void *buf)
{
tmComResBusInfo_t *bus = &dev->bus;
struct tmComResBusInfo *bus = &dev->bus;
u32 bytes_to_write, free_write_space, timeout, curr_srp, curr_swp;
u32 new_swp, space_rem;
int ret = SAA_ERR_BAD_PARAMETER;
......@@ -294,19 +294,19 @@ int saa7164_bus_set(struct saa7164_dev *dev, tmComResInfo_t* msg, void *buf)
/*
* Receive a command or a response from the bus. The implementation does not
* know if it is a command or a response it simply dequeues the data,
* depending on the bus information given in the tmComResBusInfo_t structure.
* depending on the bus information given in the struct tmComResBusInfo structure.
*
* Return Value:
* 0 The function executed successfully.
* < 0 One or more members are not initialized.
*/
int saa7164_bus_get(struct saa7164_dev *dev, tmComResInfo_t* msg, void *buf,
int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg, void *buf,
int peekonly)
{
tmComResBusInfo_t *bus = &dev->bus;
struct tmComResBusInfo *bus = &dev->bus;
u32 bytes_to_read, write_distance, curr_grp, curr_gwp,
new_grp, buf_size, space_rem;
tmComResInfo_t msg_tmp;
struct tmComResInfo msg_tmp;
int ret = SAA_ERR_BAD_PARAMETER;
saa7164_bus_verify(dev);
......
......@@ -92,7 +92,7 @@ int saa7164_irq_dequeue(struct saa7164_dev *dev)
do {
/* Peek the msg bus */
tmComResInfo_t tRsp = { 0, 0, 0, 0, 0, 0 };
struct tmComResInfo tRsp = { 0, 0, 0, 0, 0, 0 };
ret = saa7164_bus_get(dev, &tRsp, NULL, 1);
if (ret != SAA_OK)
break;
......@@ -143,7 +143,7 @@ int saa7164_cmd_dequeue(struct saa7164_dev *dev)
while (loop) {
tmComResInfo_t tRsp = { 0, 0, 0, 0, 0, 0 };
struct tmComResInfo tRsp = { 0, 0, 0, 0, 0, 0 };
ret = saa7164_bus_get(dev, &tRsp, NULL, 1);
if (ret == SAA_ERR_EMPTY)
return SAA_OK;
......@@ -186,9 +186,9 @@ int saa7164_cmd_dequeue(struct saa7164_dev *dev)
return SAA_OK;
}
int saa7164_cmd_set(struct saa7164_dev *dev, tmComResInfo_t* msg, void *buf)
int saa7164_cmd_set(struct saa7164_dev *dev, struct tmComResInfo* msg, void *buf)
{
tmComResBusInfo_t *bus = &dev->bus;
struct tmComResBusInfo *bus = &dev->bus;
u8 cmd_sent;
u16 size, idx;
u32 cmds;
......@@ -339,11 +339,11 @@ void saa7164_cmd_signal(struct saa7164_dev *dev, u8 seqno)
mutex_unlock(&dev->lock);
}
int saa7164_cmd_send(struct saa7164_dev *dev, u8 id, tmComResCmd_t command,
int saa7164_cmd_send(struct saa7164_dev *dev, u8 id, enum tmComResCmd command,
u16 controlselector, u16 size, void *buf)
{
tmComResInfo_t command_t, *pcommand_t;
tmComResInfo_t response_t, *presponse_t;
struct tmComResInfo command_t, *pcommand_t;
struct tmComResInfo response_t, *presponse_t;
u8 errdata[256];
u16 resp_dsize;
u16 data_recd;
......
......@@ -825,8 +825,8 @@ void saa7164_dumpregs(struct saa7164_dev *dev, u32 addr)
static void saa7164_dump_hwdesc(struct saa7164_dev *dev)
{
dprintk(1, "@0x%p hwdesc sizeof(tmComResHWDescr_t) = %d bytes\n",
&dev->hwdesc, (u32)sizeof(tmComResHWDescr_t));
dprintk(1, "@0x%p hwdesc sizeof(struct tmComResHWDescr) = %d bytes\n",
&dev->hwdesc, (u32)sizeof(struct tmComResHWDescr));
dprintk(1, " .bLength = 0x%x\n", dev->hwdesc.bLength);
dprintk(1, " .bDescriptorType = 0x%x\n", dev->hwdesc.bDescriptorType);
......@@ -856,8 +856,8 @@ static void saa7164_dump_hwdesc(struct saa7164_dev *dev)
static void saa7164_dump_intfdesc(struct saa7164_dev *dev)
{
dprintk(1, "@0x%p intfdesc "
"sizeof(tmComResInterfaceDescr_t) = %d bytes\n",
&dev->intfdesc, (u32)sizeof(tmComResInterfaceDescr_t));
"sizeof(struct tmComResInterfaceDescr) = %d bytes\n",
&dev->intfdesc, (u32)sizeof(struct tmComResInterfaceDescr));
dprintk(1, " .bLength = 0x%x\n", dev->intfdesc.bLength);
dprintk(1, " .bDescriptorType = 0x%x\n", dev->intfdesc.bDescriptorType);
......@@ -877,8 +877,8 @@ static void saa7164_dump_intfdesc(struct saa7164_dev *dev)
static void saa7164_dump_busdesc(struct saa7164_dev *dev)
{
dprintk(1, "@0x%p busdesc sizeof(tmComResBusDescr_t) = %d bytes\n",
&dev->busdesc, (u32)sizeof(tmComResBusDescr_t));
dprintk(1, "@0x%p busdesc sizeof(struct tmComResBusDescr) = %d bytes\n",
&dev->busdesc, (u32)sizeof(struct tmComResBusDescr));
dprintk(1, " .CommandRing = 0x%016Lx\n", dev->busdesc.CommandRing);
dprintk(1, " .ResponseRing = 0x%016Lx\n", dev->busdesc.ResponseRing);
......@@ -895,23 +895,23 @@ static void saa7164_dump_busdesc(struct saa7164_dev *dev)
*/
static void saa7164_get_descriptors(struct saa7164_dev *dev)
{
memcpy_fromio(&dev->hwdesc, dev->bmmio, sizeof(tmComResHWDescr_t));
memcpy_fromio(&dev->intfdesc, dev->bmmio + sizeof(tmComResHWDescr_t),
sizeof(tmComResInterfaceDescr_t));
memcpy_fromio(&dev->hwdesc, dev->bmmio, sizeof(struct tmComResHWDescr));
memcpy_fromio(&dev->intfdesc, dev->bmmio + sizeof(struct tmComResHWDescr),
sizeof(struct tmComResInterfaceDescr));
memcpy_fromio(&dev->busdesc, dev->bmmio + dev->intfdesc.BARLocation,
sizeof(tmComResBusDescr_t));
sizeof(struct tmComResBusDescr));
if (dev->hwdesc.bLength != sizeof(tmComResHWDescr_t)) {
printk(KERN_ERR "Structure tmComResHWDescr_t is mangled\n");
if (dev->hwdesc.bLength != sizeof(struct tmComResHWDescr)) {
printk(KERN_ERR "Structure struct tmComResHWDescr is mangled\n");
printk(KERN_ERR "Need %x got %d\n", dev->hwdesc.bLength,
(u32)sizeof(tmComResHWDescr_t));
(u32)sizeof(struct tmComResHWDescr));
} else
saa7164_dump_hwdesc(dev);
if (dev->intfdesc.bLength != sizeof(tmComResInterfaceDescr_t)) {
printk(KERN_ERR "struct tmComResInterfaceDescr_t is mangled\n");
if (dev->intfdesc.bLength != sizeof(struct tmComResInterfaceDescr)) {
printk(KERN_ERR "struct struct tmComResInterfaceDescr is mangled\n");
printk(KERN_ERR "Need %x got %d\n", dev->intfdesc.bLength,
(u32)sizeof(tmComResInterfaceDescr_t));
(u32)sizeof(struct tmComResInterfaceDescr));
} else
saa7164_dump_intfdesc(dev);
......@@ -1101,7 +1101,7 @@ static void saa7164_dev_unregister(struct saa7164_dev *dev)
static int saa7164_proc_show(struct seq_file *m, void *v)
{
struct saa7164_dev *dev;
tmComResBusInfo_t *b;
struct tmComResBusInfo *b;
struct list_head *list;
int i, c;
......@@ -1191,7 +1191,7 @@ static int saa7164_proc_create(void)
static int saa7164_thread_function(void *data)
{
struct saa7164_dev *dev = data;
tmFwInfoStruct_t fwinfo;
struct tmFwInfoStruct fwinfo;
u64 last_poll_time = 0;
dprintk(DBGLVL_THR, "thread started\n");
......
......@@ -119,7 +119,7 @@ static int saa7164_encoder_buffers_alloc(struct saa7164_port *port)
struct saa7164_dev *dev = port->dev;
struct saa7164_buffer *buf;
struct saa7164_user_buffer *ubuf;
tmHWStreamParameters_t *params = &port->hw_streamingparams;
struct tmHWStreamParameters *params = &port->hw_streamingparams;
int result = -ENODEV, i;
int len = 0;
......
......@@ -24,7 +24,7 @@
/* Some structues are passed directly to/from the firmware and
* have strict alignment requirements. This is one of them.
*/
typedef struct {
struct tmComResHWDescr {
u8 bLength;
u8 bDescriptorType;
u8 bDescriptorSubtype;
......@@ -37,14 +37,14 @@ typedef struct {
u32 dwHostMemoryRegionSize;
u32 dwHostHibernatMemRegion;
u32 dwHostHibernatMemRegionSize;
} __attribute__((packed)) tmComResHWDescr_t;
} __attribute__((packed));
/* 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 {
struct tmComResInterfaceDescr {
u8 bLength;
u8 bDescriptorType;
u8 bDescriptorSubtype;
......@@ -56,27 +56,27 @@ typedef struct {
u8 bDebugInterruptId;
u8 BARLocation;
u8 Reserved[3];
} tmComResInterfaceDescr_t;
};
typedef struct {
struct tmComResBusDescr {
u64 CommandRing;
u64 ResponseRing;
u32 CommandWrite;
u32 CommandRead;
u32 ResponseWrite;
u32 ResponseRead;
} tmComResBusDescr_t;
};
typedef enum {
enum tmBusType {
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;
struct tmComResBusInfo {
enum tmBusType Type;
u16 m_wMaxReqSize;
u8 *m_pdwSetRing;
u32 m_dwSizeSetRing;
......@@ -90,18 +90,18 @@ typedef struct {
/* All access is protected */
struct mutex lock;
} tmComResBusInfo_t;
};
typedef struct {
struct tmComResInfo {
u8 id;
u8 flags;
u16 size;
u32 command;
u16 controlselector;
u8 seqno;
} __attribute__((packed)) tmComResInfo_t;
} __attribute__((packed));
typedef enum {
enum tmComResCmd {
SET_CUR = 0x01,
GET_CUR = 0x81,
GET_MIN = 0x82,
......@@ -110,7 +110,7 @@ typedef enum {
GET_LEN = 0x85,
GET_INFO = 0x86,
GET_DEF = 0x87
} tmComResCmd_t;
};
struct cmd {
u8 seqno;
......@@ -121,20 +121,20 @@ struct cmd {
wait_queue_head_t wait;
};
typedef struct {
struct tmDescriptor {
u32 pathid;
u32 size;
void *descriptor;
} tmDescriptor_t;
};
typedef struct {
struct tmComResDescrHeader {
u8 len;
u8 type;
u8 subtype;
u8 unitid;
} __attribute__((packed)) tmComResDescrHeader_t;
} __attribute__((packed));
typedef struct {
struct tmComResExtDevDescrHeader {
u8 len;
u8 type;
u8 subtype;
......@@ -144,22 +144,22 @@ typedef struct {
u32 numgpiopins;
u8 numgpiogroups;
u8 controlsize;
} __attribute__((packed)) tmComResExtDevDescrHeader_t;
} __attribute__((packed));
typedef struct {
struct tmComResGPIO {
u32 pin;
u8 state;
} __attribute__((packed)) tmComResGPIO_t;
} __attribute__((packed));
typedef struct {
struct tmComResPathDescrHeader {
u8 len;
u8 type;
u8 subtype;
u8 pathid;
} __attribute__((packed)) tmComResPathDescrHeader_t;
} __attribute__((packed));
/* terminaltype */
typedef enum {
enum tmComResTermType {
ITT_ANTENNA = 0x0203,
LINE_CONNECTOR = 0x0603,
SPDIF_CONNECTOR = 0x0605,
......@@ -167,9 +167,9 @@ typedef enum {
SVIDEO_CONNECTOR = 0x0402,
COMPONENT_CONNECTOR = 0x0403,
STANDARD_DMA = 0xF101
} tmComResTermType_t;
};
typedef struct {
struct tmComResAntTermDescrHeader {
u8 len;
u8 type;
u8 subtype;
......@@ -178,9 +178,9 @@ typedef struct {
u8 assocterminal;
u8 iterminal;
u8 controlsize;
} __attribute__((packed)) tmComResAntTermDescrHeader_t;
} __attribute__((packed));
typedef struct {
struct tmComResTunerDescrHeader {
u8 len;
u8 type;
u8 subtype;
......@@ -190,9 +190,9 @@ typedef struct {
u32 tuningstandards;
u8 controlsize;
u32 controls;
} __attribute__((packed)) tmComResTunerDescrHeader_t;
} __attribute__((packed));
typedef enum {
enum tmBufferFlag {
/* the buffer does not contain any valid data */
TM_BUFFER_FLAG_EMPTY,
......@@ -201,23 +201,23 @@ typedef enum {
/* the buffer is the dummy buffer - TODO??? */
TM_BUFFER_FLAG_DUMMY_BUFFER
} tmBufferFlag_t;
};
typedef struct {
struct tmBuffer {
u64 *pagetablevirt;
u64 pagetablephys;
u16 offset;
u8 *context;
u64 timestamp;
tmBufferFlag_t BufferFlag_t;
enum tmBufferFlag BufferFlag;
u32 lostbuffers;
u32 validbuffers;
u64 *dummypagevirt;
u64 dummypagephys;
u64 *addressvirt;
} tmBuffer_t;
};
typedef struct {
struct tmHWStreamParameters {
u32 bitspersample;
u32 samplesperline;
u32 numberoflines;
......@@ -227,15 +227,15 @@ typedef struct {
u64 *pagetablelistphys;
u32 numpagetables;
u32 numpagetableentries;
} tmHWStreamParameters_t;
};
typedef struct {
tmHWStreamParameters_t HWStreamParameters_t;
struct tmStreamParameters {
struct tmHWStreamParameters HWStreamParameters;
u64 qwDummyPageTablePhys;
u64 *pDummyPageTableVirt;
} tmStreamParameters_t;
};
typedef struct {
struct tmComResDMATermDescrHeader {
u8 len;
u8 type;
u8 subtyle;
......@@ -251,7 +251,7 @@ typedef struct {
u8 metadatasize;
u8 numformats;
u8 controlsize;
} __attribute__((packed)) tmComResDMATermDescrHeader_t;
} __attribute__((packed));
/*
*
......@@ -274,7 +274,7 @@ typedef struct {
* Data is to be ignored by the application.
*
*/
typedef struct {
struct tmComResTSFormatDescrHeader {
u8 len;
u8 type;
u8 subtype;
......@@ -283,24 +283,22 @@ typedef struct {
u8 bPacketLength;
u8 bStrideLength;
u8 guidStrideFormat[16];
} __attribute__((packed)) tmComResTSFormatDescrHeader_t;
} __attribute__((packed));
/* Encoder related structures */
/* A/V Mux Selector */
typedef struct
{
struct tmComResSelDescrHeader {
u8 len;
u8 type;
u8 subtype;
u8 unitid;
u8 nrinpins;
u8 sourceid;
} __attribute__((packed)) tmComResSelDescrHeader_t;
} __attribute__((packed));
/* A/V Audio processor definitions */
typedef struct
{
struct tmComResProcDescrHeader {
u8 len;
u8 type;
u8 subtype;
......@@ -308,25 +306,23 @@ typedef struct
u8 sourceid;
u16 wreserved;
u8 controlsize;
} __attribute__((packed)) tmComResProcDescrHeader_t;
} __attribute__((packed));
/* Video bitrate control message */
#define EU_VIDEO_BIT_RATE_MODE_CONSTANT (0)
#define EU_VIDEO_BIT_RATE_MODE_VARIABLE_AVERAGE (1)
#define EU_VIDEO_BIT_RATE_MODE_VARIABLE_PEAK (2)
typedef struct
{
struct tmComResEncVideoBitRate {
u8 ucVideoBitRateMode;
u32 dwVideoBitRate;
u32 dwVideoBitRatePeak;
} __attribute__((packed)) tmComResEncVideoBitRate_t;
} __attribute__((packed));
/* Video Encoder Aspect Ratio message */
typedef struct
{
struct tmComResEncVideoInputAspectRatio {
u8 width;
u8 height;
} __attribute__((packed)) tmComResEncVideoInputAspectRatio_t;
} __attribute__((packed));
/* Video Encoder GOP IBP message */
/* 1. IPPPPPPPPPPPPPP */
......@@ -334,15 +330,13 @@ typedef struct
/* 3. IBBPBBPBBPBBP */
#define SAA7164_ENCODER_DEFAULT_GOP_DIST ( 1)
#define SAA7164_ENCODER_DEFAULT_GOP_SIZE (15)
typedef struct
{
struct tmComResEncVideoGopStructure {
u8 ucGOPSize; /* GOP Size 12, 15 */
u8 ucRefFrameDist; /* Reference Frame Distance */
} __attribute__((packed)) tmComResEncVideoGopStructure_t;
} __attribute__((packed));
/* Encoder processor definition */
typedef struct
{
struct tmComResEncoderDescrHeader {
u8 len;
u8 type;
u8 subtype;
......@@ -358,53 +352,47 @@ typedef struct
u16 wmVidFrmRateCap;
u32 dwmAudFormatCap;
u8 bmAudBitrateCap;
} __attribute__((packed)) tmComResEncoderDescrHeader_t;
} __attribute__((packed));
/* Audio processor definition */
typedef struct
{
struct tmComResAFeatureDescrHeader {
u8 len;
u8 type;
u8 subtype;
u8 unitid;
u8 sourceid;
u8 controlsize;
} __attribute__((packed)) tmComResAFeatureDescrHeader_t;
} __attribute__((packed));
/* Audio control messages */
typedef struct
{
struct tmComResAudioDefaults {
u8 ucDecoderLevel;
u8 ucDecoderFM_Level;
u8 ucMonoLevel;
u8 ucNICAM_Level;
u8 ucSAP_Level;
u8 ucADC_Level;
} __attribute__((packed)) tmComResAudioDefaults_t;
} __attribute__((packed));
/* Audio bitrate control message */
typedef struct
{
struct tmComResEncAudioBitRate {
u8 ucAudioBitRateMode;
u32 dwAudioBitRate;
u32 dwAudioBitRatePeak;
} __attribute__((packed)) tmComResEncAudioBitRate_t;
} __attribute__((packed));
/* Tuner / AV Decoder messages */
typedef struct
{
struct tmComResTunerStandard {
u8 std;
u32 country;
} __attribute__((packed)) tmComResTunerStandard_t;
} __attribute__((packed));
typedef struct
{
struct tmComResTunerStandardAuto {
u8 mode;
} __attribute__((packed)) tmComResTunerStandardAuto_t;
} __attribute__((packed));
/* EEPROM definition for PS stream types */
typedef struct
{
struct tmComResPSFormatDescrHeader {
u8 len;
u8 type;
u8 subtype;
......@@ -412,11 +400,10 @@ typedef struct
u16 wPacketLength;
u16 wPackLength;
u8 bPackDataType;
} __attribute__((packed)) tmComResPSFormatDescrHeader_t;
} __attribute__((packed));
/* VBI control structure */
typedef struct
{
struct tmComResVBIFormatDescrHeader {
u8 len;
u8 type;
u8 subtype; /* VS_FORMAT_VBI */
......@@ -426,28 +413,24 @@ typedef struct
u8 EndLine; /* NTSC = 21 */
u8 FieldRate; /* 60 for NTSC */
u8 bNumLines; /* Unsed - scheduled for removal */
} __attribute__((packed)) tmComResVBIFormatDescrHeader_t;
} __attribute__((packed));
typedef struct
{
struct tmComResProbeCommit {
u16 bmHint;
u8 bFormatIndex;
u8 bFrameIndex;
} __attribute__((packed)) tmComResProbeCommit_t;
} __attribute__((packed));
typedef struct
{
struct tmComResDebugSetLevel {
u32 dwDebugLevel;
} __attribute__((packed)) tmComResDebugSetLevel_t;
} __attribute__((packed));
typedef struct
{
struct tmComResDebugGetData {
u32 dwResult;
u8 ucDebugData[256];
} __attribute__((packed)) tmComResDebugGetData_t;
} __attribute__((packed));
typedef struct
{
struct tmFwInfoStruct {
u32 status;
u32 mode;
u32 devicespec;
......@@ -456,5 +439,4 @@ typedef struct
u32 RemainHeap;
u32 CPUClock;
u32 RAMSpeed;
} __attribute__((packed)) tmFwInfoStruct_t;
} __attribute__((packed));
......@@ -102,7 +102,7 @@ static int saa7164_vbi_buffers_alloc(struct saa7164_port *port)
struct saa7164_dev *dev = port->dev;
struct saa7164_buffer *buf;
struct saa7164_user_buffer *ubuf;
tmHWStreamParameters_t *params = &port->hw_streamingparams;
struct tmHWStreamParameters *params = &port->hw_streamingparams;
int result = -ENODEV, i;
int len = 0;
......
......@@ -343,10 +343,10 @@ struct saa7164_port {
/* --- Generic port attributes --- */
/* HW stream parameters */
tmHWStreamParameters_t hw_streamingparams;
struct tmHWStreamParameters hw_streamingparams;
/* DMA configuration values, is seeded during initialization */
tmComResDMATermDescrHeader_t hwcfg;
struct tmComResDMATermDescrHeader hwcfg;
/* hardware specific registers */
u32 bufcounter;
......@@ -400,11 +400,11 @@ struct saa7164_port {
u16 ctl_sharpness;
s8 ctl_volume;
tmComResAFeatureDescrHeader_t audfeat;
tmComResEncoderDescrHeader_t encunit;
tmComResProcDescrHeader_t vidproc;
tmComResExtDevDescrHeader_t ifunit;
tmComResTunerDescrHeader_t tunerunit;
struct tmComResAFeatureDescrHeader audfeat;
struct tmComResEncoderDescrHeader encunit;
struct tmComResProcDescrHeader vidproc;
struct tmComResExtDevDescrHeader ifunit;
struct tmComResTunerDescrHeader tunerunit;
struct work_struct workenc;
......@@ -418,7 +418,7 @@ struct saa7164_port {
wait_queue_head_t wait_read;
/* V4L VBI */
tmComResVBIFormatDescrHeader_t vbi_fmt_ntsc;
struct tmComResVBIFormatDescrHeader vbi_fmt_ntsc;
struct saa7164_vbi_params vbi_params;
/* Debug */
......@@ -454,11 +454,11 @@ struct saa7164_dev {
struct saa7164_fw_status fw_status;
u32 firmwareloaded;
tmComResHWDescr_t hwdesc;
tmComResInterfaceDescr_t intfdesc;
tmComResBusDescr_t busdesc;
struct tmComResHWDescr hwdesc;
struct tmComResInterfaceDescr intfdesc;
struct tmComResBusDescr busdesc;
tmComResBusInfo_t bus;
struct tmComResBusInfo bus;
/* Interrupt status and ack registers */
u32 int_status;
......@@ -511,14 +511,14 @@ extern void saa7164_call_i2c_clients(struct saa7164_i2c *bus,
/* saa7164-bus.c */
int saa7164_bus_setup(struct saa7164_dev *dev);
void saa7164_bus_dump(struct saa7164_dev *dev);
int saa7164_bus_set(struct saa7164_dev *dev, tmComResInfo_t* msg, void *buf);
int saa7164_bus_get(struct saa7164_dev *dev, tmComResInfo_t* msg,
int saa7164_bus_set(struct saa7164_dev *dev, struct tmComResInfo* msg, void *buf);
int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg,
void *buf, int peekonly);
/* ----------------------------------------------------------- */
/* saa7164-cmd.c */
int saa7164_cmd_send(struct saa7164_dev *dev,
u8 id, tmComResCmd_t command, u16 controlselector,
u8 id, enum tmComResCmd command, u16 controlselector,
u16 size, void *buf);
void saa7164_cmd_signal(struct saa7164_dev *dev, u8 seqno);
int saa7164_irq_dequeue(struct saa7164_dev *dev);
......@@ -553,7 +553,7 @@ int saa7164_api_get_videomux(struct saa7164_port *port);
int saa7164_api_set_vbi_format(struct saa7164_port *port);
int saa7164_api_set_debug(struct saa7164_dev *dev, u8 level);
int saa7164_api_collect_debug(struct saa7164_dev *dev);
int saa7164_api_get_load_info(struct saa7164_dev *dev, tmFwInfoStruct_t *i);
int saa7164_api_get_load_info(struct saa7164_dev *dev, struct tmFwInfoStruct *i);
/* ----------------------------------------------------------- */
/* saa7164-cards.c */
......
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