mmc.h

来自「包含了NXP众多的MCU的例子程序」· C头文件 代码 · 共 84 行

H
84
字号
/*************************************************************************
 *
 *    Used with ICCARM and AARM.
 *
 *    (c) Copyright IAR Systems 2003
 *
 *    File name   : mmc.h
 *    Description : define MMC module
 *
 *    History :
 *    1. Data        : July 1, 2005
 *       Author      : Stanimir Bonev
 *       Description : Create
 *
 *    $Revision: 1.2.2.1 $
**************************************************************************/

#include <includes.h>

#ifndef __MMC_H
#define __MMC_H

#ifdef MMC_GLOBAL
#define MMC_EXTERN
#else
#define MMC_EXTERN  extern
#endif

#define MMC_DISK_LUN  1
// Hardware depends definitions
#define IdentificationModeClock   400KHZ
#define PC_PCSPI1                 (1<<10)
#define PC_PCSPI0                 (1<<8)

// Time ote definition for SD Read Time out ~100msec, Write Time out ~250ms
#define SD_READ_TIME_OUT          7     // [Hz]
#define SD_WRITE_TIME_OUT         3     // [HZ]

//
#define MMC_OK              0x00
#define MMC_ILDE_STATE      0x01
#define MMC_ERASE_RST       0x02
#define MMC_ILLEGAL_CMD     0x04
#define MMC_CRC_ERROR       0x08
#define MMC_ERASE_ERROR     0x10
#define MMC_ADD_ERROR       0x20
#define MMC_PARAM_ERROR     0x40

#define MMC_DATA_TOLKEN     0xFE
#define MMC_DATA_ERR_TOLKEN 0x1F
#define MMC_STOP_TRAN       0xFD

#define MMC_DLY_1MSEC       1000

typedef enum
{
  MmcOk = 0, MmcNoPresent, MmcNoResponse, MmcCardError, MmcDataError,
  MmcUknowError, MmmcParameterError, MmcMiscompare
} MmcState_t;

typedef enum
{
  CMD0 = 0, // Resets the MultiMediaCard

  CMD1,     // Activates the card抯 initialization process

  CMD9,     // Asks the selected card to send its card-specific data (CSD)

  CMD10,    // Asks the selected card to send its card identification (CID)

  CMD12,    // Stop transmission on multiple block read

  CMD13,    // Asks the selected card to send its status register

  CMD16,    // Selects a block length (in bytes) for all following block commands (read and write)

  CMD17,    // Reads a block of the size selected by the SET_BLOCKLEN command

  CMD18,    // Continuously transfers data blocks from card to host
            // until interrupted by a Stop command or the requested number of data blocks transmitted

  CMD24,    // Writes a block of the size selected by the SET_BLOCKLEN command

  CMD25,    // Continuously writes blocks of data until a 慡top Tran

⌨️ 快捷键说明

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