示例#1
0
文件: pmu.c 项目: DeanBoro/openiBoot
PowerSupplyType pmu_get_power_supply() {
	uint8_t val = pmu_get_reg(PMU_POWERSUPPLY_REG);
	
	if (val & PMU_POWERSUPPLY_USB)
		return identify_usb_charger();
	else if (val & PMU_POWERSUPPLY_FIREWIRE)
		return PowerSupplyTypeFirewire;
	else
		return PowerSupplyTypeBattery;
}
示例#2
0
文件: pmu.c 项目: kaka22ip/openiBoot
PowerSupplyType pmu_get_power_supply() {
	if (pmu_get_reg(0x4) & 1<<3) {
		// USB powered
		return identify_usb_charger();
	} else if (pmu_get_reg(0x6) & 1<<3) {
		// Firewire powered
		return PowerSupplyTypeFirewire;
	} else {
		// Battery powered
		return PowerSupplyTypeBattery;
	}
}
示例#3
0
PowerSupplyType iphone_pmu_get_power_supply(void) {
	int mbcs1 = iphone_pmu_get_reg(PMU_MBCS1);

	if(mbcs1 & PMU_MBCS1_ADAPTPRES)
		return PowerSupplyTypeFirewire;

	if(mbcs1 & PMU_MBCS1_USBOK)
		return identify_usb_charger();
	else
		return PowerSupplyTypeBattery;

}