1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2017, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * *  Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  * --/COPYRIGHT--*/
32 #ifndef __PMAP_H__
33 #define __PMAP_H__
34 
35 //*****************************************************************************
36 //
37 //! \addtogroup pmap_api
38 //! @{
39 //
40 //*****************************************************************************
41 
42 //*****************************************************************************
43 //
44 // If building with a C++ compiler, make all of the definitions in this header
45 // have a C binding.
46 //
47 //*****************************************************************************
48 #ifdef __cplusplus
49 extern "C"
50 {
51 #endif
52 
53 #include <stdint.h>
54 #include <ti/devices/msp432p4xx/inc/msp.h>
55 
56 //*****************************************************************************
57 //
58 //The following are values that can be passed to the PMAP_configurePorts() API
59 //as the portMapReconfigure parameter.
60 //
61 //*****************************************************************************
62 #define PMAP_ENABLE_RECONFIGURATION     PMAP_CTL_PRECFG
63 #define PMAP_DISABLE_RECONFIGURATION    0x00
64 
65 //*****************************************************************************
66 //
67 //The following are values that can be passed to the PMAP_configurePorts() API
68 //as the pxMAPy parameter.
69 //
70 //*****************************************************************************
71 #define PMAP_P1MAP ((uint32_t)P1MAP - PMAP_BASE)
72 #define PMAP_P2MAP ((uint32_t)P2MAP - PMAP_BASE)
73 #define PMAP_P3MAP ((uint32_t)P3MAP - PMAP_BASE)
74 #define PMAP_P4MAP ((uint32_t)P4MAP - PMAP_BASE)
75 #define PMAP_P5MAP ((uint32_t)P5MAP - PMAP_BASE)
76 #define PMAP_P6MAP ((uint32_t)P6MAP - PMAP_BASE)
77 #define PMAP_P7MAP ((uint32_t)P7MAP - PMAP_BASE)
78 
79 
80 //*****************************************************************************
81 //
82 //Prototypes for the APIs.
83 //
84 //*****************************************************************************
85 
86 //*****************************************************************************
87 //
88 //! This function configures the MSP432 Port Mapper
89 //!
90 //! \param portMapping is the pointer to init Data
91 //! \param pxMAPy is the Port Mapper to initialize
92 //! \param numberOfPorts is the number of Ports to initialize
93 //! \param portMapReconfigure is used to enable/disable reconfiguration
94 //!             Valid values are
95 //!             \b PMAP_ENABLE_RECONFIGURATION
96 //!             \b PMAP_DISABLE_RECONFIGURATION [Default value]
97 //! Modified registers are \b PMAPKEYID, \b PMAPCTL
98 //!
99 //! \return None
100 //
101 //*****************************************************************************
102 extern void PMAP_configurePorts(const uint8_t *portMapping, uint8_t pxMAPy,
103         uint8_t numberOfPorts, uint8_t portMapReconfigure);
104 
105 /* Defines for future devices that might have multiple instances */
106 #define PMAP_configurePortsMultipleInstance(a,b,c,d,e) PMAP_configurePorts(b,c,d,e)
107 
108 //*****************************************************************************
109 //
110 // Mark the end of the C bindings section for C++ compilers.
111 //
112 //*****************************************************************************
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 //*****************************************************************************
118 //
119 // Close the Doxygen group.
120 //! @}
121 //
122 //*****************************************************************************
123 
124 #endif
125