1 /* 2 * Joshua Henderson <joshua.henderson@microchip.com> 3 * Copyright (C) 2015 Microchip Technology Inc. All rights reserved. 4 * 5 * This program is free software; you can distribute it and/or modify it 6 * under the terms of the GNU General Public License (Version 2) as 7 * published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * for more details. 13 */ 14 #ifndef _PIC32MZDA_EARLY_PIN_H 15 #define _PIC32MZDA_EARLY_PIN_H 16 17 /* 18 * This is a complete, yet overly simplistic and unoptimized, PIC32MZDA PPS 19 * configuration only useful before we have full pinctrl initialized. 20 */ 21 22 /* Input PPS Functions */ 23 enum { 24 IN_FUNC_INT3, 25 IN_FUNC_T2CK, 26 IN_FUNC_T6CK, 27 IN_FUNC_IC3, 28 IN_FUNC_IC7, 29 IN_FUNC_U1RX, 30 IN_FUNC_U2CTS, 31 IN_FUNC_U5RX, 32 IN_FUNC_U6CTS, 33 IN_FUNC_SDI1, 34 IN_FUNC_SDI3, 35 IN_FUNC_SDI5, 36 IN_FUNC_SS6, 37 IN_FUNC_REFCLKI1, 38 IN_FUNC_INT4, 39 IN_FUNC_T5CK, 40 IN_FUNC_T7CK, 41 IN_FUNC_IC4, 42 IN_FUNC_IC8, 43 IN_FUNC_U3RX, 44 IN_FUNC_U4CTS, 45 IN_FUNC_SDI2, 46 IN_FUNC_SDI4, 47 IN_FUNC_C1RX, 48 IN_FUNC_REFCLKI4, 49 IN_FUNC_INT2, 50 IN_FUNC_T3CK, 51 IN_FUNC_T8CK, 52 IN_FUNC_IC2, 53 IN_FUNC_IC5, 54 IN_FUNC_IC9, 55 IN_FUNC_U1CTS, 56 IN_FUNC_U2RX, 57 IN_FUNC_U5CTS, 58 IN_FUNC_SS1, 59 IN_FUNC_SS3, 60 IN_FUNC_SS4, 61 IN_FUNC_SS5, 62 IN_FUNC_C2RX, 63 IN_FUNC_INT1, 64 IN_FUNC_T4CK, 65 IN_FUNC_T9CK, 66 IN_FUNC_IC1, 67 IN_FUNC_IC6, 68 IN_FUNC_U3CTS, 69 IN_FUNC_U4RX, 70 IN_FUNC_U6RX, 71 IN_FUNC_SS2, 72 IN_FUNC_SDI6, 73 IN_FUNC_OCFA, 74 IN_FUNC_REFCLKI3, 75 }; 76 77 /* Input PPS Pins */ 78 #define IN_RPD2 0x00 79 #define IN_RPG8 0x01 80 #define IN_RPF4 0x02 81 #define IN_RPD10 0x03 82 #define IN_RPF1 0x04 83 #define IN_RPB9 0x05 84 #define IN_RPB10 0x06 85 #define IN_RPC14 0x07 86 #define IN_RPB5 0x08 87 #define IN_RPC1 0x0A 88 #define IN_RPD14 0x0B 89 #define IN_RPG1 0x0C 90 #define IN_RPA14 0x0D 91 #define IN_RPD6 0x0E 92 #define IN_RPD3 0x00 93 #define IN_RPG7 0x01 94 #define IN_RPF5 0x02 95 #define IN_RPD11 0x03 96 #define IN_RPF0 0x04 97 #define IN_RPB1 0x05 98 #define IN_RPE5 0x06 99 #define IN_RPC13 0x07 100 #define IN_RPB3 0x08 101 #define IN_RPC4 0x0A 102 #define IN_RPD15 0x0B 103 #define IN_RPG0 0x0C 104 #define IN_RPA15 0x0D 105 #define IN_RPD7 0x0E 106 #define IN_RPD9 0x00 107 #define IN_RPG6 0x01 108 #define IN_RPB8 0x02 109 #define IN_RPB15 0x03 110 #define IN_RPD4 0x04 111 #define IN_RPB0 0x05 112 #define IN_RPE3 0x06 113 #define IN_RPB7 0x07 114 #define IN_RPF12 0x09 115 #define IN_RPD12 0x0A 116 #define IN_RPF8 0x0B 117 #define IN_RPC3 0x0C 118 #define IN_RPE9 0x0D 119 #define IN_RPD1 0x00 120 #define IN_RPG9 0x01 121 #define IN_RPB14 0x02 122 #define IN_RPD0 0x03 123 #define IN_RPB6 0x05 124 #define IN_RPD5 0x06 125 #define IN_RPB2 0x07 126 #define IN_RPF3 0x08 127 #define IN_RPF13 0x09 128 #define IN_RPF2 0x0B 129 #define IN_RPC2 0x0C 130 #define IN_RPE8 0x0D 131 132 /* Output PPS Pins */ 133 enum { 134 OUT_RPD2, 135 OUT_RPG8, 136 OUT_RPF4, 137 OUT_RPD10, 138 OUT_RPF1, 139 OUT_RPB9, 140 OUT_RPB10, 141 OUT_RPC14, 142 OUT_RPB5, 143 OUT_RPC1, 144 OUT_RPD14, 145 OUT_RPG1, 146 OUT_RPA14, 147 OUT_RPD6, 148 OUT_RPD3, 149 OUT_RPG7, 150 OUT_RPF5, 151 OUT_RPD11, 152 OUT_RPF0, 153 OUT_RPB1, 154 OUT_RPE5, 155 OUT_RPC13, 156 OUT_RPB3, 157 OUT_RPC4, 158 OUT_RPD15, 159 OUT_RPG0, 160 OUT_RPA15, 161 OUT_RPD7, 162 OUT_RPD9, 163 OUT_RPG6, 164 OUT_RPB8, 165 OUT_RPB15, 166 OUT_RPD4, 167 OUT_RPB0, 168 OUT_RPE3, 169 OUT_RPB7, 170 OUT_RPF12, 171 OUT_RPD12, 172 OUT_RPF8, 173 OUT_RPC3, 174 OUT_RPE9, 175 OUT_RPD1, 176 OUT_RPG9, 177 OUT_RPB14, 178 OUT_RPD0, 179 OUT_RPB6, 180 OUT_RPD5, 181 OUT_RPB2, 182 OUT_RPF3, 183 OUT_RPF13, 184 OUT_RPC2, 185 OUT_RPE8, 186 OUT_RPF2, 187 }; 188 189 /* Output PPS Functions */ 190 #define OUT_FUNC_U3TX 0x01 191 #define OUT_FUNC_U4RTS 0x02 192 #define OUT_FUNC_SDO1 0x05 193 #define OUT_FUNC_SDO2 0x06 194 #define OUT_FUNC_SDO3 0x07 195 #define OUT_FUNC_SDO5 0x09 196 #define OUT_FUNC_SS6 0x0A 197 #define OUT_FUNC_OC3 0x0B 198 #define OUT_FUNC_OC6 0x0C 199 #define OUT_FUNC_REFCLKO4 0x0D 200 #define OUT_FUNC_C2OUT 0x0E 201 #define OUT_FUNC_C1TX 0x0F 202 #define OUT_FUNC_U1TX 0x01 203 #define OUT_FUNC_U2RTS 0x02 204 #define OUT_FUNC_U5TX 0x03 205 #define OUT_FUNC_U6RTS 0x04 206 #define OUT_FUNC_SDO1 0x05 207 #define OUT_FUNC_SDO2 0x06 208 #define OUT_FUNC_SDO3 0x07 209 #define OUT_FUNC_SDO4 0x08 210 #define OUT_FUNC_SDO5 0x09 211 #define OUT_FUNC_OC4 0x0B 212 #define OUT_FUNC_OC7 0x0C 213 #define OUT_FUNC_REFCLKO1 0x0F 214 #define OUT_FUNC_U3RTS 0x01 215 #define OUT_FUNC_U4TX 0x02 216 #define OUT_FUNC_U6TX 0x04 217 #define OUT_FUNC_SS1 0x05 218 #define OUT_FUNC_SS3 0x07 219 #define OUT_FUNC_SS4 0x08 220 #define OUT_FUNC_SS5 0x09 221 #define OUT_FUNC_SDO6 0x0A 222 #define OUT_FUNC_OC5 0x0B 223 #define OUT_FUNC_OC8 0x0C 224 #define OUT_FUNC_C1OUT 0x0E 225 #define OUT_FUNC_REFCLKO3 0x0F 226 #define OUT_FUNC_U1RTS 0x01 227 #define OUT_FUNC_U2TX 0x02 228 #define OUT_FUNC_U5RTS 0x03 229 #define OUT_FUNC_U6TX 0x04 230 #define OUT_FUNC_SS2 0x06 231 #define OUT_FUNC_SDO4 0x08 232 #define OUT_FUNC_SDO6 0x0A 233 #define OUT_FUNC_OC2 0x0B 234 #define OUT_FUNC_OC1 0x0C 235 #define OUT_FUNC_OC9 0x0D 236 #define OUT_FUNC_C2TX 0x0F 237 238 void pic32_pps_input(int function, int pin); 239 void pic32_pps_output(int function, int pin); 240 241 #endif 242