Main functions to generate USB patterns.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
#include "compiler.h"
#include "preprocessor.h"
#include "board.h"
#include "gpio.h"
#include "sysclk.h"
#include "usbb_otg.h"
#include "usbb_device.h"
#include "usb_protocol.h"
#include "usb_protocol_hid.h"
#include "delay.h"
Data Structures | |
struct | main_conf_desc_t |
USB HID mouse configuration descriptor struct. More... | |
struct | udi_hid_mouse_report_desc_t |
Report descriptor for HID mouse. More... | |
Macros | |
#define | SAML21_USB_TST |
#define | TST_15_DIS |
#define | TST_DETACH_DELAY 800 |
#define | USB_DEVICE_ATTR (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED) |
#define | USB_DEVICE_MAJOR_VERSION 1 |
#define | USB_DEVICE_MINOR_VERSION 0 |
#define | USB_DEVICE_POWER 100 |
#define | USB_DEVICE_PRODUCT_ID USB_PID_ATMEL_ASF_HIDMOUSE |
#define | USB_DEVICE_VENDOR_ID USB_VID_ATMEL |
Functions | |
int | main (void) |
Main function. Execution starts here. More... | |
Routines USB low level | |
static void | main_otg_init (void) |
Reset and initialize USB OTG peripheral to specified speed mode. More... | |
static void | main_usb_wait_reset_start (void) |
Waits the start of USB reset signal This routine waits the end of SOF. More... | |
static void | main_usb_wait_end_of_reset (void) |
Waits the end of USB reset signal. More... | |
static void | main_usb_wait_suspend (void) |
Waits a USB suspend mode. More... | |
static void | main_usb_wait_resume (void) |
Waits a USB downstream resume signal from host. More... | |
static void | main_usb_wait_wakeup (void) |
Waits a USB wakeup signal. More... | |
static void | main_usb_wait_sof (void) |
Waits a USB start of frame (or 1ms for USB low speed) More... | |
static void | main_detach (void) |
Detaches the USB device of the USB line (= remove USB pull_up) More... | |
static void | main_usb_enable_ctrl_ep (uint8_t address, uint8_t ep_size) |
Allocation of the control endpoint. More... | |
static void | main_usb_wait_setup_packet (void) |
Waits a SETUP packet and load data in main_setup_packet[]. More... | |
static void | main_usb_stall_after_setup_packet (void) |
Enables the control endpoint STALL after a SETUP packet reception. More... | |
static void | main_usb_send_in (uint8_t *payload, uint8_t size) |
Waits a DATA IN packets on control endpoint. More... | |
static void | main_usb_wait_out (uint8_t *payload, uint8_t size) |
Sends a DATA OUT packets on control endpoint. More... | |
Routines for each step of USB enumeration from USB Host stack core | |
static void | main_usb_enum_step1 (void) |
step1 of enumeration - wait a USB reset More... | |
static void | main_usb_enum_step2 (void) |
step2 of enumeration - IDLE 20ms More... | |
static void | main_usb_enum_step3 (void) |
step3 of enumeration - wait a USB reset More... | |
static void | main_usb_enum_step4 (void) |
step4 of enumeration - IDLE 100ms and initialize control endpoint More... | |
static void | main_usb_enum_step5 (void) |
step5 of enumeration - Get incomplete USB device descriptor More... | |
static void | main_usb_enum_step6 (void) |
step6 of enumeration - IDLE 20ms More... | |
static void | main_usb_enum_step7 (void) |
step7 of enumeration - wait a USB reset More... | |
static void | main_usb_enum_step8 (void) |
step8 of enumeration - IDLE 100ms More... | |
static void | main_usb_enum_step9 (void) |
step9 of enumeration - Reception of the Set address setup request More... | |
static void | main_usb_enum_step10 (void) |
step10 of enumeration - IDLE 20ms More... | |
static void | main_usb_enum_step11 (void) |
step11 of enumeration - Reception of the full Get device descriptor More... | |
static void | main_usb_enum_step12 (void) |
step12 of enumeration - Get first struct of USB configuration descriptor More... | |
static void | main_usb_enum_step13 (void) |
step13 of enumeration - Get all USB configuration descriptor More... | |
static void | main_usb_enum_step14 (void) |
step14 of enumeration - Reception of the Set configuration setup request More... | |
Tests of USB Host stack core | |
static void | main_test1 (void) |
Test 1 - Attach and no response. More... | |
static void | main_test2 (void) |
Test 2 - Disable endpoint 0 after first setup packet. More... | |
static void | main_test3 (void) |
Test 3 - Detach after first setup packet. More... | |
static void | main_test4 (void) |
Test 4 - No response data (NACK IN) after first setup packet. More... | |
static void | main_test5 (void) |
Test 5 - Detach after IN data phase of first setup request. More... | |
static void | main_test6 (void) |
Test 6 - Wrong value in first setup request get descriptor. More... | |
static void | main_test7 (void) |
Test 7 - Detach before reset. More... | |
static void | main_test8 (void) |
Test 8 - Detach during reset after first setup request get descriptor. More... | |
static void | main_test9 (void) |
Test 9 - Detach after reset after first setup request get descriptor. More... | |
static void | main_test10 (void) |
Test 10 - No send ZLP (NAK IN) after second setup packet (set address) More... | |
static void | main_test11 (void) |
Test 11 - Wrong value in first setup request get configuration 0. More... | |
static void | main_test12 (void) |
Test 12 - Wrong transfer value in second setup request get configuration 0. More... | |
static void | main_test13 (void) |
Test 13 - To high power consumption in setup request get configuration 0. More... | |
static void | main_test14 (void) |
Test 14 - No supported interface (!=HID mouse) More... | |
static void | main_test15 (void) |
Test 15 - HID mouse with too large endpoint size (USBB hardware limit) More... | |
static void | main_test16 (void) |
Test 16 - Stall SET CONFIGURATION (with configuration in SELF + 300mA -> must be pass) More... | |
static void | main_test17 (void) |
Test 17 - Enumeration success (with configuration in BUS + 100mA -> must be pass) More... | |
static void | main_test18 (void) |
Test 18 - Test downstream resume (from USB host) More... | |
static void | main_test19 (void) |
Test 19 - Test disconnection during downstream resume (from USB host) More... | |
static void | main_test20 (void) |
Test 20 - Test upstream resume (from USB device) More... | |
static void | main_test21 (void) |
Test 21 - Test detach during suspend. More... | |
Variables | |
static main_conf_desc_t | main_conf_desc |
USB HID mouse configuration descriptor default definition. More... | |
COMPILER_WORD_ALIGNED usb_dev_desc_t | main_device_desc |
USB HID mouse device descriptor. More... | |
static usb_setup_req_t | main_setup_packet |
static uint8_t | speed |
USB test speed (0:LS, 1:FS, 2:HS) More... | |
#define SAML21_USB_TST |
#define TST_15_DIS |
#define TST_DETACH_DELAY 800 |
Referenced by main_detach().
#define USB_DEVICE_ATTR (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED) |
Referenced by main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_usb_enum_step12(), and main_usb_enum_step13().
#define USB_DEVICE_MAJOR_VERSION 1 |
#define USB_DEVICE_MINOR_VERSION 0 |
#define USB_DEVICE_POWER 100 |
Referenced by main_test11(), main_test12(), main_test14(), main_test15(), main_usb_enum_step12(), and main_usb_enum_step13().
#define USB_DEVICE_PRODUCT_ID USB_PID_ATMEL_ASF_HIDMOUSE |
#define USB_DEVICE_VENDOR_ID USB_VID_ATMEL |
int main | ( | void | ) |
Main function. Execution starts here.
References board_init(), delay_init, main_otg_init(), main_test1(), main_test10(), main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test17(), main_test18(), main_test19(), main_test2(), main_test20(), main_test21(), main_test3(), main_test4(), main_test5(), main_test6(), main_test7(), main_test8(), main_test9(), speed, sysclk_enable_usb(), sysclk_get_cpu_hz(), and sysclk_init().
|
static |
Detaches the USB device of the USB line (= remove USB pull_up)
References delay_ms, TST_DETACH_DELAY, and udd_detach_device.
Referenced by main_test1(), main_test10(), main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test19(), main_test2(), main_test21(), main_test3(), main_test4(), main_test5(), main_test6(), main_test7(), main_test8(), and main_test9().
|
static |
Reset and initialize USB OTG peripheral to specified speed mode.
References Assert, delay_ms, Is_otg_clock_frozen, otg_disable, otg_disable_id_pin, otg_enable, otg_enable_pad, otg_force_device_mode, otg_unfreeze_clock, speed, udd_high_speed_disable, udd_high_speed_enable, udd_low_speed_disable, and udd_low_speed_enable.
Referenced by main(), main_test10(), main_test11(), main_test20(), main_test4(), main_test5(), main_test6(), main_test8(), and main_test9().
|
static |
Test 1 - Attach and no response.
References main_detach(), main_usb_enum_step1(), main_usb_enum_step2(), main_usb_enum_step3(), main_usb_wait_suspend(), udd_attach_device, udd_disable_endpoint, and udd_unallocate_memory.
Referenced by main().
|
static |
Test 10 - No send ZLP (NAK IN) after second setup packet (set address)
References main_detach(), main_otg_init(), main_usb_enable_ctrl_ep(), 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_wait_setup_packet(), speed, and udd_attach_device.
Referenced by main().
|
static |
Test 11 - Wrong value in first setup request get configuration 0.
References usb_conf_desc_t::bDescriptorType, usb_conf_desc_t::bmAttributes, usb_conf_desc_t::bMaxPower, main_conf_desc_t::conf, main_detach(), main_otg_init(), main_usb_enum_step1(), main_usb_enum_step10(), main_usb_enum_step11(), 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_send_in(), main_usb_wait_out(), main_usb_wait_setup_packet(), main_usb_wait_suspend(), udd_attach_device, USB_CONFIG_ATTR_MUST_SET, USB_CONFIG_MAX_POWER, USB_DEVICE_ATTR, and USB_DEVICE_POWER.
Referenced by main().
|
static |
Test 12 - Wrong transfer value in second setup request get configuration 0.
References usb_conf_desc_t::bDescriptorType, usb_iface_desc_t::bInterfaceProtocol, usb_conf_desc_t::bmAttributes, usb_conf_desc_t::bMaxPower, main_conf_desc_t::conf, HID_PROTOCOL_MOUSE, main_conf_desc_t::iface, main_detach(), main_usb_enum_step1(), main_usb_enum_step10(), main_usb_enum_step11(), main_usb_enum_step12(), 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_send_in(), main_usb_wait_out(), main_usb_wait_setup_packet(), main_usb_wait_suspend(), udd_attach_device, USB_CONFIG_ATTR_MUST_SET, USB_CONFIG_MAX_POWER, USB_DEVICE_ATTR, USB_DEVICE_POWER, and USB_DT_CONFIGURATION.
Referenced by main().
|
static |
Test 13 - To high power consumption in setup request get configuration 0.
References usb_conf_desc_t::bDescriptorType, usb_conf_desc_t::bmAttributes, usb_conf_desc_t::bMaxPower, main_conf_desc_t::conf, main_detach(), main_usb_enum_step1(), main_usb_enum_step10(), main_usb_enum_step11(), 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_send_in(), main_usb_wait_out(), main_usb_wait_setup_packet(), main_usb_wait_suspend(), udd_attach_device, USB_CONFIG_ATTR_MUST_SET, USB_CONFIG_MAX_POWER, USB_DEVICE_ATTR, and USB_DT_CONFIGURATION.
Referenced by main().
|
static |
Test 14 - No supported interface (!=HID mouse)
References usb_conf_desc_t::bDescriptorType, usb_iface_desc_t::bInterfaceProtocol, usb_conf_desc_t::bmAttributes, usb_conf_desc_t::bMaxPower, main_conf_desc_t::conf, main_conf_desc_t::ep, main_conf_desc_t::iface, LE16, main_detach(), main_usb_enum_step1(), main_usb_enum_step10(), main_usb_enum_step11(), main_usb_enum_step12(), 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_send_in(), main_usb_wait_out(), main_usb_wait_setup_packet(), main_usb_wait_suspend(), udd_attach_device, USB_CONFIG_ATTR_MUST_SET, USB_CONFIG_MAX_POWER, USB_DEVICE_ATTR, USB_DEVICE_POWER, USB_DT_CONFIGURATION, and usb_ep_desc_t::wMaxPacketSize.
Referenced by main().
|
static |
Test 15 - HID mouse with too large endpoint size (USBB hardware limit)
References usb_conf_desc_t::bDescriptorType, usb_iface_desc_t::bInterfaceProtocol, usb_conf_desc_t::bmAttributes, usb_conf_desc_t::bMaxPower, main_conf_desc_t::conf, main_conf_desc_t::ep, HID_PROTOCOL_MOUSE, main_conf_desc_t::iface, LE16, main_detach(), main_usb_enum_step1(), main_usb_enum_step10(), main_usb_enum_step11(), main_usb_enum_step12(), 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_send_in(), main_usb_wait_out(), main_usb_wait_setup_packet(), main_usb_wait_suspend(), udd_attach_device, USB_CONFIG_ATTR_MUST_SET, USB_CONFIG_MAX_POWER, USB_DEVICE_ATTR, USB_DEVICE_POWER, USB_DT_CONFIGURATION, and usb_ep_desc_t::wMaxPacketSize.
Referenced by main().
|
static |
Test 16 - Stall SET CONFIGURATION (with configuration in SELF + 300mA -> must be pass)
References usb_conf_desc_t::bDescriptorType, usb_iface_desc_t::bInterfaceProtocol, usb_conf_desc_t::bmAttributes, usb_conf_desc_t::bMaxPower, main_conf_desc_t::conf, main_conf_desc_t::ep, HID_PROTOCOL_MOUSE, main_conf_desc_t::iface, LE16, main_detach(), main_usb_enum_step1(), main_usb_enum_step10(), main_usb_enum_step11(), main_usb_enum_step12(), 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_send_in(), main_usb_stall_after_setup_packet(), main_usb_wait_out(), main_usb_wait_setup_packet(), main_usb_wait_suspend(), udd_attach_device, USB_CONFIG_ATTR_MUST_SET, USB_CONFIG_ATTR_SELF_POWERED, USB_CONFIG_MAX_POWER, USB_DT_CONFIGURATION, and usb_ep_desc_t::wMaxPacketSize.
Referenced by main().
|
static |
Test 17 - Enumeration success (with configuration in BUS + 100mA -> must be pass)
References main_usb_enum_step1(), main_usb_enum_step10(), main_usb_enum_step11(), main_usb_enum_step12(), main_usb_enum_step13(), main_usb_enum_step14(), 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(), and udd_attach_device.
Referenced by main().
|
static |
Test 18 - Test downstream resume (from USB host)
References main_usb_send_in(), main_usb_wait_setup_packet(), main_usb_wait_suspend(), and main_usb_wait_wakeup().
Referenced by main().
|
static |
Test 19 - Test disconnection during downstream resume (from USB host)
References main_detach(), main_usb_wait_suspend(), and main_usb_wait_wakeup().
Referenced by main().
|
static |
Test 2 - Disable endpoint 0 after first setup packet.
References main_detach(), main_usb_enum_step1(), main_usb_enum_step2(), main_usb_enum_step3(), main_usb_enum_step4(), main_usb_wait_setup_packet(), main_usb_wait_suspend(), udd_attach_device, and udd_disable_endpoint.
Referenced by main().
|
static |
Test 20 - Test upstream resume (from USB device)
References delay_ms, main_otg_init(), main_usb_enum_step1(), main_usb_enum_step10(), main_usb_enum_step11(), main_usb_enum_step12(), main_usb_enum_step13(), main_usb_enum_step14(), 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_send_in(), main_usb_wait_setup_packet(), main_usb_wait_sof(), main_usb_wait_suspend(), main_usb_wait_wakeup(), udd_attach_device, and udd_initiate_remote_wake_up.
Referenced by main().
|
static |
Test 21 - Test detach during suspend.
References delay_ms, main_detach(), and main_usb_wait_suspend().
Referenced by main().
|
static |
Test 3 - Detach after first setup packet.
References main_detach(), 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(), and udd_attach_device.
Referenced by main().
|
static |
Test 4 - No response data (NACK IN) after first setup packet.
References main_detach(), main_otg_init(), main_usb_enum_step1(), main_usb_enum_step2(), main_usb_enum_step3(), main_usb_enum_step4(), main_usb_wait_setup_packet(), and udd_attach_device.
Referenced by main().
|
static |
Test 5 - Detach after IN data phase of first setup request.
References usb_dev_desc_t::bDescriptorType, usb_dev_desc_t::bMaxPacketSize0, main_detach(), main_otg_init(), main_usb_enum_step1(), main_usb_enum_step2(), main_usb_enum_step3(), main_usb_enum_step4(), main_usb_send_in(), main_usb_wait_setup_packet(), speed, udd_attach_device, and USB_DT_DEVICE.
Referenced by main().
|
static |
Test 6 - Wrong value in first setup request get descriptor.
References usb_dev_desc_t::bDescriptorType, usb_dev_desc_t::bMaxPacketSize0, main_detach(), main_otg_init(), main_usb_enum_step1(), main_usb_enum_step2(), main_usb_enum_step3(), main_usb_enum_step4(), main_usb_send_in(), main_usb_wait_out(), main_usb_wait_setup_packet(), main_usb_wait_suspend(), and udd_attach_device.
Referenced by main().
|
static |
Test 7 - Detach before reset.
References main_detach(), main_usb_enum_step1(), main_usb_enum_step2(), main_usb_enum_step3(), main_usb_enum_step4(), main_usb_enum_step5(), main_usb_wait_sof(), and udd_attach_device.
Referenced by main().
|
static |
Test 8 - Detach during reset after first setup request get descriptor.
References delay_ms, Is_udd_low_speed_enable, main_detach(), main_otg_init(), 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_wait_reset_start(), udd_ack_reset, and udd_attach_device.
Referenced by main().
|
static |
Test 9 - Detach after reset after first setup request get descriptor.
References main_detach(), main_otg_init(), 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(), and udd_attach_device.
Referenced by main().
|
static |
Allocation of the control endpoint.
address | USB address of endpoint |
ep_size | control endpoint size |
References udd_allocate_memory, udd_configure_address, udd_configure_endpoint, udd_disable_address, udd_disable_endpoint, udd_enable_address, udd_enable_endpoint, udd_unallocate_memory, and USB_EP_TYPE_CONTROL.
Referenced by main_test10(), main_usb_enum_step4(), and main_usb_enum_step9().
|
static |
step1 of enumeration - wait a USB reset
References main_usb_wait_end_of_reset().
Referenced by main_test1(), main_test10(), main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test17(), main_test2(), main_test20(), main_test3(), main_test4(), main_test5(), main_test6(), main_test7(), main_test8(), and main_test9().
|
static |
step10 of enumeration - IDLE 20ms
References main_usb_wait_sof().
Referenced by main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test17(), and main_test20().
|
static |
step11 of enumeration - Reception of the full Get device descriptor
References usb_dev_desc_t::bDescriptorType, usb_dev_desc_t::bMaxPacketSize0, main_usb_send_in(), main_usb_wait_out(), main_usb_wait_setup_packet(), speed, and USB_DT_DEVICE.
Referenced by main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test17(), and main_test20().
|
static |
step12 of enumeration - Get first struct of USB configuration descriptor
References usb_conf_desc_t::bDescriptorType, usb_conf_desc_t::bLength, usb_conf_desc_t::bmAttributes, usb_conf_desc_t::bMaxPower, main_conf_desc_t::conf, main_usb_send_in(), main_usb_wait_out(), main_usb_wait_setup_packet(), USB_CONFIG_ATTR_MUST_SET, USB_CONFIG_MAX_POWER, USB_DEVICE_ATTR, USB_DEVICE_POWER, and USB_DT_CONFIGURATION.
Referenced by main_test12(), main_test14(), main_test15(), main_test16(), main_test17(), and main_test20().
|
static |
step13 of enumeration - Get all USB configuration descriptor
References usb_conf_desc_t::bDescriptorType, usb_iface_desc_t::bInterfaceProtocol, usb_conf_desc_t::bLength, usb_conf_desc_t::bmAttributes, usb_conf_desc_t::bMaxPower, main_conf_desc_t::conf, main_conf_desc_t::ep, HID_PROTOCOL_MOUSE, main_conf_desc_t::iface, LE16, main_usb_send_in(), main_usb_wait_out(), main_usb_wait_setup_packet(), USB_CONFIG_ATTR_MUST_SET, USB_CONFIG_MAX_POWER, USB_DEVICE_ATTR, USB_DEVICE_POWER, USB_DT_CONFIGURATION, and usb_ep_desc_t::wMaxPacketSize.
Referenced by main_test17(), and main_test20().
|
static |
step14 of enumeration - Reception of the Set configuration setup request
References main_usb_send_in(), and main_usb_wait_setup_packet().
Referenced by main_test17(), and main_test20().
|
static |
step2 of enumeration - IDLE 20ms
References main_usb_wait_sof().
Referenced by main_test1(), main_test10(), main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test17(), main_test2(), main_test20(), main_test3(), main_test4(), main_test5(), main_test6(), main_test7(), main_test8(), and main_test9().
|
static |
step3 of enumeration - wait a USB reset
References main_usb_wait_end_of_reset().
Referenced by main_test1(), main_test10(), main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test17(), main_test2(), main_test20(), main_test3(), main_test4(), main_test5(), main_test6(), main_test7(), main_test8(), and main_test9().
|
static |
step4 of enumeration - IDLE 100ms and initialize control endpoint
References main_usb_enable_ctrl_ep(), main_usb_wait_sof(), and speed.
Referenced by main_test10(), main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test17(), main_test2(), main_test20(), main_test3(), main_test4(), main_test5(), main_test6(), main_test7(), main_test8(), and main_test9().
|
static |
step5 of enumeration - Get incomplete USB device descriptor
References usb_dev_desc_t::bDescriptorType, usb_dev_desc_t::bMaxPacketSize0, main_usb_send_in(), main_usb_wait_out(), main_usb_wait_setup_packet(), speed, and USB_DT_DEVICE.
Referenced by main_test10(), main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test17(), main_test20(), main_test7(), main_test8(), and main_test9().
|
static |
step6 of enumeration - IDLE 20ms
References main_usb_wait_sof().
Referenced by main_test10(), main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test17(), main_test20(), main_test8(), and main_test9().
|
static |
step7 of enumeration - wait a USB reset
References main_usb_wait_end_of_reset().
Referenced by main_test10(), main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test17(), main_test20(), and main_test9().
|
static |
step8 of enumeration - IDLE 100ms
References main_usb_wait_sof().
Referenced by main_test10(), main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test17(), and main_test20().
|
static |
step9 of enumeration - Reception of the Set address setup request
References le16_to_cpu, main_usb_enable_ctrl_ep(), main_usb_send_in(), main_usb_wait_setup_packet(), speed, and usb_setup_req_t::wValue.
Referenced by main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test17(), and main_test20().
|
static |
Waits a DATA IN packets on control endpoint.
payload | RAM buffer to store data received |
size | Size of RAM buffer waiting |
References Is_udd_in_send, udd_ack_in_send, udd_get_endpoint_fifo_access, and udd_get_endpoint_size.
Referenced by main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test18(), main_test20(), main_test5(), main_test6(), main_usb_enum_step11(), main_usb_enum_step12(), main_usb_enum_step13(), main_usb_enum_step14(), main_usb_enum_step5(), and main_usb_enum_step9().
|
static |
Enables the control endpoint STALL after a SETUP packet reception.
References udd_ack_setup_received, and udd_enable_stall_handshake.
Referenced by main_test16().
|
static |
Waits the end of USB reset signal.
References Is_udd_reset, and udd_ack_reset.
Referenced by main_usb_enum_step1(), main_usb_enum_step3(), and main_usb_enum_step7().
|
static |
Sends a DATA OUT packets on control endpoint.
payload | Data buffer to send |
size | Size of buffer |
References Is_udd_out_received, udd_ack_out_received, udd_byte_count, and udd_get_endpoint_fifo_access.
Referenced by main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test6(), main_usb_enum_step11(), main_usb_enum_step12(), main_usb_enum_step13(), and main_usb_enum_step5().
|
static |
Waits the start of USB reset signal This routine waits the end of SOF.
References delay_ms, Is_udd_sof, and udd_ack_sof.
Referenced by main_test8().
|
static |
Waits a USB downstream resume signal from host.
References Is_udd_resume, and udd_ack_resume.
|
static |
Waits a SETUP packet and load data in main_setup_packet[].
References Assert, Is_udd_setup_received, udd_ack_setup_received, udd_byte_count, and udd_get_endpoint_fifo_access.
Referenced by main_test10(), main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test18(), main_test2(), main_test20(), main_test3(), main_test4(), main_test5(), main_test6(), main_usb_enum_step11(), main_usb_enum_step12(), main_usb_enum_step13(), main_usb_enum_step14(), main_usb_enum_step5(), and main_usb_enum_step9().
|
static |
Waits a USB start of frame (or 1ms for USB low speed)
References delay_ms, Is_udd_low_speed_enable, Is_udd_sof, and udd_ack_sof.
Referenced by main_test20(), main_test3(), main_test7(), main_test9(), main_usb_enum_step10(), main_usb_enum_step2(), main_usb_enum_step4(), main_usb_enum_step6(), and main_usb_enum_step8().
|
static |
Waits a USB suspend mode.
References Is_udd_suspend, and udd_ack_suspend.
Referenced by main_test1(), main_test11(), main_test12(), main_test13(), main_test14(), main_test15(), main_test16(), main_test18(), main_test19(), main_test2(), main_test20(), main_test21(), and main_test6().
|
static |
Waits a USB wakeup signal.
References Is_udd_wake_up, and udd_ack_wake_up.
Referenced by main_test18(), main_test19(), and main_test20().
|
static |
USB HID mouse configuration descriptor default definition.
COMPILER_WORD_ALIGNED usb_dev_desc_t main_device_desc |
USB HID mouse device descriptor.
|
static |
|
static |
USB test speed (0:LS, 1:FS, 2:HS)
Referenced by main(), main_otg_init(), main_test10(), main_test5(), main_usb_enum_step11(), main_usb_enum_step4(), main_usb_enum_step5(), and main_usb_enum_step9().