PRU DDR Access Though PRUSSDRV

Hi all, I am back with another question regarding memory accesses with the PRU.
I am currently using uio and prussdrv to map DDR memory for the PRU to write data to, and the ARM to read data from. I get some odd results however. First, let me show how I initialize the DDR memory from ARM:

...
volatile void* ptr = NULL;
prussdrv_init();
prussdrv_open(PRU_EVTOUT_0);  // Open both PRU0 and PRU1 
prussdrv_open(PRU_EVTOUT_1);
prussdrv_pruintc_init(PRUSS_INTC_INITDATA);
prussdrv_map_extmem(&ptr);
uint32_t ddr_addr = prussdrv_get_phys_addr(ptr); // = 0x9c940000
uint32_t ddr_bytes = prussdrv_extmem_size();     // = 0x40000
...

And from PRU:

...
volatile uint32_t* ddr3_buffer = (volatile uint32_t*)(0x9C940000);
...
ddr3_buffer[curr_idx] = pru_i2s_readsample();
...

This seems to all go well and fine, up until a certain point. See, I was expecting to get 256 KB (0x40000) of memory, from 0x9C940000 to 0x9C980000, as is defined in /sys/class/uio/uio0/maps/map1/addr and /sys/class/uio/uio0/maps/map1/size. But, when reading back the data on the ARM side, there seem to be gaps. The data being written is audio data from an I2S module which the PRU is pushing out into DDR for the ARM to process and store to a file. When plotting the waveform, this is what happens:

Note that these jumps to-and-from the plateau at the y=0 axis occur only at #of samples close to or exactly equal to powers of 2; the first blue jump up is at the 66009th (more or less 2^16) sample, and the orange jump down is at the 262144th sample (exactly 2^18), then the green jump up is at the 327680th sample, which is exactly 2^16 samples after 262144. I suppose you can see where I’m getting at. There must be some logical reason I get these odd gaps in my data.

So my questions are:

  1. Why does this happen? I thought prussdrv allocated these 256 KB for me to use, but it seems only parts of it are actually usable
  2. How do I properly access the 256 KB memory range? I clearly cannot access it from the ARM side this way in a reliable fashion for the whole 256 KB range in a contiguous matter.

My suspicions are that it has something to do with page alignment with mmap (since thats what prussdrv is using under the hood) or with the following mysterious statement in the prussdrv library:

// UIO driver expects user space to map PRUSS_UIO_MAP_OFFSET_XXX to
// access corresponding memory regions - region offset is N*PAGE_SIZE
...
#define PRUSS_UIO_MAP_OFFSET_EXTRAM 1*PAGE_SIZE
#define PRUSS_UIO_DRV_EXTRAM_BASE "/sys/class/uio/uio0/maps/map1/addr"
#define PRUSS_UIO_DRV_EXTRAM_SIZE "/sys/class/uio/uio0/maps/map1/size"
...

What do they mean with this? How am I supposed to map PRUSS_UIO_MAP_OFFSET_EXTRAM to a physical address 0x9C940000 when this is not possible from userspace?

Thank you in advance for any help, this problem really is a head-scratcher for me.