Skip to content

Commit 810118d

Browse files
tmon-nordicfabiobaltieri
authored andcommitted
samples: usb: uac2: Leave cache management up to drivers
Do not call cache management functions in sample because it does not work properly if driver uses bounce buffers. Signed-off-by: Tomasz Moń <[email protected]>
1 parent 9493af9 commit 810118d

File tree

2 files changed

+0
-7
lines changed
  • samples/subsys/usb
    • uac2_explicit_feedback/src
    • uac2_implicit_feedback/src

2 files changed

+0
-7
lines changed

samples/subsys/usb/uac2_explicit_feedback/src/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <sample_usbd.h>
1111
#include "feedback.h"
1212

13-
#include <zephyr/cache.h>
1413
#include <zephyr/device.h>
1514
#include <zephyr/usb/usbd.h>
1615
#include <zephyr/usb/class/usbd_uac2.h>
@@ -117,7 +116,6 @@ static void uac2_data_recv_cb(const struct device *dev, uint8_t terminal,
117116
*/
118117
size = BLOCK_SIZE;
119118
memset(buf, 0, size);
120-
sys_cache_data_flush_range(buf, size);
121119
}
122120

123121
LOG_DBG("Received %d data to input terminal %d", size, terminal);

samples/subsys/usb/uac2_implicit_feedback/src/main.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <sample_usbd.h>
1111
#include "feedback.h"
1212

13-
#include <zephyr/cache.h>
1413
#include <zephyr/device.h>
1514
#include <zephyr/usb/usbd.h>
1615
#include <zephyr/usb/class/usbd_uac2.h>
@@ -164,7 +163,6 @@ static void uac2_data_recv_cb(const struct device *dev, uint8_t terminal,
164163
size = SAMPLES_PER_SOF * BYTES_PER_SLOT;
165164
}
166165
memset(buf, 0, size);
167-
sys_cache_data_flush_range(buf, size);
168166
}
169167

170168
LOG_DBG("Received %d data to input terminal %d", size, terminal);
@@ -259,7 +257,6 @@ static void process_mic_data(const struct device *dev, struct usb_i2s_ctx *ctx)
259257
/* No data available, I2S will restart soon */
260258
return;
261259
}
262-
sys_cache_data_invd_range(rx_block, num_bytes);
263260

264261
/* I2S operates on 2 channels (stereo) */
265262
rx_samples = num_bytes / (BYTES_PER_SAMPLE * 2);
@@ -314,7 +311,6 @@ static void process_mic_data(const struct device *dev, struct usb_i2s_ctx *ctx)
314311
ctx->pending_mic_samples = mic_samples;
315312
return;
316313
}
317-
sys_cache_data_invd_range(rx_block, num_bytes);
318314

319315
src = rx_block;
320316
rx_samples = num_bytes / (BYTES_PER_SAMPLE * 2);
@@ -424,7 +420,6 @@ static void process_mic_data(const struct device *dev, struct usb_i2s_ctx *ctx)
424420
}
425421

426422
/* Finally send the microphone samples to host */
427-
sys_cache_data_flush_range(mic_buf, mic_samples * BYTES_PER_SAMPLE);
428423
if (usbd_uac2_send(dev, MICROPHONE_IN_TERMINAL_ID,
429424
mic_buf, mic_samples * BYTES_PER_SAMPLE) < 0) {
430425
k_mem_slab_free(&i2s_rx_slab, mic_buf);

0 commit comments

Comments
 (0)