The Pedigree Project  0.1
UsbUlpi.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef USBULPI_H
21 #define USBULPI_H
22 
23 #include "pedigree/kernel/processor/MemoryRegion.h"
24 #include "pedigree/kernel/processor/types.h"
25 
26 class UsbUlpi
27 {
28  public:
29  UsbUlpi()
30  : m_MemRegionUHH("USB-UHH_CONFIG"), m_MemRegionTLL("USB-TLL"),
31  m_MemRegionPCtl("USB-PCTL")
32  {
33  }
34  virtual ~UsbUlpi()
35  {
36  }
37 
38  static UsbUlpi &instance()
39  {
40  return m_Instance;
41  }
42 
43  void initialise();
44 
45  private:
47 
48  enum UlpiRegisters
49  {
50  VendorIdLo = 0,
51  VendorIdHi = 1,
52  ProductIdLo = 2,
53  ProductIdHi = 3,
54  FunctionControl = 4,
55  InterfaceControl = 7,
56  OtgControl = 0xA,
57  UsbIntEnableRise = 0xD,
58  UsbIntEnableFall = 0x10,
59  UsbIntStatus = 0x13,
60  UsbIntLatch = 0x14,
61  Debug = 0x15,
62  Scratch = 0x16,
63  ExtendedSetAccess = 0x2F,
64  UtmiVControlEnable = 0x30,
65  UtmiVControlStatus = 0x33,
66  UtmiVControlLatch = 0x34,
67  UtmiVStatus = 0x35,
68  UtmiIntLatchNoClr = 0x38,
69  VendorIntEnable = 0x3B,
70  VendorIntStatus = 0x3E,
71  VendorIntLatch = 0x3F
72  };
73 
74  enum PowerManagement
75  {
76  VUSB1V5_DEV_GRP = 0xCC,
77  VUSB1V5_TYPE = 0xCD,
78  VUSB1V5_REMAP = 0xCE,
79 
80  VUSB1V8_DEV_GRP = 0xCF,
81  VUSB1V8_TYPE = 0xD0,
82  VUSB1V8_REMAP = 0xD1,
83 
84  VUSB3V1_DEV_GRP = 0xD2,
85  VUSB3V1_TYPE = 0xD3,
86  VUSB3V1_REMAP = 0xD4,
87 
88  VUSBCP_DEV_GRP = 0xD5,
89  VUSBCP_TYPE = 0xD6,
90  VUSBCP_REMAP = 0xD7,
91 
92  VUSB_DEDICATED1 = 0xD8,
93  VUSB_DEDICATED2 = 0xD9,
94  };
95 
96  MemoryRegion m_MemRegionUHH;
97  MemoryRegion m_MemRegionTLL;
98  MemoryRegion m_MemRegionPCtl;
99 };
100 
101 #endif
static UsbUlpi m_Instance
Definition: UsbUlpi.h:46
Special memory entity in the kernel's virtual address space.
Definition: MemoryRegion.h:35
void initialise()
Definition: UsbUlpi.cc:79