CC26xx Driver Library
smph.c
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: smph.c
3 * Revised: 2015-01-13 16:59:55 +0100 (Tue, 13 Jan 2015)
4 * Revision: 42365
5 *
6 * Description: Driver for the MCU Semaphore.
7 *
8 * Copyright (c) 2015, Texas Instruments Incorporated
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * 1) Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * 2) Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may
22 * be used to endorse or promote products derived from this software without
23 * specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 ******************************************************************************/
38 
39 #include <driverlib/smph.h>
40 
41 //*****************************************************************************
42 //
43 // Handle support for DriverLib in ROM:
44 // This section will undo prototype renaming made in the header file
45 //
46 //*****************************************************************************
47 #if !defined(DOXYGEN)
48  #undef SMPHAcquire
49  #define SMPHAcquire NOROM_SMPHAcquire
50 #endif
51 
52 //*****************************************************************************
53 //
55 //
56 //*****************************************************************************
57 void
58 SMPHAcquire(uint32_t ui32Semaphore)
59 {
60  //
61  // Check the arguments.
62  //
63  ASSERT((ui32Semaphore == SMPH_0) ||
64  (ui32Semaphore == SMPH_1) ||
65  (ui32Semaphore == SMPH_2) ||
66  (ui32Semaphore == SMPH_3) ||
67  (ui32Semaphore == SMPH_4) ||
68  (ui32Semaphore == SMPH_5) ||
69  (ui32Semaphore == SMPH_6) ||
70  (ui32Semaphore == SMPH_7) ||
71  (ui32Semaphore == SMPH_8) ||
72  (ui32Semaphore == SMPH_9) ||
73  (ui32Semaphore == SMPH_10) ||
74  (ui32Semaphore == SMPH_11) ||
75  (ui32Semaphore == SMPH_12) ||
76  (ui32Semaphore == SMPH_13) ||
77  (ui32Semaphore == SMPH_14) ||
78  (ui32Semaphore == SMPH_15) ||
79  (ui32Semaphore == SMPH_16) ||
80  (ui32Semaphore == SMPH_17) ||
81  (ui32Semaphore == SMPH_18) ||
82  (ui32Semaphore == SMPH_19) ||
83  (ui32Semaphore == SMPH_20) ||
84  (ui32Semaphore == SMPH_21) ||
85  (ui32Semaphore == SMPH_22) ||
86  (ui32Semaphore == SMPH_23) ||
87  (ui32Semaphore == SMPH_24) ||
88  (ui32Semaphore == SMPH_25) ||
89  (ui32Semaphore == SMPH_26) ||
90  (ui32Semaphore == SMPH_27) ||
91  (ui32Semaphore == SMPH_28) ||
92  (ui32Semaphore == SMPH_29) ||
93  (ui32Semaphore == SMPH_30) ||
94  (ui32Semaphore == SMPH_31));
95 
96  //
97  // Wait for semaphore to be release such that it can be claimed
98  // Semaphore register reads 1 when lock was acquired otherwise 0
99  // (i.e. SMPH_CLAIMED).
100  //
101  while(HWREG(SMPH_BASE + SMPH_O_SMPH0 + 4 * ui32Semaphore) ==
102  SMPH_CLAIMED)
103  {
104  }
105 }
#define SMPH_28
Definition: smph.h:128
#define SMPH_8
Definition: smph.h:108
void SMPHAcquire(uint32_t ui32Semaphore)
Acquire a semaphore.
Definition: smph.c:58
#define SMPH_4
Definition: smph.h:104
#define SMPH_18
Definition: smph.h:118
#define SMPH_1
Definition: smph.h:101
#define SMPH_11
Definition: smph.h:111
#define SMPH_31
Definition: smph.h:131
#define SMPH_6
Definition: smph.h:106
#define SMPH_25
Definition: smph.h:125
#define SMPH_21
Definition: smph.h:121
#define SMPH_24
Definition: smph.h:124
#define SMPH_19
Definition: smph.h:119
#define SMPH_12
Definition: smph.h:112
#define SMPH_9
Definition: smph.h:109
#define SMPH_29
Definition: smph.h:129
#define SMPH_23
Definition: smph.h:123
#define ASSERT(expr)
Definition: debug.h:74
#define SMPH_17
Definition: smph.h:117
#define SMPH_13
Definition: smph.h:113
#define SMPH_0
Definition: smph.h:100
#define SMPH_26
Definition: smph.h:126
#define SMPH_2
Definition: smph.h:102
#define SMPH_14
Definition: smph.h:114
#define SMPH_30
Definition: smph.h:130
#define SMPH_5
Definition: smph.h:105
#define SMPH_10
Definition: smph.h:110
#define SMPH_27
Definition: smph.h:127
#define SMPH_15
Definition: smph.h:115
#define SMPH_16
Definition: smph.h:116
#define SMPH_7
Definition: smph.h:107
#define SMPH_20
Definition: smph.h:120
#define SMPH_3
Definition: smph.h:103
#define SMPH_22
Definition: smph.h:122
#define SMPH_CLAIMED
Definition: smph.h:92