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