• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #if !defined( __ACAMERA_EVENT_QUEUE_H__ )
21 #define __ACAMERA_EVENT_QUEUE_H__
22 
23 #include "acamera.h"
24 #include "acamera_loop_buf.h"
25 #include "system_spinlock.h"
26 
27 typedef struct acamera_event_queue *acamera_event_queue_ptr_t;
28 typedef const struct acamera_event_queue *acamera_event_queue_const_ptr_t;
29 
30 typedef struct acamera_event_queue {
31     sys_spinlock lock;
32     acamera_loop_buf_t buf;
33 } acamera_event_queue_t;
34 
acamera_event_queue_init(acamera_event_queue_ptr_t p_queue,uint8_t * p_data_buf,int data_buf_size)35 static __inline void acamera_event_queue_init( acamera_event_queue_ptr_t p_queue, uint8_t *p_data_buf, int data_buf_size )
36 {
37     acamera_loop_buffer_init( &p_queue->buf, p_data_buf, data_buf_size );
38     system_spinlock_init( &p_queue->lock );
39 }
40 void acamera_event_queue_push( acamera_event_queue_ptr_t p_queue, int event );
41 int acamera_event_queue_pop( acamera_event_queue_ptr_t p_queue );
42 int32_t acamera_event_queue_not_empty( acamera_event_queue_ptr_t p_queue );
43 
44 
acamera_event_queue_deinit(acamera_event_queue_ptr_t p_queue)45 static __inline void acamera_event_queue_deinit( acamera_event_queue_ptr_t p_queue )
46 {
47     system_spinlock_destroy( p_queue->lock );
48 }
49 
50 #endif /* __ACAMERA_EVENT_QUEUE_H__ */
51