📄 ms2_usbfn.cpp
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Module Name:
ms2_usbfn.cpp
Abstract:
Bulverde USB Function Driver.
--*/
#include <windows.h>
#include <ceddk.h>
#include <ddkreg.h>
#include <nkintr.h> // needed for SYSINTR_NOP
#include <bulverde.h>
#include <xllp_gpio.h>
#include <bul_usbfn.h>
#include <mainstoneii.h>
//#include <xllp_bcr.h>
class MS2UsbDevice: public BulUsbDevice {
public:
MS2UsbDevice(LPCTSTR lpActivePath)
: BulUsbDevice(lpActivePath)
{
// m_pBCRReg = NULL;
}
virtual ~MS2UsbDevice() {
// if (m_pBCRReg)
// MmUnmapIoSpace(m_pBCRReg,0);
}
virtual DWORD Init(PVOID pvMddContext,PUFN_MDD_INTERFACE_INFO pMddInterfaceInfo, PUFN_PDD_INTERFACE_INFO pPddInterfaceInfo)
{
DWORD dwReturn = ERROR_INVALID_DATA;
/* if (m_pBCRReg==NULL) {
PHYSICAL_ADDRESS ioPhysicalBase = { MAINSTONEII_BASE_REG_PA_FPGA, 0 };
m_pBCRReg =(PMAINSTONEII_BLR_REGS) MmMapIoSpace(ioPhysicalBase, sizeof(MAINSTONEII_BLR_REGS),FALSE) ;
}*/
// if (m_pBCRReg) {
dwReturn = BulUsbDevice::Init(pvMddContext, pMddInterfaceInfo, pPddInterfaceInfo);
// }
return dwReturn;
}
virtual DWORD Start() {
DWORD dwReturn = BulUsbDevice::Start();
if (dwReturn == ERROR_SUCCESS) {
//Enable UDC Soft Connect
// m_pBCRReg->misc_wr2 &= ~XLLP_BCR_MISCWR2_NUSBC_SC;
}
return dwReturn;
}
virtual DWORD Stop() {
DWORD dwReturn = BulUsbDevice::Stop();
if (dwReturn == ERROR_SUCCESS) {
//Enable UDC Soft Connect
//m_pBCRReg->MISCWR2 &= ~XLLP_BCR_MISCWR2_NUSBC_SC;
// m_pBCRReg->misc_wr2 |= XLLP_BCR_MISCWR2_NUSBC_SC;
}
return dwReturn;
}
virtual BOOL IsCableAttached() {
// return ((m_pBCRReg->misc_rd & XLLP_BCR_MISCRR1_USB_CBL)!=0);
return FALSE;
};
protected:
virtual void PowerMgr(BOOL bOff) {
if (bOff) {
// m_pBCRReg->misc_wr2 |= XLLP_BCR_MISCWR2_NUSBC_SC;
}
// We don't need to do software connect here because, IST will call Start to get it reconnected.
BulUsbDevice::PowerMgr(bOff);
}
private:
// volatile PMAINSTONEII_BLR_REGS m_pBCRReg;
};
BulUsbDevice * CreateBulUsbDevice(LPCTSTR lpActivePath)
{
return new MS2UsbDevice(lpActivePath);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -