/* * ======== main ======== */ Int main(Int argc, Char* argv[]) { Int status; Task_Params taskParams; /* initialize ipc layer */ do { status = Ipc_start(); } while (status < 0); /* create main thread (interrupts not enabled in main on BIOS) */ Task_Params_init(&taskParams); taskParams.instance->name = "smain"; taskParams.arg0 = (UArg)argc; taskParams.arg1 = (UArg)argv; taskParams.stackSize = 0x4000; Task_create(smain, &taskParams, NULL); /* start scheduler, this never returns */ BIOS_start(); /* should never get here */ return(0); }
/* * ======== main ======== */ Void main(Int argc, Char *argv[]) { Int status; do { /* init IPC */ status = Ipc_start(); } while (status < 0); /* init Codec Engine */ CERuntime_init(); Log_print0(Diags_USER4, "[+4] main> Welcome to DSP server's main()."); /* Configure and register BUFRES resource with RMAN */ config.iresConfig.size = sizeof(BUFRES_Params); config.iresConfig.allocFxn = DSKT2_allocPersistent; config.iresConfig.freeFxn = DSKT2_freePersistent; config.base = Memory_alloc(BUFSIZE, NULL); config.length = BUFSIZE; RMAN_register(&BUFRES_MGRFXNS, (IRESMAN_Params *)&config); BIOS_start(); }
/* * ======== main ======== * Synchronizes all processors (in Ipc_start) and calls BIOS_start */ Int main(Int argc, Char* argv[]) { Int status; nextProcId = (MultiProc_self() + 1) % MultiProc_getNumProcessors(); System_printf("main: MultiProc id = %d\n", MultiProc_self()); System_printf("main: MultiProc name = %s\n", MultiProc_getName(MultiProc_self())); /* Generate queue names based on own proc ID and total number of procs */ System_sprintf(localQueueName, "%s", MultiProc_getName(MultiProc_self())); System_sprintf(nextQueueName, "%s", MultiProc_getName(nextProcId)); /* * Ipc_start() calls Ipc_attach() to synchronize all remote processors * because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg */ status = Ipc_start(); if (status < 0) { System_abort("Ipc_start failed\n"); } BIOS_start(); return (0); }
/* * ======== main ======== * Synchronizes all processors. * Creates a HeapBufMP and registers it with MessageQ. */ Int main(Int argc, Char* argv[]) { Int status; HeapBufMP_Handle heapHandle; HeapBufMP_Params heapBufParams; /* * Ipc_start() calls Ipc_attach() to synchronize all remote processors * because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg */ status = Ipc_start(); if (status < 0) { System_abort("Ipc_start failed\n"); } /* * Create the heap that will be used to allocate messages. */ HeapBufMP_Params_init(&heapBufParams); heapBufParams.regionId = 0; heapBufParams.name = HEAP_NAME; heapBufParams.align = HEAP_ALIGN; heapBufParams.numBlocks = HEAP_NUMMSGS; heapBufParams.blockSize = HEAP_MSGSIZE; heapHandle = HeapBufMP_create(&heapBufParams); if (heapHandle == NULL) { System_abort("HeapBufMP_create failed\n" ); } /* Register this heap with MessageQ */ MessageQ_registerHeap((IHeap_Handle)heapHandle, HEAPID); BIOS_start(); return (0); }
Int main(Int argc, Char* argv[]) { Error_Block eb; Task_Params taskParams; Log_print3(Diags_ENTRY, "--> %s: (argc: %d, argv: 0x%x)", (IArg)FXNN, (IArg)argc, (IArg)argv); /* must initialize the error block before using it */ Error_init(&eb); /* initialize ipc layer */ Ipc_start(); /* create main thread (interrupts not enabled in main on BIOS) */ Task_Params_init(&taskParams); taskParams.instance->name = "AppMain_main__P"; taskParams.arg0 = (UArg)argc; taskParams.arg1 = (UArg)argv; taskParams.stackSize = 0x4000; Task_create(AppMain_main__P, &taskParams, &eb); if (Error_check(&eb)) { System_abort("main() failed to create application startup thread"); } /* start scheduler, this never returns */ BIOS_start(); /* should never get here */ Log_print1(Diags_EXIT, "<-- %s: should never get here", (IArg)FXNN); return(0); }
int main (int argc, char ** argv) { Int status = 0; UInt numLoops = NUM_LOOPS_DFLT; UInt16 procId = PROC_ID_DFLT; /* Parse Args: */ switch (argc) { case 1: /* use defaults */ break; case 2: numLoops = atoi(argv[1]); break; case 3: numLoops = atoi(argv[1]); procId = atoi(argv[2]); break; default: printf("Usage: %s [<numLoops>] [<ProcId>]\n", argv[0]); printf("\tDefaults: numLoops: %d; ProcId: %d\n", NUM_LOOPS_DFLT, PROC_ID_DFLT); exit(0); } /* configure the transport factory */ Ipc_transportConfig(&TransportRpmsg_Factory); /* IPC initialization */ status = Ipc_start(); if (status < 0) { printf("Error: Ipc_start failed, error=%d\n", status); goto exit; } if ((procId == 0) || (procId >= MultiProc_getNumProcessors())) { printf("ProcId (%d) must be nonzero and less than %d\n", procId, MultiProc_getNumProcessors()); Ipc_stop(); exit(0); } printf("Using numLoops: %d; procId : %d\n", numLoops, procId); if (status >= 0) { MessageQApp_execute(numLoops, procId); Ipc_stop(); } else { printf("Ipc_start failed: status = %d\n", status); } exit: return (status); }
/* * ======== IpcMgr_callIpcStart ======== * Initialize standard IPC module, which may use the RPMSG protocol as well. * * Calls the Ipc_start command. This must be done after IpcMgr_ipcStartup(). * * Use for stacks using a combination of TransportRpmsg and other Transports. */ Void IpcMgr_callIpcStart() { Int status; /* * Ipc_start() calls Ipc_attach() to synchronize all remote processors * if 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg * HOST is skipped, thanks to overriding NotifySetup_numIntLines(). */ status = Ipc_start(); Assert_isTrue(status >= 0, NULL); }
int main (void) { Log_print0 (Diags_USER1,"DSP: in main"); Ipc_start (); Log_print0 (Diags_USER1,"DSP: IPC Start Successful"); BIOS_start (); Log_print0 (Diags_USER1,"DSP: BIOS Start Successful"); return (0); } /* main */
Int SystemCfg_start(SystemCfg_Handle handle, String filePath) { Int status; /* initialize ipc layer */ status = Ipc_start(); if (status < 0) { Log_error1(FXNN": Ipc_start() error %d", (IArg)status); } return(status); }
/* * ======== main ======== */ Void main() { Int status = Ipc_S_SUCCESS; Log_print0(Diags_USER1, "stairstep example started."); /* Call Ipc_start() */ do { status = Ipc_start(); } while (status != Ipc_S_SUCCESS); BIOS_start(); return; }
int main (int argc, char * argv[]) { Int32 status = 0; UInt32 numLoops = NUM_LOOPS_DFLT; UInt32 payloadSize = MINPAYLOADSIZE; UInt16 procId = PROC_ID_DFLT; /* Parse args: */ if (argc > 1) { numLoops = strtoul(argv[1], NULL, 0); } if (argc > 2) { payloadSize = MAX(strtoul(argv[2], NULL, 0), MINPAYLOADSIZE); } if (argc > 3) { procId = atoi(argv[3]); } if (argc > 4) { printf("Usage: %s [<numLoops>] [<payloadSize>] [<ProcId>]\n", argv[0]); printf("\tDefaults: numLoops: %d; payloadSize: %d, ProcId: %d\n", NUM_LOOPS_DFLT, MINPAYLOADSIZE, PROC_ID_DFLT); exit(0); } status = Ipc_start(); if (procId >= MultiProc_getNumProcessors()) { printf("ProcId must be less than %d\n", MultiProc_getNumProcessors()); Ipc_stop(); exit(0); } printf("Using numLoops: %d; payloadSize: %d, procId : %d\n", numLoops, payloadSize, procId); if (status >= 0) { MessageQApp_execute(numLoops, payloadSize, procId); Ipc_stop(); } else { printf("Ipc_start failed: status = %d\n", status); } return (status); }
/* * ======== main ======== * Synchronizes all processors. */ Int main(Int argc, Char* argv[]) { Int status; /* * Ipc_start() calls Ipc_attach() to synchronize all remote processors * because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg */ status = Ipc_start(); if (status < 0) { System_abort("Ipc_start failed\n"); } BIOS_start(); return (0); }
/* * ======== main ======== */ Int main(Int argc, Char* argv[]) { Int status; printf("--> main:\n"); /* parse command line */ status = Main_parseArgs(argc, argv); if (status < 0) { goto leave; } status = CMEM_init(); if (status < 0) { printf("CMEM_init failed\n"); goto leave; } else { printf("CMEM_init success\n"); } /* configure the transport factory */ Ipc_transportConfig(&TransportRpmsg_Factory); /* IPC initialization */ status = Ipc_start(); if (status >= 0) { /* application create, exec, delete */ status = Main_main(); /* Ipc finalization */ Ipc_stop(); } else { printf("Ipc_start failed: status = %d\n", status); goto leave; } leave: printf("<-- main:\n"); status = (status >= 0 ? 0 : status); return (status); }
int main (int argc, char ** argv) { Int32 status = 0; UInt32 numLoops = NUM_LOOPS_DFLT; UInt16 procId = PROC_ID_DFLT; /* Parse Args: */ switch (argc) { case 1: /* use defaults */ break; case 2: numLoops = atoi(argv[1]); break; case 3: numLoops = atoi(argv[1]); procId = atoi(argv[2]); break; default: printf("Usage: %s [<numLoops>] [<ProcId>]\n", argv[0]); printf("\tDefaults: numLoops: %d; ProcId: %d\n", NUM_LOOPS_DFLT, PROC_ID_DFLT); exit(0); } status = Ipc_start(); if (procId >= MultiProc_getNumProcessors()) { printf("ProcId must be less than %d\n", MultiProc_getNumProcessors()); Ipc_stop(); exit(0); } printf("Using numLoops: %d; procId : %d\n", numLoops, procId); if (status >= 0) { MessageQApp_execute(numLoops, procId); Ipc_stop(); } else { printf("Ipc_start failed: status = %d\n", status); } return(0); }
/* * ======== main ======== */ Void main() { Int status; struct HeapBufMP_Params heapBufMPParams; HeapBufMP_Handle heapHandle; System_printf("Enter main()\n"); System_flush(); /* Call Ipc_start() */ status = Ipc_start(); if (status < 0) { System_abort("Ipc_start failed\n"); } #ifdef DSP_ACTIVE /* Attach to DSP */ while (Ipc_attach(1) < 0) { Task_sleep(1000); }; #endif #if 1 /* Create the heap that will be used to allocate messages. */ HeapBufMP_Params_init(&heapBufMPParams); heapBufMPParams.regionId = 0; /* use default region */ heapBufMPParams.name = "shareHeap"; heapBufMPParams.align = 4; heapBufMPParams.numBlocks = 40; heapBufMPParams.blockSize = 256; heapBufMPParams.gate = NULL; /* use system gate */ heapHandle = HeapBufMP_create(&heapBufMPParams); if (heapHandle == NULL) { System_abort("HeapBufMP_create failed\n"); while(1); } /* Register this heap with MessageQ */ if(MessageQ_registerHeap(heapHandle, 0) != MessageQ_S_SUCCESS) while(1); #endif BIOS_start(); /* enable interrupts and start SYS/BIOS */ }
/* * ======== IPC_threadGeneratedReset ======== */ Void IPC_threadGeneratedReset() { Int status; UInt16 masterId; masterId = MultiProc_getId("HOST"); do { status = Ipc_detach(masterId); } while (status < 0); do { status = Ipc_stop(); } while (status < 0); do { status = Ipc_start(); } while (status < 0); }
//--------------------------------------------------------------------- // Main Entry Point //--------------------------------------------------------------------- int main() { #ifndef _PCIE_VUART_DISABLED_ //virtual uart serial_init(); #endif logout("\n\n==== DSPREG PCIe EDITION ====\n"); logout("You're listening on core 0.\n"); /* * Ipc_start() calls Ipc_attach() to synchronize all remote processors * because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg */ Ipc_start(); /* Start the BIOS 6 Scheduler */ BIOS_start (); return 0; }
/* * ======== main ======== * Synchronizes all processors (in Ipc_start), calls BIOS_start, and registers * for an incoming event */ Int main(Int argc, Char* argv[]) { Int status; UInt numProcs = MultiProc_getNumProcessors(); /* * Determine which processors Notify will communicate with based on the * local MultiProc id. Also, create a processor-specific Task. */ srcProc = ((MultiProc_self() - 1 + numProcs) % numProcs); dstProc = ((MultiProc_self() + 1) % numProcs); System_printf("main: MultiProc id = %d\n", MultiProc_self()); System_printf("main: MultiProc name = %s\n", MultiProc_getName(MultiProc_self())); /* * Ipc_start() calls Ipc_attach() to synchronize all remote processors * because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg */ status = Ipc_start(); if (status < 0) { System_abort("Ipc_start failed\n"); } /* * Register call back with Notify. It will be called when the processor * with id = srcProc sends event number EVENTID to this processor. */ status = Notify_registerEvent(srcProc, INTERRUPT_LINE, EVENTID, (Notify_FnNotifyCbck)cbFxn, NULL); if (status < 0) { System_abort("Notify_registerEvent failed\n"); } BIOS_start(); return (0); }
void platform_init() { Int status = 0; UInt16 hostId = 0, sysProcId = 0; /* clear HSDIVDER_CLKOUT2_DIV */ set_ivahd_opp(0); /* Set up interprocessor notifications */ DEBUG("Setting up IPC"); status = Ipc_start(); if (status < 0) { ERROR("Ipc_start failed: %08x", status); return; } /* attach to host */ hostId = MultiProc_getId("MPU"); DEBUG("APPM3: IPC attaching to MPU, hostId = %d", hostId); do { status = Ipc_attach(hostId); DEBUG("APPM3: IPC attaching... %08x", status); } while (status < 0); /* attach to other M3.. do we need this? */ sysProcId = MultiProc_getId("SysM3"); DEBUG("APPM3: IPC attaching to SysM3, sysProcId = %d", sysProcId); do { status = Ipc_attach(sysProcId); DEBUG("APPM3: IPC attaching... %08x", status); } while (status < 0); /* maybe above stuff should move into dce_init().. */ dce_init(); DEBUG("APPM3: Completed IPC setup and Server Bringup"); return; }
/* * ======== main ======== */ Int main(Int argc, Char* argv[]) { Int status; armProcId = MultiProc_getId("HOST"); System_printf("main: MultiProc id = %d\n", MultiProc_self()); /* * Ipc_start() calls Ipc_attach() to synchronize all remote processors * because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg */ status = Ipc_start(); if (status < 0) { System_abort("Ipc_start failed\n"); } /* * Register cbFxn with Notify. It will be called when Arm * sends event number EVENTID to instance. * Passing in 0xFEED as the arg just for validation. */ status = Notify_registerEvent(armProcId, LINE_0, EVENTID, (Notify_FnNotifyCbck)cbFxnLine0, 0xFEED); if (status < 0) { System_abort("Notify_registerEvent failed\n"); } status = Notify_registerEvent(armProcId, LINE_1, EVENTID, (Notify_FnNotifyCbck)cbFxnLine1, 0xBEEF); if (status < 0) { System_abort("Notify_registerEvent failed\n"); } BIOS_start(); return (0); }
/* * ======== main ======== */ Int main(Int argc, Char* argv[]) { /* Set up interprocessor notifications */ Ipc_start(); BIOS_start(); return (0); }
/* * ======== main ======== */ int main(int argc, char **argv) { int status; int32_t ret; UInt16 procId = PROC_ID_DFLT; printf("mmrpc_test: --> main\n"); /* Parse Args: */ switch (argc) { case 1: /* use defaults */ break; case 2: procId = atoi(argv[1]); break; default: printf("Usage: %s [<ProcId>]\n", argv[0]); printf("\tDefaults: ProcId: %d\n", PROC_ID_DFLT); exit(0); } #if defined(IPC_BUILDOS_QNX) /* Need to start IPC for MultiProc */ status = Ipc_start(); if (status < 0) { printf("Ipc_start failed: status = %d\n", status); return (0); } #endif /* initialize Mx module (setup rpc connection) */ status = Mx_initialize(procId); if (status < 0) { goto leave; } /* invoke Mx functions */ ret = Mx_triple(11); printf("mmrpc_test: Mx_triple(11), ret=%d\n", ret); if (ret < 0) { status = -1; goto leave; } ret = Mx_triple(111); printf("mmrpc_test: Mx_triple(111), ret=%d\n", ret); if (ret < 0) { status = -1; goto leave; } ret = Mx_add(44, 66); printf("mmrpc_test: Mx_add(44, 66), ret=%d\n", ret); if (ret < 0) { status = -1; goto leave; } #if defined(IPC_BUILDOS_QNX) ret = callCompute_QnX(); #else ret = callCompute_Linux(); #endif if (ret < 0) { status = -1; } leave: /* finalize Mx module (destroy rpc connection) */ Mx_finalize(); #if defined(IPC_BUILDOS_QNX) Ipc_stop(); #endif if (status < 0) { printf("mmrpc_test: FAILED\n"); } else { printf("mmrpc_test: PASSED\n"); } return(0); }
int main (int argc, char ** argv) { Int status = 0; int opt; UInt numLoops = NUM_LOOPS_DFLT; UInt16 procId = PROC_ID_DFLT; UInt32 faultId = 0; while ((opt = getopt(argc, argv, "f:")) != -1) { switch (opt) { case 'f': /* * Argument for -f corresponds to remote-side "fault" commands. * Negative commands cause remote fault before remote MessageQ_put. * Positive commands cause remote fault after remote MessageQ_put. */ faultId = atoi(optarg); printf("fault %d will be sent in 1st msg\n", faultId); break; default: fprintf(stderr, "Unknown arg '%s'\n", optarg); return 1; } } /* Parse Args: */ switch (argc - optind + 1) { case 1: /* use defaults */ break; case 2: numLoops = atoi(argv[optind]); break; case 3: numLoops = atoi(argv[optind]); procId = atoi(argv[optind + 1]); break; default: printf("Usage: %s [<numLoops>] [<ProcId>]\n", argv[0]); printf("\tDefaults: numLoops: %d; ProcId: %d\n", NUM_LOOPS_DFLT, PROC_ID_DFLT); exit(0); } /* configure the transport factory */ Ipc_transportConfig(&TransportRpmsg_Factory); /* IPC initialization */ status = Ipc_start(); if (status < 0) { printf("Error: Ipc_start failed, error=%d\n", status); goto exit; } if ((procId == 0) || (procId >= (MultiProc_getBaseIdOfCluster() + MultiProc_getNumProcessors()))) { printf("ProcId (%d) must be nonzero and less than %d\n", procId, MultiProc_getBaseIdOfCluster() + MultiProc_getNumProcessors()); Ipc_stop(); exit(0); } printf("Using numLoops: %d; procId : %d\n", numLoops, procId); if (MessageQApp_execute(numLoops, procId, faultId) < 0) { int nAttachAttempts = 1; printf("MessageQApp_execute failed, attempting detach/attach...\n"); Ipc_detach(procId); while (Ipc_attach(procId) != Ipc_S_SUCCESS) { nAttachAttempts++; if ((nAttachAttempts % 1000) == 0) { printf("Ipc_attach(%d) failed\n", procId); } } printf("Ipc_attach(%d) succeeded (after %d tries)\n", procId, nAttachAttempts); /* call without fault this time */ MessageQApp_execute(numLoops, procId, 0); } Ipc_stop(); exit: return (status); }
int main (int argc, char ** argv) { struct thread_info threads[MAX_NUM_THREADS]; int ret,i; Int32 status = 0; /* Parse Args: */ numLoops = NUM_LOOPS_DFLT; numThreads = NUM_THREADS_DFLT; procNum = ONE_PROCESS_ONLY; switch (argc) { case 1: /* use defaults */ break; case 2: numThreads = atoi(argv[1]); break; case 3: numThreads = atoi(argv[1]); numLoops = atoi(argv[2]); break; case 4: /* We force numThreads = 1 if doing a multiProcess test: */ numThreads = 1; numLoops = atoi(argv[2]); procNum = atoi(argv[3]); break; default: printf("Usage: %s [<numThreads>] [<numLoops>] [<Process #]>\n", argv[0]); printf("\tDefaults: numThreads: %d, numLoops: %d\n", NUM_THREADS_DFLT, NUM_LOOPS_DFLT); printf("\tMax Threads: %d\n", MAX_NUM_THREADS); exit(0); } if (numThreads > MAX_NUM_THREADS) { printf("Error: Maximum number of threads supported is %d\n", MAX_NUM_THREADS); exit(EXIT_FAILURE); } printf("Using numThreads: %d, numLoops: %d\n", numThreads, numLoops); if (procNum != ONE_PROCESS_ONLY) { printf("ProcNum: %d\n", procNum); } /* configure the transport factory */ Ipc_transportConfig(&TransportRpmsg_Factory); /* IPC initialization */ status = Ipc_start(); if (status < 0) { printf ("Ipc_start failed: status = 0x%x\n", status); goto exit; } /* Launch multiple threads: */ for (i = 0; i < numThreads; i++) { /* Create the test thread: */ printf ("creating pingThreadFxn: %d\n", i); threads[i].thread_num = (procNum == ONE_PROCESS_ONLY)? i: procNum; ret = pthread_create(&threads[i].thread_id, NULL, &pingThreadFxn, &(threads[i].thread_num)); if (ret) { printf("MessageQMulti: can't spawn thread: %d, %s\n", i, strerror(ret)); } } /* Join all threads: */ for (i = 0; i < numThreads; i++) { ret = pthread_join(threads[i].thread_id, NULL); if (ret != 0) { printf("MessageQMulti: failed to join thread: %d, %s\n", threads[i].thread_num, strerror(ret)); } printf("MessageQMulti: Joined with thread %d\n",threads[i].thread_num); } Ipc_stop(); exit: return (status); }