FreeCalypso > hg > fc-magnetite
comparison src/gpf2/tst/idle_pei.c @ 294:cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
with CRLF line endings and directory name capitalization cleaned up
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Sat, 21 Oct 2017 01:12:15 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 293:5b2ebc94cae4 | 294:cd37d228dae0 |
|---|---|
| 1 /* | |
| 2 +------------------------------------------------------------------------------ | |
| 3 | File: idle_pei.c | |
| 4 +------------------------------------------------------------------------------ | |
| 5 | Copyright Texas Instruments 2002 | |
| 6 | All rights reserved. | |
| 7 | | |
| 8 +------------------------------------------------------------------------------ | |
| 9 | Purpose: PEI interface for the IDLE entity. | |
| 10 | | |
| 11 | $Identity:$ | |
| 12 +------------------------------------------------------------------------------ | |
| 13 */ | |
| 14 | |
| 15 #define IDLE_PEI_C | |
| 16 | |
| 17 /*==== INCLUDES ==============================================================*/ | |
| 18 | |
| 19 #include "typedefs.h" | |
| 20 #include "vsi.h" | |
| 21 #include "pei.h" | |
| 22 #include "tools.h" | |
| 23 #include "frame.h" | |
| 24 #include "idle.h" | |
| 25 | |
| 26 /*==== CONSTS ================================================================*/ | |
| 27 | |
| 28 /*==== TYPES =================================================================*/ | |
| 29 | |
| 30 /*==== LOCALS ================================================================*/ | |
| 31 | |
| 32 /*==== PRIVATE FUNCTIONS =====================================================*/ | |
| 33 | |
| 34 /* | |
| 35 +------------------------------------------------------------------------------ | |
| 36 | Function : pei_primitive | |
| 37 +------------------------------------------------------------------------------ | |
| 38 | Description : This function is called by the frame when a primitive is | |
| 39 | received and needs to be processed. | |
| 40 | | |
| 41 | Parameters : prim - Pointer to the received primitive | |
| 42 | | |
| 43 | Return : PEI_OK - function succeeded | |
| 44 | PEI_ERROR - function failed | |
| 45 +------------------------------------------------------------------------------ | |
| 46 */ | |
| 47 static short pei_primitive (void * prim) | |
| 48 { | |
| 49 if (prim != NULL) | |
| 50 { | |
| 51 PFREE(P2D(prim)); | |
| 52 } | |
| 53 | |
| 54 return PEI_OK; | |
| 55 } | |
| 56 | |
| 57 /* | |
| 58 +------------------------------------------------------------------------------ | |
| 59 | Function : pei_init | |
| 60 +------------------------------------------------------------------------------ | |
| 61 | Description : This function is called by the frame. It is used to initialise | |
| 62 | the entitiy. | |
| 63 | | |
| 64 | Parameters : handle - task handle | |
| 65 | | |
| 66 | Return : PEI_OK - entity initialised | |
| 67 | PEI_ERROR - entity not (yet) initialised | |
| 68 +------------------------------------------------------------------------------ | |
| 69 */ | |
| 70 static short pei_init (T_HANDLE handle) | |
| 71 { | |
| 72 /* | |
| 73 * Initialize task handle | |
| 74 */ | |
| 75 TRACE_FUNCTION("pei_init"); | |
| 76 | |
| 77 idle_handle = handle; | |
| 78 | |
| 79 /* | |
| 80 * Open communication channels | |
| 81 */ | |
| 82 if (hCommTST < VSI_OK) | |
| 83 { | |
| 84 if ((hCommTST = vsi_c_open(VSI_CALLER "RCV")) < VSI_OK) | |
| 85 return PEI_ERROR; | |
| 86 } | |
| 87 | |
| 88 return (PEI_OK); | |
| 89 } | |
| 90 | |
| 91 /* | |
| 92 +------------------------------------------------------------------------------ | |
| 93 | Function : pei_signal | |
| 94 +------------------------------------------------------------------------------ | |
| 95 | Description : This function is called by the frame when a signal has been | |
| 96 | received. | |
| 97 | | |
| 98 | Parameters : opc - signal operation code | |
| 99 | *data - pointer to primitive | |
| 100 | | |
| 101 | Return : PEI_OK - signal processed | |
| 102 | PEI_ERROR - signal not processed | |
| 103 | | |
| 104 +------------------------------------------------------------------------------ | |
| 105 */ | |
| 106 static short pei_signal (U32 opc, void *data) | |
| 107 { | |
| 108 /* | |
| 109 * Process signal | |
| 110 */ | |
| 111 | |
| 112 //TRACE_FUNCTION("pei_signal"); | |
| 113 /* Generate trig in TST */ | |
| 114 PSIGNAL(hCommTST, IDLE_CNF, NULL); | |
| 115 | |
| 116 return PEI_OK; | |
| 117 } | |
| 118 | |
| 119 /* | |
| 120 +------------------------------------------------------------------------------ | |
| 121 | Function : pei_exit | |
| 122 +------------------------------------------------------------------------------ | |
| 123 | Description : This function is called by the frame when the entity is | |
| 124 | terminated. All open resources are freed. | |
| 125 | | |
| 126 | Parameters : - | |
| 127 | | |
| 128 | Return : PEI_OK - exit sucessful | |
| 129 | PEI_ERROR - exit not sueccessful | |
| 130 +------------------------------------------------------------------------------ | |
| 131 */ | |
| 132 static short pei_exit (void) | |
| 133 { | |
| 134 /* | |
| 135 * Close communication channels | |
| 136 */ | |
| 137 | |
| 138 TRACE_FUNCTION("pei_exit"); | |
| 139 | |
| 140 vsi_c_close(VSI_CALLER hCommTST); | |
| 141 hCommTST = VSI_ERROR; | |
| 142 | |
| 143 return PEI_OK; | |
| 144 } | |
| 145 | |
| 146 /* | |
| 147 +------------------------------------------------------------------------------ | |
| 148 | Function : pei_config | |
| 149 +------------------------------------------------------------------------------ | |
| 150 | Description : This function is called by the frame when a primitive is | |
| 151 | received indicating dynamic configuration. | |
| 152 | | |
| 153 | This function is not used in this entity. | |
| 154 | | |
| 155 | Parameters : handle - Communication handle | |
| 156 | | |
| 157 | Return : PEI_OK - sucessful | |
| 158 | PEI_ERROR - not successful | |
| 159 +------------------------------------------------------------------------------ | |
| 160 */ | |
| 161 static short pei_config (char *inString) | |
| 162 { | |
| 163 TRACE_FUNCTION(inString); | |
| 164 return PEI_OK; | |
| 165 } | |
| 166 | |
| 167 /* | |
| 168 +------------------------------------------------------------------------------ | |
| 169 | Function : pei_monitor | |
| 170 +------------------------------------------------------------------------------ | |
| 171 | Description : This function is called by the frame in case sudden entity | |
| 172 | specific data is requested (e.g. entity Version). | |
| 173 | | |
| 174 | Parameters : out_monitor - return the address of the data to be | |
| 175 | monitoredCommunication handle | |
| 176 | | |
| 177 | Return : PEI_OK - sucessful (address in out_monitor is valid) | |
| 178 | PEI_ERROR - not successful | |
| 179 +------------------------------------------------------------------------------ | |
| 180 */ | |
| 181 static short pei_monitor (void **out_monitor) | |
| 182 { | |
| 183 TRACE_FUNCTION ("pei_monitor"); | |
| 184 return PEI_OK; | |
| 185 } | |
| 186 | |
| 187 /* | |
| 188 +------------------------------------------------------------------------------ | |
| 189 | Function : pei_timeout | |
| 190 +------------------------------------------------------------------------------ | |
| 191 | Description : This function is called by the frame when a timer has expired. | |
| 192 | | |
| 193 | Parameters : index - timer index | |
| 194 | | |
| 195 | Return : PEI_OK - timeout processed | |
| 196 | PEI_ERROR - timeout not processed | |
| 197 | | |
| 198 +------------------------------------------------------------------------------ | |
| 199 */ | |
| 200 static short pei_timeout (USHORT index) | |
| 201 { | |
| 202 TRACE_ERROR("Unknown Timeout"); | |
| 203 | |
| 204 return PEI_OK; | |
| 205 } | |
| 206 | |
| 207 /*==== PUBLIC FUNCTIONS ======================================================*/ | |
| 208 | |
| 209 /* | |
| 210 +------------------------------------------------------------------------------ | |
| 211 | Function : idle_pei_create | |
| 212 +------------------------------------------------------------------------------ | |
| 213 | Description : This function is called by the frame when the process is | |
| 214 | created. | |
| 215 | | |
| 216 | Parameters : out_name - Pointer to the buffer in which to locate | |
| 217 | the name of this entity | |
| 218 | | |
| 219 | Return : PEI_OK - entity created successfuly | |
| 220 | PEI_ERROR - entity could not be created | |
| 221 +------------------------------------------------------------------------------ | |
| 222 */ | |
| 223 short idle_pei_create (T_PEI_INFO **info) | |
| 224 { | |
| 225 static T_PEI_INFO pei_info = | |
| 226 { | |
| 227 "IDLE", /* name */ | |
| 228 { /* pei-table */ | |
| 229 pei_init, | |
| 230 pei_exit, | |
| 231 pei_primitive, | |
| 232 pei_timeout, | |
| 233 pei_signal, | |
| 234 NULL, /* no pei_run function */ | |
| 235 pei_config, | |
| 236 pei_monitor | |
| 237 }, | |
| 238 255, /* stack size */ | |
| 239 10, /* queue entries */ | |
| 240 2, /* priority (1->low, 255->high) */ | |
| 241 0, /* number of timers */ | |
| 242 0x03 /* flags: bit 0 active(0) body/passive(1) */ | |
| 243 }; /* bit 1 com by copy(0)/reference(1) */ | |
| 244 | |
| 245 /* | |
| 246 * Export startup configuration data | |
| 247 */ | |
| 248 *info = &pei_info; | |
| 249 | |
| 250 return PEI_OK; | |
| 251 } | |
| 252 | |
| 253 /*==== END OF FILE ===========================================================*/ |
