aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.h
blob: 3fe9247c78ac841bdd8119c5589e6d4864da9ba2 (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
/*
 * Support for Medfield PNW Camera Imaging ISP subsystem.
 *
 * Copyright (c) 2010 Intel Corporation. All Rights Reserved.
 *
 * Copyright (c) 2010 Silicon Hive www.siliconhive.com.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version
 * 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 *
 */

#ifndef _hive_isp_css_mm_hrt_h_
#define _hive_isp_css_mm_hrt_h_

#include <hmm/hmm.h>
#include <hrt/hive_isp_css_custom_host_hrt.h>

#define HRT_BUF_FLAG_CACHED (1 << 0)

enum hrt_userptr_type {
	HRT_USR_PTR = 0,
#ifdef CONFIG_ION
	HRT_USR_ION,
#endif
};

struct hrt_userbuffer_attr {
	enum hrt_userptr_type	type;
	unsigned int		pgnr;
};

void hrt_isp_css_mm_set_user_ptr(void *userptr,
				unsigned int num_pages, enum hrt_userptr_type);

int hrt_isp_css_mm_set(ia_css_ptr virt_addr, int c, size_t bytes);

/* Allocate memory, returns a virtual address */
ia_css_ptr hrt_isp_css_mm_alloc(size_t bytes);
ia_css_ptr hrt_isp_css_mm_alloc_user_ptr(size_t bytes, void *userptr,
				    unsigned int num_pages,
				    enum hrt_userptr_type,
				    bool cached);
ia_css_ptr hrt_isp_css_mm_alloc_cached(size_t bytes);

/* allocate memory and initialize with zeros,
   returns a virtual address */
ia_css_ptr hrt_isp_css_mm_calloc(size_t bytes);
ia_css_ptr hrt_isp_css_mm_calloc_cached(size_t bytes);

/* Store data to a virtual address */
int hrt_isp_css_mm_load(ia_css_ptr virt_addr, void *data, size_t bytes);

/* Load data from a virtual address */
int hrt_isp_css_mm_store(ia_css_ptr virt_addr, const void *data, size_t bytes);

int hrt_isp_css_mm_load_int(ia_css_ptr virt_addr, int *data);
int hrt_isp_css_mm_load_short(ia_css_ptr virt_addr, short *data);
int hrt_isp_css_mm_load_char(ia_css_ptr virt_addr, char *data);

int hrt_isp_css_mm_store_char(ia_css_ptr virt_addr, char data);
int hrt_isp_css_mm_store_short(ia_css_ptr virt_addr, short data);
int hrt_isp_css_mm_store_int(ia_css_ptr virt_addr, int data);

/* translate a virtual to a physical address, used to program
   the display driver on  the FPGA system */
phys_addr_t hrt_isp_css_virt_to_phys(ia_css_ptr virt_addr);

#endif /* _hive_isp_css_mm_hrt_h_ */