www.pudn.com > sdio-2.6.18-full.rar > sdio_memory.h


/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@file: function.h

@abstract: OS independent include memory card function driver

#notes:

@notice: Copyright (c), 2004-2005 Atheros Communications, Inc.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation;
 *
 *  Software distributed under the License is distributed on an "AS
 *  IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 *  implied. See the License for the specific language governing
 *  rights and limitations under the License.
 *
 *  Portions o this code were developed with information supplied from the
 *  SD Card Association Simplified Specifications. The following conditions and disclaimers may apply:
 *
 *   The following conditions apply to the release of the SD simplified specification (“Simplified
 *   Specification”) by the SD Card Association. The Simplified Specification is a subset of the complete
 *   SD Specification which is owned by the SD Card Association. This Simplified Specification is provided
 *   on a non-confidential basis subject to the disclaimers below. Any implementation of the Simplified
 *   Specification may require a license from the SD Card Association or other third parties.
 *   Disclaimers:
 *   The information contained in the Simplified Specification is presented only as a standard
 *   specification for SD Cards and SD Host/Ancillary products and is provided "AS-IS" without any
 *   representations or warranties of any kind. No responsibility is assumed by the SD Card Association for
 *   any damages, any infringements of patents or other right of the SD Card Association or any third
 *   parties, which may result from its use. No license is granted by implication, estoppel or otherwise
 *   under any patent or other rights of the SD Card Association or any third party. Nothing herein shall
 *   be construed as an obligation by the SD Card Association to disclose or distribute any technical
 *   information, know-how or other confidential information to any third party.
 *
 *
 *  The initial developers of the original code are Seung Yi and Paul Lever
 *
 *  sdio@atheros.com
 *
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#ifndef __SDIO_MEMORY_H___
#define __SDIO_MEMORY_H___

#include "sdio_memory_linux.h"

#define EXTENDED_DATA_SIZE 512
typedef struct _SDIO_MEMORY_INSTANCE {
    SDLIST         SDList;      /* link in the instance list */
    PSDDEVICE      pDevice;     /* bus driver's device we are supporting */
    SDMEMORY_CONFIG Config;     /* OS specific config  */
    UINT32         Size;        /* size of this card, in 1024 byte units*/
    UINT           FileSysBlockSize; /* block size used by file system */
    BOOL           WriteProtected; /* true if write protected */
    UINT           WriteBlockLength; /* length of writes */
    BOOL           PartialWritesAllowed; /* writes < WriteBlockLength OK */
    UINT           ReadBlockLength; /* length of reads */
    BOOL           PartialReadsAllowed; /* reads < ReadBlockLength OK */
    UINT           BlockSize;   /* read/write size based on above 4 parameters */
    UINT           MaxBlocksPerTransfer; /* maximum number of blocks per individual transfer */
    UINT8          ExtendedData[EXTENDED_DATA_SIZE]; /* store extended CSD and/or SD status block */
}SDIO_MEMORY_INSTANCE, *PSDIO_MEMORY_INSTANCE;

typedef struct _SDIO_MEMORY_CONTEXT {
    SDFUNCTION      Function;       /* function description for bus driver */
    SDMEMORY_DRIVER_CONFIG  Driver; /* OS specific driver wide configuration */
    OS_SEMAPHORE    InstanceSem;    /* instance lock */
    SDLIST          InstanceList;   /* list of instances */
}SDIO_MEMORY_CONTEXT, *PSDIO_MEMORY_CONTEXT;

#define SDDBG_DUMP (SDDBG_TRACE + 1)

void DeleteInstance(PSDIO_MEMORY_CONTEXT   pFuncContext,
                    PSDIO_MEMORY_INSTANCE  pInstance);
PSDIO_MEMORY_INSTANCE CreateDeviceInstance(PSDIO_MEMORY_CONTEXT pFuncContext,
                                           PSDDEVICE            pDevice);
PSDIO_MEMORY_INSTANCE GetFirstInstance(PSDIO_MEMORY_CONTEXT pFuncContext);
PSDIO_MEMORY_INSTANCE FindInstance(PSDIO_MEMORY_CONTEXT pFuncContext,
                                   PSDDEVICE            pDevice);
SDIO_STATUS AddDeviceInstance(PSDIO_MEMORY_CONTEXT  pFuncContext,
                              PSDIO_MEMORY_INSTANCE pInstance);
void CleanupFunctionContext(PSDIO_MEMORY_CONTEXT pFuncContext);
SDIO_STATUS InitFunctionContext(PSDIO_MEMORY_CONTEXT pFuncContext);
SDIO_STATUS MemoryTransfer(PSDIO_MEMORY_INSTANCE pInstance, SDSECTOR_SIZE sectorNumber,
                           ULONG sectorCount, PUCHAR pBuffer, BOOL WriteDirection);
SDIO_STATUS GetCardCSD(PSDDEVICE pDevice, PSDIO_MEMORY_INSTANCE pInstance, BOOL IsMmcCardType);
SDIO_STATUS IssueAsyncTransfer(PSDDEVICE        pDevice,
                            PSDIO_MEMORY_INSTANCE pInstance,
                            UINT32           Address,
                            UINT32           Length,
                            BOOL             Write,
                            PVOID            pBufferOrSGList,
                            UINT             SGcount,
                            void (*pCompletion)(struct _SDREQUEST *pRequest),
                            PVOID            pContext);

#endif /* __SDIO_MEMORY_H___*/