rpc_demo: print to proxy before it send shutdown
authorWendy Liang <jliang@xilinx.com>
Thu, 11 Aug 2016 18:47:37 +0000 (11:47 -0700)
committerWendy Liang <jliang@xilinx.com>
Thu, 13 Oct 2016 05:01:47 +0000 (22:01 -0700)
Print to the proxy before it sends the ready to shutdown
message to the remote.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
apps/rpc_demo/rpc_demo.c

index 289982e173e0e54f1c12aea48dd84fae7ecc11b8..d48be367b29628833734c7821782cea68101f429 100755 (executable)
@@ -159,21 +159,21 @@ int main()
                                printf
                                    ("\r\nRemote>RPC retargetting quitting ...\r\n");
                                sprintf(wbuff, RPC_CHANNEL_READY_TO_CLOSE);
-                               rpmsg_retarget_send(wbuff,
-                                                   sizeof
-                                                   (RPC_CHANNEL_READY_TO_CLOSE)
-                                                   + 1);
                                break;
                        }
                }
        }
        printf
            ("\r\nRemote> Firmware's rpmsg-openamp-demo-channel going down! \r\n");
+       rpmsg_retarget_send(wbuff,
+                           sizeof (RPC_CHANNEL_READY_TO_CLOSE) + 1);
 
-       while (app_rp_chnl) {
+       while (chnl_cb_flag)
                hil_poll(proc->proc, 0);
-       }
 
+       rpmsg_retarget_deinit(app_rp_chnl);
+       remoteproc_resource_deinit(proc);
+       cleanup_system();
        return 0;
 }
 
@@ -195,8 +195,6 @@ static void rpmsg_read_cb(struct rpmsg_channel *rp_chnl, void *data, int len,
 
 static void shutdown_cb(struct rpmsg_channel *rp_chnl)
 {
-       rpmsg_retarget_deinit(rp_chnl);
-       remoteproc_resource_deinit(proc);
-       cleanup_system();
+       chnl_cb_flag = 0;
 }