示例#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
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;
}