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

📄 pcmciabridge.h

📁 Microsoft WinCE 6.0 BSP FINAL release source code for use with the i.MX27ADS TO2 WCE600_FINAL_MX27_S
💻 H
字号:
/*
 *
 * Copyright (C) 2003-2004, MOTOROLA, INC. All Rights Reserved
 * THIS SOURCE CODE IS CONFIDENTIAL AND PROPRIETARY AND MAY NOT
 * BE USED OR DISTRIBUTED WITHOUT THE WRITTEN PERMISSION OF
 * MOTOROLA, INC.
 *
 * Copyright (C) 2004-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 
 *
 */
 
#ifndef __PCMCIABRIDGE_H_
#define __PCMCIABRIDGE_H_

/*+Public include files******************************************************
 Include any files to export any inherited data type *necessary* needed by 
 client to use the services of this module.  Files which are included for
 internal use within this module should be done in a later section, and should
 *not* be exported un-necessarily.
**************************************************************************-*/
#include <windows.h>

#include <types.h>
#include <cardsv2.h>
#include <socksv2.h>
#include <memory.h>
#include <ceddk.h>

#include "CRegEdit.h"
#include "CRefCon.h"
#include "CMThread.h"
#include "resource.h"

#include <PcmciaCardLib.h>
#include <PcmciaCardLibEx.h>


/*+Public Macro definitions**************************************************
 Define all public macros or macros to be used only within the module for 
 bootstapping the definitions of other items
**************************************************************************-*/
#define NUM_SLOTS 					1

/*+Public Type definitions***************************************************
 Define all types which will be exported from this module.  Type definitions
 to be used within the module should be defined in the later section.
**************************************************************************-*/


class CPcmciaBusBridge;
class CPcmciaSocket;


class CPcmciaBusBridge : public CPCCardBusBridgeBase,
				public CStaticContainer <CPcmciaSocket, NUM_SLOTS>,
				public CRefObject,
				public CMiniThread
{
public:
	
    CPcmciaBusBridge( LPCTSTR RegPath );
    ~CPcmciaBusBridge( void );
    BOOL	Init();
    BOOL	NeedPowerResuming();
    void	PowerCycleEvent( );
    void    CardInjectEvent( );

    CPcmciaSocket* ObjectBySocket( HANDLE hSocket );

    void    CallBackToCardService( HANDLE hSocket,
                                   PSS_SOCKET_STATE pSocketState );

    DWORD GetClientSysInt()
    {
        return m_dwClientSysIntr;
    }

    DWORD GetClientIrq()
    {
        return m_dwClientIrq;
    }

    BOOL LockOwner( DWORD dwTimeout = INFINITE )
    {
        return m_OwnerLock.Lock( dwTimeout );
    };

    BOOL ReleaseOwner()
    {
        return m_OwnerLock.Unlock();
    };

    BOOL	IsPollingMode(){ return m_fPollingMode; };
	
    void                            PowerManager( BOOL bPowerDown );
    virtual void                        SetPccPower(UINT8 fVCC, BOOL bInPowerMode) = 0;

private:
     CMuTexObject 					m_OwnerLock;
    BOOL                            m_fPollingMode;

    UINT                            m_uPriority; 		// IST Thread Priority.

    DWORD                           m_dwClientIrq; 			// Client Interrupt IRQ.
    DWORD                           m_dwClientSysIntr; 		// Client Interrupt ID
    DWORD                           m_dwCSCSysIntr;	// CSC Interrupt ID
    DWORD                           m_dwCSCIrq; 		// CSC Interrupt IRQ

    HANDLE                         	m_hISTEvent;
    DWORD                          	m_dwPollTimeout;
    BOOL                            m_fPowerCycleEvent;
    BOOL                            m_fCardInjectEvent;
    CPcmciaSocket*      			m_pCardSocket;
    UINT16                          m_uSocketNum;

    BOOL                            m_bTerminated; 	// IST Thread Control
    static const SS_SOCKET_SERVICE  MX27SocketServiceStatic;


    virtual DWORD                	ThreadRun(); 		// IST
	CPcmciaSocket* 					CreatePCMCIASocket();
    void                            InsertPcmciaCardSocket( CPcmciaSocket* pSocket);
    void                            RemovePcmciaCardSocket(  );

    BOOL                            InstallIsr();
    BOOL                            InitCardBusBridge( void );
    void                             ProcessCDD( DWORD dwPStateReg );
    DWORD                          	GetRegistryConfig();
    BOOL                            GetSocketNumberFromCardService(BOOL bGet );
    virtual BOOL			InitGpio(void) = 0;
    virtual void			DeinitGpio(void) = 0;
#if (MX21_TO_VER >= 20)
    virtual void                        SetPoeBit(BOOL bInPowerMode, UINT8 val) = 0;
#endif
};

CPcmciaBusBridge* CreatePCCardBusBridge( LPCTSTR pwszInfo );

/*+Local include files*******************************************************
 Include all files that will be used only within this module here. 
**************************************************************************-*/
#ifdef __PCMCIABRIDGE_CPP__

#include "pcmciasock.h"
#include "socket.h"
#include "pddmain.h"

#include "csp.h"

/*-------------------------- Local context - START ---------------------------*/
	#define VISIBLE             /* Mark as LOCAL context */

	/*+Local Macro definitions***************************************************
	 Define all macros that will only be used within the module here.
	**************************************************************************-*/


	/*+Local function prototypes*************************************************
	 Declare all proto-types for functions/procedures only used within the module.
	**************************************************************************-*/

	/*+Local data declarations***************************************************
	 Define all data objects that will used within the module here.
	**************************************************************************-*/

/*-------------------------- Local context - END ---------------------------*/

// Special Registry Value for this drivers.
#define RegPriority256 						TEXT("Priority256")
#define RegPowerOption 						TEXT("RegPowerOption")

#define FORCE_CLIENT_SYSINTR_NAME 			TEXT("ForceClientSysIntr")

#define CLIENT_IRQ_VALUE_NAME 				TEXT("ClientIrq")
#define CLIENT_SYSINTR_VALUE_NAME 			TEXT("ClientSysIntr")
#define CSC_IRQ_VALUE_NAME 					TEXT("CSCIrq")
#define CSC_SYSINTR_VALUE_NAME 				TEXT("CSCSysIntr")
#define POLL_TIMEOUT_NAME 					TEXT("PollTimeout")
#define POLLING_MODE_NAME 					TEXT("PollingMode")

#define DEFAULT_PRIORITY 					101

const SS_SOCKET_SERVICE CPcmciaBusBridge::MX27SocketServiceStatic =
{
    0,// 
    PDCardInquireSocket,
    PDCardGetSocket,
    PDCardSetSocket,
    PDCardResetSocket,
    PDCardInquireWindow,
    PDCardGetWindow,
    PDCardSetWindow,
    PDCardAccessMemory,
    PDGetPowerEntry,
    NULL, // No need to support Translate Bus address.
    NULL  // No need to support Translate System Address.

};

#else // !__PCMCIABRIDGE_CPP__
#define VISIBLE extern      /* Mark as GLOBAL context */
#endif //__PCMCIABRIDGE_CPP__

/*------------------------- Global context - START -------------------------*/

/*+Public data declarations**************************************************
 Define all data objects that will be exported here.
**************************************************************************-*/


/*+Public function prototypes************************************************
 Define all proto-types for public functions/procedures here.
**************************************************************************-*/


/*-------------------------- Global context - END --------------------------*/
#undef VISIBLE

#endif

⌨️ 快捷键说明

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