emmc驱动修改_资源共享:eMMC驱动源码

e70c0e92e9caddc13272fe45de22bf25.gif,自己顶一下。好久没到这里溜达溜达了。上来补充一下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 ;

}

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值