Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apps: Move common function declaration to common header #564

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
79 changes: 79 additions & 0 deletions apps/include/platform_info_common.h
Original file line number Diff line number Diff line change
@@ -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 */
59 changes: 2 additions & 57 deletions apps/machine/microblaze_generic/platform_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <openamp/virtio.h>
#include <openamp/rpmsg.h>

#include "platform_info_common.h"

#if defined __cplusplus
extern "C" {
#endif
Expand All @@ -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
Expand Down
59 changes: 2 additions & 57 deletions apps/machine/zynq7/platform_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <openamp/virtio.h>
#include <openamp/rpmsg.h>

#include "platform_info_common.h"

#if defined __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -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
Expand Down
60 changes: 2 additions & 58 deletions apps/machine/zynqmp/platform_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <openamp/virtio.h>
#include <openamp/rpmsg.h>

#include "platform_info_common.h"

#if defined __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -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
Expand Down
59 changes: 2 additions & 57 deletions apps/machine/zynqmp_r5/platform_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <openamp/virtio.h>
#include <openamp/rpmsg.h>

#include "platform_info_common.h"

#if defined __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -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
Expand Down
Loading
Loading