USBInit.c
/*******************************************************************************
* Function Name  : Resume
* Description    : This is the state machine handling resume operations and
*                 timing sequence. The control is based on the Resume structure
*                 variables and on the ESOF interrupt calling this subroutine
*                 without changing machine state.
* Input          : a state machine value (RESUME_STATE)
*                  RESUME_ESOF doesn't change ResumeS.eState allowing
*                  decrementing of the ESOF counter in different states.
* Output         : None.
* Return         : None.
*******************************************************************************/
Function Name  : Resume
Description    : This is the state machine handling resume operations and
timing sequence. The control is based on the Resume structure
variables and on the ESOF interrupt calling this subroutine
without changing machine state.
Input          : a state machine value (RESUME_STATE)
RESUME_ESOF doesn't change ResumeS.eState allowing
decrementing of the ESOF counter in different states.
Output         : None.
Return         : None.
Function Name : Resume Description : This is the state machine handling resume operations and timing sequence . The control is based on the Resume structure variables and on the ESOF interrupt calling this subroutine without changing machine state . Input : a state machine value ( RESUME_STATE ) RESUME_ESOF doesn ' t change ResumeS . eState allowing decrementing of the ESOF counter in different states . Output : None . Return : None .
void Resume(RESUME_STATE eResumeSetVal)
{
#ifndef STM32F10X_CL
  u16 wCNTR;
#endif 
  if (eResumeSetVal != RESUME_ESOF)
    ResumeS.eState = eResumeSetVal;
  switch (ResumeS.eState)
  {
    case RESUME_EXTERNAL:
      Resume_Init();
      ResumeS.eState = RESUME_OFF;
      break;
    case RESUME_INTERNAL:
      Resume_Init();
      ResumeS.eState = RESUME_START;
      break;
    case RESUME_LATER:
      ResumeS.bESOFcnt = 2;
      ResumeS.eState = RESUME_WAIT;
      break;
    case RESUME_WAIT:
      ResumeS.bESOFcnt--;
      if (ResumeS.bESOFcnt == 0)
        ResumeS.eState = RESUME_START;
      break;
    case RESUME_START:
     #ifdef STM32F10X_CL
      OTGD_FS_SetRemoteWakeup();
     #else
      wCNTR = _GetCNTR();
      wCNTR |= CNTR_RESUME;
      _SetCNTR(wCNTR);
     #endif 
      ResumeS.eState = RESUME_ON;
      ResumeS.bESOFcnt = 10;
      break;
    case RESUME_ON:
    #ifndef STM32F10X_CL
      ResumeS.bESOFcnt--;
      if (ResumeS.bESOFcnt == 0)
      {
     #endif 
       #ifdef STM32F10X_CL
        OTGD_FS_ResetRemoteWakeup();
       #else
        wCNTR = _GetCNTR();
        wCNTR &= (~CNTR_RESUME);
        _SetCNTR(wCNTR);
       #endif 
        ResumeS.eState = RESUME_OFF;
     #ifndef STM32F10X_CL
      }
     #endif 
      break;
    case RESUME_OFF:
    case RESUME_ESOF:
    default:
      ResumeS.eState = RESUME_OFF;
      break;
  }
}
void Resume ( RESUME_STATE eResumeSetVal ) { #ifndef STM32F10X_CL u16 wCNTR ; #endif if ( eResumeSetVal != RESUME_ESOF ) ResumeS . eState = eResumeSetVal ; switch ( ResumeS . eState ) { case RESUME_EXTERNAL : Resume_Init ( ) ; ResumeS . eState = RESUME_OFF ; break ; case RESUME_INTERNAL : Resume_Init ( ) ; ResumeS . eState = RESUME_START ; break ; case RESUME_LATER : ResumeS . bESOFcnt = 2 ; ResumeS . eState = RESUME_WAIT ; break ; case RESUME_WAIT : ResumeS . bESOFcnt -- ; if ( ResumeS . bESOFcnt == 0 ) ResumeS . eState = RESUME_START ; break ; case RESUME_START : #ifdef STM32F10X_CL OTGD_FS_SetRemoteWakeup ( ) ; #else wCNTR = _GetCNTR ( ) ; wCNTR |= CNTR_RESUME ; _SetCNTR ( wCNTR ) ; #endif ResumeS . eState = RESUME_ON ; ResumeS . bESOFcnt = 10 ; break ; case RESUME_ON : #ifndef STM32F10X_CL ResumeS . bESOFcnt -- ; if ( ResumeS . bESOFcnt == 0 ) { #endif 
       #ifdef STM32F10X_CL OTGD_FS_ResetRemoteWakeup ( ) ; #else 
        wCNTR = _GetCNTR(); wCNTR &= ( ~ CNTR_RESUME ) ; _SetCNTR ( wCNTR ) ; #endif 
        ResumeS.eState = RESUME_OFF; #ifndef STM32F10X_CL } #endif break ; case RESUME_OFF : case RESUME_ESOF : default : ResumeS . eState = RESUME_OFF ; break ; } }
Function Name  : Resume
Description    : This is the state machine handling resume operations and
timing sequence.
Function Name : Resume Description : This is the state machine handling resume operations and timing sequence .
/* STM32F10X_CL */ /* STM32F10X_CL */  /* STM32F10X_CL */  /* STM32F10X_CL */ /* STM32F10X_CL */