73 lines
3.1 KiB
Markdown
73 lines
3.1 KiB
Markdown
|
# NOXOS Drivers API
|
||
|
|
||
|
The API is directly baked into the kernel.
|
||
|
The [libnxdrv](https://git.nerdcult.net/noxos/libraries/src/branch/master/libnxdrv) library provides dummies which can be (dynamically) linked into the driver.
|
||
|
|
||
|
All API calls are prefixed with `nx_drv_`.
|
||
|
|
||
|
# API
|
||
|
## Config
|
||
|
|
||
|
### struct `nx_drv_device_id_T`
|
||
|
This struct is used to identify PCI and USB devices.
|
||
|
|
||
|
| Name | Type | Description |
|
||
|
|-----------|----------|-------------------------|
|
||
|
| vendor_id | uint16_t | The devices vendors' ID |
|
||
|
| device_id | uint16_t | The devices' ID |
|
||
|
|
||
|
|
||
|
### struct `nx_drv_config_pci_T`
|
||
|
|
||
|
| Name | Type | Description |
|
||
|
|----------------|---------------------------------------|------------------------------------------------------|
|
||
|
| enable_progif | bool | If set to false, the `progif` field will be ignored. |
|
||
|
| class | uint8_t | The PCI main class of the supported devices. |
|
||
|
| subclass | uint8_t | The PCI subclass of the supported devices. |
|
||
|
| progif | uint8_t | The PCI progif of the supported devices. |
|
||
|
| num_device_ids | uint16_t | The size of the `device_ids` field. |
|
||
|
| device_ids | nx_drv_device_id_T [`num_device_ids`] | An array of device ids that the driver supports. |
|
||
|
|
||
|
|
||
|
### struct `nx_drv_config_usb_T`
|
||
|
|
||
|
| Name | Type | Description |
|
||
|
|----------------|---------------------------------------|---------------------------------------------------|
|
||
|
| min_version | uint8_t | The minimum required version of the USB standard. |
|
||
|
| num_device_ids | uint16_t | The size of the `device_ids` field. |
|
||
|
| device_ids | nx_drv_device_id_T [`num_device_ids`] | An array of device ids that the driver supports. |
|
||
|
|
||
|
|
||
|
### struct `nx_drv_config_fs_T`
|
||
|
|
||
|
| Name | Type | Description |
|
||
|
|----------|--------------|---------------------------------------------------------------|
|
||
|
| gpt_guid | uint8_t [16] | The GPT type GUID of the filesystem that the driver supports. |
|
||
|
| mbr_type | uint8_t | The MBR type of the filesystem that the driver supports. |
|
||
|
|
||
|
|
||
|
### func - void `nx_drv_pci_config(nx_drv_config_pci_T* config)`
|
||
|
Applies the pci configuration `config`.
|
||
|
|
||
|
This function should be called in the init function, when the driver handles PCI devices.
|
||
|
|
||
|
|
||
|
### func - void `nx_drv_usb_config(nx_drv_config_usb_T* config)`
|
||
|
Applies the usb configuration `config`.
|
||
|
|
||
|
This function should be called in the init function, when the driver handles USB devices.
|
||
|
|
||
|
|
||
|
### func - void `nx_drv_fs_config(nx_drv_config_fs_T* config)`
|
||
|
Applies the fs configuration `config`.
|
||
|
|
||
|
This function should be called in the init function, when the driver handles a filesystem.
|
||
|
|
||
|
---
|
||
|
|
||
|
## Miscellaneous
|
||
|
|
||
|
### func - void `nx_drv_log(const char* string)`
|
||
|
Logs `string`.
|
||
|
|