source: rtems/bsps/shared/shmdr/shmdr-getlq.c @ 762fa62

5
Last change on this file since 762fa62 was 4b28d3c, checked in by Sebastian Huber <sebastian.huber@…>, on 04/04/18 at 14:39:58

bsps: Move shmdr to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*  Shm_Envelope_control *Shm_Locked_queue_Get( lq_cb )
2 *
3 *  This routine returns an envelope control block from a shared
4 *  memory queue.
5 *
6 *  Input parameters:
7 *    lq_cb - pointer to a locked queue control block
8 *
9 *  Output parameters:
10 *    returns - pointer to an envelope control block
11 *            - NULL if no envelopes on specified queue
12 *
13 *  COPYRIGHT (c) 1989-1999.
14 *  On-Line Applications Research Corporation (OAR).
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.rtems.org/license/LICENSE.
19 */
20
21#include <rtems.h>
22#include <shm_driver.h>
23
24Shm_Envelope_control *Shm_Locked_queue_Get(
25  Shm_Locked_queue_Control *lq_cb
26)
27{
28  Shm_Envelope_control *tmp_ecb;
29  uint32_t   tmpfront;
30
31  tmp_ecb = NULL;
32  Shm_Lock( lq_cb );
33
34    tmpfront = Shm_Convert(lq_cb->front);
35    if ( tmpfront != Shm_Locked_queue_End_of_list ) {
36      tmp_ecb = &Shm_Envelopes[ tmpfront ];
37      lq_cb->front = tmp_ecb->next;
38      if ( tmp_ecb->next == Shm_Locked_queue_End_of_list )
39        lq_cb->rear = Shm_Locked_queue_End_of_list;
40      tmp_ecb->next = Shm_Locked_queue_Not_on_list;
41    }
42
43  Shm_Unlock( lq_cb );
44  return( tmp_ecb );
45}
Note: See TracBrowser for help on using the repository browser.