shell: Add handling of CONFIG_LOG_INPLACE_PROCESS option

Extended shell to be able to process logs in place
(in the context of a log call). In order to achieve that,
shell was extended to  support for TX blocking operations. If
CONFIG_LOG_INPLACE_PROCESS is enabled then shell instance
attempts to be initialized in blocking TX mode. If fails to
do so, shell log backend is disabled. If successfully enabled
logs are processed and printed in the context of the call.

Due to that change, user may expirience interleaved output as
shell has no means to multiplex shell output with logger output.
In extreme, huge amount of log messages may prevent shell thread
execution and shell may become unresponsive.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2019-01-04 14:13:41 +01:00 committed by Carles Cufí
commit 2e6892c9b0
5 changed files with 105 additions and 31 deletions

View file

@ -292,16 +292,19 @@ struct shell_transport_api {
int (*uninit)(const struct shell_transport *transport);
/**
* @brief Function for reconfiguring the transport to work in blocking
* mode.
* @brief Function for enabling transport in given TX mode.
*
* @param transport Pointer to the transfer instance.
* @param blocking If true, the transport is enabled in blocking mode.
* Function can be used to reconfigure TX to work in blocking mode.
*
* @param transport Pointer to the transfer instance.
* @param blocking_tx If true, the transport TX is enabled in blocking
* mode.
*
* @return NRF_SUCCESS on successful enabling, error otherwise (also if
* not supported).
*/
int (*enable)(const struct shell_transport *transport, bool blocking);
int (*enable)(const struct shell_transport *transport,
bool blocking_tx);
/**
* @brief Function for writing data to the transport interface.