]> rtime.felk.cvut.cz Git - arc.git/blob - include/Os.h
Fixes to Sleep()
[arc.git] / include / Os.h
1 /* -------------------------------- Arctic Core ------------------------------\r
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
3  *\r
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
5  *\r
6  * This source code is free software; you can redistribute it and/or modify it\r
7  * under the terms of the GNU General Public License version 2 as published by the\r
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
9  *\r
10  * This program is distributed in the hope that it will be useful, but\r
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
13  * for more details.\r
14  * -------------------------------- Arctic Core ------------------------------*/\r
15 \r
16 \r
17 \r
18 #ifndef OS_H_\r
19 #define OS_H_\r
20 \r
21 #define OS_SW_MAJOR_VERSION    2\r
22 #define OS_SW_MINOR_VERSION    0\r
23 #define OS_SW_PATCH_VERSION    0\r
24 \r
25 #include <assert.h>\r
26 #include "Std_Types.h"\r
27 #include "Os_Cfg.h"\r
28 #include "MemMap.h"\r
29 #include "Cpu.h"\r
30 #include "limits.h"\r
31 #include <sys/queue.h>\r
32 \r
33 typedef uint8 StatusType;\r
34 \r
35 #if (OS_ISR_CNT > OS_ISR_MAX_CNT)\r
36 #error OS configuration error. OS_ISR_MAX_CNT must be bigger or equal to OS_ISR_CNT\r
37 #endif\r
38 \r
39 #define E_OS_ACCESS (StatusType)1               /**< STD OSEK */\r
40 #define E_OS_CALLEVEL (StatusType)2             /**< STD OSEK */\r
41 #define E_OS_ID (StatusType)3                   /**< STD OSEK */\r
42 #define E_OS_LIMIT (StatusType)4                /**< STD OSEK */\r
43 #define E_OS_NOFUNC (StatusType)5               /**< STD OSEK */\r
44 #define E_OS_RESOURCE (StatusType)6             /**< STD OSEK */\r
45 #define E_OS_STATE (StatusType)7                /**< STD OSEK */\r
46 #define E_OS_VALUE (StatusType)8                /**< STD OSEK */\r
47 \r
48 #define E_OS_SERVICEID (StatusType)9                /**< AUTOSAR, see 7.10 */\r
49 #define E_OS_RATE (StatusType)10                    /**< AUTOSAR, see 7.10 */\r
50 #define E_OS_ILLEGAL_ADDRESS (StatusType)11         /**< AUTOSAR, see 7.10 */\r
51 #define E_OS_MISSINGEND (StatusType)12              /**< AUTOSAR, see 7.10 */\r
52 #define E_OS_DISABLEDINT (StatusType)13             /**< AUTOSAR, see 7.10 */\r
53 #define E_OS_STACKFAULT (StatusType)14              /**< AUTOSAR, see 7.10 */\r
54 #define E_OS_PROTECTION_MEMORY (StatusType)15       /**< AUTOSAR, see 7.10 */\r
55 #define E_OS_PROTECTION_TIME (StatusType)16         /**< AUTOSAR, see 7.10 */\r
56 #define E_OS_PROTECTION_LOCKED (StatusType)17       /**< AUTOSAR, see 7.10 */\r
57 #define E_OS_PROTECTION_EXCEPTION (StatusType)18    /**< AUTOSAR, see 7.10 */\r
58 #define E_OS_PROTECTION_RATE (StatusType)19          /**< AUTOSAR, see 7.10 */\r
59 \r
60 #define E_COM_ID 255 // TODO: var ska E_COM_ID vara?"\r
61 \r
62 \r
63 typedef uint32_t                EventMaskType;\r
64 typedef EventMaskType * EventMaskRefType;\r
65 typedef uint16_t                TaskType;\r
66 typedef TaskType *              TaskRefType;\r
67 \r
68 typedef enum {\r
69         TASK_STATE_WAITING,\r
70         TASK_STATE_READY,\r
71         TASK_STATE_SUSPENDED,\r
72         TASK_STATE_RUNNING\r
73 } TaskStateType;\r
74 \r
75 #define INVALID_TASK    0xdeadU\r
76 \r
77 typedef TaskStateType *TaskStateRefType;\r
78 \r
79 /* FIXME: OSMEMORY_IS__ , see 8.2*/\r
80 \r
81 #define OSMEMORY_IS_READABLE(_access)\r
82 #define OSMEMORY_IS_WRITEABLE(_access)\r
83 #define OSMEMORY_IS_EXECUTABLE(_access)\r
84 #define OSMEMORY_IS_STACKSPACE(_access)\r
85 \r
86 #define OSDEFAULTAPPMODE  1\r
87 \r
88 #define INVALID_OSAPPLICATION (-1)\r
89 \r
90 /* TODO, I have no idea what this should be*/\r
91 #if (OS_USE_APPLICATIONS == STD_ON)\r
92 typedef sint32 ApplicationType;\r
93 \r
94 typedef enum {\r
95         APPLICATION_ACCESSIBLE,\r
96         APPLICATION_RESTARTING,\r
97         APPLICATION_TERMINATED\r
98 } ApplicationStateType;\r
99 \r
100 typedef ApplicationStateType *ApplicationStateRefType;\r
101 #endif\r
102 \r
103 /* See oil config for defines */\r
104 typedef sint32 AppModeType;\r
105 \r
106 /* FIXME: more types here */\r
107 typedef uint16 ScheduleTableType;\r
108 typedef uint16 GlobalTimeTickType;\r
109 \r
110 typedef enum {\r
111         SCHEDULETABLE_STOPPED,\r
112         SCHEDULETABLE_NEXT,\r
113         SCHEDULETABLE_WAITING,\r
114         SCHEDULETABLE_RUNNING,\r
115         SCHEDULETABLE_RUNNING_AND_SYNCHRONOUS\r
116 } ScheduleTableStatusType;\r
117 \r
118 typedef ScheduleTableStatusType *ScheduleTableStatusRefType;\r
119 \r
120 /* Flags for AccessType */\r
121 #define ACCESSTYPE_W    1\r
122 #define ACCESSTYPE_R    (1<<1)\r
123 \r
124 typedef uint32 AccessType;\r
125 \r
126 typedef enum {\r
127         ACCESS,\r
128         NO_ACCESS\r
129 } ObjectAccessType;\r
130 \r
131 typedef enum {\r
132         OBJECT_TASK,\r
133         OBJECT_ISR,\r
134         OBJECT_ALARM,\r
135         OBJECT_RESOURCE,\r
136         OBJECT_COUNTER,\r
137         OBJECT_SCHEDULETABLE,\r
138         OBJECT_MESSAGE\r
139 } ObjectTypeType;\r
140 \r
141 typedef enum {\r
142         PRO_KILLTASKISR,\r
143         PRO_KILLAPPL,\r
144         PRO_KILLAPPL_RESTART,\r
145         PRO_SHUTDOWN\r
146 } ProtectionReturnType;\r
147 \r
148 typedef enum {\r
149         RESTART,\r
150         NO_RESTART\r
151 } RestartType;\r
152 \r
153 \r
154 typedef ProtectionReturnType (*ProtectionHookType)( StatusType);\r
155 typedef void (*StartupHookType)( void );\r
156 typedef void (*ShutdownHookType)( StatusType );\r
157 typedef void (*ErrorHookType)( StatusType );\r
158 typedef void (*PreTaskHookType)( void );\r
159 typedef void (*PostTaskHookType)( void );\r
160 \r
161 ProtectionReturnType ProtectionHook( StatusType FatalError );\r
162 void StartupHook( void );\r
163 void ShutdownHook( StatusType Error );\r
164 void ErrorHook( StatusType Error );\r
165 void PreTaskHook( void );\r
166 void PostTaskHook( void );\r
167 \r
168 typedef uint16 TrustedFunctionIndexType;\r
169 typedef  void * TrustedFunctionParameterRefType;\r
170 \r
171 /* See 8.3.9 */\r
172 #define INVALID_ISR             ((sint16)(-1))\r
173 typedef sint16 ISRType;\r
174 \r
175 #define APP_NO_OWNER    (-1UL)\r
176 \r
177 typedef void * MemoryStartAddressType;\r
178 typedef uint32 MemorySizeType;\r
179 \r
180 #if 0\r
181 #define WaitEvent(...) SC_CALL(WaitEvent,1,1,__VA_ARGS__)\r
182 #define SetEvent(...) SC_CALL(SetEvent,2,2,__VA_ARGS__)\r
183 #define ClearEvent(...) SC_CALL(ClearEvent,3,1,__VA_ARGS__)\r
184 #endif\r
185 StatusType WaitEvent( EventMaskType Mask );\r
186 StatusType SetEvent( TaskType TaskID, EventMaskType Mask );\r
187 StatusType ClearEvent( EventMaskType Mask);\r
188 StatusType GetEvent( TaskType TaskId, EventMaskRefType Mask);\r
189 \r
190 void InitOS( void );\r
191 void StartOS( AppModeType Mode );\r
192 \r
193 ISRType GetISRID( void );\r
194 StatusType GetActiveApplicationMode( AppModeType* mode);\r
195 \r
196 typedef int8_t Os_IntCounterType;\r
197 \r
198 /* requirements here: OS368(ISR2), OS092 */\r
199 \r
200 extern Os_IntCounterType Os_IntDisableAllCnt;\r
201 extern Os_IntCounterType Os_IntSuspendAllCnt;\r
202 extern Os_IntCounterType Os_IntSuspendOsCnt;\r
203 \r
204 \r
205 \r
206 /** @req OS299 */\r
207 /* OSEK: States that " service  does  not  support  nesting", but says\r
208  * nothing what to do about it.\r
209  *\r
210  * OS092: "  If EnableAllInterrupts()/ResumeAllInterrupts()/ResumeOSInterrupts()\r
211  * are called and no corresponding DisableAllInterupts()/SuspendAllInterrupts()/\r
212  * SuspendOSInterrupts()  was  done  before,  the Operating System shall not\r
213  * perform this OS service.\r
214  */\r
215 static inline void DisableAllInterrupts( void ) {\r
216         Irq_Disable();\r
217         Os_IntDisableAllCnt++;\r
218         /* No nesting allowed */\r
219         assert(Os_IntDisableAllCnt==1);\r
220 }\r
221 \r
222 static inline void EnableAllInterrupts( void ) {\r
223 \r
224         if(Os_IntDisableAllCnt==0) {\r
225                 /** @req OS092 EnableAllInterrupts */\r
226         } else {\r
227                 Os_IntDisableAllCnt--;\r
228                 Irq_Enable();\r
229         }\r
230 }\r
231 \r
232 static inline void SuspendAllInterrupts( void ) {\r
233         Irq_SuspendAll();\r
234         Os_IntSuspendAllCnt++;\r
235 }\r
236 \r
237 static inline void ResumeAllInterrupts( void ) {\r
238 \r
239         if(Os_IntSuspendAllCnt==0) {\r
240                 /** @req OS092 ResumeAllInterrupts */\r
241         } else {\r
242                 Os_IntSuspendAllCnt--;\r
243                 Irq_ResumeAll();\r
244         }\r
245 }\r
246 \r
247 /* Only ISR2 interrupts should be suspended but this can NEVER be\r
248  * done in a more efficient way than to disable all, so let's\r
249  * do that for all targets.\r
250  */\r
251 \r
252 static inline void SuspendOSInterrupts( void ) {\r
253         Irq_SuspendOs();\r
254         Os_IntSuspendOsCnt++;\r
255 }\r
256 \r
257 static inline void ResumeOSInterrupts( void ) {\r
258 \r
259         if(Os_IntSuspendOsCnt==0) {\r
260                 /** @req OS092 ResumeOSInterrupts */\r
261         } else {\r
262                 Os_IntSuspendOsCnt--;\r
263                 Irq_ResumeOs();\r
264         }\r
265 }\r
266 \r
267 /*\r
268  * Class 2,3 and 4 API\r
269  */\r
270 \r
271 #if (OS_USE_APPLICATIONS == STD_ON)\r
272 \r
273 ApplicationType GetApplicationID( void );\r
274 AccessType      CheckISRMemoryAccess(   ISRType ISRID,\r
275                                                                         MemoryStartAddressType Address,\r
276                                                                         MemorySizeType Size );\r
277 \r
278 AccessType      CheckTaskMemoryAccess(  TaskType TaskID,\r
279                                                                         MemoryStartAddressType Address,\r
280                                                                         MemorySizeType Size );\r
281 \r
282 ObjectAccessType CheckObjectAccess( ApplicationType ApplId,\r
283                                                                         ObjectTypeType ObjectType,\r
284                                                                         uint32_t objectId );\r
285 ApplicationType CheckObjectOwnership( ObjectTypeType ObjectType,\r
286                                                                         uint32_t objectId );\r
287 StatusType TerminateApplication(  ApplicationType Application, RestartType RestartOption );\r
288 StatusType AllowAccess( void );\r
289 StatusType GetApplicationState(   ApplicationType Application,  ApplicationStateRefType Value );\r
290 StatusType      CallTrustedFunction(    TrustedFunctionIndexType FunctionIndex,\r
291                                                                         TrustedFunctionParameterRefType FunctionParams );\r
292 #endif\r
293 \r
294 StatusType      GetTaskID(              TaskRefType TaskID );\r
295 StatusType      GetTaskState(   TaskType task_id, TaskStateRefType state);\r
296 \r
297 void            ShutdownOS( StatusType );\r
298 StatusType      ActivateTask( TaskType TaskID );\r
299 StatusType      TerminateTask( void );\r
300 StatusType      ChainTask( TaskType TaskID );\r
301 StatusType      Schedule( void );\r
302 \r
303 typedef uint8 ResourceType;\r
304 #define DeclareResource(x) extern ResourceType (x);\r
305 StatusType GetResource( ResourceType ResID );\r
306 StatusType ReleaseResource( ResourceType ResID);\r
307 \r
308 /*\r
309  * Define scheduler as topmost\r
310  */\r
311 #define RES_SCHEDULER                   OS_RESOURCE_CNT\r
312 \r
313 /*\r
314  * Priorities of tasks and resources\r
315  */\r
316 #define OS_TASK_PRIORITY_MIN    0\r
317 #define OS_TASK_PRIORITY_MAX    31\r
318 /* Logical priority is higher higher than normal tasks */\r
319 #define OS_RES_SCHEDULER_PRIO   32\r
320 \r
321 typedef struct OsDriver_s {\r
322         int     OsGptChannelRef;\r
323 } OsDriver;\r
324 \r
325 \r
326 \r
327 /*-------------------------------------------------------------------\r
328  * Counters\r
329  *-----------------------------------------------------------------*/\r
330 typedef sint16 CounterType;\r
331 \r
332 typedef uint32 TickType;\r
333 typedef TickType *TickRefType;\r
334 \r
335 StatusType IncrementCounter( CounterType );\r
336 StatusType GetCounterValue( CounterType, TickRefType );\r
337 StatusType GetElapsedCounterValue( CounterType, TickRefType val, TickRefType elapsed_val);\r
338 \r
339 \r
340 /*-------------------------------------------------------------------\r
341  * System timer\r
342  *-----------------------------------------------------------------*/\r
343 typedef const uint32 OsTickType;\r
344 void Os_SysTickInit( void );\r
345 void Os_SysTickStart(TickType period_ticks);\r
346 TickType Os_SysTickGetValue( void );\r
347 TickType Os_SysTickGetElapsedValue( TickType preValue );\r
348 \r
349 /*-------------------------------------------------------------------\r
350  * Kernel extra\r
351  *-----------------------------------------------------------------*/\r
352 \r
353 #if defined(USE_KERNEL_EXTRA)\r
354 \r
355 #define TICK_MAX        UINT_MAX\r
356 \r
357 typedef struct OsSemaphore {\r
358         int val;\r
359         STAILQ_HEAD(,OsTaskVar) taskHead;\r
360 } OsSemaphoreType;\r
361 \r
362 typedef OsSemaphoreType OsMutexType;\r
363 \r
364 StatusType Sleep( TickType ticks );\r
365 StatusType InitSemaphore( OsSemaphoreType *semPtr, int initialCount  );\r
366 StatusType WaitSemaphore( OsSemaphoreType *semPtr, TickType tmo );\r
367 void SignalSemaphore( OsSemaphoreType *semPtr );\r
368 StatusType WaitMutex( OsMutexType *mutexPtr );\r
369 StatusType ReleaseMutex( OsMutexType *mutexPtr );\r
370 #endif\r
371 \r
372 \r
373 /*-------------------------------------------------------------------\r
374  * Schedule Tables\r
375  *-----------------------------------------------------------------*/\r
376 \r
377 StatusType StartScheduleTableRel(ScheduleTableType sid, TickType offset);\r
378 StatusType StartScheduleTableAbs(ScheduleTableType sid, TickType val );\r
379 StatusType StartScheduleTableSynchron(ScheduleTableType sid );\r
380 StatusType StopScheduleTable(ScheduleTableType sid);\r
381 StatusType NextScheduleTable( ScheduleTableType sid_curr, ScheduleTableType sid_next);\r
382 StatusType SyncScheduleTable( ScheduleTableType sid, GlobalTimeTickType global_time  );\r
383 StatusType GetScheduleTableStatus( ScheduleTableType sid, ScheduleTableStatusRefType status );\r
384 StatusType SetScheduleTableAsync( ScheduleTableType sid );\r
385 \r
386 \r
387 /*-------------------------------------------------------------------\r
388  * Alarms\r
389  *-----------------------------------------------------------------*/\r
390 \r
391 typedef uint16 AlarmType;\r
392 \r
393 typedef struct {\r
394         TickType maxallowedvalue;\r
395         TickType tickperbase;\r
396         TickType mincycle;\r
397 } AlarmBaseType;\r
398 \r
399 typedef AlarmBaseType *AlarmBaseRefType;\r
400 \r
401 StatusType GetAlarmBase( AlarmType AlarmId, AlarmBaseRefType Info );\r
402 StatusType GetAlarm(AlarmType AlarmId, TickRefType Tick);\r
403 StatusType SetRelAlarm(AlarmType AlarmId, TickType Increment, TickType Cycle);\r
404 StatusType SetAbsAlarm(AlarmType AlarmId, TickType Start, TickType Cycle);\r
405 StatusType CancelAlarm(AlarmType AlarmId);\r
406 \r
407 \r
408 /*-------------------------------------------------------------------\r
409  * Error's\r
410  *-----------------------------------------------------------------*/\r
411 typedef enum {\r
412     OSServiceId_ActivateTask,\r
413     OSServiceId_TerminateTask,\r
414     OSServiceId_ChainTask,\r
415     OSServiceId_Schedule,\r
416     OSServiceId_GetTaskID,\r
417     OSServiceId_GetResource,\r
418     OSServiceId_ReleaseResource,\r
419     OSServiceId_SetEvent,\r
420     OSServiceId_ClearEvent,\r
421     OSServiceId_GetEvent,\r
422     OSServiceId_WaitEvent,\r
423     OSServiceId_GetAlarmBase,\r
424     OSServiceId_GetAlarm,\r
425     OSServiceId_SetRelAlarm,\r
426     OSServiceId_SetAbsAlarm,\r
427     OSServiceId_CancelAlarm,\r
428     OSServiceId_StartOS,\r
429     OSServiceId_ShutdownOS,\r
430     OSServiceId_ErrorHook,\r
431     OSServiceId_PreTaskHook,\r
432     OSServiceId_PostTaskHook,\r
433     OSServiceId_StartupHook,\r
434     OSServiceId_ShutdownHook,\r
435     OSServiceId_GetTaskState,\r
436     OSServiceId_GetApplicationID,\r
437     OSServiceId_GetISRID,\r
438     OSServiceId_CallTrustedFunction,\r
439     OSServiceId_CheckISRMemoryAccess,\r
440     OSServiceId_TaskMemoryAccess,\r
441     OSServiceId_CheckObjectAccess,\r
442     OSServiceId_CheckObjectOwnership,\r
443     OSServiceId_StartScheduleTableRel,\r
444     OSServiceId_StartScheduleTableAbs,\r
445     OSServiceId_StopScheduleTable,\r
446     OSServiceId_NextScheduleTable,\r
447     OSServiceId_StartScheduleTableSynchron,\r
448     OSServiceId_SyncScheduleTable,\r
449     OSServiceId_GetScheduleTable,\r
450     OSServiceId_SetScheduleTableAsync,\r
451     OSServiceId_IncrementCounter,\r
452     OSServiceId_GetCounterValue,\r
453     OSServiceId_GetElapsedValue,\r
454     OSServiceId_TerminateApplication,\r
455     OSServiceId_AllowAccess,\r
456     OSServiceId_GetApplicationState,\r
457 \r
458 #if defined(USE_KERNEL_EXTRA)\r
459     OSServiceId_Sleep,\r
460 #endif\r
461 } OsServiceIdType;\r
462 \r
463 typedef struct OsError {\r
464         OsServiceIdType serviceId;\r
465         uint32_t param1;\r
466         uint32_t param2;\r
467         uint32_t param3;\r
468 } OsErrorType;\r
469 \r
470 extern OsErrorType os_error;\r
471 \r
472 // TODO: Add the service id to all OS service methods.\r
473 static inline OsServiceIdType OSErrorGetServiceId(void)  {\r
474         return os_error.serviceId;\r
475 }\r
476 \r
477 extern OsErrorType os_error;\r
478 \r
479 #define OSError_ActivateTask_TaskID ((TaskType) os_error.param1)\r
480 #define OSError_ChainTask_TaskID ((TaskType) os_error.param1)\r
481 #define OSError_GetTaskID_TaskID ((TaskRefType) os_error.param1)\r
482 #define OSError_GetResource_ResID ((ResourceType) os_error.param1)\r
483 #define OSError_ReleaseResource_ResID ((ResourceType) os_error.param1)\r
484 #define OSError_SetEvent_TaskID ((TaskType) os_error.param1)\r
485 #define OSError_SetEvent_Mask ((EventMaskType) os_error.param2)\r
486 #define OSError_ClearEvent_Mask ((EventMaskType) os_error.param1)\r
487 #define OSError_GetEvent_TaskId ((TaskType) os_error.param1)\r
488 #define OSError_GetEvent_Mask ((EventMaskRefType) os_error.param2)\r
489 #define OSError_WaitEvent_Mask ((EventMaskType) os_error.param1)\r
490 #define OSError_GetAlarmBase_AlarmId ((AlarmType) os_error.param1)\r
491 #define OSError_GetAlarmBase_Info ((AlarmBaseRefType) os_error.param2)\r
492 #define OSError_GetAlarm_AlarmId ((AlarmType) os_error.param1)\r
493 #define OSError_GetAlarm_Tick ((TickRefType) os_error.param2)\r
494 #define OSError_SetRelAlarm_AlarmId ((AlarmType) os_error.param1)\r
495 #define OSError_SetRelAlarm_Increment ((TickType) os_error.param2)\r
496 #define OSError_SetRelAlarm_Cycle ((TickType) os_error.param3)\r
497 #define OSError_SetAbsAlarm_AlarmId ((AlarmType) os_error.param1)\r
498 #define OSError_SetAbsAlarm_Start ((TickType) os_error.param2)\r
499 #define OSError_SetAbsAlarm_Cycle ((TickType) os_error.param3)\r
500 #define OSError_CancelAlarm_AlarmId ((AlarmType) os_error.param1)\r
501 #define OSError_StartOS_Mode ((AppModeType) os_error.param1)\r
502 #define OSError_ErrorHook_Error ((StatusType) os_error.param1)\r
503 #define OSError_ShutdownHook_Error ((StatusType) os_error.param1)\r
504 #define OSError_GetTaskState_TaskId ((TaskType) os_error.param1)\r
505 #define OSError_GetTaskState_State ((TaskStateRefType) os_error.param2)\r
506 \r
507 /** @req OS398 */\r
508 #if defined(LOCALMESSAGESONLY)\r
509 #error LOCALMESSAGESONLY shall not be defined\r
510 #endif\r
511 \r
512 \r
513 /*-------------------------------------------------------------------\r
514  * COM ( TODO : move )\r
515  *-----------------------------------------------------------------*/\r
516 \r
517 /*\r
518  * The only information about the COM that is valid is\r
519  * in the COM specification ..SWS_COM.pdf.\r
520  *\r
521  * The most important requirements are COM010 and COM013\r
522  *\r
523  * Com_Init()\r
524  * Com_DeInit()\r
525  *\r
526  * No error hooks..\r
527  * No. GetMessageStatus()\r
528  * No. SendZeroMessage()\r
529  * No. SendDynamicMessage(), RecieveDynamicMessage()\r
530  *\r
531  * Yes. SendMessage()\r
532  *\r
533  * */\r
534 \r
535 \r
536 typedef uint32 MessageType;\r
537 typedef void *ApplicationDataRef;\r
538 \r
539 \r
540 StatusType SendMessage( MessageType message_id, ApplicationDataRef dataRef );\r
541 StatusType ReceiveMessage( MessageType message_id, ApplicationDataRef dataRef );\r
542 \r
543 /*\r
544  * ArcCore extensions\r
545  */\r
546 TickType GetOsTick();\r
547 void OsTick(void);\r
548 void OsIdle(void);\r
549 \r
550 #define OS_ISR_TYPE2    0\r
551 #define OS_ISR_TYPE1    1\r
552 \r
553 union isr_attr {\r
554         TaskType tid;\r
555         void (*entry)(void);\r
556 };\r
557 \r
558 #define TTY_NONE                1\r
559 #define TTY_T32         2\r
560 #define TTY_WINIDEA     4\r
561 #define TTY_SERIAL              8\r
562 #define RAMLOG          16\r
563 \r
564 #endif /*OS_H_*/\r