no-OS
xilinx_spi.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * @file xilinx/xilinx_spi.h
3  * @brief Header containing extra types used in the spi driver.
4  * @author scuciurean (sergiu.cuciurean@analog.com)
5 ********************************************************************************
6  * Copyright 2019(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 XILINX_SPI_H_
40 #define XILINX_SPI_H_
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 
46 #include <stdint.h>
47 #include "no_os_spi.h"
48 
49 /******************************************************************************/
50 /********************** Macros and Constants Definitions **********************/
51 /******************************************************************************/
52 
53 #define SPI_CS_DECODE 0x01
54 #define SPI_DEASSERT_CURRENT_SS 0x0F
55 
56 /******************************************************************************/
57 /*************************** Types Declarations *******************************/
58 /******************************************************************************/
59 
71 };
72 
82  uint32_t flags;
83 };
84 
89 struct xil_spi_desc {
93  uint32_t flags;
95  void *config;
97  void *instance;
98 };
99 
103 extern const struct no_os_spi_platform_ops spi_eng_platform_ops;
104 
108 extern const struct no_os_spi_platform_ops xil_spi_ops;
109 
113 extern const struct no_os_spi_platform_ops xil_spi_pl_ops;
114 
115 #endif // XILINX_SPI_H_
xil_spi_ops
const struct no_os_spi_platform_ops xil_spi_ops
Xilinx platform specific SPI platform ops structure.
Definition: xilinx_spi.c:458
NO_OS_SPI_CPOL
#define NO_OS_SPI_CPOL
Definition: no_os_spi.h:54
no_os_spi_init_param::bit_order
enum no_os_spi_bit_order bit_order
Definition: no_os_spi.h:131
SPI_PS
@ SPI_PS
Definition: xilinx_spi.h:68
xil_spi_desc::type
enum xil_spi_type type
Definition: xilinx_spi.h:91
xil_spi_init
int32_t xil_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: xilinx_spi.c:254
no_os_spi.h
Header file of SPI Interface.
no_os_spi_platform_ops
Structure holding SPI function pointers that point to the platform specific function.
Definition: no_os_spi.h:166
xil_spi_init_param::flags
uint32_t flags
Definition: xilinx_spi.h:82
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:129
xil_spi_ops
const struct no_os_spi_platform_ops xil_spi_ops
Xilinx specific SPI platform ops structure.
Definition: xilinx_spi.c:458
xil_spi_write_and_read
int32_t xil_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: xilinx_spi.c:366
xil_spi_pl_ops
const struct no_os_spi_platform_ops xil_spi_pl_ops
Xilinx SPI PS register functions. No extra param needed.
no_os_spi_init_param::device_id
uint32_t device_id
Definition: no_os_spi.h:123
SPI_CS_DECODE
#define SPI_CS_DECODE
Definition: xilinx_spi.h:53
no_os_spi_init_param::chip_select
uint8_t chip_select
Definition: no_os_spi.h:127
no_os_spi_desc::chip_select
uint8_t chip_select
Definition: no_os_spi.h:149
xil_spi_remove
int32_t xil_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: xilinx_spi.c:308
no_os_error.h
Error codes definition.
xil_spi_desc::instance
void * instance
Definition: xilinx_spi.h:97
SPI_PL
@ SPI_PL
Definition: xilinx_spi.h:66
no_os_spi_desc::bit_order
enum no_os_spi_bit_order bit_order
Definition: no_os_spi.h:153
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:143
spi_eng_platform_ops
const struct no_os_spi_platform_ops spi_eng_platform_ops
SPI engine platform ops structure.
Definition: spi_engine.c:63
xil_spi_init_param::type
enum xil_spi_type type
Definition: xilinx_spi.h:80
spi_type
spi_type
Altera platform architecture types.
Definition: altera_spi.h:52
SPI_ENGINE
@ SPI_ENGINE
Definition: xilinx_spi.h:70
no_os_spi_desc::extra
void * extra
Definition: no_os_spi.h:156
xil_spi_type
xil_spi_type
Xilinx platform architecture sections.
Definition: xilinx_spi.h:64
xil_spi_init_param
Structure holding the initialization parameters for Xilinx platform specific SPI parameters when usin...
Definition: xilinx_spi.h:78
no_os_spi_init_param::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:125
NO_OS_SPI_BIT_ORDER_LSB_FIRST
@ NO_OS_SPI_BIT_ORDER_LSB_FIRST
Definition: no_os_spi.h:83
NULL
#define NULL
Definition: wrapper.h:64
SPI_DEASSERT_CURRENT_SS
#define SPI_DEASSERT_CURRENT_SS
Definition: xilinx_spi.h:54
xil_spi_desc
Xilinx platform specific SPI descriptor.
Definition: xilinx_spi.h:89
no_os_spi_desc::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:147
xil_spi_desc::config
void * config
Definition: xilinx_spi.h:95
NO_OS_SPI_CPHA
#define NO_OS_SPI_CPHA
Definition: no_os_spi.h:53
no_os_spi_platform_ops::init
int32_t(* init)(struct no_os_spi_desc **, const struct no_os_spi_init_param *)
Definition: no_os_spi.h:168
no_os_spi_init_param::extra
void * extra
Definition: no_os_spi.h:134
xilinx_spi.h
no_os_spi_desc::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:151
xil_spi_desc::flags
uint32_t flags
Definition: xilinx_spi.h:93
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:121