/* * main.c * * Created on: 03/08/2011 * Author: Marcos */ #include #include /* ---- XDC.RUNTIME module Headers */ #include #include #include /* ----- IPC module Headers */ #include #include #include #include #include /* ---- BIOS6 module Headers */ #include #include /* ---- Get globals from .cfg Header */ #include #include #define INTERRUPT_LINE 0 #define EVENTID 10 //CSL_IntgenRegs *pIntGenRegs = (CSL_IntgenRegs *)0x02880800; Void task1(UArg, UArg); Void cbFxn(UInt16, UInt16, UInt32, UArg, UInt32); Task_Handle tsk1; /* * ======== main ======== */ void main(void) { int status = -1; while(status<0){ status = Ipc_start(); } /* Create a task to handle notification between two cores*/ Task_Params taskParams; Task_Params_init(&taskParams); taskParams.priority = 1; tsk1 = Task_create (task1, NULL, NULL); BIOS_start(); } /* * ======== task1 ======== */ Void task1(UArg arg0, UArg arg1) { int status=-1; int thisCore; thisCore = MultiProc_self(); switch(thisCore) { case 0: { while(1){ while(status<0){ status = Ipc_attach(1); } status = Notify_sendEvent(1, 0, EVENTID, NULL, TRUE); Task_sleep(1); } } case 1: { while(1){ while(status<0){ status = Ipc_attach(0); } status = Notify_registerEvent(0, 0, 10, (Notify_FnNotifyCbck)cbFxn, NULL); if (status < 0) { System_abort("Notify_registerEvent failed\n"); } Task_sleep(1); } } } } /* * ======== cbFxn ======== (task to handle notifying interruption) */ Void cbFxn(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg, UInt32 payload) { int thisCore; thisCore = MultiProc_self(); System_printf("Running callback function [from core %d]\n", thisCore); }