no-OS
linux_spi.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * @file linux/linux_spi.h
3  * @brief Header containing extra types and spi_platform_ops used by the
4  * SPI driver.
5  * @author Dragos Bogdan (dragos.bogdan@analog.com)
6 ********************************************************************************
7  * Copyright 2020(c) Analog Devices, Inc.
8  *
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, 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
30  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
31  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32  * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
33  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
35  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *******************************************************************************/
40 #ifndef LINUX_SPI_H_
41 #define LINUX_SPI_H_
42 
46 extern const struct no_os_spi_platform_ops linux_spi_ops;
47 
48 #endif // LINUX_SPI_H_
no_os_alloc.h
no_os_spi.h
Header file of SPI Interface.
linux_spi.h
linux_spi_desc::spidev_fd
int spidev_fd
Definition: linux_spi.c:68
no_os_spi_msg
Definition: no_os_spi.h:91
no_os_spi_platform_ops
Structure holding SPI function pointers that point to the platform specific function.
Definition: no_os_spi.h:203
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:139
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:60
linux_spi_desc
Linux platform specific SPI descriptor.
Definition: linux_spi.c:66
no_os_spi_init_param::device_id
uint32_t device_id
Definition: no_os_spi.h:133
no_os_spi_init_param::chip_select
uint8_t chip_select
Definition: no_os_spi.h:137
no_os_error.h
Error codes definition.
no_os_spi_msg::cs_change
uint8_t cs_change
Definition: no_os_spi.h:99
linux_spi_remove
int32_t linux_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by linux_spi_init().
Definition: linux_spi.c:177
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
linux_spi_ops
const struct no_os_spi_platform_ops linux_spi_ops
Linux specific SPI platform ops structure.
Definition: linux_spi.c:234
linux_spi_write_and_read
int32_t linux_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: linux_spi.c:149
no_os_spi_msg::bytes_number
uint32_t bytes_number
Definition: no_os_spi.h:97
no_os_spi_desc::extra
void * extra
Definition: no_os_spi.h:193
no_os_spi_msg::cs_change_delay
uint32_t cs_change_delay
Definition: no_os_spi.h:104
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:49
no_os_spi_init_param::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:135
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:75
linux_spi_init
int32_t linux_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: linux_spi.c:81
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:205
linux_spi_ops
const struct no_os_spi_platform_ops linux_spi_ops
Linux platform specific SPI platform ops structure.
Definition: linux_spi.c:234
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131