From 984c7a694554e0c05533d9da67e50ed73fc03e46 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 12 Feb 2016 12:59:55 +0200 Subject: [PATCH] Bluetooth: Kconfig: Introduce BLUETOOTH_RX_STACK_SIZE Applications may want to fine-tune the stack size of the fiber that's used to make callbacks into the application. Change-Id: I2cd3e79283fe85359389528e84d9bcc21e3e19f6 Signed-off-by: Johan Hedberg --- drivers/nble/Kconfig | 12 ++++++++++++ drivers/nble/uart.c | 2 +- net/bluetooth/Kconfig | 12 ++++++++++++ net/bluetooth/hci_core.c | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/nble/Kconfig b/drivers/nble/Kconfig index 31e74232973..c9df72492f1 100644 --- a/drivers/nble/Kconfig +++ b/drivers/nble/Kconfig @@ -62,6 +62,18 @@ config BLUETOOTH_DEBUG default n select STDOUT_CONSOLE +config BLUETOOTH_RX_STACK_SIZE + int "Size of the receiving fiber stack" + default 1024 + range 1024 65536 + help + Size of the receiving fiber stack. This is the context from + which all event callbacks to the application occur. The + default value is sufficient for basic operation, but if the + application needs to do advanced things in its callbacks that + require extra stack space, this value can be increased to + accomodate for that. + if BLUETOOTH_DEBUG config BLUETOOTH_DEBUG_DRIVER diff --git a/drivers/nble/uart.c b/drivers/nble/uart.c index 7c288465c3a..e1973edbdd7 100644 --- a/drivers/nble/uart.c +++ b/drivers/nble/uart.c @@ -56,7 +56,7 @@ static NET_BUF_POOL(rx_pool, NBLE_RX_BUF_COUNT, NBLE_BUF_SIZE, &rx, NULL, 0); static struct nano_fifo tx; static NET_BUF_POOL(tx_pool, NBLE_TX_BUF_COUNT, NBLE_BUF_SIZE, &tx, NULL, 0); -static BT_STACK_NOINIT(rx_fiber_stack, 2048); +static BT_STACK_NOINIT(rx_fiber_stack, CONFIG_BLUETOOTH_RX_STACK_SIZE); static struct device *nble_dev; diff --git a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig index fd48449565f..8dcbbcf3616 100644 --- a/net/bluetooth/Kconfig +++ b/net/bluetooth/Kconfig @@ -76,6 +76,18 @@ config BLUETOOTH_MAX_EVT_LEN Commands. It is a 3 byte Command Complete header + 65 byte return parameters = 68 bytes in total. +config BLUETOOTH_RX_STACK_SIZE + int "Size of the receiving fiber stack" + default 1024 + range 1024 65536 + help + Size of the receiving fiber stack. This is the context from + which all event callbacks to the application occur. The + default value is sufficient for basic operation, but if the + application needs to do advanced things in its callbacks that + require extra stack space, this value can be increased to + accomodate for that. + config BLUETOOTH_PERIPHERAL bool "Peripheral Role support" default n diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 1072fa9a65c..3062e78073f 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -56,7 +56,7 @@ #endif /* Stacks for the fibers */ -static BT_STACK_NOINIT(rx_fiber_stack, 1024); +static BT_STACK_NOINIT(rx_fiber_stack, CONFIG_BLUETOOTH_RX_STACK_SIZE); static BT_STACK_NOINIT(rx_prio_fiber_stack, 256); static BT_STACK_NOINIT(cmd_tx_fiber_stack, 256);