Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
647 andrew_pro 1
#ifndef kolibrisys_h
2
#define kolibrisys_h
3
/*
4
#ifdef GNUC
5
#define stdcall __stdcall
6
#define cdecl __cdecl
7
#else
8
#define stdcall  ((__stdcall))
9
#define cdecl    ((__cdecl))
10
#endif
11
*/
12
//#ifdef GNUC
13
//#define stdcall __stdcall
14
//#else
15
#define cdecl   __attribute__ ((cdecl))
16
#define stdcall __attribute__ ((stdcall))
17
//#endif
8540 superturbo 18
typedef void* func_ptr;
647 andrew_pro 19
typedef unsigned int dword;
20
typedef unsigned char byte;
21
typedef unsigned short word;
22
 
23
typedef unsigned int fpos_t;
24
typedef unsigned int size_t;
8403 superturbo 25
#pragma pack(push,1)
26
struct process_table_entry{
647 andrew_pro 27
  int cpu_usage;             //+0
28
  int window_pos_info;       //+4
29
  short int reserved1;       //+8
30
  char name[12];             //+10
31
  int memstart;              //+22
32
  int memused;               //+26
33
  int pid;                   //+30
34
  int winx_start;            //+34
35
  int winy_start;            //+38
36
  int winx_size;             //+42
37
  int winy_size;             //+46
38
  short int slot_info;       //+50
39
  short int reserved2;       //+52
40
  int clientx;               //+54
41
  int clienty;               //+58
42
  int clientwidth;           //+62
43
  int clientheight;          //+66
44
  unsigned char window_state;//+70
45
  char reserved3[1024-71];   //+71
8403 superturbo 46
};
47
#pragma pack(pop)
647 andrew_pro 48
 
49
//-----------------------------------------------------------------------------------
50
//------------------------KolibriOS system acces to files----------------------------
51
//-----------------------------------------------------------------------------------
52
extern dword stdcall _ksys_get_filesize(char *filename);
7184 siemargl 53
extern dword stdcall _ksys_readfile(char *filename,dword pos,dword blocksize,void *data, int *preadbytes);
647 andrew_pro 54
extern dword stdcall _ksys_rewritefile(char *filename,dword blocksize,void *data);
55
extern dword stdcall _ksys_appendtofile(char *filename,dword pos,dword blocksize,void *data);
56
//-----------------------------------------------------------------------------------
57
 
58
//----------------------Run program---------------------------------------------------
59
extern void stdcall _ksys_run_program(char* filename,char* parameters);
60
//------------------------------------------------------------------------------------
61
 
62
//--------------------Debug output---------------------------------------------------
63
extern void stdcall _ksys_debug_out(int c);
64
extern void stdcall debug_out_str(char* str);
65
//-----------------------------------------------------------------------------------
66
 
67
//--------------------------Mouse state----------------------------------------------
68
extern int   stdcall _ksys_GetMouseXY(void);
69
extern int   stdcall _ksys_GetMouseButtonsState(void);
70
//-----------------------------------------------------------------------------------
71
 
72
//--------------------------get skin height------------------------------------------
73
extern int   stdcall _ksys_get_skin_height(void);
74
//-----------------------------------------------------------------------------------
75
 
76
//----------------------------background---------------------------------------------
77
extern void stdcall _ksys_set_background_size(int xsize,int ysize);
78
extern void stdcall _ksys_write_background_mem(int pos,int color);
79
extern void stdcall _ksys_draw_background(void);
80
extern void stdcall _ksys_set_background_draw_type(int type);
81
extern void stdcall _ksys_background_blockmove(void* src,int bgr_pos, int count);
82
//-----------------------------------------------------------------------------------
83
 
84
//----------------------------functionf for draw window,lines.bar,etc.---------------
85
extern void stdcall _ksys_draw_window(int xcoord,int ycoord, int xsize,
86
                               int ysize,int workcolor,int type,
87
                               int captioncolor,int windowtype,int bordercolor);
88
extern void stdcall _ksys_window_redraw(int status);
89
extern int  stdcall _ksys_putpixel(int x,int y,int color);
90
extern void stdcall _ksys_draw_bar(int x, int y, int xsize, int ysize, int color);
91
extern void stdcall _ksys_line(int x1,int y1,int x2,int y2,int color);
92
extern void stdcall _ksys_putimage(int x, int y, int xsize, int ysize, void* image);
93
//-----------------------------------------------------------------------------------
94
 
95
//--------------------------write text(system fonts 6x9)-----------------------------
96
extern void stdcall _ksys_write_text(int x,int y,int color,char* text,int len);
97
//-----------------------------------------------------------------------------------
98
 
99
//------------------  get screen size  and bytes per pixel---------------------------
100
extern int  stdcall _ksys_get_screen_size(int* x,int* y);
101
extern void stdcall _ksys_dga_get_resolution(int* xres, int* yres, int* bpp, int* bpscan);
102
//-----------------------------------------------------------------------------------
103
 
104
//-------------------------------craete thread---------------------------------------
105
extern void* stdcall  _ksys_start_thread(void (* func_ptr)(void),int stack_size,int* pid);
106
//-----------------------------------------------------------------------------------
107
 
108
//------------------system button(Old function. Better use libGUI functions.)--------
109
extern void stdcall _ksys_make_button(int x, int y, int xsize, int ysize, int id, int color);
110
extern int  stdcall _ksys_get_button_id(void); //get state of system button
111
//------------------------------------------------------------------------------------
112
 
113
//----------------------system clock(in 1/100 sec.) and date--------------------------
114
extern int  stdcall _ksys_get_system_clock(void);
115
extern int  stdcall _ksys_get_date(void);
116
//------------------------------------------------------------------------------------
117
 
118
//-------------------------system delay(in 1/100 sec.)-------------------------------
119
extern void stdcall _ksys_delay(int m);
120
//-----------------------------------------------------------------------------------
121
 
122
//------------------------system events----------------------------------------------
123
extern int  stdcall _ksys_wait_for_event_infinite(void);
124
extern int  stdcall _ksys_check_for_event(void);
125
extern int  stdcall _ksys_wait_for_event(int time);
126
extern void stdcall _ksys_set_wanted_events(int ev);
127
//-----------------------------------------------------------------------------------
128
 
129
//----------------------------system exit program------------------------------------
130
extern void stdcall _ksys_exit(void);
131
//-----------------------------------------------------------------------------------
132
 
133
//-----------------------------system IPC send message-------------------------------
134
extern void stdcall _ksys_send_message(int pid, void* msg, int size);
135
//-----------------------------------------------------------------------------------
136
 
137
//---------------------------system work with IRQ from user mode---------------------
138
extern void stdcall _ksys_define_receive_area(void* area, int size);
139
extern int  stdcall _ksys_get_irq_owner(int irq);
140
extern int  stdcall _ksys_get_data_read_by_irq(int irq, int* size, void* data);
141
extern int  stdcall _ksys_send_data_to_device(int port, unsigned char val);
142
extern int  stdcall _ksys_receive_data_from_device(int port,unsigned char* data);
143
extern void stdcall _ksys_program_irq(void* intrtable, int irq);
144
extern void stdcall _ksys_reserve_irq(int irq);
145
extern void stdcall _ksys_free_irq(int irq);
146
//----------------------------------------------------------------------------------
147
 
148
//----------------------------system reserve diapason of ports----------------------
149
extern int  stdcall _ksys_reserve_port_area(int start,int end);
150
extern int  stdcall _ksys_free_port_area(int start,int end);
151
//----------------------------------------------------------------------------------
152
 
153
//-------------functions get key and set keyboard mode------------------------------
154
extern int  stdcall _ksys_get_key(void);
155
extern void stdcall _ksys_set_keyboard_mode(int mode);
156
//----------------------------------------------------------------------------------
157
 
158
//--------------simple work with MPU401 sound device---------------------------------
159
extern void stdcall _ksys_midi_reset(void);
160
extern void stdcall _ksys_midi_send(int data);
161
//-----------------------------------------------------------------------------------
162
 
163
//--------------------------acces to PCI BUS from user mode---------------------------
164
extern int  stdcall _ksys_get_pci_version(void);
165
extern int  stdcall _ksys_get_last_pci_bus(void);
166
extern int  stdcall _ksys_get_pci_access_mechanism(void);
167
extern int  stdcall _ksys_pci_read_config_byte(int bus,int dev,int fn,int reg);
168
extern int  stdcall _ksys_pci_read_config_word(int bus,int dev,int fn,int reg);
169
extern int  stdcall _ksys_pci_read_config_dword(int bus,int dev,int fn,int reg);
170
extern int  stdcall _ksys_pci_write_config_byte(int bus,int dev,int fn,int reg,int value);
171
extern int  stdcall _ksys_pci_write_config_word(int bus,int dev,int fn,int reg,int value);
7820 rgimad 172
extern int  stdcall _ksys_pci_write_config_dword(int bus,int dev,int fn,int reg,int value);
647 andrew_pro 173
//--------------------------------------------------------------------------------------
174
 
8337 superturbo 175
//------------------------Working with processes--------------------------------------
647 andrew_pro 176
extern int  stdcall _ksys_get_process_table(struct process_table_entry *proctab,int pid); //if pid=-1 than get info about him.
8337 superturbo 177
extern int  stdcall _ksys_kill_process(int pid); // if it returns -1 then an error.
647 andrew_pro 178
//---------------------------------------------------------------------------------
179
 
180
//-----------------Old functions for work with sound(Sound Blaster only).---------
181
extern void stdcall _ksys_sound_load_block(void* blockptr);
182
extern void stdcall _ksys_sound_play_block(void);
183
extern void stdcall _ksys_sound_set_channels(int channels);
184
extern void stdcall _ksys_sound_set_data_size(int size);
185
extern void stdcall _ksys_sound_set_frequency(int frequency);
186
//--------------------------------------------------------------------------------
187
 
188
//------------------------------system speaker(integrated speaker)----------------
189
extern void stdcall _ksys_sound_speaker_play(void* data);
190
//--------------------------------------------------------------------------------
191
 
192
//------------------function for work with Dinamic Link Librarys(DLL)--------------
193
extern dword* stdcall _ksys_cofflib_load(char* name);
8540 superturbo 194
extern func_ptr stdcall _ksys_cofflib_getproc(void* exp,char* sz_name);
647 andrew_pro 195
//---------------------------------------------------------------------------------
196
 
197
#endif