1
10
13
14
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
108
109
110
111
112
113
115
116
117
118
120
121
122
123
124
125
126
127
128
129
130
...
...
...
#define UX_SOURCE_CODE
#define UX_HCD_STM32_SOURCE_CODE
#include "ux_api.h"
#include "ux_hcd_stm32.h"
#include "ux_host_stack.h"
...
...
UINT _ux_hcd_stm32_least_traffic_list_get(UX_HCD_STM32 *hcd_stm32)
{
UX_HCD_STM32_ED *ed;
UINT list_index;
ULONG min_bandwidth_used;
ULONG bandwidth_used;
UINT min_bandwidth_slot;
min_bandwidth_used = 0xffffffff;
min_bandwidth_slot = 0;
for (list_index = 0; list_index < 32; list_index++)
{
bandwidth_used = 0;
ed = hcd_stm32 -> ux_hcd_stm32_periodic_ed_head;
while (ed != UX_NULL)
{
if ((list_index & ed -> ux_stm32_ed_interval_mask) == ed -> ux_stm32_ed_interval_position)
{
bandwidth_used += (ULONG) ed -> ux_stm32_ed_endpoint -> ux_endpoint_descriptor.wMaxPacketSize;
}if ((list_index & ed -> ux_stm32_ed_interval_mask) == ed -> ux_stm32_ed_interval_position) { ... }
ed = ed -> ux_stm32_ed_next_ed;
}while (ed != UX_NULL) { ... }
/* ... */
if (bandwidth_used < min_bandwidth_used)
{
/* ... */
min_bandwidth_used = bandwidth_used;
min_bandwidth_slot = list_index;
}if (bandwidth_used < min_bandwidth_used) { ... }
}for (list_index = 0; list_index < 32; list_index++) { ... }
return(min_bandwidth_slot);
}{ ... }