1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Support for Intel Camera Imaging ISP subsystem.
4 * Copyright (c) 2010-2015, Intel Corporation.
5 */
6
7 #ifndef __FIFO_MONITOR_PRIVATE_H_INCLUDED__
8 #define __FIFO_MONITOR_PRIVATE_H_INCLUDED__
9
10 #include "fifo_monitor_public.h"
11
12 #define __INLINE_GP_DEVICE__
13 #include "gp_device.h"
14
15 #include "device_access.h"
16
17 #include "assert_support.h"
18
19 #ifdef __INLINE_FIFO_MONITOR__
20 extern const unsigned int FIFO_SWITCH_ADDR[N_FIFO_SWITCH];
21 #endif
22
fifo_switch_set(const fifo_monitor_ID_t ID,const fifo_switch_t switch_id,const hrt_data sel)23 STORAGE_CLASS_FIFO_MONITOR_C void fifo_switch_set(
24 const fifo_monitor_ID_t ID,
25 const fifo_switch_t switch_id,
26 const hrt_data sel)
27 {
28 assert(ID == FIFO_MONITOR0_ID);
29 assert(FIFO_MONITOR_BASE[ID] != (hrt_address) - 1);
30 assert(switch_id < N_FIFO_SWITCH);
31 (void)ID;
32
33 gp_device_reg_store(GP_DEVICE0_ID, FIFO_SWITCH_ADDR[switch_id], sel);
34
35 return;
36 }
37
fifo_switch_get(const fifo_monitor_ID_t ID,const fifo_switch_t switch_id)38 STORAGE_CLASS_FIFO_MONITOR_C hrt_data fifo_switch_get(
39 const fifo_monitor_ID_t ID,
40 const fifo_switch_t switch_id)
41 {
42 assert(ID == FIFO_MONITOR0_ID);
43 assert(FIFO_MONITOR_BASE[ID] != (hrt_address) - 1);
44 assert(switch_id < N_FIFO_SWITCH);
45 (void)ID;
46
47 return gp_device_reg_load(GP_DEVICE0_ID, FIFO_SWITCH_ADDR[switch_id]);
48 }
49
fifo_monitor_reg_store(const fifo_monitor_ID_t ID,const unsigned int reg,const hrt_data value)50 STORAGE_CLASS_FIFO_MONITOR_C void fifo_monitor_reg_store(
51 const fifo_monitor_ID_t ID,
52 const unsigned int reg,
53 const hrt_data value)
54 {
55 assert(ID < N_FIFO_MONITOR_ID);
56 assert(FIFO_MONITOR_BASE[ID] != (hrt_address) - 1);
57 ia_css_device_store_uint32(FIFO_MONITOR_BASE[ID] + reg * sizeof(hrt_data),
58 value);
59 return;
60 }
61
fifo_monitor_reg_load(const fifo_monitor_ID_t ID,const unsigned int reg)62 STORAGE_CLASS_FIFO_MONITOR_C hrt_data fifo_monitor_reg_load(
63 const fifo_monitor_ID_t ID,
64 const unsigned int reg)
65 {
66 assert(ID < N_FIFO_MONITOR_ID);
67 assert(FIFO_MONITOR_BASE[ID] != (hrt_address) - 1);
68 return ia_css_device_load_uint32(FIFO_MONITOR_BASE[ID] + reg * sizeof(
69 hrt_data));
70 }
71
72 #endif /* __FIFO_MONITOR_PRIVATE_H_INCLUDED__ */
73