Skip to content

Commit

Permalink
Merge pull request #13954 from akshaim/Kconfig_slipdev
Browse files Browse the repository at this point in the history
drivers/slipdev : Expose Configurations to Kconfig
  • Loading branch information
leandrolanzieri authored Apr 29, 2020
2 parents e531bdb + e6924e5 commit d822a91
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
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

0 comments on commit d822a91

Please sign in to comment.