/ src / pio_usb_configuration.h
pio_usb_configuration.h
 1  
 2  #pragma once
 3  
 4  typedef enum {
 5    PIO_USB_PINOUT_DPDM = 0,  // DM = DP+1
 6    PIO_USB_PINOUT_DMDP,      // DM = DP-1
 7  } PIO_USB_PINOUT;
 8  
 9  typedef struct {
10      uint8_t pin_dp;
11      uint8_t pio_tx_num;
12      uint8_t sm_tx;
13      uint8_t tx_ch;
14      uint8_t pio_rx_num;
15      uint8_t sm_rx;
16      uint8_t sm_eop;
17      void* alarm_pool;
18      int8_t debug_pin_rx;
19      int8_t debug_pin_eop;
20      bool skip_alarm_pool;
21      PIO_USB_PINOUT pinout;
22  } pio_usb_configuration_t;
23  
24  #ifndef PIO_USB_DP_PIN_DEFAULT
25  #define PIO_USB_DP_PIN_DEFAULT 0
26  #endif
27  
28  #define PIO_USB_TX_DEFAULT 0
29  #define PIO_SM_USB_TX_DEFAULT 0
30  #define PIO_USB_DMA_TX_DEFAULT 0
31  
32  #define PIO_USB_RX_DEFAULT 0
33  #define PIO_SM_USB_RX_DEFAULT 1
34  #define PIO_SM_USB_EOP_DEFAULT 2
35  
36  #define PIO_USB_DEBUG_PIN_NONE (-1)
37  
38  #define PIO_USB_DEFAULT_CONFIG                                             \
39    {                                                                        \
40      PIO_USB_DP_PIN_DEFAULT, PIO_USB_TX_DEFAULT, PIO_SM_USB_TX_DEFAULT,     \
41          PIO_USB_DMA_TX_DEFAULT, PIO_USB_RX_DEFAULT, PIO_SM_USB_RX_DEFAULT, \
42          PIO_SM_USB_EOP_DEFAULT, NULL, PIO_USB_DEBUG_PIN_NONE,              \
43          PIO_USB_DEBUG_PIN_NONE, false, PIO_USB_PINOUT_DPDM                 \
44    }
45  
46  #define PIO_USB_EP_POOL_CNT 32
47  #define PIO_USB_DEV_EP_CNT 16
48  #define PIO_USB_DEVICE_CNT 4
49  #define PIO_USB_HUB_PORT_CNT 8
50  #define PIO_USB_ROOT_PORT_CNT 2
51  
52  #define PIO_USB_EP_SIZE 64