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 __EVENT_FIFO_PRIVATE_H
16 #define __EVENT_FIFO_PRIVATE_H
18 #include "event_fifo_public.h"
20 #include "device_access.h"
22 #include "assert_support.h"
24 #include <hrt/bits.h> /* _hrt_get_bits() */
26 STORAGE_CLASS_EVENT_C void event_wait_for(const event_ID_t ID)
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]);
34 STORAGE_CLASS_EVENT_C void cnd_event_wait_for(const event_ID_t ID,
42 STORAGE_CLASS_EVENT_C hrt_data event_receive_token(const event_ID_t ID)
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]);
49 STORAGE_CLASS_EVENT_C void event_send_token(const event_ID_t ID,
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);
57 STORAGE_CLASS_EVENT_C bool is_event_pending(const event_ID_t ID)
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);
66 STORAGE_CLASS_EVENT_C bool can_event_send_token(const event_ID_t ID)
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);
75 #endif /* __EVENT_FIFO_PRIVATE_H */