1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for Intel Camera Imaging ISP subsystem. 4 * Copyright (c) 2015, Intel Corporation. 5 */ 6 7 #ifndef __EVENT_FIFO_PRIVATE_H 8 #define __EVENT_FIFO_PRIVATE_H 9 10 #include "event_fifo_public.h" 11 12 #include "device_access.h" 13 14 #include "assert_support.h" 15 16 #include <bits.h> /* _hrt_get_bits() */ 17 event_wait_for(const event_ID_t ID)18STORAGE_CLASS_EVENT_C void event_wait_for(const event_ID_t ID) 19 { 20 assert(ID < N_EVENT_ID); 21 assert(event_source_addr[ID] != ((hrt_address) - 1)); 22 (void)ia_css_device_load_uint32(event_source_addr[ID]); 23 return; 24 } 25 cnd_event_wait_for(const event_ID_t ID,const bool cnd)26STORAGE_CLASS_EVENT_C void cnd_event_wait_for(const event_ID_t ID, 27 const bool cnd) 28 { 29 if (cnd) { 30 event_wait_for(ID); 31 } 32 } 33 event_receive_token(const event_ID_t ID)34STORAGE_CLASS_EVENT_C hrt_data event_receive_token(const event_ID_t ID) 35 { 36 assert(ID < N_EVENT_ID); 37 assert(event_source_addr[ID] != ((hrt_address) - 1)); 38 return ia_css_device_load_uint32(event_source_addr[ID]); 39 } 40 event_send_token(const event_ID_t ID,const hrt_data token)41STORAGE_CLASS_EVENT_C void event_send_token(const event_ID_t ID, 42 const hrt_data token) 43 { 44 assert(ID < N_EVENT_ID); 45 assert(event_sink_addr[ID] != ((hrt_address) - 1)); 46 ia_css_device_store_uint32(event_sink_addr[ID], token); 47 } 48 is_event_pending(const event_ID_t ID)49STORAGE_CLASS_EVENT_C bool is_event_pending(const event_ID_t ID) 50 { 51 hrt_data value; 52 53 assert(ID < N_EVENT_ID); 54 assert(event_source_query_addr[ID] != ((hrt_address) - 1)); 55 value = ia_css_device_load_uint32(event_source_query_addr[ID]); 56 return !_hrt_get_bit(value, EVENT_QUERY_BIT); 57 } 58 can_event_send_token(const event_ID_t ID)59STORAGE_CLASS_EVENT_C bool can_event_send_token(const event_ID_t ID) 60 { 61 hrt_data value; 62 63 assert(ID < N_EVENT_ID); 64 assert(event_sink_query_addr[ID] != ((hrt_address) - 1)); 65 value = ia_css_device_load_uint32(event_sink_query_addr[ID]); 66 return !_hrt_get_bit(value, EVENT_QUERY_BIT); 67 } 68 69 #endif /* __EVENT_FIFO_PRIVATE_H */ 70