|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2015-1-27 17:31:03
|
显示全部楼层
,自己顶一下。好久没到这里溜达溜达了。上来补充一下Emmc驱动的问题。一般emmc会分为以下几个区
BootAreaPartition1、BootAreaPartition2、RPMBPartition、UserDataArea。emmc复位或启动默认访问的UserDataArea,
要想访问其他区域必需使用Switch命令进行相关的配置。以下为访问BootAreaPartition1的读函数。
/**
* Function: Read a single block by SDR mode
* Arg:
* busmode support 1bit and 8 bit bus mode
* blk_length set the block length ,but not detect the aligh now
* addr this function not detect the validity of this parament
* return : No .
* Author: zhangweixiang--datoudatou37@gmail.com 2013/05/29 version-1.0
**/
void emmc_sin_blk_read( unsigned int addr, uchar busmode, unsigned int blk_length,unsigned char *z_ReadDataBuff)
{
emmc_sel_dis_card(0x02 ,ENABLE);
time_delay_ms(1);
/* select the 8 bit bus width without ddr mode */
if (busmode == BUS8_SDR_MODE) {
//emmc_set_switch_cmd(BUS8_SDR);
time_delay_ms(3);
emmc_set_switch_cmd(BUS8_SDR); //set buswith
time_delay_ms(3);
//0x03b30900
emmc_set_switch_cmd(0x03b30900);//set bootpartion1 access
time_delay_ms(3);
}
/* 2. send CMD16 to set the block length */
#if 1
emmc_set_block_length(blk_length);
time_delay_ms(1);
#endif
if (busmode == BUS8_SDR_MODE) {
// while(1)
{
single_block_read_8(addr,z_ReadDataBuff);
//printf("clc\r\n");
//time_delay_ms(5);
}
time_delay_ms(1);
} else {
single_block_read(addr);
time_delay_ms(1);
}
/*
* Send CMD12 Stop the data trans
* Note: if the data tran finish
* this cmd don't affect
* anything
*/
emmc_stop_tran_cmd();
time_delay_ms(1);
/* Send CMD7 with discard to disselect the card */
emmc_cancel_sel_card();
time_delay_ms(11);
return ;
}
|
|