summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2019-05-06 13:20:31 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-05-11 14:18:17 -0700
commite02b08ceca36300a602c50b2b3cc81f3a5385978 (patch)
treeca86369257c69186d762a653dedf335e98fa51a8 /extra
parent1009c67272f56d66f4d23a2994bf30809a0deef5 (diff)
downloadchrome-ec-e02b08ceca36300a602c50b2b3cc81f3a5385978.tar.gz
stm32: Decouple printf logic from directly calling USB console driver
When calling printf functions, it was to call the USB console driver directly, i.e. copying all the bytes to USB package buffer and enabling the transmission. If the next printf is called immediately before the USB transmission is done, it will wait (polling the EP_TX_VALID status). This implementation limited each printf function can only transmit 64 bytes, i.e. the USB max package size. The remaining bytes will be dropped silently. To fix this issue, this CL puts a queue between the printf logic and the driver. The size of the queue is 2048-byte (no overflow happened on a normal boot and console commands). The printf logic now fills the queue and schedules a deferred hook to handle the transmission. When the transmission is done, an interrupt will be triggered that schedules the deferred hook again to check any remaining bytes need to be transmitted. For the incoming bytes, replace the circular buffer to a queue structure for better reusability. No major logic changes. BRANCH=servo BUG=b:129423678 TEST=Manually added a printf call to show >64 bytes and verified it. TEST=Manually added a printf call to show >2048 bytes and the bytes after the 2048-th dropped silently. Change-Id: Icb2310421d7bcbbff8d7cd753c732390acc43ab8 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/1597960 Commit-Ready: Todd Broch <tbroch@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'extra')
0 files changed, 0 insertions, 0 deletions