#include "overlay.h" #include "risc_dsp_caller.h" #include "mcom_runtime/uart.h" #include "overlay.inc" #include #include extern int dspu0__prog0; // program for DSP0 extern int dspu1__prog1; // program for DSP1 int core0_task() { int dsp_ret = 0; char buffer[128]; struct dsp_task_info pTask0, pTask1; // tasks declaration // setup synchronus mode risc_dsp_set_mode(DSP_TASK_SYNC); // prepare program for core 0 config_overlay(0,0); enum ERL_ERROR err_init0 = risc_dsp_init_task(&pTask0, (unsigned int)(&dspu0__prog0)); enum ERL_ERROR err_load0 = risc_dsp_load_task(&pTask0); // prepare program for core 1 config_overlay(1,0); enum ERL_ERROR err_init1 = risc_dsp_init_task(&pTask1, (unsigned int)(&dspu1__prog1)); enum ERL_ERROR err_load1 = risc_dsp_load_task(&pTask1); // start tasks execution enum ERL_ERROR err_run = risc_dsp_run_tasks(&pTask0, &pTask1); // wait tasks execution enum ERL_ERROR err_wait0 = risc_dsp_wait_task(&pTask0); enum ERL_ERROR err_wait1 = risc_dsp_wait_task(&pTask1); // receive value from dsp // see "calling convention" in clang documentation dsp_ret = pTask0.dsp_regs->R0L*pTask1.dsp_regs->R0L; sprintf(buffer, "DSP0*DSP1 return value - %d, expected value - %d \r\n\r\n", dsp_ret, 15*120); uart_puts(0, buffer); return dsp_ret; }