4 Replies Latest reply on Aug 8, 2012 7:40 AM by rama.sai.krishna.vakkantula

    LMP Management in Cypress Example USBBulkSourceSink

    content.librarian

      Hello,

         

       

         

      can somebody explain why the main thread in the sourcesink example is trying each 2 seconds to get the LPM back to U0?

         

       

         

      With that code snippet:

         

              /* Try to get the USB 3.0 link back to U0. */
              {
                  CyU3PUsbLinkPowerMode curState;

                  if (CyU3PUsbGetSpeed () == CY_U3P_SUPER_SPEED)
                  {
                      /* If the link is in U1/U2 states, try to get back to U0. */
                      stat = CyU3PUsbGetLinkPowerState (&curState);
                      while ((stat == CY_U3P_SUCCESS) && (curState >= CyU3PUsbLPM_U1) && (curState <= CyU3PUsbLPM_U3))
                      {
                          CyU3PUsbSetLinkPowerState (CyU3PUsbLPM_U0);
                          CyU3PThreadSleep (1);
                          stat = CyU3PUsbGetLinkPowerState (&curState);
                      }
                  }
              }
       

         

      For what use is this?

         

      Why polling each two seconds?

         

      Why not doing this in the LPM callback function if the LPM state changes to other than U0?

         

       

         

      Thanks,

         

      lumpi