aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hive_isp_css_ddr_hrt_modified.h
blob: 39785aa214590111bf4520ecea3277fc1ac38109 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
 * Support for Intel Camera Imaging ISP subsystem.
 * Copyright (c) 2010-2015, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#ifndef _hive_isp_css_ddr_hrt_modified_h_
#define _hive_isp_css_ddr_hrt_modified_h_

#include <hmm_64/hmm.h>

/* This function reads an image from DDR and stores it in the img_buf array
   that has been allocated by the caller.
   The specifics of how the pixels are stored into DDR by the DMA are taken
   into account (bits padded to a width of 256, depending on the number of
   elements per ddr word).
   The DMA specific parameters give to this function (elems_per_xword and sign_extend)
   should correspond to those given to the DMA engine.
   The address is a virtual address which will be translated to a physical address before
   data is loaded from or stored to that address.

   The return value is 0 in case of success and 1 in case of failure.
 */
unsigned int
hrt_isp_css_read_image_from_ddr(
    unsigned short *img_buf,
    unsigned int width,
    unsigned int height,
    unsigned int elems_per_xword,
    unsigned int sign_extend,
    hmm_ptr virt_addr);

/* This function writes an image to DDR, keeping the same aspects into account as the read_image function
   above. */
unsigned int
hrt_isp_css_write_image_to_ddr(
    const unsigned short *img_buf,
    unsigned int width,
    unsigned int height,
    unsigned int elems_per_xword,
    unsigned int sign_extend,
    hmm_ptr virt_addr);

/* return the size in bytes of an image (frame or plane). */
unsigned int
hrt_isp_css_sizeof_image_in_ddr(
    unsigned int width,
    unsigned int height,
    unsigned int bits_per_element);

unsigned int
hrt_isp_css_stride_of_image_in_ddr(
    unsigned int width,
    unsigned int bits_per_element);

hmm_ptr
hrt_isp_css_alloc_image_in_ddr(
    unsigned int width,
    unsigned int height,
    unsigned int elems_per_xword);

hmm_ptr
hrt_isp_css_calloc_image_in_ddr(
    unsigned int width,
    unsigned int height,
    unsigned int elems_per_xword);

#ifndef HIVE_ISP_NO_GDC
#include "gdc_v2_defs.h"

hmm_ptr
hrt_isp_css_alloc_gdc_lut_in_ddr(void);

void
hrt_isp_css_write_gdc_lut_to_ddr(
    short values[4][HRT_GDC_N],
    hmm_ptr virt_addr);
#endif

#ifdef _HIVE_ISP_CSS_FPGA_SYSTEM
hmm_ptr
hrt_isp_css_alloc_image_for_display(
    unsigned int width,
    unsigned int height,
    unsigned int elems_per_xword);

hmm_ptr
hrt_isp_css_calloc_image_for_display(
    unsigned int width,
    unsigned int height,
    unsigned int elems_per_xword);
#endif

/* New set of functions, these do not require the elems_per_xword, but use bits_per_element instead,
   this way the user does not need to know about the width of a DDR word. */
unsigned int
hrt_isp_css_read_unsigned(
    unsigned short *target,
    unsigned int width,
    unsigned int height,
    unsigned int source_bits_per_element,
    hmm_ptr source);

unsigned int
hrt_isp_css_read_signed(
    short *target,
    unsigned int width,
    unsigned int height,
    unsigned int source_bits_per_element,
    hmm_ptr source);

unsigned int 
hrt_isp_css_write_unsigned(
    const unsigned short *source,
    unsigned int width,
    unsigned int height,
    unsigned int target_bits_per_element,
    hmm_ptr target);

unsigned int 
hrt_isp_css_write_signed(
    const short *source,
    unsigned int width,
    unsigned int height,
    unsigned int target_bits_per_element,
    hmm_ptr target);

hmm_ptr
hrt_isp_css_alloc(
    unsigned int width,
    unsigned int height,
    unsigned int bits_per_element);

hmm_ptr
hrt_isp_css_calloc(
    unsigned int width,
    unsigned int height,
    unsigned int bits_per_element);

#endif /* _hive_isp_css_ddr_hrt_modified_h_ */