Skip to content

esp_hosted_ng: Adapt CONFIG_BT #542

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion esp_hosted_ng/host/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ ifeq ($(MODULE_NAME), esp32_spi)
module_objects += spi/esp_spi.o
endif

module_objects += esp_bt.o main.o esp_cmd.o esp_utils.o esp_cfg80211.o esp_stats.o esp_debugfs.o esp_log.o
ifneq ($(filter $(CONFIG_BT), y m), )
EXTRA_CFLAGS += -DCONFIG_BT
module_objects += esp_bt.o
endif

module_objects += main.o esp_cmd.o esp_utils.o esp_cfg80211.o esp_stats.o esp_debugfs.o esp_log.o
#$(foreach obj,$(module_objects),$(eval CFLAGS_$(obj:.o=).o := $(debug_flags)))
CFLAGS_esp_log.o = -DDEBUG

Expand Down
10 changes: 10 additions & 0 deletions esp_hosted_ng/host/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ void print_capabilities(u32 cap)
}
}

#ifdef CONFIG_BT
static void init_bt(struct esp_adapter *adapter)
{

Expand All @@ -233,6 +234,7 @@ static void init_bt(struct esp_adapter *adapter)
esp_init_bt(adapter);
}
}
#endif

static int check_esp_version(struct fw_version *ver)
{
Expand Down Expand Up @@ -349,7 +351,9 @@ static int process_event_esp_bootup(struct esp_adapter *adapter, u8 *evt_buf, u8
esp_err("network interface init failed\n");
return -1;
}
#ifdef CONFIG_BT
init_bt(adapter);
#endif

if (raw_tp_mode !=0) {
#if TEST_RAW_TP
Expand Down Expand Up @@ -594,8 +598,10 @@ int esp_remove_card(struct esp_adapter *adapter)

esp_stop_network_ifaces(adapter);
esp_cfg_cleanup(adapter);
#ifdef CONFIG_BT
/* BT may have been initialized after fw bootup event, deinit it */
esp_deinit_bt(adapter);
#endif

if (adapter->if_rx_workqueue) {
flush_workqueue(adapter->if_rx_workqueue);
Expand Down Expand Up @@ -687,8 +693,10 @@ static void process_rx_packet(struct esp_adapter *adapter, struct sk_buff *skb)
struct esp_payload_header *payload_header = NULL;
u16 len = 0, offset = 0;
u16 rx_checksum = 0, checksum = 0;
#ifdef CONFIG_BT
struct hci_dev *hdev = adapter->hcidev;
u8 *type = NULL;
#endif

if (!skb)
return;
Expand Down Expand Up @@ -752,6 +760,7 @@ static void process_rx_packet(struct esp_adapter *adapter, struct sk_buff *skb)
dev_kfree_skb_any(skb);
}

#ifdef CONFIG_BT
} else if (payload_header->if_type == ESP_HCI_IF) {
if (hdev) {

Expand All @@ -769,6 +778,7 @@ static void process_rx_packet(struct esp_adapter *adapter, struct sk_buff *skb)
esp_hci_update_rx_counter(hdev, *type, skb->len);
}
}
#endif
} else if (payload_header->if_type == ESP_INTERNAL_IF) {

/* Queue event skb for processing in events workqueue */
Expand Down
4 changes: 4 additions & 0 deletions esp_hosted_ng/host/sdio/esp_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,11 @@ static void esp_remove(struct sdio_func *func)
if (context->adapter) {
esp_remove_card(context->adapter);

#ifdef CONFIG_BT
if (context->adapter->hcidev) {
esp_deinit_bt(context->adapter);
}
#endif
}


Expand Down Expand Up @@ -502,8 +504,10 @@ static int write_packet(struct esp_adapter *adapter, struct sk_buff *skb)
/* Notify to process queue */
if (payload_header->if_type == ESP_INTERNAL_IF)
prio = PRIO_Q_HIGH;
#ifdef CONFIG_BT
else if (payload_header->if_type == ESP_HCI_IF)
prio = PRIO_Q_MID;
#endif
else
prio = PRIO_Q_LOW;

Expand Down
6 changes: 6 additions & 0 deletions esp_hosted_ng/host/spi/esp_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ static int write_packet(struct esp_adapter *adapter, struct sk_buff *skb)
/* Enqueue SKB in tx_q */
if (payload_header->if_type == ESP_INTERNAL_IF) {
skb_queue_tail(&spi_context.tx_q[PRIO_Q_HIGH], skb);
#ifdef CONFIG_BT
} else if (payload_header->if_type == ESP_HCI_IF) {
skb_queue_tail(&spi_context.tx_q[PRIO_Q_MID], skb);
#endif
} else {
skb_queue_tail(&spi_context.tx_q[PRIO_Q_LOW], skb);
atomic_inc(&tx_pending);
Expand Down Expand Up @@ -257,8 +259,10 @@ static int process_rx_buf(struct sk_buff *skb)
/* enqueue skb for read_packet to pick it */
if (header->if_type == ESP_INTERNAL_IF)
skb_queue_tail(&spi_context.rx_q[PRIO_Q_HIGH], skb);
#ifdef CONFIG_BT
else if (header->if_type == ESP_HCI_IF)
skb_queue_tail(&spi_context.rx_q[PRIO_Q_MID], skb);
#endif
else
skb_queue_tail(&spi_context.rx_q[PRIO_Q_LOW], skb);

Expand Down Expand Up @@ -612,8 +616,10 @@ static void spi_exit(void)

cleanup_spi_gpio();

#ifdef CONFIG_BT
if (spi_context.adapter && spi_context.adapter->hcidev)
esp_deinit_bt(spi_context.adapter);
#endif

spi_context.adapter->dev = NULL;

Expand Down