source: mainline/uspace/drv/bus/usb/ehci/ehci_regs.h@ 0e7c3d9

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 0e7c3d9 was 8d2dd7f2, checked in by Jakub Jermar <jakub@…>, 8 years ago

Reduce the number of files that include <sys/types.h>

  • Property mode set to 100644
File size: 6.5 KB
Line 
1/*
2 * Copyright (c) 2013 Jan Vesely
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28/** @addtogroup drvusbehci
29 * @{
30 */
31/** @file
32 * @brief EHCI host controller register structure
33 */
34#ifndef DRV_EHCI_EHCI_REGS_H
35#define DRV_EHCI_EHCI_REGS_H
36
37#include <sys/types.h>
38#include <byteorder.h>
39#include <macros.h>
40#include <ddi.h>
41
42#define EHCI_WR(reg, val) pio_write_32(&(reg), host2uint32_t_le(val))
43#define EHCI_RD(reg) uint32_t_le2host(pio_read_32(&(reg)))
44#define EHCI_RD8(reg) pio_read_8(&(reg))
45#define EHCI_SET(reg, val) pio_set_32(&(reg), host2uint32_t_le(val), 10)
46#define EHCI_CLR(reg, val) pio_clear_32(&(reg), host2uint32_t_le(val), 10)
47
48/** EHCI memory mapped capability registers structure */
49typedef struct ehci_cap_regs {
50 const ioport8_t caplength;
51 PADD8;
52 const ioport16_t hciversion;
53 const ioport32_t hcsparams;
54#define EHCI_CAPS_HCS_DEBUG_PORT_MASK 0xf
55#define EHCI_CAPS_HCS_DEBUG_PORT_SHIFT (1 << 20)
56#define EHCI_CAPS_HCS_INDICATORS_FLAG (1 << 16)
57#define EHCI_CAPS_HCS_N_CC_MASK 0xf
58#define EHCI_CAPS_HCS_N_CC_SHIFT 12
59#define EHCI_CAPS_HCS_N_PCC_MASK 0xf
60#define EHCI_CAPS_HCS_N_PCC_SHIFT 8
61#define EHCI_CAPS_HCS_ROUTING_FLAG (1 << 7)
62#define EHCI_CAPS_HCS_PPC_FLAG (1 << 4)
63#define EHCI_CAPS_HCS_N_PORTS_MASK 0xf
64#define EHCI_CAPS_HCS_N_PORTS_SHIFT 0
65
66 const ioport32_t hccparams;
67#define EHCI_CAPS_HCC_EECP_MASK 0xff
68#define EHCI_CAPS_HCC_EECP_SHIFT 8
69#define EHCI_CAPS_HCC_ISO_THRESHOLD_MASK 0xf
70#define EHCI_CAPS_HCC_ISO_THRESHOLD_SHIFT 4
71#define EHCI_CAPS_HCC_ASYNC_PART_FLAG (1 << 2)
72#define EHCI_CAPS_HCC_PROG_FRAME_FLAG (1 << 1)
73#define EHCI_CAPS_HCC_64_FLAG (1 << 0)
74 ioport8_t hcsp_portoute[8];
75
76} ehci_caps_regs_t;
77
78
79/** EHCI memory mapped operational registers structure */
80typedef struct ehci_regs {
81 ioport32_t usbcmd;
82#define USB_CMD_INT_THRESHOLD_MASK 0xff
83#define USB_CMD_INT_THRESHOLD_SHIFT 16
84#define USB_CMD_PARK_MODE_FLAG (1 << 11)
85#define USB_CMD_PARK_COUNT_MASK 0x3
86#define USB_CMD_PARK_COUNT_SHIFT 8
87#define USB_CMD_LIGHT_RESET (1 << 7)
88#define USB_CMD_IRQ_ASYNC_DOORBELL (1 << 6)
89#define USB_CMD_ASYNC_SCHEDULE_FLAG (1 << 5)
90#define USB_CMD_PERIODIC_SCHEDULE_FLAG (1 << 4)
91#define USB_CMD_FRAME_LIST_SIZE_MASK 0x3
92#define USB_CMD_FRAME_LIST_SIZE_SHIFT 2
93#define USB_CMD_FRAME_LIST_SIZE_1024 0x0
94#define USB_CMD_FRAME_LIST_SIZE_512 0x1
95#define USB_CMD_FRAME_LIST_SIZE_256 0x2
96#define USB_CMD_HC_RESET_FLAG (1 << 1)
97#define USB_CMD_RUN_FLAG (1 << 0)
98
99 ioport32_t usbsts;
100#define USB_STS_ASYNC_SCHED_FLAG (1 << 15)
101#define USB_STS_PERIODIC_SCHED_FLAG (1 << 14)
102#define USB_STS_RECLAMATION_FLAG (1 << 13)
103#define USB_STS_HC_HALTED_FLAG (1 << 12)
104#define USB_STS_IRQ_ASYNC_ADVANCE_FLAG (1 << 5)
105#define USB_STS_HOST_ERROR_FLAG (1 << 4)
106#define USB_STS_FRAME_ROLLOVER_FLAG (1 << 3)
107#define USB_STS_PORT_CHANGE_FLAG (1 << 2)
108#define USB_STS_ERR_IRQ_FLAG (1 << 1)
109#define USB_STS_IRQ_FLAG (1 << 0)
110
111 ioport32_t usbintr;
112#define USB_INTR_ASYNC_ADVANCE_FLAG (1 << 5)
113#define USB_INTR_HOST_ERR_FLAG (1 << 4)
114#define USB_INTR_FRAME_ROLLOVER_FLAG (1 << 3)
115#define USB_INTR_PORT_CHANGE_FLAG (1 << 2)
116#define USB_INTR_ERR_IRQ_FLAG (1 << 1)
117#define USB_INTR_IRQ_FLAG (1 << 0)
118
119 ioport32_t frindex;
120#define USB_FRINDEX_MASK 0xfff
121
122 ioport32_t ctrldssegment;
123 ioport32_t periodiclistbase;
124#define USB_PERIODIC_LIST_BASE_MASK 0xfffff000
125
126 ioport32_t asynclistaddr;
127#define USB_ASYNCLIST_MASK 0xfffffff0
128
129 PADD32[9];
130
131 ioport32_t configflag;
132#define USB_CONFIG_FLAG_FLAG (1 << 0)
133
134 ioport32_t portsc[];
135#define USB_PORTSC_WKOC_E_FLAG (1 << 22)
136#define USB_PORTSC_WKDSCNNT_E_FLAG (1 << 21)
137#define USB_PORTSC_WKCNNT_E_FLAG (1 << 20)
138#define USB_PORTSC_PORT_TEST_MASK (0xf << 16)
139#define USB_PORTSC_NO_TEST (0x0 << 16)
140#define USB_PORTSC_TEST_J_STATE (0x1 << 16)
141#define USB_PORTSC_TEST_K_STATE (0x2 << 16)
142#define USB_PORTSC_TEST_SE0_NAK (0x3 << 16)
143#define USB_PORTSC_TEST_PACKET (0x4 << 16)
144#define USB_PORTSC_TEST_FORCE_ENABLE (0x5 << 16)
145#define USB_PORTSC_INDICATOR_MASK (0x3 << 14)
146#define USB_PORTSC_INDICATOR_OFF (0x0 << 14)
147#define USB_PORTSC_INDICATOR_AMBER (0x1 << 14)
148#define USB_PORTSC_INDICATOR_GREEN (0x2 << 14)
149#define USB_PORTSC_PORT_OWNER_FLAG (1 << 13)
150#define USB_PORTSC_PORT_POWER_FLAG (1 << 12)
151#define USB_PORTSC_LINE_STATUS_MASK (0x3 << 10)
152#define USB_PORTSC_LINE_STATUS_SE0 (0x0 << 10)
153#define USB_PORTSC_LINE_STATUS_K (0x1 << 10)
154#define USB_PORTSC_LINE_STATUS_J (0x2 << 10)
155#define USB_PORTSC_PORT_RESET_FLAG (1 << 8)
156#define USB_PORTSC_SUSPEND_FLAG (1 << 7)
157#define USB_PORTSC_RESUME_FLAG (1 << 6)
158#define USB_PORTSC_OC_CHANGE_FLAG (1 << 5)
159#define USB_PORTSC_OC_ACTIVE_FLAG (1 << 4)
160#define USB_PORTSC_EN_CHANGE_FLAG (1 << 3)
161#define USB_PORTSC_ENABLED_FLAG (1 << 2)
162#define USB_PORTSC_CONNECT_CH_FLAG (1 << 1)
163#define USB_PORTSC_CONNECT_FLAG (1 << 0)
164
165#define USB_PORTSC_WC_MASK \
166 (USB_PORTSC_CONNECT_CH_FLAG | USB_PORTSC_EN_CHANGE_FLAG | USB_PORTSC_OC_CHANGE_FLAG)
167} ehci_regs_t;
168
169#endif
170/**
171 * @}
172 */
173
Note: See TracBrowser for help on using the repository browser.