Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/ad7616-sdz/ad7616_core.h

raw symbols SCIP
1 /***************************************************************************//**
2 * @file ad7616_core.h
3 * @brief Header file of AD7616 Core Driver.
4 * @author DBogdan ([email protected])
5 ********************************************************************************
6 * Copyright 2016(c) Analog Devices, Inc.
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
12 * - Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * - Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * - Neither the name of Analog Devices, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 * - The use of this software may or may not infringe the patent rights
22 * of one or more patent holders. This license does not release you
23 * from the requirement that you obtain separate licenses from these
24 * patent holders to use this software.
25 * - Use of the software either in source or binary form, must be run
26 * on or directly connected to an Analog Devices Inc. component.
27 *
28 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *******************************************************************************/
39 #ifndef AD7616_CORE_H_
40 #define AD7616_CORE_H_
41
42 /******************************************************************************/
43 /********************** Macros and Constants Definitions **********************/
44 /******************************************************************************/
45 #define AD7616_REG_PCORE_VERSION 0x400
46 #define AD7616_REG_ID 0x404
47 #define AD7616_REG_UP_SCRATCH 0x408
48 #define AD7616_REG_UP_IF_TYPE 0x40C
49 #define AD7616_REG_UP_CTRL 0x440
50 #define AD7616_REG_UP_CONV_RATE 0x444
51 #define AD7616_REG_UP_READ_DATA 0x448
52 #define AD7616_REG_UP_WRITE_DATA 0x44C
53
54 /* AD7616_REG_UP_CTRL */
55 #define AD7616_CTRL_RESETN (1 << 0)
56 #define AD7616_CTRL_CNVST_EN (1 << 1)
57
58 #define ADC_DMAC_REG_IRQ_MASK 0x80
59 #define ADC_DMAC_REG_IRQ_PENDING 0x84
60 #define ADC_DMAC_REG_IRQ_SOURCE 0x88
61
62 #define ADC_DMAC_REG_CTRL 0x400
63 #define ADC_DMAC_REG_TRANSFER_ID 0x404
64 #define ADC_DMAC_REG_START_TRANSFER 0x408
65 #define ADC_DMAC_REG_FLAGS 0x40c
66 #define ADC_DMAC_REG_DEST_ADDRESS 0x410
67 #define ADC_DMAC_REG_SRC_ADDRESS 0x414
68 #define ADC_DMAC_REG_X_LENGTH 0x418
69 #define ADC_DMAC_REG_Y_LENGTH 0x41c
70 #define ADC_DMAC_REG_DEST_STRIDE 0x420
71 #define ADC_DMAC_REG_SRC_STRIDE 0x424
72 #define ADC_DMAC_REG_TRANSFER_DONE 0x428
73 #define ADC_DMAC_REG_ACTIVE_TRANSFER_ID 0x42c
74 #define ADC_DMAC_REG_STATUS 0x430
75 #define ADC_DMAC_REG_CURRENT_DEST_ADDR 0x434
76 #define ADC_DMAC_REG_CURRENT_SRC_ADDR 0x438
77 #define ADC_DMAC_REG_DBG0 0x43c
78 #define ADC_DMAC_REG_DBG1 0x440
79
80 #define ADC_DMAC_CTRL_ENABLE (1 << 0)
81 #define ADC_DMAC_CTRL_PAUSE (1 << 1)
82
83 #define ADC_DMAC_IRQ_SOT (1 << 0)
84 #define ADC_DMAC_IRQ_EOT (1 << 1)
85
86 /******************************************************************************/
87 /*************************** Types Declarations *******************************/
88 /******************************************************************************/
89 typedef struct {
90 uint32_t adc_baseaddr;
91 uint32_t dmac_baseaddr;
92 uint8_t no_of_channels;
93 uint8_t resolution;
94 } adc_core;
95
96 /******************************************************************************/
97 /************************ Functions Declarations ******************************/
98 /******************************************************************************/
99 int32_t ad7616_core_read(adc_core core,
100 uint32_t reg_addr,
101 uint32_t *reg_data);
102 int32_t ad7616_core_write(adc_core core,
103 uint32_t reg_addr,
104 uint32_t reg_data);
105 int32_t ad7616_dma_read(adc_core core,
106 uint32_t reg_addr,
107 uint32_t *reg_data);
108 int32_t ad7616_dma_write(adc_core core,
109 uint32_t reg_addr,
110 uint32_t reg_data);
111 int32_t ad7616_core_setup(adc_core core);
112 int32_t ad7616_capture_serial(adc_core core,
113 uint32_t no_of_samples,
114 uint32_t start_address);
115 int32_t ad7616_capture_parallel(adc_core core,
116 uint32_t no_of_samples,
117 uint32_t start_address);
118 #endif