From f6ed4f830666b7281308cca4bf90e0000dcfaef4 Mon Sep 17 00:00:00 2001 From: Cástor Muñoz Date: Wed, 25 May 2016 23:18:33 +0200 Subject: iPod Classic: use PMU interrupts to detect accessories - Speed auto detection is launched when an accessory is inserted, so the user doesn't need to modify settings to use accessories that operates at different speeds (or when the same accessory is unplugged and plugged again). - UART controller is disabled when no accessory is inserted, not much powersave but everything counts. Change-Id: If20c3617c2a87b6277fd7e0270031030c44fa953 --- firmware/target/arm/s5l8702/debug-s5l8702.c | 38 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 17 deletions(-) (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 48a20a97c2..b274b5fc0a 100644 --- a/firmware/target/arm/s5l8702/debug-s5l8702.c +++ b/firmware/target/arm/s5l8702/debug-s5l8702.c @@ -138,22 +138,26 @@ bool dbg_hw_info(void) else if(state==2) { extern struct uartc_port ser_port; - int tx_stat, rx_stat, tx_speed, rx_speed; - char line_cfg[4]; - int abr_stat; - uint32_t abr_cnt; - char *abrstatus[] = {"Idle", "Launched", "Counting", "Abnormal"}; - - uartc_port_get_line_info(&ser_port, - &tx_stat, &rx_stat, &tx_speed, &rx_speed, line_cfg); - abr_stat = uartc_port_get_abr_info(&ser_port, &abr_cnt); - - _DEBUG_PRINTF("UART %d:", ser_port.id); - line++; - _DEBUG_PRINTF("line: %s", line_cfg); - _DEBUG_PRINTF("Tx: %s, speed: %d", tx_stat ? "On":"Off", tx_speed); - _DEBUG_PRINTF("Rx: %s, speed: %d", rx_stat ? "On":"Off", rx_speed); - _DEBUG_PRINTF("ABR: %s, cnt: %u", abrstatus[abr_stat], abr_cnt); + bool opened = !!ser_port.uartc->port_l[ser_port.id]; + _DEBUG_PRINTF("UART %d: %s", ser_port.id, opened ? "opened":"closed"); + if (opened) + { + int tx_stat, rx_stat, tx_speed, rx_speed; + char line_cfg[4]; + int abr_stat; + uint32_t abr_cnt; + char *abrstatus[] = {"Idle", "Launched", "Counting", "Abnormal"}; + + uartc_port_get_line_info(&ser_port, + &tx_stat, &rx_stat, &tx_speed, &rx_speed, line_cfg); + abr_stat = uartc_port_get_abr_info(&ser_port, &abr_cnt); + + line++; + _DEBUG_PRINTF("line: %s", line_cfg); + _DEBUG_PRINTF("Tx: %s, speed: %d", tx_stat ? "On":"Off", tx_speed); + _DEBUG_PRINTF("Rx: %s, speed: %d", rx_stat ? "On":"Off", rx_speed); + _DEBUG_PRINTF("ABR: %s, cnt: %u", abrstatus[abr_stat], abr_cnt); + } line++; _DEBUG_PRINTF("n_tx_bytes: %u", ser_port.n_tx_bytes); _DEBUG_PRINTF("n_rx_bytes: %u", ser_port.n_rx_bytes); @@ -162,7 +166,7 @@ bool dbg_hw_info(void) _DEBUG_PRINTF("n_frame_err: %u", ser_port.n_frame_err); _DEBUG_PRINTF("n_break_detect: %u", ser_port.n_break_detect); _DEBUG_PRINTF("ABR n_abnormal: %u %u", - ser_port.n_abnormal0, ser_port.n_abnormal1); + ser_port.n_abnormal0, ser_port.n_abnormal1); } #endif else -- cgit v1.2.3