Robobo
udphs.h
1 /* ----------------------------------------------------------------------------
2  * SAM Software Package License
3  * ----------------------------------------------------------------------------
4  * Copyright (c) 2011-2012, Atmel Corporation
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following condition is met:
10  *
11  * - Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the disclaimer below.
13  *
14  * Atmel's name may not be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  * ----------------------------------------------------------------------------
28  */
29 
30 #ifndef UDPHS_H_INCLUDED
31 #define UDPHS_H_INCLUDED
32 
33 #define NUM_IT_MAX 3
34 
35 #define EP_SINGLE_64 0x32 // EP0
36 #define EP_DOUBLE_64 0x36 // Other endpoints
37 
38 
39 // Endpoint 0:
40 #define EP_TYPE_CONTROL UDPHS_EPTCFG_EPT_SIZE_64 \
41  | UDPHS_EPTCFG_EPT_TYPE_CTRL8 \
42  | UDPHS_EPTCFG_BK_NUMBER_1
43 #ifdef CDC_ENABLED
44 #define EP_TYPE_BULK_IN UDPHS_EPTCFG_EPT_SIZE_512 \
45  | UDPHS_EPTCFG_EPT_DIR \
46  | UDPHS_EPTCFG_EPT_TYPE_BULK \
47  | UDPHS_EPTCFG_BK_NUMBER_2
48 #define EP_TYPE_BULK_OUT UDPHS_EPTCFG_EPT_SIZE_512 \
49  | UDPHS_EPTCFG_EPT_TYPE_BULK \
50  | UDPHS_EPTCFG_BK_NUMBER_2
51 #define EP_TYPE_INTERRUPT_IN UDPHS_EPTCFG_EPT_SIZE_64 \
52  | UDPHS_EPTCFG_EPT_DIR \
53  | UDPHS_EPTCFG_EPT_TYPE_INT \
54  | UDPHS_EPTCFG_BK_NUMBER_2
55 #endif
56 
57 #ifdef HID_ENABLED
58 #define EP_TYPE_INTERRUPT_IN_HID UDPHS_EPTCFG_EPT_SIZE_64 \
59  | UDPHS_EPTCFG_EPT_DIR \
60  | UDPHS_EPTCFG_EPT_TYPE_INT \
61  | UDPHS_EPTCFG_BK_NUMBER_2
62 #endif
63 
64 #define EP_TYPE_INTERRUPT_OUT UDPHS_EPTCFG_EPT_SIZE_64 \
65  | UDPHS_EPTCFG_EPT_TYPE_INT \
66  | UDPHS_EPTCFG_EPT_TYPE_INT \
67  | UDPHS_EPTCFG_BK_NUMBER_1
68 #define EP_TYPE_ISOCHRONOUS_IN UDPHS_EPTCFG_EPT_SIZE_1024 \
69  | UDPHS_EPTCFG_EPT_DIR \
70  | UDPHS_EPTCFG_EPT_TYPE_ISO \
71  | UDPHS_EPTCFG_BK_NUMBER_3
72 #define EP_TYPE_ISOCHRONOUS_OUT UDPHS_EPTCFG_EPT_SIZE_1024 \
73  | UDPHS_EPTCFG_EPT_TYPE_ISO \
74  | UDPHS_EPTCFG_BK_NUMBER_3
75 
76 
77 #ifndef TXLED1
78 #define TXLED0
79 #define RXLED0
80 #define TXLED1
81 #define RXLED1
82 #endif
83 
84 
85 #define UDFNUML ((UDPHS->UDPHS_FNUM & UDPHS_FNUM_FRAME_NUMBER_Msk)>>3)
86 
87 #define USB_RECV_TIMEOUT
88 
89 #define UDPHS_EPTFIFO (0x20180000) // (UDPHS_EPTFIFO) Base Address
90 
91 #endif /* UDPHS_H_INCLUDED */