VxWorks中的地址映射
#define VM_STATE_WRITABLE_NOT 0x00
#define VM_STATE_CACHEABLE 0x10
#define VM_STATE_CACHEABLE_NOT 0x00
同
样不同的CPU芯片类型还有其特殊状态
2、 初始化结构
在 Tornado\target\config\ads860\sysLib.c 文件中:
PHYS_MEM_DESC sysPhysMemDesc [] =
{
{
(void *) LOCAL_MEM_LOCAL_ADRS,
(void *) LOCAL_MEM_LOCAL_ADRS,
LOCAL_MEM_SIZE ,
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE |
VM_STATE_MASK_CACHEABLE,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE
},
{
(void *) BCSR0,
(void *) BCSR0,
0x00001000, /* 4 k - Board Control and Status */
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE |
VM_STATE_MASK_CACHEABLE | VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
……
{
(void *) INTERNAL_MEM_MAP_ADDR,
(void *) INTERNAL_MEM_MAP_ADDR,
INTERNAL_MEM_MAP_SIZE, /* 64 k - Internal Memory Map */
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE |
VM_STATE_MASK_CACHEABLE | VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
{
(void *) ROM_BASE_ADRS,
(void *) ROM_BASE_ADRS,
ROM_SIZE, /* Flach memory */
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE |
VM_STATE_MASK_CACHEABLE ,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT
}
};
上面结构中是缺省地址映射。
3、 地址初始化
在Tornado\target\src\config\ usrMmuInit.c 文件中
通过函数usrMmuInit使地址映射生效
4、 实现映射:
如你定义flash地址为0x04000000开始的8Mbyte地址,则可以如下进行地址映射
{
(void *) 0x04000000,
(void *) 0x0400