1 /******************************************************************************
2 *  Filename:       gpio.h
3 *  Revised:        2020-09-09 19:57:34 +0200 (Wed, 09 Sep 2020)
4 *  Revision:       58572
5 *
6 *  Description:    Defines and prototypes for the GPIO.
7 *
8 *  Copyright (c) 2015 - 2020, 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 //*****************************************************************************
40 //
41 //! \addtogroup peripheral_group
42 //! @{
43 //! \addtogroup gpio_api
44 //! @{
45 //
46 //*****************************************************************************
47 
48 #ifndef __GPIO_H__
49 #define __GPIO_H__
50 
51 //*****************************************************************************
52 //
53 // If building with a C++ compiler, make all of the definitions in this header
54 // have a C binding.
55 //
56 //*****************************************************************************
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61 
62 #include <stdint.h>
63 #include "../inc/hw_types.h"
64 #include "../inc/hw_memmap.h"
65 #include "../inc/hw_gpio.h"
66 #include "debug.h"
67 
68 //*****************************************************************************
69 //
70 // Check for legal range of variable dioNumber
71 //
72 //*****************************************************************************
73 #ifdef DRIVERLIB_DEBUG
74 #include "../inc/hw_fcfg1.h"
75 #include "chipinfo.h"
76 
77 static bool
dioNumberLegal(uint32_t dioNumber)78 dioNumberLegal( uint32_t dioNumber )
79 {
80     uint32_t ioCount =
81         (( HWREG( FCFG1_BASE + FCFG1_O_IOCONF ) &
82             FCFG1_IOCONF_GPIO_CNT_M ) >>
83             FCFG1_IOCONF_GPIO_CNT_S ) ;
84 
85     // CC13x2 + CC26x2
86     if ( ChipInfo_ChipFamilyIs_CC13x2_CC26x2() )
87     {
88         return ( (dioNumber >= (31 - ioCount)) && (dioNumber < 31) )
89     }
90     // Special handling of CC13x0 7x7, where IO_CNT = 30 and legal range is 1..30
91     // for all other chips legal range is 0..(dioNumber-1)
92     else if (( ioCount == 30 ) && ChipInfo_ChipFamilyIs_CC13x0() )
93     {
94         return (( dioNumber > 0 ) && ( dioNumber <= ioCount ));
95     }
96     else
97     {
98         return ( dioNumber < ioCount );
99     }
100 
101 }
102 #endif
103 
104 //*****************************************************************************
105 //
106 // The following values define the bit field for the GPIO DIOs.
107 //
108 //*****************************************************************************
109 #define GPIO_DIO_0_MASK         0x00000001  // GPIO DIO 0 mask
110 #define GPIO_DIO_1_MASK         0x00000002  // GPIO DIO 1 mask
111 #define GPIO_DIO_2_MASK         0x00000004  // GPIO DIO 2 mask
112 #define GPIO_DIO_3_MASK         0x00000008  // GPIO DIO 3 mask
113 #define GPIO_DIO_4_MASK         0x00000010  // GPIO DIO 4 mask
114 #define GPIO_DIO_5_MASK         0x00000020  // GPIO DIO 5 mask
115 #define GPIO_DIO_6_MASK         0x00000040  // GPIO DIO 6 mask
116 #define GPIO_DIO_7_MASK         0x00000080  // GPIO DIO 7 mask
117 #define GPIO_DIO_8_MASK         0x00000100  // GPIO DIO 8 mask
118 #define GPIO_DIO_9_MASK         0x00000200  // GPIO DIO 9 mask
119 #define GPIO_DIO_10_MASK        0x00000400  // GPIO DIO 10 mask
120 #define GPIO_DIO_11_MASK        0x00000800  // GPIO DIO 11 mask
121 #define GPIO_DIO_12_MASK        0x00001000  // GPIO DIO 12 mask
122 #define GPIO_DIO_13_MASK        0x00002000  // GPIO DIO 13 mask
123 #define GPIO_DIO_14_MASK        0x00004000  // GPIO DIO 14 mask
124 #define GPIO_DIO_15_MASK        0x00008000  // GPIO DIO 15 mask
125 #define GPIO_DIO_16_MASK        0x00010000  // GPIO DIO 16 mask
126 #define GPIO_DIO_17_MASK        0x00020000  // GPIO DIO 17 mask
127 #define GPIO_DIO_18_MASK        0x00040000  // GPIO DIO 18 mask
128 #define GPIO_DIO_19_MASK        0x00080000  // GPIO DIO 19 mask
129 #define GPIO_DIO_20_MASK        0x00100000  // GPIO DIO 20 mask
130 #define GPIO_DIO_21_MASK        0x00200000  // GPIO DIO 21 mask
131 #define GPIO_DIO_22_MASK        0x00400000  // GPIO DIO 22 mask
132 #define GPIO_DIO_23_MASK        0x00800000  // GPIO DIO 23 mask
133 #define GPIO_DIO_24_MASK        0x01000000  // GPIO DIO 24 mask
134 #define GPIO_DIO_25_MASK        0x02000000  // GPIO DIO 25 mask
135 #define GPIO_DIO_26_MASK        0x04000000  // GPIO DIO 26 mask
136 #define GPIO_DIO_27_MASK        0x08000000  // GPIO DIO 27 mask
137 #define GPIO_DIO_28_MASK        0x10000000  // GPIO DIO 28 mask
138 #define GPIO_DIO_29_MASK        0x20000000  // GPIO DIO 29 mask
139 #define GPIO_DIO_30_MASK        0x40000000  // GPIO DIO 30 mask
140 #define GPIO_DIO_31_MASK        0x80000000  // GPIO DIO 31 mask
141 #define GPIO_DIO_ALL_MASK       0xFFFFFFFF  // GPIO all DIOs mask
142 
143 //*****************************************************************************
144 //
145 // Define constants that shall be passed as the outputEnableValue parameter to
146 // GPIO_setOutputEnableDio() and will be returned from the function
147 // GPIO_getOutputEnableDio().
148 //
149 //*****************************************************************************
150 #define GPIO_OUTPUT_DISABLE     0x00000000  // DIO output is disabled
151 #define GPIO_OUTPUT_ENABLE      0x00000001  // DIO output is enabled
152 
153 //*****************************************************************************
154 //
155 // API Functions and prototypes
156 //
157 //*****************************************************************************
158 
159 //*****************************************************************************
160 //
161 //! \brief Reads a specific DIO.
162 //!
163 //! \param dioNumber specifies the DIO to read (0-31).
164 //!
165 //! \return Returns 0 or 1 reflecting the input value of the specified DIO.
166 //!
167 //! \sa \ref GPIO_readMultiDio(), \ref GPIO_writeDio(), \ref GPIO_writeMultiDio()
168 //
169 //*****************************************************************************
170 __STATIC_INLINE uint32_t
171 GPIO_readDio( uint32_t dioNumber )
172 {
173     // Check the arguments.
174     ASSERT( dioNumberLegal( dioNumber ));
175 
176     // Return the input value from the specified DIO.
177     return (( HWREG( GPIO_BASE + GPIO_O_DIN31_0 ) >> dioNumber ) & 1 );
178 }
179 
180 //*****************************************************************************
181 //
182 //! \brief Reads the input value for the specified DIOs.
183 //!
184 //! This function returns the input value for multiple DIOs.
185 //! The value returned is not shifted and hence matches the corresponding dioMask bits.
186 //!
187 //! \param dioMask is the bit-mask representation of the DIOs to read.
188 //! The parameter must be a bitwise OR'ed combination of the following:
189 //! - \ref GPIO_DIO_0_MASK
190 //! - ...
191 //! - \ref GPIO_DIO_31_MASK
192 //!
193 //! \return Returns a bit vector reflecting the input value of the corresponding DIOs.
194 //! - 0 : Corresponding DIO is low.
195 //! - 1 : Corresponding DIO is high.
196 //!
197 //! \sa \ref GPIO_readDio(), \ref GPIO_writeDio(), \ref GPIO_writeMultiDio()
198 //
199 //*****************************************************************************
200 __STATIC_INLINE uint32_t
201 GPIO_readMultiDio( uint32_t dioMask )
202 {
203     // Check the arguments.
204     ASSERT( dioMask & GPIO_DIO_ALL_MASK );
205 
206     // Return the input value from the specified DIOs.
207     return ( HWREG( GPIO_BASE + GPIO_O_DIN31_0 ) & dioMask );
208 }
209 
210 //*****************************************************************************
211 //
212 //! \brief Writes a value to a specific DIO.
213 //!
214 //! \param dioNumber specifies the DIO to update (0-31).
215 //! \param value specifies the value to write
216 //! - 0 : Logic zero (low)
217 //! - 1 : Logic one (high)
218 //!
219 //! \return None
220 //!
221 //! \sa \ref GPIO_writeMultiDio(), \ref GPIO_readDio(), \ref GPIO_readMultiDio()
222 //
223 //*****************************************************************************
224 __STATIC_INLINE void
225 GPIO_writeDio( uint32_t dioNumber, uint32_t value )
226 {
227     // Check the arguments.
228     ASSERT( dioNumberLegal( dioNumber ));
229     ASSERT(( value == 0 ) || ( value == 1 ));
230 
231     // Write 0 or 1 to the byte indexed DOUT map
232     HWREGB( GPIO_BASE + dioNumber ) = value;
233 }
234 
235 //*****************************************************************************
236 //
237 //! \brief Writes masked data to the specified DIOs.
238 //!
239 //! Enables for writing multiple bits simultaneously.
240 //! The value to write must be shifted so it matches the corresponding dioMask bits.
241 //!
242 //! \note Note that this is a read-modify-write operation and hence not atomic.
243 //!
244 //! \param dioMask is the bit-mask representation of the DIOs to write.
245 //! The parameter must be a bitwise OR'ed combination of the following:
246 //! - \ref GPIO_DIO_0_MASK
247 //! - ...
248 //! - \ref GPIO_DIO_31_MASK
249 //! \param bitVectoredValue holds the value to be written to the corresponding DIO-bits.
250 //!
251 //! \return None
252 //!
253 //! \sa \ref GPIO_writeDio(), \ref GPIO_readDio(), \ref GPIO_readMultiDio()
254 //
255 //*****************************************************************************
256 __STATIC_INLINE void
257 GPIO_writeMultiDio( uint32_t dioMask, uint32_t bitVectoredValue )
258 {
259     // Check the arguments.
260     ASSERT( dioMask & GPIO_DIO_ALL_MASK );
261 
262     HWREG( GPIO_BASE + GPIO_O_DOUT31_0 ) =
263         ( HWREG( GPIO_BASE + GPIO_O_DOUT31_0 ) & ~dioMask ) |
264         ( bitVectoredValue & dioMask );
265 }
266 
267 //*****************************************************************************
268 //
269 //! \brief Sets a specific DIO to 1 (high).
270 //!
271 //! \param dioNumber specifies the DIO to set (0-31).
272 //!
273 //! \return None
274 //!
275 //! \sa \ref GPIO_setMultiDio(), \ref GPIO_clearDio(), \ref GPIO_clearMultiDio()
276 //
277 //*****************************************************************************
278 __STATIC_INLINE void
279 GPIO_setDio( uint32_t dioNumber )
280 {
281     // Check the arguments.
282     ASSERT( dioNumberLegal( dioNumber ));
283 
284     // Set the specified DIO.
285     HWREG( GPIO_BASE + GPIO_O_DOUTSET31_0 ) = ( 1 << dioNumber );
286 }
287 
288 //*****************************************************************************
289 //
290 //! \brief Sets the specified DIOs to 1 (high).
291 //!
292 //! \param dioMask is the bit-mask representation of the DIOs to set.
293 //! The parameter must be a bitwise OR'ed combination of the following:
294 //! - \ref GPIO_DIO_0_MASK
295 //! - ...
296 //! - \ref GPIO_DIO_31_MASK
297 //!
298 //! \return None
299 //!
300 //! \sa \ref GPIO_setDio(), \ref GPIO_clearDio(), \ref GPIO_clearMultiDio()
301 //
302 //*****************************************************************************
303 __STATIC_INLINE void
304 GPIO_setMultiDio( uint32_t dioMask )
305 {
306     // Check the arguments.
307     ASSERT( dioMask & GPIO_DIO_ALL_MASK );
308 
309     // Set the DIOs.
310     HWREG( GPIO_BASE + GPIO_O_DOUTSET31_0 ) = dioMask;
311 }
312 
313 //*****************************************************************************
314 //
315 //! \brief Clears a specific DIO to 0 (low).
316 //!
317 //! \param dioNumber specifies the DIO to clear (0-31).
318 //!
319 //! \return None
320 //!
321 //! \sa \ref GPIO_clearMultiDio(), \ref GPIO_setDio(), \ref GPIO_setMultiDio()
322 //
323 //*****************************************************************************
324 __STATIC_INLINE void
325 GPIO_clearDio( uint32_t dioNumber )
326 {
327     // Check the arguments.
328     ASSERT( dioNumberLegal( dioNumber ));
329 
330     // Clear the specified DIO.
331     HWREG( GPIO_BASE + GPIO_O_DOUTCLR31_0 ) = ( 1 << dioNumber );
332 }
333 
334 //*****************************************************************************
335 //
336 //! \brief Clears the specified DIOs to 0 (low).
337 //!
338 //! \param dioMask is the bit-mask representation of the DIOs to clear.
339 //! The parameter must be a bitwise OR'ed combination of the following:
340 //! - \ref GPIO_DIO_0_MASK
341 //! - ...
342 //! - \ref GPIO_DIO_31_MASK
343 //!
344 //! \return None
345 //!
346 //! \sa \ref GPIO_clearDio(), \ref GPIO_setDio(), \ref GPIO_setMultiDio()
347 //
348 //*****************************************************************************
349 __STATIC_INLINE void
350 GPIO_clearMultiDio( uint32_t dioMask )
351 {
352     // Check the arguments.
353     ASSERT( dioMask & GPIO_DIO_ALL_MASK );
354 
355     // Clear the DIOs.
356     HWREG( GPIO_BASE + GPIO_O_DOUTCLR31_0 ) = dioMask;
357 }
358 
359 //*****************************************************************************
360 //
361 //! \brief Toggles a specific DIO.
362 //!
363 //! \param dioNumber specifies the DIO to toggle (0-31).
364 //!
365 //! \return None
366 //!
367 //! \sa \ref GPIO_toggleMultiDio()
368 //
369 //*****************************************************************************
370 __STATIC_INLINE void
371 GPIO_toggleDio( uint32_t dioNumber )
372 {
373     // Check the arguments.
374     ASSERT( dioNumberLegal( dioNumber ));
375 
376     // Toggle the specified DIO.
377     HWREG( GPIO_BASE + GPIO_O_DOUTTGL31_0 ) = ( 1 << dioNumber );
378 }
379 
380 //*****************************************************************************
381 //
382 //! \brief Toggles the specified DIOs.
383 //!
384 //! \param dioMask is the bit-mask representation of the DIOs to toggle.
385 //! The parameter must be a bitwise OR'ed combination of the following:
386 //! - \ref GPIO_DIO_0_MASK
387 //! - ...
388 //! - \ref GPIO_DIO_31_MASK
389 //!
390 //! \return None
391 //!
392 //! \sa \ref GPIO_toggleDio()
393 //
394 //*****************************************************************************
395 __STATIC_INLINE void
396 GPIO_toggleMultiDio( uint32_t dioMask )
397 {
398     // Check the arguments.
399     ASSERT( dioMask & GPIO_DIO_ALL_MASK );
400 
401     // Toggle the DIOs.
402     HWREG( GPIO_BASE + GPIO_O_DOUTTGL31_0 ) = dioMask;
403 }
404 
405 //*****************************************************************************
406 //
407 //! \brief Gets the output enable status of a specific DIO.
408 //!
409 //! This function returns the output enable status for the specified DIO.
410 //! The DIO can be configured as either input or output under software control.
411 //!
412 //! \param dioNumber specifies the DIO to get the output enable setting from (0-31).
413 //!
414 //! \return Returns one of the enumerated data types (0 or 1):
415 //! - \ref GPIO_OUTPUT_DISABLE : DIO output is disabled.
416 //! - \ref GPIO_OUTPUT_ENABLE  : DIO output is enabled.
417 //!
418 //! \sa \ref GPIO_getOutputEnableMultiDio(), \ref GPIO_setOutputEnableDio(), \ref GPIO_setOutputEnableMultiDio()
419 //
420 //*****************************************************************************
421 __STATIC_INLINE uint32_t
422 GPIO_getOutputEnableDio( uint32_t dioNumber )
423 {
424     // Check the arguments.
425     ASSERT( dioNumberLegal( dioNumber ));
426 
427     // Return the output enable status for the specified DIO.
428     return (( HWREG( GPIO_BASE + GPIO_O_DOE31_0 ) >> dioNumber ) & 1 );
429 }
430 
431 //*****************************************************************************
432 //
433 //! \brief Gets the output enable setting of the specified DIOs.
434 //!
435 //! This function returns the output enable setting for multiple DIOs.
436 //! The value returned is not shifted and hence matches the corresponding dioMask bits.
437 //!
438 //! \param dioMask is the bit-mask representation of the DIOs to return the output enable settings from.
439 //! The parameter must be a bitwise OR'ed combination of the following:
440 //! - \ref GPIO_DIO_0_MASK
441 //! - ...
442 //! - \ref GPIO_DIO_31_MASK
443 //!
444 //! \return Returns the output enable setting for multiple DIOs as a bit vector corresponding to the dioMask bits.
445 //! - 0 : Corresponding DIO is configured with output disabled.
446 //! - 1 : Corresponding DIO is configured with output enabled.
447 //!
448 //! \sa \ref GPIO_getOutputEnableDio(), \ref GPIO_setOutputEnableDio(), \ref GPIO_setOutputEnableMultiDio()
449 //
450 //*****************************************************************************
451 __STATIC_INLINE uint32_t
452 GPIO_getOutputEnableMultiDio( uint32_t dioMask )
453 {
454     // Check the arguments.
455     ASSERT( dioMask & GPIO_DIO_ALL_MASK );
456 
457     // Return the output enable value for the specified DIOs.
458     return ( HWREG( GPIO_BASE + GPIO_O_DOE31_0 ) & dioMask );
459 }
460 
461 //*****************************************************************************
462 //
463 //! \brief Sets output enable of a specific DIO.
464 //!
465 //! This function sets the GPIO output enable bit for the specified DIO.
466 //! The DIO can be configured as either input or output under software control.
467 //!
468 //! \param dioNumber specifies the DIO to configure (0-31).
469 //! \param outputEnableValue specifies the output enable setting of the specified DIO:
470 //! - \ref GPIO_OUTPUT_DISABLE : DIO output is disabled.
471 //! - \ref GPIO_OUTPUT_ENABLE  : DIO output is enabled.
472 //!
473 //! \return None
474 //!
475 //! \sa \ref GPIO_setOutputEnableMultiDio(), \ref GPIO_getOutputEnableDio(), \ref GPIO_getOutputEnableMultiDio()
476 //
477 //*****************************************************************************
478 __STATIC_INLINE void
479 GPIO_setOutputEnableDio( uint32_t dioNumber, uint32_t outputEnableValue )
480 {
481     // Check the arguments.
482     ASSERT( dioNumberLegal( dioNumber ));
483     ASSERT(( outputEnableValue == GPIO_OUTPUT_DISABLE ) ||
484            ( outputEnableValue == GPIO_OUTPUT_ENABLE  )    );
485 
486     // Update the output enable bit for the specified DIO.
487     HWREGBITW( GPIO_BASE + GPIO_O_DOE31_0, dioNumber ) = outputEnableValue;
488 }
489 
490 //*****************************************************************************
491 //
492 //! \brief Configures the output enable setting for all specified DIOs.
493 //!
494 //! This function configures the output enable setting for the specified DIOs.
495 //! The output enable setting must be shifted so it matches the corresponding dioMask bits.
496 //! The DIOs can be configured as either an input or output under software control.
497 //!
498 //! \note Note that this is a read-modify-write operation and hence not atomic.
499 //!
500 //! \param dioMask is the bit-mask representation of the DIOs on which to configure the
501 //! output enable setting. The parameter must be a bitwise OR'ed combination of the following:
502 //! - \ref GPIO_DIO_0_MASK
503 //! - ...
504 //! - \ref GPIO_DIO_31_MASK
505 //! \param bitVectoredOutputEnable holds the output enable setting the corresponding DIO-bits:
506 //! - 0 : Corresponding DIO is configured with output disabled.
507 //! - 1 : Corresponding DIO is configured with output enabled.
508 //!
509 //! \return None
510 //!
511 //! \sa \ref GPIO_setOutputEnableDio(), \ref GPIO_getOutputEnableDio(), \ref GPIO_getOutputEnableMultiDio()
512 //
513 //*****************************************************************************
514 __STATIC_INLINE void
515 GPIO_setOutputEnableMultiDio( uint32_t dioMask, uint32_t bitVectoredOutputEnable )
516 {
517     // Check the arguments.
518     ASSERT( dioMask & GPIO_DIO_ALL_MASK );
519 
520     HWREG( GPIO_BASE + GPIO_O_DOE31_0 ) =
521         ( HWREG( GPIO_BASE + GPIO_O_DOE31_0 ) & ~dioMask ) |
522         ( bitVectoredOutputEnable & dioMask );
523 }
524 
525 //*****************************************************************************
526 //
527 //! \brief Gets the event status of a specific DIO.
528 //!
529 //! \param dioNumber specifies the DIO to get the event status from (0-31).
530 //!
531 //! \return Returns the current event status on the specified DIO.
532 //! - 0 : Non-triggered event.
533 //! - 1 : Triggered event.
534 //!
535 //! \sa \ref GPIO_getEventMultiDio(), \ref GPIO_clearEventDio(), \ref GPIO_clearEventMultiDio()
536 //
537 //*****************************************************************************
538 __STATIC_INLINE uint32_t
539 GPIO_getEventDio( uint32_t dioNumber )
540 {
541     // Check the arguments.
542     ASSERT( dioNumberLegal( dioNumber ));
543 
544     // Return the event status for the specified DIO.
545     return (( HWREG( GPIO_BASE + GPIO_O_EVFLAGS31_0 ) >> dioNumber ) & 1 );
546 }
547 
548 //*****************************************************************************
549 //
550 //! \brief Gets the event status of the specified DIOs.
551 //!
552 //! This function returns the event status for multiple DIOs.
553 //! The value returned is not shifted and hence matches the corresponding dioMask bits.
554 //!
555 //! \param dioMask is the bit-mask representation of the DIOs to get the
556 //! event status from (0-31).
557 //! The parameter must be a bitwise OR'ed combination of the following:
558 //! - \ref GPIO_DIO_0_MASK
559 //! - ...
560 //! - \ref GPIO_DIO_31_MASK
561 //!
562 //! \return Returns a bit vector with the current event status corresponding to the specified DIOs.
563 //! - 0 : Corresponding DIO has no triggered event.
564 //! - 1 : Corresponding DIO has a triggered event.
565 //!
566 //! \sa \ref GPIO_getEventDio(), \ref GPIO_clearEventDio(), \ref GPIO_clearEventMultiDio()
567 //
568 //*****************************************************************************
569 __STATIC_INLINE uint32_t
570 GPIO_getEventMultiDio( uint32_t dioMask )
571 {
572     // Check the arguments.
573     ASSERT( dioMask & GPIO_DIO_ALL_MASK );
574 
575     // Return the event status for the specified DIO.
576     return ( HWREG( GPIO_BASE + GPIO_O_EVFLAGS31_0 ) & dioMask );
577 }
578 
579 //*****************************************************************************
580 //
581 //! \brief Clears the IO event status of a specific DIO.
582 //!
583 //! \param dioNumber specifies the DIO on which to clear the event status (0-31).
584 //!
585 //! \return None
586 //!
587 //! \sa \ref GPIO_clearEventMultiDio(), \ref GPIO_getEventDio(), \ref GPIO_getEventMultiDio()
588 //
589 //*****************************************************************************
590 __STATIC_INLINE void
591 GPIO_clearEventDio( uint32_t dioNumber )
592 {
593     // Check the arguments.
594     ASSERT( dioNumberLegal( dioNumber ));
595 
596     // Clear the event status for the specified DIO.
597     HWREG( GPIO_BASE + GPIO_O_EVFLAGS31_0 ) = ( 1 << dioNumber );
598 }
599 
600 //*****************************************************************************
601 //
602 //! \brief Clears the IO event status on the specified DIOs.
603 //!
604 //! \param dioMask is the bit-mask representation of the DIOs on which to
605 //! clear the events status.
606 //! The parameter must be a bitwise OR'ed combination of the following:
607 //! - \ref GPIO_DIO_0_MASK
608 //! - ...
609 //! - \ref GPIO_DIO_31_MASK
610 //!
611 //! \return None
612 //!
613 //! \sa \ref GPIO_clearEventDio(), \ref GPIO_getEventDio(), \ref GPIO_getEventMultiDio()
614 //
615 //*****************************************************************************
616 __STATIC_INLINE void
617 GPIO_clearEventMultiDio( uint32_t dioMask )
618 {
619     // Check the arguments.
620     ASSERT( dioMask & GPIO_DIO_ALL_MASK );
621 
622     // Clear the event status for the specified DIOs.
623     HWREG( GPIO_BASE + GPIO_O_EVFLAGS31_0 ) = dioMask;
624 }
625 
626 //*****************************************************************************
627 //
628 // Mark the end of the C bindings section for C++ compilers.
629 //
630 //*****************************************************************************
631 #ifdef __cplusplus
632 }
633 #endif
634 
635 #endif // __GPIO_H__
636 
637 //*****************************************************************************
638 //
639 //! Close the Doxygen group.
640 //! @}
641 //! @}
642 //
643 //*****************************************************************************
644