Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/Pmods/Common/sw/system_config.h

raw symbols SCIP
1 /**************************************************************************//**
2 * @file system_config.h
3 * @brief System configuration header file
4 * @author ATofan ([email protected])
5 *
6 *******************************************************************************
7 * Copyright 2012(c) Analog Devices, Inc.
8 *
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 * - Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * - Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 * - Neither the name of Analog Devices, Inc. nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 * - The use of this software may or may not infringe the patent rights
23 * of one or more patent holders. This license does not release you
24 * from the requirement that you obtain separate licenses from these
25 * patent holders to use this software.
26 * - Use of the software either in source or binary form, must be run
27 * on or directly connected to an Analog Devices Inc. component.
28 *
29 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED
30 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY
31 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
34 * INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 *******************************************************************************
41 * SVN Revision: 468
42 ******************************************************************************/
43
44 /*****************************************************************************/
45 /***************************** Include Files *********************************/
46 /*****************************************************************************/
47
48 #ifndef SYSTEM_CONFIG_H_
49 #define SYSTEM_CONFIG_H_
50
51 // Select between PS7 or AXI Interface
52 #define USE_PS7 1
53 // SPI used in the design
54 #define USE_SPI 1
55 // I2C used in the design
56 #define USE_I2C 0
57 // Timer (+interrupts) used in the design
58 #define USE_TIMER 1
59 // External interrupts used in the design
60 #define USE_EXTERNAL 0
61 // GPIO used in the design
62 #define USE_GPIO 0
63
64 #if(USE_PS7 == 1)
65 #include "spi_ps7.h"
66 #include "i2c_axi.h"
67 #include "ps7_interrupts.h"
68 #include "xscugic.h"
69 #include "xil_exception.h"
70 #else
71 #include "spi_axi.h"
72 #include "i2c_axi.h"
73 #include "axi_interrupts.h"
74 #endif
75
76 // Generic functions pointers
77 u32 (*SPI_Init)(u32, char, char, char);
78 u32 (*SPI_TransferData)(u32, char, char*, char, char*, char);
79 u32 (*I2C_Init)(u32, u32);
80 u32 (*I2C_Read)(u32, u32, u32, u32, unsigned char*);
81 u32 (*I2C_Write)(u32, u32, u32, u32, unsigned char*);
82 void (*InterruptsInit)(void);
83 void (*DisableInterrupts)(int);
84 void (*EnableInterrupts)(int);
85 char (*UartReadChar)(void);
86 void (*TimerIntrFunction)(void);
87 void (*StartTimer)(void);
88 void (*StopTimer)(void);
89 void (*LoadTimer)(int);
90 void (*ExtIntrFunction)(void);
91 void (*GpioOut)(int, int);
92
93 // System configuration functions
94 void SystemSpiConfiguration(void);
95 void SystemConfiguration(void);
96
97 // AXI Functions
98 u32 SPI_Init_axi(u32 axiBaseAddr, char lsbFirst, char cpha, char cpol);
99 u32 SPI_TransferData_axi(u32 axiBaseAddr, char txSize, char* txBuf, char rxSize, char* rxBuf, char ssNo);
100 u32 I2C_Init_axi(u32 axiBaseAddr, u32 i2cAddr);
101 u32 I2C_Read_axi(u32 axiBaseAddr, u32 i2cAddr, u32 regAddr, u32 rxSize, unsigned char* rxBuf);
102 u32 I2C_Write_axi(u32 axiBaseAddr, u32 i2cAddr, u32 regAddr, u32 txSize, unsigned char* txBuf);
103 void AxiIntrInit(void);
104 void AxiIntrEnable(int intrNr);
105 void AxiIntrDisable(int intrNr);
106 char AxiUartReadChar(void);
107 void AxiTimerIntrFunction(void);
108 void AxiStartTimer(void);
109 void AxiStopTimer(void);
110 void AxiLoadTimer(int value);
111 void AxiGpioOut(int addr, int value);
112
113 // PS7 Functions
114 u32 SPI_Init_ps7(u32 axiBaseAddr, char lsbFirst, char cpha, char cpol);
115 u32 SPI_TransferData_ps7(u32 axiBaseAddr, char txSize, char* txBuf, char rxSize, char* rxBuf, char ssNo);
116 void Ps7IntrInit(void);
117 void Ps7IntrEnable(int intrNr);
118 void Ps7IntrDisable(int intrNr);
119 char Ps7UartReadChar(void);
120 void Ps7imerIntrFunction(void);
121 void Ps7StartTimer(void);
122 void Ps7StopTimer(void);
123 void Ps7LoadTimer(int value);
124 void Ps7GpioOut(int addr, int value);
125
126 // Interrupt Handlers
127 void ADITimerIntrFunction(void);
128 void ADIExtIntrFunction(void);
129
130 #endif /* SYSTEM_CONFIG_H_ */