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.

the mailbox interrupt of DM8168 on the dsp side

Hi,

I am using the mailbox of DM8168. I found the interrupt number of mailbox is 56 on the dsp side.

I am developing based on the mcfw of DVR_RDK on the platform of DM8168.

Now, I want to know how to register the mailbox interrupt on the dsp side, and if the notify module of syslink have used the interrupt, where I can see the code about the ISR of the mailbox interrupt.

I have seen the function of the System_ipcNotifyHandler() on the file: src_bios6\links_common\system\system_ipc_notify.c.

Thanks

Tianxing

  • Tianxing,

    Notify module from ipc supports 32 events on the mailbox interrupt, even if DVR RDK modules are using mailbox interrupts, unused event numbers can be used by application writers to register their own events. Look at

    DVR_RDK\ti_tools\ipc\ipc_x_xx_xx_xx\packages\ti\ipc\Notify.h

    Int Notify_registerEvent(UInt16 procId,
                             UInt16 lineId,
                             UInt32 eventId,
                             Notify_FnNotifyCbck fnNotifyCbck,
                             UArg cbckArg); 

    This function can be called from DSP to register event on mailbox interrupt.

  • Yogesh,

    Thank you for reply.

    I don't want to register the ISR by IPC_API.

    Now, I have used the mailbox interrupt directly on the A8 side, and I want to use the mailbox interrupt directly.

    I found the IPC_API code in the file "src_bios6\links_common\system\system_ipc_notify.c" as follow:

    status = Notify_registerEvent(procId,
                                                         SYSTEM_IPC_NOTIFY_LINE_ID,
                                                         SYSTEM_IPC_NOTIFY_EVENT_ID,
                                                         System_ipcNotifyHandler, NULL);

    And I saw the function System_ipcNotifyHandler, I thought it maybe called in the ISR of  interrupt 56 on the dsp side, however I can't find the code about the

    register of interrupt 56 and its ISR function.

    I want to use the ISR of interrupt 56 directly.

    Futhermore, could you tell me about the ISR of mailbox on the M3 side. 

    Regards.

    Tianxing

  • Tianxing,

    Then you must have a look at this file ipc_x_xx_xx_xx\packages\ti\sdo\ipc\family\ti81xx\InterruptDsp.c You need to use Hwi module from bios to register your own function. Especially look at InterruptDsp_intRegister which registers InterruptDsp_intShmStub() as call back for interrupt 55. Similarly look at ipc_x_xx_xx_xx\packages\ti\sdo\ipc\family\ti81xx\InterruptDucati.c, there InterruptDucati_intRegister() does the same operation for M3s.

     

     

  • Yogesh,

    Thank you for your reply, it's so useful for us.


    Regards,

    Tianxing

  • Hi, Yogesh

    I modify the code of IPC, how should I do if I want to rebuild the IPC in the linux.

    Thank you

    Tianxing

  • There are two packages for interprocessor communication in DVR_RDK/ti_tools folder 1. SysLink and 2. ipc, SysLink is used from A8 side Linux while ipc is used on M3s/Dsp and with bios. Which one have you modified? SysLink or Ipc? Ipc is not built for Linux. For SysLink, You can use targets mentioend in makerules/build_syslink.mk like make -s syslink, make -s syslink_kermod, make -s syslink_rtos etc.

     

  • Yogesh,

    I modify the function InterruptDsp_intShmStub() as you mentioned, it is a ISR of mailbox interrupt 56 on the DSP side.

    Regards,

    Tianxing

  • For building ipc refer ti_tools\ipc\ipc_x_xx_xx_xx\docs\IPC_Install-Guide.pdf you will have to change directory to ipc package and use "xdc all -PR ." I guess. I believe DSP_INT has been defined to 55 not 56.

    BTW, I understand that you need to use your own function as a callback but why are you not using IPC API (notify Module) which provides you event multiplexing over mailbox interrupt and has been well tested for many race conditions.

  • I found the code as follow in the file sdo\ipc\family\ti81xx\InterruptDsp.c:

    so I thought the DSP_INT has been defined to 56.

     I want to use the mailbox directly to transfer some simplified data between A8 and DSP, and the notify will consume a long time.

  • Ok. You are right its 56.

    tianxing hou said:

     I want to use the mailbox directly to transfer some simplified data between A8 and DSP, and the notify will consume a long time.

     
     
    Well, Notify module round trip time (mailbox interrupt from one core to another core and back) is approximately around 100 microsecs I guess. That is not lot of time. I will try to find exact numbers if I could get. My point is, unless your  are requirements really below 100 microsec for 1 roundtrip interrupt, you would be wasting time in re-implementing this piece of software.
  • I have modified and rebuild the ipc, however I found it has no effect. I modified the code as follow:

    1. I defined  mailbox 10 for the communication between A8 and DSP

            #define ITG_HOST_TO_DSP  10

    2. I enable the new message interrupt of mailbox 10

        REG32(MAILBOX_IRQENABLE_SET_DSP) = ((MAILBOX_REG_VAL(HOST_TO_DSP) | MAILBOX_REG_VAL(ITG_HOST_TO_DSP)));

    3. I receive the message from A8 and clear the status of interrupt on the ISR InterruptDsp_intShmStub()

    if(REG32(MAILBOX_IRQENABLE_SET_DSP) & MAILBOX_REG_VAL(ITG_HOST_TO_DSP)
         & REG32(MAILBOX_IRQSTATUS_CLR_DSP) != 0)
    {
            //get the count of message in the mailbox FIFO
            msg_cnt = REG32(MAILBOX_STATUS(ITG_HOST_TO_DSP));
            //receive and store the message
            for(i = 0; i < msg_cnt; i++)
            {
                     recv_msg[mbox_recv_cnt] = REG32(MAILBOX_MESSAGE(ITG_HOST_TO_DSP));
                     mbox_recv_cnt++;
                     if(mbox_recv_cnt >= RECV_ARRAY_CNT_MAX)
                    {
                            mbox_recv_cnt = 0;
                    }
            }
           //clear the interrupt status
          REG32(MAILBOX_IRQSTATUS_CLR_DSP) = MAILBOX_REG_VAL(ITG_HOST_TO_DSP);
    }

    Are there any errors?

    Regards,

    Tianxing

  • Yogesh,

    Thanks for your help.

    I will consure our requirement about the  consume time with my colleague.


    Regards,

    Tianxing


  • Yogesh,

    I need use the mailbox interrupt.

    Now, I am sure that the new message interrupt of mailbox10 is enabled on the DSP side. However, when I write the mailbox10 on the A8 side, it can't generage the interrupt. I used the "mmap" to remap the PA to the user space.

    Could you give me some advices?

    Thanks,

    Tianxing 

  • Tianxing,

    Have you enabled mailbox clk? without that writing in to mailbox will not gernerate interrupt. Look at DM8168DSPPWR_on() function in SysLink ti_tools\syslink\syslink_x_xx_xx_xx\packages\ti\syslink\family\common\ti81xx\ti81xxdsp\Dm8168DspPwr.c, you need to enable mailbox_ick clk to get mailbox functional

  • Yogesh,

    I have resolved the bug as I mentioned before.

    Now, I have another question about the using of mailbox. I defined two mailbox for the communication from A8 to DSP, one is the mailbox 3(it is used by syslink/ipc), another is the mailbox 10(used by ourself), when I write the mailbox10 and mailbox3 on the A8 side at the same time as the follow:

        *mbox_message_03 = 0x5A5A;

        *mbox_message_10 = 0x5B5B;

    It would generate a interrupt to DSP, however I can't get the message from mailbox3 and mailbox10, the value of  MAILBOX_IRQSTATUS_CLR_u register is 0 before I write the register.  

    I want to use the mailbox interrupt directy in ourself way, however, I hope it will not obstruct the using of notify in syslink/ipc.

    Could you give me some advices about that?


    Thanks,

    Tianxing

  • Yogesh,

    I want to know the mutex about the mailbox if I write message to different mailbox simultaneously on the A8 or DSP side..

    For example, I write a message to mailbox10 on the A8 side, simulaneously, I write a message to mailbox3 on the A8 side. 

    Regards.

    Tianxing

  • I dont think you need to worry about that. The interrupt service routine on the remote core should enusre that  all mailboxes those are enabled to receive interrupts are checked for value and service those interrupts e.g. if DSP has enabled interrupts from A8 and M3 on different mailboxes, in its ISR it will ensure both interrupts are serviced irrespective of when mailboxes were written the values.

  • Tianxing,

    As far as mailbox10 is not used by syslink/ipc for any other instance of notify it should be ok and it should not obstruct notify functionality. For the other part, are you able to get interrupt on dsp by writing only mailbox3 or only mailbox10?  When you are writing from A8 have you ensured mapping of mailbox register space in to respective Os's virtual space(user or kernel)? also when you write to mailbox just ensure the value is being written to right address by watching memory window in CCS with A8 MMU disabled.

  • Yogesh,

    I have get the interrupt on dsp by writing only mailbox3 or only mailbox10, and I can receive the message successful. However, when I writing mailbox3 and mailbox10 simultaneously, it will get the intterrupt on dsp but the message is not recevied.

    The Os's virtual space is correctly.

    Regards,

    Tianxing

  • Can you post your ISR on DSP again? I need to review that. I went back in posts and checked that you have this condition in ISR. Are you sure this is correct?  This condition is checking only one mailbox (ITG_HOST_TO_DSP). This condition also worries me about value '0' what if A8 writes 0 in the mailbox? also do you want & operator to be &&?

    if(REG32(MAILBOX_IRQENABLE_SET_DSP) & MAILBOX_REG_VAL(ITG_HOST_TO_DSP)
         & REG32(MAILBOX_IRQSTATUS_CLR_DSP) != 0)