Skip to main content

dup_driver_num

Function dup_driver_num 

Source
pub const fn dup_driver_num(driver_num: usize, instance_num: usize) -> usize
Expand description

Create a DRIVER_NUM for a second (or third, etc.) instance of a SyscallDriver.

Creating additional driver numbers for known drivers uses the second most significant nibble of the 32-bit driver number. This allows creating up to 15 additional driver numbers for the same driver. The original driver of course has 0 in this field.

The format is like this:

32         28         24                                        0
 ┌──────────┬──────────┬────────────────────────────────────────┐
 │ 0        │ Instance │ Driver Number                          │
 │          │ Number   │                                        │
 └──────────┴──────────┴────────────────────────────────────────┘