Skip to content

Commit

Permalink
Merge branch 'fix/spi_build' into 'feature/esp_as_mcu_host'
Browse files Browse the repository at this point in the history
fix/spi_build Fix building for spi due to change in structure

See merge request app-frameworks/esp_hosted!450
  • Loading branch information
mantriyogesh committed May 20, 2024
2 parents 4e60637 + 786e88b commit 2b86b4b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions host/drivers/transport/spi/spi_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ static void spi_process_rx_task(void const* pvParameters)
{
interface_buffer_handle_t buf_handle_l = {0};
interface_buffer_handle_t *buf_handle = NULL;
int ret = 0;

while (1) {

Expand All @@ -537,16 +538,18 @@ static void spi_process_rx_task(void const* pvParameters)
} else if((buf_handle->if_type == ESP_STA_IF) ||
(buf_handle->if_type == ESP_AP_IF)) {
schedule_dummy_rx = 1;
#if 0
#if 1
if (chan_arr[buf_handle->if_type] && chan_arr[buf_handle->if_type]->rx) {
/* TODO : Need to abstract heap_caps_malloc */
uint8_t * copy_payload = (uint8_t *)heap_caps_malloc(buf_handle->payload_len, MALLOC_CAP_32BIT);
uint8_t * copy_payload = (uint8_t *)g_h.funcs->_h_malloc(buf_handle->payload_len);
assert(copy_payload);
memcpy(copy_payload, buf_handle->payload, buf_handle->payload_len);
H_FREE_PTR_WITH_FUNC(buf_handle->free_buf_handle, buf_handle->priv_buffer_handle);

chan_arr[buf_handle->if_type]->rx(chan_arr[buf_handle->if_type]->api_chan,
ret = chan_arr[buf_handle->if_type]->rx(chan_arr[buf_handle->if_type]->api_chan,
copy_payload, copy_payload, buf_handle->payload_len);
if (unlikely(ret))
HOSTED_FREE(copy_payload);
}
#else

Expand Down
4 changes: 2 additions & 2 deletions slave/main/spi_slave_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ static int process_spi_rx(interface_buffer_handle_t *buf_handle)

#if ESP_PKT_STATS
if (buf_handle->if_type == ESP_STA_IF)
pkt_stats.sta_rx_in++;
pkt_stats.hs_bus_sta_in++;
#endif
if (header->if_type == ESP_SERIAL_IF) {
xQueueSend(spi_rx_queue[PRIO_Q_SERIAL], buf_handle, portMAX_DELAY);
Expand Down Expand Up @@ -681,7 +681,7 @@ static void spi_transaction_post_process_task(void* pvParameters)
struct esp_payload_header *header =
(struct esp_payload_header *)spi_trans->tx_buffer;
if (header->if_type == ESP_STA_IF)
pkt_stats.sta_tx_out++;
pkt_stats.sta_sh_out++;
#endif

/* Free any tx buffer, data is not relevant anymore */
Expand Down

0 comments on commit 2b86b4b

Please sign in to comment.