1
1
/*
2
2
* Copyright (c) 2016, Freescale Semiconductor, Inc.
3
+ * Copyright 2016-2018 NXP
3
4
* All rights reserved.
4
5
*
5
- * Redistribution and use in source and binary forms, with or without modification,
6
- * are permitted provided that the following conditions are met:
7
- *
8
- * o Redistributions of source code must retain the above copyright notice, this list
9
- * of conditions and the following disclaimer.
10
- *
11
- * o Redistributions in binary form must reproduce the above copyright notice, this
12
- * list of conditions and the following disclaimer in the documentation and/or
13
- * other materials provided with the distribution.
14
- *
15
- * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16
- * contributors may be used to endorse or promote products derived from this
17
- * software without specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
- * DISCLAIMED. IN NO EVENT SDRVL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6
+ * SPDX-License-Identifier: BSD-3-Clause
29
7
*/
30
8
31
9
#ifndef _LPC_GPIO_H_
46
24
47
25
/*! @name Driver version */
48
26
/*@{*/
49
- /*! @brief LPC GPIO driver version 1.0.0 . */
50
- #define FSL_GPIO_DRIVER_VERSION (MAKE_VERSION(1, 0, 0 ))
27
+ /*! @brief LPC GPIO driver version 2.1.3 . */
28
+ #define FSL_GPIO_DRIVER_VERSION (MAKE_VERSION(2, 1, 3 ))
51
29
/*@}*/
52
30
53
31
/*! @brief LPC GPIO direction definition */
@@ -80,6 +58,16 @@ extern "C" {
80
58
/*! @name GPIO Configuration */
81
59
/*@{*/
82
60
61
+ /*!
62
+ * @brief Initializes the GPIO peripheral.
63
+ *
64
+ * This function ungates the GPIO clock.
65
+ *
66
+ * @param base GPIO peripheral base pointer.
67
+ * @param port GPIO port number.
68
+ */
69
+ void GPIO_PortInit (GPIO_Type * base , uint32_t port );
70
+
83
71
/*!
84
72
* @brief Initializes a GPIO pin used by the board.
85
73
*
@@ -124,10 +112,11 @@ void GPIO_PinInit(GPIO_Type *base, uint32_t port, uint32_t pin, const gpio_pin_c
124
112
* - 0: corresponding pin output low-logic level.
125
113
* - 1: corresponding pin output high-logic level.
126
114
*/
127
- static inline void GPIO_WritePinOutput (GPIO_Type * base , uint32_t port , uint32_t pin , uint8_t output )
115
+ static inline void GPIO_PinWrite (GPIO_Type * base , uint32_t port , uint32_t pin , uint8_t output )
128
116
{
129
117
base -> B [port ][pin ] = output ;
130
118
}
119
+
131
120
/*@}*/
132
121
/*! @name GPIO Input Operations */
133
122
/*@{*/
@@ -142,10 +131,11 @@ static inline void GPIO_WritePinOutput(GPIO_Type *base, uint32_t port, uint32_t
142
131
* - 0: corresponding pin input low-logic level.
143
132
* - 1: corresponding pin input high-logic level.
144
133
*/
145
- static inline uint32_t GPIO_ReadPinInput (GPIO_Type * base , uint32_t port , uint32_t pin )
134
+ static inline uint32_t GPIO_PinRead (GPIO_Type * base , uint32_t port , uint32_t pin )
146
135
{
147
136
return (uint32_t )base -> B [port ][pin ];
148
137
}
138
+
149
139
/*@}*/
150
140
151
141
/*!
@@ -155,7 +145,7 @@ static inline uint32_t GPIO_ReadPinInput(GPIO_Type *base, uint32_t port, uint32_
155
145
* @param port GPIO port number
156
146
* @param mask GPIO pin number macro
157
147
*/
158
- static inline void GPIO_SetPinsOutput (GPIO_Type * base , uint32_t port , uint32_t mask )
148
+ static inline void GPIO_PortSet (GPIO_Type * base , uint32_t port , uint32_t mask )
159
149
{
160
150
base -> SET [port ] = mask ;
161
151
}
@@ -167,7 +157,7 @@ static inline void GPIO_SetPinsOutput(GPIO_Type *base, uint32_t port, uint32_t m
167
157
* @param port GPIO port number
168
158
* @param mask GPIO pin number macro
169
159
*/
170
- static inline void GPIO_ClearPinsOutput (GPIO_Type * base , uint32_t port , uint32_t mask )
160
+ static inline void GPIO_PortClear (GPIO_Type * base , uint32_t port , uint32_t mask )
171
161
{
172
162
base -> CLR [port ] = mask ;
173
163
}
@@ -179,10 +169,11 @@ static inline void GPIO_ClearPinsOutput(GPIO_Type *base, uint32_t port, uint32_t
179
169
* @param port GPIO port number
180
170
* @param mask GPIO pin number macro
181
171
*/
182
- static inline void GPIO_TogglePinsOutput (GPIO_Type * base , uint32_t port , uint32_t mask )
172
+ static inline void GPIO_PortToggle (GPIO_Type * base , uint32_t port , uint32_t mask )
183
173
{
184
174
base -> NOT [port ] = mask ;
185
175
}
176
+
186
177
/*@}*/
187
178
188
179
/*!
@@ -191,7 +182,7 @@ static inline void GPIO_TogglePinsOutput(GPIO_Type *base, uint32_t port, uint32_
191
182
* @param base GPIO peripheral base pointer(Typically GPIO)
192
183
* @param port GPIO port number
193
184
*/
194
- static inline uint32_t GPIO_ReadPinsInput (GPIO_Type * base , uint32_t port )
185
+ static inline uint32_t GPIO_PortRead (GPIO_Type * base , uint32_t port )
195
186
{
196
187
return (uint32_t )base -> PIN [port ];
197
188
}
@@ -207,7 +198,7 @@ static inline uint32_t GPIO_ReadPinsInput(GPIO_Type *base, uint32_t port)
207
198
* @param port GPIO port number
208
199
* @param mask GPIO pin number macro
209
200
*/
210
- static inline void GPIO_SetPortMask (GPIO_Type * base , uint32_t port , uint32_t mask )
201
+ static inline void GPIO_PortMaskedSet (GPIO_Type * base , uint32_t port , uint32_t mask )
211
202
{
212
203
base -> MASK [port ] = mask ;
213
204
}
@@ -219,7 +210,7 @@ static inline void GPIO_SetPortMask(GPIO_Type *base, uint32_t port, uint32_t mas
219
210
* @param port GPIO port number
220
211
* @param output GPIO port output value.
221
212
*/
222
- static inline void GPIO_WriteMPort (GPIO_Type * base , uint32_t port , uint32_t output )
213
+ static inline void GPIO_PortMaskedWrite (GPIO_Type * base , uint32_t port , uint32_t output )
223
214
{
224
215
base -> MPIN [port ] = output ;
225
216
}
@@ -232,7 +223,7 @@ static inline void GPIO_WriteMPort(GPIO_Type *base, uint32_t port, uint32_t outp
232
223
* @param port GPIO port number
233
224
* @retval masked GPIO port value
234
225
*/
235
- static inline uint32_t GPIO_ReadMPort (GPIO_Type * base , uint32_t port )
226
+ static inline uint32_t GPIO_PortMaskedRead (GPIO_Type * base , uint32_t port )
236
227
{
237
228
return (uint32_t )base -> MPIN [port ];
238
229
}
0 commit comments