mirror of
https://github.com/apache/nuttx.git
synced 2026-05-25 18:27:56 +08:00
rpmsg_port_spi: add spi slave support
The rpmsg port spi slave version support Signed-off-by: liaoao <liaoao@xiaomi.com>
This commit is contained in:
@@ -37,6 +37,10 @@ if(CONFIG_RPMSG)
|
||||
list(APPEND SRCS rpmsg_port_spi.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_RPMSG_PORT_SPI_SLAVE)
|
||||
list(APPEND SRCS rpmsg_port_spi_slave.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_RPMSG_VIRTIO)
|
||||
list(APPEND SRCS rpmsg_virtio.c)
|
||||
endif()
|
||||
|
||||
@@ -44,7 +44,14 @@ config RPMSG_PORT_SPI
|
||||
---help---
|
||||
Rpmsg SPI Port driver used for cross chip communication.
|
||||
|
||||
if RPMSG_PORT_SPI
|
||||
config RPMSG_PORT_SPI_SLAVE
|
||||
bool "Rpmsg SPI Slave Port Driver Support"
|
||||
default n
|
||||
select RPMSG_PORT
|
||||
---help---
|
||||
Rpmsg SPI Slave Port driver used for cross chip communication.
|
||||
|
||||
if RPMSG_PORT_SPI || RPMSG_PORT_SPI_SLAVE
|
||||
|
||||
config RPMSG_PORT_SPI_THREAD_PRIORITY
|
||||
int "Rpmsg SPI Port Thread Priority"
|
||||
|
||||
@@ -41,6 +41,10 @@ ifeq ($(CONFIG_RPMSG_PORT_SPI),y)
|
||||
CSRCS += rpmsg_port_spi.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RPMSG_PORT_SPI_SLAVE),y)
|
||||
CSRCS += rpmsg_port_spi_slave.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RPMSG_VIRTIO),y)
|
||||
CSRCS += rpmsg_virtio.c
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)openamp$(DELIM)open-amp$(DELIM)lib
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <nuttx/ioexpander/ioexpander.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/spi/slave.h>
|
||||
|
||||
#ifdef CONFIG_RPMSG_PORT
|
||||
|
||||
@@ -77,7 +78,7 @@ struct rpmsg_port_spi_config_s
|
||||
int mreq_invert;
|
||||
int sreq_invert; /* Pin options described in ioexpander.h */
|
||||
|
||||
enum spi_mode_e mode;
|
||||
int mode; /* Mode of enum spi_mode_e */
|
||||
uint32_t devid; /* Device ID of enum spi_devtype_e */
|
||||
uint32_t freq; /* SPI frequency (Hz) */
|
||||
};
|
||||
@@ -123,6 +124,34 @@ rpmsg_port_spi_initialize(FAR const struct rpmsg_port_config_s *cfg,
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RPMSG_PORT_SPI_SLAVE
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rpmsg_port_spi_slave_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize a rpmsg_port_spi_slave device to communicate between two
|
||||
* chips.
|
||||
*
|
||||
* Input Parameters:
|
||||
* cfg - Configuration of buffers needed for communication.
|
||||
* spicfg - SPI device's configuration.
|
||||
* spictrlr - SPI slave controller used for transfer data between two
|
||||
* chips.
|
||||
* ioe - ioexpander used to config gpios.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero on success or an negative value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int
|
||||
rpmsg_port_spi_slave_initialize(FAR const struct rpmsg_port_config_s *cfg,
|
||||
FAR const struct rpmsg_port_spi_config_s *spicfg,
|
||||
FAR struct spi_slave_ctrlr_s *spictrlr, FAR struct ioexpander_dev_s *ioe);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user