static tZGVoidReturn do_get_zg2100_version_cmd(tZGVoidInput)
{


    if ( DISPATCH_ZGLIB( ZG_LIB_FUNC(ZGLibGetChipVersion),
                         kNULL,
                         ZG_COMP_FUNC(consoleGetVerComplete),
                         kNULL ) != kZGSuccess )
    {
        ZG_PUTRSUART("Device busy, try again...\n\r");
    }
}
extern tZGVoidReturn

ZGUserScanMgr(tZGVoidInput)

{
    tZGU32   time = ZGSYS_MODULE_GET_MSEC_TICK_COUNT();

    if (IS_USER_SCAN_INPROGRESS(APPCXT.scanStatus))  {
        if ((time - APPCXT.scanTime) > TIME_BETWEEN_SCAN) {
            if ( DISPATCH_ZGLIB( ZG_LIB_FUNC(ZGLibScan),
                                 ZG_REQ_FUNC(ZG_SCAN),
                                 ZG_COMP_FUNC(genericScanComplete),
                                 APPCXT.scanList ) != kZGSuccess )
            {
                /* If we get here no sweat we will come back and try */
                ZG_PUTRSUART( "Device busy, try again...\n\r");
            }
        }     
    }

    return;
}
Beispiel #3
0
void
ZGLinkMgr(void)
{

  tDispatchZGLib        appLibFuncPtr = kNULL;
  tDispatchComplete     appCompleteHandler = kNULL;
  tDispatchRequest      appRequestHandler = kNULL;
  tDispatchNext         appNextStateHandler = APPCXT.FSMSelector[APPCXT.FSM.currentState].next_state_func;
  enum tFSMValidStates  tempNext = kNULL;



 /* This is an optional runtime override to the static pass/fail next states in a FSM table */
 /* The next state is useful when the decission process for a next state is based on random user input */
 /* or there are multiple edges to the next state in the FSM graph */
 if (  appNextStateHandler != kNULL )
 {
     /* If the nextState handler returns null, it does not want to override */
    tempNext =  DISPATCH_NEXT(appNextStateHandler);
 }

  switch ( APPCXT.FSM.stateStatus )
  {

      case kSUCCESS:
          /* Does the next state hander have a runtime overide? of the static pass entry  */
          if ( tempNext != kNULL )
            APPCXT.FSM.currentState = tempNext;
          else
            APPCXT.FSM.currentState = APPCXT.FSMSelector[ APPCXT.FSM.currentState ].next_success;

          break;

      case kFAILURE:
          /* Does the next state hander have a runtime overide? of the static fail entry  */
          if ( tempNext != kNULL )
            APPCXT.FSM.currentState = tempNext;
          else
           /* The pass or fail next states are defined in FSM tables */
           APPCXT.FSM.currentState = APPCXT.FSMSelector[ APPCXT.FSM.currentState ].next_fail;

          break;

      case kRETRY:
          /* call the same state again */
          break;

      case kPENDING:
          /* wait for driver to complete call*/
          return;

      default:

          ZGErrorHandler((ROM FAR char*) "Unknown FSM status");
          break;
   }

   appLibFuncPtr = APPCXT.FSMSelector[APPCXT.FSM.currentState].zg_library_func;

   if ( appLibFuncPtr != kNULL )
   {
     /* iniate the call to the ZeroG library */
     appCompleteHandler = APPCXT.FSMSelector[APPCXT.FSM.currentState].complete_func;
     appRequestHandler = APPCXT.FSMSelector[APPCXT.FSM.currentState].request_func;

     g_linkMgrCtx.FSM.stateStatus = kPENDING;

     /* This call can fail, if another library call has been made or there is no memory for a new call */
     if ( DISPATCH_ZGLIB (appLibFuncPtr, appRequestHandler, appCompleteHandler, kNULL) !=  kZGSuccess )
     {
        g_linkMgrCtx.FSM.stateStatus = kRETRY;
     }
   }
  }  /* end switch */