summaryrefslogtreecommitdiff
path: root/include/uart.h
Commit message (Collapse)AuthorAgeFilesLines
* common: uart: split off printf and like functions into separate moduleJack Rosenthal2021-02-111-0/+16
| | | | | | | | | | | | | | | | | | This separates the high-level uart output functions like uart_printf and uart_putc from the uart buffering module, allowing the buffering to be implemented separately from the output functions. The contract between this module and the uart_buffering layer is to implement uart_tx_char_raw and uart_tx_start. BUG=b:178033156 BRANCH=none TEST=buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5fb62ca2be1fea04654eaadd7a3806ac0c586929 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685411 Reviewed-by: Simon Glass <sjg@chromium.org>
* uart.h: fix compilation inclusion guard placementVadim Bendebury2020-03-191-2/+2
| | | | | | | | | | | | | | | A recent change added a declaration after the compilation inclusion guard '#endif', this is a mistake, let's fix it. BRANCH=none BUG=none TEST=make buildall -j Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I9744b4ffddda3119dda9424e69537338a8c16a41 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2109313 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Nicolas Boichat <drinkcat@chromium.org>
* uart: Add uart_put_rawDaisuke Nojiri2020-01-241-1/+10
| | | | | | | | | | | | | | | | | | uart_put_raw sends byte stream without translating '\n' to '\r\n'. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/119329144,chromium:998135 BRANCH=none TEST=Boot Nami Change-Id: Iaac4244d45231bf5904d917f2f446f87e8e10c50 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1757273 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
* printf: Enable compile-time format checkingEvan Green2019-10-051-0/+1
| | | | | | | | | | | | | | | Add annotations to allow the compiler to check printf-style format strings in the EC. BUG=chromium:984041 TEST=make -j buildall BRANCH=None Change-Id: Ic39f37f8362372de7d289becea684d9da535599a Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1733101 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* host_command: Change host command return value to enum ec_statusTom Hughes2019-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the host command handler callback function returns an int, it's easy to accidentally mix up the enum ec_error_list and enum ec_status types. The host commands always expect an enum ec_status type, so we change the return value to be of that explicit type. Compilation will then fail if you accidentally try to return an enum ec_error_list value. Ran the following commands and then manually fixed up a few remaining instances that were not caught: git grep --name-only 'static int .*(struct host_cmd_handler_args \*args)' |\ xargs sed -i 's#static int \(.*\)(struct host_cmd_handler_args \*args)#\ static enum ec_status \1(struct host_cmd_handler_args \*args)##' git grep --name-only 'int .*(struct host_cmd_handler_args \*args)' |\ xargs sed -i 's#int \(.*\)(struct host_cmd_handler_args \*args)#\ enum ec_status \1(struct host_cmd_handler_args \*args)##' BRANCH=none BUG=chromium:1004831 TEST=make buildall -j Cq-Depend: chrome-internal:1872675 Change-Id: Id93df9387ac53d016a1594dba86c6642babbfd1e Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1816865 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* log: Preserve Kukui EC reset logs across every EC reboot on SRAM.Shannon Chen2019-08-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | On Kukui, we need to put console logs and reset reasons at fixed addresses on SRAM to save the information across each EC resets. Otherwise, EC will lose console logs and reset reasons after resetting EC. This CL ensures that the contents of reset and console logs will not be clobbered or cleared by putting mandatory symbols at a fixed location on SRAM. The values will only be reset when checksum or sanity check fails. BUG=b:133795403 TEST=1. On Kukui, shutdown AP, reboot AP, or sysjump, and see the previous logs before reboot will be kept on /var/log/croc_ec.log 2. Reset reasons can be viewed with ectool uptimeinfo BRANCH=master Change-Id: I19db49101fda1675dc2fdc047b7f14af77cdb6e6 Signed-off-by: Shannon Chen <shannc@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1716671 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Shannon Chen <shannc@chromium.org> Tested-by: Shannon Chen <shannc@chromium.org>
* uart_buffering: add tx_buffer_full() APIVadim Bendebury2019-06-271-0/+5
| | | | | | | | | | | | | | | | | To aid in system level UART console performance testing a test function needs to know when the UART console buffer is full. This patch provides an API for that. BRANCH=none BUG=b:38448364 TEST=verified proper operation of the chargen CLI command which uses this API. Change-Id: I5fbc6cf4031a5077c91cd4bb85ab6f4dfb18821e Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1679710 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-191-1/+1
| | | | | | | | | | | | | | | | Ran the following command: git grep -l 'Copyright (c)' | \ xargs sed -i 's/Copyright (c)/Copyright/g' BRANCH=none BUG=none TEST=make buildall -j Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* UART: Export uart_clear_input APIDaisuke Nojiri2019-02-081-0/+5
| | | | | | | | | | | | | | | | This patch exports the uart_clear_input API. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/119329144 BRANCH=none TEST=buildall Change-Id: Ib78b9dbca8ef9efb21c566888fd495b6cf313ada Reviewed-on: https://chromium-review.googlesource.com/1454987 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* UART: Add uart_put APIDaisuke Nojiri2019-02-081-0/+9
| | | | | | | | | | | | | | | | | | The uart_puts API takes a null-terminated string. This patch adds the uart_put API, which works like uart_puts but allows the caller to specify the data size. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/119329144 BRANCH=none TEST=buildall Change-Id: I18b2625f9a2339b68ca586b6f1b3c36511cb725c Reviewed-on: https://chromium-review.googlesource.com/1457576 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* uart_buffering: expose interface to support non-host commandWei-Han Chen2018-08-201-0/+32
| | | | | | | | | | | | | | | | | | | UART buffer could only be accessed by host command. For detachable devices, we don't want to enable all host commands. Refactor and expose an API to support accessing UART buffer directly, host command is not necessary. BRANCH=none BUG=b:70482333 TEST=tested on whiskers TEST=tested on nocturne Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I8a9bbad23fbd3c02df54cd7b5d59b0e8376756ac Reviewed-on: https://chromium-review.googlesource.com/1177094 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* stm32: move UART wake-up to uart codeVincent Palatin2018-06-131-0/+11
| | | | | | | | | | | | | | | | | | | Move the low-power mode UART register settings out of the STM32F0 low power mode code into the UART driver as a preparation for adding STM32H7 low power mode code. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=poppy BUG=b:75105319 TEST=make buildall Change-Id: Iecac8c387edd80c15fc3a211cf7969bbc6b8a15e Reviewed-on: https://chromium-review.googlesource.com/1096766 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* chip/npcx: Add support for pad-switching UARTNicolas Boichat2017-10-251-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NPCX5* only has one UART controller, which can be switched between 2 pads. We keep the default pad for EC console, however, we allow switching to the alternate pad for short, infrequent, transactions. Both pads are assumed to use the same baudrate and other line settings. When switching pad, we first configure the new pad, then switch off the old one, to avoid having no pad selected at a given time, see b/65526215#c26. Because of the added complexity of npcx_gpio2uart (and the fact that it uses the global variable "pad" define in uart.c), we move the implementation to uart.c (npcx_uart2gpio is also moved for consistency). When the pad is switched to alternate pad, characters input and output on the EC console (default pad) would be lost. To compensate for this, we: - Switch back to main pad in case of EC panic, so that output is shown on EC console. - Immediately abort current alternate pad transaction if a character is received on the default pad. Note, however, that the first character will be lost (this can be worked around by telling user to press enter, and have servod/FAFT always send 2 blank lines (instead of just one) before sending a command). - Inhibit pad switching for 500ms after receiving a character on default pad. Assuming a reasonable typing speed, this should allow developers to type console commands relatively comfortably, while not starving the alternate pad communication for too long. The logic above could be simplified significantly by implementing software flow control (XON/XOFF, see b/67026316). BRANCH=none BUG=b:65526215 TEST=While follow-up CL that writes long 1k buffers, the following works fine: - type 'uart' in EC console - Read battery power consumption from servod, which "types" in the EC console: while true; do dut-control ppvar_vbat_mw; sleep 1; done no failure is seen. TEST=Add this test code in uart_alt_pad_read_write, after the pad has been switched, and check that panic information is consistently printed correctly: { static int t; if (t++ > 20) t = t / ret; } Change-Id: I18feed2f8ca4eb85f40389f77dac3a46315310e7 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/659458 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* UART: Remove enable/disable interrupt functionsAnton Staaf2016-04-271-12/+0
| | | | | | | | | | | | | | | | These were not being used and complicate changes to the UART API. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I73e256f09f7ea72f0cc4831cc7ce391a7125e555 Reviewed-on: https://chromium-review.googlesource.com/340841 Commit-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* gpio: Refactor IRQ handler pointer out of gpio_listAseda Aboagye2015-04-101-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the gpio_info struct, we had a irq_handler pointer defined even though a majority of the GPIOs did not have irq handlers associated. By removing the irq_handler pointer out of the struct, we can save some space with some targets saving more than others. (For example, ~260 bytes for samus_pd). This change also brings about a new define: GPIO_INT(name, port, pin, flags, signal) And the existing GPIO macro has had the signal parameter removed since they were just NULL. GPIO(name, port, pin, flags) In each of the gpio.inc files, all the GPIOs with irq handlers must be defined at the top of the file. This is because their enum values from gpio_signal are used as the index to the gpio_irq_handlers table. BUG=chromium:471331 BRANCH=none TEST=Flashed ec to samus and samus_pd, verified lightbar tap, lid, power button, keyboard, charging, all still working. TEST=Moved a GPIO_INT declaration after a GPIO declaration and watched the build fail. TEST=make -j BOARD=peppy tests TEST=make -j BOARD=auron tests TEST=make -j BOARD=link tests Change-Id: Id6e261b0a3cd63223ca92f2e96a80c95e85cdefb Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/263973 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Trybot-Ready: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* common: Add the possibility to filter UART inputMyles Watson2015-02-211-0/+11
| | | | | | | | | | | | | | | | | | | Add CONFIG_UART_INPUT_FILTER, which is undefined by default. BUG=chrome-os-partner:36745 TEST=buildall for the case where it is not defined. Added a filter function to the btle code on hadoken. Tested reset, transmit test, receive test, test end, and test mode end. BRANCH=None Signed-off-by: Myles Watson <mylesgw@chromium.org> Change-Id: I3a9c067ffcb114449b61f468271a48491a8c7ec5 Reviewed-on: https://chromium-review.googlesource.com/250580 Tested-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Myles Watson <mylesgw@chromium.org>
* lm4: Use low speed clock in deep sleep.Alec Berg2013-10-211-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | Changed the low power idle task to use the low speed clock in deep sleep. The low power idle task is currently only enabled for Peppy, Slippy, and Falco. This change decreases power consumption when the AP is not running. Note that the low speed clock is slow enough that the JTAG cannot be used and the EC console UART cannot be used. To work around that, this commit detects when the JTAG is in use and when the EC console is in use, and will not use the low speed clock if either is in use. The JTAG in use never clears after being set and the console in use clears after a fixed timeout period. BUG=None BRANCH=None TEST=Passes all unit tests. Tested that the EC console works when in deep sleep. Tested that it is possible to run flash_ec when in deep sleep and using the low speed clock. Change-Id: Ia65997eb8e607a5df9b2c7d68e4826bfb1e0194c Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173326 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: Use DMA for UART receiveRandall Spangler2013-09-161-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | STM32 has a single-byte mailbox for UART I/O. When the core clock runs at 16Mhz we can service interrupts fast enough to handle 115200 baud input, but when we drop to 1MHz we drop characters. Using DMA to receive input solves this problem. The STM32 DMA engine can only generate interrupts when the transfer is half-done / all-done, so we need to poll the DMA receive-head-pointer to see if individual characters have been received. Do this in the tick task (every 250ms). When a character is received, poll more quickly for a bit (5 times before the next tick) so the input console is more responsive to typing. BUG=chrome-os-partner:20485 BRANCH=none TEST=Console is responsive to debug commands. For example, help -> prints help apshutdown -> shuts down AP arrow keys -> move cursor and scroll through command history Ctrl+Q, help, wait a second, Ctrl+S -> help output printed after Ctrl+S Then in chip/stm32/config_chip.h, comment out #define CONFIG_UART_RX_DMA and rebuild/reflash the EC. When the AP is up, the console works normally but after 'apshutdown', the EC drops to 1MHz core clock, and the arrow keys don't work. (This step confirms that adding DMA support did not change the behavior of systems where CONFIG_UART_RX_DMA is not defined.) Change-Id: I199448354824bd747c7b290ea7fd5ccf354c11bb Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/169406 Reviewed-by: Simon Glass <sjg@chromium.org>
* Simplify uart_tx_start()Randall Spangler2013-09-141-7/+2
| | | | | | | | | | | | | | | | | | | All calls to it did if (uart_tx_stopped()) uart_tx_start(); And that was the only use of uart_tx_stopped(). Merge the functions. BUG=chrome-os-partner:20485 BRANCH=none TEST=EC debug console still prints output and accepts commands. Ctrl+Q pauses output and Ctrl+S resumes it. Change-Id: I113c64f5fdfc6b02b63034a74b1a3c6c6a76c351 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/169329 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Remove unused uart functionsRandall Spangler2013-09-131-26/+0
| | | | | | | | | | | | | | Nothing ever called uart_flush_input() or uart_gets(), so remove them. They're dead code, and make implementing UART DMA input more complex. BUG=chrome-os-partner:20485 BRANCH=none TEST=build all platforms; pass unit tests Change-Id: I94c2c372ac3f326b98e819b2c89b8995311b2868 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/169345 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* stm32: Support DMA-based UART outputRandall Spangler2013-09-111-0/+13
| | | | | | | | | | | | | | | This reduces the number of UART interrupts by a factor of 12, and reduces the overall interrupt rate on STM32 by a factor of 2. BUG=chrome-os-partner:20485 BRANCH=none (not required for pit branch) TEST=Boot pit. Ctrl+Q pauses debug output; Ctrl+S resumes it. 'crash divzero' still prints a full crash dump. And util/makeall.sh passes builds all platforms and passes tests. Change-Id: I86993e14b436150298dcb2c6d29086cc3c9db418 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/168814
* Split uart_process() into input and output processingRandall Spangler2013-09-111-5/+11
| | | | | | | | | | | | | | This is a precursor to DMA-based UART transfers, which require different processing for DMA vs PIO output types. BUG=chrome-os-partner:20485 BRANCH=pit TEST=Boot pit; verify EC console still works. Change-Id: I6d6f55561eeebe9bd2928b2bfb25278c86f689d1 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/168811 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move input character processing from UART interrupt to console taskRandall Spangler2013-08-021-17/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, processing of arrow keys and control characters was done in the interrupt handler itself. This increased the impact of UART input on other interrupts and high-priority tasks. It also makes it harder to implement DMA-based UART input on STM32L (in an imminent CL), since the processing affected the circular UART input buffer in-place. This change turns uart_buffering.c back into a dumb I/O buffering module, and puts all the command line editing and history support into console.c. Console history is done via a simple array of input lines instead of a packed circular buffer of characters. This is a little less RAM-efficient, but is easier to implement and read. History depth is controlled via CONFIG_CONSOLE_HISTORY, and is 3 for STM32F and 8 for other platforms. If we really need a greater history depth, we can look into implementing a packed circular buffer again, but this time at task time in console.c. Also added a 'history' command to print the current console history. BUG=chrome-os-partner:20485 BRANCH=none TEST=console_edit unit test passes; 'history' command prints the last commands Change-Id: I142a0be0d67718c58341e4569f4e2908f191d8b0 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/64363 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Clean up UART moduleRandall Spangler2012-10-301-56/+108
| | | | | | | | | | | | | | And change some direct uart_printf()/uart_puts() output to console output methods instead. Disable unused comxtest debug command. No other functional changes. BUG=chrome-os-partner:15579 BRANCH=none TEST=boot system; should still see debug output with reset flags Change-Id: I57fe6bb781a1ba7884afa6d090b74a92f45a53cc Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36835
* Consolidate emergency debug outputRandall Spangler2012-10-291-12/+0
| | | | | | | | | | | | | | | | | | | This removes the duplicate uart_emergency_printf() vs. panic_printf() / uart_emergency_puts() vs. panic_puts() implementation and saves ~0.5kb of code size. The other significant change is that uart_flush_output() is now smart enough to determine if it's in an interrupt; if so, it will spin-flush the output buffer instead of waiting on the uart interrupt. This removes the need for a separate panic_flush(). BUG=chrome-os-partner:15579 BRANCH=none TEST=crash unaligned; should print well-formatted crash dump Change-Id: Ifae756203dd1881806be563308077c1d68302e1f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36695
* Clean up uart buffering codeRandall Spangler2012-10-261-9/+0
| | | | | | | | | | | | | No functional changes. BUG=chrome-os-partner:15579 BRANCH=none TEST=help version -> prints help on version command Change-Id: I79c4b668513b6037aa6cf3fa1a2a8c0fc9856f41 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36612 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move printf() formatting to its own file to enable re-useRandall Spangler2012-06-071-23/+12
| | | | | | | | | | | | | Also add snprintf(), and %X format code. BUG=chrome-os-partner:10206 TEST=timerinfo; should print correctly. 'ectool battery' on host side should print same serial as 'battery' on EC console. Change-Id: I5c9f69d1a20ee5d0a59440c122655adbf62c9aea Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/24635 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
* Add support for printing fixed-point numbersRandall Spangler2012-05-221-2/+6
| | | | | | | | | | | | This makes timestamps much easier to read. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:9866 TEST=timerinfo, taskinfo, battery commands have fixed-point numbers, and timestamps printed in the log look right. Change-Id: If91c83f725984c8e04bfb7cdcff316d9c3bfe24c
* Refactor async console outputRandall Spangler2012-04-241-0/+5
| | | | | | | | | | | | | | | | | | This adds a 'ch' command which prints/sets which channels are active This handles all the async output; the remaining debug commands will be refactored to use ccprintf() / ccputs() in a followup CL. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7464 TEST=manual ch --> all channels active ch 0x100 -> just port80 active powerbtn -> system boots; only port 80 codes shown on console Change-Id: I9efc43acec919b62b78c2c82c61946d32380adfe
* Implement 64-bit integer printing in uart_printf()Randall Spangler2012-04-201-7/+4
| | | | | | | | | Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7490 TEST=timerinfo; numbers should look reasonable Change-Id: I698be99c87bf311013427ac0ed9e93e5687f40c0
* Add %T format code to print current timestamp.Randall Spangler2012-04-031-3/+7
| | | | | | | | | Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:8724 TEST=if timestamps show up in the debug output, it works Change-Id: I5264a3a40a07a824cc15b39a7bd81f2db02a3c13
* Support warm reboot from one EC image to another.Randall Spangler2012-03-191-0/+2
| | | | | | | | | | | | | | | | | | | | | This is necessary at init-time for verified boot to jump from RO to one of the RW images. It's also used by factory EC update to update one image and then jump to the updated image to finish the update. In this case, the x86 does NOT reboot. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:8449 TEST=manual 1) power on x86 and log in 2) sysjump a --> system is in a; x86 has not rebooted 3) sysjump ro --> system is back in RO; x86 has not rebooted 4) reboot -> system is in RO; x86 HAS rebooted Change-Id: I9dbadcf9775e146a0718abfd4ee0758b65350a87
* Delay enabling UART1 until after LPC bus is enabled.Bill Richardson2012-02-171-0/+3
| | | | | | | | | BUG=none TEST=manual Try it on a bds with no LPC bus. It gets a BusFault without this patch. Change-Id: If3f38df5f7bebaf4c7045a9f48fbe3ac66e8bdbf
* Handle up/down arrow keys for UART console.Vic Yang2012-02-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | Record commands used previously and use up/down arrow key to navigate in the command history. Also removed the command '.' of repeating last command as we can use up arrow key now. Also changed the behaviour of uart_write_char() to be blocking on transmit FIFO full, so that we do not lose echoed character and do not need to flush. BUG=chrome-os-partner:7815 TEST=Type 'help' and enter. Then type 'aaaa' and up arrow key, should show 'help', and pressing enter prints help. Type 'hellp' and enter. Then type 'aaaaaa' and up arrow key, should show 'hellp'. Should be able to use left/right arrow key and backspace to correct it to 'help', and pressing enter prints help. Type 'help' and enter. Then type 'aaa', up arrow key, and down arrow key. Should show 'aaa'. Change-Id: I65c615d61bf63acb31bea329aa91a3202d4db0ad
* Add UART1 receive support (UART to x86 console)Randall Spangler2012-02-061-1/+1
| | | | | | | | | Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7488 TEST=type things into the x86 console UART; should appear on the u-boot prompt Change-Id: I75fd225842c03d11d79280fb7453ad37695279e3
* Split UART codeVincent Palatin2012-01-261-0/+60
| | | | | | | | | | | | | | | Preparatory work to introduce a second SoC : 3rd series 1/2 Most of the code is handling the buffering and the printf, thus put it in an hardware independant location and only implement the UART dependant portions in the chip driver. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=None TEST=run on BDS and stress the console. Change-Id: I9376f2fa1dad341eac808e1756dbeff32900bd51
* Clean up UART codeRandall Spangler2011-12-121-0/+9
| | | | | | | | | | | | LPC module no longer directly talks to UART registers, and vice-versa. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST='ectool sertest' on target system Change-Id: Id070c0d849bdfe91c752e0af651d357b695d2648 (cherry picked from commit ab8c3c2b8e3b08a4bf5573cda3a12dd3a384e67d)
* Initial sources import 1/3Randall Spangler2011-12-071-0/+112
source files mainly done by Randall. Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: Iaff83a842b17f3350fb6f2a3f1597ad4c29bd12a