-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move apps dir from the open-amp repository
Move apps directory from https://github.com/OpenAMP/open-amp Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
- Loading branch information
1 parent
9c75250
commit 0cb624c
Showing
96 changed files
with
11,588 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
collector_create (APP_COMMON_SOURCES "") | ||
collector_create (APP_LIB_DIRS "") | ||
collector_create (APP_INC_DIRS "") | ||
collector_create (APP_LIB_DEPS "") | ||
|
||
collector_create (APP_EXTRA_C_FLAGS "") | ||
set (APPS_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") | ||
|
||
set (APPS_SHARE_DIR "${CMAKE_CURRENT_BINARY_DIR}/share") | ||
|
||
add_subdirectory (machine) | ||
add_subdirectory (system) | ||
add_subdirectory (tests) | ||
add_subdirectory (examples) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
option (WITH_LOAD_FW "Include loading firmware example" OFF) | ||
|
||
if (MACHINE MATCHES ".*microblaze.*") | ||
add_subdirectory (echo) | ||
else () | ||
add_subdirectory (echo) | ||
add_subdirectory (nocopy_echo) | ||
add_subdirectory (rpmsg_sample_echo) | ||
add_subdirectory (matrix_multiply) | ||
if (WITH_LOAD_FW) | ||
add_subdirectory (load_fw) | ||
endif (WITH_LOAD_FW) | ||
if (WITH_PROXY_APPS) | ||
add_subdirectory (rpc_demo) | ||
add_subdirectory (linux_rpc_demo) | ||
endif (WITH_PROXY_APPS) | ||
endif (MACHINE MATCHES ".*microblaze.*") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
set (_cflags "${CMAKE_C_FLAGS} ${APP_EXTRA_C_FLAGS} -fdata-sections -ffunction-sections") | ||
set (_fw_dir "${APPS_SHARE_DIR}") | ||
|
||
collector_list (_list PROJECT_INC_DIRS) | ||
collector_list (_app_list APP_INC_DIRS) | ||
include_directories (${_list} ${_app_list} ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
collector_list (_list PROJECT_LIB_DIRS) | ||
collector_list (_app_list APP_LIB_DIRS) | ||
link_directories (${_list} ${_app_list}) | ||
|
||
get_property (_linker_opt GLOBAL PROPERTY APP_LINKER_OPT) | ||
collector_list (_deps PROJECT_LIB_DEPS) | ||
|
||
set (OPENAMP_LIB open_amp) | ||
|
||
foreach (_app rpmsg-echo-ping rpmsg-echo) | ||
collector_list (_sources APP_COMMON_SOURCES) | ||
if (${_app} STREQUAL "rpmsg-echo-ping") | ||
list (APPEND _sources "${CMAKE_CURRENT_SOURCE_DIR}/rpmsg-ping.c") | ||
elseif (${_app} STREQUAL "rpmsg-echo") | ||
list (APPEND _sources "${CMAKE_CURRENT_SOURCE_DIR}/rpmsg-echo.c") | ||
endif (${_app} STREQUAL "rpmsg-echo-ping") | ||
|
||
if (WITH_SHARED_LIB) | ||
add_executable (${_app}-shared ${_sources}) | ||
target_link_libraries (${_app}-shared ${OPENAMP_LIB}-shared ${_deps}) | ||
install (TARGETS ${_app}-shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
endif (WITH_SHARED_LIB) | ||
|
||
if (WITH_STATIC_LIB) | ||
if (${PROJECT_SYSTEM} STREQUAL "linux") | ||
add_executable (${_app}-static ${_sources}) | ||
target_link_libraries (${_app}-static ${OPENAMP_LIB}-static ${_deps}) | ||
install (TARGETS ${_app}-static RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
else (${PROJECT_SYSTEM}) | ||
add_executable (${_app}.out ${_sources}) | ||
set_source_files_properties(${_sources} PROPERTIES COMPILE_FLAGS "${_cflags}") | ||
|
||
target_link_libraries(${_app}.out -Wl,-Map=${_app}.map -Wl,--gc-sections ${_linker_opt} -Wl,--start-group ${OPENAMP_LIB}-static ${_deps} -Wl,--end-group) | ||
|
||
install (TARGETS ${_app}.out RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
endif (${PROJECT_SYSTEM} STREQUAL "linux" ) | ||
endif (WITH_STATIC_LIB) | ||
endforeach(_app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
/* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
/* | ||
* This is a sample demonstration application that showcases usage of rpmsg | ||
* This application is meant to run on the remote CPU running baremetal code. | ||
* This application echoes back data that was sent to it by the host core. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <openamp/open_amp.h> | ||
#include <openamp/version.h> | ||
#include <metal/alloc.h> | ||
#include <metal/version.h> | ||
#include "platform_info.h" | ||
#include "rpmsg-echo.h" | ||
|
||
#define SHUTDOWN_MSG 0xEF56A55A | ||
|
||
#define LPRINTF(format, ...) printf(format, ##__VA_ARGS__) | ||
//#define LPRINTF(format, ...) | ||
#define LPERROR(format, ...) LPRINTF("ERROR: " format, ##__VA_ARGS__) | ||
|
||
static struct rpmsg_endpoint lept; | ||
static int shutdown_req = 0; | ||
|
||
/*-----------------------------------------------------------------------------* | ||
* RPMSG endpoint callbacks | ||
*-----------------------------------------------------------------------------*/ | ||
static int rpmsg_endpoint_cb(struct rpmsg_endpoint *ept, void *data, size_t len, | ||
uint32_t src, void *priv) | ||
{ | ||
(void)priv; | ||
(void)src; | ||
|
||
/* On reception of a shutdown we signal the application to terminate */ | ||
if ((*(unsigned int *)data) == SHUTDOWN_MSG) { | ||
LPRINTF("shutdown message is received.\r\n"); | ||
shutdown_req = 1; | ||
return RPMSG_SUCCESS; | ||
} | ||
|
||
/* Send data back to host */ | ||
if (rpmsg_send(ept, data, len) < 0) { | ||
LPERROR("rpmsg_send failed\r\n"); | ||
} | ||
return RPMSG_SUCCESS; | ||
} | ||
|
||
static void rpmsg_service_unbind(struct rpmsg_endpoint *ept) | ||
{ | ||
(void)ept; | ||
LPRINTF("unexpected Remote endpoint destroy\r\n"); | ||
shutdown_req = 1; | ||
} | ||
|
||
/*-----------------------------------------------------------------------------* | ||
* Application | ||
*-----------------------------------------------------------------------------*/ | ||
int app(struct rpmsg_device *rdev, void *priv) | ||
{ | ||
int ret; | ||
|
||
/* Initialize RPMSG framework */ | ||
LPRINTF("Try to create rpmsg endpoint.\r\n"); | ||
|
||
ret = rpmsg_create_ept(&lept, rdev, RPMSG_SERVICE_NAME, | ||
RPMSG_ADDR_ANY, RPMSG_ADDR_ANY, | ||
rpmsg_endpoint_cb, | ||
rpmsg_service_unbind); | ||
if (ret) { | ||
LPERROR("Failed to create endpoint.\r\n"); | ||
return -1; | ||
} | ||
|
||
LPRINTF("Successfully created rpmsg endpoint.\r\n"); | ||
while(1) { | ||
platform_poll(priv); | ||
/* we got a shutdown request, exit */ | ||
if (shutdown_req) { | ||
break; | ||
} | ||
} | ||
rpmsg_destroy_ept(&lept); | ||
|
||
return 0; | ||
} | ||
|
||
/*-----------------------------------------------------------------------------* | ||
* Application entry point | ||
*-----------------------------------------------------------------------------*/ | ||
int main(int argc, char *argv[]) | ||
{ | ||
void *platform; | ||
struct rpmsg_device *rpdev; | ||
int ret; | ||
|
||
LPRINTF("openamp lib version: %s (", openamp_version()); | ||
LPRINTF("Major: %d, ", openamp_version_major()); | ||
LPRINTF("Minor: %d, ", openamp_version_minor()); | ||
LPRINTF("Patch: %d)\r\n", openamp_version_patch()); | ||
|
||
LPRINTF("libmetal lib version: %s (", metal_ver()); | ||
LPRINTF("Major: %d, ", metal_ver_major()); | ||
LPRINTF("Minor: %d, ", metal_ver_minor()); | ||
LPRINTF("Patch: %d)\r\n", metal_ver_patch()); | ||
|
||
LPRINTF("Starting application...\r\n"); | ||
|
||
/* Initialize platform */ | ||
ret = platform_init(argc, argv, &platform); | ||
if (ret) { | ||
LPERROR("Failed to initialize platform.\r\n"); | ||
ret = -1; | ||
} else { | ||
rpdev = platform_create_rpmsg_vdev(platform, 0, | ||
VIRTIO_DEV_DEVICE, | ||
NULL, NULL); | ||
if (!rpdev) { | ||
LPERROR("Failed to create rpmsg virtio device.\r\n"); | ||
ret = -1; | ||
} else { | ||
app(rpdev, platform); | ||
platform_release_rpmsg_vdev(rpdev, platform); | ||
ret = 0; | ||
} | ||
} | ||
|
||
LPRINTF("Stopping application...\r\n"); | ||
platform_cleanup(platform); | ||
|
||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
#ifndef RPMSG_ECHO_H | ||
#define RPMSG_ECHO_H | ||
|
||
#define RPMSG_SERVICE_NAME "rpmsg-openamp-demo-channel" | ||
|
||
#endif /* RPMSG_ECHO_H */ |
Oops, something went wrong.