Skip to content
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

function "tu_fifo_peek_at_n" return vlaue incompatible (IDFGH-6508) #8161

Closed
dreamtrek opened this issue Dec 29, 2021 · 3 comments
Closed

function "tu_fifo_peek_at_n" return vlaue incompatible (IDFGH-6508) #8161

dreamtrek opened this issue Dec 29, 2021 · 3 comments
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally

Comments

@dreamtrek
Copy link

Environment

  • IDF version:
    v4.4-beta1

Problem Description

it returned a bool value instead of the data length

Code to reproduce this issue

/******************************************************************************/
/*!
    @brief Read n items without removing it from the FIFO
    This function checks for an overflow and corrects read pointer if required.

    @param[in]  f
                Pointer to the FIFO buffer to manipulate
    @param[in]  offset
                Position to read from in the FIFO buffer with respect to read pointer
    @param[in]  p_buffer
                Pointer to the place holder for data read from the buffer
    @param[in]  n
                Number of items to peek

    @returns Number of bytes written to p_buffer
 */
/******************************************************************************/
uint16_t tu_fifo_peek_at_n(tu_fifo_t* f, uint16_t offset, void * p_buffer, uint16_t n)
{
  _ff_lock(f->mutex_rd);
  bool ret = _tu_fifo_peek_at_n(f, offset, p_buffer, n, f->wr_idx, f->rd_idx, TU_FIFO_COPY_INC);
  _ff_unlock(f->mutex_rd);
  return ret;
}
@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 29, 2021
@github-actions github-actions bot changed the title function "tu_fifo_peek_at_n" return vlaue incompatible function "tu_fifo_peek_at_n" return vlaue incompatible (IDFGH-6508) Dec 29, 2021
@zikalino zikalino self-assigned this Dec 29, 2021
@zikalino
Copy link
Collaborator

Just checked, indeed an issue in Espressif's TinyUSB fork here: https://github.com/espressif/tinyusb/blob/075334af80303488a8c874255d725cb4ca15a7de/src/common/tusb_fifo.c#L486

@dreamtrek we will fix it and keep you updated

@alisitsyn
Copy link
Collaborator

@dreamtrek,
The fix was merged in commit 6ddf2ea. Will be synchronized with github soon.

@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally and removed Status: Opened Issue is new labels Sep 5, 2022
@Alvin1Zhang
Copy link
Collaborator

Thanks for reporting, feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

5 participants