comparison AnimationMaster.c @ 235:ecbf6992dab4

debugging -- made master lock padding arch indep -- changed schedSlot to animSlot
author Some Random Person <seanhalle@yahoo.com>
date Fri, 16 Mar 2012 23:40:55 -0700
parents a0ac58d8201c
children d9053472d0db
comparison
equal deleted inserted replaced
3:fde66a0f1846 4:8ef13219249e
8 8
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <stddef.h> 10 #include <stddef.h>
11 11
12 #include "VMS.h" 12 #include "VMS.h"
13
14
15 //========================= Local Fn Prototypes =============================
16 void inline
17 stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ,
18 SlaveVP *masterVP );
19
20 //===========================================================================
21 13
22 14
23 15
24 /*The animationMaster embodies most of the animator of the language. The 16 /*The animationMaster embodies most of the animator of the language. The
25 * animator is what emodies the behavior of language constructs. 17 * animator is what emodies the behavior of language constructs.
127 */ 119 */
128 void animationMaster( void *initData, SlaveVP *masterVP ) 120 void animationMaster( void *initData, SlaveVP *masterVP )
129 { 121 {
130 //Used while scanning and filling animation slots 122 //Used while scanning and filling animation slots
131 int32 slotIdx, numSlotsFilled; 123 int32 slotIdx, numSlotsFilled;
132 SchedSlot *currSlot, **schedSlots; 124 AnimSlot *currSlot, **animSlots;
133 SlaveVP *assignedSlaveVP; //the slave chosen by the assigner 125 SlaveVP *assignedSlaveVP; //the slave chosen by the assigner
134 126
135 //Local copies, for performance 127 //Local copies, for performance
136 MasterEnv *masterEnv; 128 MasterEnv *masterEnv;
137 SlaveAssigner slaveAssigner; 129 SlaveAssigner slaveAssigner;
141 133
142 //======================== Initializations ======================== 134 //======================== Initializations ========================
143 masterEnv = (MasterEnv*)_VMSMasterEnv; 135 masterEnv = (MasterEnv*)_VMSMasterEnv;
144 136
145 thisCoresIdx = masterVP->coreAnimatedBy; 137 thisCoresIdx = masterVP->coreAnimatedBy;
146 schedSlots = masterEnv->allSchedSlots[thisCoresIdx]; 138 animSlots = masterEnv->allAnimSlots[thisCoresIdx];
147 139
148 requestHandler = masterEnv->requestHandler; 140 requestHandler = masterEnv->requestHandler;
149 slaveAssigner = masterEnv->slaveAssigner; 141 slaveAssigner = masterEnv->slaveAssigner;
150 semanticEnv = masterEnv->semanticEnv; 142 semanticEnv = masterEnv->semanticEnv;
151 143
157 149
158 //Scan the animation slots 150 //Scan the animation slots
159 numSlotsFilled = 0; 151 numSlotsFilled = 0;
160 for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++) 152 for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++)
161 { 153 {
162 currSlot = schedSlots[ slotIdx ]; 154 currSlot = animSlots[ slotIdx ];
163 155
164 //Check if newly-done slave in slot, which will need request handld 156 //Check if newly-done slave in slot, which will need request handld
165 if( currSlot->workIsDone ) 157 if( currSlot->workIsDone )
166 { 158 {
167 currSlot->workIsDone = FALSE; 159 currSlot->workIsDone = FALSE;
181 (*slaveAssigner)( semanticEnv, currSlot ); 173 (*slaveAssigner)( semanticEnv, currSlot );
182 174
183 //put the chosen slave into slot, and adjust flags and state 175 //put the chosen slave into slot, and adjust flags and state
184 if( assignedSlaveVP != NULL ) 176 if( assignedSlaveVP != NULL )
185 { currSlot->slaveAssignedToSlot = assignedSlaveVP; 177 { currSlot->slaveAssignedToSlot = assignedSlaveVP;
186 assignedSlaveVP->schedSlotAssignedTo = currSlot; 178 assignedSlaveVP->animSlotAssignedTo = currSlot;
187 currSlot->needsSlaveAssigned = FALSE; 179 currSlot->needsSlaveAssigned = FALSE;
188 numSlotsFilled += 1; 180 numSlotsFilled += 1;
189 } 181 }
190 } 182 }
191 } 183 }
192 184
193 MEAS__Capture_Post_Master_Point; 185 MEAS__Capture_Post_Master_Point;
194 186
195 masterSwitchToCoreCtlr( masterVP ); 187 masterSwitchToCoreCtlr( masterVP );
196 flushRegisters(); 188 flushRegisters();
189 DEBUG__printf(FALSE,"came back after switch to core -- so lock released!");
197 }//while(1) 190 }//while(1)
198 } 191 }
199 192