• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*******************************************************************************
2 * Copyright (C) 2018 Cadence Design Systems, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to use this Software with Cadence processor cores only and
7 * not with any other processors and platforms, subject to
8 * the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included
11 * in all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
17 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 
21 ******************************************************************************/
22 
23 /*******************************************************************************
24  * mutex.h
25  *
26  *
27  * Implementation of "non-robust" Szymanski linear-waiting algorithm. Types of
28  * failures tolerated by Szymanski's "robust" algorithm are not specific for
29  * Xtensa DSP cluster and therefore more lightweight version of the algorithm
30  * is used. FIFO servicing property is of low importance, and faster/smaller
31  * version with linear-wait property is preferable.
32  *
33  * We assume there is just a single mutex in the system, and all communication
34  * variables are defined somewhere in board-specific headers and imported here
35  * by means of macros MUTEX_SHARED_READ/WRITE.
36  ******************************************************************************/
37 
38 #ifndef __MUTEX_H
39 #define __MUTEX_H
40 
41 /*******************************************************************************
42  * Imported macros
43  ******************************************************************************/
44 
45 #if !defined(MUTEX_SHARED_READ) || !defined(MUTEX_SHARED_WRITE)
46 #error "Macros MUTEX_SHARED_READ and/or MUTEX_SHARED_WRITE not defined"
47 #endif
48 
49 /*******************************************************************************
50  * Entry points
51  ******************************************************************************/
52 
53 /* ...acquire global mutex from i-th core */
54 extern void mutex_lock(u32 i);
55 
56 /* ...release global mutex from i-th core */
57 extern void mutex_unlock(u32 i);
58 
59 #endif  /* __MUTEX_H */
60