/* Application entry point */ int main() { int status = 0; #ifdef ZYNQ7_BAREMETAL SWITCH_TO_SYS_MODE(); #endif /* Initialize HW system components */ init_system(); rsc_info.rsc_tab = (struct resource_table *)&resources; rsc_info.size = sizeof(resources); /* Initialize RPMSG framework */ status = remoteproc_resource_init(&rsc_info, rpmsg_channel_created, rpmsg_channel_deleted, rpmsg_read_cb, &proc); if (status < 0) { return -1; } while (1) { __asm__("wfi\n\t"); } return 0; }
/* Application entry point */ int main() { int status; struct remote_proc *proc; int shutdown_msg = SHUTDOWN_MSG; int i; /* Switch to System Mode */ SWITCH_TO_SYS_MODE(); /* Initialize HW system components */ init_system(); status = remoteproc_init((void *) fw_name, rpmsg_channel_created, rpmsg_channel_deleted, rpmsg_read_cb, &proc); if(!status) { status = remoteproc_boot(proc); } if(status) { return -1; } while (1) { if(shutdown_called == 1) { break; } sleep(); } /* Send shutdown message to remote */ rpmsg_send(app_rp_chnl, &shutdown_msg, sizeof(int)); for (i = 0; i < 100000; i++) { sleep(); } remoteproc_shutdown(proc); remoteproc_deinit(proc); return 0; }
/* Application entry point */ int main() { int status; struct remote_proc *proc; int i; int shutdown_msg = SHUTDOWN_MSG; /* Switch to System Mode */ SWITCH_TO_SYS_MODE(); /* Initialize HW system components */ init_system(); status = remoteproc_init((void *) fw_name, rpmsg_channel_created, rpmsg_channel_deleted, rpmsg_read_cb, &proc); if(!status) { status = remoteproc_boot(proc); } if(status) { return -1; } while (1) { if (int_flag) { if(shutdown_called == 1) { break; } /* Process received data and multiple matrices. */ Matrix_Multiply(&matrix_array[0], &matrix_array[1], &matrix_result); /* Send the result of matrix multiplication back to master. */ rpmsg_send(app_rp_chnl, &matrix_result, sizeof(matrix)); int_flag = 0; sleep(); } sleep(); } /* Send shutdown message to remote */ rpmsg_send(app_rp_chnl, &shutdown_msg, sizeof(int)); for (i = 0; i < 100000; i++) { sleep(); } remoteproc_shutdown(proc); remoteproc_deinit(proc); return 0; }
int main() { struct remote_proc *proc; int uninit = 0; struct ept_cmd_data *ept_data; #ifdef ZYNQ7_BAREMETAL /* Switch to System Mode */ SWITCH_TO_SYS_MODE(); #endif /* Initialize HW system components */ init_system(); rsc_info.rsc_tab = (struct resource_table *)&resources; rsc_info.size = sizeof(resources); /* 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, rpmsg_channel_created, rpmsg_channel_deleted, rpmsg_read_default_cb, &proc); for (;;) { if (intr_flag) { struct command *cmd = (struct command *)r_buffer; if (cmd->comm_start == CMD_START) { unsigned int cm_code = cmd->comm_code; void *data = cmd->data; switch (cm_code) { case CREATE_EPT: ept_data = (struct ept_cmd_data *)data; rp_ept = rpmsg_create_ept(app_rp_chnl, rpmsg_read_ept_cb, RPMSG_NULL, ept_data->dst); if (rp_ept) { /* Send data back to ack. */ rpmsg_sendto(app_rp_chnl, r_buffer, Len, Src); } break; case DELETE_EPT: rpmsg_destroy_ept(rp_ept); rpmsg_sendto(app_rp_chnl, r_buffer, Len, Src); break; case CREATE_CHNL: break; case DELETE_CHNL: rpmsg_sendto(app_rp_chnl, r_buffer, Len, Src); remoteproc_resource_deinit(proc); uninit = 1; break; case QUERY_FW_NAME: rpmsg_send(app_rp_chnl, &firmware_name[0], strlen(firmware_name) + 1); break; default: rpmsg_sendto(app_rp_chnl, r_buffer, Len, Src); break; } } else { rpmsg_sendto(app_rp_chnl, r_buffer, Len, Src); } intr_flag = 0; if (uninit) break; } sleep(); } return 0; }