2015-04-11 07:44:37 +08:00
|
|
|
/* uart_console.h - uart console driver */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2011, 2014 Wind River Systems, Inc.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_INCLUDE_DRIVERS_CONSOLE_UART_CONSOLE_H_
|
|
|
|
#define ZEPHYR_INCLUDE_DRIVERS_CONSOLE_UART_CONSOLE_H_
|
2015-04-11 07:44:37 +08:00
|
|
|
|
2019-08-13 01:54:52 +08:00
|
|
|
#include <kernel.h>
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-05-04 19:43:36 +08:00
|
|
|
/** @brief Register uart input processing
|
|
|
|
*
|
|
|
|
* Input processing is started when string is typed in the console.
|
|
|
|
* Carriage return is translated to NULL making string always NULL
|
|
|
|
* terminated. Application before calling register function need to
|
|
|
|
* initialize two fifo queues mentioned below.
|
|
|
|
*
|
2016-11-11 20:11:44 +08:00
|
|
|
* @param avail k_fifo queue keeping available input slots
|
|
|
|
* @param lines k_fifo queue of entered lines which to be processed
|
2015-05-04 19:43:36 +08:00
|
|
|
* in the application code.
|
2016-05-25 22:23:42 +08:00
|
|
|
* @param completion callback for tab completion of entered commands
|
2015-05-04 19:43:36 +08:00
|
|
|
*
|
2015-11-21 02:53:02 +08:00
|
|
|
* @return N/A
|
2015-04-20 16:04:22 +08:00
|
|
|
*/
|
2016-11-30 15:37:17 +08:00
|
|
|
void uart_register_input(struct k_fifo *avail, struct k_fifo *lines,
|
2017-04-21 23:55:34 +08:00
|
|
|
u8_t (*completion)(char *str, u8_t len));
|
2015-04-20 16:04:22 +08:00
|
|
|
|
2016-04-12 05:11:28 +08:00
|
|
|
/*
|
|
|
|
* Allows having debug hooks in the console driver for handling incoming
|
|
|
|
* control characters, and letting other ones through.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_UART_CONSOLE_DEBUG_SERVER_HOOKS
|
|
|
|
#define UART_CONSOLE_DEBUG_HOOK_HANDLED 1
|
|
|
|
#define UART_CONSOLE_OUT_DEBUG_HOOK_SIG(x) int(x)(char c)
|
|
|
|
typedef UART_CONSOLE_OUT_DEBUG_HOOK_SIG(uart_console_out_debug_hook_t);
|
|
|
|
|
2016-10-23 15:53:21 +08:00
|
|
|
void uart_console_out_debug_hook_install(
|
2016-04-12 05:11:28 +08:00
|
|
|
uart_console_out_debug_hook_t *hook);
|
2016-10-23 15:53:21 +08:00
|
|
|
|
2017-04-21 23:55:34 +08:00
|
|
|
typedef int (*uart_console_in_debug_hook_t) (u8_t);
|
2016-10-23 15:53:21 +08:00
|
|
|
|
|
|
|
void uart_console_in_debug_hook_install(uart_console_in_debug_hook_t hook);
|
|
|
|
|
2016-04-12 05:11:28 +08:00
|
|
|
#endif
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_INCLUDE_DRIVERS_CONSOLE_UART_CONSOLE_H_ */
|