Exemple #1
0
//------------------------------------------------------------------------------
static tOplkError processNmtEvent(tEvent* pEvent_p)
{
    tOplkError      Ret = kErrorOk;
    tNmtEvent*      pNmtEvent;
    tNmtState       NmtState;

    pNmtEvent = (tNmtEvent*)pEvent_p->eventArg.pEventArg;

    switch (*pNmtEvent)
    {
        case kNmtEventDllCeSoa:
            // do preprocessing for next cycle
            NmtState = dllkInstance_g.nmtState;
#if (CONFIG_DLL_PROCESS_SYNC == DLL_PROCESS_SYNC_ON_SOA)
            if (dllkInstance_g.dllState != kDllGsInit)
            {   // cyclic state is active, so preprocessing is necessary
                Ret = processSync(NmtState);
            }
//            BENCHMARK_MOD_02_TOGGLE(7);
#endif
            Ret = processCycleFinish(NmtState);
            break;

        default:
            break;
    }

    return Ret;
}
void pdsp::ClockedPhazor::process(int bufferSize) noexcept {
        phaseOffset = processAndGetSingleValue(input_phase, 0);
        division = processAndGetSingleValue(input_division, 0);
   
        if (input_trig.isConnected()) {
                processTrigger(bufferSize);
        }else{
                processSync(bufferSize);
        }
}
static bool processWhenSynchronized(pulseProcessor_t *state, int sensor, unsigned int timestamp, unsigned int width, pulseProcessorResult_t angles[], int *baseStation, int *axis) {
  bool anglesMeasured = false;

  if (isSweep(state, timestamp, width)) {
    storeSweepData(state, sensor, timestamp);
  } else {
    anglesMeasured = processSync(state, timestamp, width, angles, baseStation, axis);
  }

  return anglesMeasured;
}
Exemple #4
0
void DSDDstar::process()
{
    if (m_frameType == DStarVoiceFrame)
    {
        processVoice();
    }
    else if (m_frameType == DStarDataFrame)
    {
        processData();
    }
    else if (m_frameType == DStarSyncFrame)
    {
        processSync();
    }
}
Exemple #5
0
//------------------------------------------------------------------------------
static tOplkError processCycleFinish(tNmtState nmtState_p)
{
    tOplkError      ret = kErrorOk;

    ret = dllkframe_updateFrameAsyncRes(nmtState_p);
    if (ret != kErrorOk)
        goto Exit;

    ret = errhndk_decrementCounters(NMT_IF_ACTIVE_MN(nmtState_p));

#if defined(CONFIG_INCLUDE_NMT_MN)
    if (dllkInstance_g.dllState > kDllMsNonCyclic)
    {
        if (dllkInstance_g.dllConfigParam.syncNodeId == C_ADR_SYNC_ON_SOC)
        {   // cyclic state is active, so preprocessing is necessary
            ret = processSync(nmtState_p);
        }
    }
#endif
Exit:
    return ret;
}
//------------------------------------------------------------------------------
static void loopMain(void)
{
    tOplkError              ret = kErrorOk;
    char                    cKey = 0;
    BOOL                    fExit = FALSE;

#if !defined(CONFIG_KERNELSTACK_DIRECTLINK)

#if defined(CONFIG_USE_SYNCTHREAD)
    system_startSyncThread(processSync);
#endif

#endif

    // start stack processing by sending a NMT reset command
    ret = oplk_execNmtCommand(kNmtEventSwReset);
    if (ret != kErrorOk)
    {
        return;
    }

    printf("\n-------------------------------\n");
    printf("Press Esc to leave the program\n");
    printf("Press r to reset the node\n");
    printf("-------------------------------\n\n");

    while (!fExit)
    {
        if (console_kbhit())
        {
            cKey = (char)console_getch();
            switch (cKey)
            {
                case 'r':
                    ret = oplk_execNmtCommand(kNmtEventSwReset);
                    if (ret != kErrorOk)
                    {
                        fExit = TRUE;
                    }
                    break;

                case 'c':
                    ret = oplk_execNmtCommand(kNmtEventNmtCycleError);
                    if (ret != kErrorOk)
                    {
                        fExit = TRUE;
                    }
                    break;

                case 0x1B:
                    fExit = TRUE;
                    break;

                default:
                    break;
            }
        }

        if (system_getTermSignalState() == TRUE)
        {
            fExit = TRUE;
            printf("Received termination signal, exiting...\n");
        }

        if (oplk_checkKernelStack() == FALSE)
        {
            fExit = TRUE;
            fprintf(stderr, "Kernel stack has gone! Exiting...\n");
        }

#if defined(CONFIG_USE_SYNCTHREAD) || defined(CONFIG_KERNELSTACK_DIRECTLINK)
        system_msleep(100);
#else
        processSync();
#endif

    }

#if (TARGET_SYSTEM == _WIN32_)
    printf("Press Enter to quit!\n");
    console_getch();
#endif

}
//------------------------------------------------------------------------------
static void loopMain(void)
{
    tOplkError              ret = kErrorOk;
    char                    cKey = 0;
    BOOL                    fExit = FALSE;

#if !defined(CONFIG_KERNELSTACK_DIRECTLINK)

#if defined(CONFIG_USE_SYNCTHREAD)
    system_startSyncThread(processSync);
#endif

#endif

    // start processing
    ret = oplk_execNmtCommand(kNmtEventSwReset);
    if (ret != kErrorOk)
    {
        return;
    }

    printf("start POWERLINK Stack... ok\n");
    printf("Digital I/O interface with openPOWERLINK is ready!\n");
    printf("\n-------------------------------\n");
    printf("Press Esc to leave the programm\n");
    printf("Press r to reset the node\n");
    printf("Press i to increase digital input\n");
    printf("Press d to decrease digital input\n");
    printf("Press p to print digital outputs\n");
    printf("-------------------------------\n\n");

    setupInputs();

    // wait for key hit
    while (!fExit)
    {
        if (console_kbhit())
        {
            cKey = (BYTE)console_getch();

            switch (cKey)
            {
                case 'r':
                    ret = oplk_execNmtCommand(kNmtEventSwReset);
                    if (ret != kErrorOk)
                    {
                        fExit = TRUE;
                    }
                    break;

                case 'i':
                    increaseInputs();
                    break;

                case 'd':
                    decreaseInputs();
                    break;

                case 'p':
                    printOutputs();
                    break;

                case 0x1B:
                    fExit = TRUE;
                    break;

                default:
                    break;
            }
        }

        if (system_getTermSignalState() == TRUE)
        {
            fExit = TRUE;
            printf("Received termination signal, exiting...\n");
        }

        if (oplk_checkKernelStack() == FALSE)
        {
            fExit = TRUE;
            fprintf(stderr, "Kernel stack has gone! Exiting...\n");
        }

#if defined(CONFIG_USE_SYNCTHREAD) || defined(CONFIG_KERNELSTACK_DIRECTLINK)
        system_msleep(100);
#else
        processSync();
#endif
    }

#if (TARGET_SYSTEM == _WIN32_)
    printf("Press Enter to quit!\n");
    console_getch();
#endif

    return;
}
Exemple #8
0
//------------------------------------------------------------------------------
tOplkError dllk_process(tEvent* pEvent_p)
{
    tOplkError              ret = kErrorOk;
    tEventNmtStateChange*   pNmtStateChange;

    switch (pEvent_p->eventType)
    {
        case kEventTypeNmtStateChange:
            pNmtStateChange = (tEventNmtStateChange*)pEvent_p->eventArg.pEventArg;
            ret = processNmtStateChange(pNmtStateChange->newNmtState,
                                        pNmtStateChange->oldNmtState,
                                        pNmtStateChange->nmtEvent);
            break;

        case kEventTypeNmtEvent:
            ret = processNmtEvent(pEvent_p);
            break;

        case kEventTypeDllkFillTx:
            ret = processFillTx(*((tDllAsyncReqPriority*)pEvent_p->eventArg.pEventArg),
                                dllkInstance_g.nmtState);
            break;

        case kEventTypeDllkFlag1:
            // trigger update of StatusRes on SoA, because Flag 1 was changed
            if (dllkInstance_g.updateTxFrame == DLLK_UPDATE_NONE)
                dllkInstance_g.updateTxFrame = DLLK_UPDATE_STATUS;
            break;

        case kEventTypeDllkCycleFinish:
            ret = processCycleFinish(dllkInstance_g.nmtState);
            break;

        case kEventTypeSync:
            ret = processSync(dllkInstance_g.nmtState);
            break;

#if defined(CONFIG_INCLUDE_NMT_MN)
        case kEventTypeDllkStartReducedCycle:
            ret = processStartReducedCycle();
            break;

#if defined(CONFIG_INCLUDE_PRES_FORWARD)
        case kEventTypeRequPresForward:
            ret = requestPresForward(*((UINT*)pEvent_p->eventArg.pEventArg));
            break;
#endif

#endif

#if CONFIG_DLL_PRES_READY_AFTER_SOA != FALSE
        case kEventTypeDllkPresReady:
            ret = processPresReady(dllkInstance_g.nmtState);
            break;
#endif


        default:
            ret = kErrorInvalidEvent;
            ASSERTMSG(ret != kErrorInvalidEvent, "dllk_process(): unhandled event type!\n");
            break;
    }

    return ret;
}
int sageDisplayManager::parseEvent(sageEvent *event)
{
   if (!event) {
      sage::printLog("sageDisplayManager::parseEvent : event object is Null");
      return -1;
   }

   switch (event->eventType) {
      case EVENT_NEW_CONNECTION : {
         initStreams(event->eventMsg, (streamProtocol *)event->param);
         break;
      }

      case EVENT_NEW_MESSAGE : {
         parseMessage((sageMessage *)event->param);
         break;
      }

      case EVENT_SYNC_MESSAGE : {
         //processSync((char *)event->eventMsg);
    	  processSync( event );
         break;
      }

      case EVENT_REFRESH_SCREEN : {
         if (shared->displayObj->isDirty())
            shared->displayObj->updateScreen(shared, false);

         if (shared->context)
            shared->context->checkEvent();
         break;
      }

      case EVENT_READ_BLOCK : {
         int instID = atoi((char *)event->eventMsg);
			if (0 > instID) break;

			int index;
			pixelDownloader*  temp_app = findApp(instID, index);
			if (temp_app) {
            if (temp_app->getStatus() == PDL_WAIT_DATA)
               temp_app->fetchSageBlocks();
         }
         break;
      }

		case EVENT_APP_CONNECTED : {
         int instID = atoi((char *)event->eventMsg);
			if (0 > instID) break;

			int index;
			pixelDownloader*  temp_app = findApp(instID, index);

			if (temp_app) {
            sendMessage(DISP_APP_CONNECTED, instID);
         }
         break;
		}
   }

   delete event;

   return 0;
}