Ejemplo n.º 1
0
//! \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();
}
Ejemplo n.º 2
0
//! \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);
}
Ejemplo n.º 3
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();
}
Ejemplo n.º 4
0
//! \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 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();
}
Ejemplo n.º 6
0
//! \brief Test 9  - Detach after reset after first setup request get descriptor
static void main_test9(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_wait_sof();
	main_detach();
}
Ejemplo n.º 7
0
//! \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();
}
Ejemplo n.º 8
0
//! \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
}
Ejemplo n.º 9
0
//! \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();
}