Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #ifndef __GLIBC__MENUET_OS_H
  2. #define __GLIBC__MENUET_OS_H
  3.  
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7.  
  8. typedef unsigned char       __u8;
  9. typedef unsigned short      __u16;
  10. typedef unsigned long       __u32;
  11.  
  12. #pragma pack(push,1)
  13.  
  14. void __menuet__define_window(__u16 x1,__u16 y1,__u16 xsize,__u16 ysize,
  15.      __u32 body_color,__u32 grab_color,__u32 frame_color);
  16. void __menuet__window_redraw(int status);
  17. void __menuet__putpixel(__u32 x,__u32 y,__u32 color);
  18. int __menuet__getkey(void);
  19. __u32 __menuet__getsystemclock(void);
  20. void __menuet__write_text(__u16 x,__u16 y,__u32 color,char * text,int len);
  21. void __menuet__delay100(int m);
  22. __u32 __menuet__open(char * name,char * data);
  23. void __menuet__save(char * name,char * data,__u32 count);
  24. void __menuet__putimage(__u16 x1,__u16 y1,__u16 xsize,__u16 ysize,char * image);
  25. void __menuet__make_button(__u16 x1,__u16 y1,__u16 xsize,__u16 ysize,
  26.                            int id,__u32 color);
  27. int __menuet__get_button_id(void);
  28. int __menuet__wait_for_event(void);
  29. int __menuet__check_for_event(void);
  30. void __menuet__bar(__u16 x1,__u16 y1,__u16 xsize,__u16 ysize,__u32 color);
  31. void __menuet__sys_exit(void);
  32. void * __menuet__exec_thread(void (* func_ptr)(void),__u32 stack_size,int * retp);
  33. void __menuet__idle(void);
  34.  
  35. void __menuet__exec_ramdisk(char * filename,char * args,...);
  36. void __menuet__exec_hd(char * filename,char * args,...);
  37.  
  38. struct process_table_entry
  39. {
  40.  __u32 cpu_usage;
  41.  __u16 pos_in_windowing_stack;
  42.  __u16 win_stack_val_at_ecx;
  43.  __u16 reserved1;
  44.  char name[12];
  45.  __u32 memstart;
  46.  __u32 memused;
  47.  __u32 pid;
  48.  __u32 winx_start,winy_start;
  49.  __u32 winx_size,winy_size;
  50.  __u16 thread_state;
  51.  __u16 reserved2;
  52.  __u32 client_left,client_top,client_width,client_height;
  53.  __u8 window_state;
  54.  __u8 reserved3[1024-71];
  55. };
  56.  
  57. #define PID_WHOAMI              (-1)
  58.  
  59. int __menuet__get_process_table(struct process_table_entry * proctab,int pid);
  60. void __menuet__get_screen_max(__u16 * x,__u16 * y);
  61.  
  62. #define BTYPE_TILE                  1
  63. #define BTYPE_STRETCH               2
  64.  
  65. void __menuet__set_background_size(__u32 xsz,__u32 ysz);
  66. void __menuet__write_background_mem(__u32 pos,__u32 color);
  67. void __menuet__draw_background(void);
  68. void __menuet__set_background_draw_type(int type);
  69. void __menuet__background_blockmove(char * src_ptr,__u32 bgr_dst,__u32 count);
  70.  
  71. void __menuet__reset_mpu401(void);
  72. void __menuet__write_mpu401(__u8 d);
  73.  
  74. __u32 __menuet__get_date(void);
  75.  
  76. void __menuet__line(__u16 x1,__u16 y1,__u16 x2,__u16 y2,__u32 color);
  77.  
  78. void __menuet__set_bitfield_for_wanted_events(__u16 ev);
  79.  
  80. #define EVENT_REDRAW              0x00000001
  81. #define EVENT_KEY                 0x00000002
  82. #define EVENT_BUTTON              0x00000004
  83. #define EVENT_END_REQUEST         0x00000008
  84. #define EVENT_DESKTOP_BACK_DRAW   0x00000010
  85. #define EVENT_MOUSE_CHANGE        0x00000020
  86. #define EVENT_IPC                 0x00000040
  87. #define EVENT_GET_IRQS_MASK       0xFFFF0000
  88. #define EVENT_GET_IRQ(e)          (((e)>>16)&0xFFFF)
  89.  
  90. __u32 __menuet__get_irq_owner(__u32 irq);
  91. int __menuet__get_data_read_by_irq(__u32 irq,__u32 * num_bytes_in_buf,__u8 * data);
  92. int __menuet__send_data_to_device(__u16 port,__u8 val);
  93. void __menuet__program_irq(void * intr_table,__u32 irq_num);
  94. int __menuet__reserve_irq(int irqno);
  95. int __menuet__free_irq(int irqno);
  96. int __menuet__reserve_port_area(__u32 start,__u32 end);
  97. int __menuet__free_port_area(__u32 start,__u32 end);
  98.  
  99.  
  100. #define NAME_LEN                   512
  101.  
  102. #define STC_READ                  0
  103. #define STC_WRITE                 1
  104. #define STC_APPEND                2
  105.  
  106. struct systree_info
  107. {
  108.         __u32 command;
  109.         __u32 file_offset_low;
  110.         __u32 file_offset_high;
  111.         __u32 size;
  112.         __u32 data_pointer;
  113.         char _zero;
  114.         const char* nameptr;
  115. };
  116.  
  117. struct systree_info2
  118. {
  119.         __u32 command;
  120.         __u32 file_offset_low;
  121.         __u32 file_offset_high;
  122.         __u32 size;
  123.         __u32 data_pointer;
  124.         char name[NAME_LEN];
  125. };
  126.  
  127. struct bdfe_time
  128. {
  129.         __u8 seconds;
  130.         __u8 minutes;
  131.         __u8 hours;
  132.         __u8 reserved;
  133. };
  134. struct bdfe_date
  135. {
  136.         __u8 day;
  137.         __u8 month;
  138.         __u16 year;
  139. };
  140. struct bdfe_item
  141. {
  142.         __u32 attr;
  143.         __u8 nametype;
  144.         __u8 reserved[3];
  145.         struct bdfe_time ctime;
  146.         struct bdfe_date cdate;
  147.         struct bdfe_time atime;
  148.         struct bdfe_date adate;
  149.         struct bdfe_time mtime;
  150.         struct bdfe_date mdate;
  151.         __u32 filesize_low;
  152.         __u32 filesize_high;
  153. };
  154.  
  155. int __kolibri__system_tree_access(struct systree_info * info);
  156. int __kolibri__system_tree_access2(struct systree_info2 * info);
  157.  
  158. int __fslayer_open(char * name,int flags);
  159. int __fslayer_close(int fd);
  160. int __fslayer_lseek(int fd,int pos,int seek_type);
  161. int __fslayer_tell(int fd);
  162. int __fslayer_read(int fd,void * buffer,__u32 count);
  163. int __fslayer_write(int fd,void * buffer,__u32 count);
  164.  
  165. typedef struct
  166. {
  167.  __u8 lock;
  168.  __u8 resvd[3];
  169.  __u32 ptr_to_fmsg_pos;
  170.  /* Below is for message */
  171.  __u32 sender_pid;
  172.  __u32 msg_length;
  173. } msgrcva_t /*__attribute__((packed))*/;
  174.  
  175. void send_message(int pid,void * msg_ptr,int message_size);
  176. void define_receive_area(msgrcva_t * rcva_ptr,int size);
  177.  
  178. void __menuet__sound_load_block(char * blockptr);
  179. void __menuet__sound_play_block(void);
  180.  
  181. void __menuet__dga_get_caps(int * xres,int * yres,int * bpp,int * bpscan);
  182.  
  183. void get_pci_version(__u8 * major,__u8 * minor);
  184. void pci_get_last_bus(__u8 * last_bus);
  185. void get_pci_access_mechanism(__u8 * mechanism);
  186.  
  187. void pci_write_config_byte(__u8 bus,__u8 dev,__u8 fn,__u8 reg,__u8 val);
  188. void pci_write_config_word(__u8 bus,__u8 dev,__u8 fn,__u8 reg,__u16 val);
  189. void pci_write_config_dword(__u8 bus,__u8 dev,__u8 fn,__u8 reg,__u32 val);
  190. __u8 pci_read_config_byte(__u8 bus,__u8 dev,__u8 fn,__u8 reg);
  191. __u16 pci_read_config_word(__u8 bus,__u8 dev,__u8 fn,__u8 reg);
  192. __u32 pci_read_config_dword(__u8 bus,__u8 dev,__u8 fn,__u8 reg);
  193.  
  194. typedef struct{
  195.         char* name;
  196.         void* pointer;
  197. } IMP_ENTRY;
  198. typedef const IMP_ENTRY* IMP_TABLE;
  199. IMP_TABLE __kolibri__cofflib_load(const char*);
  200. __u32 __kolibri__cofflib_getproc(IMP_TABLE, const char*);
  201. //int __kolibri__cofflib_link(FUNC*, IMP_TABLE);
  202.  
  203. static __inline__ void __menuet__debug_out_byte(const char ch){
  204.     __asm__ __volatile__ ("int $0x40"::"a"(63L),"b"(1L),"c"((__u8)ch));
  205. }
  206. void __menuet__debug_out(const char* str);
  207.  
  208. #define TIME_GETH(x)    ((x)&0x000000FF)
  209. #define TIME_GETM(x)    ((((x)&0x00FF00)>>8)&0xFF)
  210. #define TIME_GETS(x)    ((((x)&0xFF0000)>>16)&0xFF)
  211.  
  212. #pragma pack(pop)
  213.  
  214. #ifdef __cplusplus
  215. }
  216. #endif
  217.  
  218. #endif
  219.