aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-driver.h
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-11-08 21:45:24 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:41:51 -0500
commit52fcb3ecc6707f52dfe4297f96b7609d4ba517fb (patch)
treefe8ecd66c20b10e8b2ba63c667a6afe78c23a2e1 /drivers/media/video/cx18/cx18-driver.h
parentfa655dda5ce6e5ac4a9b94fd451358edca2ddab8 (diff)
V4L/DVB (13429): cx18: Add Memory Descriptor List (MDL) layer to buffer handling
Add a Memory Descriptor List (MDL) layer to buffer handling to implement scatter-gather I/O. Currently there is still only 1 buffer per MDL. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-driver.h')
-rw-r--r--drivers/media/video/cx18/cx18-driver.h45
1 files changed, 31 insertions, 14 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index 1a899e0773d7..bed8bcc65411 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -246,8 +246,8 @@ struct cx18_options {
246 int radio; /* enable/disable radio */ 246 int radio; /* enable/disable radio */
247}; 247};
248 248
249/* per-buffer bit flags */ 249/* per-mdl bit flags */
250#define CX18_F_B_NEED_BUF_SWAP 0 /* this buffer should be byte swapped */ 250#define CX18_F_M_NEED_SWAP 0 /* mdl buffer data must be endianess swapped */
251 251
252/* per-stream, s_flags */ 252/* per-stream, s_flags */
253#define CX18_F_S_CLAIMED 3 /* this stream is claimed */ 253#define CX18_F_S_CLAIMED 3 /* this stream is claimed */
@@ -274,15 +274,26 @@ struct cx18_options {
274struct cx18_buffer { 274struct cx18_buffer {
275 struct list_head list; 275 struct list_head list;
276 dma_addr_t dma_handle; 276 dma_addr_t dma_handle;
277 u32 id;
278 unsigned long b_flags;
279 unsigned skipped;
280 char *buf; 277 char *buf;
281 278
282 u32 bytesused; 279 u32 bytesused;
283 u32 readpos; 280 u32 readpos;
284}; 281};
285 282
283struct cx18_mdl {
284 struct list_head list;
285 u32 id; /* index into cx->scb->cpu_mdl[] of 1st cx18_mdl_ent */
286
287 unsigned int skipped;
288 unsigned long m_flags;
289
290 struct list_head buf_list;
291 struct cx18_buffer *curr_buf; /* current buffer in list for reading */
292
293 u32 bytesused;
294 u32 readpos;
295};
296
286struct cx18_queue { 297struct cx18_queue {
287 struct list_head list; 298 struct list_head list;
288 atomic_t depth; 299 atomic_t depth;
@@ -346,14 +357,20 @@ struct cx18_stream {
346 PCI_DMA_NONE */ 357 PCI_DMA_NONE */
347 wait_queue_head_t waitq; 358 wait_queue_head_t waitq;
348 359
349 /* Buffer Stats */ 360 /* Buffers */
350 u32 buffers; 361 struct list_head buf_pool; /* buffers not attached to an MDL */
351 u32 buf_size; 362 u32 buffers; /* total buffers owned by this stream */
363 u32 buf_size; /* size in bytes of a single buffer */
364
365 /* MDL sizes - all stream MDLs are the same size */
366 u32 bufs_per_mdl;
367 u32 mdl_size; /* total bytes in all buffers in a mdl */
352 368
353 /* Buffer Queues */ 369 /* MDL Queues */
354 struct cx18_queue q_free; /* free buffers */ 370 struct cx18_queue q_free; /* free - in rotation, not committed */
355 struct cx18_queue q_busy; /* busy buffers - in use by firmware */ 371 struct cx18_queue q_busy; /* busy - in use by firmware */
356 struct cx18_queue q_full; /* full buffers - data for user apps */ 372 struct cx18_queue q_full; /* full - data for user apps */
373 struct cx18_queue q_idle; /* idle - not in rotation */
357 374
358 struct work_struct out_work_order; 375 struct work_struct out_work_order;
359 376
@@ -481,10 +498,11 @@ struct vbi_info {
481 u32 inserted_frame; 498 u32 inserted_frame;
482 499
483 /* 500 /*
484 * A dummy driver stream transfer buffer with a copy of the next 501 * A dummy driver stream transfer mdl & buffer with a copy of the next
485 * sliced_mpeg_data[] buffer for output to userland apps. 502 * sliced_mpeg_data[] buffer for output to userland apps.
486 * Only used in cx18-fileops.c, but its state needs to persist at times. 503 * Only used in cx18-fileops.c, but its state needs to persist at times.
487 */ 504 */
505 struct cx18_mdl sliced_mpeg_mdl;
488 struct cx18_buffer sliced_mpeg_buf; 506 struct cx18_buffer sliced_mpeg_buf;
489}; 507};
490 508
@@ -511,7 +529,6 @@ struct cx18 {
511 u8 is_60hz; 529 u8 is_60hz;
512 u8 nof_inputs; /* number of video inputs */ 530 u8 nof_inputs; /* number of video inputs */
513 u8 nof_audio_inputs; /* number of audio inputs */ 531 u8 nof_audio_inputs; /* number of audio inputs */
514 u16 buffer_id; /* buffer ID counter */
515 u32 v4l2_cap; /* V4L2 capabilities of card */ 532 u32 v4l2_cap; /* V4L2 capabilities of card */
516 u32 hw_flags; /* Hardware description of the board */ 533 u32 hw_flags; /* Hardware description of the board */
517 unsigned int free_mdl_idx; 534 unsigned int free_mdl_idx;