aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/interface/ia_css_bufq.h
blob: 034ec15ec4a15b6302a8fce3a05b4bc1a2f07d36 (plain) (blame)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#ifndef ISP2401
/*
 * Support for Intel Camera Imaging ISP subsystem.
 * Copyright (c) 2015, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope 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.
 */
#else
/**
Support for Intel Camera Imaging ISP subsystem.
Copyright (c) 2010 - 2015, Intel Corporation.

This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.

This program is distributed in the hope 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.
*/
#endif

#ifndef _IA_CSS_BUFQ_H
#define _IA_CSS_BUFQ_H

#include <type_support.h>
#include "ia_css_bufq_comm.h"
#include "ia_css_buffer.h"
#include "ia_css_err.h"
#define BUFQ_EVENT_SIZE 4


/**
 * @brief Query the internal frame ID.
 *
 * @param[in]	key	The query key.
 * @param[out]	val	The query value.
 *
 * @return
 *	true, if the query succeeds;
 *	false, if the query fails.
 */
bool ia_css_query_internal_queue_id(
	enum ia_css_buffer_type buf_type,
	unsigned int thread_id,
	enum sh_css_queue_id *val
	);


/**
 * @brief  Map buffer type to a internal queue id.
 *
 * @param[in] thread id		Thread in which the buffer type has to be mapped or unmapped
 * @param[in] buf_type		buffer type.
 * @param[in] map		boolean flag to specify map or unmap
 * @return none
 */
void ia_css_queue_map(
	unsigned int thread_id,
	enum ia_css_buffer_type buf_type,
	bool map
	);


/**
 * @brief  Initilize buffer type to a queue id mapping
 * @return none
 */
void ia_css_queue_map_init(void);


/**
 * @brief initializes bufq module
 * It create instances of
 * -host to SP buffer queue  which is a list with predefined size,
 *	MxN queues where M is the number threads and N is the number queues per thread
 *-SP to host buffer queue , is a list with N queues
 *-host to SP event communication queue
 * -SP to host event communication queue
 * -queue for tagger commands
 * @return none
 */
void ia_css_bufq_init(void);


/**
* @brief Enqueues an item into host to SP buffer queue
 *
 * @param thread_index[in]	Thread in which the item to be enqueued
 *
 * @param queue_id[in]		Index of the queue in the specified thread
 * @param item[in]		Object to enqueue.
 * @return	IA_CSS_SUCCESS or error code upon error.
 *
*/
enum ia_css_err ia_css_bufq_enqueue_buffer(
	int thread_index,
	int queue_id,
	uint32_t item);

/**
* @brief Dequeues an item from SP to host buffer queue.
 *
 * @param queue_id[in]		Specifies  the index of the queue in the list where
 *				the item has to be read.
 * @paramitem [out]		Object to be dequeued into this item.
 * @return	IA_CSS_SUCCESS or error code upon error.
 *
*/
enum  ia_css_err ia_css_bufq_dequeue_buffer(
	int queue_id,
	uint32_t *item);

/**
* @brief  Enqueue an event item into host to SP communication event queue.
 *
 * @param[in]	evt_id		      The event ID.
 * @param[in]	evt_payload_0	The event payload.
 * @param[in]	evt_payload_1	The event payload.
 * @param[in]	evt_payload_2	The event payload.
 * @return	IA_CSS_SUCCESS or error code upon error.
 *
*/
enum ia_css_err ia_css_bufq_enqueue_psys_event(
	uint8_t evt_id,
	uint8_t evt_payload_0,
	uint8_t evt_payload_1,
	uint8_t evt_payload_2
	);

/**
 * @brief   Dequeue an item from  SP to host communication event queue.
 *
 * @param item	Object to be dequeued into this item.
 * @return	IA_CSS_SUCCESS or error code upon error.
 *
*/
enum  ia_css_err ia_css_bufq_dequeue_psys_event(
	uint8_t item[BUFQ_EVENT_SIZE]
	);

/**
 * @brief  Enqueue an event item into host to SP EOF event queue.
 *
 * @param[in]	evt_id		      The event ID.
 * @return	IA_CSS_SUCCESS or error code upon error.
 *
 */
enum ia_css_err ia_css_bufq_enqueue_isys_event(
	uint8_t evt_id);

/**
* @brief   Dequeue an item from  SP to host communication EOF event queue.

 *
 * @param item	Object to be dequeued into this item.
 * @return	IA_CSS_SUCCESS or error code upon error.
 *
 */
enum  ia_css_err ia_css_bufq_dequeue_isys_event(
	uint8_t item[BUFQ_EVENT_SIZE]);

/**
* @brief   Enqueue a tagger command item into tagger command queue..
 *
 * @param item	Object to be enqueue.
 * @return	IA_CSS_SUCCESS or error code upon error.
 *
*/
enum ia_css_err ia_css_bufq_enqueue_tag_cmd(
	uint32_t item);

/**
* @brief  Uninitializes bufq module.
 *
 * @return	IA_CSS_SUCCESS or error code upon error.
 *
*/
enum ia_css_err ia_css_bufq_deinit(void);

/**
* @brief  Dump queue states
 *
 * @return	None
 *
*/
void ia_css_bufq_dump_queue_info(void);

#endif	/* _IA_CSS_BUFQ_H */