
Table 27-3: Writing to and Reading from a Mailbox
#include <stdio.h>
#include "altera_avalon_mailbox.h"
int main()
{
alt_u32 message = 0;
alt_mailbox_dev* send_dev, recv_dev;
/* Open the two mailboxes between this processor and another */
send_dev = altera_avalon_mailbox_open("/dev/mailbox_0");
recv_dev = altera_avalon_mailbox_open("/dev/mailbox_1");
while(1)
{
/* Send a message to the other processor */
altera_avalon_mailbox_post(send_dev, message);
/* Wait for the other processor to send a message back */
message = altera_avalon_mailbox_pend(recv_dev);
}
return 0;
}
Mailbox API
This section describes the application programming interface (API) for the mailbox core.
altera_avalon_mailbox_close()
Prototype:
void altera_avalon_mailbox_close (alt_mailbox_dev* dev);
Thread-safe: Yes.
Available from
ISR:
No.
Include: <altera_avalon_mailbox.h>
Parameters: dev—the mailbox to close.
Returns: Null.
Description: altera_avalon_mailbox_close() closes the mailbox.
27-4
Mailbox API
UG-01085
2014.24.07
Altera Corporation
Mailbox Core
Send Feedback
Komentarze do niniejszej Instrukcji