Documente Academic
Documente Profesional
Documente Cultură
1
Message Mailbox Management
2
Functions
• OSMboxCreate()
– Creating a mailbox
• OSMboxDel()
– Deleting a mailbox
• OSMboxPend()
– Waiting for a message
• OSMboxAccept()
– Getting a message without waiting
• OSMboxPost()
– Sending a message
• OSMboxPostOpt()
– OSMboxPost++
• OSMboxQuery()
– Obtaining the status
3
Tasks, ISRs and a
message mailbox
4
OS_EVENT_TYPE_SEM &
OS_EVENT_TYPE_MBOX
OS_EVENT_TYPE_SEM OS_EVENT_TYPE_MBOX
0x00 0x00
cnt 0x00
NULL Point to msg
0x00 … 0x00 0x00 … 0x00
5
OSMboxCreate()
6
OSMboxDel()
7
8
OSMboxPend()
9
OSMboxPend()
10
OSMboxPost()
11
OSMboxPostOpt()
• pevent
a pointer to the event control block associated with the
desired mailbox
• msg
a pointer to the message to send. You must not send a null
pointer.
• opt
determines the type of POST performed:
– OS_POST_OPT_NONE: post to a single waiting task
(Identical to OSMboxPost())
– OS_POST_OPT_BROADCAST: post to all tasks that are
waiting on the mailbox
12
13
OSMboxAccept()
14
Using a Mailbox as a Binary Semaphore
OS_EVENT *MboxSem;
15