POK
|
00001 /* 00002 * POK header 00003 * 00004 * The following file is a part of the POK project. Any modification should 00005 * made according to the POK licence. You CANNOT use this file or a part of 00006 * this file is this part of a file for your own project 00007 * 00008 * For more information on the POK licence, please see our LICENCE FILE 00009 * 00010 * Please follow the coding guidelines described in doc/CODING_GUIDELINES 00011 * 00012 * Copyright (c) 2007-2009 POK team 00013 * 00014 * Created by julien on Thu Jan 15 23:34:13 2009 00015 */ 00016 00017 #ifdef POK_NEEDS_ARINC653_PROCESS 00018 00019 #include <arinc653/types.h> 00020 00021 #ifndef APEX_PROCESS 00022 #define APEX_PROCESS 00023 00024 #define MAX_NUMBER_OF_PROCESSES SYSTEM_LIMIT_NUMBER_OF_PROCESSES 00025 #define MIN_PRIORITY_VALUE 1 00026 #define MAX_PRIORITY_VALUE 63 00027 #define MAX_LOCK_LEVEL 16 00028 00029 typedef NAME_TYPE PROCESS_NAME_TYPE; 00030 00031 typedef APEX_INTEGER PROCESS_ID_TYPE; 00032 00033 typedef APEX_INTEGER LOCK_LEVEL_TYPE; 00034 00035 typedef APEX_UNSIGNED STACK_SIZE_TYPE; 00036 00037 typedef APEX_INTEGER WAITING_RANGE_TYPE; 00038 00039 typedef APEX_INTEGER PRIORITY_TYPE; 00040 00041 typedef enum 00042 { 00043 DORMANT = 0, 00044 READY = 1, 00045 RUNNING = 2, 00046 WAITING = 3 00047 } PROCESS_STATE_TYPE; 00048 00049 typedef enum 00050 { 00051 SOFT = 0, 00052 HARD = 1 00053 } DEADLINE_TYPE; 00054 00055 typedef struct { 00056 SYSTEM_TIME_TYPE PERIOD; 00057 SYSTEM_TIME_TYPE TIME_CAPACITY; 00058 SYSTEM_ADDRESS_TYPE ENTRY_POINT; 00059 STACK_SIZE_TYPE STACK_SIZE; 00060 PRIORITY_TYPE BASE_PRIORITY; 00061 DEADLINE_TYPE DEADLINE; 00062 PROCESS_NAME_TYPE NAME; 00063 } PROCESS_ATTRIBUTE_TYPE; 00064 00065 typedef struct { 00066 SYSTEM_TIME_TYPE DEADLINE_TIME; 00067 PRIORITY_TYPE CURRENT_PRIORITY; 00068 PROCESS_STATE_TYPE PROCESS_STATE; 00069 PROCESS_ATTRIBUTE_TYPE ATTRIBUTES; 00070 } PROCESS_STATUS_TYPE; 00071 00072 extern void CREATE_PROCESS ( 00073 /*in */ PROCESS_ATTRIBUTE_TYPE *ATTRIBUTES, 00074 /*out*/ PROCESS_ID_TYPE *PROCESS_ID, 00075 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00076 00077 extern void SET_PRIORITY ( 00078 /*in */ PROCESS_ID_TYPE PROCESS_ID, 00079 /*in */ PRIORITY_TYPE PRIORITY, 00080 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00081 00082 extern void SUSPEND_SELF ( 00083 /*in */ SYSTEM_TIME_TYPE TIME_OUT, 00084 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00085 00086 extern void SUSPEND ( 00087 /*in */ PROCESS_ID_TYPE PROCESS_ID, 00088 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00089 00090 extern void RESUME ( 00091 /*in */ PROCESS_ID_TYPE PROCESS_ID, 00092 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00093 00094 extern void STOP_SELF (); 00095 00096 extern void STOP ( 00097 /*in */ PROCESS_ID_TYPE PROCESS_ID, 00098 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00099 00100 extern void START ( 00101 /*in */ PROCESS_ID_TYPE PROCESS_ID, 00102 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00103 00104 extern void DELAYED_START ( 00105 /*in */ PROCESS_ID_TYPE PROCESS_ID, 00106 /*in */ SYSTEM_TIME_TYPE DELAY_TIME, 00107 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00108 00109 extern void LOCK_PREEMPTION ( 00110 /*out*/ LOCK_LEVEL_TYPE *LOCK_LEVEL, 00111 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00112 00113 extern void UNLOCK_PREEMPTION ( 00114 /*out*/ LOCK_LEVEL_TYPE *LOCK_LEVEL, 00115 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00116 00117 extern void GET_MY_ID ( 00118 /*out*/ PROCESS_ID_TYPE *PROCESS_ID, 00119 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00120 00121 extern void GET_PROCESS_ID ( 00122 /*in */ PROCESS_NAME_TYPE PROCESS_NAME[MAX_NAME_LENGTH], 00123 /*out*/ PROCESS_ID_TYPE *PROCESS_ID, 00124 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00125 00126 extern void GET_PROCESS_STATUS ( 00127 /*in */ PROCESS_ID_TYPE PROCESS_ID, 00128 /*out*/ PROCESS_STATUS_TYPE *PROCESS_STATUS, 00129 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ); 00130 00131 #endif 00132 #endif