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

📄 mmc_apiroutinetest.c

📁 5509 MMC in Native Mode
💻 C
字号:
/******************************************************************************\
*           Copyright (C) 2001 Texas Instruments Incorporated.
*                           All Rights Reserved
*------------------------------------------------------------------------------
* MODULE NAME... MMC
* FILENAME...... MMC_apiTest.c
* DATE CREATED.. Mon 09/18/2001
* PROJECT....... Chip Support Library
* COMPONENT..... 
* PREREQUISITS.. 
*------------------------------------------------------------------------------
* HISTORY:
*   09/18/2001  (IM) Created
*
*  
*------------------------------------------------------------------------------
* DESCRIPTION:  
*   
* This is a test that tests the MMC functions for Amadeus
\*----------------------------------------------------------------------*/

#include <csl_mmc.h>
#include <stdio.h>

MMC_InitObj Init = { 
  1,            /* Enable/disable DMA for data read/write */
  0,            /* Set level of edge detection on DAT3 pin */
  0,               /* Determines if MMC goes IDLE during IDLE instr */
  0,         /* Memory clk reflected on CLK Pin */
  3,                 /* CPU CLK to MMC function clk divide down */
  2,                 /* MMC function clk to memory clk divide down */
  0,           /* No. memory clks to wait before response timeout */
  0,          /* No. memory clks to wait before data timeout */
  512             /* Block Length must be same as CSD */
};


MMC_Config configmmc = {
0,
0,
0,
0,
0,
0,
0,
0
};

MMC_CardIdObj cardid;
MMC_CardObj card;
MMC_Handle mmc0;
int temp,i;
char productame[8];

Uint16 data[512];
Uint16 datareceive[512];
Uint16 *dataptr = data;
Uint16 *datarcv = datareceive;

main()
{

    CSL_init();
    
    for (i=0;i<512;i++) {  /* fill data array */
    data[i] = i;
    }
   
    mmc0 = MMC_open(MMC_DEV1);

    MMC_setupNative(mmc0,&Init);
    
    MMC_sendGoIdle(mmc0);  /* idle all cards */

    for (temp=0;temp<4016;temp++) {   /* delay loop to allow card to reset */
    asm("	NOP");
    }
    
    temp=MMC_sendOpCond(mmc0,0x0010000);   /* send operating conditions to all cards */
    
    temp = MMC_sendAllCID(mmc0,&cardid); /* get card ids */
    
    temp = MMC_setRca(mmc0,&card,1); /* send relative address to card */   
    
    temp = MMC_selectCard(mmc0,&card); /* select card for writing/reading */ 
	
	for (temp=0;temp<4016;temp++) {   /* delay loop to allow card to reset */
    asm("	NOP");
    }

    temp = MMC_write(mmc0,0,dataptr,512);  /* write single block */
    
    temp = MMC_read(mmc0,0,datarcv,512);   /* read back the block */
  
   
   
}



/******************************************************************************\
* End of MMC_apiTest.c
\******************************************************************************/

⌨️ 快捷键说明

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