First try in keyboard driver
[incOS.git] / programs / include / rpc.h
blob49a0fc200204477f97fcda85ae904300e25e0f66
1 /*
2 Copyright (C) 2008 Mathias Gottschlag
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in the
6 Software without restriction, including without limitation the rights to use,
7 copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8 Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 #ifndef RPC_H_INCLUDED
23 #define RPC_H_INCLUDED
25 #include <stdint.h>
27 #define RPC_INIT_GET_PID 0x00
28 #define RPC_INIT_GET_FS 0x01
29 #define RPC_INIT_DEBUG 0x02
30 #define RPC_INIT_INITIALIZED 0x03
31 #define RPC_INIT_DEVFS_CREATE 0x04
32 #define RPC_INIT_DEVFS_DELETE 0x05
33 #define RPC_INIT_REGISTER_FS 0x06
34 #define RPC_INIT_FORK 0x07
35 #define RPC_INIT_EXEC 0x08
36 // File system RPCs
37 #define RPC_FS_OPEN 0x10
38 #define RPC_FS_CLOSE 0x11
39 #define RPC_FS_READ 0x12
40 #define RPC_FS_WRITE 0x13
41 #define RPC_FS_RENAME 0x14
42 #define RPC_FS_DELETE 0x15
43 #define RPC_FS_IOCTL 0x16
44 #define RPC_FS_OPENDIR 0x17
45 #define RPC_FS_SEEK 0x18
46 #define RPC_FS_TRUNCATE 0x19
47 #define RPC_FS_MOUNT 0x1A
48 #define RPC_FS_UNMOUNT 0x1B
49 #define RPC_FS_MKNOD 0x1C
50 #define RPC_FS_REWINDDIR 0x1D
51 #define RPC_FS_CLONE 0x1E
52 #define RPC_FS_IOCTL_INFO 0x1F
53 // devfs
54 #define RPC_DEVFS_OPEN 0x20
55 #define RPC_DEVFS_CLOSE 0x21
56 #define RPC_DEVFS_READ 0x22
57 #define RPC_DEVFS_WRITE 0x23
58 #define RPC_DEVFS_IOCTL 0x24
59 #define RPC_DEVFS_IOCTL_INFO 0x25
60 #define RPC_DEVFS_SEEK 0x26
61 // Other RPCs
62 #define RPC_SIGNAL 0x70
63 // User defined RPCs (everything above this index)
64 #define RPC_USER 0x80
66 typedef uint32_t (*RPCHandler)(uint32_t caller, void *data, uint32_t size);
68 void rpcInit(void);
69 void rpcSetHandler(uint8_t index, RPCHandler handler);
70 void rpcHandlerSetActive(uint32_t active);
72 uint32_t rpcSend(uint32_t process, uint8_t index, void *data, uint32_t size, uint32_t *retvalue);
74 #endif