#include <metal/io.h>
#include <metal/mutex.h>
#include <openamp/rpmsg.h>
#include <openamp/virtio.h>
Go to the source code of this file.
|
| static __deprecated int | deprecated_rpmsg_master (void) |
| |
| static __deprecated int | deprecated_rpmsg_slave (void) |
| |
| static unsigned int | rpmsg_virtio_get_role (struct rpmsg_virtio_device *rvdev) |
| |
| static void | rpmsg_virtio_set_status (struct rpmsg_virtio_device *rvdev, uint8_t status) |
| |
| static uint8_t | rpmsg_virtio_get_status (struct rpmsg_virtio_device *rvdev) |
| |
| static uint32_t | rpmsg_virtio_get_features (struct rpmsg_virtio_device *rvdev) |
| |
| static void | rpmsg_virtio_read_config (struct rpmsg_virtio_device *rvdev, uint32_t offset, void *dst, int length) |
| |
| static void | rpmsg_virtio_write_config (struct rpmsg_virtio_device *rvdev, uint32_t offset, void *dst, int length) |
| |
| static int | rpmsg_virtio_create_virtqueues (struct rpmsg_virtio_device *rvdev, int flags, unsigned int nvqs, const char *names[], vq_callback *callbacks) |
| |
| int | rpmsg_virtio_get_buffer_size (struct rpmsg_device *rdev) |
| | Get rpmsg virtio buffer size. More...
|
| |
| int | rpmsg_init_vdev (struct rpmsg_virtio_device *rvdev, struct virtio_device *vdev, rpmsg_ns_bind_cb ns_bind_cb, struct metal_io_region *shm_io, struct rpmsg_virtio_shm_pool *shpool) |
| | Initialize rpmsg virtio device. More...
|
| |
| int | rpmsg_init_vdev_with_config (struct rpmsg_virtio_device *rvdev, struct virtio_device *vdev, rpmsg_ns_bind_cb ns_bind_cb, struct metal_io_region *shm_io, struct rpmsg_virtio_shm_pool *shpool, const struct rpmsg_virtio_config *config) |
| | Initialize rpmsg virtio device with config. More...
|
| |
| void | rpmsg_deinit_vdev (struct rpmsg_virtio_device *rvdev) |
| | Deinitialize rpmsg virtio device. More...
|
| |
| void | rpmsg_virtio_init_shm_pool (struct rpmsg_virtio_shm_pool *shpool, void *shbuf, size_t size) |
| | Initialize default shared buffers pool. More...
|
| |
| static struct rpmsg_device * | rpmsg_virtio_get_rpmsg_device (struct rpmsg_virtio_device *rvdev) |
| | Get RPMsg device from RPMsg virtio device. More...
|
| |
| metal_weak void * | rpmsg_virtio_shm_pool_get_buffer (struct rpmsg_virtio_shm_pool *shpool, size_t size) |
| | Get buffer in the shared memory pool. More...
|
| |
◆ RPMSG_BUFFER_SIZE
| #define RPMSG_BUFFER_SIZE (512) |
◆ RPMSG_HOST
◆ RPMSG_MASTER
◆ RPMSG_REMOTE
◆ RPMSG_SLAVE
◆ VIRTIO_RPMSG_F_NS
| #define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ |
◆ deprecated_rpmsg_master()
| static __deprecated int deprecated_rpmsg_master |
( |
void |
| ) |
|
|
inlinestatic |
◆ deprecated_rpmsg_slave()
| static __deprecated int deprecated_rpmsg_slave |
( |
void |
| ) |
|
|
inlinestatic |
◆ rpmsg_deinit_vdev()
Deinitialize rpmsg virtio device.
- Parameters
-
| rvdev | Pointer to the rpmsg virtio device |
◆ rpmsg_init_vdev()
Initialize rpmsg virtio device.
Host side: Initialize RPMsg virtio queues and shared buffers, the address of shm can be ANY. In this case, function will get shared memory from system shared memory pools. If the vdev has the RPMsg name service feature, this API will create a name service endpoint.
Remote side: This API will not return until the driver ready is set by the host side.
- Parameters
-
| rvdev | Pointer to the rpmsg virtio device |
| vdev | Pointer to the virtio device |
| ns_bind_cb | Callback handler for name service announcement without local endpoints waiting to bind. |
| shm_io | Pointer to the share memory I/O region. |
| shpool | Pointer to shared memory pool. rpmsg_virtio_init_shm_pool has to be called first to fill this structure. |
- Returns
- Status of function execution
◆ rpmsg_init_vdev_with_config()
Initialize rpmsg virtio device with config.
Host side: Initialize RPMsg virtio queues and shared buffers, the address of shm can be ANY. In this case, function will get shared memory from system shared memory pools. If the vdev has the RPMsg name service feature, this API will create a name service endpoint. Sizes of virtio data buffers used by the initialized RPMsg instance are set to values read from the passed configuration structure.
Remote side: This API will not return until the driver ready is set by the host side. Sizes of virtio data buffers are set by the host side. Values passed in the configuration structure have no effect.
- Parameters
-
| rvdev | Pointer to the rpmsg virtio device |
| vdev | Pointer to the virtio device |
| ns_bind_cb | Callback handler for name service announcement without local endpoints waiting to bind. |
| shm_io | Pointer to the share memory I/O region. |
| shpool | Pointer to shared memory pool array. If the config->split_shpool is turn on, the array will contain two elements, the shpool of txshpool and rxshpool, Otherwise, the array has only one element, and txshpool rxshpool shares a shpool. And rpmsg_virtio_init_shm_pool has to be called first to fill each shpool in this array. |
| config | Pointer to configuration structure |
- Returns
- Status of function execution
VIRTIO_DEVICE_ONLY
VIRTIO_DRIVER_ONLY
VIRTIO_DEVICE_ONLY
VIRTIO_DRIVER_ONLY
VIRTIO_DEVICE_ONLY
VIRTIO_DEVICE_ONLY
◆ rpmsg_virtio_create_virtqueues()
| static int rpmsg_virtio_create_virtqueues |
( |
struct rpmsg_virtio_device * |
rvdev, |
|
|
int |
flags, |
|
|
unsigned int |
nvqs, |
|
|
const char * |
names[], |
|
|
vq_callback * |
callbacks |
|
) |
| |
|
inlinestatic |
◆ rpmsg_virtio_get_buffer_size()
| int rpmsg_virtio_get_buffer_size |
( |
struct rpmsg_device * |
rdev | ) |
|
Get rpmsg virtio buffer size.
- Parameters
-
| rdev | Pointer to the rpmsg device |
- Returns
- Next available buffer size for text, negative value for failure
◆ rpmsg_virtio_get_features()
◆ rpmsg_virtio_get_role()
◆ rpmsg_virtio_get_rpmsg_device()
Get RPMsg device from RPMsg virtio device.
- Parameters
-
| rvdev | Pointer to RPMsg virtio device |
- Returns
- RPMsg device pointed by RPMsg virtio device
◆ rpmsg_virtio_get_status()
◆ rpmsg_virtio_init_shm_pool()
Initialize default shared buffers pool.
RPMsg virtio has default shared buffers pool implementation. The memory assigned to this pool will be dedicated to the RPMsg virtio. This function has to be called before calling rpmsg_init_vdev, to initialize the rpmsg_virtio_shm_pool structure.
- Parameters
-
| shpool | Pointer to the shared buffers pool structure |
| shbuf | Pointer to the beginning of shared buffers |
| size | Shared buffers total size |
VIRTIO_DEVICE_ONLY
◆ rpmsg_virtio_read_config()
| static void rpmsg_virtio_read_config |
( |
struct rpmsg_virtio_device * |
rvdev, |
|
|
uint32_t |
offset, |
|
|
void * |
dst, |
|
|
int |
length |
|
) |
| |
|
inlinestatic |
◆ rpmsg_virtio_set_status()
◆ rpmsg_virtio_shm_pool_get_buffer()
Get buffer in the shared memory pool.
RPMsg virtio has default shared buffers pool implementation. The memory assigned to this pool will be dedicated to the RPMsg virtio. If you prefer to have other shared buffers allocation, you can implement your rpmsg_virtio_shm_pool_get_buffer function.
- Parameters
-
| shpool | Pointer to the shared buffers pool |
| size | Shared buffers total size |
- Returns
- Buffer pointer if free buffer is available, NULL otherwise.
◆ rpmsg_virtio_write_config()
| static void rpmsg_virtio_write_config |
( |
struct rpmsg_virtio_device * |
rvdev, |
|
|
uint32_t |
offset, |
|
|
void * |
dst, |
|
|
int |
length |
|
) |
| |
|
inlinestatic |