[cli] make CLI buffer sizes configurable (#2351)

* [core] Make CLI buffer sizes configurable.

At the moment, we allocate 512 bytes for a receive buffer and 1kB for
transmit, which while it doesn't seem a lot, is in fact a big commitment
for a CLI interface.  In cases where the platform does its own
buffering, this can be significantly reduced.

These add definitions that mirror the current settings so they may be
changed.

* [cli] Define UART buffers according to config.

Use the definitions produced in the previous commit to set the buffer
sizes.

* [core, cli] Rename OPENTHREAD_CONFIG_CLI_LINE_LENGTH

to `OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH` as per review in pull request 2351.
This commit is contained in:
Stuart Longland
2017-11-21 00:31:47 +00:00
committed by Jonathan Hui
parent 3acc159202
commit 1f6528e6c9
2 changed files with 33 additions and 3 deletions
+3 -3
View File
@@ -111,9 +111,9 @@ public:
private:
enum
{
kRxBufferSize = 512,
kTxBufferSize = 1024,
kMaxLineLength = 128,
kRxBufferSize = OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE,
kTxBufferSize = OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE,
kMaxLineLength = OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH,
};
otError ProcessCommand(void);
+30
View File
@@ -231,6 +231,36 @@
#define OPENTHREAD_CONFIG_ADDRESS_QUERY_MAX_RETRY_DELAY 28800
#endif
/**
* @def OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH
*
* The maximum size of the CLI line in bytes
*
*/
#ifndef OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH
#define OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH 128
#endif
/**
* @def OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
*
* The size of CLI UART RX buffer in bytes
*
*/
#ifndef OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
#define OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE 512
#endif
/**
* @def OPENTHREAD_CONFIG_CLI_TX_BUFFER_SIZE
*
* The size of CLI message buffer in bytes
*
*/
#ifndef OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE
#define OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE 1024
#endif
/**
* @def OPENTHREAD_CONFIG_MAX_CHILDREN
*