1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Support for Intel Camera Imaging ISP subsystem.
4 * Copyright (c) 2015, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16 #ifndef __ISYS_DMA_PRIVATE_H_INCLUDED__
17 #define __ISYS_DMA_PRIVATE_H_INCLUDED__
18
19 #include "isys_dma_public.h"
20 #include "device_access.h"
21 #include "assert_support.h"
22 #include "dma.h"
23 #include "dma_v2_defs.h"
24 #include "print_support.h"
25
isys2401_dma_reg_store(const isys2401_dma_ID_t dma_id,const unsigned int reg,const hrt_data value)26 void isys2401_dma_reg_store(const isys2401_dma_ID_t dma_id,
27 const unsigned int reg,
28 const hrt_data value)
29 {
30 unsigned int reg_loc;
31
32 assert(dma_id < N_ISYS2401_DMA_ID);
33 assert(ISYS2401_DMA_BASE[dma_id] != (hrt_address) - 1);
34
35 reg_loc = ISYS2401_DMA_BASE[dma_id] + (reg * sizeof(hrt_data));
36
37 ia_css_device_store_uint32(reg_loc, value);
38 }
39
isys2401_dma_reg_load(const isys2401_dma_ID_t dma_id,const unsigned int reg)40 hrt_data isys2401_dma_reg_load(const isys2401_dma_ID_t dma_id,
41 const unsigned int reg)
42 {
43 unsigned int reg_loc;
44 hrt_data value;
45
46 assert(dma_id < N_ISYS2401_DMA_ID);
47 assert(ISYS2401_DMA_BASE[dma_id] != (hrt_address) - 1);
48
49 reg_loc = ISYS2401_DMA_BASE[dma_id] + (reg * sizeof(hrt_data));
50
51 value = ia_css_device_load_uint32(reg_loc);
52 ia_css_print("isys dma load from addr(0x%x) val(%u)\n", reg_loc,
53 (unsigned int)value);
54
55 return value;
56 }
57
58 #endif /* __ISYS_DMA_PRIVATE_H_INCLUDED__ */
59