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