1 /* 2 * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef _PINNAME_H_ 16 #define _PINNAME_H_ 17 18 #define PIN_TYPE_SHIFT 8 19 #define PIN_TYPE_MASK 0xFF 20 #define PIN_IDX_MASK 0xFF 21 22 #define PIN_TYPE(pin) ((pin >> PIN_TYPE_SHIFT) & PIN_TYPE_MASK) 23 #define PIN_IDX(pin) (pin & PIN_IDX_MASK) 24 #define PIN(type, idx) ((type << PIN_TYPE_SHIFT) | idx) 25 26 typedef enum 27 { 28 PIN_TYPE_NC = 0x00, 29 PIN_TYPE_A = 0x01, 30 PIN_TYPE_B = 0x02, 31 PIN_TYPE_PWR = 0x03 32 } PinType; 33 34 typedef enum { 35 PA_0 = PIN(PIN_TYPE_A, 0), 36 PA_1, 37 PA_2, 38 PA_3, 39 PA_4, 40 PA_5, 41 PA_6, 42 PA_7, 43 PA_8, 44 PA_9, 45 PA_10, 46 PA_11, 47 PA_12, 48 PA_13, 49 PA_14, 50 PA_15, 51 PA_16, 52 PA_17, 53 PA_18, 54 PA_19, 55 PA_20, 56 PA_21, 57 PA_22, 58 PA_23, 59 PA_24, 60 PA_25, 61 PA_26, 62 PA_27, 63 PA_28, 64 PA_29, 65 PA_30, 66 PA_31, 67 PB_0 = PIN(PIN_TYPE_B, 0), 68 PB_1, 69 PB_2, 70 PB_3, 71 PB_4, 72 PB_5, 73 PB_6, 74 PB_7, 75 PB_8, 76 PB_9, 77 PB_10, 78 PB_11, 79 PB_12, 80 PB_13, 81 PB_14, 82 PB_15, 83 PB_16, 84 PB_17, 85 PB_18, 86 PB_19, 87 PB_20, 88 PB_21, 89 PB_22, 90 PB_23, 91 PB_24, 92 PB_25, 93 PB_26, 94 PB_27, 95 PB_28, 96 PB_29, 97 PB_30, 98 PB_31, 99 PIN_PWR = PIN(PIN_TYPE_PWR, 0), 100 PIN_NC = PIN(PIN_TYPE_NC, 0), 101 } PinName; 102 103 #endif /* _PINNAME_H_ */ 104