Update demo apps to use new HIL proc APIs
authorWendy Liang <jliang@xilinx.com>
Thu, 22 Sep 2016 06:36:59 +0000 (23:36 -0700)
committerWendy Liang <jliang@xilinx.com>
Fri, 14 Oct 2016 00:06:08 +0000 (17:06 -0700)
As the hil_proc init APIs has been changed, the applications OpenAMP
initialization needs to update to use the new APIs.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
apps/echo_test/echo_test.c
apps/echo_test/echo_testd.c
apps/func_test_suite/func_test_suite.c
apps/matrix_multiply/matrix_multiply.c
apps/matrix_multiply/matrix_multiplyd.c
apps/rpc_demo/rpc_demo.c
apps/rpc_demo/rpc_demod.c

index 44df1ee77ff6793b164218c54b3fad39ae1bf64f..cb01cee1fc15ca61f9ada7b3eaa40f313599e252 100644 (file)
@@ -9,7 +9,6 @@ This application echoes back data that was sent to it by the master core. */
 #include "openamp/open_amp.h"
 #include "metal/alloc.h"
 #include "rsc_table.h"
-#include "platform_info.h"
 
 #define SHUTDOWN_MSG   0xEF56A55A
 #define LPRINTF(format, ...) printf(format, ##__VA_ARGS__)
@@ -47,11 +46,11 @@ static struct _payload *i_payload;
 static int rnum = 0;
 static int err_cnt = 0;
 extern const struct remote_resource_table resources;
-extern struct rproc_info_plat_local proc_table;
 
 /* External functions */
 extern void init_system();
 extern void cleanup_system();
+extern struct hil_proc *platform_create_proc(int proc_index);
 
 /* Application entry point */
 int main()
@@ -61,6 +60,7 @@ int main()
        int i;
        int size;
        int expect_rnum = 0;
+       struct hil_proc *hproc;
 
        LPRINTF(" 1 - Send data to remote core, retrieve the echo");
        LPRINTF(" and validate its integrity ..\n");
@@ -79,15 +79,21 @@ int main()
                return -1;
        }
 
+       /* Create HIL proc */
+       hproc = platform_create_proc(0);
+       if (!hproc) {
+               LPERROR("Failed to create hil proc.\n");
+               return -1;
+       }
        /* Initialize RPMSG framework */
        status =
-           remoteproc_resource_init(&rsc_info, &proc_table,
+           remoteproc_resource_init(&rsc_info, hproc,
                                     rpmsg_channel_created,
                                     rpmsg_channel_deleted, rpmsg_read_cb,
                                     &proc, 1);
 
        if (status) {
-               LPERROR("Failed  to initialize remoteproc resource.\n");
+               LPERROR("Failed to initialize remoteproc resource.\n");
                return -1;
        }
 
index 99450fbbd2122d703399e214a84fa48070281713..1186162dd577ab9255c67b5abeaeecdfd1545768 100644 (file)
@@ -3,7 +3,6 @@ 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 master core. */
 
 #include "rsc_table.h"
-#include "platform_info.h"
 
 #define SHUTDOWN_MSG   0xEF56A55A
 
@@ -19,16 +18,17 @@ static struct remote_proc *proc = NULL;
 static struct rsc_table_info rsc_info;
 static int evt_chnl_deleted = 0;
 extern const struct remote_resource_table resources;
-extern struct rproc_info_plat_local proc_table;
 
 /* External functions */
 extern void init_system(void);
 extern void cleanup_system(void);
+extern struct hil_proc *platform_create_proc(int proc_index);
 
 /* Application entry point */
 int main(void)
 {
        int status = 0;
+       struct hil_proc *hproc;
 
        /* Initialize HW system components */
        init_system();
@@ -36,9 +36,14 @@ int main(void)
        rsc_info.rsc_tab = (struct resource_table *)&resources;
        rsc_info.size = sizeof(resources);
 
+       /* Create HIL proc */
+       hproc = platform_create_proc(0);
+       if (!hproc)
+               return -1;
+
        /* Initialize RPMSG framework */
        status =
-           remoteproc_resource_init(&rsc_info, &proc_table,
+           remoteproc_resource_init(&rsc_info, hproc,
                                     rpmsg_channel_created,
                                     rpmsg_channel_deleted, rpmsg_read_cb,
                                     &proc, 0);
index 945817df338c8ae8c919110674dc934c5adf5083..977aa880481ecf629157cdce8084e2bb349ea859 100644 (file)
@@ -8,7 +8,6 @@
 #include "openamp/open_amp.h"
 #include "rsc_table.h"
 #include "test_suite.h"
-#include "platform_info.h"
 
 #define EPT_ADDR        59
 
@@ -32,14 +31,15 @@ static char firmware_name[] = "baremetal-fn-test-suite-remote-firmware";
 static char r_buffer[512];
 static struct rsc_table_info rsc_info;
 extern const struct remote_resource_table resources;
-extern struct rproc_info_plat_local proc_table;
 
 /* External functions */
 extern void init_system();
 extern void cleanup_system();
+extern struct hil_proc *platform_create_proc(int proc_index);
 
 int main()
 {
+       struct hil_proc *proc;
        struct remote_proc *proc;
        int uninit = 0;
        struct ept_cmd_data *ept_data;
@@ -50,9 +50,14 @@ int main()
        rsc_info.rsc_tab = (struct resource_table *)&resources;
        rsc_info.size = sizeof(resources);
 
+       /* Create HIL proc */
+       hproc = platform_create_proc(0);
+       if (!hproc)
+               return -1;
+
        /* This API creates the virtio devices for this remote node and initializes
           other relevant resources defined in the resource table */
-       remoteproc_resource_init(&rsc_info, &proc_table,
+       remoteproc_resource_init(&rsc_info, hproc,
                                 rpmsg_channel_created,
                                 rpmsg_channel_deleted, rpmsg_read_default_cb,
                                 &proc, 0);
index f49fbbe7794a02fb56cb65460b24e83647c879d3..e1ecdec7afbc6dedf9f1a81a61b75c946b0cf79f 100644 (file)
@@ -10,7 +10,6 @@ multiplies them and returns the result to the master core. */
 #include <unistd.h>
 #include "openamp/open_amp.h"
 #include "rsc_table.h"
-#include "platform_info.h"
 
 #define        MAX_SIZE                6
 #define NUM_MATRIX              2
@@ -41,11 +40,11 @@ static struct rpmsg_endpoint *rp_ept;
 static struct remote_proc *proc = NULL;
 static struct rsc_table_info rsc_info;
 extern const struct remote_resource_table resources;
-extern struct rproc_info_plat_local proc_table;
 
 /* External functions */
 extern void init_system();
 extern void cleanup_system();
+extern struct hil_proc *platform_create_proc(int proc_index);
 
 int __attribute__((weak)) _gettimeofday(struct timeval *tv,
                                        void *tz)
@@ -120,6 +119,7 @@ int main()
        int shutdown_msg = SHUTDOWN_MSG;
        int c;
        int status = 0;
+       struct hil_proc *hproc;
 
        /* Initialize HW system components */
        init_system();
@@ -132,9 +132,15 @@ int main()
        LPRINTF("Send to the remote and get the computation result back.\n");
        LPRINTF("It will then check if the result is expected.\n");
 
+       /* Create HIL proc */
+       hproc = platform_create_proc(0);
+       if (!hproc) {
+               LPERROR("Failed to create hil proc.\n");
+               return -1;
+       }
        /* Initialize RPMSG framework */
        status =
-           remoteproc_resource_init(&rsc_info, &proc_table,
+           remoteproc_resource_init(&rsc_info, hproc,
                                     rpmsg_channel_created,
                                     rpmsg_channel_deleted, rpmsg_read_cb,
                                     &proc, 1);
index 47a22b37b23f50013760fd57737f688a7297b0cd..9d12bf98596bcd1760e2c466842089eeef06ac00 100644 (file)
@@ -8,7 +8,6 @@ multiplies them and returns the result to the master core. */
 #include <string.h>
 #include "openamp/open_amp.h"
 #include "rsc_table.h"
-#include "platform_info.h"
 
 #define        MAX_SIZE                6
 #define NUM_MATRIX              2
@@ -36,7 +35,7 @@ static struct rsc_table_info rsc_info;
 static int evt_chnl_deleted = 0;
 
 extern const struct remote_resource_table resources;
-extern struct rproc_info_plat_local proc_table;
+extern struct hil_proc *platform_create_proc(int proc_index);
 
 /* External functions */
 extern void init_system();
@@ -47,6 +46,7 @@ int main(void)
 {
 
        int status = 0;
+       struct hil_proc *hproc;
 
        /* Initialize HW system components */
        init_system();
@@ -54,9 +54,14 @@ int main(void)
        rsc_info.rsc_tab = (struct resource_table *)&resources;
        rsc_info.size = sizeof(resources);
 
+       /* Create HIL proc */
+       hproc = platform_create_proc(0);
+       if (!hproc)
+               return -1;
+
        /* Initialize RPMSG framework */
        status =
-           remoteproc_resource_init(&rsc_info, &proc_table,
+           remoteproc_resource_init(&rsc_info, hproc,
                                     rpmsg_channel_created,
                                     rpmsg_channel_deleted, rpmsg_read_cb,
                                     &proc, 0);
index 001c6606016f600803179437fc2c92866ba1af51..ac1622574568dfe25cf2aa3a580358068660d0b0 100755 (executable)
@@ -9,7 +9,6 @@
 #include <unistd.h>
 #include "openamp/open_amp.h"
 #include "rsc_table.h"
-#include "platform_info.h"
 #include "openamp/rpmsg_retarget.h"
 
 /* Internal functions */
@@ -25,11 +24,11 @@ static volatile int chnl_is_alive = 0;
 static struct remote_proc *proc = NULL;
 static struct rsc_table_info rsc_info;
 extern const struct remote_resource_table resources;
-extern struct rproc_info_plat_local proc_table;
 
 /* External functions */
 extern void init_system();
 extern void cleanup_system();
+extern struct hil_proc *platform_create_proc(int proc_index);
 
 #define REDEF_O_CREAT 100
 #define REDEF_O_EXCL 200
@@ -53,6 +52,7 @@ int main()
        int idata;
        int ret;
        int status;
+       struct hil_proc *hproc;
 
        /* Initialize HW system components */
        init_system();
@@ -61,8 +61,13 @@ int main()
        rsc_info.rsc_tab = (struct resource_table *)&resources;
        rsc_info.size = sizeof(resources);
 
+       /* Create HIL proc */
+       hproc = platform_create_proc(0);
+       if (!hproc)
+               return -1;
+
        /* Initialize RPMSG framework */
-       status = remoteproc_resource_init(&rsc_info, &proc_table,
+       status = remoteproc_resource_init(&rsc_info, hproc,
                                          rpmsg_channel_created,
                                          rpmsg_channel_deleted, rpmsg_read_cb,
                                          &proc, 0);
index 5ac44d7a072e602c1a27555e3bd767c319c9062f..eb44103304803bd5188f7b2e18188d42b32bc4ba 100755 (executable)
@@ -11,7 +11,6 @@
 #include "openamp/rpmsg_retarget.h"
 #include "metal/alloc.h"
 #include "rsc_table.h"
-#include "platform_info.h"
 
 #define PROXY_ENDPOINT                 127
 
@@ -55,11 +54,11 @@ static struct _proxy_data *proxy;
 static int err_cnt = 0;
 
 extern const struct remote_resource_table resources;
-extern struct rproc_info_plat_local proc_table;
 
 /* External functions */
 extern void init_system();
 extern void cleanup_system();
+extern struct hil_proc *platform_create_proc(int proc_index);
 
 #define REDEF_O_CREAT 100
 #define REDEF_O_EXCL 200
@@ -257,6 +256,7 @@ int main()
        int ret = 0;
        struct sigaction exit_action;
        struct sigaction kill_action;
+       struct hil_proc *hproc;
 
        /* Initialize HW system components */
        init_system();
@@ -291,9 +291,16 @@ int main()
        rsc_info.rsc_tab = (struct resource_table *)&resources;
        rsc_info.size = sizeof(resources);
 
+       /* Create HIL proc */
+       hproc = platform_create_proc(0);
+       if (!hproc) {
+               LPERROR("Failed to create hil proc.\n");
+               return -1;
+       }
+
        /* Initialize RPMSG framework */
        status =
-           remoteproc_resource_init(&rsc_info, &proc_table,
+           remoteproc_resource_init(&rsc_info, hproc,
                                     rpmsg_channel_created,
                                     rpmsg_channel_deleted, rpmsg_read_cb,
                                     &proc, 1);