A technique and apparatus for efficiently and flexibly utilizing shared memory
as a full duplex mailbox for both data and payload information. The invention allows
payload messages of varying lengths to be passed in contiguous memory space, allowing
an interrupt service routine (ISR) or other process to easily and quickly read
or cache the passed payload data. In a disclosed embodiment, a processor-to-processor
mailbox is formed using a shared memory (e.g., a dual port RAM). The shared memory
is separated into three main portions: a processor 1 to processor 2
fixed portion, a processor 2 to processor 1 fixed portion, and an
unallocated dynamic portion. Importantly, the other direction of the mailbox is
located starting at the highest address of the shared memory, and works toward
the lowest address of the shared memory. Preferably, write access for payload messages
and other generally longer messages are dynamically allocated in the unallocated
dynamic portion for use in either mailbox. For messages passed in mailbox 1,
i.e., from processor 1 to processor 2, the memory in the unallocated
dynamic portion is allocated in a lowest to highest address direction. Conversely,
for messages passed in mailbox 2, i.e., from processor 2 to processor
1, the memory in the unallocated dynamic portion is allocated in a highest
to lowest address direction.