2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
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.
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
15 #ifndef _IA_CSS_CIRCBUF_COMM_H
16 #define _IA_CSS_CIRCBUF_COMM_H
18 #include <type_support.h> /* uint8_t, uint32_t */
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.
28 /****************************************************************
30 * Portable Data structures
32 ****************************************************************/
34 * @brief Data structure for the circular descriptor.
36 typedef struct ia_css_circbuf_desc_s ia_css_circbuf_desc_t;
37 struct ia_css_circbuf_desc_s {
38 uint8_t size; /* the maximum number of elements*/
39 uint8_t step; /* number of bytes per element */
40 uint8_t start; /* index of the oldest element */
41 uint8_t end; /* index at which to write the new element */
43 #define SIZE_OF_IA_CSS_CIRCBUF_DESC_S_STRUCT \
47 * @brief Data structure for the circular buffer element.
49 typedef struct ia_css_circbuf_elem_s ia_css_circbuf_elem_t;
50 struct ia_css_circbuf_elem_s {
51 uint32_t val; /* the value stored in the element */
53 #define SIZE_OF_IA_CSS_CIRCBUF_ELEM_S_STRUCT \
56 #endif /*_IA_CSS_CIRCBUF_COMM_H*/