CC26xx Driver Library
Main Page
Related Pages
CC26xx APIs
Register Descriptions
Online Resources
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
smph.c
Go to the documentation of this file.
1
/******************************************************************************
2
* Filename: smph.c
3
* Revised: 2015-01-13 16:59:55 +0100 (ti, 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
#ifndef DRIVERLIB_GENERATE_ROM
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
}
SMPH_28
#define SMPH_28
Definition:
smph.h:128
SMPH_8
#define SMPH_8
Definition:
smph.h:108
SMPHAcquire
void SMPHAcquire(uint32_t ui32Semaphore)
Acquire a semaphore.
Definition:
smph.c:58
SMPH_4
#define SMPH_4
Definition:
smph.h:104
SMPH_18
#define SMPH_18
Definition:
smph.h:118
SMPH_1
#define SMPH_1
Definition:
smph.h:101
SMPH_11
#define SMPH_11
Definition:
smph.h:111
SMPH_31
#define SMPH_31
Definition:
smph.h:131
ASSERT
#define ASSERT(expr)
Definition:
debug.h:65
SMPH_6
#define SMPH_6
Definition:
smph.h:106
SMPH_25
#define SMPH_25
Definition:
smph.h:125
SMPH_21
#define SMPH_21
Definition:
smph.h:121
SMPH_24
#define SMPH_24
Definition:
smph.h:124
SMPH_19
#define SMPH_19
Definition:
smph.h:119
SMPH_12
#define SMPH_12
Definition:
smph.h:112
SMPH_9
#define SMPH_9
Definition:
smph.h:109
SMPH_29
#define SMPH_29
Definition:
smph.h:129
SMPH_23
#define SMPH_23
Definition:
smph.h:123
smph.h
SMPH_17
#define SMPH_17
Definition:
smph.h:117
SMPH_13
#define SMPH_13
Definition:
smph.h:113
SMPH_0
#define SMPH_0
Definition:
smph.h:100
SMPH_26
#define SMPH_26
Definition:
smph.h:126
SMPH_2
#define SMPH_2
Definition:
smph.h:102
SMPH_14
#define SMPH_14
Definition:
smph.h:114
SMPH_30
#define SMPH_30
Definition:
smph.h:130
SMPH_5
#define SMPH_5
Definition:
smph.h:105
SMPH_10
#define SMPH_10
Definition:
smph.h:110
SMPH_27
#define SMPH_27
Definition:
smph.h:127
SMPH_15
#define SMPH_15
Definition:
smph.h:115
SMPH_16
#define SMPH_16
Definition:
smph.h:116
SMPH_7
#define SMPH_7
Definition:
smph.h:107
SMPH_20
#define SMPH_20
Definition:
smph.h:120
SMPH_3
#define SMPH_3
Definition:
smph.h:103
SMPH_22
#define SMPH_22
Definition:
smph.h:122
SMPH_CLAIMED
#define SMPH_CLAIMED
Definition:
smph.h:92
driverlib
smph.c
© Copyright 2015 Texas Instruments Incorporated. All rights reserved.