iMX6ULL DCP + MMU

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

iMX6ULL DCP + MMU

跳至解决方案
1,078 次查看
stephenbialkows
Contributor III

Hello,

I have a custom i.MX6ULL board.  I tested a set of DCP routines on a bare metal board (no OS, just asm initialization and main).  Now I am trying to test these same routines after an OS has enabled the MMU.  No combination of logical mmap() options seems to allow the DCP direct access to OCRAM.  Is it physically possible for the DCP to operate on OCRAM when the MMU is enabled?  

Thanks!

Stephen

标记 (1)
0 项奖励
1 解答
892 次查看
stephenbialkows
Contributor III

To whom it concerns,

I found it works as long as the source buffer, destination buffer, and command are all mmap'ed such that

1) both addr and offset are the same (1st and last parameter)

2) prot = PROT_NOCACHE | PROT_READ | PROT_WRITE

3) flags = MAP_SHARED | MAP_PHYS | MAP_FIXED | MAP_NOSYNCFILE

4) fileds = NOFD

example:

#define MMAP_PROT (PROT_NOCACHE | PROT_READ | PROT_WRITE)
#define MMAP_FLAGS (MAP_SHARED | MAP_PHYS | MAP_FIXED | MAP_NOSYNCFILE)
#define MMAP_FILE_DES NOFD

srcBuf = (volatile uint32_t*) mmap((void* const)OCRAM_SRC_BUF_ADDR, OCRAM_BUF_SIZE, MMAP_PROT, MMAP_FLAGS, MMAP_FILE_DES, OCRAM_SRC_BUF_ADDR);
dstBuf = (volatile uint32_t*) mmap((void* const)OCRAM_DST_BUF_ADDR, OCRAM_BUF_SIZE, MMAP_PROT, MMAP_FLAGS, MMAP_FILE_DES, OCRAM_DST_BUF_ADDR);
cmd = (volatile DcpWorkPacket*) mmap((void* const)OCRAM_CMD_ADDR, sizeof(DcpWorkPacket), MMAP_PROT, MMAP_FLAGS, MMAP_FILE_DES, OCRAM_CMD_ADDR);

This forces the mapped addresses to be the same as the physical addresses being mapped, and removes all buffering.  It appears as though the DCP is incapable of IO unless the mapped addresses are the same as the physical addresses.  When I remove MAP_FIXED, it fails.  This may be unfortunate because not all OSs support MAP_FIXED.  

在原帖中查看解决方案

0 项奖励
1 回复
893 次查看
stephenbialkows
Contributor III

To whom it concerns,

I found it works as long as the source buffer, destination buffer, and command are all mmap'ed such that

1) both addr and offset are the same (1st and last parameter)

2) prot = PROT_NOCACHE | PROT_READ | PROT_WRITE

3) flags = MAP_SHARED | MAP_PHYS | MAP_FIXED | MAP_NOSYNCFILE

4) fileds = NOFD

example:

#define MMAP_PROT (PROT_NOCACHE | PROT_READ | PROT_WRITE)
#define MMAP_FLAGS (MAP_SHARED | MAP_PHYS | MAP_FIXED | MAP_NOSYNCFILE)
#define MMAP_FILE_DES NOFD

srcBuf = (volatile uint32_t*) mmap((void* const)OCRAM_SRC_BUF_ADDR, OCRAM_BUF_SIZE, MMAP_PROT, MMAP_FLAGS, MMAP_FILE_DES, OCRAM_SRC_BUF_ADDR);
dstBuf = (volatile uint32_t*) mmap((void* const)OCRAM_DST_BUF_ADDR, OCRAM_BUF_SIZE, MMAP_PROT, MMAP_FLAGS, MMAP_FILE_DES, OCRAM_DST_BUF_ADDR);
cmd = (volatile DcpWorkPacket*) mmap((void* const)OCRAM_CMD_ADDR, sizeof(DcpWorkPacket), MMAP_PROT, MMAP_FLAGS, MMAP_FILE_DES, OCRAM_CMD_ADDR);

This forces the mapped addresses to be the same as the physical addresses being mapped, and removes all buffering.  It appears as though the DCP is incapable of IO unless the mapped addresses are the same as the physical addresses.  When I remove MAP_FIXED, it fails.  This may be unfortunate because not all OSs support MAP_FIXED.  

0 项奖励