common: Add NXP's USB serial code.
[gps-watch.git] / src / common / usb_khci.h
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2015, Freescale Semiconductor, Inc.
4  * Copyright 2016 NXP
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,
8  * are permitted (subject to the limitations in the disclaimer below) provided
9  * that the following conditions are met:
10  *
11  * o Redistributions of source code must retain the above copyright notice, this list
12  *   of conditions and the following disclaimer.
13  *
14  * o Redistributions in binary form must reproduce the above copyright notice, this
15  *   list of conditions and the following disclaimer in the documentation and/or
16  *   other materials provided with the distribution.
17  *
18  * o Neither the name of the copyright holder nor the names of its
19  *   contributors may be used to endorse or promote products derived from this
20  *   software without specific prior written permission.
21  *
22  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34
35 #ifndef __USB_KHCI_H__
36 #define __USB_KHCI_H__
37
38 /*******************************************************************************
39  * Definitions
40  ******************************************************************************/
41
42 #define USB_KHCI_BDT_DEVICE_OUT_TOKEN (0x01U)
43 #define USB_KHCI_BDT_DEVICE_IN_TOKEN (0x09U)
44 #define USB_KHCI_BDT_DEVICE_SETUP_TOKEN (0x0DU)
45
46 #define USB_KHCI_BDT_OWN (0x80U)
47 #define USB_KHCI_BDT_DATA01(x) ((((uint32_t)(x)) & 0x01U) << 0x06U)
48 #define USB_KHCI_BDT_BC(x) ((((uint32_t)(x)) & 0x3FFU) << 0x10U)
49 #define UBS_KHCI_BDT_KEEP (0x20U)
50 #define UBS_KHCI_BDT_NINC (0x10U)
51 #define USB_KHCI_BDT_DTS (0x08U)
52 #define USB_KHCI_BDT_STALL (0x04U)
53
54 typedef enum _usb_khci_interrupt_type
55 {
56     kUSB_KhciInterruptReset = 0x01U,
57     kUSB_KhciInterruptError = 0x02U,
58     kUSB_KhciInterruptSofToken = 0x04U,
59     kUSB_KhciInterruptTokenDone = 0x08U,
60     kUSB_KhciInterruptSleep = 0x10U,
61     kUSB_KhciInterruptResume = 0x20U,
62     kUSB_KhciInterruptAttach = 0x40U,
63     kUSB_KhciInterruptStall = 0x80U,
64 } usb_khci_interrupt_type_t;
65
66 #endif /* __USB_KHCI_H__ */