io_read

I/O read interface.

int32_t io_read(
    struct io_descriptor *const io_descr,
    uint8_t *const buf,
    const uint16_t length
)

This function reads up to length bytes from a given I/O descriptor, and stores it in the buffer pointed to by buf. It returns the number of bytes actually read.

Parameters

descr

An I/O descriptor to read

buf

Type: uint8_t *const

The buffer pointer to story the read data

length

Type: const uint16_t

The number of bytes to read

Returns

Type: int32_t

The number of bytes actually read. This number can be less than the requested length. E.g., in a driver that uses ring buffer for reception, it may depend on the availability of data in the ring buffer.