pub fn map_dev(dev: DeviceHandle) -> StatusExpand description
Map a device in the caller’s memory layout
§Usage
Maps a given device identified by its handle (see get_device_handle).
The memory mapping system is responsible for verifying that there is enough space in the caller’s memory layout, and if yes, do map, synchronously, the device area in the caller’s memory. The device is mapped read-write, so that the caller can directly configure it.
Any mapped device can be unmapped (see unmap_dev).
This syscall returns Status::Ok if the device is successfully mapped by the kernel.
If the device handle is not owned by the caller or the caller do not own the device’s capability, the syscall returns Status::Denied If the device handle is not found, or the device is already mapped, the syscall returns Status::Invalid. If the device can’t be mapped (e.g. if the task memory layout is already full) the syscall returns Status::Busy.
§Example
match map_dev(devh) {
Status::Ok => (),
Status::Busy => (unmap_other()),
any_err => return(any_err),
}