mirror of
https://github.com/OpenAMP/open-amp.git
synced 2026-02-06 11:13:09 +08:00
apps: Move common function declaration to common header
Several platform_*() functions are common across the example machines. They actually have to be as they are consumed by example apps that build across these machines. Move these common declarations to common a header. Signed-off-by: Andrew Davis <afd@ti.com>
This commit is contained in:
committed by
Arnaud Pouliquen
parent
793851621d
commit
fd6a6fdda7
@@ -8,6 +8,8 @@ set (APPS_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
set (APPS_SHARE_DIR "${CMAKE_CURRENT_BINARY_DIR}/share")
|
||||
|
||||
collect (APP_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
|
||||
add_subdirectory (machine)
|
||||
add_subdirectory (system)
|
||||
add_subdirectory (tests)
|
||||
|
||||
79
apps/include/platform_info_common.h
Normal file
79
apps/include/platform_info_common.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Texas Instruments, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_INFO_COMMON_H
|
||||
#define PLATFORM_INFO_COMMON_H
|
||||
|
||||
#include <openamp/remoteproc.h>
|
||||
#include <openamp/virtio.h>
|
||||
#include <openamp/rpmsg.h>
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* platform_init - initialize the platform
|
||||
*
|
||||
* Initialize the platform.
|
||||
*
|
||||
* @argc: number of arguments
|
||||
* @argv: array of the input arguments
|
||||
* @platform: pointer to store the platform data pointer
|
||||
*
|
||||
* return 0 for success or negative value for failure
|
||||
*/
|
||||
int platform_init(int argc, char *argv[], void **platform);
|
||||
|
||||
/**
|
||||
* platform_create_rpmsg_vdev - create rpmsg vdev
|
||||
*
|
||||
* Create rpmsg virtio device, and return the rpmsg virtio
|
||||
* device pointer.
|
||||
*
|
||||
* @platform: pointer to the private data
|
||||
* @vdev_index: index of the virtio device, there can more than one vdev
|
||||
* on the platform.
|
||||
* @role: virtio driver or virtio device of the vdev
|
||||
* @rst_cb: virtio device reset callback
|
||||
* @ns_bind_cb: rpmsg name service bind callback
|
||||
*
|
||||
* return pointer to the rpmsg virtio device
|
||||
*/
|
||||
struct rpmsg_device *
|
||||
platform_create_rpmsg_vdev(void *platform, unsigned int vdev_index,
|
||||
unsigned int role,
|
||||
void (*rst_cb)(struct virtio_device *vdev),
|
||||
rpmsg_ns_bind_cb ns_bind_cb);
|
||||
|
||||
/**
|
||||
* platform_poll - platform poll function
|
||||
*
|
||||
* @platform: pointer to the platform
|
||||
*
|
||||
* return negative value for errors, otherwise 0.
|
||||
*/
|
||||
int platform_poll(void *platform);
|
||||
|
||||
/**
|
||||
* platform_release_rpmsg_vdev - release rpmsg virtio device
|
||||
*
|
||||
* @rpdev: pointer to the rpmsg device
|
||||
*/
|
||||
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform);
|
||||
|
||||
/**
|
||||
* platform_cleanup - clean up the platform resource
|
||||
*
|
||||
* @platform: pointer to the platform
|
||||
*/
|
||||
void platform_cleanup(void *platform);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PLATFORM_INFO_COMMON_H */
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <openamp/virtio.h>
|
||||
#include <openamp/rpmsg.h>
|
||||
|
||||
#include "platform_info_common.h"
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -33,63 +35,6 @@ struct remoteproc_priv {
|
||||
atomic_int ipi_nokick;
|
||||
};
|
||||
|
||||
/**
|
||||
* platform_init - initialize the platform
|
||||
*
|
||||
* Initialize the platform.
|
||||
*
|
||||
* @argc: number of arguments
|
||||
* @argv: array of the input arguments
|
||||
* @platform: pointer to store the platform data pointer
|
||||
*
|
||||
* return 0 for success or negative value for failure
|
||||
*/
|
||||
int platform_init(int argc, char *argv[], void **platform);
|
||||
|
||||
/**
|
||||
* platform_create_rpmsg_vdev - create rpmsg vdev
|
||||
*
|
||||
* Create rpmsg virtio device, and return the rpmsg virtio
|
||||
* device pointer.
|
||||
*
|
||||
* @platform: pointer to the private data
|
||||
* @vdev_index: index of the virtio device, there can more than one vdev
|
||||
* on the platform.
|
||||
* @role: virtio driver or virtio device of the vdev
|
||||
* @rst_cb: virtio device reset callback
|
||||
* @ns_bind_cb: rpmsg name service bind callback
|
||||
*
|
||||
* return pointer to the rpmsg virtio device
|
||||
*/
|
||||
struct rpmsg_device *
|
||||
platform_create_rpmsg_vdev(void *platform, unsigned int vdev_index,
|
||||
unsigned int role,
|
||||
void (*rst_cb)(struct virtio_device *vdev),
|
||||
rpmsg_ns_bind_cb ns_bind_cb);
|
||||
|
||||
/**
|
||||
* platform_poll - platform poll function
|
||||
*
|
||||
* @platform: pointer to the platform
|
||||
*
|
||||
* return negative value for errors, otherwise 0.
|
||||
*/
|
||||
int platform_poll(void *platform);
|
||||
|
||||
/**
|
||||
* platform_release_rpmsg_vdev - release rpmsg virtio device
|
||||
*
|
||||
* @rpdev: pointer to the rpmsg device
|
||||
*/
|
||||
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform);
|
||||
|
||||
/**
|
||||
* platform_cleanup - clean up the platform resource
|
||||
*
|
||||
* @platform: pointer to the platform
|
||||
*/
|
||||
void platform_cleanup(void *platform);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <openamp/virtio.h>
|
||||
#include <openamp/rpmsg.h>
|
||||
|
||||
#include "platform_info_common.h"
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -50,63 +52,6 @@ struct remoteproc_priv {
|
||||
atomic_int nokick; /* 0 for kick from other side */
|
||||
};
|
||||
|
||||
/**
|
||||
* platform_init - initialize the platform
|
||||
*
|
||||
* It will initialize the platform.
|
||||
*
|
||||
* @argc: number of arguments
|
||||
* @argv: array of the input arguments
|
||||
* @platform: pointer to store the platform data pointer
|
||||
*
|
||||
* return 0 for success or negative value for failure
|
||||
*/
|
||||
int platform_init(int argc, char *argv[], void **platform);
|
||||
|
||||
/**
|
||||
* platform_create_rpmsg_vdev - create rpmsg vdev
|
||||
*
|
||||
* It will create rpmsg virtio device, and returns the rpmsg virtio
|
||||
* device pointer.
|
||||
*
|
||||
* @platform: pointer to the private data
|
||||
* @vdev_index: index of the virtio device, there can more than one vdev
|
||||
* on the platform.
|
||||
* @role: virtio driver or virtio device of the vdev
|
||||
* @rst_cb: virtio device reset callback
|
||||
* @ns_bind_cb: rpmsg name service bind callback
|
||||
*
|
||||
* return pointer to the rpmsg virtio device
|
||||
*/
|
||||
struct rpmsg_device *
|
||||
platform_create_rpmsg_vdev(void *platform, unsigned int vdev_index,
|
||||
unsigned int role,
|
||||
void (*rst_cb)(struct virtio_device *vdev),
|
||||
rpmsg_ns_bind_cb ns_bind_cb);
|
||||
|
||||
/**
|
||||
* platform_poll - platform poll function
|
||||
*
|
||||
* @platform: pointer to the platform
|
||||
*
|
||||
* return negative value for errors, otherwise 0.
|
||||
*/
|
||||
int platform_poll(void *platform);
|
||||
|
||||
/**
|
||||
* platform_release_rpmsg_vdev - release rpmsg virtio device
|
||||
*
|
||||
* @rpdev: pointer to the rpmsg device
|
||||
*/
|
||||
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform);
|
||||
|
||||
/**
|
||||
* platform_cleanup - clean up the platform resource
|
||||
*
|
||||
* @platform: pointer to the platform
|
||||
*/
|
||||
void platform_cleanup(void *platform);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include <openamp/virtio.h>
|
||||
#include <openamp/rpmsg.h>
|
||||
|
||||
#include "platform_info_common.h"
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -51,64 +53,6 @@ struct remoteproc_priv {
|
||||
#define POLL_STOP 0x1U
|
||||
#endif /* RPMSG_NO_IPI */
|
||||
|
||||
|
||||
/**
|
||||
* platform_init - initialize the platform
|
||||
*
|
||||
* It will initialize the platform.
|
||||
*
|
||||
* @argc: number of arguments
|
||||
* @argv: array of the input arguments
|
||||
* @platform: pointer to store the platform data pointer
|
||||
*
|
||||
* return 0 for success or negative value for failure
|
||||
*/
|
||||
int platform_init(int argc, char *argv[], void **platform);
|
||||
|
||||
/**
|
||||
* platform_create_rpmsg_vdev - create rpmsg vdev
|
||||
*
|
||||
* It will create rpmsg virtio device, and returns the rpmsg virtio
|
||||
* device pointer.
|
||||
*
|
||||
* @platform: pointer to the private data
|
||||
* @vdev_index: index of the virtio device, there can more than one vdev
|
||||
* on the platform.
|
||||
* @role: virtio driver or virtio device of the vdev
|
||||
* @rst_cb: virtio device reset callback
|
||||
* @ns_bind_cb: rpmsg name service bind callback
|
||||
*
|
||||
* return pointer to the rpmsg virtio device
|
||||
*/
|
||||
struct rpmsg_device *
|
||||
platform_create_rpmsg_vdev(void *platform, unsigned int vdev_index,
|
||||
unsigned int role,
|
||||
void (*rst_cb)(struct virtio_device *vdev),
|
||||
rpmsg_ns_bind_cb ns_bind_cb);
|
||||
|
||||
/**
|
||||
* platform_poll - platform poll function
|
||||
*
|
||||
* @platform: pointer to the platform
|
||||
*
|
||||
* return negative value for errors, otherwise 0.
|
||||
*/
|
||||
int platform_poll(void *platform);
|
||||
|
||||
/**
|
||||
* platform_release_rpmsg_vdev - release rpmsg virtio device
|
||||
*
|
||||
* @rpdev: pointer to the rpmsg device
|
||||
*/
|
||||
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform);
|
||||
|
||||
/**
|
||||
* platform_cleanup - clean up the platform resource
|
||||
*
|
||||
* @platform: pointer to the platform
|
||||
*/
|
||||
void platform_cleanup(void *platform);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <openamp/virtio.h>
|
||||
#include <openamp/rpmsg.h>
|
||||
|
||||
#include "platform_info_common.h"
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -73,63 +75,6 @@ struct remoteproc_priv {
|
||||
#endif /* !RPMSG_NO_IPI */
|
||||
};
|
||||
|
||||
/**
|
||||
* platform_init - initialize the platform
|
||||
*
|
||||
* It will initialize the platform.
|
||||
*
|
||||
* @argc: number of arguments
|
||||
* @argv: array of the input arguments
|
||||
* @platform: pointer to store the platform data pointer
|
||||
*
|
||||
* return 0 for success or negative value for failure
|
||||
*/
|
||||
int platform_init(int argc, char *argv[], void **platform);
|
||||
|
||||
/**
|
||||
* platform_create_rpmsg_vdev - create rpmsg vdev
|
||||
*
|
||||
* It will create rpmsg virtio device, and returns the rpmsg virtio
|
||||
* device pointer.
|
||||
*
|
||||
* @platform: pointer to the private data
|
||||
* @vdev_index: index of the virtio device, there can more than one vdev
|
||||
* on the platform.
|
||||
* @role: virtio driver or virtio device of the vdev
|
||||
* @rst_cb: virtio device reset callback
|
||||
* @ns_bind_cb: rpmsg name service bind callback
|
||||
*
|
||||
* return pointer to the rpmsg virtio device
|
||||
*/
|
||||
struct rpmsg_device *
|
||||
platform_create_rpmsg_vdev(void *platform, unsigned int vdev_index,
|
||||
unsigned int role,
|
||||
void (*rst_cb)(struct virtio_device *vdev),
|
||||
rpmsg_ns_bind_cb ns_bind_cb);
|
||||
|
||||
/**
|
||||
* platform_poll - platform poll function
|
||||
*
|
||||
* @platform: pointer to the platform
|
||||
*
|
||||
* return negative value for errors, otherwise 0.
|
||||
*/
|
||||
int platform_poll(void *platform);
|
||||
|
||||
/**
|
||||
* platform_release_rpmsg_vdev - release rpmsg virtio device
|
||||
*
|
||||
* @rpdev: pointer to the rpmsg device
|
||||
*/
|
||||
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform);
|
||||
|
||||
/**
|
||||
* platform_cleanup - clean up the platform resource
|
||||
*
|
||||
* @platform: pointer to the platform
|
||||
*/
|
||||
void platform_cleanup(void *platform);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -16,69 +16,6 @@
|
||||
#include <openamp/virtio.h>
|
||||
#include <openamp/rpmsg.h>
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* platform_init - initialize the platform
|
||||
*
|
||||
* It will initialize the platform.
|
||||
*
|
||||
* @argc: number of arguments
|
||||
* @argv: array of the input arguments
|
||||
* @platform: pointer to store the platform data pointer
|
||||
*
|
||||
* return 0 for success or negative value for failure
|
||||
*/
|
||||
int platform_init(int argc, char *argv[], void **platform);
|
||||
|
||||
/**
|
||||
* platform_create_rpmsg_vdev - create rpmsg vdev
|
||||
*
|
||||
* It will create rpmsg virtio device, and returns the rpmsg virtio
|
||||
* device pointer.
|
||||
*
|
||||
* @platform: pointer to the private data
|
||||
* @vdev_index: index of the virtio device, there can more than one vdev
|
||||
* on the platform.
|
||||
* @role: virtio driver or virtio device of the vdev
|
||||
* @rst_cb: virtio device reset callback
|
||||
* @ns_bind_cb: rpmsg name service bind callback
|
||||
*
|
||||
* return pointer to the rpmsg virtio device
|
||||
*/
|
||||
struct rpmsg_device *
|
||||
platform_create_rpmsg_vdev(void *platform, unsigned int vdev_index,
|
||||
unsigned int role,
|
||||
void (*rst_cb)(struct virtio_device *vdev),
|
||||
rpmsg_ns_bind_cb ns_bind_cb);
|
||||
|
||||
/**
|
||||
* platform_poll - platform poll function
|
||||
*
|
||||
* @platform: pointer to the platform
|
||||
*
|
||||
* return negative value for errors, otherwise 0.
|
||||
*/
|
||||
int platform_poll(void *platform);
|
||||
|
||||
/**
|
||||
* platform_release_rpmsg_vdev - release rpmsg virtio device
|
||||
*
|
||||
* @rpdev: pointer to the rpmsg device
|
||||
*/
|
||||
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform);
|
||||
|
||||
/**
|
||||
* platform_cleanup - clean up the platform resource
|
||||
*
|
||||
* @platform: pointer to the platform
|
||||
*/
|
||||
void platform_cleanup(void *platform);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "platform_info_common.h"
|
||||
|
||||
#endif /* PLATFORM_INFO_H */
|
||||
|
||||
Reference in New Issue
Block a user