source: rtems/c/src/libchip/shmdr/send.c @ dd9cc9f7

4.104.115
Last change on this file since dd9cc9f7 was 534c893, checked in by Joel Sherrill <joel.sherrill@…>, on 12/18/08 at 17:15:51

2008-12-18 Joel Sherrill <joel.sherrill@…>

  • libchip/shmdr/dump.c, libchip/shmdr/init.c, libchip/shmdr/send.c, libchip/shmdr/shm_driver.h: Cleanup and remove variables which duplicated data.
  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[ac7d5ef0]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 *
[08311cc3]14 *  COPYRIGHT (c) 1989-1999.
[ac7d5ef0]15 *  On-Line Applications Research Corporation (OAR).
16 *
[98e4ebf5]17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
[4e89a12]19 *  http://www.rtems.com/license/LICENSE.
[ac7d5ef0]20 *
21 *  $Id$
22 */
23
24#include <rtems.h>
[48bfd992]25#include "shm_driver.h"
[ac7d5ef0]26
27struct pkt_cpy {
[ee4f57d]28  uint32_t   packet[MAX_PACKET_SIZE/4];
[ac7d5ef0]29};
30
31rtems_mpci_entry Shm_Send_packet(
[ee4f57d]32  uint32_t   node,
[ac7d5ef0]33  rtems_packet_prefix *packet
34)
35{
36  Shm_Envelope_control *ecb, *tmp_ecb;
[ee4f57d]37  uint32_t   nnum;
[ac7d5ef0]38
39  ecb = Shm_Packet_prefix_to_envelope_control_pointer( packet );
40  if ( node ) {
41    Shm_Build_preamble( ecb, node );
42    Shm_Build_postamble( ecb );
43    Shm_Append_to_receive_queue( node, ecb );
44    (*Shm_Configuration->cause_intr)( node );
45  }
46  else {
[534c893]47    for( nnum = SHM_FIRST_NODE ; nnum <= SHM_MAXIMUM_NODES ; nnum++ )
48      if ( _Configuration_MP_table->node != nnum ) {
[ac7d5ef0]49        tmp_ecb = Shm_Allocate_envelope();
50        if ( !tmp_ecb )
51          rtems_fatal_error_occurred( SHM_NO_FREE_PKTS );
52        Shm_Build_preamble( tmp_ecb, nnum );
53        *((struct pkt_cpy *)tmp_ecb->packet) = *((struct pkt_cpy *)packet);
54        Shm_Build_postamble( tmp_ecb );
55        Shm_Append_to_receive_queue( nnum, tmp_ecb );
56        (*Shm_Configuration->cause_intr)( nnum );
57      }
58    Shm_Free_envelope( ecb );
59  }
60}
Note: See TracBrowser for help on using the repository browser.