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  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * 3. Neither the name of Analog Devices, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived from this
21  * software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR
24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
26  * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
29  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *******************************************************************************/
34 #ifndef LINUX_SPI_H_
35 #define LINUX_SPI_H_
36 
40 extern const struct no_os_spi_platform_ops linux_spi_ops;
41 
42 #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:62
no_os_spi_msg
Definition: no_os_spi.h:100
no_os_spi_platform_ops
Structure holding SPI function pointers that point to the platform specific function.
Definition: no_os_spi.h:222
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:148
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
linux_spi_desc
Linux platform specific SPI descriptor.
Definition: linux_spi.c:60
no_os_spi_init_param::device_id
uint32_t device_id
Definition: no_os_spi.h:142
no_os_spi_init_param::chip_select
uint8_t chip_select
Definition: no_os_spi.h:146
no_os_error.h
Error codes definition.
no_os_spi_msg::cs_change
uint8_t cs_change
Definition: no_os_spi.h:108
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:171
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
linux_spi_ops
const struct no_os_spi_platform_ops linux_spi_ops
Linux specific SPI platform ops structure.
Definition: linux_spi.c:228
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:143
no_os_spi_msg::bytes_number
uint32_t bytes_number
Definition: no_os_spi.h:106
no_os_spi_desc::extra
void * extra
Definition: no_os_spi.h:212
no_os_spi_msg::cs_change_delay
uint32_t cs_change_delay
Definition: no_os_spi.h:113
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
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:75
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
linux_spi_ops
const struct no_os_spi_platform_ops linux_spi_ops
Linux platform specific SPI platform ops structure.
Definition: linux_spi.c:228
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140