no-OS
demux_spi.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef SRC_DEMUX_SPI_H_
35 #define SRC_DEMUX_SPI_H_
36 
37 /******************************************************************************/
38 /***************************** Include Files **********************************/
39 /******************************************************************************/
40 
41 #include "no_os_spi.h"
42 
43 /******************************************************************************/
44 /********************** Macros and Constants Definitions **********************/
45 /******************************************************************************/
46 
47 #define CS_OFFSET 0x80
48 
49 /******************************************************************************/
50 /*************************** Types Declarations *******************************/
51 /******************************************************************************/
52 
58 
59 /******************************************************************************/
60 /************************ Functions Declarations ******************************/
61 /******************************************************************************/
62 
63 /* Initialize the SPI communication peripheral. */
64 int32_t demux_spi_init(struct no_os_spi_desc **desc,
65  const struct no_os_spi_init_param *param);
66 
67 /* Free the resources allocated by no_os_spi_init(). */
68 int32_t demux_spi_remove(struct no_os_spi_desc *desc);
69 
70 /* Write and read data to/from SPI. */
71 int32_t demux_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data,
72  uint16_t bytes_number);
73 
74 #endif /* SRC_DEMUX_SPI_H_ */
no_os_alloc.h
demux_spi_remove
int32_t demux_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by demux_spi_init().
Definition: demux_spi.c:103
no_os_spi_write_and_read
int32_t no_os_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: no_os_spi.c:159
no_os_spi.h
Header file of SPI Interface.
demux_spi_remove
int32_t demux_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by demux_spi_init().
Definition: demux_spi.c:103
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
demux_spi_init
int32_t demux_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI demux layer.
Definition: demux_spi.c:63
demux_spi.h
Header file of SPI Demux Interface.
CS_OFFSET
#define CS_OFFSET
Definition: demux_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
no_os_error.h
Error codes definition.
demux_spi_platform_ops
const struct no_os_spi_platform_ops demux_spi_platform_ops
Demux specific SPI platform ops structure.
Definition: demux_spi.c:51
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
no_os_spi_desc::extra
void * extra
Definition: no_os_spi.h:212
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
demux_spi_init
int32_t demux_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI demux layer.
Definition: demux_spi.c:63
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_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
no_os_spi_desc::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:198
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
demux_spi_write_and_read
int32_t demux_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI demux layer.
Definition: demux_spi.c:123
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
no_os_spi_desc::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:202
demux_spi_write_and_read
int32_t demux_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI demux layer.
Definition: demux_spi.c:123
demux_spi_platform_ops
const struct no_os_spi_platform_ops demux_spi_platform_ops
Demux specific SPI platform ops structure.
Definition: demux_spi.c:51
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140