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.

where is the DSPLINK_shmBaseAddress initialized

Hi,

 

As I studied the dsplink, I found that dsp and gpp talk first via DSPLINK_shmBaseAddress.

 

/** ============================================================================
 *  @const  DSPLINK_shmBaseAddress
 *
 *  @desc   Location where the starting address of the shared memory used by
 *          the DSPLINK components is stored.
 *  ============================================================================
 */
Uint32 DSPLINK_shmBaseAddress ;

/** ----------------------------------------------------------------------------
 *  @name   DSPLINK_isInitialized
 *
 *  @desc   Indicates if DSP/BIOS LINK has been initialized
 *  ----------------------------------------------------------------------------
 */
static Bool DSPLINK_isInitialized = FALSE ;

/** ============================================================================
 *  Create named sections for all DSPLINK functions to allow specific memory
 *  placement.
 *  ============================================================================
 */
#pragma CODE_SECTION (DSPLINK_init,                 ".text:DSPLINK_init")


/** ============================================================================
 *  @func   DSPLINK_init
 *
 *  @desc   This function initializes DSP/BIOS LINK. It is called by the
 *          applications.
 *
 *  @modif  None.
 *  ============================================================================
 */
Void
DSPLINK_init  (Void)
{
    DRV_Ctrl * ctrlPtr      = (DRV_Ctrl *) DSPLINK_shmBaseAddress ;
    Uint16     dspHandshake = DRV_HANDSHAKE_BASE ;

    /* Call the internal function to initialize DSPLINK. By this time, data
     * drivers (if any) and pools (if any) are already initialized.
     */
    _DSPLINK_init () ;

    /* If data drivers or pools were not included by the application, complete
     * the handshake for them to ensure that the GPP-side can proceed further.
     */
#if defined (POOL_COMPONENT)
    if (ctrlPtr->poolDspInitDone == COMP_UNINITIALIZED) {
        ctrlPtr->poolDspInitDone = (Uint32) SYS_OK ;
        dspHandshake |= DRV_HANDSHAKE_POOL ;
    }
#endif /* if defined (POOL_COMPONENT) */

#if defined (CHNL_COMPONENT)
    if (ctrlPtr->dataDspInitDone == COMP_UNINITIALIZED) {
        ctrlPtr->dataDspInitDone = (Uint32) SYS_OK ;
        dspHandshake |= DRV_HANDSHAKE_DATA ;
    }
#endif /* if defined (CHNL_COMPONENT) */

    HAL_cacheWbInv ((Void *) ctrlPtr, sizeof (DRV_Ctrl)) ;

    /* Complete the handshake for configured components as expected by the
     * GPP, even if they are not included by the application.
     */
    SHMDRV_handshake (ID_GPP, dspHandshake) ;
}

 

But When dsp side executable start to run, DSPLINK_init is called first generaly.

The question is who initialize the Uint32  DSPLINK_shmBaseAddress?

As the the comment said the it is a const, but where is the initial value.

Could any guys tell me?

Thanks a lot!


David Chan (also known as Blacksword.David)


  • David,

    The DSPLINK_shmBaseAddress variable is initialized from the GPP-side before it starts the DSP in PROC_start. Explanation below ...

    Shared memory used by DSPLink is configured on the GPP-side through the CFG_<PLATFORM>.c file and on the DSP-side through the TCF file. This shared memory region (DSPLINKMEM / DSPLINKMEM1) is used by DSPLink modules for their shared memory requirements. On the GPP-side, the modules start getting initialized in PROC_setup & PROC_attach. At its init time, each module takes its specific needs of shared memory from the internal module: Shared Memory Manager (SMM). Thus, depending on the modules configured (enabled) in the build, the start address of shared memory for each module may be different for different builds.

    At its build time, DSP-side does not know about this configuration that's happening on the GPP-side. Each DSP-side module needs to get its memory requirements through information from the GPP-side. The main issue for the DSP-side is getting the 'first' shared address which could point to the rest of the modules' shared information. This first location is also not fixed, because it depends on shared memory start address as determined on GPP-side.

    Hence, we use a very interesting technique ... On the GPP-side, we have a COFF parser, which is used when DSP is loaded with its executable. Using this COFF parser, we read the symbol table, and get the address of the DSPLINK_shmBaseAddress const variable in the DSP executable. Then GPP-side writes the start of the shared memory region into this address before starting the DSP (releasing it from reset). This way, when the DSP comes up, it finds the variable pre-initialized by the GPP, and can then go ahead and initialize all its modules in DSPLINK_init.

    You can get further details of this mechanism from the "Dynamic Configuration" design document available within the DSPLink package: dsplink/doc/design/LNK_137_DES.doc

    If a symbol-stripped DSP executable is used (to save memory), and hence the symbol information is not available on GPP-side, the application needs to fill the DSPLINK_shmBaseAddress const variable with actual start of shared memory through the linker command file as mentioned at the below page. This facility is available from DSPLink 1.40.05_p4 onwards.

    http://tiexpressdsp.com/wiki/index.php?title=Using_a_symbol_stripped_DSP_executable_with_DSPLink

    Regards,
    Mugdha