index ac1622574568dfe25cf2aa3a580358068660d0b0..b6354832a01034f43bc2618969e2b7558fb17dd7 100755 (executable)
--- a/apps/rpc_demo/rpc_demo.c
+++ b/apps/rpc_demo/rpc_demo.c
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;
/* External functions */
extern void init_system();
extern void cleanup_system();
extern struct hil_proc *platform_create_proc(int proc_index);
+extern void *get_resource_table (int rsc_id, int *len);
#define REDEF_O_CREAT 100
#define REDEF_O_EXCL 200
#define RPC_CHANNEL_READY_TO_CLOSE "rpc_channel_ready_to_close"
+#define LPRINTF(format, ...)
+#define LPERROR(format, ...) LPRINTF("ERROR: " format, ##__VA_ARGS__)
+
/* Application entry point */
-int main()
+int app (struct hil_proc *hproc)
{
int fd, bytes_written, bytes_read;
char fname[] = "remote.file";
int idata;
int ret;
int status;
- struct hil_proc *hproc;
-
- /* Initialize HW system components */
- init_system();
-
- /* Resource table needs to be provided to remoteproc_resource_init() */
- 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, hproc,
chnl_is_alive = 0;
}
+int main(int argc, char *argv[])
+{
+ unsigned long proc_id = 0;
+ unsigned long rsc_id = 0;
+ struct hil_proc *hproc;
+
+ /* Initialize HW system components */
+ init_system();
+
+ if (argc >= 2) {
+ proc_id = strtoul(argv[1], NULL, 0);
+ }
+
+ if (argc >= 3) {
+ rsc_id = strtoul(argv[2], NULL, 0);
+ }
+
+ /* Create HIL proc */
+ hproc = platform_create_proc(proc_id);
+ if (!hproc) {
+ LPERROR("Failed to create hil proc.\n");
+ return -1;
+ }
+ rsc_info.rsc_tab = get_resource_table(
+ (int)rsc_id, &rsc_info.size);
+ if (!rsc_info.rsc_tab) {
+ LPRINTF("Failed to get resource table data.\n");
+ return -1;
+ }
+ return app(hproc);
+}
+