source: rtems/cpukit/rtems/src/msgqbroadcast.c @ 1d496f6

4.104.114.84.9
Last change on this file since 1d496f6 was 1d496f6, checked in by Ralf Corsepius <ralf.corsepius@…>, on Mar 29, 2004 at 4:04:42 PM

2004-03-29 Ralf Corsepius <ralf_corsepius@…>

  • rtems/include/rtems.h, rtems/include/rtems/rtems/asr.h, rtems/include/rtems/rtems/attr.h, rtems/include/rtems/rtems/clock.h, rtems/include/rtems/rtems/config.h, rtems/include/rtems/rtems/dpmem.h, rtems/include/rtems/rtems/eventset.h, rtems/include/rtems/rtems/message.h, rtems/include/rtems/rtems/modes.h, rtems/include/rtems/rtems/msgmp.h, rtems/include/rtems/rtems/options.h, rtems/include/rtems/rtems/part.h, rtems/include/rtems/rtems/ratemon.h, rtems/include/rtems/rtems/region.h, rtems/include/rtems/rtems/regionmp.h, rtems/include/rtems/rtems/sem.h, rtems/include/rtems/rtems/support.h, rtems/include/rtems/rtems/taskmp.h, rtems/include/rtems/rtems/tasks.h, rtems/include/rtems/rtems/timer.h, rtems/inline/rtems/rtems/part.inl, rtems/inline/rtems/rtems/region.inl, rtems/macros/rtems/rtems/part.inl, rtems/src/attr.c, rtems/src/dpmem.c, rtems/src/dpmemcreate.c, rtems/src/dpmemexternal2internal.c, rtems/src/dpmeminternal2external.c, rtems/src/eventseize.c, rtems/src/msg.c, rtems/src/msgmp.c, rtems/src/msgqallocate.c, rtems/src/msgqbroadcast.c, rtems/src/msgqcreate.c, rtems/src/msgqflush.c, rtems/src/msgqgetnumberpending.c, rtems/src/msgqident.c, rtems/src/msgqreceive.c, rtems/src/msgqsend.c, rtems/src/msgqsubmit.c, rtems/src/msgqtranslatereturncode.c, rtems/src/msgqurgent.c, rtems/src/part.c, rtems/src/partcreate.c, rtems/src/partident.c, rtems/src/partmp.c, rtems/src/ratemon.c, rtems/src/region.c, rtems/src/regioncreate.c, rtems/src/regionextend.c, rtems/src/regiongetsegment.c, rtems/src/regiongetsegmentsize.c, rtems/src/regionmp.c, rtems/src/regionreturnsegment.c, rtems/src/rtemstimer.c, rtems/src/sem.c, rtems/src/semcreate.c, rtems/src/semident.c, rtems/src/semmp.c, rtems/src/semobtain.c, rtems/src/semtranslatereturncode.c, rtems/src/taskcreate.c, rtems/src/taskgetnote.c, rtems/src/taskident.c, rtems/src/taskinitusers.c, rtems/src/taskmp.c, rtems/src/taskrestart.c, rtems/src/tasks.c, rtems/src/tasksetnote.c, rtems/src/taskstart.c, rtems/src/timerserver.c: Convert to using c99 fixed size types.
  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*
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.rtems.com/license/LICENSE.
11 *
12 *  $Id$
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
52rtems_status_code rtems_message_queue_broadcast(
53  Objects_Id            id,
54  void                 *buffer,
55  uint32_t              size,
56  uint32_t             *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}
Note: See TracBrowser for help on using the repository browser.