//! \brief Test 15 - HID mouse with too large endpoint size (USBB hardware limit) static void main_test15(void) { udd_attach_device(); main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_enum_step5(); main_usb_enum_step6(); main_usb_enum_step7(); main_usb_enum_step8(); main_usb_enum_step9(); main_usb_enum_step10(); main_usb_enum_step11(); main_usb_enum_step12(); // Get configuration descriptor main_usb_wait_setup_packet(); main_conf_desc.conf.bDescriptorType = USB_DT_CONFIGURATION; main_conf_desc.conf.bMaxPower = USB_CONFIG_MAX_POWER(USB_DEVICE_POWER), main_conf_desc.conf.bmAttributes = USB_CONFIG_ATTR_MUST_SET | USB_DEVICE_ATTR, main_conf_desc.iface.bInterfaceProtocol = HID_PROTOCOL_MOUSE; main_conf_desc.ep.wMaxPacketSize = LE16(1023); main_usb_send_in((uint8_t*)&main_conf_desc, sizeof(main_conf_desc)); main_usb_wait_out(NULL,0); main_usb_wait_suspend(); main_detach(); }
//! \brief Test 20 - Test upstream resume (from USB device) static void main_test20(void) { udd_attach_device(); main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_enum_step5(); main_usb_enum_step6(); main_usb_enum_step7(); main_usb_enum_step8(); main_usb_enum_step9(); main_usb_enum_step10(); main_usb_enum_step11(); main_usb_enum_step12(); main_usb_enum_step13(); main_usb_enum_step14(); // Setup set remotewakeup main_usb_wait_setup_packet(); main_usb_send_in(NULL,0); main_usb_wait_suspend(); delay_ms(100); udd_initiate_remote_wake_up(); main_usb_wait_wakeup(); main_usb_wait_sof(); // Setup clear remotewakeup main_usb_wait_setup_packet(); main_usb_send_in(NULL,0); }
//! \brief Test 16 - Stall SET CONFIGURATION (with configuration in SELF + 300mA -> must be pass) static void main_test16(void) { uint8_t nb_fail; udd_attach_device(); nb_fail = 4; while (nb_fail--) { main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_enum_step5(); main_usb_enum_step6(); main_usb_enum_step7(); main_usb_enum_step8(); main_usb_enum_step9(); main_usb_enum_step10(); main_usb_enum_step11(); main_usb_enum_step12(); // Get configuration descriptor main_usb_wait_setup_packet(); main_conf_desc.conf.bDescriptorType = USB_DT_CONFIGURATION; main_conf_desc.conf.bMaxPower = USB_CONFIG_MAX_POWER(300), main_conf_desc.conf.bmAttributes = USB_CONFIG_ATTR_MUST_SET | USB_CONFIG_ATTR_SELF_POWERED; main_conf_desc.iface.bInterfaceProtocol = HID_PROTOCOL_MOUSE; main_conf_desc.ep.wMaxPacketSize = LE16(8); main_usb_send_in((uint8_t*)&main_conf_desc, sizeof(main_conf_desc)); main_usb_wait_out(NULL,0); // Set configuration main_usb_wait_setup_packet(); main_usb_stall_after_setup_packet(); } main_usb_wait_suspend(); main_detach(); }
//! \brief Test 11 - Wrong value in first setup request get configuration 0 static void main_test11(void) { uint8_t nb_fail; main_otg_init(); udd_attach_device(); nb_fail = 4; while (nb_fail--) { main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_enum_step5(); main_usb_enum_step6(); main_usb_enum_step7(); main_usb_enum_step8(); main_usb_enum_step9(); main_usb_enum_step10(); main_usb_enum_step11(); // Get configuration descriptor main_usb_wait_setup_packet(); main_conf_desc.conf.bDescriptorType = 0xFF; main_conf_desc.conf.bMaxPower = USB_CONFIG_MAX_POWER(USB_DEVICE_POWER); main_conf_desc.conf.bmAttributes = USB_CONFIG_ATTR_MUST_SET | USB_DEVICE_ATTR, main_usb_send_in((uint8_t*)&main_conf_desc, sizeof(usb_conf_desc_t)); main_usb_wait_out(NULL,0); } main_usb_wait_suspend(); main_detach(); }
//! \brief Test 13 - To high power consumption in setup request get configuration 0 static void main_test13(void) { udd_attach_device(); main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_enum_step5(); main_usb_enum_step6(); main_usb_enum_step7(); main_usb_enum_step8(); main_usb_enum_step9(); main_usb_enum_step10(); main_usb_enum_step11(); // Get configuration descriptor main_usb_wait_setup_packet(); main_conf_desc.conf.bDescriptorType = USB_DT_CONFIGURATION; main_conf_desc.conf.bMaxPower = USB_CONFIG_MAX_POWER(300); main_conf_desc.conf.bmAttributes = USB_CONFIG_ATTR_MUST_SET | USB_DEVICE_ATTR, main_usb_send_in((uint8_t*)&main_conf_desc, sizeof(usb_conf_desc_t)); main_usb_wait_out(NULL,0); main_usb_wait_suspend(); main_detach(); }
//! \brief Test 7 - Detach before reset static void main_test7(void) { udd_attach_device(); main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_enum_step5(); main_usb_wait_sof(); main_detach(); }
//! \brief Test 3 - Detach after first setup packet static void main_test3(void) { udd_attach_device(); main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_wait_setup_packet(); main_usb_wait_sof(); main_detach(); }
//! \brief Test 4 - No response data (NACK IN) after first setup packet static void main_test4(void) { main_otg_init(); udd_attach_device(); main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_wait_setup_packet(); main_usb_enum_step1(); main_usb_enum_step2(); main_detach(); }
//! \brief Test 9 - Detach after reset after first setup request get descriptor static void main_test9(void) { main_otg_init(); udd_attach_device(); main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_enum_step5(); main_usb_enum_step6(); main_usb_enum_step7(); main_usb_wait_sof(); main_detach(); }
//! \brief Test 5 - Detach after IN data phase of first setup request static void main_test5(void) { udd_attach_device(); main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); // Get Device Descriptor main_usb_wait_setup_packet(); main_device_desc.bDescriptorType = USB_DT_DEVICE; main_device_desc.bMaxPacketSize0 = (speed==0)?8:64; main_usb_send_in((uint8_t*)&main_device_desc,8); main_detach(); }
//! \brief Test 10 - No send ZLP (NAK IN) after second setup packet (set address) static void main_test10(void) { udd_attach_device(); main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_enum_step5(); main_usb_enum_step6(); main_usb_enum_step7(); main_usb_enum_step8(); main_usb_enable_ctrl_ep(0, (speed==0)?8:64); main_usb_wait_setup_packet(); main_usb_enum_step1(); main_usb_enum_step2(); main_detach(); }
//! \brief Test 8 - Detach during reset after first setup request get descriptor static void main_test8(void) { udd_attach_device(); main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_enum_step5(); main_usb_enum_step6(); if (Is_udd_low_speed_enable()) { delay_ms(25); } else { main_usb_wait_reset_start(); } main_detach(); udd_ack_reset(); // Ack previous reset finish by detach }
//! \brief Test 17 - Enumeration success (with configuration in BUS + 100mA -> must be pass) static void main_test17(void) { udd_attach_device(); main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_enum_step5(); main_usb_enum_step6(); main_usb_enum_step7(); main_usb_enum_step8(); main_usb_enum_step9(); main_usb_enum_step10(); main_usb_enum_step11(); main_usb_enum_step12(); main_usb_enum_step13(); main_usb_enum_step14(); }
//! \brief Test 2 - Disable endpoint 0 after first setup packet static void main_test2(void) { uint8_t nb_fail; udd_attach_device(); nb_fail = 4; while (nb_fail--) { main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); main_usb_wait_setup_packet(); udd_disable_endpoint(0); // Here Host try to send IN on control endpoint 0 } main_usb_wait_suspend(); main_detach(); }
//! \brief Test 6 - Wrong value in first setup request get descriptor static void main_test6(void) { uint8_t nb_fail; udd_attach_device(); nb_fail = 4; while (nb_fail--) { main_usb_enum_step1(); main_usb_enum_step2(); main_usb_enum_step3(); main_usb_enum_step4(); // Get Device Descriptor main_usb_wait_setup_packet(); main_device_desc.bDescriptorType = 0xFF; main_device_desc.bMaxPacketSize0 = 0xFF; main_usb_send_in((uint8_t*)&main_device_desc,8); main_usb_wait_out(NULL,0); } main_usb_wait_suspend(); main_detach(); }