Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

static ddi_bc_Status_t ddi_bc_ToppingOff ( void   )  [static]

Topping Off state function.

Function

This function implements the Topping Off state.

Definition at line 848 of file ddi_bc_sm.c.

References ddi_bc_hwPowerSupplyIsPresent(), ddi_bc_RampStep(), ddi_bc_RampUpdateAlarms(), DDI_BC_STATUS_SUCCESS, g_ddi_bc_Configuration, TransitionToWaitingToCharge(), _ddi_bc_Cfg::u32StateMachinePeriod, and _ddi_bc_Cfg::u32TopOffPeriod.

{

      //--------------------------------------------------------------------------
      // The first order of business is to update alarms.

      //--------------------------------------------------------------------------

      ddi_bc_RampUpdateAlarms();

      //--------------------------------------------------------------------------
      // Increment the state timer. Notice that, unlike other states, we increment
      // the state timer whether or not we're under an alarm.
      //--------------------------------------------------------------------------

      g_ddi_bc_u32StateTimer += g_ddi_bc_Configuration.u32StateMachinePeriod;

      //--------------------------------------------------------------------------
      // Check if the power supply is still around.
      //--------------------------------------------------------------------------

      if (!ddi_bc_hwPowerSupplyIsPresent()) {

            //----------------------------------------------------------------------
            // If control arrives here, the power supply has been removed. Go back
            // and wait.
            //---------------------------------------------------------------------

            TransitionToWaitingToCharge();

            //----------------------------------------------------------------------
            // Return success.
            //----------------------------------------------------------------------

            return (DDI_BC_STATUS_SUCCESS);

      }

      //--------------------------------------------------------------------------
      // Are we done topping off?
      //--------------------------------------------------------------------------
      if (g_ddi_bc_u32StateTimer >= g_ddi_bc_Configuration.u32TopOffPeriod) {

            //----------------------------------------------------------------------
            // If control arrives here, we're done topping off.
            //----------------------------------------------------------------------

            TransitionToWaitingToCharge();

      }
      //--------------------------------------------------------------------------
      // If control arrives here, we're staying in this state. Step the current
      // ramp.
      //--------------------------------------------------------------------------

      ddi_bc_RampStep(g_ddi_bc_Configuration.u32StateMachinePeriod);

      //--------------------------------------------------------------------------
      // Return success.
      //--------------------------------------------------------------------------

      return (DDI_BC_STATUS_SUCCESS);

}


Generated by  Doxygen 1.6.0   Back to index