X-Git-Url: https://git.ti.com/gitweb?p=ipc%2Fipcdev.git;a=blobdiff_plain;f=packages%2Fti%2Fsdo%2Fipc%2Ffamily%2Fvayu%2FInterruptDsp.c;h=406558e14da94b16fb9c64c652f50c9554f32424;hp=ec24a7e9cda3ff1f88d128456e41441fceac790c;hb=feb7a8486ed537033c5aed5b170f52f758bddabe;hpb=7751220c988198d82c33ec6ea02622df789b9269;ds=sidebyside diff --git a/packages/ti/sdo/ipc/family/vayu/InterruptDsp.c b/packages/ti/sdo/ipc/family/vayu/InterruptDsp.c index ec24a7e..406558e 100644 --- a/packages/ti/sdo/ipc/family/vayu/InterruptDsp.c +++ b/packages/ti/sdo/ipc/family/vayu/InterruptDsp.c @@ -302,25 +302,17 @@ Void InterruptDsp_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo, /* * Before writing to a mailbox, check whether it already contains a - * message. If so, don't write to the mailbox since we want one and only - * one message per interrupt. Disable interrupts between reading + * message. If so, wait for the message to be read since we want one + * and only one message per interrupt. Disable interrupts between reading * the MSGSTATUS_X register and writing to the mailbox to protect from - * another thread doing an intSend at the same time - * - * Note regarding possible race condition between local 'intSend' and - * remote 'intClear': - * It is possible that we we read the MAILBOX_MSGSTATUS_X register during - * the remote side's intClear. Therefore, we might choose _not_ to send - * write to the mailbox even though the mailbox is about to be cleared a - * few cycles later. In this case, the interrupt will be lost. - * This is OK, however. intClear should always be called by the Notify - * driver _before_ shared memory is read, so the event will be picked up - * anyway by the previous interrupt that caused intClear to be called. + * another thread doing an intSend at the same time. */ key = Hwi_disable(); - if (REG32(MAILBOX_STATUS(index)) == 0) { - REG32(MAILBOX_MESSAGE(index)) = arg; + while (REG32(MAILBOX_STATUS(index)) != 0) { + Hwi_restore(key); + key = Hwi_disable(); } + REG32(MAILBOX_MESSAGE(index)) = arg; Hwi_restore(key); }