Fennix
1.0.0
Full Documentation
Loading...
Searching...
No Matches
device.h
Go to the documentation of this file.
1
/*
2
This file is part of Fennix Kernel.
3
4
Fennix Kernel is free software: you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation, either version 3 of
7
the License, or (at your option) any later version.
8
9
Fennix Kernel is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef __FENNIX_API_DEVICE_H__
19
#define __FENNIX_API_DEVICE_H__
20
21
#include <types.h>
22
23
#ifndef __FENNIX_API_FILESYSTEM_H__
24
#if __has_include(<interface/fs.h>)
25
#include <
interface/fs.h
>
26
#else
27
#include <
fs.h
>
28
#endif
29
#endif
// !__FENNIX_API_FILESYSTEM_H__
30
31
typedef
enum
32
{
33
DEVICE_TYPE_MASK
= 0b1111111100000000000000000000000000000000,
34
DEVICE_TYPE_NONE
= 0b0000000000000000000000000000000000000000,
35
DEVICE_TYPE_INPUT
= 0b0000000100000000000000000000000000000000,
36
DEVICE_TYPE_AUDIO
= 0b0000001000000000000000000000000000000000,
37
DEVICE_TYPE_NETWORK
= 0b0000010000000000000000000000000000000000,
38
DEVICE_TYPE_BLOCK
= 0b0000100000000000000000000000000000000000,
39
40
INPUT_TYPE_NONE
=
DEVICE_TYPE_INPUT
+ 0,
41
INPUT_TYPE_KEYBOARD
=
DEVICE_TYPE_INPUT
+ 2,
42
INPUT_TYPE_MOUSE
=
DEVICE_TYPE_INPUT
+ 4,
43
INPUT_TYPE_JOYSTICK
=
DEVICE_TYPE_INPUT
+ 8,
44
INPUT_TYPE_TOUCHSCREEN
=
DEVICE_TYPE_INPUT
+ 16,
45
INPUT_TYPE_GAMEPAD
=
DEVICE_TYPE_INPUT
+ 32,
46
INPUT_TYPE_ACCELEROMETER
=
DEVICE_TYPE_INPUT
+ 64,
47
INPUT_TYPE_GYROSCOPE
=
DEVICE_TYPE_INPUT
+ 128,
48
INPUT_TYPE_MAGNETOMETER
=
DEVICE_TYPE_INPUT
+ 256,
49
50
AUDIO_TYPE_NONE
=
DEVICE_TYPE_AUDIO
+ 0,
51
AUDIO_TYPE_PWM
=
DEVICE_TYPE_AUDIO
+ 2,
52
AUDIO_TYPE_DSP
=
DEVICE_TYPE_AUDIO
+ 4,
53
AUDIO_TYPE_PCM
=
DEVICE_TYPE_AUDIO
+ 8,
54
AUDIO_TYPE_MIDI
=
DEVICE_TYPE_AUDIO
+ 16,
55
56
NETWORK_TYPE_NONE
=
DEVICE_TYPE_NETWORK
+ 0,
57
NETWORK_TYPE_ETHERNET
=
DEVICE_TYPE_NETWORK
+ 2,
58
NETWORK_TYPE_WIFI
=
DEVICE_TYPE_NETWORK
+ 4,
59
NETWORK_TYPE_BLUETOOTH
=
DEVICE_TYPE_NETWORK
+ 8,
60
NETWORK_TYPE_UART
=
DEVICE_TYPE_NETWORK
+ 16,
61
62
BLOCK_TYPE_NONE
=
DEVICE_TYPE_BLOCK
+ 0,
63
BLOCK_TYPE_SDCARD
=
DEVICE_TYPE_BLOCK
+ 2,
64
BLOCK_TYPE_HDD
=
DEVICE_TYPE_BLOCK
+ 4,
65
BLOCK_TYPE_SSD
=
DEVICE_TYPE_BLOCK
+ 8,
66
BLOCK_TYPE_USB
=
DEVICE_TYPE_BLOCK
+ 16,
67
BLOCK_TYPE_NVME
=
DEVICE_TYPE_BLOCK
+ 32,
68
BLOCK_TYPE_CDROM
=
DEVICE_TYPE_BLOCK
+ 64,
69
BLOCK_TYPE_FLOPPY
=
DEVICE_TYPE_BLOCK
+ 128,
70
}
DeviceType
;
71
72
#ifndef __kernel__
73
EXTERNC dev_t
CreateDeviceFile
(
const
char
*name, mode_t mode,
const
struct
InodeOperations
*Operations);
74
EXTERNC dev_t
RegisterDevice
(
DeviceType
Type,
const
struct
InodeOperations
*Operations);
75
EXTERNC
int
UnregisterDevice
(dev_t Device);
76
#endif
// !__kernel__
77
78
#endif
// !__FENNIX_API_DEVICE_H__
UnregisterDevice
EXTERNC int UnregisterDevice(dev_t Device)
RegisterDevice
EXTERNC dev_t RegisterDevice(DeviceType Type, const struct InodeOperations *Operations)
CreateDeviceFile
EXTERNC dev_t CreateDeviceFile(const char *name, mode_t mode, const struct InodeOperations *Operations)
DeviceType
DeviceType
Definition
device.h:32
INPUT_TYPE_TOUCHSCREEN
@ INPUT_TYPE_TOUCHSCREEN
Definition
device.h:44
INPUT_TYPE_GYROSCOPE
@ INPUT_TYPE_GYROSCOPE
Definition
device.h:47
DEVICE_TYPE_MASK
@ DEVICE_TYPE_MASK
Definition
device.h:33
DEVICE_TYPE_AUDIO
@ DEVICE_TYPE_AUDIO
Definition
device.h:36
NETWORK_TYPE_BLUETOOTH
@ NETWORK_TYPE_BLUETOOTH
Definition
device.h:59
AUDIO_TYPE_PWM
@ AUDIO_TYPE_PWM
Definition
device.h:51
BLOCK_TYPE_NONE
@ BLOCK_TYPE_NONE
Definition
device.h:62
DEVICE_TYPE_NONE
@ DEVICE_TYPE_NONE
Definition
device.h:34
DEVICE_TYPE_NETWORK
@ DEVICE_TYPE_NETWORK
Definition
device.h:37
NETWORK_TYPE_NONE
@ NETWORK_TYPE_NONE
Definition
device.h:56
BLOCK_TYPE_SDCARD
@ BLOCK_TYPE_SDCARD
Definition
device.h:63
DEVICE_TYPE_INPUT
@ DEVICE_TYPE_INPUT
Definition
device.h:35
NETWORK_TYPE_UART
@ NETWORK_TYPE_UART
Definition
device.h:60
NETWORK_TYPE_WIFI
@ NETWORK_TYPE_WIFI
Definition
device.h:58
BLOCK_TYPE_USB
@ BLOCK_TYPE_USB
Definition
device.h:66
BLOCK_TYPE_CDROM
@ BLOCK_TYPE_CDROM
Definition
device.h:68
AUDIO_TYPE_PCM
@ AUDIO_TYPE_PCM
Definition
device.h:53
INPUT_TYPE_ACCELEROMETER
@ INPUT_TYPE_ACCELEROMETER
Definition
device.h:46
BLOCK_TYPE_SSD
@ BLOCK_TYPE_SSD
Definition
device.h:65
AUDIO_TYPE_DSP
@ AUDIO_TYPE_DSP
Definition
device.h:52
INPUT_TYPE_NONE
@ INPUT_TYPE_NONE
Definition
device.h:40
INPUT_TYPE_JOYSTICK
@ INPUT_TYPE_JOYSTICK
Definition
device.h:43
INPUT_TYPE_KEYBOARD
@ INPUT_TYPE_KEYBOARD
Definition
device.h:41
NETWORK_TYPE_ETHERNET
@ NETWORK_TYPE_ETHERNET
Definition
device.h:57
AUDIO_TYPE_MIDI
@ AUDIO_TYPE_MIDI
Definition
device.h:54
INPUT_TYPE_MOUSE
@ INPUT_TYPE_MOUSE
Definition
device.h:42
AUDIO_TYPE_NONE
@ AUDIO_TYPE_NONE
Definition
device.h:50
INPUT_TYPE_MAGNETOMETER
@ INPUT_TYPE_MAGNETOMETER
Definition
device.h:48
INPUT_TYPE_GAMEPAD
@ INPUT_TYPE_GAMEPAD
Definition
device.h:45
DEVICE_TYPE_BLOCK
@ DEVICE_TYPE_BLOCK
Definition
device.h:38
BLOCK_TYPE_NVME
@ BLOCK_TYPE_NVME
Definition
device.h:67
BLOCK_TYPE_HDD
@ BLOCK_TYPE_HDD
Definition
device.h:64
BLOCK_TYPE_FLOPPY
@ BLOCK_TYPE_FLOPPY
Definition
device.h:69
fs.h
InodeOperations
Definition
fs.h:305
Kernel
include
interface
device.h
Generated on Thu Apr 3 2025 07:14:29 for Fennix by
1.9.8