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

Ddi_bc


Files

file  ddi_bc.h
 Header file for the Battery Charger device driver.
file  ddi_bc_api.c
 Contains the Battery Charger API.
file  ddi_bc_hw.c
 Contains the Battery Charger hardware operations.
file  ddi_bc_hw.h
 Internal header file for Battery Charger hardware operations.
file  ddi_bc_init.c
 Contains the Battery Charger initialization function.
file  ddi_bc_internal.h
 Internal header file for the Battery Charger device driver.
file  ddi_bc_ramp.c
 Contains the Battery Charger current ramp controller.
file  ddi_bc_ramp.h
 Internal header file for Battery Charger current ramp controller.
file  ddi_bc_sm.c
 Contains the Battery Charger state machine.
file  ddi_bc_sm.h
 Header file for the Battery Charger state machine.

Classes

struct  _ddi_bc_Cfg
 Defines the battery charger configuration. More...
struct  _ddi_bc_RampControl
 This is the control structure for the current ramp. More...

Defines

#define DDI_BC_ALKALINE_NIMH_CHARGING_VOLTAGE   1750
#define DDI_BC_EVENT_GROUP   (11<<10)
#define DDI_BC_LIION_CHARGING_VOLTAGE   4200
#define DDI_BC_MAX_RESTART_CYCLES   100
#define TRANSITION_TO_TOPOFF_MINIMUM_CHARGE_TIME_mS   1 * 60 * 1000

Typedefs

typedef enum _ddi_bc_BatteryMode ddi_bc_BatteryMode_t
 The enumeration of battery modes.
typedef enum
_ddi_bc_BiasCurrentSource 
ddi_bc_BiasCurrentSource_t
 The enumeration of bias current sources.
typedef enum _ddi_bc_BrokenReason ddi_bc_BrokenReason_t
typedef struct _ddi_bc_Cfg ddi_bc_Cfg_t
 Defines the battery charger configuration.
typedef struct _ddi_bc_RampControl ddi_bc_RampControl_t
 This is the control structure for the current ramp.
typedef enum _ddi_bc_State ddi_bc_State_t
 Defines battery charger states.
typedef enum _ddi_bc_Status ddi_bc_Status_t
 Status returned by Battery Charger functions.

Enumerations

enum  _ddi_bc_BatteryMode { DDI_BC_BATTERY_MODE_LI_ION_2_CELLS = 0, DDI_BC_BATTERY_MODE_LI_ION_1_CELL = 1, DDI_BC_BATTERY_MODE_2_CELLS = 2, DDI_BC_BATTERY_MODE_1_CELL = 3 }
 The enumeration of battery modes.
enum  _ddi_bc_BiasCurrentSource { DDI_BC_EXTERNAL_BIAS_CURRENT = 0, DDI_BC_INTERNAL_BIAS_CURRENT = 1 }
 The enumeration of bias current sources.
enum  _ddi_bc_BrokenReason {
  DDI_BC_BROKEN_UNINITIALIZED = 0, DDI_BC_BROKEN_CHARGING_TIMEOUT = 1, DDI_BC_BROKEN_FORCED_BY_APPLICATION = 2, DDI_BC_BROKEN_EXTERNAL_BATTERY_VOLTAGE_DETECTED = 3,
  DDI_BC_BROKEN_NO_BATTERY_DETECTED = 4
}
enum  _ddi_bc_State {
  DDI_BC_STATE_UNINITIALIZED = 0, DDI_BC_STATE_BROKEN = 1, DDI_BC_STATE_DISABLED = 2, DDI_BC_STATE_WAITING_TO_CHARGE = 3,
  DDI_BC_STATE_CONDITIONING = 4, DDI_BC_STATE_CHARGING = 5, DDI_BC_STATE_TOPPING_OFF = 6, DDI_BC_STATE_DCDC_MODE_WAITING_TO_CHARGE = 7
}
 Defines battery charger states. More...
enum  _ddi_bc_Status {
  DDI_BC_STATUS_SUCCESS = 0, DDI_BC_STATUS_HARDWARE_DISABLED, DDI_BC_STATUS_BAD_BATTERY_MODE, DDI_BC_STATUS_CLOCK_GATE_CLOSED,
  DDI_BC_STATUS_NOT_INITIALIZED, DDI_BC_STATUS_ALREADY_INITIALIZED, DDI_BC_STATUS_BROKEN, DDI_BC_STATUS_NOT_BROKEN,
  DDI_BC_STATUS_NOT_DISABLED, DDI_BC_STATUS_BAD_ARGUMENT, DDI_BC_STATUS_CFG_BAD_BATTERY_TEMP_CHANNEL, DDI_BC_STATUS_CFG_BAD_CHARGING_VOLTAGE
}
 Status returned by Battery Charger functions. More...
enum  ddi_bc_Event_t {
  ddi_bc_MinEventCode = DDI_BC_EVENT_GROUP, ddi_bc_WaitingToChargeCode, ddi_bc_State_ConditioningCode, ddi_bc_State_Topping_OffCode,
  ddi_bc_State_BrokenCode, ddi_bc_SettingChargeCode, ddi_bc_RaisingDieTempAlarmCode, ddi_bc_DroppingDieTempAlarmCode,
  ddi_bc_MaxEventCode, ddi_bc_DcdcModeWaitingToChargeCode
}
 TBD. More...

Functions

static ddi_bc_Status_t ddi_bc_Broken (void)
 Broken state function.
static ddi_bc_Status_t ddi_bc_Charging (void)
 Charging state function.
static ddi_bc_Status_t ddi_bc_Conditioning (void)
 Conditioning state function.
static ddi_bc_Status_t ddi_bc_Disabled (void)
 Disabled state function.
ddi_bc_Status_t ddi_bc_ForceChargingToStart (void)
 Restart the charge cycle.
ddi_bc_BrokenReason_t ddi_bc_GetBrokenReason (void)
 Report the reason for being in the broken state.
uint16_t ddi_bc_GetCurrentLimit (void)
 Report the current limit.
uint32_t ddi_bc_GetCurrentRampSlope (void)
 Report the current ramp slope.
ddi_bc_State_t ddi_bc_GetState (void)
 Get the Battery Charger's current state.
uint32_t ddi_bc_GetStateMachinePeriod (void)
 Report the state machine period.
uint32_t ddi_bc_GetStateTime (void)
 Report the time spent in the present state (milliseconds).
int ddi_bc_hwBatteryChargerIsEnabled (void)
 Report if the battery charging hardware is available.
int ddi_bc_hwChargerPowerIsOn (void)
 Report if the charger hardware power is on.
uint8_t ddi_bc_hwCurrentToSetting (uint16_t u16Current)
 Convert a current in mA to a hardware setting.
uint16_t ddi_bc_hwExpressibleCurrent (uint16_t u16Current)
 Compute the actual current expressible in the hardware.
ddi_bc_BatteryMode_t ddi_bc_hwGetBatteryMode (void)
 Report the battery configuration.
ddi_bc_Status_t ddi_bc_hwGetBatteryTemp (uint16_t *pReading)
 Report the battery temperature reading.
uint16_t ddi_bc_hwGetBatteryVoltage (void)
 Report the voltage across the battery.
ddi_bc_BiasCurrentSource_t ddi_bc_hwGetBiasCurrentSource (void)
int ddi_bc_hwGetChargeStatus (void)
 Reports if the charging current has fallen below the threshold.
uint16_t ddi_bc_hwGetCurrentThreshold (void)
 Report the charging current threshold.
void ddi_bc_hwGetDieTemp (int16_t *pLow, int16_t *pHigh)
 Report on the die temperature.
uint16_t ddi_bc_hwGetMaxCurrent (void)
 Report the maximum charging current.
bool ddi_bc_hwIsDcdcOn (void)
 Checks to see if the DCDC has been manually enabled.
int ddi_bc_hwPowerSupplyIsPresent (void)
 Report on the presence of the power supply.
ddi_bc_Status_t ddi_bc_hwSetBiasCurrentSource (ddi_bc_BiasCurrentSource_t)
void ddi_bc_hwSetChargerPower (int on)
 Turn the charging hardware on or off.
ddi_bc_Status_t ddi_bc_hwSetChargingVoltage (uint16_t)
uint16_t ddi_bc_hwSetCurrentThreshold (uint16_t u16Threshold)
 Set the charging current threshold.
uint16_t ddi_bc_hwSetMaxCurrent (uint16_t u16Limit)
 Set the maximum charging current.
uint16_t ddi_bc_hwSettingToCurrent (uint8_t u8Setting)
 Convert a hardware current setting to a value in mA.
ddi_bc_Status_t ddi_bc_Init (ddi_bc_Cfg_t *pCfg)
 Initialize the Battery Charger.
void ddi_bc_QueryCfg (ddi_bc_Cfg_t *pCfg)
 Report the Battery Charger configuration.
int ddi_bc_RampGetAmbientTempAlarm (void)
 Reports the state of the ambient temperature alarm.
int ddi_bc_RampGetBatteryTempAlarm (void)
 Reports the state of the battery temperature alarm.
int ddi_bc_RampGetDieTempAlarm (void)
 Reports the state of the die temperature alarm.
uint16_t ddi_bc_RampGetLimit (void)
 Report the current limit.
uint16_t ddi_bc_RampGetTarget (void)
 Report the target.
void ddi_bc_RampReset ()
 Reset the current ramp.
uint16_t ddi_bc_RampSetLimit (uint16_t u16Limit)
 Set the current limit.
uint16_t ddi_bc_RampSetTarget (uint16_t u16Target)
 Set the target current.
ddi_bc_Status_t ddi_bc_RampStep (uint32_t u32Time)
 Step the current ramp.
void ddi_bc_RampUpdateAlarms ()
 Update alarms.
ddi_bc_Status_t ddi_bc_SetBroken (void)
 Declare the battery to be broken.
uint16_t ddi_bc_SetCurrentLimit (uint16_t u16Limit)
 Set the current limit.
uint16_t ddi_bc_SetCurrentThreshold (uint16_t u16Current)
 Set the current threshold.
ddi_bc_Status_t ddi_bc_SetDisable (void)
 Disable the Battery Charger.
ddi_bc_Status_t ddi_bc_SetEnable (void)
 Enable the Battery Charger.
ddi_bc_Status_t ddi_bc_SetFixed (void)
 Declare the battery to be fixed.
ddi_bc_Status_t ddi_bc_SetNewPeriodAndSlope (uint32_t u32StateMachinePeriod, uint16_t u16CurrentRampSlope)
 Set the battery charger state machine period.
void ddi_bc_ShutDown (void)
 Shut down the Battery Charger.
ddi_bc_Status_t ddi_bc_StateMachine (void)
 Advances the state machine.
static ddi_bc_Status_t ddi_bc_ToppingOff (void)
 Topping Off state function.
static ddi_bc_Status_t ddi_bc_Uninitialized (void)
 Uninitialized state function.
static ddi_bc_Status_t ddi_bc_WaitingToCharge (void)
 Waitin to Charge state function.
ddi_bc_Status_t stateFunctionTable (void)
 The state function table.
static void TransitionToBroken (void)
 Transition to the Broken state.
static void TransitionToCharging (void)
 Transition to the Charging state.
static void TransitionToConditioning (void)
 Transition to the Conditioning state.
static void TransitionToToppingOff (void)
 Transition to the Topping Off state.
static void TransitionToWaitingToCharge (void)
 Transition to the Waiting to Charge state.

Variables

bool bRestartChargeCycle = true
bool bRestartChargeCycle
ddi_bc_BrokenReason_t ddi_bc_gBrokenReason = DDI_BC_BROKEN_UNINITIALIZED
ddi_bc_BrokenReason_t ddi_bc_gBrokenReason
ddi_bc_Cfg_t g_ddi_bc_Configuration
 This structure holds the current Battery Charger configuration.
ddi_bc_Cfg_t g_ddi_bc_Configuration
 This structure holds the current Battery Charger configuration.
bool g_ddi_bc_Configured
ddi_bc_State_t g_ddi_bc_State
 The current state.
ddi_bc_State_t g_ddi_bc_State = DDI_BC_STATE_UNINITIALIZED
 The current state.
uint32_t g_ddi_bc_u32StateTimer = 0
uint32_t g_ddi_bc_u32StateTimer
static ddi_bc_RampControl_t g_RampControl
 This structure contains control information for the current ramp.


Generated by  Doxygen 1.6.0   Back to index