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

📄 atadisk.h

📁 smdk2443_wince50 embedd
💻 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 FALSEt accept the terms of the EULA, you are FALSEt authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*++
Copyright (c) 1999-2000 SanDisk Corporation

Module Name:
    sddisk.h

Abstract:
    This module contains the function prototypes and constant, type,
    global data and structure definitions for the WINCE Secured Digital
    and Multimedia card driver.

--*/


#ifndef _ATADISK_H_
#define _ATADISK_H_

#ifdef __cplusplus
extern "C" {
#endif

#include "atapi.h"
#include <Diskio.h>
#include "s3c2443.h"
#include "defines.h"


/*
#define DISK_IO_TIME_OUT 10000
#define REQUEST_TIME_OUT 30000
#define BYTES_PER_SECTOR 512


// (The other registers are defined in atapi.h)
*/

#define READING 1
#define WRITING 2

#define STATE_INITING 1
#define STATE_CLOSED  2
#define STATE_OPENED  3
#define STATE_DEAD    4    // Power down
#define STATE_REMOVED 5    // Power down


#define BYTES_PER_SECTOR 512

  typedef unsigned short * USERADDRESS;

//
// Structure to keep track of a disk
//

typedef struct drive_desc
{
    ULONG       total_lba;
    UINT16      num_heads;
    UINT16      sec_p_track;
    UINT16      num_cylinders;
    UINT16      block_size;
    UINT16      features;           /* BIT0 = LBA, BIT1 = Wide bus */
 } DRIVE_DESC, *PDRIVE_DESC;
typedef struct drive_control
{
    /* Geometry of the drives */
    PDRIVE_DESC drive;
    USERADDRESS user_address;/* Pointer address of the user's buffer */

    /* Address of the controller in memory or IO mode */
    UINT16 register_file_address;

    int command_complete;  /* Set when operation is complete */
//    UINT16 opencount;
//    INT16 interrupt_number; /* -1 if FALSEt being used */
//    COUNT controller_number;

    UINT16 error_code;      /* Set if an error occured - This is 
                   the error reported to the user.
                */
    UINT16 timer;           /* Command fails if this much time elapsed */
    UINT16 block_size;      /* Block size for read/write multiple cmds */
    UCOUNT sectors_remaining;/* Sectors remaining for read/write mult */
    INT16 drive_active;     /* Current active drive */
        UINT16 mode;            /* Single or multiple transfer */
        UINT16 currentState;    /* Current MMC state */
        UINT16 mmcRdyState;     /* Card BUSY/READY state */
    UINT16 tempData;
        UINT16 LastResponse[8]; /* Response data */
        UINT32 mmcStatus;       /* Card status */
} DEVICE_CONTROLLER, *PDEVICE_CONTROLLER;

typedef struct _DISK {
    struct _DISK * d_next;
    CRITICAL_SECTION d_DiskCardCrit;// guard access to global state and card
    DWORD d_DrvFALSE;    
    DWORD d_DiskCardState;
    DISK_INFO d_DiskInfo;    // for DISK_IOCTL_GET/SETINFOs
    int  d_fLBAMode;        // TRUE => logical block addressing supported
    DWORD d_OpenCount;       // open ref count
    LPWSTR d_ActivePath;     // Active key registry path
} DISK, * PDISK; 


// 
// Global Variables
//
extern DWORD v_MemGran;                // memory granularity (usually 1)
extern CRITICAL_SECTION v_DiskCrit;    // guard access to disk structure list
extern PDISK v_DiskList;

//
// Global functions
//
extern void  CloseDisk(PDISK pDisk);
extern DWORD DoDiskIO(PDISK pDisk, DWORD Opcode, PSG_REQ pSG);
extern DWORD GetDiskInfo(PDISK pDisk, PDISK_INFO pInfo);
extern DWORD SetDiskInfo(PDISK pDisk, PDISK_INFO pInfo);
extern DWORD InitDisk(PDISK pDisk);
extern int IsValidDisk(PDISK pDisk);
extern DWORD GetDiskStateError(DWORD DiskState);

#ifdef DEBUG
//
// Debug zones
//
#define ZONE_ERROR      DEBUGZONE(0)
//#define ZONE_WARNING    DEBUGZONE(1)
#define ZONE_FUNCTION   DEBUGZONE(2)
//#define ZONE_INIT       DEBUGZONE(3)
#define ZONE_IO         DEBUGZONE(5)
#define ZONE_INIT         DEBUGZONE(5)
#define ZONE_WARNING         DEBUGZONE(5)

#endif  // DEBUG

#ifdef __cplusplus
}
#endif

#endif // _ATADISK_H_


⌨️ 快捷键说明

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