read函式不会读取eMMC闪存?

本帖最后由 FatDKai 于 2015-4-28 11:56 编辑

在Firefly平台弄了个读/写档案测试的程序用ADB丢进/data/tmp目录执行
执行读取函式时,用分析仪抓取不到任何读eMMC闪存的CMD(17,18), 系统对eMMC闪存不会下读闪存的CMD?
为什么?求解~

   int patFile1 = open("./Pattern1.bin",O_CREAT|O_EXCL|O_RDWR,S_IRUSR|S_IWUSR|S_IXUSR);
    if(patFile1 < 0)
    {
       printf("open patFile1 error!\n");
  bError = 1;
       goto OUT;

    }

    // lseek(patFile1, 0 , SEEK_SET);

    int i;
    unsigned int   offset = 0;
    unsigned char* dataPatBuf;
    unsigned char* tmpDataBuf;
    unsigned int   fileSecs = MAX_BYTE_OF_FILE / SEC_SIZE;

    dataPatBuf = (unsigned char *)malloc(SEC_SIZE);
    printf("File Sectors = %d\n", fileSecs);

    srand(seed);

    for(i = 0; i < fileSecs; i++) {
        memset(dataPatBuf, (rand() % SEC_SIZE), SEC_SIZE);
        write(patFile1,dataPatBuf, SEC_SIZE);
    }

	//fsync(patFile1);

    lseek(patFile1, 0 , SEEK_SET);

    printf("Read Data Pattern...\n");
    for(i = 0; i < fileSecs; i++)
        read(patFile1,dataPatBuf,SEC_SIZE);

    free(dataPatBuf);

    close(patFile1);

    remove("Pattern1.bin");