예제 #1
0
파일: fifo.c 프로젝트: vyacht/stm32
unsigned int fifo_in(fifo_t *fifo,
                     const uint8_t *buf, unsigned long len)
{
    unsigned int l;

    l = fifo_unused(fifo);
    if (len > l)
        len = l;

    fifo_copy_in(fifo, buf, len, fifo->in);
    fifo->in += len;
    return len;
}
예제 #2
0
파일: k_fifo.c 프로젝트: cyysu/AliOS-Things
uint32_t fifo_in(struct k_fifo *fifo, const void *buf, uint32_t len)
{
    uint32_t l;

    CPSR_ALLOC();

    RHINO_CRITICAL_ENTER();

    l = fifo_unused(fifo);

    if (len > l) {
        len = l;
    }

    fifo_copy_in(fifo, buf, len, fifo->in);
    fifo->in += len;

    fifo->free_bytes -= len;

    RHINO_CRITICAL_EXIT();
    return len;
}
예제 #3
0
파일: fifo.c 프로젝트: vyacht/stm32
/**
 * fifo_capacity - returns the number free space for new elements
 * @fifo: address of the fifo to be used
 */
unsigned int fifo_free(fifo_t * fifo)
{
    return fifo_unused(fifo);
}