免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3549 | 回复: 2
打印 上一主题 下一主题

MIPS下的cache/uncache访问的一点想法 [复制链接]

论坛徽章:
5
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-04-28 11:26 |只看该作者 |倒序浏览
有同事提到在客户平台下访问cache地址的问题.
Q: XXX used cached reads from the FLASH to read back some data, but found that sometimes they read the wrong data. I'm checking with them to see if the use cached writes to FLASH also.

In our FW, we use uncached writes to FLASH. Can you please help me understand why we need to use uncached writes (or reads) to the FLASH? Is there a possibility that the data in the cache is not written to FLASH if we use cached access?


A: For flash device, cached write/erase command sequence may cause problems.

For example:
A common sector erase command sequence without cache is:
ADDR: 555 DATA:AA
ADDR: AAA DATA:55
ADDR: 555  DATA:80
ADDR: 555 DATA:AA
ADDR: AAA DATA:55
ADDR: SA DATA:30

Whitin cache , it may look like:
ADDR: 555 DATA:AA
ADDR: AAA DATA:55
//ADDR: 555  DATA:80   => Addr 555 is cache hit and DATA is changed to 80
//ADDR: 555 DATA:AA   => Addr 555 is cache hit and DATA is changed to AA
//ADDR: AAA DATA:55   => Addr AAA is cache hit and DATA is unchanged
ADDR: SA DATA:30

Then the sequence becomes:
ADDR: 555 DATA:AA
ADDR: AAA DATA:55
ADDR: SA DATA:30

In result the above sequence in cache becomes an invalid erase sequence. The same as other flash command sequences beyond one cycle.

[结论]可见, 对于这种有严格时序要求的IO访问, 只能访问uncache地址.

[ 本帖最后由 yidou 于 2009-4-28 11:27 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2009-04-28 12:47 |只看该作者
我们平台也是mips,将framebuffer映射到cache上,再调用flush cache函数将cache上的数据冲洗到framebuffer中。如果要保持cache和IO数据的一致性,应该实现这样的类似接口

论坛徽章:
0
3 [报告]
发表于 2009-04-30 13:56 |只看该作者

回复 #1 yidou 的帖子

嗯,看到有一段和这个相关的
The kseg1 region is the only chunk of the memory map that is guaranteed to behave properly from system reset; that’s why the after-reset
starting point (0xBFC0.0000) lies within it. You will therefore use this region to access your initial program ROM,and most people use it for I/O registers.
----《 see mips run》
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP