esp32-cam-demo icon indicating copy to clipboard operation
esp32-cam-demo copied to clipboard

Question on setting pd->length to same as pd->size

Open nkolban opened this issue 8 years ago • 1 comments

In the sample code in the function called dma_desc_init() we find the creation of the DMA descriptors in a linked list. In the initialization of an element of this list, we find that we are creating and populating instances of lldesc_t structures.

In this structure we set (among others):

  • buf - A pointer to a malloced RAM biffer of size=buf_size
  • size - We record the size of the buffer (=buf_size)
  • length - The sample code also sets this to be buf_size

This causes me to be puzzled. I understand that buf is the storage to be written into and I understand that size is the amount of storage that the DMA subsystem can write into. It is length that is causing me pause. I had understood that the value of this would be the length of data actually written into the buffer by DMA. At initialization time, I would thus have imagined that its value would be 0 as opposed to the size of the buffer itself. I would have thought that 0 would indicate that no bytes within the buffer have been utilized to store DMA retrieved data?

nkolban avatar Jul 24 '17 00:07 nkolban

You are right, i think the value does not matter when I2S is writing data into the buffer. It would have mattered if I2S was reading data from the buffer. Will fix this.

igrr avatar Jul 24 '17 06:07 igrr