Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/slipdev : Expose Configurations to Kconfig #13954

Merged
merged 2 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions drivers/Kconfig.net
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ rsource "cc110x/Kconfig"
rsource "dose/Kconfig"
rsource "mrf24j40/Kconfig"
rsource "pn532/Kconfig"
rsource "slipdev/Kconfig"
source "$(RIOTCPU)/nrf52/radio/nrf802154/Kconfig"
endmenu # Network Device Drivers

Expand Down
10 changes: 7 additions & 3 deletions drivers/include/slipdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ extern "C" {
*
* @pre Needs to be power of two and `<= INT_MAX`
*/
#ifndef SLIPDEV_BUFSIZE
#define SLIPDEV_BUFSIZE (2048U)
#ifdef CONFIG_SLIPDEV_BUFSIZE_EXP
#define CONFIG_SLIPDEV_BUFSIZE (1<<CONFIG_SLIPDEV_BUFSIZE_EXP)
#endif

#ifndef CONFIG_SLIPDEV_BUFSIZE
#define CONFIG_SLIPDEV_BUFSIZE (2048U)
#endif
/** @} */

Expand Down Expand Up @@ -88,7 +92,7 @@ typedef struct {
netdev_t netdev; /**< parent class */
slipdev_params_t config; /**< configuration parameters */
tsrb_t inbuf; /**< RX buffer */
uint8_t rxmem[SLIPDEV_BUFSIZE]; /**< memory used by RX buffer */
uint8_t rxmem[CONFIG_SLIPDEV_BUFSIZE]; /**< memory used by RX buffer */
/**
* @brief Device state
* @see [Device state definitions](@ref drivers_slipdev_states)
Expand Down
25 changes: 25 additions & 0 deletions drivers/slipdev/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2020 Freie Universitaet Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
menuconfig KCONFIG_MODULE_SLIPDEV
bool "Configure SLIPDEV driver"
depends on MODULE_SLIPDEV
help
Configure the SLIPDEV driver using Kconfig.

if KCONFIG_MODULE_SLIPDEV

config SLIPDEV_BUFSIZE_EXP
int "Buffer size (as exponent of 2^n)"
default 11
range 0 31
help
UART buffer size used for TX and RX buffers.
Reduce this value if your expected traffic does
not include full IPv6 MTU.
Value represents the exponent n of 2^n.

endif # KCONFIG_MODULE_SLIPDEV