aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/tdmb/tcc3170/inc/tcpal/tcpal_queue.h
blob: 05e79827bb442e7bfbfe77852ddf7ecb181df3ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * tcpal_queue.c
 *
 * Author:  <linux@telechips.com>
 * Description: Telechips broadcast driver
 *
 * Copyright (c) Telechips, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#ifndef __TCBD_QUEUE_H__
#define __TCBD_QUEUE_H__

#define TCBD_QUEUE_SIZE 50

struct tcbd_queue_item {
	u8 *buffer;
	u8 subch_id;
	s32 size;
	s32 type;
};

struct tcbd_queue {
	s32 front;
	s32 rear;
	s32 qsize;
	s32 pointer;
	s32 buff_size;
	u8 *global_buffer;
	u32 sem;
	struct tcbd_queue_item q[TCBD_QUEUE_SIZE];
};

TCBB_FUNC void tcbd_init_queue(
	struct tcbd_queue *_queue, u8* buffer, s32 _buff_size);
TCBB_FUNC void tcbd_deinit_queue(struct tcbd_queue *_queue);

TCBB_FUNC s32 tcbd_enqueue(
	struct tcbd_queue *_queue, u8 *_chunk, s32 _size,
	u8 _subch_id, s32 _type);

TCBB_FUNC s32 tcbd_dequeue(
	struct tcbd_queue *_queue, u8 *_chunk, s32 *_size,
	u8 *_subch_id, s32 *_type);

TCBB_FUNC s32 tcbd_dequeue_ptr(
	struct tcbd_queue *_queue, u8 **_chunk,	s32 *_size,	s32 *_type);

TCBB_FUNC s32 tcbd_get_first_queue_ptr(
	struct tcbd_queue *_queue, u8 **_chunk,	s32 *_size,	s32 *_type);

TCBB_FUNC s32 tcbd_queue_is_empty(struct tcbd_queue *_queue);
TCBB_FUNC s32 tcbd_queue_is_full(struct tcbd_queue *_queue);
TCBB_FUNC void tcbd_reset_queue(struct tcbd_queue *_queue);
#endif /*__TCBD_QUEUE_H__*/