From 2c4cb4dd01268b334e53f2d3f14de961f3276447 Mon Sep 17 00:00:00 2001 From: antifallobst Date: Thu, 1 Jun 2023 12:01:05 +0200 Subject: [PATCH] feature (libnxdrv): implemented basic configuration API calls --- libnxdrv/inc/libnxdrv.h | 37 +++++++++++++++++++++++++++++++++---- libnxdrv/inc/stdtypes.h | 22 ++++++++++++++++++++++ libnxdrv/src/libnxdrv.c | 12 +++++++++++- 3 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 libnxdrv/inc/stdtypes.h diff --git a/libnxdrv/inc/libnxdrv.h b/libnxdrv/inc/libnxdrv.h index 974bb36..153f2fd 100644 --- a/libnxdrv/inc/libnxdrv.h +++ b/libnxdrv/inc/libnxdrv.h @@ -1,8 +1,37 @@ // This file is part of noxos and licensed under the MIT open source license -#ifndef NOXOS_LIBNXDRV_H -#define NOXOS_LIBNXDRV_H +#ifndef LIBNXDRV_LIBNXDRV_H +#define LIBNXDRV_LIBNXDRV_H -void nx_drv_init(); +#include "stdtypes.h" -#endif //NOXOS_LIBNXDRV_H \ No newline at end of file +typedef struct { + uint16_t vendor_id; + uint16_t device_id; +} __attribute__((packed)) nx_drv_device_id_T; + +typedef struct { + bool enable_progif; + uint8_t class; + uint8_t subclass; + uint8_t progif; + uint16_t num_device_ids; + nx_drv_device_id_T device_ids; +} __attribute__((packed)) nx_drv_config_pci_T; + +typedef struct { + uint8_t min_version; + uint16_t num_device_ids; + nx_drv_device_id_T device_ids; +} __attribute__((packed)) nx_drv_config_usb_T; + +typedef struct { + uint8_t gpt_guid[16]; + uint8_t mbr_type; +} __attribute__((packed)) nx_drv_config_fs_T; + +void nx_drv_pci_config(nx_drv_config_pci_T* config); +void nx_drv_usb_config(nx_drv_config_usb_T* config); +void nx_drv_fs_config (nx_drv_config_fs_T* config); + +#endif //LIBNXDRV_LIBNXDRV_H \ No newline at end of file diff --git a/libnxdrv/inc/stdtypes.h b/libnxdrv/inc/stdtypes.h new file mode 100644 index 0000000..d9bcf99 --- /dev/null +++ b/libnxdrv/inc/stdtypes.h @@ -0,0 +1,22 @@ +// This file is part of noxos and licensed under the MIT open source license + +#ifndef LIBNXDRV_STDTYPES_H +#define LIBNXDRV_STDTYPES_H + +typedef unsigned char uint8_t; +typedef signed char int8_t; +typedef unsigned short uint16_t; +typedef signed short int16_t; +typedef unsigned int uint32_t; +typedef signed int int32_t; +typedef unsigned long uint64_t; +typedef signed long int64_t; + +typedef _Bool bool; + +#define true 1 +#define false 0 + +#define NULL (void*)0 + +#endif //LIBNXDRV_STDTYPES_H diff --git a/libnxdrv/src/libnxdrv.c b/libnxdrv/src/libnxdrv.c index 3138f00..8303619 100644 --- a/libnxdrv/src/libnxdrv.c +++ b/libnxdrv/src/libnxdrv.c @@ -1,5 +1,15 @@ // This file is part of noxos and licensed under the MIT open source license -void nx_drv_init() { +#include "libnxdrv.h" + +void nx_drv_pci_config(nx_drv_config_pci_T* config) { + +} + +void nx_drv_usb_config(nx_drv_config_usb_T* config) { + +} + +void nx_drv_fs_config(nx_drv_config_fs_T* config) { } \ No newline at end of file