#define SOC_OMAPL138 #include #include #include #include #include #include #include #include #include #include #include void _mfence() {} // @todo apparently not defined on the C674x... char buf[250]; volatile Bool has_msg = FALSE; void setupUart() { const uint32_t UART_INST = 2; UART_HwAttrs uart_cfg; UART_Params uart_params; UART_init(); UART_socGetInitCfg(UART_INST, &uart_cfg); uart_cfg.edmaHandle = NULL; uart_cfg.dmaMode = FALSE; uart_cfg.loopback = FALSE; UART_socSetInitCfg(UART_INST, &uart_cfg); UART_Params_init(&uart_params); uart_params.baudRate = 3000000ul; uart_params.dataLength = UART_LEN_8; uart_params.parityType = UART_PAR_NONE; uart_params.stopBits = UART_STOP_ONE; UART_stdioInit2(UART_INST, &uart_params); } void taskFxn(UArg a0, UArg a1) { UART_printf("DSP SIDE TASK STARTS SUCCESSFULLY\n"); System_printf("DSP SIDE TASK STARTS SUCCESSFULLY\n"); System_flush(); while(1) { if (has_msg) { System_printf("%s", buf); System_flush(); UART_printf("%s", buf); has_msg = FALSE; } } } void notify_callback(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg, UInt32 payload) { if (!has_msg) { sprintf(buf, "Got notify event with payload: %u\n", payload); has_msg = TRUE; } } int main() { Task_Handle task; Error_Block eb; Board_initCfg boardCfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_MODULE_CLOCK; Board_STATUS boardStatus = Board_init(boardCfg); if (boardStatus != BOARD_SOK) { System_printf("ERROR INITIALIZING BOARD!\n"); System_flush(); while (1); } setupUart(); System_printf("enter main()\n"); UART_printf("Starting DSP side...\n"); int status = Ipc_start(); if (status != Ipc_S_SUCCESS) { UART_printf("Failed IPC setup: %i.\n", status); System_printf("Failed IPC setup: %i.\n", status); System_flush(); } //* Uint16 master_id = MultiProc_getId("HOST"); do { status = Ipc_attach(master_id); } while (status < 0); if (status != Ipc_S_SUCCESS) { System_printf("Failed IPC attach: %i.\n", status); System_flush(); } //*/ /* UART_printf("Registering notify event...\n"); status = Notify_registerEvent(MultiProc_getId("HOST"), 0, 10, notify_callback, 0); if (status < 0) { UART_printf("Notify_registerEvent failed: %i\n", status); System_printf("Notify_registerEvent failed: %i\n", status); System_flush(); } //*/ Error_init(&eb); task = Task_create(taskFxn, NULL, &eb); if (task == NULL) { System_printf("Task_create() failed!\n"); BIOS_exit(0); } BIOS_start(); return(0); }