Logo
MSP430IEC60730SWPackage
IEC60730_gpio_test.h
1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2016, 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 _IEC60730_GPIO_TEST_H_
33 #define _IEC60730_GPIO_TEST_H_
34 
35 //*****************************************************************************
36 //
37 //The following include is added to use C99 data types
38 //
39 //*****************************************************************************
40 #include "stdint.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 
47 //*****************************************************************************
48 //
49 //The following defines are used to determine the valid parameter to be passed
50 //as to IEC60730_GPIO_TEST_testGpioOutput
51 //
52 //*****************************************************************************
53 
54 #define PORT_1 0x0001
55 #define PORT_2 0x0002
56 #define PORT_3 0x0004
57 #define PORT_4 0x0008
58 #define PORT_5 0x0010
59 #define PORT_6 0x0020
60 #define PORT_7 0x0040
61 #define PORT_8 0x0080
62 #define PORT_9 0x0100
63 #define PORT_10 0x0200
64 #define PORT_11 0x0400
65 #define PORT_A PORT_1 + PORT_2
66 #define PORT_B PORT_3 + PORT_4
67 #define PORT_C PORT_5 + PORT_6
68 #define PORT_D PORT_7 + PORT_8
69 #define PORT_E PORT_9 + PORT_10
70 #define PORT_F PORT_11
71 #define PORT_J 0x1000
72 
73 
74 //*****************************************************************************
75 //
76 //The following are values that can be passed to GPIO TEST API
77 //as the gpioPin parameter.
78 //
79 //*****************************************************************************
80 
81 #define PIN0 0x0001
82 #define PIN1 0x0002
83 #define PIN2 0x0004
84 #define PIN3 0x0008
85 #define PIN4 0x0010
86 #define PIN5 0x0020
87 #define PIN6 0x0040
88 #define PIN7 0x0080
89 #define PIN8 0x0100
90 #define PIN9 0x0200
91 #define PIN10 0x0400
92 #define PIN11 0x0800
93 #define PIN12 0x1000
94 #define PIN13 0x2000
95 #define PIN14 0x4000
96 #define PIN15 0x8000
97 
98 
99 //*****************************************************************************
100 //
101 //The following are values that can be passed to GPIO TEST API
102 //as the expectedValue parameter.
103 //
104 //*****************************************************************************
105 
106 #define PIN0_HIGH 0x0001
107 #define PIN1_HIGH 0x0002
108 #define PIN2_HIGH 0x0004
109 #define PIN3_HIGH 0x0008
110 #define PIN4_HIGH 0x0010
111 #define PIN5_HIGH 0x0020
112 #define PIN6_HIGH 0x0040
113 #define PIN7_HIGH 0x0080
114 #define PIN8_HIGH 0x0100
115 #define PIN9_HIGH 0x0200
116 #define PIN10_HIGH 0x0400
117 #define PIN11_HIGH 0x0800
118 #define PIN12_HIGH 0x1000
119 #define PIN13_HIGH 0x2000
120 #define PIN14_HIGH 0x4000
121 #define PIN15_HIGH 0x8000
122 #define PIN0_LOW 0x0000
123 #define PIN1_LOW 0x0000
124 #define PIN2_LOW 0x0000
125 #define PIN3_LOW 0x0000
126 #define PIN4_LOW 0x0000
127 #define PIN5_LOW 0x0000
128 #define PIN6_LOW 0x0000
129 #define PIN7_LOW 0x0000
130 #define PIN8_LOW 0x0000
131 #define PIN9_LOW 0x0000
132 #define PIN10_LOW 0x0000
133 #define PIN11_LOW 0x0000
134 #define PIN12_LOW 0x0000
135 #define PIN13_LOW 0x0000
136 #define PIN14_LOW 0x0000
137 #define PIN15_LOW 0x0000
138 
139 
140 //*****************************************************************************
141 //
142 //Prototypes for the APIs.
143 //
144 //*****************************************************************************
145 extern uint8_t IEC60730_GPIO_TEST_testGpioOutput(uint16_t port,
146  uint16_t gpioPin);
147 
148 extern uint8_t IEC60730_GPIO_TEST_testGpioInput(uint16_t port,
149  uint16_t gpioPin,
150  uint16_t expectedValue);
151 
152 
153 #ifdef __cplusplus
154 }
155 #endif // extern "C"
156 
157 
158 
159 
160 #endif
uint8_t IEC60730_GPIO_TEST_testGpioOutput(uint16_t port, uint16_t gpioPin)
Definition: IEC60730_gpio_test.c:123
uint8_t IEC60730_GPIO_TEST_testGpioInput(uint16_t port, uint16_t gpioPin, uint16_t expectedValue)
Definition: IEC60730_gpio_test.c:401