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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
115
116
117
118
119
120
121
122
127
128
129
130
131
132
133
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
...
...
...
#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_initialize(UX_HCD *hcd)
{
UX_HCD_STM32 *hcd_stm32;
hcd -> ux_hcd_controller_type = UX_HCD_STM32_CONTROLLER;
/* ... */
#if UX_MAX_DEVICES > 1
hcd -> ux_hcd_available_bandwidth = UX_HCD_STM32_AVAILABLE_BANDWIDTH;
#endif
hcd_stm32 = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, sizeof(UX_HCD_STM32));
if (hcd_stm32 == UX_NULL)
return(UX_MEMORY_INSUFFICIENT);
hcd -> ux_hcd_controller_hardware = (VOID *) hcd_stm32;
hcd_stm32 -> ux_hcd_stm32_hcd_owner = hcd;
hcd -> ux_hcd_entry_function = _ux_hcd_stm32_entry;
hcd -> ux_hcd_status = UX_HCD_STATUS_HALTED;
hcd_stm32 -> ux_hcd_stm32_nb_channels = UX_HCD_STM32_MAX_NB_CHANNELS;
if (hcd -> ux_hcd_irq == 0)
{
_ux_utility_memory_free(hcd_stm32);
return(UX_ERROR);
}if (hcd -> ux_hcd_irq == 0) { ... }
hcd_stm32 -> hcd_handle = (HCD_HandleTypeDef*)hcd -> ux_hcd_irq;
hcd_stm32 -> hcd_handle -> pData = hcd;
hcd_stm32 -> ux_hcd_stm32_ed_list = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, sizeof(UX_HCD_STM32_ED) *_ux_system_host -> ux_system_host_max_ed);
if (hcd_stm32 -> ux_hcd_stm32_ed_list == UX_NULL)
{
_ux_utility_memory_free(hcd_stm32);
return(UX_MEMORY_INSUFFICIENT);
}if (hcd_stm32 -> ux_hcd_stm32_ed_list == UX_NULL) { ... }
#if UX_MAX_DEVICES > 1
hcd -> ux_hcd_version = 0x200;
#endif
/* ... */
hcd -> ux_hcd_nb_root_hubs = UX_HCD_STM32_NB_ROOT_PORTS;
_ux_hcd_stm32_power_on_port(hcd_stm32, 0);
hcd_stm32 -> ux_hcd_stm32_queue_empty = UX_TRUE;
hcd_stm32 -> ux_hcd_stm32_periodic_scheduler_active = 0;
hcd -> ux_hcd_status = UX_HCD_STATUS_OPERATIONAL;
return(UX_SUCCESS);
}{ ... }