source: rtems/c/src/libchip/shmdr/send.c @ 40a24661

4.115
Last change on this file since 40a24661 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*  Shm_Send_packet
2 *
3 *  This routine is the shared memory driver locked queue write
4 *  MPCI driver routine.  This routine sends the specified packet
5 *  to the destination specified by "node".  A "node" value of
6 *  zero designates that this packet is to be broadcasted.
7 *
8 *  Input parameters:
9 *    node          - destination of this packet (0 = broadcast)
10 *    packet        - address of packet
11 *
12 *  Output parameters: NONE
13 *
14 *  COPYRIGHT (c) 1989-1999.
15 *  On-Line Applications Research Corporation (OAR).
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.org/license/LICENSE.
20 */
21
22#include <rtems.h>
23#include "shm_driver.h"
24
25struct pkt_cpy {
26  uint32_t   packet[MAX_PACKET_SIZE/4];
27};
28
29rtems_mpci_entry Shm_Send_packet(
30  uint32_t   node,
31  rtems_packet_prefix *packet
32)
33{
34  Shm_Envelope_control *ecb, *tmp_ecb;
35  uint32_t   nnum;
36
37  ecb = Shm_Packet_prefix_to_envelope_control_pointer( packet );
38  if ( node ) {
39    Shm_Build_preamble( ecb, node );
40    Shm_Build_postamble( ecb );
41    Shm_Append_to_receive_queue( node, ecb );
42    (*Shm_Configuration->cause_intr)( node );
43  }
44  else {
45    for( nnum = SHM_FIRST_NODE ; nnum <= SHM_MAXIMUM_NODES ; nnum++ )
46      if ( _Configuration_MP_table->node != nnum ) {
47        tmp_ecb = Shm_Allocate_envelope();
48        if ( !tmp_ecb )
49          rtems_fatal_error_occurred( SHM_NO_FREE_PKTS );
50        Shm_Build_preamble( tmp_ecb, nnum );
51        *((struct pkt_cpy *)tmp_ecb->packet) = *((struct pkt_cpy *)packet);
52        Shm_Build_postamble( tmp_ecb );
53        Shm_Append_to_receive_queue( nnum, tmp_ecb );
54        (*Shm_Configuration->cause_intr)( nnum );
55      }
56    Shm_Free_envelope( ecb );
57  }
58}
Note: See TracBrowser for help on using the repository browser.