M480 BSP  V3.05.001
The Board Support Package for M480 Series
config.h
Go to the documentation of this file.
1 /**************************************************************************/
10 #ifndef _USBH_CONFIG_H_
11 #define _USBH_CONFIG_H_
12 
14 
15 /*----------------------------------------------------------------------------------------*/
16 /* Hardware settings */
17 /*----------------------------------------------------------------------------------------*/
18 #define HCLK_MHZ 192 /* used for loop-delay. must be larger than
19  true HCLK clock MHz */
20 
21 #define ENABLE_OHCI_IRQ() NVIC_EnableIRQ(USBH_IRQn)
22 #define DISABLE_OHCI_IRQ() NVIC_DisableIRQ(USBH_IRQn)
23 #define ENABLE_EHCI_IRQ() NVIC_EnableIRQ(HSUSBH_IRQn)
24 #define DISABLE_EHCI_IRQ() NVIC_DisableIRQ(HSUSBH_IRQn)
25 
26 #define ENABLE_OHCI /* Enable OHCI host controller */
27 #define ENABLE_EHCI /* Enable EHCI host controller */
28 
29 #define EHCI_PORT_CNT 1 /* Number of EHCI roothub ports */
30 #define OHCI_PORT_CNT 2 /* Number of OHCI roothub ports */
31 #define OHCI_PER_PORT_POWER /* OHCI root hub per port powered */
32 
33 #define OHCI_ISO_DELAY 4 /* preserved number frames while scheduling
34  OHCI isochronous transfer */
35 
36 #define EHCI_ISO_DELAY 2 /* preserved number of frames while
37  scheduling EHCI isochronous transfer */
38 
39 #define EHCI_ISO_RCLM_RANGE 32 /* When inspecting activated iTD/siTD,
40  unconditionally reclaim iTD/isTD scheduled
41  in just elapsed EHCI_ISO_RCLM_RANGE ms. */
42 
43 #define MAX_DESC_BUFF_SIZE 512 /* To hold the configuration descriptor, USB
44  core will allocate a buffer with this size
45  for each connected device. USB core does
46  not release it until device disconnected. */
47 
48 /*----------------------------------------------------------------------------------------*/
49 /* Memory allocation settings */
50 /*----------------------------------------------------------------------------------------*/
51 
52 #define STATIC_MEMORY_ALLOC 0 /* pre-allocate static memory blocks. No dynamic memory aloocation.
53  But the maximum number of connected devices and transfers are
54  limited. */
55 
56 #define MAX_UDEV_DRIVER 8
57 #define MAX_ALT_PER_IFACE 8
58 #define MAX_EP_PER_IFACE 6
59 #define MAX_HUB_DEVICE 8
61 /* Host controller hardware transfer descriptors memory pool. ED/TD/ITD of OHCI and QH/QTD of EHCI
62  are all allocated from this pool. Allocated unit size is determined by MEM_POOL_UNIT_SIZE.
63  May allocate one or more units depend on hardware descriptor type. */
64 
65 #define MEM_POOL_UNIT_SIZE 64
66 #define MEM_POOL_UNIT_NUM 256
68 /*----------------------------------------------------------------------------------------*/
69 /* Re-defined staff for various compiler */
70 /*----------------------------------------------------------------------------------------*/
71 #ifdef __ICCARM__
72 #define __inline inline
73 #endif
74 
75 
76 /*----------------------------------------------------------------------------------------*/
77 /* Debug settings */
78 /*----------------------------------------------------------------------------------------*/
79 #define ENABLE_ERROR_MSG /* enable debug messages */
80 #define ENABLE_DEBUG_MSG /* enable debug messages */
81 //#define ENABLE_VERBOSE_DEBUG /* verbos debug messages */
82 //#define DUMP_DESCRIPTOR /* dump descriptors */
83 
84 #ifdef ENABLE_ERROR_MSG
85 #define USB_error printf
86 #else
87 #define USB_error(...)
88 #endif
89 
90 #ifdef ENABLE_DEBUG_MSG
91 #define USB_debug printf
92 #ifdef ENABLE_VERBOSE_DEBUG
93 #define USB_vdebug printf
94 #else
95 #define USB_vdebug(...)
96 #endif
97 #else
98 #define USB_debug(...)
99 #define USB_vdebug(...)
100 #endif
101 
102 
104 
105 #endif /* _USBH_CONFIG_H_ */
106 
107 /*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/
108