summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-04-24 17:55:01 -0700
committerRandall Spangler <rspangler@chromium.org>2012-04-24 18:34:46 -0700
commit470916fb0f856945f2a93c7fd160845b5f659be1 (patch)
tree18652a5cff68223ec72650afc12e1e2e727c8529 /chip
parent135f14bf498ab19b6e75efc3a0d18ef7c8a8752d (diff)
downloadchrome-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')
-rw-r--r--chip/lm4/adc.c8
-rw-r--r--chip/lm4/clock.c11
-rw-r--r--chip/lm4/eeprom.c39
-rw-r--r--chip/lm4/i2c.c29
-rw-r--r--chip/lm4/peci.c7
-rw-r--r--chip/lm4/pwm.c53
-rw-r--r--chip/lm4/uart.c4
-rw-r--r--chip/stm32l/dma.c19
-rw-r--r--chip/stm32l/gpio.c10
-rw-r--r--chip/stm32l/i2c.c27
10 files changed, 103 insertions, 104 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++);
diff --git a/chip/stm32l/dma.c b/chip/stm32l/dma.c
index 6ab971d34b..f357c7b6c3 100644
--- a/chip/stm32l/dma.c
+++ b/chip/stm32l/dma.c
@@ -6,9 +6,12 @@
#include "dma.h"
#include "registers.h"
#include "timer.h"
-#include "uart.h"
#include "util.h"
+/* Console output macros */
+#define CPUTS(outstr) cputs(CC_DMA, outstr)
+#define CPRINTF(format, args...) cprintf(CC_DMA, format, ## args)
+
/**
* Get a pointer to a DMA channel.
@@ -110,17 +113,17 @@ void dma_check(int channel, char *buff)
chan = get_channel(channel);
count = REG32(&chan->cndtr);
- uart_printf("c=%d\n", count);
+ CPRINTF("c=%d\n", count);
udelay(1000 * 100);
- uart_printf("c=%d\n",
+ CPRINTF("c=%d\n",
REG32(&chan->cndtr));
for (i = 0; i < count; i++)
- uart_printf("%02x ", buff[i]);
+ CPRINTF("%02x ", buff[i]);
udelay(1000 * 100);
- uart_printf("c=%d\n",
+ CPRINTF("c=%d\n",
REG32(&chan->cndtr));
for (i = 0; i < count; i++)
- uart_printf("%02x ", buff[i]);
+ CPRINTF("%02x ", buff[i]);
}
/* Run a check of memory-to-memory DMA */
@@ -155,8 +158,8 @@ void dma_test(void)
ctrl |= DMA_EN;
REG32(&chan->ccr) = ctrl;
for (i = 0; i < count; i++)
- uart_printf("%d/%d ", periph[i], memory[i]);
- uart_printf("\ncount=%d\n", REG32(&chan->cndtr));
+ CPRINTF("%d/%d ", periph[i], memory[i]);
+ CPRINTF("\ncount=%d\n", REG32(&chan->cndtr));
}
#endif /* CONFIG_TEST */
diff --git a/chip/stm32l/gpio.c b/chip/stm32l/gpio.c
index d56efa32d4..5545b741a0 100644
--- a/chip/stm32l/gpio.c
+++ b/chip/stm32l/gpio.c
@@ -6,13 +6,17 @@
/* GPIO module for Chrome EC */
#include "board.h"
+#include "console.h"
#include "gpio.h"
#include "hooks.h"
#include "registers.h"
#include "task.h"
-#include "uart.h"
#include "util.h"
+/* Console output macros */
+#define CPUTS(outstr) cputs(CC_GPIO, outstr)
+#define CPRINTF(format, args...) cprintf(CC_GPIO, format, ## args)
+
/* Signal information from board.c. Must match order from enum gpio_signal. */
extern const struct gpio_info gpio_list[GPIO_COUNT];
@@ -151,8 +155,8 @@ int gpio_enable_interrupt(enum gpio_signal signal)
#ifdef CONFIG_DEBUG
if (exti_events[bit]) {
- uart_printf("Overriding %s with %s on EXTI%d\n",
- exti_events[bit]->name, g->name, bit);
+ CPRINTF("Overriding %s with %s on EXTI%d\n",
+ exti_events[bit]->name, g->name, bit);
}
#endif
exti_events[bit] = g;
diff --git a/chip/stm32l/i2c.c b/chip/stm32l/i2c.c
index 0c4aff57de..1ff3b88f90 100644
--- a/chip/stm32l/i2c.c
+++ b/chip/stm32l/i2c.c
@@ -12,7 +12,10 @@
#include "message.h"
#include "registers.h"
#include "task.h"
-#include "uart.h"
+
+/* Console output macros */
+#define CPUTS(outstr) cputs(CC_I2C, outstr)
+#define CPRINTF(format, args...) cprintf(CC_I2C, format, ## args)
/* 8-bit I2C slave address */
#define I2C_ADDRESS 0xec
@@ -108,7 +111,7 @@ void i2c2_work_task(void)
/* RxNE; AP issued write command */
i2c_read_raw(I2C2, &i2c_xmit_mode[I2C2], 1);
#ifdef CONFIG_DEBUG
- uart_printf("%s: i2c2_xmit_mode: %02x\n",
+ CPRINTF("%s: i2c2_xmit_mode: %02x\n",
__func__, i2c_xmit_mode[I2C2]);
#endif
} else if (tmp16 & (1 << 7)) {
@@ -118,7 +121,7 @@ void i2c2_work_task(void)
if (msg_len > 0) {
i2c_write_raw(I2C2, out_msg, msg_len);
} else {
- uart_printf("%s: unexpected mode %u\n",
+ CPRINTF("%s: unexpected mode %u\n",
__func__, i2c_xmit_mode[I2C2]);
}
}
@@ -138,24 +141,24 @@ static void i2c_event_handler(int port)
STM32L_I2C_SR1(port);
STM32L_I2C_SR2(port);
#ifdef CONFIG_DEBUG
- uart_printf("%s: ADDR\n", __func__);
+ CPRINTF("%s: ADDR\n", __func__);
#endif
} else if (i2c_sr1[port] & (1 << 2)) {
;
#ifdef CONFIG_DEBUG
- uart_printf("%s: BTF\n", __func__);
+ CPRINTF("%s: BTF\n", __func__);
#endif
} else if (i2c_sr1[port] & (1 << 4)) {
/* clear STOPF bit by reading SR1 and then writing CR1 */
STM32L_I2C_SR1(port);
STM32L_I2C_CR1(port) = STM32L_I2C_CR1(port);
#ifdef CONFIG_DEBUG
- uart_printf("%s: STOPF\n", __func__);
+ CPRINTF("%s: STOPF\n", __func__);
#endif
} else {
;
#ifdef CONFIG_DEBUG
- uart_printf("%s: unknown event\n", __func__);
+ CPRINTF("%s: unknown event\n", __func__);
#endif
}
@@ -176,12 +179,12 @@ static void i2c_error_handler(int port)
if (i2c_sr1[port] & 1 << 10) {
/* ACK failed (NACK); expected when AP reads final byte.
* Software must clear AF bit. */
- uart_printf("%s: AF detected\n", __func__);
+ CPRINTF("%s: AF detected\n", __func__);
}
- uart_printf("%s: tx byte count: %u, rx_byte_count: %u\n",
+ CPRINTF("%s: tx byte count: %u, rx_byte_count: %u\n",
__func__, tx_byte_count, rx_byte_count);
- uart_printf("%s: I2C_SR1(%s): 0x%04x\n", __func__, port, i2c_sr1[port]);
- uart_printf("%s: I2C_SR2(%s): 0x%04x\n",
+ CPRINTF("%s: I2C_SR1(%s): 0x%04x\n", __func__, port, i2c_sr1[port]);
+ CPRINTF("%s: I2C_SR2(%s): 0x%04x\n",
__func__, port, STM32L_I2C_SR2(port));
#endif
@@ -219,7 +222,7 @@ static int i2c_init2(void)
task_enable_irq(STM32L_IRQ_I2C2_EV);
task_enable_irq(STM32L_IRQ_I2C2_ER);
- uart_printf("done\n");
+ CPUTS("done\n");
return EC_SUCCESS;
}