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

📄 atapiromi.h

📁 三星ARM9系列CPU S3C2440A的WINCE 5.0下的BSP
💻 H
字号:
//
// 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.
//

/*++

Module Name:
    atapipci.h

Abstract:
    ATA/ATAPI for 2440 Ref Board.

Revision History:

--*/

#ifndef _ATAPIROMI_H_
#define _ATAPIROMI_H_

#include <atamain.h>
#include <s3c2440a.h>
#include "s3c2440a_base_regs.h"

// Config port undo flags
#define CP_CLNUP_IRQEVENT    1
#define CP_CLNUP_HEVENT      2
#define CP_CLNUP_INTCHNHDNLR 4
#define CP_CLNUP_IST         8
#define ISTFLG_EXIT          1


class CRomiDisk : public CDisk {
  public:

    // member variables
    static LONG  m_lDeviceCount;
    HANDLE m_hIsr; // handle to ISR



    // (DMA support)
    LPBYTE       m_pStartMemory;
    PDMATable    m_pPRD;
    PPhysTable   m_pPhysList;
    PSGCopyTable m_pSGCopy;
    PDWORD       m_pPFNs;
    DWORD        m_dwSGCount;
    DWORD        m_pPRDPhys;
    DWORD        m_dwPhysCount;
    DWORD        m_dwPRDSize;
    LPBYTE       m_pBMCommand;

    volatile S3C2440A_IOPORT_REG* m_vpIOPRegs;
    volatile S3C2440A_MEMCTRL_REG* m_vpMEMRegs;



    // constructors/destructors
    CRomiDisk(HKEY hKey);
    virtual ~CRomiDisk();

    // member functions
    virtual VOID ConfigureRegisterBlock(DWORD dwStride);
    virtual BOOL Init(HKEY hActiveKey);
    virtual DWORD MainIoctl(PIOREQ pIOReq);
    // virtual void TakeCS();
    // virtual void ReleaseCS();
    virtual BOOL WaitForInterrupt(DWORD dwTimeOut);
    virtual void EnableInterrupt();
    virtual BOOL ConfigPort();
    virtual BOOL SetupDMA(PSG_BUF pSgBuf, DWORD dwSgCount, BOOL fRead);
    virtual BOOL BeginDMA(BOOL fRead);
    virtual BOOL EndDMA();
    virtual BOOL AbortDMA();
    virtual BOOL CompleteDMA(PSG_BUF pSgBuf, DWORD dwSgCount, BOOL fRead);
    virtual BOOL WakeUp();
    
    void FreeDMABuffers();
    void CopyDiskInfoFromPort();
    BOOL TranslateAddress(PDWORD pdwAddr);
    virtual CDiskPower *GetDiskPowerInterface(void);



    inline virtual void CRomiDisk::TakeCS() {
        m_pPort->TakeCS();
    }
    inline virtual void CRomiDisk::ReleaseCS() {
        m_pPort->ReleaseCS();
    }
    inline void CRomiDisk::WriteBMCommand(BYTE bCommand) {
        ATA_WRITE_BYTE(m_pBMCommand, bCommand);
    }
    inline BYTE CRomiDisk::ReadBMStatus() {
        return ATA_READ_BYTE(m_pBMCommand + 2);
    }
    inline void CRomiDisk::WriteBMTable(DWORD dwPhys) {
        ATA_WRITE_DWORD((LPDWORD)(m_pBMCommand + 4), dwPhys);
    }
    inline void CRomiDisk::WriteBMStatus(BYTE bStatus) {
        ATA_WRITE_BYTE(m_pBMCommand + 2, bStatus);
    }
    inline BOOL CRomiDisk::DoesDeviceAlreadyExist() {
        return FALSE;
    }

};

#endif //_ATAPIPCI_H_

⌨️ 快捷键说明

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