1 /* 2 * 3 * SPDX-License-Identifier: GPL-2.0 4 * 5 * Copyright (C) 2011-2018 ARM or its affiliates 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; version 2. 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * for more details. 14 * You should have received a copy of the GNU General Public License along 15 * with this program; if not, write to the Free Software Foundation, Inc., 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 * 18 */ 19 20 #ifndef __ACAMERA_LOOP_BUF_H__ 21 #define __ACAMERA_LOOP_BUF_H__ 22 23 #include "acamera.h" 24 25 typedef struct _acamera_loop_buf_t acamera_loop_buf_t; 26 typedef struct _acamera_loop_buf_t *acamera_loop_buf_ptr_t; 27 typedef const struct _acamera_loop_buf_t *acamera_loop_buf_const_ptr_t; 28 29 struct _acamera_loop_buf_t { 30 volatile int head; 31 volatile int tail; 32 uint8_t *p_data_buf; 33 int data_buf_size; 34 }; 35 36 void acamera_loop_buffer_init( acamera_loop_buf_ptr_t p_buf, uint8_t *p_data_buf, int data_buf_size ); 37 uint8_t acamera_loop_buffer_read_u8( acamera_loop_buf_ptr_t p_buf, int pos ); 38 int acamera_loop_buffer_write_u8( acamera_loop_buf_ptr_t p_buf, int pos, uint8_t sample ); 39 40 #endif /* __ACAMERA_LOOP_BUF_H__ */ 41