GNU Linux-libre 4.14.251-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_common / host / sp_local.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 __SP_LOCAL_H_INCLUDED__
16 #define __SP_LOCAL_H_INCLUDED__
17
18 #include <type_support.h>
19 #include "sp_global.h"
20
21 struct sp_state_s {
22         int             pc;
23         int             status_register;
24         bool    is_broken;
25         bool    is_idle;
26         bool    is_sleeping;
27         bool    is_stalling;
28 };
29
30 struct sp_stall_s {
31         bool    fifo0;
32         bool    fifo1;
33         bool    fifo2;
34         bool    fifo3;
35         bool    fifo4;
36         bool    fifo5;
37         bool    fifo6;
38         bool    fifo7;
39         bool    fifo8;
40         bool    fifo9;
41         bool    fifoa;
42         bool    dmem;
43         bool    control_master;
44         bool    icache_master;
45 };
46
47 #define sp_address_of(var)      (HIVE_ADDR_ ## var)
48
49 /*
50  * deprecated
51  */
52 #define store_sp_int(var, value) \
53         sp_dmem_store_uint32(SP0_ID, (unsigned)sp_address_of(var), \
54                 (uint32_t)(value))
55
56 #define store_sp_ptr(var, value) \
57         sp_dmem_store_uint32(SP0_ID, (unsigned)sp_address_of(var), \
58                 (uint32_t)(value))
59
60 #define load_sp_uint(var) \
61         sp_dmem_load_uint32(SP0_ID, (unsigned)sp_address_of(var))
62
63 #define load_sp_array_uint8(array_name, index) \
64         sp_dmem_load_uint8(SP0_ID, (unsigned)sp_address_of(array_name) + \
65                 (index)*sizeof(uint8_t))
66
67 #define load_sp_array_uint16(array_name, index) \
68         sp_dmem_load_uint16(SP0_ID, (unsigned)sp_address_of(array_name) + \
69                 (index)*sizeof(uint16_t))
70
71 #define load_sp_array_uint(array_name, index) \
72         sp_dmem_load_uint32(SP0_ID, (unsigned)sp_address_of(array_name) + \
73                 (index)*sizeof(uint32_t))
74
75 #define store_sp_var(var, data, bytes) \
76         sp_dmem_store(SP0_ID, (unsigned)sp_address_of(var), data, bytes)
77
78 #define store_sp_array_uint8(array_name, index, value) \
79         sp_dmem_store_uint8(SP0_ID, (unsigned)sp_address_of(array_name) + \
80                 (index)*sizeof(uint8_t), value)
81
82 #define store_sp_array_uint16(array_name, index, value) \
83         sp_dmem_store_uint16(SP0_ID, (unsigned)sp_address_of(array_name) + \
84                 (index)*sizeof(uint16_t), value)
85
86 #define store_sp_array_uint(array_name, index, value) \
87         sp_dmem_store_uint32(SP0_ID, (unsigned)sp_address_of(array_name) + \
88                 (index)*sizeof(uint32_t), value)
89
90 #define store_sp_var_with_offset(var, offset, data, bytes) \
91         sp_dmem_store(SP0_ID, (unsigned)sp_address_of(var) + \
92                 offset, data, bytes)
93
94 #define load_sp_var(var, data, bytes) \
95         sp_dmem_load(SP0_ID, (unsigned)sp_address_of(var), data, bytes)
96
97 #define load_sp_var_with_offset(var, offset, data, bytes) \
98         sp_dmem_load(SP0_ID, (unsigned)sp_address_of(var) + offset, \
99                 data, bytes)
100
101 #endif /* __SP_LOCAL_H_INCLUDED__ */