Dear Sir,
The device driver is using interrupts; there are several interrupt sources registered in the device driver.
As far as the mailbox is concerned, each time a mailbox interrupt is received, the device driver stores the value in a software queue. Reading the register clears the interrupt (this is in kernel code).
On the API side, the read mailbox function asks a mailbox value from the software fifo and wait up to the next device driver ping; either the value or a timeout value coming from the device driver. The function is blocking during this time.
The scheme is perfectly sound. A thread is waiting on a ping from the firmware, blocking on the read mailbox function. As soon the ping is received, read mail box function returns letting the thread know how many byte to offload. If the size of data is constant, then the mailbox value is dummy. As soon the data is received, in other words the read data completed (also blocking) you notify the worker thread about it. Generally you would use a double buffering scheme, where the worker thread consumes data while another DMA operation is running.
I hope that helps,
Arnaud