/* This function will fetch but retaining data in the data queue.  */
rt_err_t rt_data_queue_peek(struct rt_data_queue *queue, const void **data_ptr, rt_size_t *size)
/* This function will fetch but retaining data in the data queue.  */
rt_err_t rt_data_queue_peek(struct rt_data_queue *queue, const void **data_ptr, rt_size_t *size)
{
    rt_base_t level;
    RT_ASSERT(queue != RT_NULL);
    RT_ASSERT(queue->magic == DATAQUEUE_MAGIC);
    if (queue->is_empty)
    {
        return -RT_EEMPTY;
    }
    level = rt_spin_lock_irqsave(&(queue->spinlock));
    *data_ptr = queue->queue[queue->get_index].data_ptr;
    *size     = queue->queue[queue->get_index].data_size;
    rt_spin_unlock_irqrestore(&(queue->spinlock), level);
    return RT_EOK;
}