Skip to content

Commit

Permalink
Fix AP interface crash
Browse files Browse the repository at this point in the history
  • Loading branch information
mantriyogesh committed Oct 26, 2023
1 parent a0a1a68 commit 5470283
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
6 changes: 6 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,12 @@ ESP32S3_SDIO_CLK_FREQ_KHZ_RANGE_MAX := 80000
Cache allocated memory - reduces number of malloc calls

menu "Debug Settings"
config ESP_HOSTED_ENABLE_HEXDUMP
bool "Hexdump logs enable"
default n
help
Enable Hex logs to print msg content

config ESP_RAW_THROUGHPUT_TRANSPORT
bool "RawTP: Transport level throughput debug test"
default n
Expand Down
4 changes: 2 additions & 2 deletions common/include/esp_hosted_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
#include "esp_log.h"


#if ESP_HOSTED_ENABLE_HEXDUMP
#if CONFIG_ESP_HOSTED_ENABLE_HEXDUMP

#define ESP_PRIV_HEXDUMP(tag1, tag2, buff, len, curr_level) \
if ( LOG_LOCAL_LEVEL >= curr_level) { \
ESP_LOGD(tag1, tag2); \
ESP_LOG_BUFFER_HEXDUMP(tag2, buff, len, level); \
ESP_LOG_BUFFER_HEXDUMP(tag2, buff, len, curr_level); \
}

#define ESP_HEXLOGE(tag2, buff, len) ESP_PRIV_HEXDUMP(TAG, tag2, buff, len, ESP_LOG_ERROR)
Expand Down
17 changes: 13 additions & 4 deletions host/drivers/transport/transport_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,26 @@ static esp_err_t transport_drv_sta_tx(void *h, void *buffer, size_t len)
assert(h && h==chan_arr[ESP_STA_IF]->api_chan);

/* Prepare transport buffer directly consumable */
copy_buff = mempool_alloc(((struct mempool*)chan_arr[ESP_STA_IF]->memp), MAX_SPI_BUFFER_SIZE, true);
copy_buff = mempool_alloc(((struct mempool*)chan_arr[ESP_STA_IF]->memp), MAX_SPI_BUFFER_SIZE, true);
g_h.funcs->_h_memcpy(copy_buff+H_ESP_PAYLOAD_HEADER_OFFSET, buffer, len);

return esp_hosted_tx(ESP_STA_IF, 0, copy_buff, len, H_BUFF_ZEROCOPY, transport_sta_free_cb);
}

static esp_err_t transport_drv_ap_tx(void *h, void *buffer, size_t len)
{
/* TODO */
void * copy_buff = NULL;

if (!buffer || !len)
return ESP_OK;

assert(h && h==chan_arr[ESP_AP_IF]->api_chan);
return esp_hosted_tx(ESP_AP_IF, 0, buffer, len, H_BUFF_ZEROCOPY, transport_ap_free_cb);

/* Prepare transport buffer directly consumable */
copy_buff = mempool_alloc(((struct mempool*)chan_arr[ESP_AP_IF]->memp), MAX_SPI_BUFFER_SIZE, true);
g_h.funcs->_h_memcpy(copy_buff+H_ESP_PAYLOAD_HEADER_OFFSET, buffer, len);

return esp_hosted_tx(ESP_AP_IF, 0, copy_buff, len, H_BUFF_ZEROCOPY, transport_ap_free_cb);
}

esp_err_t transport_drv_serial_tx(void *h, void *buffer, size_t len)
Expand Down Expand Up @@ -283,7 +292,7 @@ transport_channel_t *transport_drv_add_channel(void *api_chan,
#endif

ESP_LOGI(TAG, "Add ESP-Hosted channel IF[%u]: S[%u] Tx[%p] Rx[%p]",
secure, if_type, *tx, rx);
if_type, secure, *tx, rx);

return channel;
}
Expand Down
2 changes: 1 addition & 1 deletion idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "0.0.5-dev.4"
version: "0.0.5-dev.5"
description: ESP-Hosted provides driver such that any host can re-use ESP chipset as Wi-Fi or Bluetooth co-processor.
url: https://github.com/espressif/esp-hosted/tree/feature/esp_as_mcu_host
dependencies:
Expand Down

0 comments on commit 5470283

Please sign in to comment.