]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blob - drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/queue/interface/ia_css_queue.h
ASoC: pcm512x: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE
[mirror_ubuntu-focal-kernel.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / runtime / queue / interface / ia_css_queue.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_QUEUE_H
32 #define __IA_CSS_QUEUE_H
33
34 #include <platform_support.h>
35 #include <type_support.h>
36
37 #include "ia_css_queue_comm.h"
38 #include "../src/queue_access.h"
39
40 /* Local Queue object descriptor */
41 struct ia_css_queue_local {
42 ia_css_circbuf_desc_t *cb_desc; /*Circbuf desc for local queues*/
43 ia_css_circbuf_elem_t *cb_elems; /*Circbuf elements*/
44 };
45 typedef struct ia_css_queue_local ia_css_queue_local_t;
46
47 /* Handle for queue object*/
48 typedef struct ia_css_queue ia_css_queue_t;
49
50
51 /*****************************************************************************
52 * Queue Public APIs
53 *****************************************************************************/
54 /** @brief Initialize a local queue instance.
55 *
56 * @param[out] qhandle. Handle to queue instance for use with API
57 * @param[in] desc. Descriptor with queue properties filled-in
58 * @return 0 - Successful init of local queue instance.
59 * @return EINVAL - Invalid argument.
60 *
61 */
62 extern int ia_css_queue_local_init(
63 ia_css_queue_t *qhandle,
64 ia_css_queue_local_t *desc);
65
66 /** @brief Initialize a remote queue instance
67 *
68 * @param[out] qhandle. Handle to queue instance for use with API
69 * @param[in] desc. Descriptor with queue properties filled-in
70 * @return 0 - Successful init of remote queue instance.
71 * @return EINVAL - Invalid argument.
72 */
73 extern int ia_css_queue_remote_init(
74 ia_css_queue_t *qhandle,
75 ia_css_queue_remote_t *desc);
76
77 /** @brief Uninitialize a queue instance
78 *
79 * @param[in] qhandle. Handle to queue instance
80 * @return 0 - Successful uninit.
81 *
82 */
83 extern int ia_css_queue_uninit(
84 ia_css_queue_t *qhandle);
85
86 /** @brief Enqueue an item in the queue instance
87 *
88 * @param[in] qhandle. Handle to queue instance
89 * @param[in] item. Object to be enqueued.
90 * @return 0 - Successful enqueue.
91 * @return EINVAL - Invalid argument.
92 * @return ENOBUFS - Queue is full.
93 *
94 */
95 extern int ia_css_queue_enqueue(
96 ia_css_queue_t *qhandle,
97 uint32_t item);
98
99 /** @brief Dequeue an item from the queue instance
100 *
101 * @param[in] qhandle. Handle to queue instance
102 * @param[out] item. Object to be dequeued into this item.
103
104 * @return 0 - Successful dequeue.
105 * @return EINVAL - Invalid argument.
106 * @return ENODATA - Queue is empty.
107 *
108 */
109 extern int ia_css_queue_dequeue(
110 ia_css_queue_t *qhandle,
111 uint32_t *item);
112
113 /** @brief Check if the queue is empty
114 *
115 * @param[in] qhandle. Handle to queue instance
116 * @param[in] is_empty True if empty, False if not.
117 * @return 0 - Successful access state.
118 * @return EINVAL - Invalid argument.
119 * @return ENOSYS - Function not implemented.
120 *
121 */
122 extern int ia_css_queue_is_empty(
123 ia_css_queue_t *qhandle,
124 bool *is_empty);
125
126 /** @brief Check if the queue is full
127 *
128 * @param[in] qhandle. Handle to queue instance
129 * @param[in] is_full True if Full, False if not.
130 * @return 0 - Successfully access state.
131 * @return EINVAL - Invalid argument.
132 * @return ENOSYS - Function not implemented.
133 *
134 */
135 extern int ia_css_queue_is_full(
136 ia_css_queue_t *qhandle,
137 bool *is_full);
138
139 /** @brief Get used space in the queue
140 *
141 * @param[in] qhandle. Handle to queue instance
142 * @param[in] size Number of available elements in the queue
143 * @return 0 - Successfully access state.
144 * @return EINVAL - Invalid argument.
145 *
146 */
147 extern int ia_css_queue_get_used_space(
148 ia_css_queue_t *qhandle,
149 uint32_t *size);
150
151 /** @brief Get free space in the queue
152 *
153 * @param[in] qhandle. Handle to queue instance
154 * @param[in] size Number of free elements in the queue
155 * @return 0 - Successfully access state.
156 * @return EINVAL - Invalid argument.
157 *
158 */
159 extern int ia_css_queue_get_free_space(
160 ia_css_queue_t *qhandle,
161 uint32_t *size);
162
163 /** @brief Peek at an element in the queue
164 *
165 * @param[in] qhandle. Handle to queue instance
166 * @param[in] offset Offset of element to peek,
167 * starting from head of queue
168 * @param[in] element Value of element returned
169 * @return 0 - Successfully access state.
170 * @return EINVAL - Invalid argument.
171 *
172 */
173 extern int ia_css_queue_peek(
174 ia_css_queue_t *qhandle,
175 uint32_t offset,
176 uint32_t *element);
177
178 /** @brief Get the usable size for the queue
179 *
180 * @param[in] qhandle. Handle to queue instance
181 * @param[out] size Size value to be returned here.
182 * @return 0 - Successful get size.
183 * @return EINVAL - Invalid argument.
184 * @return ENOSYS - Function not implemented.
185 *
186 */
187 extern int ia_css_queue_get_size(
188 ia_css_queue_t *qhandle,
189 uint32_t *size);
190
191 #endif /* __IA_CSS_QUEUE_H */
192