1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 
16 #ifndef __EVENT_FIFO_PUBLIC_H
17 #define __EVENT_FIFO_PUBLIC_H
18 
19 #include <type_support.h>
20 #include "system_local.h"
21 
22 /*! Blocking read from an event source EVENT[ID]
23 
24  \param	ID[in]				EVENT identifier
25 
26  \return none, dequeue(event_queue[ID])
27  */
28 STORAGE_CLASS_EVENT_H void event_wait_for(
29     const event_ID_t		ID);
30 
31 /*! Conditional blocking wait for an event source EVENT[ID]
32 
33  \param	ID[in]				EVENT identifier
34  \param	cnd[in]				predicate
35 
36  \return none, if(cnd) dequeue(event_queue[ID])
37  */
38 STORAGE_CLASS_EVENT_H void cnd_event_wait_for(
39     const event_ID_t		ID,
40     const bool				cnd);
41 
42 /*! Blocking read from an event source EVENT[ID]
43 
44  \param	ID[in]				EVENT identifier
45 
46  \return dequeue(event_queue[ID])
47  */
48 STORAGE_CLASS_EVENT_H hrt_data event_receive_token(
49     const event_ID_t		ID);
50 
51 /*! Blocking write to an event sink EVENT[ID]
52 
53  \param	ID[in]				EVENT identifier
54  \param	token[in]			token to be written on the event
55 
56  \return none, enqueue(event_queue[ID])
57  */
58 STORAGE_CLASS_EVENT_H void event_send_token(
59     const event_ID_t		ID,
60     const hrt_data			token);
61 
62 /*! Query an event source EVENT[ID]
63 
64  \param	ID[in]				EVENT identifier
65 
66  \return !isempty(event_queue[ID])
67  */
68 STORAGE_CLASS_EVENT_H bool is_event_pending(
69     const event_ID_t		ID);
70 
71 /*! Query an event sink EVENT[ID]
72 
73  \param	ID[in]				EVENT identifier
74 
75  \return !isfull(event_queue[ID])
76  */
77 STORAGE_CLASS_EVENT_H bool can_event_send_token(
78     const event_ID_t		ID);
79 
80 #endif /* __EVENT_FIFO_PUBLIC_H */
81