]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/event_fifo_private.h
staging/atomisp: Add support for the Intel IPU v2
[mirror_ubuntu-hirsute-kernel.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_common / host / event_fifo_private.h
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 __EVENT_FIFO_PRIVATE_H
16 #define __EVENT_FIFO_PRIVATE_H
17
18 #include "event_fifo_public.h"
19
20 #include "device_access.h"
21
22 #include "assert_support.h"
23
24 #include <hrt/bits.h> /* _hrt_get_bits() */
25
26 STORAGE_CLASS_EVENT_C void event_wait_for(const event_ID_t ID)
27 {
28 assert(ID < N_EVENT_ID);
29 assert(event_source_addr[ID] != ((hrt_address)-1));
30 (void)ia_css_device_load_uint32(event_source_addr[ID]);
31 return;
32 }
33
34 STORAGE_CLASS_EVENT_C void cnd_event_wait_for(const event_ID_t ID,
35 const bool cnd)
36 {
37 if (cnd) {
38 event_wait_for(ID);
39 }
40 }
41
42 STORAGE_CLASS_EVENT_C hrt_data event_receive_token(const event_ID_t ID)
43 {
44 assert(ID < N_EVENT_ID);
45 assert(event_source_addr[ID] != ((hrt_address)-1));
46 return ia_css_device_load_uint32(event_source_addr[ID]);
47 }
48
49 STORAGE_CLASS_EVENT_C void event_send_token(const event_ID_t ID,
50 const hrt_data token)
51 {
52 assert(ID < N_EVENT_ID);
53 assert(event_sink_addr[ID] != ((hrt_address)-1));
54 ia_css_device_store_uint32(event_sink_addr[ID], token);
55 }
56
57 STORAGE_CLASS_EVENT_C bool is_event_pending(const event_ID_t ID)
58 {
59 hrt_data value;
60 assert(ID < N_EVENT_ID);
61 assert(event_source_query_addr[ID] != ((hrt_address)-1));
62 value = ia_css_device_load_uint32(event_source_query_addr[ID]);
63 return !_hrt_get_bit(value, EVENT_QUERY_BIT);
64 }
65
66 STORAGE_CLASS_EVENT_C bool can_event_send_token(const event_ID_t ID)
67 {
68 hrt_data value;
69 assert(ID < N_EVENT_ID);
70 assert(event_sink_query_addr[ID] != ((hrt_address)-1));
71 value = ia_css_device_load_uint32(event_sink_query_addr[ID]);
72 return !_hrt_get_bit(value, EVENT_QUERY_BIT);
73 }
74
75 #endif /* __EVENT_FIFO_PRIVATE_H */