index 44df1ee77ff6793b164218c54b3fad39ae1bf64f..c947194362fee463013b0bdd6684481c211f2e0a 100644 (file)
#include "openamp/open_amp.h"
#include "metal/alloc.h"
#include "rsc_table.h"
#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__)
#define SHUTDOWN_MSG 0xEF56A55A
#define LPRINTF(format, ...) printf(format, ##__VA_ARGS__)
struct _payload {
unsigned long num;
unsigned long size;
struct _payload {
unsigned long num;
unsigned long size;
- char data[];
+ unsigned char data[];
};
static int err_cnt;
};
static int err_cnt;
static struct _payload *i_payload;
static int rnum = 0;
static int err_cnt = 0;
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();
/* 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);
/* Application entry point */
/* Application entry point */
-int main()
+int app (struct hil_proc *hproc)
{
int status = 0;
int shutdown_msg = SHUTDOWN_MSG;
{
int status = 0;
int shutdown_msg = SHUTDOWN_MSG;
LPRINTF(" 1 - Send data to remote core, retrieve the echo");
LPRINTF(" and validate its integrity ..\n");
LPRINTF(" 1 - Send data to remote core, retrieve the echo");
LPRINTF(" and validate its integrity ..\n");
- /* Initialize HW system components */
- init_system();
-
- rsc_info.rsc_tab = (struct resource_table *)&resources;
- rsc_info.size = sizeof(resources);
i_payload =
(struct _payload *)metal_allocate_memory(2 * sizeof(unsigned long) +
i_payload =
(struct _payload *)metal_allocate_memory(2 * sizeof(unsigned long) +
/* Initialize RPMSG framework */
status =
/* 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) {
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;
}
return -1;
}
/* Validate data buffer integrity. */
for (i = 0; i < (int)r_payload->size; i++) {
if (r_payload->data[i] != 0xA5) {
/* Validate data buffer integrity. */
for (i = 0; i < (int)r_payload->size; i++) {
if (r_payload->data[i] != 0xA5) {
- LPRINTF("Data corruption at index %d \n", i);
+ LPRINTF("Data corruption at index %d\n", i);
err_cnt++;
break;
}
err_cnt++;
break;
}
rnum = r_payload->num + 1;
}
rnum = r_payload->num + 1;
}
+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);
+}
+