Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  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
  18.  
  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;
  25.  
  26. typedef struct process_table_entry{
  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
  46. }__attribute__((packed));
  47.  
  48. //-----------------------------------------------------------------------------------
  49. //------------------------KolibriOS system acces to files----------------------------
  50. //-----------------------------------------------------------------------------------
  51. extern dword stdcall _ksys_get_filesize(char *filename);
  52. extern dword stdcall _ksys_readfile(char *filename,dword pos,dword blocksize,void *data, int *preadbytes);
  53. extern dword stdcall _ksys_rewritefile(char *filename,dword blocksize,void *data);
  54. extern dword stdcall _ksys_appendtofile(char *filename,dword pos,dword blocksize,void *data);
  55. //-----------------------------------------------------------------------------------
  56.  
  57. //----------------------Run program---------------------------------------------------
  58. extern void stdcall _ksys_run_program(char* filename,char* parameters);
  59. //------------------------------------------------------------------------------------
  60.  
  61. //--------------------Debug output---------------------------------------------------
  62. extern void stdcall _ksys_debug_out(int c);
  63. extern void stdcall debug_out_str(char* str);
  64. //-----------------------------------------------------------------------------------
  65.  
  66. //--------------------------Mouse state----------------------------------------------
  67. extern int   stdcall _ksys_GetMouseXY(void);
  68. extern int   stdcall _ksys_GetMouseButtonsState(void);
  69. //-----------------------------------------------------------------------------------
  70.  
  71. //--------------------------get skin height------------------------------------------
  72. extern int   stdcall _ksys_get_skin_height(void);
  73. //-----------------------------------------------------------------------------------
  74.  
  75. //----------------------------background---------------------------------------------
  76. extern void stdcall _ksys_set_background_size(int xsize,int ysize);
  77. extern void stdcall _ksys_write_background_mem(int pos,int color);
  78. extern void stdcall _ksys_draw_background(void);
  79. extern void stdcall _ksys_set_background_draw_type(int type);
  80. extern void stdcall _ksys_background_blockmove(void* src,int bgr_pos, int count);
  81. //-----------------------------------------------------------------------------------
  82.  
  83. //----------------------------functionf for draw window,lines.bar,etc.---------------
  84. extern void stdcall _ksys_draw_window(int xcoord,int ycoord, int xsize,
  85.                                int ysize,int workcolor,int type,
  86.                                int captioncolor,int windowtype,int bordercolor);
  87. extern void stdcall _ksys_window_redraw(int status);
  88. extern int  stdcall _ksys_putpixel(int x,int y,int color);
  89. extern void stdcall _ksys_draw_bar(int x, int y, int xsize, int ysize, int color);
  90. extern void stdcall _ksys_line(int x1,int y1,int x2,int y2,int color);
  91. extern void stdcall _ksys_putimage(int x, int y, int xsize, int ysize, void* image);
  92. //-----------------------------------------------------------------------------------
  93.  
  94. //--------------------------write text(system fonts 6x9)-----------------------------
  95. extern void stdcall _ksys_write_text(int x,int y,int color,char* text,int len);
  96. //-----------------------------------------------------------------------------------
  97.  
  98. //------------------  get screen size  and bytes per pixel---------------------------
  99. extern int  stdcall _ksys_get_screen_size(int* x,int* y);
  100. extern void stdcall _ksys_dga_get_resolution(int* xres, int* yres, int* bpp, int* bpscan);
  101. //-----------------------------------------------------------------------------------
  102.  
  103. //-------------------------------craete thread---------------------------------------
  104. extern void* stdcall  _ksys_start_thread(void (* func_ptr)(void),int stack_size,int* pid);
  105. //-----------------------------------------------------------------------------------
  106.  
  107. //------------------system button(Old function. Better use libGUI functions.)--------
  108. extern void stdcall _ksys_make_button(int x, int y, int xsize, int ysize, int id, int color);
  109. extern int  stdcall _ksys_get_button_id(void); //get state of system button
  110. //------------------------------------------------------------------------------------
  111.  
  112. //----------------------system clock(in 1/100 sec.) and date--------------------------
  113. extern int  stdcall _ksys_get_system_clock(void);
  114. extern int  stdcall _ksys_get_date(void);
  115. //------------------------------------------------------------------------------------
  116.  
  117. //-------------------------system delay(in 1/100 sec.)-------------------------------
  118. extern void stdcall _ksys_delay(int m);
  119. //-----------------------------------------------------------------------------------
  120.  
  121. //------------------------system events----------------------------------------------
  122. extern int  stdcall _ksys_wait_for_event_infinite(void);
  123. extern int  stdcall _ksys_check_for_event(void);
  124. extern int  stdcall _ksys_wait_for_event(int time);
  125. extern void stdcall _ksys_set_wanted_events(int ev);
  126. //-----------------------------------------------------------------------------------
  127.  
  128. //----------------------------system exit program------------------------------------
  129. extern void stdcall _ksys_exit(void);
  130. //-----------------------------------------------------------------------------------
  131.  
  132. //-----------------------------system IPC send message-------------------------------
  133. extern void stdcall _ksys_send_message(int pid, void* msg, int size);
  134. //-----------------------------------------------------------------------------------
  135.  
  136. //---------------------------system work with IRQ from user mode---------------------
  137. extern void stdcall _ksys_define_receive_area(void* area, int size);
  138. extern int  stdcall _ksys_get_irq_owner(int irq);
  139. extern int  stdcall _ksys_get_data_read_by_irq(int irq, int* size, void* data);
  140. extern int  stdcall _ksys_send_data_to_device(int port, unsigned char val);
  141. extern int  stdcall _ksys_receive_data_from_device(int port,unsigned char* data);
  142. extern void stdcall _ksys_program_irq(void* intrtable, int irq);
  143. extern void stdcall _ksys_reserve_irq(int irq);
  144. extern void stdcall _ksys_free_irq(int irq);
  145. //----------------------------------------------------------------------------------
  146.  
  147. //----------------------------system reserve diapason of ports----------------------
  148. extern int  stdcall _ksys_reserve_port_area(int start,int end);
  149. extern int  stdcall _ksys_free_port_area(int start,int end);
  150. //----------------------------------------------------------------------------------
  151.  
  152. //-------------functions get key and set keyboard mode------------------------------
  153. extern int  stdcall _ksys_get_key(void);
  154. extern void stdcall _ksys_set_keyboard_mode(int mode);
  155. //----------------------------------------------------------------------------------
  156.  
  157. //--------------simple work with MPU401 sound device---------------------------------
  158. extern void stdcall _ksys_midi_reset(void);
  159. extern void stdcall _ksys_midi_send(int data);
  160. //-----------------------------------------------------------------------------------
  161.  
  162. //--------------------------acces to PCI BUS from user mode---------------------------
  163. extern int  stdcall _ksys_get_pci_version(void);
  164. extern int  stdcall _ksys_get_last_pci_bus(void);
  165. extern int  stdcall _ksys_get_pci_access_mechanism(void);
  166. extern int  stdcall _ksys_pci_read_config_byte(int bus,int dev,int fn,int reg);
  167. extern int  stdcall _ksys_pci_read_config_word(int bus,int dev,int fn,int reg);
  168. extern int  stdcall _ksys_pci_read_config_dword(int bus,int dev,int fn,int reg);
  169. extern int  stdcall _ksys_pci_write_config_byte(int bus,int dev,int fn,int reg,int value);
  170. extern int  stdcall _ksys_pci_write_config_word(int bus,int dev,int fn,int reg,int value);
  171. extern int  stdcall _ksys_pci_write_config_value(int bus,int dev,int fn,int reg,int value);
  172. //--------------------------------------------------------------------------------------
  173.  
  174. //------------------------Process information--------------------------------------
  175. extern int  stdcall _ksys_get_process_table(struct process_table_entry *proctab,int pid); //if pid=-1 than get info about him.
  176. //---------------------------------------------------------------------------------
  177.  
  178. //-----------------Old functions for work with sound(Sound Blaster only).---------
  179. extern void stdcall _ksys_sound_load_block(void* blockptr);
  180. extern void stdcall _ksys_sound_play_block(void);
  181. extern void stdcall _ksys_sound_set_channels(int channels);
  182. extern void stdcall _ksys_sound_set_data_size(int size);
  183. extern void stdcall _ksys_sound_set_frequency(int frequency);
  184. //--------------------------------------------------------------------------------
  185.  
  186. //------------------------------system speaker(integrated speaker)----------------
  187. extern void stdcall _ksys_sound_speaker_play(void* data);
  188. //--------------------------------------------------------------------------------
  189.  
  190. //------------------function for work with Dinamic Link Librarys(DLL)--------------
  191. extern dword* stdcall _ksys_cofflib_load(char* name);
  192. extern char* stdcall _ksys_cofflib_getproc(void* exp,char* sz_name);
  193. //---------------------------------------------------------------------------------
  194.  
  195. #endif
  196.