annotate chipsetsw/layer1/cust0/ind_os.c @ 261:fde2a5d01e33

g23m/copyblobs.sh: l1audio_back.obj deblobbed (LoCosto import was perfect match)
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 13 Mar 2017 03:42:04 +0000
parents 83ef68065d4a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
198
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1 /************* Revision Controle System Header *************
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
2 * GSM Layer 1 software
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
3 * IND_OS.C
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
4 *
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
5 * Filename ind_os.c
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
6 * Version 1.1
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
7 * Date 04/26/00
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
8 *
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
9 ************* Revision Controle System Header *************/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
10
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
11
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
12 // Nucleus include files.
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
13 #include "nucleus.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
14 #include "tc_defs.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
15 #include "sys_types.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
16 #include "ind_os.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
17
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
18 #include "l1_confg.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
19 // Layer1 and debug include files.
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
20 #include "l1_types.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
21 #include "l1_const.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
22
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
23 #if (L1_GTT == 1)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
24 #include "l1gtt_const.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
25 #include "l1gtt_defty.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
26 #endif
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
27
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
28 //#if ((ANALOG == 1) || (ANALOG == 2))
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
29 // #include "spi_drv.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
30 //#endif
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
31
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
32 #if TESTMODE
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
33 #include "l1tm_defty.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
34 #endif
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
35
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
36 #include "l1audio_const.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
37 #include "l1audio_cust.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
38 #include "l1audio_defty.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
39 #include "l1_defty.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
40 #include "l1_msgty.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
41 #include "l1_varex.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
42
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
43 #if (CHIPSET == 2 || CHIPSET == 3 || CHIPSET == 4 || CHIPSET == 5 || CHIPSET == 6 || CHIPSET == 7 || CHIPSET == 8 || CHIPSET == 10 || CHIPSET == 11 || CHIPSET == 12)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
44 #include "ulpd.h"
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
45 #endif
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
46
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
47 extern UWORD32 TCD_Priority_Groups;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
48 extern TC_HCB *TCD_Active_HISR_Heads[TC_HISR_PRIORITIES];
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
49 extern VOID *TCD_Current_Thread;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
50 extern TC_HCB *TCD_Active_HISR_Tails[TC_HISR_PRIORITIES];
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
51 extern INT TMD_Timer_State;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
52 extern UWORD32 TMD_Timer; // for big sleep
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
53 extern TC_PROTECT TCD_System_Protect;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
54
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
55
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
56 /*-------------------------------------------------------*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
57 /* int ind_os_sleep() */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
58 /*-------------------------------------------------------*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
59 /* Parameters : none */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
60 /* Return : */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
61 /* Functionality : Suspend the thread an interval */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
62 /* of millisecs. */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
63 /* Limitation : */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
64 /*-------------------------------------------------------*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
65
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
66 T_OS_RETURN ind_os_sleep (SYS_UWORD32 millisecs)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
67 {
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
68 NU_Sleep ((SYS_UWORD32) millisecs);
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
69 return OS_OK;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
70 }
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
71
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
72
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
73 /*-------------------------------------------------------*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
74 /* int OS_get_inactivity_ticks() */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
75 /*-------------------------------------------------------*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
76 /* Parameters : none */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
77 /* Return : Number of ticks of inactivity */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
78 /* 0 means immediate activity planned */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
79 /* -1 means no activity planned */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
80 /* Functionality : Evaluates the OS activity planned */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
81 /* by looking at ready tasks, activated */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
82 /* HISR and the elapsed time of the timers*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
83 /* Limitation : Must be protected from H/W interrupts */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
84 /*-------------------------------------------------------*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
85 int OS_get_inactivity_ticks(void)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
86 {
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
87 int i;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
88
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
89 // Returns immediate activity if a task is ready
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
90 if (TCD_Priority_Groups)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
91 return 0;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
92
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
93 //for all HISR priorities
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
94 for (i = 0; i < TC_HISR_PRIORITIES ; i++)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
95 {
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
96 // if no hisr of priority "i" ==> go to next priority
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
97 if (TCD_Active_HISR_Heads[i] == 0)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
98 continue;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
99
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
100 // the first hisr is NOT the current one (frame hisr) so it may be
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
101 // with other priority ==> abort
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
102 if (TCD_Active_HISR_Heads[i] != TCD_Current_Thread)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
103 return 0;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
104
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
105 // the last hisr is NOT the current one (frame hisr) so there is
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
106 // at least another hisr with same priority ==> abort
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
107 if (TCD_Active_HISR_Tails[i] != TCD_Current_Thread)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
108 return 0;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
109
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
110 // the first and last hisrs are the current one (frame hisr) but
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
111 // there are several occurences of it ! ==> abort
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
112 if ( (TCD_Active_HISR_Heads[i]->tc_activation_count != 1))
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
113 return 0;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
114 }
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
115
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
116 // Returns remaining ticks number if any timer is active
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
117 if (TMD_Timer_State == TM_ACTIVE) // any active timer ?
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
118 {
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
119 if (TMD_Timer <= MIN_SLEEP_TIME)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
120 return(0);
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
121 else
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
122 return TMD_Timer;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
123 }
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
124
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
125 // Returns not activity if no timer active
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
126 if (TMD_Timer_State == TM_NOT_ACTIVE)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
127 return -1;
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
128 else
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
129 // otherwise, returns immediate activity if a timer is expired (TM_EXPIRED)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
130 return(0);
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
131 }
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
132
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
133 /*-------------------------------------------------------*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
134 /* int OS_system_protect() */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
135 /*-------------------------------------------------------*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
136 /* Parameters : none */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
137 /* Return : The Thread Control Block of the thread */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
138 /* which already owns the protection or */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
139 /* 0 if no protection */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
140 /* Functionality : Checks whether the system structures */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
141 /* are already protected or not */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
142 /*-------------------------------------------------------*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
143 void OS_system_protect (void)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
144 {
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
145 NU_Protect((NU_PROTECT*) &TCD_System_Protect);
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
146 }
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
147
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
148 /*-------------------------------------------------------*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
149 /* int OS_system_Unprotect() */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
150 /*-------------------------------------------------------*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
151 /* Parameters : none */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
152 /* Return : */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
153 /* Functionality : unprotect the system structures */
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
154 /*-------------------------------------------------------*/
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
155 void OS_system_Unprotect (void)
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
156 {
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
157 NU_Unprotect();
83ef68065d4a ind_os.c: MV100 version matches TCS211 perfectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
158 }