⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bsppcc_mx27.cpp

📁 mx27 f14v2 源代码。包括ADS板上诸多驱动的源码。
💻 CPP
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
//------------------------------------------------------------------------------
//
// Copyright (C) 2006, Freescale Semiconductor, Inc. All Rights Reserved.
// THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
// AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT 
//
//------------------------------------------------------------------------------
 
/*++
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:  

Abstract:

    Platform dependent PCMCIA initialization functions

Notes: 
--*/

#include <windows.h>
#include <ceddk.h>

#include "bsp.h"
#include "socksv2.h"
#include "socket.h"
#include "pcmciabridge.h"

static PCSP_PBC_REGS g_pPBC = NULL;

class BSPCPcmciaBusBridge : public CPcmciaBusBridge
{
public:
    BSPCPcmciaBusBridge( LPCTSTR RegPath );
    ~BSPCPcmciaBusBridge( void );
    
    virtual void   SetPccPower(UINT8 fVCC, BOOL bInPowerMode);

protected:
    virtual BOOL   InitGpio(void);
    virtual void   DeinitGpio(void);
    
#if (MX21_TO_VER >= 20)
    virtual void   SetPoeBit(BOOL bInPowerMode, UINT8 val);
#endif
};

BSPCPcmciaBusBridge::BSPCPcmciaBusBridge( LPCTSTR RegPath )
                 :CPcmciaBusBridge(RegPath)
{
}

BSPCPcmciaBusBridge::~BSPCPcmciaBusBridge()              
{
}

//
// Initialize GPIO pins for PCMCIA
//
BOOL BSPCPcmciaBusBridge::InitGpio(void)
{
	DDK_GPIO_CFG	ioctl;
       PHYSICAL_ADDRESS phyAddr_pbc;
	
	//CPLD registers
	phyAddr_pbc.QuadPart = BSP_BASE_REG_PA_PBC_BASE;
	g_pPBC = (PCSP_PBC_REGS) MmMapIoSpace(phyAddr_pbc, sizeof(CSP_PBC_REGS), FALSE);

	// Enable PCMCIA module pins
	DDK_GPIO_SET_CONFIG (ioctl, PCMCIA);
	if (DDKGpioEnable(&ioctl) != TRUE)
		return FALSE;
	
	OUTREG16(&g_pPBC->BCTRL2_SET, CSP_BITFMASK(PBC_BCTRL2_VPP_EN));
	OUTREG16(&g_pPBC->BCTRL2_SET, CSP_BITFMASK(PBC_BCTRL2_VCC_EN));

	return TRUE;
}

//
// Set the PCCARD Power Supply
//
void   BSPCPcmciaBusBridge::SetPccPower(UINT8 fVCC, BOOL bInPowerMode)
{
	UINT8 voltage = fVCC;
	
	switch( voltage ) {
		case 0:
			if (bInPowerMode)
			{
				// Set to 0V Voltage
				OUTREG16(&g_pPBC->BCTRL2_CLEAR, CSP_BITFMASK(PBC_BCTRL2_VPP_EN));
				OUTREG16(&g_pPBC->BCTRL2_CLEAR, CSP_BITFMASK(PBC_BCTRL2_VCC_EN));
			}
			break;			
		case 33:
			// Set to 3.3V Voltage
		case 50:
			// Set to 5.0V Voltage - PBC supports only 3.3V
			OUTREG16(&g_pPBC->BCTRL2_SET, CSP_BITFMASK(PBC_BCTRL2_VPP_EN));
			OUTREG16(&g_pPBC->BCTRL2_SET, CSP_BITFMASK(PBC_BCTRL2_VCC_EN));
			break;
		
		default:
			break;
	}
}

//
// Set POE_B for PCMCIA
//
#if (MX21_TO_VER >= 20)
void   BSPCPcmciaBusBridge::SetPoeBit(BOOL bInPowerMode, UINT8 val)
{
}
#endif

//
// Deinitialize GPIO pins for PCMCIA
//
void BSPCPcmciaBusBridge::DeinitGpio()
{
	DDK_GPIO_CFG ioctl;

	// Disable PCMCIA module pins
	DDK_GPIO_SET_CONFIG (ioctl, PCMCIA);
       DDKGpioDisable (&ioctl);

	OUTREG16(&g_pPBC->BCTRL2_CLEAR, CSP_BITFMASK(PBC_BCTRL2_VCC_EN));
	OUTREG16(&g_pPBC->BCTRL2_CLEAR, CSP_BITFMASK(PBC_BCTRL2_VPP_EN));

	if(g_pPBC) {
		MmUnmapIoSpace((void *)g_pPBC, sizeof(CSP_PBC_REGS));
		g_pPBC= NULL;
	}


}

// this function will be used to create a new instance of the bridge class
CPcmciaBusBridge* CreatePCCardBusBridge( LPCTSTR pwszInfo )
{
    return new BSPCPcmciaBusBridge( pwszInfo );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -