blob: 28773768f5199c0cfdcbc24d56fccacf52bd3974 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* Copyright 2015 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.
*
* Console command to query USART state
*/
#include "atomic.h"
#include "common.h"
#include "console.h"
#include "usart.h"
static int command_usart_info(int argc, char **argv)
{
struct usart_configs configs = usart_get_configs();
size_t i;
for (i = 0; i < configs.count; i++) {
struct usart_config const *config = configs.configs[i];
if (config == NULL)
continue;
ccprintf("USART%d\n"
" dropped %ld bytes\n"
" overran %ld times\n",
config->hw->index + 1,
(long)atomic_clear(
(atomic_t *)&(config->state->rx_dropped)),
(long)atomic_clear(
(atomic_t *)&(config->state->rx_overrun)));
if (config->rx->info)
config->rx->info(config);
if (config->tx->info)
config->tx->info(config);
}
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(usart_info,
command_usart_info,
NULL,
"Display USART info");
|