コード例 #1
0
ファイル: rtx_timer.c プロジェクト: David-Garcia-Polo/CMSIS_5
/// Stop a timer.
/// \note API identical to osTimerStop
static osStatus_t svcRtxTimerStop (osTimerId_t timer_id) {
  os_timer_t *timer = osRtxTimerId(timer_id);

  // Check parameters
  if ((timer == NULL) || (timer->id != osRtxIdTimer)) {
    EvrRtxTimerError(timer, (int32_t)osErrorParameter);
    //lint -e{904} "Return statement before end of function" [MISRA Note 1]
    return osErrorParameter;
  }

  // Check object state
  if (timer->state != osRtxTimerRunning) {
    EvrRtxTimerError(timer, (int32_t)osErrorResource);
    //lint -e{904} "Return statement before end of function" [MISRA Note 1]
    return osErrorResource;
  }

  timer->state = osRtxTimerStopped;

  TimerRemove(timer);

  EvrRtxTimerStopped(timer);

  return osOK;
}
コード例 #2
0
ファイル: rtx_timer.c プロジェクト: David-Garcia-Polo/CMSIS_5
/// Start or restart a timer.
/// \note API identical to osTimerStart
static osStatus_t svcRtxTimerStart (osTimerId_t timer_id, uint32_t ticks) {
  os_timer_t *timer = osRtxTimerId(timer_id);

  // Check parameters
  if ((timer == NULL) || (timer->id != osRtxIdTimer) || (ticks == 0U)) {
    EvrRtxTimerError(timer, (int32_t)osErrorParameter);
    //lint -e{904} "Return statement before end of function" [MISRA Note 1]
    return osErrorParameter;
  }

  // Check object state
  if (timer->state == osRtxTimerInactive) {
    EvrRtxTimerError(timer, (int32_t)osErrorResource);
    //lint -e{904} "Return statement before end of function" [MISRA Note 1]
    return osErrorResource;
  }
  if (timer->state == osRtxTimerRunning) {
    TimerRemove(timer);
  } else {
    if (osRtxInfo.timer.tick == NULL) {
      EvrRtxTimerError(timer, (int32_t)osErrorResource);
      //lint -e{904} "Return statement before end of function" [MISRA Note 1]
      return osErrorResource;
    } else {
      timer->state = osRtxTimerRunning;
      timer->load  = ticks;
    }
  }

  TimerInsert(timer, ticks);

  EvrRtxTimerStarted(timer);

  return osOK;
}
コード例 #3
0
void TimerFireInByJiffies(Timer *me, int act, void *callback, unsigned char *data_p, unsigned int Jiffies)
{
	if (act)
	{
		/* Remove in case Timer is already added */
		TimerRemove(me);
		TimerByJiffiesAdd(me, act, callback, data_p, Jiffies);
	}
}
コード例 #4
0
/*!
* Start a one shot timer 
* @param me Pointer to the timer
* @param act none-zero to active the timer
* @param callback Pointer to the callback function, which will be called if the timer expired
* @param data_p Pointer to user defined data, which is useful by user when implementing callback function
* @param ticks Timer alarm in ticks
*/
void TimerFireIn(Timer *me, int act, void *callback, unsigned char *data_p, unsigned int ticks)
{
	if (act)
	{
		/* Remove in case Timer is already added */
		TimerRemove(me);
		TimerAdd(me, act, callback, data_p, ticks);
	}
}
コード例 #5
0
/*!
* Start a periodic timer 
* @param me Pointer to the timer
* @param act none-zero to active the timer
* @param callback Pointer to the callback function, which will be called if the timer expired
* @param data_p Pointer to user defined data, which is useful by user when implementing callback function
* @param ticks Timer alarm in ticks
*/
void TimerFireEvery(Timer *me, int act, void *callback, unsigned char *data_p, unsigned int ticks)
{
	/* This is not used in current code.  In order to trigger a callback periodically 
	the user will need to rearm the timer within the callback.  */
	if (act)
	{
		TimerRemove(me);
		TimerAdd(me, act, callback, data_p, ticks);
	}
}
コード例 #6
0
ファイル: AuthSta_srv.c プロジェクト: 7LK/McWRT
/*************************************************************************
* Function: authSrv_RecvMsgRsp
*
* Description:
*
* Input:
*
* Output:
*
**************************************************************************/
extern SINT32 authSrv_RecvMsgRsp( vmacStaInfo_t *vStaInfo_p,
								  dot11MgtFrame_t *MgmtMsg_p )
{
    SINT32 authResult;

    #ifdef ETH_DEBUG
    eprintf("macMgmtMlme_AuthenticateMsg:: Entered\n");
    #endif

    TimerRemove(&vStaInfo_p->authTimer);
    switch (MgmtMsg_p->Body.Auth.AuthAlg)
    {
      case AUTH_OPEN_SYSTEM:
            authResult = authSrv_DoOpenAuth(vStaInfo_p, MgmtMsg_p);
            break;

      case AUTH_SHARED_KEY:
            authResult = authSrv_DoSharedKeyAuth(vStaInfo_p, MgmtMsg_p);
            break;
           
      default:
            #ifdef ETH_DEBUG
            eprintf("macMgmtMlme_AuthenticateMsg:: case default\n");
            #endif /* ETH_DEBUG */
            /* Notify peer of failure */
            authSrv_SndAuthError( vStaInfo_p, 
                                IEEEtypes_STATUS_UNSUPPORTED_AUTHALG,
                                MgmtMsg_p->Body.Auth.AuthTransSeq,
                                MgmtMsg_p->Body.Auth.AuthAlg, 
                                &MgmtMsg_p->Hdr.SrcAddr);
            authSrv_SndAuthCnfm(vStaInfo_p, AUTH_NOT_SUPPORTED, 
                            AUTH_RESULT_REFUSED, &MgmtMsg_p->Hdr.SrcAddr[0]);
            /* L2 Event Notification */
            mlmeApiEventNotification(vStaInfo_p,
                                  MlmeAuth_Cnfm,
                                  (UINT8 *)&MgmtMsg_p->Hdr.SrcAddr,
                                  MgmtMsg_p->Body.Auth.StatusCode);
            authResult = MLME_FAILURE;
            break;
    }
    return authResult;
}
コード例 #7
0
ファイル: rtx_timer.c プロジェクト: David-Garcia-Polo/CMSIS_5
/// Delete a timer.
/// \note API identical to osTimerDelete
static osStatus_t svcRtxTimerDelete (osTimerId_t timer_id) {
  os_timer_t *timer = osRtxTimerId(timer_id);

  // Check parameters
  if ((timer == NULL) || (timer->id != osRtxIdTimer)) {
    EvrRtxTimerError(timer, (int32_t)osErrorParameter);
    //lint -e{904} "Return statement before end of function" [MISRA Note 1]
    return osErrorParameter;
  }

  // Check object state
  if (timer->state == osRtxTimerInactive) {
    EvrRtxTimerError(timer, (int32_t)osErrorResource);
    //lint -e{904} "Return statement before end of function" [MISRA Note 1]
    return osErrorResource;
  }
  if (timer->state == osRtxTimerRunning) {
    TimerRemove(timer);
  }

  // Mark object as inactive
  timer->state = osRtxTimerInactive;

  // Free object memory
  if ((timer->flags & osRtxFlagSystemObject) != 0U) {
    if (osRtxInfo.mpi.timer != NULL) {
      (void)osRtxMemoryPoolFree(osRtxInfo.mpi.timer, timer);
    } else {
      (void)osRtxMemoryFree(osRtxInfo.mem.common, timer);
    }
#if (defined(OS_OBJ_MEM_USAGE) && (OS_OBJ_MEM_USAGE != 0))
    osRtxTimerMemUsage.cnt_free++;
#endif
  }

  EvrRtxTimerDestroyed(timer);

  return osOK;
}
コード例 #8
0
ファイル: davis2ivy.c プロジェクト: CheBuzz/paparazzi
/// Handler for Ctrl-C, exits the main loop
void sigint_handler(int sig) {
  IvyStop();
  TimerRemove(tid);
  close(fd);
}
コード例 #9
0
ファイル: kestrel2ivy.c プロジェクト: 2seasuav/paparuzzi
/**
 * Handler for Ctrl-C, exits the main loop.
 */
void sigint_handler(int sig) {
  cbFree(&cb);
  IvyStop();
  TimerRemove(tid);
  close(fd);
}
コード例 #10
0
ファイル: civyloop.c プロジェクト: AntoineBlais/paparazzi
value ivy_timerRemove(value t)
{
  TimerRemove((TimerId)Long_val(t));
  return Val_unit;
}