1 /* 2 * Support for Intel Camera Imaging ISP subsystem. 3 * Copyright (c) 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_CIRCBUF_COMM_H 16 #define _IA_CSS_CIRCBUF_COMM_H 17 18 #include <type_support.h> /* uint8_t, uint32_t */ 19 20 #define IA_CSS_CIRCBUF_PADDING 1 /* The circular buffer is implemented in lock-less manner, wherein 21 * the head and tail can advance independently without any locks. 22 * But to achieve this, an extra buffer element is required to detect 23 * queue full & empty conditions, wherein the tail trails the head for 24 * full and is equal to head for empty condition. This causes 1 buffer 25 * not being available for use. 26 */ 27 28 /**************************************************************** 29 * 30 * Portable Data structures 31 * 32 ****************************************************************/ 33 /** 34 * @brief Data structure for the circular descriptor. 35 */ 36 typedef struct ia_css_circbuf_desc_s ia_css_circbuf_desc_t; 37 struct ia_css_circbuf_desc_s { 38 u8 size; /* the maximum number of elements*/ 39 u8 step; /* number of bytes per element */ 40 u8 start; /* index of the oldest element */ 41 u8 end; /* index at which to write the new element */ 42 }; 43 44 #define SIZE_OF_IA_CSS_CIRCBUF_DESC_S_STRUCT \ 45 (4 * sizeof(uint8_t)) 46 47 /** 48 * @brief Data structure for the circular buffer element. 49 */ 50 typedef struct ia_css_circbuf_elem_s ia_css_circbuf_elem_t; 51 struct ia_css_circbuf_elem_s { 52 u32 val; /* the value stored in the element */ 53 }; 54 55 #define SIZE_OF_IA_CSS_CIRCBUF_ELEM_S_STRUCT \ 56 (sizeof(uint32_t)) 57 58 #endif /*_IA_CSS_CIRCBUF_COMM_H*/ 59