summaryrefslogtreecommitdiff
path: root/src/tusb.c
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2025-11-19 22:05:07 +0100
committerHiFiPhile <[email protected]>2025-11-19 22:05:07 +0100
commit85adf694e659bde41b34e2f585cb2db552279064 (patch)
tree6445badf0b427556fd47fb3d7b682bb8b439039e /src/tusb.c
parent2f0a35f21af4c09154d6b4b5b118325af8990e51 (diff)
parent790c7a0d7a6099e88a0bf6bbc341504c8bdaa974 (diff)
Merge remote-tracking branch 'tinyusb/master' into copilot/fix-dcd-edpt-xfer-issue
Signed-off-by: HiFiPhile <[email protected]>
Diffstat (limited to 'src/tusb.c')
-rw-r--r--src/tusb.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tusb.c b/src/tusb.c
index 7313a2c20..3852da76b 100644
--- a/src/tusb.c
+++ b/src/tusb.c
@@ -354,8 +354,8 @@ bool tu_edpt_stream_init(tu_edpt_stream_t* s, bool is_host, bool is_tx, bool ove
return true;
}
-bool tu_edpt_stream_deinit(tu_edpt_stream_t* s) {
- (void) s;
+bool tu_edpt_stream_deinit(tu_edpt_stream_t *s) {
+ (void)s;
#if OSAL_MUTEX_REQUIRED
if (s->ff.mutex_wr) {
osal_mutex_delete(s->ff.mutex_wr);
@@ -363,7 +363,7 @@ bool tu_edpt_stream_deinit(tu_edpt_stream_t* s) {
if (s->ff.mutex_rd) {
osal_mutex_delete(s->ff.mutex_rd);
}
-#endif
+ #endif
return true;
}
@@ -412,7 +412,7 @@ TU_ATTR_ALWAYS_INLINE static inline bool stream_release(uint8_t hwid, tu_edpt_st
bool tu_edpt_stream_write_zlp_if_needed(uint8_t hwid, tu_edpt_stream_t* s, uint32_t last_xferred_bytes) {
// ZLP condition: no pending data, last transferred bytes is multiple of packet size
const uint16_t mps = s->is_mps512 ? TUSB_EPSIZE_BULK_HS : TUSB_EPSIZE_BULK_FS;
- TU_VERIFY(!tu_fifo_count(&s->ff) && last_xferred_bytes > 0 && (0 == (last_xferred_bytes & (mps - 1))));
+ TU_VERIFY(tu_fifo_empty(&s->ff) && last_xferred_bytes > 0 && (0 == (last_xferred_bytes & (mps - 1))));
TU_VERIFY(stream_claim(hwid, s));
TU_ASSERT(stream_xfer(hwid, s, 0));
return true;
@@ -424,7 +424,7 @@ uint32_t tu_edpt_stream_write_xfer(uint8_t hwid, tu_edpt_stream_t* s) {
TU_VERIFY(stream_claim(hwid, s), 0);
// Pull data from FIFO -> EP buf
- uint16_t const count = tu_fifo_read_n(&s->ff, s->ep_buf, s->ep_bufsize);
+ const uint16_t count = tu_fifo_read_n(&s->ff, s->ep_buf, s->ep_bufsize);
if (count > 0) {
TU_ASSERT(stream_xfer(hwid, s, count), 0);
@@ -437,7 +437,7 @@ uint32_t tu_edpt_stream_write_xfer(uint8_t hwid, tu_edpt_stream_t* s) {
}
}
-uint32_t tu_edpt_stream_write(uint8_t hwid, tu_edpt_stream_t* s, void const* buffer, uint32_t bufsize) {
+uint32_t tu_edpt_stream_write(uint8_t hwid, tu_edpt_stream_t *s, const void *buffer, uint32_t bufsize) {
TU_VERIFY(bufsize > 0); // TODO support ZLP
if (0 == tu_fifo_depth(&s->ff)) {
@@ -517,7 +517,7 @@ uint32_t tu_edpt_stream_read_xfer(uint8_t hwid, tu_edpt_stream_t* s) {
}
uint32_t tu_edpt_stream_read(uint8_t hwid, tu_edpt_stream_t* s, void* buffer, uint32_t bufsize) {
- uint32_t num_read = tu_fifo_read_n(&s->ff, buffer, (uint16_t) bufsize);
+ const uint32_t num_read = tu_fifo_read_n(&s->ff, buffer, (uint16_t)bufsize);
tu_edpt_stream_read_xfer(hwid, s);
return num_read;
}