コード例 #1
0
ファイル: echo_test.c プロジェクト: PetrLukas/open-amp
/* 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;
}
コード例 #2
0
ファイル: platform_info.c プロジェクト: oska874/open-amp
static struct remoteproc *
platform_create_proc(int proc_index, int rsc_index)
{
	void *rsc_table;
	int rsc_size;
	int ret;
	metal_phys_addr_t pa;

	(void) proc_index;
	rsc_table = get_resource_table(rsc_index, &rsc_size);

	/* Register IPI device */
	(void)metal_register_generic_device(&scugic_device);
	/* Initialize remoteproc instance */
	if (!remoteproc_init(&rproc_inst, &zynq_a9_proc_ops, &rproc_priv))
		return NULL;

	/*
	 * Mmap shared memories
	 * Or shall we constraint that they will be set as carved out
	 * in the resource table?
	 */
	/* mmap resource table */
	pa = (metal_phys_addr_t)rsc_table;
	(void *)remoteproc_mmap(&rproc_inst, &pa,
				NULL, rsc_size,
				NORM_NONCACHE | STRONG_ORDERED,
				&rproc_inst.rsc_io);
	/* mmap shared memory */
	pa = SHARED_MEM_PA;
	(void *)remoteproc_mmap(&rproc_inst, &pa,
				NULL, SHARED_MEM_SIZE,
				NORM_NONCACHE | STRONG_ORDERED,
				NULL);

	/* parse resource table to remoteproc */
	ret = remoteproc_set_rsc_table(&rproc_inst, rsc_table, rsc_size);
	if (ret) {
		xil_printf("Failed to intialize remoteproc\r\n");
		remoteproc_remove(&rproc_inst);
		return NULL;
	}
	xil_printf("Initialize remoteproc successfully.\r\n");

	return &rproc_inst;
}
コード例 #3
0
ファイル: platform_info.c プロジェクト: OpenAMP/open-amp
static struct remoteproc *
platform_create_proc(int proc_index, int rsc_index)
{
	void *rsc_table;
	int rsc_size;
	int ret;
	metal_phys_addr_t pa;

	(void)proc_index;
	(void)rsc_index;
	rsc_size = RSC_MEM_SIZE;

	/* Initialize remoteproc instance */
	if (!remoteproc_init(&rproc_inst, &zynqmp_linux_r5_proc_ops,
			     &rproc_priv))
		return NULL;
	printf("Successfully initialized remoteproc\r\n");

	/* Mmap resource table */
	pa = RSC_MEM_PA;
	printf("Calling mmap resource table.\r\n");
	rsc_table = remoteproc_mmap(&rproc_inst, &pa, NULL, rsc_size,
				    0, NULL);
	if (!rsc_table) {
		fprintf(stderr, "ERROR: Failed to mmap resource table.\r\n");
		return NULL;
	}
	printf("Successfully mmap resource table.\r\n");
	/* parse resource table to remoteproc */
	ret = remoteproc_set_rsc_table(&rproc_inst, rsc_table, rsc_size);
	if (ret) {
		printf("Failed to intialize remoteproc\r\n");
		remoteproc_remove(&rproc_inst);
		return NULL;
	}
	printf("Successfully set resource table to remoteproc.\r\n");

	return &rproc_inst;
}
コード例 #4
0
ファイル: matrix_multiply.c プロジェクト: PetrLukas/open-amp
/* 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;
}