Rev 3555 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3555 | Rev 3626 | ||
---|---|---|---|
Line 204... | Line 204... | ||
204 | jb .every_frame |
204 | jb .every_frame |
205 | ; 2. Determine the actual interval in milliseconds. |
205 | ; 2. Determine the actual interval in milliseconds. |
206 | sub ecx, 3 |
206 | sub ecx, 3 |
207 | cmp ecx, 5 ; maximum 32ms |
207 | cmp ecx, 5 ; maximum 32ms |
208 | jbe @f |
208 | jbe @f |
209 | push 5 |
- | |
210 | pop ecx |
209 | movi ecx, 5 |
211 | @@: |
210 | @@: |
212 | ; There are four nested loops, |
211 | ; There are four nested loops, |
213 | ; * Loop #4 (the innermost one) calculates the total periodic bandwidth |
212 | ; * Loop #4 (the innermost one) calculates the total periodic bandwidth |
214 | ; scheduled in the given microframe of the given millisecond. |
213 | ; scheduled in the given microframe of the given millisecond. |
215 | ; * Loop #3 calculates the maximum over all milliseconds |
214 | ; * Loop #3 calculates the maximum over all milliseconds |
Line 219... | Line 218... | ||
219 | ; loop #2 is responsible for the microframe within millisecond. |
218 | ; loop #2 is responsible for the microframe within millisecond. |
220 | ; 3. Prepare for loops. |
219 | ; 3. Prepare for loops. |
221 | ; ebx = number of iterations of loop #1 |
220 | ; ebx = number of iterations of loop #1 |
222 | ; [esp] = delta of counter for loop #3, in bytes |
221 | ; [esp] = delta of counter for loop #3, in bytes |
223 | ; [esp+4] = delta between the first group and the target group, in bytes |
222 | ; [esp+4] = delta between the first group and the target group, in bytes |
224 | push 1 |
- | |
225 | pop ebx |
223 | movi ebx, 1 |
226 | push sizeof.ehci_static_ep |
224 | movi edx, sizeof.ehci_static_ep |
227 | pop edx |
- | |
228 | shl ebx, cl |
225 | shl ebx, cl |
229 | shl edx, cl |
226 | shl edx, cl |
230 | mov eax, 64*sizeof.ehci_static_ep |
227 | mov eax, 64*sizeof.ehci_static_ep |
231 | sub eax, edx |
228 | sub eax, edx |
232 | sub eax, edx |
229 | sub eax, edx |
Line 280... | Line 277... | ||
280 | ; then the previous optimum, update the optimal bandwidth and the target. |
277 | ; then the previous optimum, update the optimal bandwidth and the target. |
281 | cmp edi, [.bandwidth] |
278 | cmp edi, [.bandwidth] |
282 | ja @f |
279 | ja @f |
283 | mov [.bandwidth], edi |
280 | mov [.bandwidth], edi |
284 | mov [.target], edx |
281 | mov [.target], edx |
285 | push 1 |
- | |
286 | pop eax |
282 | movi eax, 1 |
287 | shl eax, cl |
283 | shl eax, cl |
288 | mov [.targetsmask], eax |
284 | mov [.targetsmask], eax |
289 | @@: |
285 | @@: |
290 | ; 4k. Loop #2: continue 8 times for every microframe. |
286 | ; 4k. Loop #2: continue 8 times for every microframe. |
291 | inc ecx |
287 | inc ecx |
Line 315... | Line 311... | ||
315 | ; USB2 specification allows maximum 60000*80% bit times for periodic microframe |
311 | ; USB2 specification allows maximum 60000*80% bit times for periodic microframe |
316 | ; 8. Convert {o|u}hci_static_ep to usb_static_ep, update bandwidth and return. |
312 | ; 8. Convert {o|u}hci_static_ep to usb_static_ep, update bandwidth and return. |
317 | mov ecx, [.targetsmask] |
313 | mov ecx, [.targetsmask] |
318 | add [edx+ehci_static_ep.Bandwidths+ecx*2], ax |
314 | add [edx+ehci_static_ep.Bandwidths+ecx*2], ax |
319 | add edx, ehci_static_ep.SoftwarePart |
315 | add edx, ehci_static_ep.SoftwarePart |
320 | push 1 |
- | |
321 | pop eax |
316 | movi eax, 1 |
322 | shl eax, cl |
317 | shl eax, cl |
323 | pop edi ebx ; restore used registers to be stdcall |
318 | pop edi ebx ; restore used registers to be stdcall |
324 | ret |
319 | ret |
325 | .every_frame: |
320 | .every_frame: |
326 | ; The pipe should be scheduled every frame in two or more microframes. |
321 | ; The pipe should be scheduled every frame in two or more microframes. |
Line 369... | Line 364... | ||
369 | .bandwidth1 dd ? |
364 | .bandwidth1 dd ? |
370 | .bandwidth0 dd ? |
365 | .bandwidth0 dd ? |
371 | end virtual |
366 | end virtual |
372 | ; 10. Select the best variant. |
367 | ; 10. Select the best variant. |
373 | ; edx = S-Mask = bitmask of scheduled microframes |
368 | ; edx = S-Mask = bitmask of scheduled microframes |
374 | push 0x11 |
369 | movi edx, 0x11 |
375 | pop edx |
- | |
376 | cmp ecx, 1 |
370 | cmp ecx, 1 |
377 | ja @f |
371 | ja @f |
378 | mov dl, 0x55 |
372 | mov dl, 0x55 |
379 | jz @f |
373 | jz @f |
380 | mov dl, 0xFF |
374 | mov dl, 0xFF |