I stored the files in address "26623 * 512",so I only need to open the "/dev/block/mmcblk0" for read the file contents,
I had made the following test.
1.Add the node of drivers;
static int emmcvalue=0;
static ssize_t show_emmc(struct device *dev,
struct device_attribute *attr, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", emmcvalue);
}
static ssize_t set_emmc(struct device *dev,
struct device_attribute *attr, char *buf, size_t count)
{
int value = simple_strtol(buf,NULL,0);
printk(" value =%d\n",value);
///check the value
if(value ==1)
emmc_read();
emmcvalue = value;
return count;
}
static DEVICE_ATTR(emmc, S_IWUSR | S_IRUGO, show_emmc, set_emmc);
2.When the devices bootup, I call the "emmc" in serial port:
bash-3.2# echo 1 > emmc
[ 53.799949] value =1
[ 53.802239] loading waveform file: /dev/block/mmcblk0
[ 53.808659] emmc_read,i=4
[ 53.813369] waveform name: V220_C175_50_WN5331_ED050SC5_BTC.wbf
[ 53.819297] waveform size: 38853
it works well,but I call it in kernel,it can't open. Thanks.