第一个问题,出了一堆的指令数据异常,是不是访问了非法地址?我也搞不清楚。只能给出一些通常用法的建议。从nand类型的flash做tffs的时候需要注意以下几点:
1、read函数一定要在identify的时候注册,因为nand类型的flash不能直接读取;
2、map函数不能像nor一样直接映射,需要开辟一个全局的buf,把flash里面的内容使用read函数读到buf里面,再把buf地址返回;
3、write函数的overwrite选项一定要处理,会操作到每个block后面的几个字节,这里要记录状态;
4、全局变量tlTable表里面,可能没有nftl的格式化和mount函数,如果没有自己添加;
第二个问题,tffsRawio是low level的ioctrl,以下是这个函数的几个io选项的处理:
* TFFS_GET_PHYSICAL_INFO writes the flash type, erasable block size, and media
* size to the user buffer specified in <arg0>.
*
* TFFS_PHYSICAL_READ reads <arg1> bytes from <arg0> and writes them to
* the buffer specified by <arg2>.
*
* TFFS_PHYSICAL_WRITE copies <arg1> bytes from the <arg2> buffer and writes
* them to the flash memory location specified by <arg0>.
* This aborts if the volume is already mounted to prevent the versions of
* translation data in memory and in flash from going out of synchronization.
*
* TFFS_PHYSICAL_ERASE erases <arg1> erase units, starting at the erase unit
* specified in <arg0>.
* This aborts if the volume is already mounted to prevent the versions of
* translation data in memory and in flash from going out of synchronization.
*
* TFFS_ABS_READ reads <arg1> sectors, starting at sector <arg0>, and writes
* them to the user buffer specified in <arg2>.
*
* TFFS_ABS_WRITE takes data from the <arg2> user buffer and writes <arg1>
* sectors of it to the flash location starting at sector <arg0>.
*
* TFFS_ABS_DELETE deletes <arg1> sectors of data starting at sector <arg0>.
*
* TFFS_DEFRAGMENT_VOLUME calls the defragmentation routine with the minimum
* number of sectors to be reclaimed, <arg0>, and writes the actual number
* reclaimed in the user buffer by <arg1>. Calling this function through some
* low priority task will make writes more deterministic.
* No validation is done of the user specified address fields, so the functions
* assume they are writable. If the address is invalid, you could see bus errors
* or segmentation faults.