iMX6ULL DCP + MMU

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX6ULL DCP + MMU

Jump to solution
1,021 Views
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

Tags (1)
0 Kudos
1 Solution
835 Views
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.  

View solution in original post

0 Kudos
1 Reply
836 Views
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 Kudos