/* Get the first readable byte of the ring buffer.  */
rt_size_t rt_ringbuffer_peak(struct rt_ringbuffer *rb, rt_uint8_t **ptr)
/* Get the first readable byte of the ring buffer.  */
rt_size_t rt_ringbuffer_peak(struct rt_ringbuffer *rb, rt_uint8_t **ptr)
{
    RT_ASSERT(rb != RT_NULL);
    *ptr = RT_NULL;
    rt_size_t size = rt_ringbuffer_data_len(rb);
    if (size == 0)
        return 0;
    *ptr = &rb->buffer_ptr[rb->read_index];
    if(rb->buffer_size - rb->read_index > size)
    {
        rb->read_index += size;
        return size;
    }
    size = rb->buffer_size - rb->read_index;
    rb->read_mirror = ~rb->read_mirror;
    rb->read_index = 0;
    return size;
}