MCPcopy Create free account
hub / github.com/apache/nuttx / usbtrace

Function usbtrace

drivers/usbdev/usbdev_trace.c:154–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152
153#if defined(CONFIG_USBDEV_TRACE) || (defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_USB))
154void usbtrace(uint16_t event, uint16_t value)
155{
156 irqstate_t flags;
157
158 /* Check if tracing is enabled for this ID */
159
160 flags = spin_lock_irqsave(&g_lock);
161 if ((g_maskedidset & TRACE_ID2BIT(event)) != 0)
162 {
163#ifdef CONFIG_USBDEV_TRACE
164 /* Yes... save the new trace data at the head */
165
166 g_trace[g_head].event = event;
167 g_trace[g_head].value = value;
168
169 /* Increment the head and (probably) the tail index */
170
171 if (++g_head >= CONFIG_USBDEV_TRACE_NRECORDS)
172 {
173 g_head = 0;
174 }
175
176 if (g_head == g_tail)
177 {
178 if (++g_tail >= CONFIG_USBDEV_TRACE_NRECORDS)
179 {
180 g_tail = 0;
181 }
182 }
183
184 spin_unlock_irqrestore(&g_lock, flags);
185#else
186 /* Just print the data using syslog */
187
188 spin_unlock_irqrestore(&g_lock, flags);
189 usbtrace_trprintf(usbtrace_syslog, event, value);
190#endif
191 }
192 else
193 {
194 spin_unlock_irqrestore(&g_lock, flags);
195 }
196}
197#endif /* CONFIG_USBDEV_TRACE || CONFIG_DEBUG_FEATURES && CONFIG_DEBUG_USB */
198
199/****************************************************************************

Callers 15

sim_reqabortFunction · 0.85
sim_reqwriteFunction · 0.85
sim_usbdev_ep0readFunction · 0.85
sim_usbdev_epreadFunction · 0.85
sim_ep_configureFunction · 0.85
sim_ep_disableFunction · 0.85
sim_ep_allocreqFunction · 0.85
sim_ep_freereqFunction · 0.85
sim_ep_stallFunction · 0.85
sim_ep_submitFunction · 0.85
sim_ep_cancelFunction · 0.85
sim_usbdev_allocepFunction · 0.85

Calls 2

spin_unlock_irqrestoreFunction · 0.85
usbtrace_trprintfFunction · 0.85

Tested by

no test coverage detected