XenevaOS
Loading...
Searching...
No Matches
dwhcidevice.h
Go to the documentation of this file.
1//
2// dwhcidevice.h
3//
4// USPi - An USB driver for Raspberry Pi written in C
5// Copyright (C) 2014-2018 R. Stange <rsta2@o2online.de>
6//
7// This program is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19//
20#ifndef _uspi_dwhcidevice_h
21#define _uspi_dwhcidevice_h
22
23#include "uspi/usb.h"
24#include "uspi/usbendpoint.h"
25#include "uspi/usbrequest.h"
26#include "uspi/dwhcirootport.h"
28#include "uspi/dwhciregister.h"
29#include "uspi/dwhci.h"
30#include "uspi/usb.h"
31#include "uspi/types.h"
32#include "uspios.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38typedef struct TDWHCIDevice
39{
40 unsigned m_nChannels;
41 volatile unsigned m_nChannelAllocated; // one bit per channel, set if allocated
42
44
45 volatile boolean m_bWaiting;
46
48}
50
51void DWHCIDevice (TDWHCIDevice *pThis);
52void _DWHCIDevice (TDWHCIDevice *pThis);
53
54boolean DWHCIDeviceInitialize (TDWHCIDevice *pThis);
55
56// returns resulting length or < 0 on failure
58 unsigned char ucType, unsigned char ucIndex,
59 void *pBuffer, unsigned nBufSize,
60 unsigned char ucRequestType /* = REQUEST_IN */);
61
62boolean DWHCIDeviceSetAddress (TDWHCIDevice *pThis, TUSBEndpoint *pEndpoint, u8 ucDeviceAddress);
63
64boolean DWHCIDeviceSetConfiguration (TDWHCIDevice *pThis, TUSBEndpoint *pEndpoint, u8 ucConfigurationValue);
65
66// returns resulting length or < 0 on failure
68 u8 ucRequestType, u8 ucRequest, u16 usValue, u16 usIndex,
69 void *pData, u16 usDataSize);
70
71// returns resulting length or < 0 on failure
72int DWHCIDeviceTransfer (TDWHCIDevice *pThis, TUSBEndpoint *pEndpoint, void *pBuffer, unsigned nBufSize);
73
76
80
81#ifdef __cplusplus
82}
83#endif
84
85#endif
TUSBSpeed
Definition usb.h:43
#define DWHCI_MAX_CHANNELS
Definition dwhci.h:29
boolean DWHCIDeviceSubmitAsyncRequest(TDWHCIDevice *pThis, TUSBRequest *pURB)
Definition dwhcidevice.c:337
int DWHCIDeviceControlMessage(TDWHCIDevice *pThis, TUSBEndpoint *pEndpoint, u8 ucRequestType, u8 ucRequest, u16 usValue, u16 usIndex, void *pData, u16 usDataSize)
Definition dwhcidevice.c:225
boolean DWHCIDeviceSetConfiguration(TDWHCIDevice *pThis, TUSBEndpoint *pEndpoint, u8 ucConfigurationValue)
Definition dwhcidevice.c:212
void DWHCIDevice(TDWHCIDevice *pThis)
Definition dwhcidevice.c:94
boolean DWHCIDeviceSetAddress(TDWHCIDevice *pThis, TUSBEndpoint *pEndpoint, u8 ucDeviceAddress)
Definition dwhcidevice.c:198
boolean DWHCIDeviceInitialize(TDWHCIDevice *pThis)
Definition dwhcidevice.c:109
int DWHCIDeviceGetDescriptor(TDWHCIDevice *pThis, TUSBEndpoint *pEndpoint, unsigned char ucType, unsigned char ucIndex, void *pBuffer, unsigned nBufSize, unsigned char ucRequestType)
Definition dwhcidevice.c:185
int DWHCIDeviceTransfer(TDWHCIDevice *pThis, TUSBEndpoint *pEndpoint, void *pBuffer, unsigned nBufSize)
Definition dwhcidevice.c:255
boolean DWHCIDeviceOvercurrentDetected(TDWHCIDevice *pThis)
Definition dwhcidevice.c:1348
TUSBSpeed DWHCIDeviceGetPortSpeed(TDWHCIDevice *pThis)
Definition dwhcidevice.c:1316
boolean DWHCIDeviceSubmitBlockingRequest(TDWHCIDevice *pThis, TUSBRequest *pURB)
Definition dwhcidevice.c:274
void _DWHCIDevice(TDWHCIDevice *pThis)
Definition dwhcidevice.c:104
void DWHCIDeviceDisableRootPort(TDWHCIDevice *pThis)
Definition dwhcidevice.c:1367
uint8_t u8
Definition kernel.h:20
uint16_t u16
Definition kernel.h:21
Definition dwhcidevice.h:39
unsigned m_nChannels
Definition dwhcidevice.h:40
TDWHCITransferStageData m_StageData[DWHCI_MAX_CHANNELS]
Definition dwhcidevice.h:43
volatile boolean m_bWaiting
Definition dwhcidevice.h:45
volatile unsigned m_nChannelAllocated
Definition dwhcidevice.h:41
TDWHCIRootPort m_RootPort
Definition dwhcidevice.h:47
Definition dwhcirootport.h:33
Definition dwhcixferstagedata.h:39
Definition usbendpoint.h:41
Definition usbrequest.h:36