OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [rtems/] [src/] [msgqbroadcast.c] - Blame information for rev 314

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  Message Queue Manager
3
 *
4
 *
5
 *  COPYRIGHT (c) 1989-1999.
6
 *  On-Line Applications Research Corporation (OAR).
7
 *
8
 *  The license and distribution terms for this file may be
9
 *  found in the file LICENSE in this distribution or at
10
 *  http://www.OARcorp.com/rtems/license.html.
11
 *
12
 *  $Id: msgqbroadcast.c,v 1.2 2001-09-27 11:59:19 chris Exp $
13
 */
14
 
15
#include <rtems/system.h>
16
#include <rtems/score/sysstate.h>
17
#include <rtems/score/chain.h>
18
#include <rtems/score/isr.h>
19
#include <rtems/score/coremsg.h>
20
#include <rtems/score/object.h>
21
#include <rtems/score/states.h>
22
#include <rtems/score/thread.h>
23
#include <rtems/score/wkspace.h>
24
#if defined(RTEMS_MULTIPROCESSING)
25
#include <rtems/score/mpci.h>
26
#endif
27
#include <rtems/rtems/status.h>
28
#include <rtems/rtems/attr.h>
29
#include <rtems/rtems/message.h>
30
#include <rtems/rtems/options.h>
31
#include <rtems/rtems/support.h>
32
 
33
/*PAGE
34
 *
35
 *  rtems_message_queue_broadcast
36
 *
37
 *  This directive sends a message for every thread waiting on the queue
38
 *  designated by id.
39
 *
40
 *  Input parameters:
41
 *    id     - pointer to message queue
42
 *    buffer - pointer to message buffer
43
 *    size   - size of message to broadcast
44
 *    count  - pointer to area to store number of threads made ready
45
 *
46
 *  Output parameters:
47
 *    count             - number of threads made ready
48
 *    RTEMS_SUCCESSFUL  - if successful
49
 *    error code        - if unsuccessful
50
 */
51
 
52
rtems_status_code rtems_message_queue_broadcast(
53
  Objects_Id            id,
54
  void                 *buffer,
55
  unsigned32            size,
56
  unsigned32           *count
57
)
58
{
59
  register Message_queue_Control *the_message_queue;
60
  Objects_Locations               location;
61
  CORE_message_queue_Status       core_status;
62
 
63
  the_message_queue = _Message_queue_Get( id, &location );
64
  switch ( location ) {
65
    case OBJECTS_REMOTE:
66
#if defined(RTEMS_MULTIPROCESSING)
67
      _Thread_Executing->Wait.return_argument = count;
68
 
69
      return
70
        _Message_queue_MP_Send_request_packet(
71
          MESSAGE_QUEUE_MP_BROADCAST_REQUEST,
72
          id,
73
          buffer,
74
          &size,
75
          0,                               /* option_set not used */
76
          MPCI_DEFAULT_TIMEOUT
77
        );
78
#endif
79
 
80
    case OBJECTS_ERROR:
81
      return RTEMS_INVALID_ID;
82
 
83
    case OBJECTS_LOCAL:
84
      core_status = _CORE_message_queue_Broadcast(
85
                      &the_message_queue->message_queue,
86
                      buffer,
87
                      size,
88
                      id,
89
#if defined(RTEMS_MULTIPROCESSING)
90
                      _Message_queue_Core_message_queue_mp_support,
91
#else
92
                      NULL,
93
#endif
94
                      count
95
                    );
96
 
97
      _Thread_Enable_dispatch();
98
      return
99
        _Message_queue_Translate_core_message_queue_return_code( core_status );
100
 
101
  }
102
  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
103
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.