Public Version
IPC Mailbox Basic Programming Model
www.ti.com
message queue is full for the same reason.
The receiver can also detect new messages from another user using two methods:
•
Poll the MAILBOX.
[0] FIFOFULLMB bit or the
[2:0] NBOFMSGMB field.
•
Use a new message ISR (interrupt service routine). In this case, the receiver must enable the
appropriate interrupt in the MAILBOX.
register.
NOTE:
After an interrupt is generated, and before exiting the ISR, write 1 in each bit responsible for
this generation in the MAILBOX.
register, thereby clearing these
bits.
14.4.4 Mailbox Communication Sequence
When a message slot is available in the mailbox, a message can be transmitted by a sender to a receiver
using the following steps:
1. The sender writes a message in the MAILBOX.
register. This results in the
following actions:
•
The message is stored at the tail of the FIFO queue of mailbox m, and the
MAILBOX.
and MAILBOX.
registers are
updated.
•
If the FIFO queue was previously empty, a new message interrupt can be generated to the
receiver to which the mailbox is allocated; otherwise, the interrupt is already asserted and remains
so.
2. The receiver can either use an ISR or poll the MAILBOX.
or
registers to detect new messages and read them by accessing
the MAILBOX.
register.
•
If using interrupts, the receiver enters the ISR when it detects the new message interrupt. The
receiver checks both the MAILBOX.
register to determine the source of
the interrupt and the MAILBOX.
register(s) to determine the number of
messages in the FIFO queue.
•
The receiver can poll the appropriate MAILBOX.
register(s) to check
the status and determine if there are any pending messages to read. The receiver can read the
MAILBOX.
[2:0] NBOFMSGMB field to determine how many messages
are available.
3. Using either ISR or polling method, when the receiver determines that it has a message pending in a
mailbox, it repeatedly reads the MAILBOX.
register to remove all messages
from the FIFO queue until a read in the MAILBOX.
register indicates no
more messages are available (MAILBOX.
[2:0] NBOFMSGMB field =
0x00).
4. After reading all of the messages, the receiver can acknowledge the new message interrupt by writing
1 in the appropriate bit of the MAILBOX.
register to clear the interrupt flag
before exiting the ISR.
14.4.5 Example of Communication
This example shows how communication is established between the MPU and IVA2.2 subsystems in the
device. The MPU subsystem sends messages to the IVA2.2 subsystem through mailbox 0, and the IVA2.2
subsystem sends messages to the MPU subsystem through mailbox 1.
To establish communication, the software follows these steps:
1. Turn on the automatic idle feature by writing 1 in the MAILBOX.
[0] AUTOIDLE
bit.
2. Configure the mailbox in smart-idle mode by setting the MAILBOX.
SIDLEMODE field in smart-idle mode (smart-idle is the recommended mode; see
Mailbox Register Manual, for more information). Smart-idle mode allows the PRCM low-power-mode
requests to be acknowledged only after clearing any pending interrupts.
2654
Interprocessor Communication
SWPU177N – December 2009 – Revised November 2010
Copyright © 2009–2010, Texas Instruments Incorporated