GNU Linux-libre 4.14.302-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / runtime / bufq / interface / ia_css_bufq.h
1 #ifndef ISP2401
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 #else
16 /**
17 Support for Intel Camera Imaging ISP subsystem.
18 Copyright (c) 2010 - 2015, Intel Corporation.
19
20 This program is free software; you can redistribute it and/or modify it
21 under the terms and conditions of the GNU General Public License,
22 version 2, as published by the Free Software Foundation.
23
24 This program is distributed in the hope it will be useful, but WITHOUT
25 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
27 more details.
28 */
29 #endif
30
31 #ifndef _IA_CSS_BUFQ_H
32 #define _IA_CSS_BUFQ_H
33
34 #include <type_support.h>
35 #include "ia_css_bufq_comm.h"
36 #include "ia_css_buffer.h"
37 #include "ia_css_err.h"
38 #define BUFQ_EVENT_SIZE 4
39
40
41 /**
42  * @brief Query the internal frame ID.
43  *
44  * @param[in]   key     The query key.
45  * @param[out]  val     The query value.
46  *
47  * @return
48  *      true, if the query succeeds;
49  *      false, if the query fails.
50  */
51 bool ia_css_query_internal_queue_id(
52         enum ia_css_buffer_type buf_type,
53         unsigned int thread_id,
54         enum sh_css_queue_id *val
55         );
56
57
58 /**
59  * @brief  Map buffer type to a internal queue id.
60  *
61  * @param[in] thread id         Thread in which the buffer type has to be mapped or unmapped
62  * @param[in] buf_type          buffer type.
63  * @param[in] map               boolean flag to specify map or unmap
64  * @return none
65  */
66 void ia_css_queue_map(
67         unsigned int thread_id,
68         enum ia_css_buffer_type buf_type,
69         bool map
70         );
71
72
73 /**
74  * @brief  Initilize buffer type to a queue id mapping
75  * @return none
76  */
77 void ia_css_queue_map_init(void);
78
79
80 /**
81  * @brief initializes bufq module
82  * It create instances of
83  * -host to SP buffer queue  which is a list with predefined size,
84  *      MxN queues where M is the number threads and N is the number queues per thread
85  *-SP to host buffer queue , is a list with N queues
86  *-host to SP event communication queue
87  * -SP to host event communication queue
88  * -queue for tagger commands
89  * @return none
90  */
91 void ia_css_bufq_init(void);
92
93
94 /**
95 * @brief Enqueues an item into host to SP buffer queue
96  *
97  * @param thread_index[in]      Thread in which the item to be enqueued
98  *
99  * @param queue_id[in]          Index of the queue in the specified thread
100  * @param item[in]              Object to enqueue.
101  * @return      IA_CSS_SUCCESS or error code upon error.
102  *
103 */
104 enum ia_css_err ia_css_bufq_enqueue_buffer(
105         int thread_index,
106         int queue_id,
107         uint32_t item);
108
109 /**
110 * @brief Dequeues an item from SP to host buffer queue.
111  *
112  * @param queue_id[in]          Specifies  the index of the queue in the list where
113  *                              the item has to be read.
114  * @paramitem [out]             Object to be dequeued into this item.
115  * @return      IA_CSS_SUCCESS or error code upon error.
116  *
117 */
118 enum  ia_css_err ia_css_bufq_dequeue_buffer(
119         int queue_id,
120         uint32_t *item);
121
122 /**
123 * @brief  Enqueue an event item into host to SP communication event queue.
124  *
125  * @param[in]   evt_id                The event ID.
126  * @param[in]   evt_payload_0   The event payload.
127  * @param[in]   evt_payload_1   The event payload.
128  * @param[in]   evt_payload_2   The event payload.
129  * @return      IA_CSS_SUCCESS or error code upon error.
130  *
131 */
132 enum ia_css_err ia_css_bufq_enqueue_psys_event(
133         uint8_t evt_id,
134         uint8_t evt_payload_0,
135         uint8_t evt_payload_1,
136         uint8_t evt_payload_2
137         );
138
139 /**
140  * @brief   Dequeue an item from  SP to host communication event queue.
141  *
142  * @param item  Object to be dequeued into this item.
143  * @return      IA_CSS_SUCCESS or error code upon error.
144  *
145 */
146 enum  ia_css_err ia_css_bufq_dequeue_psys_event(
147         uint8_t item[BUFQ_EVENT_SIZE]
148         );
149
150 /**
151  * @brief  Enqueue an event item into host to SP EOF event queue.
152  *
153  * @param[in]   evt_id                The event ID.
154  * @return      IA_CSS_SUCCESS or error code upon error.
155  *
156  */
157 enum ia_css_err ia_css_bufq_enqueue_isys_event(
158         uint8_t evt_id);
159
160 /**
161 * @brief   Dequeue an item from  SP to host communication EOF event queue.
162
163  *
164  * @param item  Object to be dequeued into this item.
165  * @return      IA_CSS_SUCCESS or error code upon error.
166  *
167  */
168 enum  ia_css_err ia_css_bufq_dequeue_isys_event(
169         uint8_t item[BUFQ_EVENT_SIZE]);
170
171 /**
172 * @brief   Enqueue a tagger command item into tagger command queue..
173  *
174  * @param item  Object to be enqueue.
175  * @return      IA_CSS_SUCCESS or error code upon error.
176  *
177 */
178 enum ia_css_err ia_css_bufq_enqueue_tag_cmd(
179         uint32_t item);
180
181 /**
182 * @brief  Uninitializes bufq module.
183  *
184  * @return      IA_CSS_SUCCESS or error code upon error.
185  *
186 */
187 enum ia_css_err ia_css_bufq_deinit(void);
188
189 /**
190 * @brief  Dump queue states
191  *
192  * @return      None
193  *
194 */
195 void ia_css_bufq_dump_queue_info(void);
196
197 #endif  /* _IA_CSS_BUFQ_H */