GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_common / host / hive_isp_css_ddr_hrt_modified.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 _hive_isp_css_ddr_hrt_modified_h_
16 #define _hive_isp_css_ddr_hrt_modified_h_
17
18 #include <hmm_64/hmm.h>
19
20 /* This function reads an image from DDR and stores it in the img_buf array
21    that has been allocated by the caller.
22    The specifics of how the pixels are stored into DDR by the DMA are taken
23    into account (bits padded to a width of 256, depending on the number of
24    elements per ddr word).
25    The DMA specific parameters give to this function (elems_per_xword and sign_extend)
26    should correspond to those given to the DMA engine.
27    The address is a virtual address which will be translated to a physical address before
28    data is loaded from or stored to that address.
29
30    The return value is 0 in case of success and 1 in case of failure.
31  */
32 unsigned int
33 hrt_isp_css_read_image_from_ddr(
34     unsigned short *img_buf,
35     unsigned int width,
36     unsigned int height,
37     unsigned int elems_per_xword,
38     unsigned int sign_extend,
39     hmm_ptr virt_addr);
40
41 /* This function writes an image to DDR, keeping the same aspects into account as the read_image function
42    above. */
43 unsigned int
44 hrt_isp_css_write_image_to_ddr(
45     const unsigned short *img_buf,
46     unsigned int width,
47     unsigned int height,
48     unsigned int elems_per_xword,
49     unsigned int sign_extend,
50     hmm_ptr virt_addr);
51
52 /* return the size in bytes of an image (frame or plane). */
53 unsigned int
54 hrt_isp_css_sizeof_image_in_ddr(
55     unsigned int width,
56     unsigned int height,
57     unsigned int bits_per_element);
58
59 unsigned int
60 hrt_isp_css_stride_of_image_in_ddr(
61     unsigned int width,
62     unsigned int bits_per_element);
63
64 hmm_ptr
65 hrt_isp_css_alloc_image_in_ddr(
66     unsigned int width,
67     unsigned int height,
68     unsigned int elems_per_xword);
69
70 hmm_ptr
71 hrt_isp_css_calloc_image_in_ddr(
72     unsigned int width,
73     unsigned int height,
74     unsigned int elems_per_xword);
75
76 #ifndef HIVE_ISP_NO_GDC
77 #include "gdc_v2_defs.h"
78
79 hmm_ptr
80 hrt_isp_css_alloc_gdc_lut_in_ddr(void);
81
82 void
83 hrt_isp_css_write_gdc_lut_to_ddr(
84     short values[4][HRT_GDC_N],
85     hmm_ptr virt_addr);
86 #endif
87
88 #ifdef _HIVE_ISP_CSS_FPGA_SYSTEM
89 hmm_ptr
90 hrt_isp_css_alloc_image_for_display(
91     unsigned int width,
92     unsigned int height,
93     unsigned int elems_per_xword);
94
95 hmm_ptr
96 hrt_isp_css_calloc_image_for_display(
97     unsigned int width,
98     unsigned int height,
99     unsigned int elems_per_xword);
100 #endif
101
102 /* New set of functions, these do not require the elems_per_xword, but use bits_per_element instead,
103    this way the user does not need to know about the width of a DDR word. */
104 unsigned int
105 hrt_isp_css_read_unsigned(
106     unsigned short *target,
107     unsigned int width,
108     unsigned int height,
109     unsigned int source_bits_per_element,
110     hmm_ptr source);
111
112 unsigned int
113 hrt_isp_css_read_signed(
114     short *target,
115     unsigned int width,
116     unsigned int height,
117     unsigned int source_bits_per_element,
118     hmm_ptr source);
119
120 unsigned int 
121 hrt_isp_css_write_unsigned(
122     const unsigned short *source,
123     unsigned int width,
124     unsigned int height,
125     unsigned int target_bits_per_element,
126     hmm_ptr target);
127
128 unsigned int 
129 hrt_isp_css_write_signed(
130     const short *source,
131     unsigned int width,
132     unsigned int height,
133     unsigned int target_bits_per_element,
134     hmm_ptr target);
135
136 hmm_ptr
137 hrt_isp_css_alloc(
138     unsigned int width,
139     unsigned int height,
140     unsigned int bits_per_element);
141
142 hmm_ptr
143 hrt_isp_css_calloc(
144     unsigned int width,
145     unsigned int height,
146     unsigned int bits_per_element);
147
148 #endif /* _hive_isp_css_ddr_hrt_modified_h_ */