GNU Linux-libre 4.14.303-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_common / host / fifo_monitor_private.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2010-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 __FIFO_MONITOR_PRIVATE_H_INCLUDED__
16 #define __FIFO_MONITOR_PRIVATE_H_INCLUDED__
17
18 #include "fifo_monitor_public.h"
19
20 #define __INLINE_GP_DEVICE__
21 #include "gp_device.h"
22
23 #include "device_access.h"
24
25 #include "assert_support.h"
26
27 #ifdef __INLINE_FIFO_MONITOR__
28 extern const unsigned int FIFO_SWITCH_ADDR[N_FIFO_SWITCH];
29 #endif
30
31 STORAGE_CLASS_FIFO_MONITOR_C void fifo_switch_set(
32         const fifo_monitor_ID_t         ID,
33         const fifo_switch_t                     switch_id,
34         const hrt_data                          sel)
35 {
36 assert(ID == FIFO_MONITOR0_ID);
37 assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1);
38 assert(switch_id < N_FIFO_SWITCH);
39         (void)ID;
40
41         gp_device_reg_store(GP_DEVICE0_ID, FIFO_SWITCH_ADDR[switch_id], sel);
42
43 return;
44 }
45
46 STORAGE_CLASS_FIFO_MONITOR_C hrt_data fifo_switch_get(
47         const fifo_monitor_ID_t         ID,
48         const fifo_switch_t                     switch_id)
49 {
50 assert(ID == FIFO_MONITOR0_ID);
51 assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1);
52 assert(switch_id < N_FIFO_SWITCH);
53         (void)ID;
54
55 return gp_device_reg_load(GP_DEVICE0_ID, FIFO_SWITCH_ADDR[switch_id]);
56 }
57
58
59 STORAGE_CLASS_FIFO_MONITOR_C void fifo_monitor_reg_store(
60         const fifo_monitor_ID_t         ID,
61         const unsigned int                      reg,
62         const hrt_data                          value)
63 {
64 assert(ID < N_FIFO_MONITOR_ID);
65 assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1);
66         ia_css_device_store_uint32(FIFO_MONITOR_BASE[ID] + reg*sizeof(hrt_data), value);
67 return;
68 }
69
70 STORAGE_CLASS_FIFO_MONITOR_C hrt_data fifo_monitor_reg_load(
71         const fifo_monitor_ID_t         ID,
72         const unsigned int                      reg)
73 {
74 assert(ID < N_FIFO_MONITOR_ID);
75 assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1);
76 return ia_css_device_load_uint32(FIFO_MONITOR_BASE[ID] + reg*sizeof(hrt_data));
77 }
78
79 #endif /* __FIFO_MONITOR_PRIVATE_H_INCLUDED__ */