Rev 9784 | Rev 9829 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9784 | Rev 9788 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | #ifndef _KSYS_H_ |
|
- | 2 | #define _KSYS_H_ |
|
- | 3 | ||
1 | /* Copyright (C) KolibriOS team 2004-2021. All rights reserved. */ |
4 | /* Copyright (C) KolibriOS team 2004-2021. All rights reserved. */ |
2 | /* Distributed under terms of the GNU General Public License */ |
5 | /* Distributed under terms of the GNU General Public License */ |
Line 3... | Line 6... | ||
3 | 6 | ||
4 | /* This file contains basic wrappers over KolibriOS system calls. */ |
7 | /* This file contains basic wrappers over KolibriOS system calls. */ |
Line 14... | Line 17... | ||
14 | 17 | ||
15 | * Warning! The end of the file is the old definitions of function/structure names. |
18 | * Warning! The end of the file is the old definitions of function/structure names. |
16 | * They are for compatibility... Better not to use them. |
19 | * They are for compatibility... Better not to use them. |
Line 17... | Line -... | ||
17 | */ |
- | |
18 | - | ||
19 | #ifndef _KSYS_H_ |
- | |
20 | #define _KSYS_H_ |
20 | */ |
21 | 21 | ||
Line 22... | Line 22... | ||
22 | #include |
22 | #include |
23 | #include |
23 | #include |
Line 191... | Line 191... | ||
191 | typedef struct { |
191 | typedef struct { |
192 | char key[64]; |
192 | char key[64]; |
193 | char path[64]; |
193 | char path[64]; |
194 | } ksys_dir_key_t; |
194 | } ksys_dir_key_t; |
Line -... | Line 195... | ||
- | 195 | ||
- | 196 | typedef union { |
|
- | 197 | uint8_t raw_data[24]; |
|
- | 198 | struct { |
|
- | 199 | uint32_t id; |
|
- | 200 | uint8_t data[20]; |
|
- | 201 | }; |
|
- | 202 | } ksys_signal_info_t; |
|
195 | 203 | ||
Line 196... | Line 204... | ||
196 | #pragma pack(pop) |
204 | #pragma pack(pop) |
Line 197... | Line 205... | ||
197 | 205 | ||
Line 352... | Line 360... | ||
352 | "int $0x40" ::"a"(8), "d"(id & 0x00FFFFFF | 0x80000000)); |
360 | "int $0x40" ::"a"(8), "d"(id & 0x00FFFFFF | 0x80000000)); |
353 | } |
361 | } |
Line 354... | Line 362... | ||
354 | 362 | ||
Line -... | Line 363... | ||
- | 363 | /*============ Function 9 - information on execution thread. ===========*/ |
|
- | 364 | ||
- | 365 | #define KSYS_THIS_SLOT -1 |
|
- | 366 | ||
- | 367 | enum KSYS_SLOT_STATES { |
|
- | 368 | KSYS_SLOT_STATE_RUNNING = 0, |
|
- | 369 | KSYS_SLOT_STATE_SUSPENDED = 1, |
|
- | 370 | KSYS_SLOT_STATE_SUSPENDED_WAIT_EVENT = 2, |
|
- | 371 | KSYS_SLOT_STATE_NORMAL_TERM = 3, |
|
- | 372 | KSYS_SLOT_STATE_EXCEPT_TERM = 4, |
|
- | 373 | KSYS_SLOT_STATE_WAIT_EVENT = 5, |
|
- | 374 | KSYS_SLOT_STATE_FREE = 6 |
|
355 | /*============ Function 9 - information on execution thread. ===========*/ |
375 | }; |
356 | 376 | ||
357 | KOSAPI int _ksys_thread_info(ksys_thread_t* table, int slot) |
377 | KOSAPI int _ksys_thread_info(ksys_thread_t* table, int slot) |
358 | { |
378 | { |
359 | int val; |
379 | int val; |
Line 1078... | Line 1098... | ||
1078 | { |
1098 | { |
1079 | asm_inline( |
1099 | asm_inline( |
1080 | "int $0x40" ::"a"(67), "b"(new_x), "c"(new_y), "d"(new_w), "S"(new_h)); |
1100 | "int $0x40" ::"a"(67), "b"(new_x), "c"(new_y), "d"(new_w), "S"(new_h)); |
1081 | } |
1101 | } |
Line -... | Line 1102... | ||
- | 1102 | ||
- | 1103 | /*===== Function 68, subfunction 1 - switch to the next thread of execution ====*/ |
|
- | 1104 | ||
- | 1105 | KOSAPI void _ksys_thread_yield(void) |
|
- | 1106 | { |
|
- | 1107 | asm_inline("int $0x40" :: "a"(68),"b"(1)); |
|
- | 1108 | } |
|
1082 | 1109 | ||
Line 1083... | Line 1110... | ||
1083 | /*======== Function 68, subfunction 12 - allocate memory block. ========*/ |
1110 | /*======== Function 68, subfunction 12 - allocate memory block. ========*/ |
1084 | 1111 | ||
1085 | KOSAPI void* _ksys_alloc(size_t size) |
1112 | KOSAPI void* _ksys_alloc(size_t size) |
Line 1102... | Line 1129... | ||
1102 | : "=a"(val) |
1129 | : "=a"(val) |
1103 | : "a"(68), "b"(13), "c"(mem)); |
1130 | : "a"(68), "b"(13), "c"(mem)); |
1104 | return val; |
1131 | return val; |
1105 | } |
1132 | } |
Line -... | Line 1133... | ||
- | 1133 | ||
- | 1134 | /*====== Function 68, subfunction 14 - Wait signal from other applications/drivers. =====*/ |
|
- | 1135 | ||
- | 1136 | KOSAPI void _ksys_wait_signal(ksys_signal_info_t* signal) |
|
- | 1137 | { |
|
- | 1138 | asm_inline("int $0x40" :: "a"(68),"b"(14),"c"(signal) : "memory"); |
|
- | 1139 | } |
|
1106 | 1140 | ||
Line 1107... | Line 1141... | ||
1107 | /*============= Function 68, subfunction 16 - load driver. =============*/ |
1141 | /*============= Function 68, subfunction 16 - load driver. =============*/ |
1108 | 1142 | ||
1109 | KOSAPI ksys_drv_hand_t _ksys_load_driver(char* driver_name) |
1143 | KOSAPI ksys_drv_hand_t _ksys_load_driver(char* driver_name) |