int main(int argc, const char **argv) { PortalSocketParam paramSocket = {}; PortalMuxParam param = {}; Portal *mcommon = new Portal(0, sizeof(uint32_t), NULL, NULL, &socketfuncInit, ¶mSocket, 0); param.pint = &mcommon->pint; EchoIndication *sIndication = new EchoIndication(IfcNames_EchoIndication, &muxfunc, ¶m); sEcho = new EchoRequestSWProxy(IfcNames_EchoRequest, &muxfunc, ¶m); SecondIndication *sSecondIndication = new SecondIndication(IfcNames_SecondIndication, &muxfunc, ¶m); sSecond = new SecondRequestProxy(IfcNames_SecondRequest, &muxfunc, ¶m); ThirdIndication *sThirdIndication = new ThirdIndication(IfcNames_ThirdIndication, &muxfunc, ¶m); sThird = new ThirdRequestProxy(IfcNames_ThirdRequest, &muxfunc, ¶m); portalExec_start(); int v = 42; fprintf(stderr, "Saying %d\n", v); call_say(v); sSecond->say(v*99, v * 1000000000L, v*55); call_say(v*5); sThird->say(); call_say(v*17); call_say(v*93); call_say2(v, v*3); printf("TEST TYPE: SEM\n"); sEcho->setLeds(9); portalExec_end(); return 0; }
int main(int argc, const char **argv) { PortalSocketParam param = {0}; //#define USE_UNIX_SOCKET #ifdef USE_UNIX_SOCKET #define PARAM NULL #else #define PARAM ¶m #endif int rc = getaddrinfo("127.0.0.1", "5000", NULL, ¶m.addr); EchoIndication *sIndication = new EchoIndication(IfcNames_EchoIndicationH2S, &transportSocketInit, PARAM); rc = getaddrinfo("127.0.0.1", "5001", NULL, ¶m.addr); sRequestProxy = new EchoRequestProxy(IfcNames_EchoRequestS2H, &transportSocketInit, PARAM, &EchoRequestJsonProxyReq, 1000); int v = 42; fprintf(stderr, "Saying %d\n", v); call_say(v); call_say(v*5); call_say(v*17); call_say(v*93); call_say2(v, v*3); printf("TEST TYPE: SEM\n"); sRequestProxy->setLeds(9); return 0; }
int main(int argc, const char **argv) { int alloc_sz = 64-4; //1000; MMURequestProxy *dmap = new MMURequestProxy(IfcNames_MMURequest, &socketfuncInit, NULL); DmaManager *dma = new DmaManager(dmap); MMUIndication *mIndication = new MMUIndication(dma, IfcNames_MMUIndication, &socketfuncInit, NULL); portalExec_start(); PortalSharedParam param = {dma, alloc_sz}; EchoIndication *sIndication = new EchoIndication(IfcNames_EchoIndication, &sharedfunc, ¶m); sRequestProxy = new EchoRequestProxy(IfcNames_EchoRequest, &sharedfunc, ¶m); for (int i = 0; i < 10; i++) { int v = 42; fprintf(stderr, "Saying %d\n", v); call_say(v); call_say(v*5); call_say(v*17); call_say(v*93); call_say2(v, v*3); } sRequestProxy->setLeds(9); while (1) { sleep(1); } return 0; }
int main(int argc, const char **argv) { poller = new PortalPoller(); EchoIndication *echoIndication = new EchoIndication(IfcNames_EchoIndication, poller); DisplayInd *dispIndication = new DisplayInd(IfcNames_DisplayInd, poller); // these use the default poller SwallowProxy *swallowProxy = new SwallowProxy(IfcNames_Swallow); echoRequestProxy = new EchoRequestProxy(IfcNames_EchoRequest); poller->portalExec_init(); init_thread(); portalExec_start(); #if 0 printf("Timer tests\n"); portalTimerInit(); for (int i = 0; i < 1000; i++) { portalTimerStart(0); portalTimerCatch(1); portalTimerCatch(2); portalTimerCatch(3); portalTimerCatch(4); portalTimerCatch(5); portalTimerCatch(6); portalTimerCatch(7); portalTimerCatch(8); } portalTimerPrint(1000); #endif int v = 42; fprintf(stderr, "Saying %d\n", v); call_say(v); call_say(v*5); call_say(v*17); call_say(v*93); printf("[%s:%d] run %d loops\n\n", __FUNCTION__, __LINE__, LOOP_COUNT); portalTimerInit(); portalTimerStart(1); for (int i = 0; i < LOOP_COUNT; i++) call_say2(v, v*3); uint64_t elapsed = portalTimerLap(1); printf("TEST TYPE: " #ifndef SEPARATE_EVENT_THREAD "INLINE" #elif defined(USE_MUTEX_SYNC) "MUTEX" #else "SEM" #endif "\n"); portalTimerPrint(LOOP_COUNT); printf("call_say: elapsed %g average %g\n", (double) elapsed, (double) elapsed/ (double) LOOP_COUNT); echoRequestProxy->setLeds(9); poller->portalExec_end(); portalExec_end(); return 0; }