mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-06 13:55:08 +08:00
c942fddf87
Based on 3 normalized pattern(s): 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 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 [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] 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 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 [author] [graeme] [gregory] [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema] [hk] [hemahk]@[ti] [com] 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1105 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
85 lines
2.3 KiB
C
85 lines
2.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* cx18 buffer queues
|
|
*
|
|
* Derived from ivtv-queue.h
|
|
*
|
|
* Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
|
|
* Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net>
|
|
*/
|
|
|
|
#define CX18_DMA_UNMAPPED ((u32) -1)
|
|
|
|
/* cx18_buffer utility functions */
|
|
|
|
static inline void cx18_buf_sync_for_cpu(struct cx18_stream *s,
|
|
struct cx18_buffer *buf)
|
|
{
|
|
pci_dma_sync_single_for_cpu(s->cx->pci_dev, buf->dma_handle,
|
|
s->buf_size, s->dma);
|
|
}
|
|
|
|
static inline void cx18_buf_sync_for_device(struct cx18_stream *s,
|
|
struct cx18_buffer *buf)
|
|
{
|
|
pci_dma_sync_single_for_device(s->cx->pci_dev, buf->dma_handle,
|
|
s->buf_size, s->dma);
|
|
}
|
|
|
|
void _cx18_mdl_sync_for_device(struct cx18_stream *s, struct cx18_mdl *mdl);
|
|
|
|
static inline void cx18_mdl_sync_for_device(struct cx18_stream *s,
|
|
struct cx18_mdl *mdl)
|
|
{
|
|
if (list_is_singular(&mdl->buf_list))
|
|
cx18_buf_sync_for_device(s, list_first_entry(&mdl->buf_list,
|
|
struct cx18_buffer,
|
|
list));
|
|
else
|
|
_cx18_mdl_sync_for_device(s, mdl);
|
|
}
|
|
|
|
void cx18_buf_swap(struct cx18_buffer *buf);
|
|
void _cx18_mdl_swap(struct cx18_mdl *mdl);
|
|
|
|
static inline void cx18_mdl_swap(struct cx18_mdl *mdl)
|
|
{
|
|
if (list_is_singular(&mdl->buf_list))
|
|
cx18_buf_swap(list_first_entry(&mdl->buf_list,
|
|
struct cx18_buffer, list));
|
|
else
|
|
_cx18_mdl_swap(mdl);
|
|
}
|
|
|
|
/* cx18_queue utility functions */
|
|
struct cx18_queue *_cx18_enqueue(struct cx18_stream *s, struct cx18_mdl *mdl,
|
|
struct cx18_queue *q, int to_front);
|
|
|
|
static inline
|
|
struct cx18_queue *cx18_enqueue(struct cx18_stream *s, struct cx18_mdl *mdl,
|
|
struct cx18_queue *q)
|
|
{
|
|
return _cx18_enqueue(s, mdl, q, 0); /* FIFO */
|
|
}
|
|
|
|
static inline
|
|
struct cx18_queue *cx18_push(struct cx18_stream *s, struct cx18_mdl *mdl,
|
|
struct cx18_queue *q)
|
|
{
|
|
return _cx18_enqueue(s, mdl, q, 1); /* LIFO */
|
|
}
|
|
|
|
void cx18_queue_init(struct cx18_queue *q);
|
|
struct cx18_mdl *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q);
|
|
struct cx18_mdl *cx18_queue_get_mdl(struct cx18_stream *s, u32 id,
|
|
u32 bytesused);
|
|
void cx18_flush_queues(struct cx18_stream *s);
|
|
|
|
/* queue MDL reconfiguration helpers */
|
|
void cx18_unload_queues(struct cx18_stream *s);
|
|
void cx18_load_queues(struct cx18_stream *s);
|
|
|
|
/* cx18_stream utility functions */
|
|
int cx18_stream_alloc(struct cx18_stream *s);
|
|
void cx18_stream_free(struct cx18_stream *s);
|