Debian Codegraph @

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

raw symbols SCIP
1 /**************************************************************************//**
2 * @file spi_ps7.h
3 * @brief ZYNQ Hardware SPI header file.
4 * @author ATofan ([email protected])
5 *
6 *******************************************************************************
7 * Copyright 2011(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: $WCREV$
42 ******************************************************************************/
43
44 #ifndef __SPI_PS7_H__
45 #define __SPI_PS7_H__
46
47 /*****************************************************************************/
48 /******************* Include Files *******************************************/
49 /*****************************************************************************/
50 #include <stdint.h>
51 #include "xil_types.h"
52 #include "system_config.h"
53
54 #if(USE_PS7 == 1)
55 #define SPI_BASEADDR XPAR_PS7_SPI_0_BASEADDR
56
57 /* ZYNQ Hardware SPI Registers */
58 #define HW_SPI_CONFIG_REG 0x00
59 #define HW_SPI_INTR_STS_REG 0x04
60 #define HW_SPI_INTR_EN_REG 0x08
61 #define HW_SPI_INTR_DIS_REG 0x0C
62 #define HW_SPI_INTR_MASK_REG 0x10
63 #define HW_SPI_EN_REG 0x14
64 #define HW_SPI_DELAY_REG 0x18
65 #define HW_SPI_TXDATA_REG 0x1C
66 #define HW_SPI_RXDATA_REG 0x20
67 #define HW_SPI_SLAVE_IDLE_COUNT_REG 0x24
68 #define HW_SPI_TX_THRES_REG 0x28
69 #define HW_SPI_RX_THRES_REG 0x2C
70 #define HW_SPI_MOD_ID_REG 0xFC
71
72 /* ZYNQ Hardware SPI Registers */
73 /* Config Register 0x00 */
74 #define Modefail_gen_en 17
75 #define Man_start_com 16
76 #define Man_start_en 15
77 #define Manual_CS 14
78 #define CS_Bits 10
79 #define PERI_SEL 9
80 #define SPI_REF_CLK 8
81 #define SPI_BAUD_RATE_DIV 3
82 #define SPI_CLK_PH 2
83 #define SPI_CLK_POL 1
84 #define SPI_MODE_SEL 0
85 /* Interrupt Status Register 0x04 */
86 #define SPI_TX_FIFO_underflow 6
87 #define SPI_RX_FIFO_full 5
88 #define SPI_RX_FIFO_not_empty 4
89 #define SPI_TX_FIFO_full 3
90 #define SPI_TX_FIFO_not_full 2
91 #define SPI_MODE_FAIL 1
92 #define SPI_RX_OVERFLOW 0
93 /* SPI Enable Register */
94 #define SPI_EN 0
95
96 u32 SPI_Init_ps7(u32 hwBaseAddr, char lsbFirst, char cpha, char cpol);
97 u32 SPI_TransferData_ps7(u32 hwBaseAddr, char txSize, char* txBuf, char rxSize, char* rxBuf, char ssNo);
98
99 #endif
100 #endif