From adbd2969e6e6fd584d46ef60a3fa40bf878d7e00 Mon Sep 17 00:00:00 2001 From: Cástor Muñoz Date: Fri, 12 Aug 2016 02:37:45 +0200 Subject: iPod Classic: ADC updates Add code to read USB D+/D- and accessory ADCs, it is shown in HW debug menu, might be useful in future for RB and/or the bootloader to identify external USB chargers. Change-Id: Ia48ca5e06bb7ddc52bb55abedde6734653ce8dba --- firmware/target/arm/s5l8702/debug-s5l8702.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'firmware/target/arm/s5l8702/debug-s5l8702.c') diff --git a/firmware/target/arm/s5l8702/debug-s5l8702.c b/firmware/target/arm/s5l8702/debug-s5l8702.c index a61a728d43..1bf59e94fe 100644 --- a/firmware/target/arm/s5l8702/debug-s5l8702.c +++ b/firmware/target/arm/s5l8702/debug-s5l8702.c @@ -19,6 +19,7 @@ * ****************************************************************************/ +#include #include #include "system.h" #include "config.h" @@ -28,6 +29,7 @@ #include "font.h" #include "storage.h" #include "power.h" +#include "adc.h" #include "pmu-target.h" #include "pcm-target.h" #ifdef HAVE_SERIAL @@ -133,12 +135,20 @@ bool dbg_hw_info(void) _DEBUG_PRINTF("accessory present: %s", pmu_accessory_present() ? "true" : "false"); #endif + line++; + _DEBUG_PRINTF("ADC:"); + _DEBUG_PRINTF("%s: %d mV", adc_name(ADC_BATTERY), + adc_read_battery_voltage()); + _DEBUG_PRINTF("%s: %d Ohms", adc_name(ADC_ACCESSORY), + adc_read_accessory_resistor()); + _DEBUG_PRINTF("USB D+: %d mV", adc_read_usbdata_voltage(true)); + _DEBUG_PRINTF("USB D-: %d mV", adc_read_usbdata_voltage(false)); line++; extern unsigned long i2c_rd_err, i2c_wr_err; _DEBUG_PRINTF("i2c rd/wr errors: %lu/%lu", i2c_rd_err, i2c_wr_err); } #ifdef UC870X_DEBUG - else if(state==2) + else if(state==(max_states-1)) { extern struct uartc_port ser_port; bool opened = !!ser_port.uartc->port_l[ser_port.id]; -- cgit v1.2.3