text: /*
   * sfun_usb_disconnect.c: simulation stub for USB disconnection
   *
   *   Copyright 2010 The MathWorks, Inc.
   */
  
  
  #define S_FUNCTION_NAME  sfun_usb_disconnect
  #define S_FUNCTION_LEVEL 2
  
  #include "simstruc.h"
  
  #ifndef MATLAB_MEX_FILE
  /* Since we have a target file for this S-function, declare an error here
   * so that, if for some reason this file is being used (instead of the
   * target file) for code generation, we can trap this problem at compile
   * time.  */
  #  error This_file_can_be_used_only_during_simulation_inside_Simulink
  #endif
  
  
  /*=========================================================================*
   * Number of S-function Parameters and macros to access from the SimStruct *
   *=========================================================================*/
  
  /*==================================================*
   * Macros to access the S-function parameter values *
   *==================================================*/
  
  /*==================================================*
   * Macros to access the S-function parameter values *
   *==================================================*/
  
  /*====================*
   * S-function methods *
   *====================*/
  static void mdlCheckParameters(SimStruct *S)
  {
  }
  
  /* Function: mdlInitializeSizes ===============================================
   * Abstract:
   *    The sizes information is used by Simulink to determine the S-function
   *    block's characteristics (number of inputs, outputs, states, etc.).
   */
  static void mdlInitializeSizes(SimStruct *S)
  {
      ssSetNumContStates(S, 0);
      ssSetNumDiscStates(S, 0);
      
      if (!ssSetNumInputPorts(S, 1)) return;
      ssSetInputPortWidth(S, 0, 1);
      ssSetInputPortDataType(S, 0, SS_UINT8);
      ssSetInputPortRequiredContiguous(S, 0, true); 
      ssSetInputPortDirectFeedThrough(S, 0, 1);
      ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
  
      if (!ssSetNumOutputPorts(S, 0)) return;
      
      ssSetNumSampleTimes(S, 1);
      ssSetNumRWork(S, 0);
      ssSetNumIWork(S, 0);
      ssSetNumPWork(S, 0);
      ssSetNumModes(S, 0);
      ssSetNumNonsampledZCs(S, 0);
      ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_CAN_BE_CALLED_CONDITIONALLY);
  }
  
  
  /* Function: mdlInitializeSampleTimes =========================================
   * Abstract:
   *    This function is used to specify the sample time(s) for your
   *    S-function. You must register the same number of sample times as
   *    specified in ssSetNumSampleTimes.
   */
  static void mdlInitializeSampleTimes(SimStruct *S)
  {
      ssSetSampleTime(S, 0, INHERITED_SAMPLE_TIME);
      ssSetOffsetTime(S, 0, 0.0);
  
  }
  
  
  /* Function: mdlOutputs =======================================================
   * Abstract:
   *    In this function, you compute the outputs of your S-function
   *    block. Generally outputs are placed in the output vector, ssGetY(S).
   */
  static void mdlOutputs(SimStruct *S, int_T tid)
  {
      /* no outputs */
  }
  
  
  /* Function: mdlTerminate =====================================================
   * Abstract:
   *    In this function, you should perform any actions that are necessary
   *    at the termination of a simulation.  For example, if memory was
   *    allocated in mdlStart, this is the place to free it.
   */
  static void mdlTerminate(SimStruct *S)
  {
  }
  
  
  #define MDL_RTW                        /* Change to #undef to remove function */
  #if defined(MDL_RTW) && (defined(MATLAB_MEX_FILE) || defined(NRT))
  /* Function: mdlRTW ============================================================
   * Abstract:
   *    This function is called when the Real-Time Workshop is generating the
   *    model.rtw file. In this routine, you can call the following functions
   *    which add fields to the model.rtw file.
   *
   *    Important! Since this s-function has this mdlRTW method, it is required
   *    to have a correcponding .tlc file so as to work with RTW. You will find
   *    the sfun_directlook.tlc in <matlabroot>/toolbox/simulink/blocks/tlc_c/.
   */
  static void mdlRTW(SimStruct *S)
  {
  }
  #endif /* MDL_RTW */
  
  
  /*======================================================*
   * See sfuntmpl_doc.c for the optional S-function methods *
   *======================================================*/
  
  /*=============================*
   * Required S-function trailer *
   *=============================*/
  
  #include "simulink.c"      /* MEX-file interface mechanism */
  