Skip to content

Commit 51143ea

Browse files
author
Cruz Monrreal
authored
Merge pull request #8815 from ThunderSoft123/master
Add platform TT_M3HQ
2 parents 1bf7e1c + 0146c21 commit 51143ea

32 files changed

+11065
-0
lines changed
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
/* mbed Microcontroller Library
2+
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2018 All rights reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#ifndef MBED_PERIPHERALNAMES_H
17+
#define MBED_PERIPHERALNAMES_H
18+
19+
#include "PinNames.h"
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
typedef enum {
26+
SERIAL_0 = 0,
27+
SERIAL_1,
28+
SERIAL_2,
29+
SERIAL_3,
30+
SERIAL_4,
31+
SERIAL_5,
32+
INVALID_SERIAL = (int)NC
33+
} UARTName;
34+
35+
typedef enum {
36+
ADC_AINA00 = 0,
37+
ADC_AINA01,
38+
ADC_AINA02,
39+
ADC_AINA03,
40+
ADC_AINA04,
41+
ADC_AINA05,
42+
ADC_AINA06,
43+
ADC_AINA07,
44+
ADC_AINA08,
45+
ADC_AINA09,
46+
ADC_AINA10,
47+
ADC_AINA11,
48+
ADC_AINA12,
49+
ADC_AINA13,
50+
ADC_AINA14,
51+
ADC_AINA15,
52+
ADC_AINA16,
53+
ADC_AINA17,
54+
ADC_AINA18,
55+
ADC_AINA19,
56+
ADC_AINA20,
57+
INVALID_ADC = (int)NC
58+
} ADCName;
59+
60+
typedef enum {
61+
DAC_A0 = 0,
62+
DAC_A1,
63+
INVALID_DAC = (int)NC
64+
} DACName;
65+
66+
typedef enum {
67+
SPI_0 = 0,
68+
SPI_1,
69+
SPI_2,
70+
SPI_3,
71+
SPI_4,
72+
INVALID_SPI = (int)NC
73+
} SPIName;
74+
75+
typedef enum {
76+
I2C_0 = 0,
77+
I2C_1,
78+
I2C_2,
79+
I2C_3,
80+
INVALID_I2C = (int)NC
81+
} I2CName;
82+
83+
typedef enum {
84+
PWM_0 = 0,
85+
PWM_1,
86+
PWM_2,
87+
PWM_3,
88+
PWM_4,
89+
PWM_5,
90+
PWM_6,
91+
INVALID_PWM = (int)NC
92+
} PWMName;
93+
94+
typedef enum {
95+
GPIO_IRQ_00 = 0,
96+
GPIO_IRQ_01,
97+
GPIO_IRQ_02,
98+
GPIO_IRQ_03,
99+
GPIO_IRQ_04,
100+
GPIO_IRQ_05,
101+
GPIO_IRQ_06,
102+
GPIO_IRQ_07,
103+
GPIO_IRQ_08,
104+
GPIO_IRQ_09,
105+
GPIO_IRQ_10,
106+
GPIO_IRQ_11,
107+
GPIO_IRQ_12,
108+
GPIO_IRQ_13,
109+
GPIO_IRQ_14,
110+
GPIO_IRQ_15,
111+
GPIO_IRQ_16,
112+
GPIO_IRQ_17_18,
113+
GPIO_IRQ_19_22,
114+
GPIO_IRQ_23_26,
115+
GPIO_IRQ_27_28,
116+
GPIO_IRQ_29,
117+
GPIO_IRQ_30_31,
118+
INVALID_GPIO_IRQ = (int)NC
119+
} gpio_irqname;
120+
121+
#define STDIO_UART_TX USBTX
122+
#define STDIO_UART_RX USBRX
123+
#define STDIO_UART SERIAL_1
124+
125+
#define MBED_SPI0 PA1, PA2, PA0, PA4
126+
#define MBED_SPI1 PB3, PB4, PB2, PB5
127+
#define MBED_SPI2 PT3, PT4, PT2, PT1
128+
#define MBED_SPI3 PP4, PP3, PP5, PP6
129+
#define MBED_SPI4 PH5, PH6, PH4, PH0
130+
131+
#define MBED_UART0 PA1, PA2
132+
#define MBED_UART1 PJ1, PJ2
133+
#define MBED_UART2 PB2, PB3
134+
#define MBED_UART3 PA7, PA6
135+
#define MBED_UART4 PC4, PC5
136+
#define MBED_UART5 PN2, PN3
137+
#define MBED_UARTUSB USBTX, USBRX
138+
139+
#define MBED_I2C0 PC1, PC0
140+
#define MBED_I2C1 PA5, PA4
141+
#define MBED_I2C2 PL1, PL0
142+
#define MBED_I2C3 PT0, PT1
143+
144+
#define MBED_ANALOGIN0 A0
145+
#define MBED_ANALOGIN1 A1
146+
#define MBED_ANALOGIN2 A2
147+
#define MBED_ANALOGIN3 A3
148+
#define MBED_ANALOGIN4 A4
149+
#define MBED_ANALOGIN5 A5
150+
151+
#define MBED_PWMOUT0 PB0
152+
#define MBED_PWMOUT1 PC0
153+
#define MBED_PWMOUT2 PJ0
154+
#define MBED_PWMOUT3 PK2
155+
#define MBED_PWMOUT4 PN0
156+
#define MBED_PWMOUT5 PL5
157+
#define MBED_PWMOUT6 PG2
158+
159+
#ifdef __cplusplus
160+
}
161+
#endif
162+
163+
#endif
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
/* mbed Microcontroller Library
2+
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2018 All rights reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#ifndef MBED_PINNAMES_H
17+
#define MBED_PINNAMES_H
18+
19+
#include "cmsis.h"
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
#define PIN_PORT(X) (((uint32_t)(X) >> 3) & 0x1F)
26+
#define PIN_POS(X) ((uint32_t)(X) & 0x7)
27+
28+
// Pin data, bit 31..16: Pin Function, bit 15..0: Pin Direction
29+
#define PIN_DATA(FUNC, DIR) (int)(((FUNC) << 16)| ((DIR) << 0))
30+
#define PIN_FUNC(X) (((X) & 0xffff0000) >> 16)
31+
#define PIN_DIR(X) ((X) & 0xffff)
32+
33+
#define GPIO_NUM (15U) // total number of gpio
34+
#define FRMAX (7U)
35+
#define RESER (8U - (FRMAX))
36+
37+
typedef enum {
38+
PIN_INPUT,
39+
PIN_OUTPUT,
40+
PIN_INOUT
41+
} PinDirection;
42+
43+
typedef enum {
44+
// TMPM3HQ Pin Names
45+
PA0 = 0 << 3, PA1, PA2, PA3, PA4, PA5, PA6, PA7,
46+
PB0 = 1 << 3, PB1, PB2, PB3, PB4, PB5, PB6, PB7,
47+
PC0 = 2 << 3, PC1, PC2, PC3, PC4, PC5, PC6,
48+
PD0 = 3 << 3, PD1, PD2, PD3, PD4, PD5,
49+
PE0 = 4 << 3, PE1, PE2, PE3, PE4, PE5, PE6,
50+
PF0 = 5 << 3, PF1, PF2, PF3, PF4, PF5, PF6, PF7,
51+
PG0 = 6 << 3, PG1, PG2, PG3, PG4, PG5, PG6, PG7,
52+
PH0 = 7 << 3, PH1, PH2, PH3, PH4, PH5, PH6, PH7,
53+
PJ0 = 8 << 3, PJ1, PJ2, PJ3, PJ4, PJ5,
54+
PK0 = 9 << 3, PK1, PK2, PK3, PK4, PK5, PK6, PK7,
55+
PL0 = 10 << 3, PL1, PL2, PL3, PL4, PL5, PL6, PL7,
56+
PM0 = 11 << 3, PM1, PM2, PM3, PM4, PM5, PM6, PM7,
57+
PN0 = 12 << 3, PN1, PN2, PN3, PN4, PN5,
58+
PP0 = 13 << 3, PP1, PP2, PP3, PP4, PP5, PP6, PP7,
59+
PR0 = 14 << 3, PR1, PR2, PR3, PR4, PR5, PR6, PR7,
60+
PT0 = 15 << 3, PT1, PT2, PT3, PT4, PT5, PT6, PT7,
61+
PU0 = 16 << 3, PU1, PU2, PU3, PU4, PU5,
62+
PV0 = 17 << 3, PV1, PV2, PV3, PV4, PV5, PV6, PV7,
63+
64+
// Other mbed Pin Names
65+
LED1 = PK4,
66+
LED2 = PK5,
67+
LED3 = PK6,
68+
LED4 = PK7,
69+
70+
// External data bus Pin Names
71+
D0 = PV7,
72+
D1 = PV6,
73+
D2 = PC4,
74+
D3 = PK2,
75+
D4 = PC3,
76+
D5 = PJ0,
77+
D6 = PN0,
78+
D7 = PL6,
79+
D8 = PT0,
80+
D9 = PP0,
81+
D10 = PT1,
82+
D11 = PT3,
83+
D12 = PT4,
84+
D13 = PT2,
85+
D14 = PA5,
86+
D15 = PA4,
87+
88+
// Analogue out pins
89+
A0 = PF2,
90+
A1 = PF3,
91+
A2 = PF4,
92+
A3 = PF5,
93+
A4 = PF6,
94+
A5 = PF7,
95+
96+
DAC0 = PG0,
97+
DAC1 = PG1,
98+
99+
// DAP_UART
100+
USBTX = PJ1,
101+
USBRX = PJ2,
102+
MBEDIF_TXD = USBTX,
103+
MBEDIF_RXD = USBRX,
104+
105+
// Switches
106+
SW1 = PV0,
107+
SW2 = PV1,
108+
SW3 = PV2,
109+
SW4 = PV3,
110+
111+
// I2C pins
112+
SDA = D14,
113+
SCL = D15,
114+
I2C_SDA = SDA,
115+
I2C_SCL = SCL,
116+
117+
// Not connected
118+
NC = (int)0xFFFFFFFF,
119+
} PinName;
120+
121+
typedef enum {
122+
PullUp = 0,
123+
PullDown,
124+
PullNone,
125+
OpenDrain,
126+
PullDefault
127+
} PinMode;
128+
129+
typedef enum {
130+
DISABLE = 0,
131+
ENABLE
132+
} FunctionalState;
133+
134+
#ifdef __cplusplus
135+
}
136+
#endif
137+
138+
#endif
139+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* mbed Microcontroller Library
2+
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2018 All rights reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#ifndef MBED_PORTNAMES_H
17+
#define MBED_PORTNAMES_H
18+
19+
#ifdef __cplusplus
20+
extern "C" {
21+
#endif
22+
23+
typedef enum {
24+
PortA = 0,
25+
PortB,
26+
PortC,
27+
PortD,
28+
PortE,
29+
PortF,
30+
PortG,
31+
PortH,
32+
PortJ,
33+
PortK,
34+
PortL,
35+
PortM,
36+
PortN,
37+
PortP,
38+
PortR,
39+
PortT,
40+
PortU,
41+
PortV
42+
} PortName;
43+
44+
#define IS_GPIO_PORT(param) ((param) <= PortV) // parameter checking for port number
45+
46+
#ifdef __cplusplus
47+
}
48+
#endif
49+
#endif

0 commit comments

Comments
 (0)