XenevaOS
Loading...
Searching...
No Matches
smsc951x.h
Go to the documentation of this file.
1//
2// smsc951x.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_smsc951x_h
21#define _uspi_smsc951x_h
22
23#include "uspi/usbfunction.h"
24#include "uspi/usbendpoint.h"
25#include "uspi/usbrequest.h"
26#include "uspi/macaddress.h"
27#include "uspi/types.h"
28
29#define FRAME_BUFFER_SIZE 1600
30
43
44void SMSC951xDevice (TSMSC951xDevice *pThis, TUSBFunction *pFunction);
46
47boolean SMSC951xDeviceConfigure (TUSBFunction *pUSBFunction);
48
50
51boolean SMSC951xDeviceSendFrame (TSMSC951xDevice *pThis, const void *pBuffer, unsigned nLength);
52
53// pBuffer must have size FRAME_BUFFER_SIZE
54boolean SMSC951xDeviceReceiveFrame (TSMSC951xDevice *pThis, void *pBuffer, unsigned *pResultLength);
55
56// returns TRUE if PHY link is up
58
59// private:
60boolean SMSC951xDevicePHYWrite (TSMSC951xDevice *pThis, u8 uchIndex, u16 usValue);
61boolean SMSC951xDevicePHYRead (TSMSC951xDevice *pThis, u8 uchIndex, u16 *pValue);
63
64boolean SMSC951xDeviceWriteReg (TSMSC951xDevice *pThis, u32 nIndex, u32 nValue);
65boolean SMSC951xDeviceReadReg (TSMSC951xDevice *pThis, u32 nIndex, u32 *pValue);
66
67#ifndef NDEBUG
68void SMSC951xDeviceDumpReg (TSMSC951xDevice *pThis, const char *pName, u32 nIndex);
70#endif
71
72#endif
uint8_t u8
Definition kernel.h:20
uint16_t u16
Definition kernel.h:21
uint32_t u32
Definition kernel.h:22
void _SMSC951xDevice(TSMSC951xDevice *pThis)
Definition smsc951x.c:150
boolean SMSC951xDevicePHYWrite(TSMSC951xDevice *pThis, u8 uchIndex, u16 usValue)
Definition smsc951x.c:406
boolean SMSC951xDeviceReadReg(TSMSC951xDevice *pThis, u32 nIndex, u32 *pValue)
Definition smsc951x.c:486
boolean SMSC951xDeviceSendFrame(TSMSC951xDevice *pThis, const void *pBuffer, unsigned nLength)
Definition smsc951x.c:316
TMACAddress * SMSC951xDeviceGetMACAddress(TSMSC951xDevice *pThis)
Definition smsc951x.c:309
void SMSC951xDevice(TSMSC951xDevice *pThis, TUSBFunction *pFunction)
Definition smsc951x.c:135
boolean SMSC951xDevicePHYRead(TSMSC951xDevice *pThis, u8 uchIndex, u16 *pValue)
Definition smsc951x.c:426
void SMSC951xDeviceDumpRegs(TSMSC951xDevice *pThis)
Definition smsc951x.c:513
boolean SMSC951xDevicePHYWaitNotBusy(TSMSC951xDevice *pThis)
Definition smsc951x.c:451
boolean SMSC951xDeviceConfigure(TUSBFunction *pUSBFunction)
Definition smsc951x.c:177
void SMSC951xDeviceDumpReg(TSMSC951xDevice *pThis, const char *pName, u32 nIndex)
Definition smsc951x.c:498
boolean SMSC951xDeviceWriteReg(TSMSC951xDevice *pThis, u32 nIndex, u32 nValue)
Definition smsc951x.c:476
boolean SMSC951xDeviceIsLinkUp(TSMSC951xDevice *pThis)
Definition smsc951x.c:393
boolean SMSC951xDeviceReceiveFrame(TSMSC951xDevice *pThis, void *pBuffer, unsigned *pResultLength)
Definition smsc951x.c:336
Definition macaddress.h:29
Definition smsc951x.h:32
TUSBEndpoint * m_pEndpointBulkOut
Definition smsc951x.h:36
TUSBEndpoint * m_pEndpointBulkIn
Definition smsc951x.h:35
u8 * m_pTxBuffer
Definition smsc951x.h:40
TMACAddress m_MACAddress
Definition smsc951x.h:38
TUSBFunction m_USBFunction
Definition smsc951x.h:33
Definition usbendpoint.h:41
Definition usbfunction.h:33