Subversion Repositories Kolibri OS

Rev

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

  1. /***************************************************************************************************
  2.  *  Copyright (C) Vasiliy Kosenko (vkos), 2009                                                     *
  3.  *  This program is free software: you can redistribute it and/or modify it under the terms of the *
  4.  *  GNU General Public License as published by the Free Software Foundation, either version 3      *
  5.  *  of the License, or (at your option) any later version.                                         *
  6.  *                                                                                                 *
  7.  *  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;      *
  8.  *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See  *
  9.  *  the GNU General Public License for more details.                                               *
  10.  *                                                                                                 *
  11.  *  You should have received a copy of the GNU General Public License along with this program.     *
  12.  *  If not, see <http://www.gnu.org/licenses/>.                                                    *
  13.  ***************************************************************************************************/
  14.  
  15. #ifndef _KOLIBRI_H_
  16. #define _KOLIBRI_H_
  17.  
  18. #define KOLIBRI_ACCESS_READ 0x0
  19. #define KOLIBRI_CREATE 0x8
  20.  
  21. #define KOLIBRI_IPC_EVENT_MASK 0x40
  22. #define KOLIBRI_IPC_EVENT 0x7
  23.  
  24. /*
  25.  * IPC structures, functions & data
  26.  */
  27.  
  28. //
  29. struct kolibri_IPC_area {
  30.         unsigned long lock;
  31.         unsigned long size;
  32. };
  33.  
  34. typedef struct kolibri_IPC_area kolibri_IPC_area_t;
  35.  
  36. //
  37. struct kolibri_IPC_message {
  38.         unsigned long tid;
  39.         unsigned long length;
  40. };
  41.  
  42. typedef struct kolibri_IPC_message kolibri_IPC_message_t;
  43.  
  44. //
  45. struct kolibri_memarea {
  46.         void *addr;
  47.         int error;              // or size
  48.         char *name;
  49. };
  50.  
  51. typedef struct kolibri_memarea kolibri_memarea_t;
  52.  
  53. //
  54. #pragma pack(push,1)
  55. struct kolibri_process_info {
  56.         long cpu_using;                         // +0
  57.         short window_position;                  // +4
  58.         short window_position_slot;             // +6
  59.         short reserved_0;                       // +8
  60.         char name[11];                          // +10
  61.         char reserved_const_0;                  // +21
  62.         unsigned long addr;                     // +22
  63.         long mem_using;                         // +26
  64.         long tid;                               // +30
  65.         long window_x;
  66.         long window_y;
  67.         long window_width;
  68.         long window_height;
  69.         short state;
  70.         short reserved_const_1;
  71.         long window_client_x;
  72.         long window_client_y;
  73.         long window_client_width;
  74.         long window_client_height;
  75.         char window_state;
  76. };
  77. #pragma pack(pop)
  78.  
  79. typedef struct kolibri_process_info kolibri_process_info_t;
  80.  
  81. //
  82. extern kolibri_IPC_area_t *kolibri_IPC_area;
  83.  
  84. //
  85. int kolibri_IPC_set_area(void *area, int size);
  86. int kolibri_IPC_send(int tid, void *msg, int length);
  87. void kolibri_IPC_unlock();
  88. void kolibri_IPC_lock();
  89. int kolibri_IPC_init(void *area, int size);
  90. kolibri_IPC_message_t *kolibri_IPC_get_next_message();
  91. void kolibri_IPC_clear_buff();
  92. int kolibri_event_wait();
  93.  
  94. /*
  95.  * Memory functions
  96.  */
  97.  
  98. kolibri_memarea_t kolibri_new_named_memory(char *name, int size, int flags);
  99. int kolibri_heap_init();
  100. void *kolibri_malloc(int nbytes);
  101.  
  102. /*
  103.  * Events functions
  104.  */
  105. void kolibri_set_event_mask(int mask);
  106.  
  107. #endif
  108.