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  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of Analog Devices, Inc. nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25  * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *******************************************************************************/
33 #ifndef XILINX_SPI_H_
34 #define XILINX_SPI_H_
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 
40 #include <stdint.h>
41 #include "no_os_spi.h"
42 
43 /******************************************************************************/
44 /********************** Macros and Constants Definitions **********************/
45 /******************************************************************************/
46 
47 #define SPI_CS_DECODE 0x01
48 #define SPI_DEASSERT_CURRENT_SS 0x0F
49 
50 /******************************************************************************/
51 /*************************** Types Declarations *******************************/
52 /******************************************************************************/
53 
65 };
66 
76  uint32_t flags;
77 };
78 
83 struct xil_spi_desc {
87  uint32_t flags;
89  void *config;
91  void *instance;
92 };
93 
98 
102 extern const struct no_os_spi_platform_ops xil_spi_ops;
103 
107 extern const struct no_os_spi_platform_ops xil_spi_pl_ops;
108 
109 #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:453
no_os_alloc.h
NO_OS_SPI_CPOL
#define NO_OS_SPI_CPOL
Definition: no_os_spi.h:48
no_os_spi_init_param::bit_order
enum no_os_spi_bit_order bit_order
Definition: no_os_spi.h:150
SPI_PS
@ SPI_PS
Definition: xilinx_spi.h:62
xil_spi_desc::type
enum xil_spi_type type
Definition: xilinx_spi.h:85
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:249
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:222
xil_spi_init_param::flags
uint32_t flags
Definition: xilinx_spi.h:76
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:148
xil_spi_ops
const struct no_os_spi_platform_ops xil_spi_ops
Xilinx specific SPI platform ops structure.
Definition: xilinx_spi.c:453
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:361
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
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:142
SPI_CS_DECODE
#define SPI_CS_DECODE
Definition: xilinx_spi.h:47
no_os_spi_init_param::chip_select
uint8_t chip_select
Definition: no_os_spi.h:146
no_os_spi_desc::chip_select
uint8_t chip_select
Definition: no_os_spi.h:200
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:303
no_os_error.h
Error codes definition.
xil_spi_desc::instance
void * instance
Definition: xilinx_spi.h:91
SPI_PL
@ SPI_PL
Definition: xilinx_spi.h:60
no_os_spi_desc::bit_order
enum no_os_spi_bit_order bit_order
Definition: no_os_spi.h:204
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
spi_eng_platform_ops
const struct no_os_spi_platform_ops spi_eng_platform_ops
SPI engine platform ops structure.
Definition: spi_engine.c:61
xil_spi_init_param::type
enum xil_spi_type type
Definition: xilinx_spi.h:74
spi_type
spi_type
Altera platform architecture types.
Definition: altera_spi.h:46
SPI_ENGINE
@ SPI_ENGINE
Definition: xilinx_spi.h:64
no_os_spi_desc::extra
void * extra
Definition: no_os_spi.h:212
xil_spi_type
xil_spi_type
Xilinx platform architecture sections.
Definition: xilinx_spi.h:58
xil_spi_init_param
Structure holding the initialization parameters for Xilinx platform specific SPI parameters when usin...
Definition: xilinx_spi.h:72
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
no_os_spi_init_param::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:144
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
NO_OS_SPI_BIT_ORDER_LSB_FIRST
@ NO_OS_SPI_BIT_ORDER_LSB_FIRST
Definition: no_os_spi.h:78
NULL
#define NULL
Definition: wrapper.h:64
SPI_DEASSERT_CURRENT_SS
#define SPI_DEASSERT_CURRENT_SS
Definition: xilinx_spi.h:48
xil_spi_desc
Xilinx platform specific SPI descriptor.
Definition: xilinx_spi.h:83
no_os_spi_desc::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:198
xil_spi_desc::config
void * config
Definition: xilinx_spi.h:89
NO_OS_SPI_CPHA
#define NO_OS_SPI_CPHA
Definition: no_os_spi.h:47
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:224
no_os_spi_init_param::extra
void * extra
Definition: no_os_spi.h:158
xilinx_spi.h
no_os_spi_desc::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:202
xil_spi_desc::flags
uint32_t flags
Definition: xilinx_spi.h:87
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140