Lines Matching full:dev
30 static int test_udc_event_handler(const struct device *dev, in test_udc_event_handler() argument
36 static void event_ep_request(const struct device *dev, struct udc_event event) in event_ep_request() argument
43 err = udc_ep_buf_free(dev, event.buf); in event_ep_request()
56 const struct device *dev = p1; in test_udc_thread() local
62 zassert_equal(udc_get_event_ctx(event.dev), &test_event_ctx, in test_udc_thread()
85 event_ep_request(dev, event); in test_udc_thread()
96 static void test_udc_ep_try_config(const struct device *dev, in test_udc_ep_try_config() argument
102 err = udc_ep_try_config(dev, ed->bEndpointAddress, in test_udc_ep_try_config()
117 err = udc_ep_try_config(dev, ed->bEndpointAddress, in test_udc_ep_try_config()
124 static void test_udc_ep_enable(const struct device *dev, in test_udc_ep_enable() argument
132 err1 = udc_ep_enable(dev, ed->bEndpointAddress, ed->bmAttributes, in test_udc_ep_enable()
135 err2 = udc_ep_enable(dev, ed->bEndpointAddress, ed->bmAttributes, in test_udc_ep_enable()
138 err3 = udc_ep_enable(dev, FALSE_EP_ADDR, ed->bmAttributes, in test_udc_ep_enable()
141 err4 = udc_ep_enable(dev, ctrl_ep, ed->bmAttributes, in test_udc_ep_enable()
145 if (!udc_is_initialized(dev) && !udc_is_enabled(dev)) { in test_udc_ep_enable()
150 } else if (udc_is_initialized(dev) && !udc_is_enabled(dev)) { in test_udc_ep_enable()
163 static void test_udc_ep_disable(const struct device *dev, in test_udc_ep_disable() argument
171 err1 = udc_ep_disable(dev, ed->bEndpointAddress); in test_udc_ep_disable()
172 err2 = udc_ep_disable(dev, ed->bEndpointAddress); in test_udc_ep_disable()
173 err3 = udc_ep_disable(dev, FALSE_EP_ADDR); in test_udc_ep_disable()
174 err4 = udc_ep_disable(dev, ctrl_ep); in test_udc_ep_disable()
176 if (!udc_is_initialized(dev) && !udc_is_enabled(dev)) { in test_udc_ep_disable()
181 } else if (udc_is_initialized(dev) && !udc_is_enabled(dev)) { in test_udc_ep_disable()
194 static struct net_buf *test_udc_ep_buf_alloc(const struct device *dev, in test_udc_ep_buf_alloc() argument
199 buf = udc_ep_buf_alloc(dev, ed->bEndpointAddress, in test_udc_ep_buf_alloc()
207 static void test_udc_ep_buf_free(const struct device *dev, in test_udc_ep_buf_free() argument
216 err = udc_ep_buf_free(dev, buf); in test_udc_ep_buf_free()
220 static void test_udc_ep_halt(const struct device *dev, in test_udc_ep_halt() argument
226 err1 = udc_ep_set_halt(dev, ed->bEndpointAddress); in test_udc_ep_halt()
227 err2 = udc_ep_set_halt(dev, FALSE_EP_ADDR); in test_udc_ep_halt()
229 if (udc_is_enabled(dev)) { in test_udc_ep_halt()
242 err1 = udc_ep_clear_halt(dev, ed->bEndpointAddress); in test_udc_ep_halt()
243 err2 = udc_ep_clear_halt(dev, FALSE_EP_ADDR); in test_udc_ep_halt()
245 if (udc_is_enabled(dev)) { in test_udc_ep_halt()
259 static void test_udc_ep_enqueue(const struct device *dev, in test_udc_ep_enqueue() argument
266 err1 = udc_ep_enqueue(dev, buf); in test_udc_ep_enqueue()
267 if (udc_is_enabled(dev)) { in test_udc_ep_enqueue()
268 false_buf = udc_ep_buf_alloc(dev, FALSE_EP_ADDR, 64); in test_udc_ep_enqueue()
270 err2 = udc_ep_enqueue(dev, false_buf); in test_udc_ep_enqueue()
273 if (udc_is_enabled(dev)) { in test_udc_ep_enqueue()
280 test_udc_ep_buf_free(dev, false_buf); in test_udc_ep_enqueue()
283 static void test_udc_ep_dequeue(const struct device *dev, in test_udc_ep_dequeue() argument
289 err1 = udc_ep_dequeue(dev, ed->bEndpointAddress); in test_udc_ep_dequeue()
290 err2 = udc_ep_dequeue(dev, FALSE_EP_ADDR); in test_udc_ep_dequeue()
292 if (!udc_is_initialized(dev)) { in test_udc_ep_dequeue()
301 static void test_udc_wakeup(const struct device *dev) in test_udc_wakeup() argument
305 err = udc_host_wakeup(dev); in test_udc_wakeup()
307 if (!udc_is_enabled(dev)) { in test_udc_wakeup()
312 static void test_udc_set_address(const struct device *dev, uint8_t addr) in test_udc_set_address() argument
316 err = udc_set_address(dev, addr); in test_udc_set_address()
318 if (!udc_is_enabled(dev)) { in test_udc_set_address()
323 static void test_udc_ep_api(const struct device *dev, in test_udc_ep_api() argument
333 err = udc_ep_enable(dev, ed->bEndpointAddress, ed->bmAttributes, in test_udc_ep_api()
340 buf = udc_ep_buf_alloc(dev, ed->bEndpointAddress, in test_udc_ep_api()
347 err = udc_ep_enqueue(dev, buf); in test_udc_ep_api()
352 err = udc_ep_disable(dev, ed->bEndpointAddress); in test_udc_ep_api()
355 err = udc_ep_dequeue(dev, ed->bEndpointAddress); in test_udc_ep_api()
374 const struct device *dev; in test_udc_ep_mps() local
378 dev = DEVICE_DT_GET(DT_NODELABEL(zephyr_udc0)); in test_udc_ep_mps()
379 zassert_true(device_is_ready(dev), "UDC device not ready"); in test_udc_ep_mps()
381 err = udc_init(dev, test_udc_event_handler, &test_event_ctx); in test_udc_ep_mps()
384 err = udc_enable(dev); in test_udc_ep_mps()
392 err = udc_ep_try_config(dev, i, in test_udc_ep_mps()
409 test_udc_ep_api(dev, &ed); in test_udc_ep_mps()
412 test_udc_ep_api(dev, &ed); in test_udc_ep_mps()
415 err = udc_disable(dev); in test_udc_ep_mps()
418 err = udc_shutdown(dev); in test_udc_ep_mps()
425 const struct device *dev; in test_udc_device_get() local
427 dev = DEVICE_DT_GET(DT_NODELABEL(zephyr_udc0)); in test_udc_device_get()
428 zassert_true(device_is_ready(dev), "UDC device not ready"); in test_udc_device_get()
430 caps = udc_caps(dev); in test_udc_device_get()
436 (void *)dev, NULL, NULL, in test_udc_device_get()
441 return (void *)dev; in test_udc_device_get()
482 const struct device *dev; in ZTEST() local
486 dev = DEVICE_DT_GET(DT_NODELABEL(zephyr_udc0)); in ZTEST()
487 zassert_true(device_is_ready(dev), "UDC device not ready"); in ZTEST()
489 err = udc_init(dev, NULL, NULL); in ZTEST()
492 err = udc_shutdown(dev); in ZTEST()
495 err = udc_enable(dev); in ZTEST()
498 test_udc_set_address(dev, 0); in ZTEST()
499 test_udc_set_address(dev, 1); in ZTEST()
500 test_udc_wakeup(dev); in ZTEST()
502 test_udc_ep_try_config(dev, &ed_ctrl_out); in ZTEST()
503 test_udc_ep_try_config(dev, &ed_ctrl_in); in ZTEST()
504 test_udc_ep_try_config(dev, &ed_bulk_out); in ZTEST()
505 test_udc_ep_try_config(dev, &ed_bulk_in); in ZTEST()
507 buf = test_udc_ep_buf_alloc(dev, &ed_bulk_out); in ZTEST()
508 test_udc_ep_enable(dev, &ed_bulk_out); in ZTEST()
509 test_udc_ep_enqueue(dev, buf); in ZTEST()
510 test_udc_ep_halt(dev, &ed_bulk_out); in ZTEST()
511 test_udc_ep_disable(dev, &ed_bulk_out); in ZTEST()
512 test_udc_ep_dequeue(dev, &ed_bulk_out); in ZTEST()
513 test_udc_ep_buf_free(dev, buf); in ZTEST()
515 err = udc_disable(dev); in ZTEST()
521 const struct device *dev; in ZTEST() local
525 dev = DEVICE_DT_GET(DT_NODELABEL(zephyr_udc0)); in ZTEST()
526 zassert_true(device_is_ready(dev), "UDC device not ready"); in ZTEST()
528 err = udc_init(dev, test_udc_event_handler, &test_event_ctx); in ZTEST()
531 test_udc_set_address(dev, 0); in ZTEST()
532 test_udc_set_address(dev, 1); in ZTEST()
533 test_udc_wakeup(dev); in ZTEST()
535 test_udc_ep_try_config(dev, &ed_ctrl_out); in ZTEST()
536 test_udc_ep_try_config(dev, &ed_ctrl_in); in ZTEST()
537 test_udc_ep_try_config(dev, &ed_bulk_out); in ZTEST()
538 test_udc_ep_try_config(dev, &ed_bulk_in); in ZTEST()
540 buf = test_udc_ep_buf_alloc(dev, &ed_bulk_out); in ZTEST()
541 test_udc_ep_enable(dev, &ed_bulk_out); in ZTEST()
542 test_udc_ep_enqueue(dev, buf); in ZTEST()
543 test_udc_ep_halt(dev, &ed_bulk_out); in ZTEST()
544 test_udc_ep_disable(dev, &ed_bulk_out); in ZTEST()
545 test_udc_ep_dequeue(dev, &ed_bulk_out); in ZTEST()
546 test_udc_ep_buf_free(dev, buf); in ZTEST()
548 err = udc_shutdown(dev); in ZTEST()
554 const struct device *dev; in ZTEST() local
558 dev = DEVICE_DT_GET(DT_NODELABEL(zephyr_udc0)); in ZTEST()
559 zassert_true(device_is_ready(dev), "UDC device not ready"); in ZTEST()
561 err = udc_init(dev, test_udc_event_handler, &test_event_ctx); in ZTEST()
564 err = udc_enable(dev); in ZTEST()
567 err = udc_enable(dev); in ZTEST()
570 err = udc_disable(dev); in ZTEST()
573 err = udc_enable(dev); in ZTEST()
576 test_udc_set_address(dev, 0); in ZTEST()
577 test_udc_set_address(dev, 1); in ZTEST()
579 test_udc_ep_try_config(dev, &ed_ctrl_out); in ZTEST()
580 test_udc_ep_try_config(dev, &ed_ctrl_in); in ZTEST()
581 test_udc_ep_try_config(dev, &ed_bulk_out); in ZTEST()
582 test_udc_ep_try_config(dev, &ed_bulk_in); in ZTEST()
584 buf = test_udc_ep_buf_alloc(dev, &ed_bulk_out); in ZTEST()
585 test_udc_ep_enable(dev, &ed_bulk_out); in ZTEST()
586 test_udc_ep_enqueue(dev, buf); in ZTEST()
587 test_udc_ep_halt(dev, &ed_bulk_out); in ZTEST()
588 test_udc_ep_disable(dev, &ed_bulk_out); in ZTEST()
589 test_udc_ep_dequeue(dev, &ed_bulk_out); in ZTEST()
590 test_udc_ep_buf_free(dev, buf); in ZTEST()
592 err = udc_shutdown(dev); in ZTEST()
595 err = udc_disable(dev); in ZTEST()
598 err = udc_shutdown(dev); in ZTEST()