source: rtems/bsps/powerpc/psim/mpci/lock.c @ c3b609d5

5
Last change on this file since c3b609d5 was 1efa1c8, checked in by Sebastian Huber <sebastian.huber@…>, on 04/20/18 at 11:38:33

bsps: Move MPCI support to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*  Shared Memory Lock Routines
2 *
3 *  This shared memory locked queue support routine need to be
4 *  able to lock the specified locked queue.  Interrupts are
5 *  disabled while the queue is locked to prevent preemption
6 *  and deadlock when two tasks poll for the same lock.
7 *  previous level.
8 *
9 *  COPYRIGHT (c) 1989-2008.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may in
13 *  the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#include <rtems.h>
18#include <bsp.h>
19#include <shm_driver.h>
20#include <psim.h>
21
22/*
23 *  Shm_Initialize_lock
24 *
25 *  Initialize the lock for the specified locked queue.
26 */
27
28void Shm_Initialize_lock(
29  Shm_Locked_queue_Control *lq_cb
30)
31{
32  /* nothing required -- done implicitly by device tree */
33}
34
35/*  void _Shm_Lock( &lq_cb )
36 *
37 *  This shared memory locked queue support routine locks the
38 *  specified locked queue.  It disables interrupts to prevent
39 *  a deadlock condition.
40 */
41
42static rtems_interrupt_level level;
43
44void Shm_Lock(
45  Shm_Locked_queue_Control *lq_cb
46)
47{
48  rtems_interrupt_disable( level );
49    (void) PSIM.Semaphore.lock;
50}
51
52/*
53 *  Shm_Unlock
54 *
55 *  Unlock the lock for the specified locked queue.
56 */
57
58void Shm_Unlock(
59  Shm_Locked_queue_Control *lq_cb
60)
61{
62    (void) PSIM.Semaphore.unlock;
63  rtems_interrupt_enable( level );
64}
Note: See TracBrowser for help on using the repository browser.