POK
process.h
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by julien on Thu Jan 15 23:34:13 2009
15  */
16 
17 #ifdef POK_NEEDS_ARINC653_PROCESS
18 
19 #include <arinc653/types.h>
20 
21 #ifndef APEX_PROCESS
22 #define APEX_PROCESS
23 
24 #define MAX_NUMBER_OF_PROCESSES SYSTEM_LIMIT_NUMBER_OF_PROCESSES
25 #define MIN_PRIORITY_VALUE 1
26 #define MAX_PRIORITY_VALUE 63
27 #define MAX_LOCK_LEVEL 16
28 
29 typedef NAME_TYPE PROCESS_NAME_TYPE;
30 
31 typedef APEX_INTEGER PROCESS_ID_TYPE;
32 
33 typedef APEX_INTEGER LOCK_LEVEL_TYPE;
34 
35 typedef APEX_UNSIGNED STACK_SIZE_TYPE;
36 
37 typedef APEX_INTEGER WAITING_RANGE_TYPE;
38 
39 typedef APEX_INTEGER PRIORITY_TYPE;
40 
41 typedef enum
42 {
43  DORMANT = 0,
44  READY = 1,
45  RUNNING = 2,
46  WAITING = 3
47 } PROCESS_STATE_TYPE;
48 
49 typedef enum
50 {
51  SOFT = 0,
52  HARD = 1
53 } DEADLINE_TYPE;
54 
55 typedef struct {
56  SYSTEM_TIME_TYPE PERIOD;
57  SYSTEM_TIME_TYPE TIME_CAPACITY;
58  SYSTEM_ADDRESS_TYPE ENTRY_POINT;
59  STACK_SIZE_TYPE STACK_SIZE;
60  PRIORITY_TYPE BASE_PRIORITY;
61  DEADLINE_TYPE DEADLINE;
62  PROCESS_NAME_TYPE NAME;
64 
65 typedef struct {
66  SYSTEM_TIME_TYPE DEADLINE_TIME;
67  PRIORITY_TYPE CURRENT_PRIORITY;
68  PROCESS_STATE_TYPE PROCESS_STATE;
69  PROCESS_ATTRIBUTE_TYPE ATTRIBUTES;
71 
72 extern void CREATE_PROCESS (
73  /*in */ PROCESS_ATTRIBUTE_TYPE *ATTRIBUTES,
74  /*out*/ PROCESS_ID_TYPE *PROCESS_ID,
75  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
76 
77 extern void SET_PRIORITY (
78  /*in */ PROCESS_ID_TYPE PROCESS_ID,
79  /*in */ PRIORITY_TYPE PRIORITY,
80  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
81 
82 extern void SUSPEND_SELF (
83  /*in */ SYSTEM_TIME_TYPE TIME_OUT,
84  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
85 
86 extern void SUSPEND (
87  /*in */ PROCESS_ID_TYPE PROCESS_ID,
88  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
89 
90 extern void RESUME (
91  /*in */ PROCESS_ID_TYPE PROCESS_ID,
92  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
93 
94 extern void STOP_SELF ();
95 
96 extern void STOP (
97  /*in */ PROCESS_ID_TYPE PROCESS_ID,
98  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
99 
100 extern void START (
101  /*in */ PROCESS_ID_TYPE PROCESS_ID,
102  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
103 
104 extern void DELAYED_START (
105  /*in */ PROCESS_ID_TYPE PROCESS_ID,
106  /*in */ SYSTEM_TIME_TYPE DELAY_TIME,
107  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
108 
109 extern void LOCK_PREEMPTION (
110  /*out*/ LOCK_LEVEL_TYPE *LOCK_LEVEL,
111  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
112 
113 extern void UNLOCK_PREEMPTION (
114  /*out*/ LOCK_LEVEL_TYPE *LOCK_LEVEL,
115  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
116 
117 extern void GET_MY_ID (
118  /*out*/ PROCESS_ID_TYPE *PROCESS_ID,
119  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
120 
121 extern void GET_PROCESS_ID (
122  /*in */ PROCESS_NAME_TYPE PROCESS_NAME[MAX_NAME_LENGTH],
123  /*out*/ PROCESS_ID_TYPE *PROCESS_ID,
124  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
125 
126 extern void GET_PROCESS_STATUS (
127  /*in */ PROCESS_ID_TYPE PROCESS_ID,
128  /*out*/ PROCESS_STATUS_TYPE *PROCESS_STATUS,
129  /*out*/ RETURN_CODE_TYPE *RETURN_CODE );
130 
131 #endif
132 #endif