
2. TASK CONTROL FUNCTION
B–61863E–1/06
PMC CONTROL SOFTWARE
78
(3) Sending a packet
To send a packet, use the system call, os_send_pkt. When a packet
is sent, the task ID of the receiving task must be specified. The sent
packet is then linked to the packet queue of the receiving task.
Since packets consist of dynamic links, the receiving task waits for
the arrival of a packet, but the sending task does not wait for sending.
Therefore, tasks can send a packet whenever they want. When a
packet has been sent, the ownership of the packet is transferred to the
destination.
CAUTION
Do not send a packet without its ownership.
Target ID 10
Task A
Target ID 11
Target ID 12
Task ID 10
Task ID 11
Task ID 12
Queue
j j j j
Queue
j j j j
Queue
j j j j
(4) Receiving a packet
To receive a packet, use the system call, os_recv_pkt. If there are any
packets in the packet queue of the receiving task, the task detaches a
packet from the top of the packet queue, then returns the packet
address. If the packet queue is empty, the task enters the wait state.
(5) Specifying packet sending priority
For faster packet notification, a priority can be given to a packet when
it is sent. Specifiable packet priorities range from 0 to 255.
D Packets of equal priority are enqueued in FIFO order.
D When priority 0 is specified for a packet, it is attached to the top
of the queue. In this case, the queue becomes an LIFO (Last
In-First Out) queue. (The packet is enqueued in the same way
even when another packet with priority 0 specification is already
placed in the queue.)
os_send_pkt 3 j
os_send_pkt 2 Jj
os_send_pkt 2 jJj
os_send_pkt 1 Jjjj
os_send_pkt 0 Jjjjj
os_send_pkt 0 Jjjjjj
Priority Packet queue