diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-04-24 17:55:01 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-04-24 18:34:46 -0700 |
commit | 470916fb0f856945f2a93c7fd160845b5f659be1 (patch) | |
tree | 18652a5cff68223ec72650afc12e1e2e727c8529 /chip/lm4 | |
parent | 135f14bf498ab19b6e75efc3a0d18ef7c8a8752d (diff) | |
download | chrome-ec-470916fb0f856945f2a93c7fd160845b5f659be1.tar.gz |
Use console output instead of uart output for console commands
This completes console output cleanup. The remaining calls to
uart_puts() and uart_printf() actually need to be that way.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=chrome-os-partner:7464
TEST=manual
Change-Id: Ib1d6d370d30429017b3d11994894fece75fab6ea
Diffstat (limited to 'chip/lm4')
-rw-r--r-- | chip/lm4/adc.c | 8 | ||||
-rw-r--r-- | chip/lm4/clock.c | 11 | ||||
-rw-r--r-- | chip/lm4/eeprom.c | 39 | ||||
-rw-r--r-- | chip/lm4/i2c.c | 29 | ||||
-rw-r--r-- | chip/lm4/peci.c | 7 | ||||
-rw-r--r-- | chip/lm4/pwm.c | 53 | ||||
-rw-r--r-- | chip/lm4/uart.c | 4 |
7 files changed, 70 insertions, 81 deletions
diff --git a/chip/lm4/adc.c b/chip/lm4/adc.c index 18f8dbe3a7..d265d0f283 100644 --- a/chip/lm4/adc.c +++ b/chip/lm4/adc.c @@ -13,7 +13,6 @@ #include "registers.h" #include "task.h" #include "timer.h" -#include "uart.h" #include "util.h" extern const struct adc_t adc_channels[ADC_CH_COUNT]; @@ -181,7 +180,7 @@ DECLARE_IRQ(LM4_IRQ_ADC0_SS3, ss3_interrupt, 2); static int command_ectemp(int argc, char **argv) { int t = adc_read_channel(ADC_CH_EC_TEMP); - uart_printf("EC temperature is %d K = %d C\n", t, t-273); + ccprintf("EC temperature is %d K = %d C\n", t, t-273); return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(ectemp, command_ectemp); @@ -192,9 +191,8 @@ static int command_adc(int argc, char **argv) int i; for (i = 0; i < ADC_CH_COUNT; ++i) - uart_printf("ADC channel \"%s\" = %d\n", - adc_channels[i].name, - adc_read_channel(i)); + ccprintf("ADC channel \"%s\" = %d\n", + adc_channels[i].name, adc_read_channel(i)); return EC_SUCCESS; } diff --git a/chip/lm4/clock.c b/chip/lm4/clock.c index 84608f7ee7..81e36c001e 100644 --- a/chip/lm4/clock.c +++ b/chip/lm4/clock.c @@ -15,7 +15,6 @@ #include "system.h" #include "task.h" #include "timer.h" -#include "uart.h" #include "util.h" #define PLL_CLOCK 66666667 /* System clock = 200MHz PLL/3 = 66.667MHz */ @@ -113,8 +112,8 @@ static int command_sleep(int argc, char **argv) gpio_set_level(GPIO_DEBUG_LED, 0); #endif - uart_printf("Going to sleep : level %d clock %d...\n", level, clock); - uart_flush_output(); + ccprintf("Going to sleep : level %d clock %d...\n", level, clock); + cflush(); /* clock setting */ if (clock) { @@ -161,8 +160,8 @@ static int command_sleep(int argc, char **argv) } if (uartfbrd) { - uart_printf("We are still alive. RCC=%08x\n", LM4_SYSTEM_RCC); - uart_flush_output(); + ccprintf("We are still alive. RCC=%08x\n", LM4_SYSTEM_RCC); + cflush(); } asm volatile("cpsid i"); @@ -195,7 +194,7 @@ static int command_pll(int argc, char **argv) { /* Toggle the PLL */ clock_enable_pll(LM4_SYSTEM_RCC & LM4_SYSTEM_RCC_BYPASS ? 1 : 0); - uart_printf("Clock frequency is now %d\n", clock_get_freq()); + ccprintf("Clock frequency is now %d\n", clock_get_freq()); return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(pll, command_pll); diff --git a/chip/lm4/eeprom.c b/chip/lm4/eeprom.c index c605d0e560..f5783ad664 100644 --- a/chip/lm4/eeprom.c +++ b/chip/lm4/eeprom.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. +/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -7,7 +7,6 @@ #include "eeprom.h" #include "console.h" -#include "uart.h" #include "registers.h" #include "util.h" @@ -120,9 +119,9 @@ int eeprom_hide(int block) static int command_eeprom_info(int argc, char **argv) { - uart_printf("EEPROM: %d blocks of %d bytes\n", - eeprom_get_block_count(), eeprom_get_block_size()); - uart_printf(" Block-hide flags: 0x%08x\n", LM4_EEPROM_EEHIDE); + ccprintf("EEPROM: %d blocks of %d bytes\n", + eeprom_get_block_count(), eeprom_get_block_size()); + ccprintf(" Block-hide flags: 0x%08x\n", LM4_EEPROM_EEHIDE); return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(eeinfo, command_eeprom_info); @@ -137,28 +136,27 @@ static int command_eeprom_read(int argc, char **argv) uint32_t d; if (argc < 2) { - uart_puts("Usage: eeread <block> [offset]\n"); + ccputs("Usage: eeread <block> [offset]\n"); return EC_ERROR_UNKNOWN; } block = strtoi(argv[1], &e, 0); if (*e) { - uart_puts("Invalid block\n"); + ccputs("Invalid block\n"); return EC_ERROR_UNKNOWN; } if (argc > 2) { offset = strtoi(argv[2], &e, 0); if (*e) { - uart_puts("Invalid offset\n"); + ccputs("Invalid offset\n"); return EC_ERROR_UNKNOWN; } } rv = eeprom_read(block, offset, sizeof(d), (char *)&d); if (rv == EC_SUCCESS) - uart_printf("Block %d offset %d = 0x%08x\n", - block, offset, d); + ccprintf("Block %d offset %d = 0x%08x\n", block, offset, d); return rv; } DECLARE_CONSOLE_COMMAND(eeread, command_eeprom_read); @@ -173,31 +171,30 @@ static int command_eeprom_write(int argc, char **argv) uint32_t d; if (argc < 4) { - uart_puts("Usage: eeread <block> <offset> <data>\n"); + ccputs("Usage: eeread <block> <offset> <data>\n"); return EC_ERROR_UNKNOWN; } block = strtoi(argv[1], &e, 0); if (*e) { - uart_puts("Invalid block\n"); + ccputs("Invalid block\n"); return EC_ERROR_UNKNOWN; } offset = strtoi(argv[2], &e, 0); if (*e) { - uart_puts("Invalid offset\n"); + ccputs("Invalid offset\n"); return EC_ERROR_UNKNOWN; } d = strtoi(argv[3], &e, 0); if (*e) { - uart_puts("Invalid data\n"); + ccputs("Invalid data\n"); return EC_ERROR_UNKNOWN; } - uart_printf("Writing 0x%08x to block %d offset %d...\n", - d, block, offset); + ccprintf("Writing 0x%08x to block %d offset %d...\n", d, block, offset); rv = eeprom_write(block, offset, sizeof(d), (char *)&d); if (rv == EC_SUCCESS) - uart_puts("done.\n"); + ccputs("done.\n"); return rv; } DECLARE_CONSOLE_COMMAND(eewrite, command_eeprom_write); @@ -210,20 +207,20 @@ static int command_eeprom_hide(int argc, char **argv) int rv; if (argc < 2) { - uart_puts("Usage: eehide <block>\n"); + ccputs("Usage: eehide <block>\n"); return EC_ERROR_UNKNOWN; } block = strtoi(argv[1], &e, 0); if (*e) { - uart_puts("Invalid block\n"); + ccputs("Invalid block\n"); return EC_ERROR_UNKNOWN; } - uart_printf("Hiding EEPROM block %d...\n", block); + ccprintf("Hiding EEPROM block %d...\n", block); rv = eeprom_hide(block); if (rv == EC_SUCCESS) - uart_printf("Done.\n"); + ccprintf("Done.\n"); return rv; } DECLARE_CONSOLE_COMMAND(eehide, command_eeprom_hide); diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c index 8a5a93b3c8..7daf585a2e 100644 --- a/chip/lm4/i2c.c +++ b/chip/lm4/i2c.c @@ -14,7 +14,6 @@ #include "task.h" #include "timer.h" #include "registers.h" -#include "uart.h" #include "util.h" #define NUM_PORTS 6 @@ -318,24 +317,24 @@ static void scan_bus(int port, char *desc) int rv; int a; - uart_printf("Scanning %s I2C bus (%d)...\n", desc, port); + ccprintf("Scanning %s I2C bus (%d)...\n", desc, port); mutex_lock(port_mutex + port); for (a = 0; a < 0x100; a += 2) { - uart_puts("."); + ccputs("."); /* Do a single read */ LM4_I2C_MSA(port) = a | 0x01; LM4_I2C_MCS(port) = 0x07; rv = wait_idle(port); if (rv == EC_SUCCESS) - uart_printf("\nFound device at 8-bit addr 0x%02x\n", a); + ccprintf("\nFound device at 8-bit addr 0x%02x\n", a); } mutex_unlock(port_mutex + port); - uart_puts("\n"); + ccputs("\n"); } @@ -347,37 +346,37 @@ static int command_i2cread(int argc, char **argv) int d, i; if (argc < 3) { - uart_puts("Usage: i2cread <port> <addr> [count]\n"); + ccputs("Usage: i2cread <port> <addr> [count]\n"); return EC_ERROR_UNKNOWN; } port = strtoi(argv[1], &e, 0); if (*e) { - uart_puts("Invalid port\n"); + ccputs("Invalid port\n"); return EC_ERROR_INVAL; } if (port != I2C_PORT_THERMAL && port != I2C_PORT_BATTERY && port != I2C_PORT_CHARGER) { - uart_puts("Unsupported port\n"); + ccputs("Unsupported port\n"); return EC_ERROR_UNKNOWN; } addr = strtoi(argv[2], &e, 0); if (*e || (addr & 0x01)) { - uart_puts("Invalid addr; try 'i2cscan' command\n"); + ccputs("Invalid addr; try 'i2cscan' command\n"); return EC_ERROR_INVAL; } if (argc > 3) { count = strtoi(argv[3], &e, 0); if (*e) { - uart_puts("Invalid count\n"); + ccputs("Invalid count\n"); return EC_ERROR_INVAL; } } - uart_printf("Reading %d bytes from I2C device %d:0x%02x...\n", - count, port, addr); + ccprintf("Reading %d bytes from I2C device %d:0x%02x...\n", + count, port, addr); mutex_lock(port_mutex + port); LM4_I2C_MSA(port) = addr | 0x01; for (i = 0; i < count; i++) { @@ -391,10 +390,10 @@ static int command_i2cread(int argc, char **argv) return rv; } d = LM4_I2C_MDR(port) & 0xff; - uart_printf("0x%02x ", d); + ccprintf("0x%02x ", d); } mutex_unlock(port_mutex + port); - uart_puts("\n"); + ccputs("\n"); return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(i2cread, command_i2cread); @@ -405,7 +404,7 @@ static int command_scan(int argc, char **argv) scan_bus(I2C_PORT_THERMAL, "thermal"); scan_bus(I2C_PORT_BATTERY, "battery"); scan_bus(I2C_PORT_CHARGER, "charger"); - uart_puts("done.\n"); + ccputs("done.\n"); return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(i2cscan, command_scan); diff --git a/chip/lm4/peci.c b/chip/lm4/peci.c index 8accb1d1d5..6bbdaa832c 100644 --- a/chip/lm4/peci.c +++ b/chip/lm4/peci.c @@ -13,7 +13,6 @@ #include "peci.h" #include "registers.h" #include "temp_sensor.h" -#include "uart.h" #include "util.h" /* Max junction temperature for processor in degrees C */ @@ -102,11 +101,11 @@ static int command_peci_temp(int argc, char **argv) { int t = peci_get_cpu_temp(); if (t == -1) { - uart_puts("Error reading CPU temperature via PECI\n"); - uart_printf("Error code = 0x%04x\n", LM4_PECI_M0D0 & 0xffff); + ccputs("Error reading CPU temperature via PECI\n"); + ccprintf("Error code = 0x%04x\n", LM4_PECI_M0D0 & 0xffff); return EC_ERROR_UNKNOWN; } - uart_printf("Current CPU temperature = %d K = %d C\n", t, t - 273); + ccprintf("Current CPU temperature = %d K = %d C\n", t, t - 273); return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(pecitemp, command_peci_temp); diff --git a/chip/lm4/pwm.c b/chip/lm4/pwm.c index 0a37ffc5b8..e947e0a55f 100644 --- a/chip/lm4/pwm.c +++ b/chip/lm4/pwm.c @@ -9,15 +9,14 @@ #include "console.h" #include "gpio.h" #include "hooks.h" +#include "lpc.h" +#include "lpc_commands.h" #include "pwm.h" #include "registers.h" -#include "uart.h" -#include "util.h" #include "task.h" #include "thermal.h" #include "timer.h" -#include "lpc.h" -#include "lpc_commands.h" +#include "util.h" /* Maximum RPM for fan controller */ #define MAX_RPM 0x1fff @@ -145,17 +144,17 @@ void pwm_task(void) static int command_fan_info(int argc, char **argv) { - uart_printf("Fan actual speed: %4d rpm\n", pwm_get_fan_rpm()); - uart_printf(" target speed: %4d rpm\n", - (LM4_FAN_FANCMD(FAN_CH_CPU) & MAX_RPM) * CPU_FAN_SCALE); - uart_printf(" duty cycle: %d%%\n", - ((LM4_FAN_FANCMD(FAN_CH_CPU) >> 16)) * 100 / MAX_PWM); - uart_printf(" status: %d\n", - (LM4_FAN_FANSTS >> (2 * FAN_CH_CPU)) & 0x03); - uart_printf(" enabled: %s\n", - LM4_FAN_FANCTL & (1 << FAN_CH_CPU) ? "yes" : "no"); - uart_printf(" powered: %s\n", - gpio_get_level(GPIO_ENABLE_VS) ? "yes" : "no"); + ccprintf("Fan actual speed: %4d rpm\n", pwm_get_fan_rpm()); + ccprintf(" target speed: %4d rpm\n", + (LM4_FAN_FANCMD(FAN_CH_CPU) & MAX_RPM) * CPU_FAN_SCALE); + ccprintf(" duty cycle: %d%%\n", + ((LM4_FAN_FANCMD(FAN_CH_CPU) >> 16)) * 100 / MAX_PWM); + ccprintf(" status: %d\n", + (LM4_FAN_FANSTS >> (2 * FAN_CH_CPU)) & 0x03); + ccprintf(" enabled: %s\n", + LM4_FAN_FANCTL & (1 << FAN_CH_CPU) ? "yes" : "no"); + ccprintf(" powered: %s\n", + gpio_get_level(GPIO_ENABLE_VS) ? "yes" : "no"); return EC_SUCCESS; } @@ -169,17 +168,17 @@ static int command_fan_set(int argc, char **argv) int rv; if (argc < 2) { - uart_puts("Usage: fanset <rpm>\n"); + ccputs("Usage: fanset <rpm>\n"); return EC_ERROR_UNKNOWN; } rpm = strtoi(argv[1], &e, 0); if (*e) { - uart_puts("Invalid speed\n"); + ccputs("Invalid speed\n"); return EC_ERROR_UNKNOWN; } - uart_printf("Setting fan speed to %d rpm...\n", rpm); + ccprintf("Setting fan speed to %d rpm...\n", rpm); /* Move the fan to automatic control */ if (LM4_FAN_FANCH(FAN_CH_CPU) & 0x0001) { @@ -196,7 +195,7 @@ static int command_fan_set(int argc, char **argv) rv = pwm_set_fan_target_rpm(rpm); if (rv == EC_SUCCESS) - uart_printf("Done.\n"); + ccprintf("Done.\n"); return rv; } @@ -210,18 +209,18 @@ static int command_fan_duty(int argc, char **argv) char *e; if (argc < 2) { - uart_puts("Usage: fanduty <percent>\n"); + ccputs("Usage: fanduty <percent>\n"); return EC_ERROR_UNKNOWN; } d = strtoi(argv[1], &e, 0); if (*e) { - uart_puts("Invalid duty cycle\n"); + ccputs("Invalid duty cycle\n"); return EC_ERROR_UNKNOWN; } pwm = (MAX_PWM * d) / 100; - uart_printf("Setting fan duty cycle to %d%% = 0x%x...\n", d, pwm); + ccprintf("Setting fan duty cycle to %d%% = 0x%x...\n", d, pwm); /* Move the fan to manual control */ if (!(LM4_FAN_FANCH(FAN_CH_CPU) & 0x0001)) { @@ -251,21 +250,21 @@ static int command_kblight(int argc, char **argv) int i; if (argc < 2) { - uart_printf("Keyboard backlight is at %d%%\n", - pwm_get_keyboard_backlight()); + ccprintf("Keyboard backlight is at %d%%\n", + pwm_get_keyboard_backlight()); return EC_SUCCESS; } i = strtoi(argv[1], &e, 0); if (*e) { - uart_puts("Invalid percent\n"); + ccputs("Invalid percent\n"); return EC_ERROR_UNKNOWN; } - uart_printf("Setting keyboard backlight to %d%%...\n", i); + ccprintf("Setting keyboard backlight to %d%%...\n", i); rv = pwm_set_keyboard_backlight(i); if (rv == EC_SUCCESS) - uart_printf("Done.\n"); + ccprintf("Done.\n"); return rv; } DECLARE_CONSOLE_COMMAND(kblight, command_kblight); diff --git a/chip/lm4/uart.c b/chip/lm4/uart.c index 652f1edf37..baa8129602 100644 --- a/chip/lm4/uart.c +++ b/chip/lm4/uart.c @@ -5,8 +5,6 @@ /* UART module for Chrome EC */ -#include <stdarg.h> - #include "board.h" #include "console.h" #include "gpio.h" @@ -246,7 +244,7 @@ static int command_comxtest(int argc, char **argv) /* Put characters to COMX port */ const char *c = argc > 1 ? argv[1] : "testing comx output!"; - uart_printf("Writing \"%s\\r\\n\" to COMx UART...\n", c); + ccprintf("Writing \"%s\\r\\n\" to COMx UART...\n", c); while (*c) uart_comx_putc_wait(*c++); |