pub fn pmu_counter_get_info(counter_idx: usize) -> SbiRet
Expand description

Get details about the specified counter.

The value returned includes details such as underlying CSR number, width of the counter, type of counter (hardware or firmware), etc.

The counter_info returned by this SBI call is encoded as follows:

    counter_info[11:0] = CSR; // (12bit CSR number)
    counter_info[17:12] = Width; // (One less than number of bits in CSR)
    counter_info[XLEN-2:18] = Reserved; // Reserved for future use
    counter_info[XLEN-1] = Type; // (0 = hardware and 1 = firmware)

If counter_info.type == 1 then counter_info.csr and counter_info.width should be ignored.

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

§Return value

Returns the counter_info described above in SbiRet.value.

The possible return error codes returned in SbiRet.error are shown in the table below:

Return codeDescription
SbiRet::success()counter_info read successfully.
SbiRet::invalid_param()counter_idx points to an invalid counter.

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