This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROC_write and PROC_read in DSPLINK driver

Could you give some clarification on PROC_Write/PROC_read() function in DSPLINK driver

1. PROC_write/PROC_read function copies data to/from DSP memory space as single byte. will it create any memory corruption issue if I copy to/from DSP memory space as 4 byte?

2. Can I use memcpy() function instead of PROC_write/PROC_read if I know dsp address and gpp address?

Please provide your suggestions and your early response is very much appreciated.

  • Hi,

    1. Latest DSPLink releases (1.60 onwards) use memcpy for PROC_read / PROC_write within the kernel module. This was done since memcpy gives better performance than byte-by-byte copy. If you change the implementation of DSP_write to do 4-byte copy, to prevent corruption of memory before & after the region, you will need to ensure that you take care of initial & final cases where the start address & size may not be 4-byte aligned.

    2. If you want to use memcpy from user-side, then you will need the mapped user-side gpp address. If you have this, you can definitely directly use memcpy instead of PROC_read / PROC_write.

    Regards,
    Mugdha

  • Hi,

    Thanks for your response.

    Can i have a circular buffer in the shared memory region, which can be accessed by both GPP and DSP?

    Like GPP may write the data and provide the read ptr to DSP. DSP shall read data from the Rd-pointer and process the data.

    There is a possibility that DSP-GPP shared memory region is simultaneously accessed for GPP write/DSP read, but in a different memory address.

    is this feasible? Is there any limitation that at a time either GPP/ DSP (irrespective of read/write) can only access the shared memory region.

  • Hello,

    Please find my answers inline:

    Like GPP may write the data and provide the read ptr to DSP. DSP shall read data from the Rd-pointer and process the data. Can i have a circular buffer in the shared memory region, which can be accessed by both GPP and DSP?

    [Deepali]: Can you check if this link helps you?

    http://wiki.davincidsp.com/index.php/Writing_DSPLink_Application_using_PROC_read_and_write_APIs

    If you are looking for more features from the circular buffer, please have a look at the RingIO IPC given by DSPLink.

    http://wiki.davincidsp.com/index.php/DSPBIOS_LINK_WebEx_Presentations

    There is a possibility that DSP-GPP shared memory region is simultaneously accessed for GPP write/DSP read, but in a different memory address. is this feasible? Is there any limitation that at a time either GPP/ DSP (irrespective of read/write) can only access the shared memory region.

    [Deepali]: Only one core should be allowed to write into the shared buffer as multiple cores trying to access for write at the same time will corrupt the data.Only after a write by a core is complete, can the other core read it. I am not understanding the use case for simultaneous read/write access. Please can you explain the use case to enable me to answer your question better.

    Deepali