GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / css_2401_csi2p_system / host / isys_dma_private.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 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 __ISYS_DMA_PRIVATE_H_INCLUDED__
16 #define __ISYS_DMA_PRIVATE_H_INCLUDED__
17
18 #include "isys_dma_public.h"
19 #include "device_access.h"
20 #include "assert_support.h"
21 #include "dma.h"
22 #include "dma_v2_defs.h"
23 #include "print_support.h"
24
25
26 STORAGE_CLASS_ISYS2401_DMA_C void isys2401_dma_reg_store(
27         const isys2401_dma_ID_t dma_id,
28         const unsigned int      reg,
29         const hrt_data          value)
30 {
31         unsigned int reg_loc;
32
33         assert(dma_id < N_ISYS2401_DMA_ID);
34         assert(ISYS2401_DMA_BASE[dma_id] != (hrt_address)-1);
35
36         reg_loc = ISYS2401_DMA_BASE[dma_id] + (reg * sizeof(hrt_data));
37
38         ia_css_print("isys dma store at addr(0x%x) val(%u)\n", reg_loc, (unsigned int)value);
39         ia_css_device_store_uint32(reg_loc, value);
40 }
41
42 STORAGE_CLASS_ISYS2401_DMA_C hrt_data isys2401_dma_reg_load(
43         const isys2401_dma_ID_t dma_id,
44         const unsigned int      reg)
45 {
46         unsigned int reg_loc;
47         hrt_data value;
48
49         assert(dma_id < N_ISYS2401_DMA_ID);
50         assert(ISYS2401_DMA_BASE[dma_id] != (hrt_address)-1);
51
52         reg_loc = ISYS2401_DMA_BASE[dma_id] + (reg * sizeof(hrt_data));
53
54         value = ia_css_device_load_uint32(reg_loc);
55         ia_css_print("isys dma load from addr(0x%x) val(%u)\n", reg_loc, (unsigned int)value);
56
57         return value;
58 }
59
60 #endif /* __ISYS_DMA_PRIVATE_H_INCLUDED__ */