📄 pdsocket.h
字号:
//
// Copyright(C) Renesas Technology Corp. 2005. All rights reserved.
//
// PCCARD driver for ITS-DS7
//
// FILE : pdsocket.h
// CREATED : 2005.02.03
// MODIFIED :
// AUTHOR : Renesas Technology Corp.
// HARDWARE : RENESAS ITS-DS7
// HISTORY :
// 2005.02.03
// - Created release code.
// (based on PCCARD driver for ASPEN for WCE5.0)
//
// 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.
//
/*++
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:
--*/
#ifndef __PDSOCKET_H_
#define __PDSOCKET_H_
#include "shx.h"
#include "ITS_DS7.h"
#include <pcmciapd.h>
#include "debug.h"
#include "CRegEdit.h"
#include "CRefCon.h"
#include "CMthread.h"
#include "resource.h"
#include <socksv2.h>
#include <PcmciaCardLib.h>
#include <drv_glob.h>
class CPCCardBusBridge;
class CPCardSocket;
#include <PcmciaCardLibEx.h>
typedef CStaticMemoryWindow<CPCardSocket> CPcmciaMemWindow;
typedef CStaticIOWindow<CPCardSocket> CPcmciaIoWindow;
#define SOCKETS_COUNT 2
#define PCMCIA_POWER_ENTRIES 4
enum PCMCIA_INTERRUPT_EVENT {
PCMCIA_INTERRUPT_NONE = 0,
PCMCIA_INTERRUPT_POWER,
PCMCIA_INTERRUPT_FORCE_EJECT
};
//
// Structure to track a physical socket
//
class CPCardSocket : public CPCMCIASocketBase<CStaticMemoryWindow<CPCardSocket>, CStaticIOWindow<CPCardSocket>, CStaticWindowBridgeContainer<CPCCardBusBridge>, CPCCardBusBridge>
{
public:
CPCardSocket( int nSlot, CPCCardBusBridge* pBriedge ) ;
virtual ~CPCardSocket() ;
virtual void SocketEventHandle( int nSlot, WORD wStateChange, WORD wState, PCMCIA_INTERRUPT_EVENT otherEvent ); // Event Handle from Interrupt.
// Socket
virtual STATUS CardInquireSocket( PSS_SOCKET_INFO pSocketInfo ) ;
virtual STATUS CardGetSocket( PSS_SOCKET_STATE pState );
virtual STATUS CardSetSocket( PSS_SOCKET_STATE pState );
virtual STATUS CardResetSocket();
virtual BOOL IsCardBusCard()
{
return FALSE ;
};
virtual STATUS GetPowerEntry( PDWORD pdwNumOfEnery,
PSS_POWER_ENTRY pPowerEntry );
virtual STATUS CardAccessMemory( PSS_MEMORY_ACCESS /*pMemoryAccess*/ )
{
DEBUGCHK( FALSE );
return CERR_UNSUPPORTED_SERVICE;
}
// Power Down and Up
virtual void PowerMgr( BOOL bPowerDown );
virtual BOOL Resuming();
HANDLE GetSocketHandle()
{
return ( HANDLE ) m_dwSocketIndex;
};
UINT16 GetSocketNumber();
BOOL EnableWindow();
protected:
DWORD m_dwSocketIndex;
private:
int m_nSlot;
static DWORD sdwSocketLastIndex;
SS_SOCKET_STATE m_SockState;
SS_SOCKET_INFO mss_PcmciaSocketInfo;
BOOL m_bResuming ;
static const SS_SOCKET_STATE ms_SockInitState;
static const SS_SOCKET_INFO ms_PcmciaSocketInfo;
void PowerOnProcedure( UINT8 fVcc, UINT8 fVpp );
void PowerMgrCallback( BOOL bPowerOff );
};
class CPCCardBusBridge : public CPCCardBusBridgeBase,
public CRefObject,
public CLockObject,
public CMiniThread
{
public:
// Socket Contructor and De-Constructor
CPCCardBusBridge( LPCTSTR RegPath );
virtual ~CPCCardBusBridge( void );
BOOL Init();
// Socket Info.
UINT16 GetSocketNumber( int nSlot )
{
return m_rguSocketNum[nSlot];
}
BOOL SetInterruptEvent( int nSlot, PCMCIA_INTERRUPT_EVENT pcmIntrEvent );
BOOL GetRegPowerOption( PDWORD pOption )
{
return m_dwPowerOption;
}
BOOL IsCardInserted( int nSlot );
BOOL IsCardReady( int nSlot );
// Socket Power Handle
void PowerMgr( BOOL bPowerDown );
BOOL SetupWakeupSource( BOOL bSet );
BOOL ApplyPower( int nSlot, DWORD dwVccPowerLevel, DWORD dwVppPowerLevel );
BOOL ApplyReset( int nSlot,BOOL fReset );
BOOL ApplyEnable(int nSlot, BOOL fEnable ) ;
UINT8 GetVSPinOut( int nSlot );
DWORD GetCardType( int nSlot );
void SetCardType( int nSlot, DWORD dwInterface );
BOOL IsValidPowerSetting( DWORD dwVcc, DWORD dwVpp );
BOOL NeedPowerResuming();
// Client Interrupt Handle
void EnableClientInterrupt( int nSlot, BOOL bEnable );
BOOL SetupClientWakeupSource( int nSlot, BOOL bSet );
// Lock Entire hardware
DWORD GetClientInterrupt( int nSlot )
{
return m_rgdwFunctionSysIntr[nSlot];
}
// Interface to CardServices.
void CallBackToCardService( int nSlot, HANDLE hSocket,
PSS_SOCKET_STATE pSocketState );
BOOL GetSocketNumberFromCS( int nSlot, BOOL bGet );
BOOL EnableWindow( int nSlot );
protected:
UINT m_uPriority; // IST Thread Priority.
virtual DWORD ThreadRun(); // IST
void InsertPCardSocket( int nSlot, CPCardSocket* pSocket );
void RemovePCardSocket( int nSlot );
// IST & ISR
HANDLE m_hISTEvent;
CPCardSocket* m_rgpCardSocket[NUM_SLOTS];
BOOL bTerminated; // IST Thread Control
BOOL m_ResumeFlag;
DWORD m_dwPowerOption;
PCMCIA_INTERRUPT_EVENT m_rgPcmciaInterruptEvents[ NUM_SLOTS ];
void EnableCSCInterrupts( BOOL bEnable );
BOOL NeedReinitAfterPowerDown()
{
return FALSE;
};
// PCMCIA registers
PCMCIA_REGISTER_LAYOUT m_rgPcmciaRegisters[NUM_SLOTS];
PDRIVER_GLOBALS m_pDriverGlobals;
PVBYTE m_pPerFPGABase;
// Service Table
static const SS_SOCKET_SERVICE MRSHPCSocketServicStatic;
// Socket IDs assigned by the Socket Services
UINT16 m_rguSocketNum[NUM_SLOTS];
// Registry Info
BOOL loadRequiredRegEntry();
// interrupt SYSINTR values
DWORD m_dwCSCSysIntr;
DWORD m_rgdwFunctionSysIntr[NUM_SLOTS];
// Operation
BOOL MapHardware();
#ifdef DEBUG
void PrintRegisters(int uSocket);
#endif
public:
// power entries
static const SS_POWER_ENTRY cs_rgPowerEntries[PCMCIA_POWER_ENTRIES];
static const POWER_REGISTER_VALUES cs_rgrgPowerSetting[NUM_SLOTS][PCMCIA_POWER_ENTRIES][PCMCIA_POWER_ENTRIES];
};
CPCardSocket* CreatePCMCIASocket( int nSlot, CPCCardBusBridge* pBridge );
CPCardSocket* GetSocket( HANDLE hSocket );
CPCCardBusBridge* CreatePCCardBusBridge( LPCTSTR pszInfo );
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -