X-Git-Url: https://git.ti.com/gitweb?p=ipc%2Fipcdev.git;a=blobdiff_plain;f=linux%2Fsrc%2Fapi%2FIpc.c;h=214c6264612627943c5e500607488ba11093372d;hp=43cfa66143fe946c566cfc5f98ec4f8df5e2e2fd;hb=bebbebbd6c294f81ca89bad9131d5f93e187c3c7;hpb=19c8290c37cbd0bd5fb2d720fab1955803b55ab4 diff --git a/linux/src/api/Ipc.c b/linux/src/api/Ipc.c index 43cfa66..214c626 100644 --- a/linux/src/api/Ipc.c +++ b/linux/src/api/Ipc.c @@ -44,9 +44,9 @@ #include #include #include -#include /* Common IPC headers: */ +#include #include #include @@ -55,11 +55,10 @@ /* IPC startup/shutdown stuff: */ #include +#include <_MultiProc.h> #include <_MessageQ.h> #include <_NameServer.h> -MultiProc_Config _MultiProc_cfg; - static LAD_ClientHandle ladHandle; static void cleanup(int arg); @@ -73,9 +72,10 @@ Int Ipc_start (Void) { MessageQ_Config msgqCfg; MultiProc_Config mpCfg; - Int32 status = Ipc_S_SUCCESS; + Int32 status; LAD_Status ladStatus; UInt16 rprocId; + Int32 attachedAny = 0; /* Catch ctrl-C, and cleanup: */ (void) signal(SIGINT, cleanup); @@ -87,9 +87,12 @@ Int Ipc_start (Void) goto exit; } - /* Setup and get MultiProc configuration from LAD */ + /* + * Get MultiProc configuration from LAD and initialize local MultiProc + * config structure. + */ MultiProc_getConfig(&mpCfg); - _MultiProc_cfg = mpCfg; + _MultiProc_initCfg(&mpCfg); status = NameServer_setup(); if (status >= 0) { @@ -97,19 +100,28 @@ Int Ipc_start (Void) MessageQ_setup(&msgqCfg); /* Now attach to all remote processors, assuming they are up. */ - for (rprocId = 0; - (rprocId < MultiProc_getNumProcessors()) && (status >= 0); - rprocId++) { - if (0 == rprocId) { - /* Skip host, which should always be 0th entry. */ - continue; - } - status = MessageQ_attach (rprocId, NULL); - if (status < 0) { - printf("Ipc_start: MessageQ_attach(%d) failed: %d\n", - rprocId, status); - status = Ipc_E_FAIL; - } + for (rprocId = 0; rprocId < MultiProc_getNumProcessors(); rprocId++) { + if (0 == rprocId) { + /* Skip host, which should always be 0th entry. */ + continue; + } + status = MessageQ_attach(rprocId, NULL); + if (status == MessageQ_E_RESOURCE) { + continue; + } + if (status < 0) { + printf("Ipc_start: MessageQ_attach(%d) failed: %d\n", + rprocId, status); + status = Ipc_E_FAIL; + + break; + } + else { + attachedAny = 1; + } + } + if (attachedAny) { + status = Ipc_S_SUCCESS; } } else {