diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2020-03-18 17:46:53 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-31 23:24:38 +0000 |
commit | a795c626a156a92813e7992bc14c764b1ae1f994 (patch) | |
tree | 45d3a3fdb92e57eb200c0f3b1ee13838c05d5347 /include/console.h | |
parent | 804d65e5fd86057e78c0d0b5f6139172d20b8207 (diff) | |
download | chrome-ec-a795c626a156a92813e7992bc14c764b1ae1f994.tar.gz |
cmsg.c, console packet mode driver
This patch adds a console driver for packet mode.
The driver processes information prepared by util_precomplie.py when
processing printf invocations in the source code. Each invocation is
replaced by a cmsgX function, where X is the number of format
arguments.
cmsgX functions prepare an array of parameters of size X and invoke a
common function, passing it the array and an integer value, consisting
of up to 8 4 bit fields, describing the parameters.
Since both console drivers need to be able to filter logical console
channels, the channel_mask variable is made global.
BUG=b:149964350
TEST=with the rest of patches applied and packet mode enabled,
verified proper operation of both Cr50 consoles (USB and UART).
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Change-Id: I1f6ef5ea50bffbe14d3e3850fff0191c54f37033
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2113931
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/console.h')
-rw-r--r-- | include/console.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/include/console.h b/include/console.h index 2c5e9f98fa..f0367f7ffe 100644 --- a/include/console.h +++ b/include/console.h @@ -225,6 +225,37 @@ void console_has_input(void); (CONFIG_CONSOLE_COMMAND_FLAGS_DEFAULT & \ ~CMD_FLAG_RESTRICTED)) -#endif /* HAS_TASK_CONSOLE */ +#endif /* HAS_TASK_CONSOLE */ -#endif /* __CROS_EC_CONSOLE_H */ +/* + * Packet mode console interface functions, with fixed number of parameters, + * replacing cprint/cprints/cputs in the source code. + * + * All converted parameters are typecast to uintptr_t. The uint32_t parameter + * is a mask of up to eight 4 bit fields describing each present parameter + * type. This allows the packet building function to properly re-cast the + * uintptr_t parameters. + */ +int cmsg0(enum console_channel chan, int str_index); +int cmsg1(enum console_channel chan, int str_index, uint32_t mask, + uintptr_t p1); +int cmsg2(enum console_channel chan, int str_index, uint32_t mask, uintptr_t p1, + uintptr_t p2); +int cmsg3(enum console_channel chan, int str_index, uint32_t mask, uintptr_t p1, + uintptr_t p2, uintptr_t p3); +int cmsg4(enum console_channel chan, int str_index, uint32_t mask, uintptr_t p1, + uintptr_t p2, uintptr_t p3, uintptr_t p4); +int cmsg5(enum console_channel chan, int str_index, uint32_t mask, uintptr_t p1, + uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5); +int cmsg6(enum console_channel chan, int str_index, uint32_t mask, uintptr_t p1, + uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5, uintptr_t p6); +int cmsg7(enum console_channel chan, int str_index, uint32_t mask, uintptr_t p1, + uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5, uintptr_t p6, + uintptr_t p7); +int cmsg8(enum console_channel chan, int str_index, uint32_t mask, uintptr_t p1, + uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5, uintptr_t p6, + uintptr_t p7, uintptr_t p8); + +extern uint32_t channel_mask; + +#endif /* __CROS_EC_CONSOLE_H */ |