00001 /**************************************************************************** 00002 * 00003 * (C) 2000 by BECK IPC GmbH 00004 * 00005 * BECK IPC GmbH 00006 * Garbenheimerstr. 38 00007 * D-35578 Wetzlar 00008 * 00009 * Phone : (49)-6441-905-240 00010 * Fax : (49)-6441-905-245 00011 * 00012 * --------------------------------------------------------------------------- 00013 * Module : IPC@CHIP SC12 API :rtos.h 00014 * 00015 * Function : prototypes and constants RTOS API 00016 * Use model large at your program, if you use this include file. 00017 * See html documentation of the RTOS API for details. 00018 * Author : bartat 00019 * Date : 19.01.00 00020 * --------------------------------------------------------------------------- 00021 00022 $Header: RTOS.H, 14, 14.02.2002 10:47:27, Christoph Stoidner$ 00023 00024 $Log: 00025 14 IPC@CHIP 1.13 14.02.2002 10:47:27 Christoph Stoidner add Find 00026 Semaphore Function 00027 13 IPC@CHIP 1.12 16.01.2002 18:40:50 Markus Bartat add a semicolon 00028 after prototype declarartion at 00029 RTX_Disable_Task_Scheduling(void) 00030 and 00031 RTX_Enable_Task_Scheduling(void); 00032 12 IPC@CHIP 1.11 16.01.2002 11:45:06 Christoph Stoidner add starteam 00033 directives 00034 11 IPC@CHIP 1.10 14.01.2002 13:18:38 Christoph Stoidner add new 00035 functions 00036 10 IPC@CHIP 1.9 23.07.2001 10:17:37 Christoph Stoidner comment 00037 9 IPC@CHIP 1.8 02.07.2001 13:29:07 Markus Bartat delete the send 00038 message/taskstart functions 00039 8 IPC@CHIP 1.7 19.06.2001 13:40:11 Markus Bartat edit 00040 7 IPC@CHIP 1.6 19.06.2001 13:35:08 Markus Bartat start: Added 00041 comments to the c functions 00042 6 IPC@CHIP 1.5 01.06.2001 12:20:27 Markus Bartat added new 00043 functions 00044 5 IPC@CHIP 1.4 31.05.2001 16:18:26 Christoph Stoidner 00045 4 IPC@CHIP 1.3 31.05.2001 14:27:45 Christoph Stoidner 00046 3 IPC@CHIP 1.2 29.05.2001 16:03:58 Markus Bartat added API call 00047 0x11 Create a task without starting it 00048 2 IPC@CHIP 1.1 15.02.2001 15:16:52 Christoph Stoidner 00049 1 IPC@CHIP 1.0 14.02.2001 16:09:47 Christoph Stoidner 00050 $ 00051 00052 00053 * History : 00054 * 00055 * Vx.yy Author Changes 00056 * 00057 * 19.01.00 mb Create 00058 * 22.07.00 mb add timer procedure calls 00059 * 20.08.00 mb add task monitoring API calls 00060 * 24.08.00 mb add API calls suspend and resume tasks 00061 * 23.10.00 mb add event group calls 00062 * 26.10.00 mb add message exchange calls 00063 * 29.05.01 mb add task create call without running the task 00064 * 01.06.01 mb add get task state call without using taskmonitoring 00065 *****************************************************************************/ 00066 00067 #ifndef _RTOS_H___ 00068 #define _RTOS_H___ 00069 00070 /*************************************************************************/ 00071 #include <DOS.H> 00072 #include "clib/rtxapi.h" 00073 /*************************************************************************/ 00074 //defines 00075 /*************************************************************************/ 00076 #define RTOSVECT 0xAD 00077 00078 #ifdef _MSC_VER /* If Microsoft C Compiler is used, define new FP_SEG and FP_OFF Macro */ 00079 #ifdef FP_SEG 00080 #undef FP_SEG 00081 #endif 00082 #define FP_SEG(ptr) ((unsigned int)(((unsigned long)ptr)>>16)) 00083 00084 #ifdef FP_OFF 00085 #undef FP_OFF 00086 #endif 00087 #define FP_OFF(ptr) ((unsigned int)(((unsigned long)ptr)&0xFFFF)) 00088 #endif 00089 00090 00091 /*************************************************************************/ 00092 //prototypes 00093 /*************************************************************************/ 00094 int RTX_Create_Task(int far * taskID, TaskDefBlock far * taskdefblock); 00095 int RTX_Create_Task_Without_Run(int far * taskID, TaskDefBlock far * taskdefblock); 00096 /*************************************************************************/ 00097 //Delete a task from the system 00098 /*************************************************************************/ 00099 int RTX_Delete_Task(int taskID); 00100 /*************************************************************************/ 00101 //Stop and kill a task 00102 /*************************************************************************/ 00103 int RTX_Kill_Task(int taskID); 00104 /*************************************************************************/ 00105 //Go to sleep for a defined time 00106 /*************************************************************************/ 00107 int RTX_Sleep_Time(unsigned int time_ms); 00108 /*************************************************************************/ 00109 //Go to sleep, until wakerequest 00110 /*************************************************************************/ 00111 int RTX_Sleep_Request(void); 00112 /*************************************************************************/ 00113 //Wakeup a sleeping task 00114 /*************************************************************************/ 00115 int RTX_Wakeup(int taskID); 00116 /*************************************************************************/ 00117 //End execution of task by itself, this functions never returns 00118 /*************************************************************************/ 00119 int RTX_End_Execution(void); 00120 /*************************************************************************/ 00121 //Suspend/Resume task execution 00122 /*************************************************************************/ 00123 int RTX_Suspend_Task(int taskID); 00124 int RTX_Resume_Task(int taskID); 00125 /*************************************************************************/ 00126 //Change taskprio 00127 /*************************************************************************/ 00128 int RTX_Change_TaskPrio(int taskID, int prio, int far *error); 00129 /*************************************************************************/ 00130 //Get the ID of the current running task 00131 /*************************************************************************/ 00132 int RTX_Get_TaskID(void); 00133 /*************************************************************************/ 00134 //file access 00135 /*************************************************************************/ 00136 int RTX_Access_Filesystem(void); 00137 /*************************************************************************/ 00138 //Get state of a task, using the task monitoring 00139 /*************************************************************************/ 00140 int RTX_Get_Task_State(char * taskname, Task_StateData * taskdata, int * error); 00141 /*************************************************************************/ 00142 //Get state of a task, without using the task monitoring 00143 /*************************************************************************/ 00144 int RTX_Get_Task_State_Ext(char * taskname, unsigned int * taskstate, int * error); 00145 /*************************************************************************/ 00146 //Get task list 00147 /*************************************************************************/ 00148 int RTX_Get_Task_List(TaskList * tasklist, int length); 00149 /*************************************************************************/ 00150 //Start taskmonitoring 00151 /*************************************************************************/ 00152 void RTX_Start_Task_Monitor(void); 00153 /*************************************************************************/ 00154 //Start taskmonitoring 00155 /*************************************************************************/ 00156 void RTX_Stop_Task_Monitor(void); 00157 /*************************************************************************/ 00158 //Restart a task, killed with call 0x02 00159 /*************************************************************************/ 00160 int RTX_Restart_Task(int taskID); 00161 /*************************************************************************/ 00162 //Disable the Task Scheduling 00163 /*************************************************************************/ 00164 void RTX_Disable_Task_Scheduling(void); 00165 /*************************************************************************/ 00166 //Enable the Task Scheduling 00167 /*************************************************************************/ 00168 void RTX_Enable_Task_Scheduling(void); 00169 /*************************************************************************/ 00170 //Wake up a task, which sends direct a message 00171 /*************************************************************************/ 00172 int RTX_Wake_Msg_Receipt(void); 00173 /*************************************************************************/ 00174 //Create a semaphore 00175 /*************************************************************************/ 00176 int RTX_Create_Sem(int far * semID, char far * name, int initvalue); 00177 /*************************************************************************/ 00178 //Delete a semaphore 00179 /*************************************************************************/ 00180 int RTX_Delete_Sem(int semID); 00181 /*************************************************************************/ 00182 //Free a resource semaphore 00183 /*************************************************************************/ 00184 int RTX_Free_Sem(int semID); 00185 /*************************************************************************/ 00186 //Get a counting semaphore 00187 /*************************************************************************/ 00188 int RTX_Get_Sem(int semID); 00189 /*************************************************************************/ 00190 //Release a resoure semaphore 00191 /*************************************************************************/ 00192 int RTX_Release_Sem(int semID); 00193 /*************************************************************************/ 00194 //Reserve a resoure semaphore (optional timeout) 00195 /*************************************************************************/ 00196 int RTX_Reserve_Sem(int semID, long far * time_ms); 00197 /*************************************************************************/ 00198 //Signal a counting semaphore 00199 /*************************************************************************/ 00200 int RTX_Signal_Sem(int semID); 00201 /*************************************************************************/ 00202 //Wait on a counting semaphore (optional timeout) 00203 /*************************************************************************/ 00204 int RTX_Wait_Sem(int semID, long far *time_ms); 00205 /*************************************************************************/ 00206 //Find an semaphore, specified by 4 char name tag 00207 /*************************************************************************/ 00208 int RTX_Find_Sem(int * ID, char * name); 00209 /*************************************************************************/ 00210 //Get system time and date 00211 /*************************************************************************/ 00212 int RTX_Get_TimeDate(TimeDate_Structure far * td); 00213 /*************************************************************************/ 00214 //Set system time and date 00215 /*************************************************************************/ 00216 int RTX_Set_TimeDate(TimeDate_Structure far * td); 00217 /*************************************************************************/ 00218 //Set system ticks 00219 /*************************************************************************/ 00220 void RTX_Get_System_Ticks(unsigned long far * ticks); 00221 /*************************************************************************/ 00222 //Install timer procedure 00223 /*************************************************************************/ 00224 int RTX_Install_Timer(TimerProc_Structure far * TProcPtr); 00225 /*************************************************************************/ 00226 //Remove timer procedure 00227 /*************************************************************************/ 00228 int RTX_Remove_Timer(unsigned int timerID); 00229 /*************************************************************************/ 00230 //Start periodic execution of timer procedure 00231 /*************************************************************************/ 00232 int RTX_Start_Timer(unsigned int timerID); 00233 /*************************************************************************/ 00234 //Stop periodic execution of timer procedure 00235 /*************************************************************************/ 00236 int RTX_Stop_Timer(unsigned int timerID); 00237 00238 /*************************************************************************/ 00239 //Create event group 00240 /*************************************************************************/ 00241 int RTX_Create_EventGroup(unsigned int * ID, char * name, int init_value); 00242 /*************************************************************************/ 00243 //Delete an event group 00244 /*************************************************************************/ 00245 int RTX_Delete_EventGroup(unsigned int ID); 00246 /*************************************************************************/ 00247 //Signal events group 00248 /*************************************************************************/ 00249 int RTX_Signal_Events(unsigned int ID, unsigned int event_mask, unsigned event_value); 00250 /*************************************************************************/ 00251 //Wait for events 00252 /*************************************************************************/ 00253 int RTX_Wait_For_Event(unsigned int ID, RTX_Wait_Event * event_ptr); 00254 /*************************************************************************/ 00255 //Read current events on a group 00256 /*************************************************************************/ 00257 int RTX_Get_EventGroup_State(unsigned int ID, unsigned int * Event); 00258 /*************************************************************************/ 00259 //Get the saved event flags/bits 00260 /*************************************************************************/ 00261 int RTX_Get_Saved_Events(unsigned int * Event); 00262 /*************************************************************************/ 00263 //Find an event group, specified by 4 char name tag 00264 /*************************************************************************/ 00265 int RTX_Find_EventGroup(unsigned int * ID, char * name); 00266 /*************************************************************************/ 00267 //Create message exchange 00268 /*************************************************************************/ 00269 int RTX_Create_Msg(RTX_Msg * msg_ptr); 00270 /*************************************************************************/ 00271 //Delete a message exchange 00272 /*************************************************************************/ 00273 int RTX_Delete_Msg(unsigned int ID); 00274 /*************************************************************************/ 00275 //Send a message to a message exchange 00276 /*************************************************************************/ 00277 int RTX_Send_Msg(unsigned int ID, int prio, char * msg); 00278 /*************************************************************************/ 00279 //Get a message from a message exchange, no wait 00280 /*************************************************************************/ 00281 int RTX_Get_Msg(unsigned int ID, char * msg); 00282 /*************************************************************************/ 00283 //Wait for a message, optional timeout 00284 /*************************************************************************/ 00285 int RTX_Wait_For_Msg(RTX_Wait_Msg * msg_ptr); 00286 /*************************************************************************/ 00287 //Find an message exchange, specified by 4 char name tag 00288 /*************************************************************************/ 00289 int RTX_Find_Msg(unsigned int * ID, char * name); 00290 /*************************************************************************/ 00291 #endif /* _RTOS_H___ */ 00292 /*************************************************************************/ 00293 //end rtos.h