Function sbi_rt::console_read

source ·
pub fn console_read(bytes: Physical<&mut [u8]>) -> SbiRet
Expand description

Read bytes from the debug console into an output memory.

§Parameters

The bytes parameter specifies the output memory, including the maximum bytes which can be written, and its memory physical base address (both lower and upper bits).

§Non-blocking function

This is a non-blocking SBI call, and it will not write anything into the output memory if there are no bytes to be read in the debug console.

§Return value

The number of bytes read is returned in SbiRet.value and the possible return error codes returned in SbiRet.error are shown in the table below:

Return codeDescription
SbiRet::success()Bytes read successfully.
SbiRet::invalid_param()The memory pointed to by bytes does not satisfy the requirements described in shared memory physical address range.
SbiRet::failed()Failed to read due to I/O errors.

This function is defined in RISC-V SBI Specification chapter 12.2.