Skip to content

Commit 0611822

Browse files
authored
Merge pull request #29 from RT-Thread/master
p
2 parents 295b95c + de1d079 commit 0611822

File tree

100 files changed

+10206
-374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+10206
-374
lines changed

.github/workflows/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ jobs:
104104
- {RTT_BSP: "stm32/stm32h743-atk-apollo", RTT_TOOL_CHAIN: "sourcery-arm"}
105105
- {RTT_BSP: "stm32/stm32h743-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
106106
- {RTT_BSP: "stm32/stm32h747-st-discovery", RTT_TOOL_CHAIN: "sourcery-arm"}
107+
- {RTT_BSP: "stm32/stm32h750-artpi-h750", RTT_TOOL_CHAIN: "sourcery-arm"}
107108
- {RTT_BSP: "stm32/stm32l4r9-st-eval", RTT_TOOL_CHAIN: "sourcery-arm"}
108109
- {RTT_BSP: "stm32/stm32l010-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
109110
- {RTT_BSP: "stm32/stm32l053-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}

bsp/bluetrum/ab32vg1-ab-prougen/board/Kconfig

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ menu "Hardware Drivers Config"
22

33
menu "Onboard Peripheral Drivers"
44

5-
config BSP_USING_USB_TO_USART
6-
bool "Enable USB TO USART (uart0)"
7-
select BSP_USING_UART
8-
select BSP_USING_UART0
9-
default y
10-
115
menuconfig BSP_USING_AUDIO
126
bool "Enable Audio Device"
137
select RT_USING_AUDIO
@@ -34,11 +28,22 @@ menu "Onboard Peripheral Drivers"
3428
endmenu
3529

3630
menu "On-chip Peripheral Drivers"
37-
38-
menuconfig BSP_USING_UART0
39-
bool "Enable UART0"
40-
select RT_USING_SERIAL
41-
default y
31+
menuconfig BSP_USING_UART
32+
bool "Enable UART"
33+
if BSP_USING_UART
34+
config BSP_USING_UART0
35+
bool "Enable UART0"
36+
select RT_USING_SERIAL
37+
default y
38+
config BSP_USING_UART1
39+
bool "Enable UART1"
40+
select RT_USING_SERIAL
41+
default n
42+
config BSP_USING_UART2
43+
bool "Enable UART2"
44+
select RT_USING_SERIAL
45+
default n
46+
endif
4247

4348
config BSP_USING_SDIO
4449
bool "Enable SDIO"

bsp/bluetrum/ab32vg1-ab-prougen/board/ab32vg1_hal_msp.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ void hal_uart_mspinit(struct uart_handle *huart)
3535
gpio_init.af_con = GPIO_AFEN | GPIO_AFCON0 | UT1RXMAP_AF;
3636
hal_gpio_init(GPIOA_BASE, &gpio_init);
3737
/* Interrupt */
38+
} else if (huart->instance == UART2_BASE) {
39+
gpio_init.pin = GPIO_PIN_2;
40+
gpio_init.dir = GPIO_DIR_OUTPUT;
41+
gpio_init.de = GPIO_DIGITAL;
42+
gpio_init.alternate = GPIO_AF_MAP_Gx(UT2TXMAP_AF, GPIO_AF_G2);
43+
gpio_init.af_con = GPIO_AFEN | GPIO_AFCON1 | UT2TXMAP_AF;
44+
hal_gpio_init(GPIOB_BASE, &gpio_init);
45+
46+
gpio_init.pin = GPIO_PIN_1;
47+
gpio_init.pull = GPIO_PULLUP;
48+
gpio_init.dir = GPIO_DIR_INPUT;
49+
gpio_init.de = GPIO_DIGITAL;
50+
gpio_init.alternate = GPIO_AF_MAP_Gx(UT2RXMAP_AF, GPIO_AF_G2);
51+
gpio_init.af_con = GPIO_AFEN | GPIO_AFCON1 | UT2RXMAP_AF;
52+
hal_gpio_init(GPIOB_BASE, &gpio_init);
53+
/* Interrupt */
3854
}
3955
}
4056

bsp/bluetrum/libraries/hal_drivers/drv_usart.c

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,40 @@
2121

2222
enum
2323
{
24+
#ifdef BSP_USING_UART0
2425
UART0_INDEX,
26+
#endif
27+
#ifdef BSP_USING_UART1
2528
UART1_INDEX,
29+
#endif
30+
#ifdef BSP_USING_UART2
31+
UART2_INDEX,
32+
#endif
2633
};
2734

2835
static struct ab32_uart_config uart_config[] =
2936
{
37+
#ifdef BSP_USING_UART0
3038
{
3139
.name = "uart0",
3240
.instance = UART0_BASE,
41+
.mode = UART_MODE_TX_RX | UART_MODE_1LINE,
3342
},
43+
#endif
44+
#ifdef BSP_USING_UART1
3445
{
3546
.name = "uart1",
3647
.instance = UART1_BASE,
48+
.mode = UART_MODE_TX_RX,
49+
},
50+
#endif
51+
#ifdef BSP_USING_UART2
52+
{
53+
.name = "uart2",
54+
.instance = UART2_BASE,
55+
.mode = UART_MODE_TX_RX,
3756
}
57+
#endif
3858
};
3959

4060
static struct ab32_uart uart_obj[sizeof(uart_config) / sizeof(uart_config[0])] = {0};
@@ -48,7 +68,7 @@ static rt_err_t ab32_configure(struct rt_serial_device *serial, struct serial_co
4868
uart = rt_container_of(serial, struct ab32_uart, serial);
4969
uart->handle.instance = uart->config->instance;
5070
uart->handle.init.baud = cfg->baud_rate;
51-
uart->handle.init.mode = UART_MODE_TX_RX;
71+
uart->handle.init.mode = uart->config->mode;
5272

5373
switch (cfg->data_bits)
5474
{
@@ -152,14 +172,24 @@ static void uart_isr(int vector, void *param)
152172
{
153173
rt_interrupt_enter();
154174

175+
#ifdef BSP_USING_UART0
155176
if(hal_uart_getflag(UART0_BASE, UART_FLAG_RXPND)) //RX one byte finish
156177
{
157178
rt_hw_serial_isr(&(uart_obj[UART0_INDEX].serial), RT_SERIAL_EVENT_RX_IND);
158179
}
159-
// if(hal_uart_getflag(UART1_BASE, UART_FLAG_RXPND)) //RX one byte finish
160-
// {
161-
// rt_hw_serial_isr(&(uart_obj[UART1_INDEX].serial), RT_SERIAL_EVENT_RX_IND);
162-
// }
180+
#endif
181+
#ifdef BSP_USING_UART1
182+
if(hal_uart_getflag(UART1_BASE, UART_FLAG_RXPND)) //RX one byte finish
183+
{
184+
rt_hw_serial_isr(&(uart_obj[UART1_INDEX].serial), RT_SERIAL_EVENT_RX_IND);
185+
}
186+
#endif
187+
#ifdef BSP_USING_UART2
188+
if(hal_uart_getflag(UART2_BASE, UART_FLAG_RXPND)) //RX one byte finish
189+
{
190+
rt_hw_serial_isr(&(uart_obj[UART2_INDEX].serial), RT_SERIAL_EVENT_RX_IND);
191+
}
192+
#endif
163193

164194
rt_interrupt_leave();
165195
}

bsp/bluetrum/libraries/hal_drivers/drv_usart.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ struct ab32_uart_config
2020
{
2121
const char *name;
2222
hal_sfr_t instance;
23+
uint8_t mode;
24+
uint8_t reserve[3];
2325
// struct dma_config *dma_rx;
2426
// struct dma_config *dma_tx;
2527
};

bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/include/ab32vg1_hal_gpio_ex.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,15 @@
3333
* G1: tx:PA7 rx:PA6
3434
* G2: tx:PA4 rx:PA3
3535
* G3: tx:PF2 rx:map to tx
36+
*
37+
* UART2:
38+
* G1: tx:PE3 rx:PE2
39+
* G2: tx:PB2 rx:PB1
3640
*/
3741

42+
#define UT2RXMAP_AF (8u)
43+
#define UT2TXMAP_AF (4u)
44+
3845
#define UT1RXMAP_AF (28u)
3946
#define UT1TXMAP_AF (24u)
4047
#define HSUTRXMAP_AF (20u)

bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/include/ab32vg1_hal_uart.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ struct uart_handle
7878
*/
7979
#define UART_MODE_TX (0x00u) /*!< TX mode */
8080
#define UART_MODE_TX_RX (0x01u) /*!< RX and TX mode */
81+
#define UART_MODE_1LINE (0x02u) /*!< oneline mode */
8182

8283
/**
8384
* @}

bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal_uart.c

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,51 @@ void hal_uart_setbaud(hal_sfr_t uartx, uint32_t baud)
2727
uint32_t baud_cfg;
2828

2929
uartx[UARTxCON] |= UART_CLK_SRC1;
30-
baud_cfg = (26000000/2)/baud; //1.5M
30+
baud_cfg = (26000000/2)/baud;
3131
uartx[UARTxBAUD] = (baud_cfg << 16) | baud_cfg;
3232
}
3333

34+
/**
35+
* @brief Set the UART misc paramter.
36+
*
37+
* @param uartx This parameter can be UARTxN where x can be (0.2).
38+
* @param param uart config paramter pointer.
39+
*/
40+
void hal_uart_setparam(hal_sfr_t uartx, struct uart_init *param)
41+
{
42+
switch (param->word_len)
43+
{
44+
case UART_WORDLENGTH_8B:
45+
uartx[UARTxCON] &= ~UART_BIT9_ENABLE;
46+
break;
47+
case UART_WORDLENGTH_9B:
48+
uartx[UARTxCON] |= UART_BIT9_ENABLE;
49+
break;
50+
default:
51+
break;
52+
}
53+
54+
switch (param->stop_bits)
55+
{
56+
case UART_STOPBITS_1:
57+
uartx[UARTxCON] &= ~UART_SB2_ENABLE;
58+
break;
59+
case UART_STOPBITS_2:
60+
uartx[UARTxCON] |= UART_SB2_ENABLE;
61+
break;
62+
default:
63+
break;
64+
}
65+
66+
if (param->mode & UART_MODE_1LINE)
67+
{
68+
uartx[UARTxCON] |= UART_1LINE_ENABLE;
69+
}
70+
else
71+
{
72+
uartx[UARTxCON] &= ~UART_1LINE_ENABLE;
73+
}
74+
}
3475
/**
3576
* @brief Initialize the UART mode.
3677
*
@@ -157,11 +198,15 @@ void uart_config_all(struct uart_handle *huart)
157198
hal_rcu_periph_clk_enable(RCU_UART0);
158199
} else if (huart->instance == UART1_BASE) {
159200
hal_rcu_periph_clk_enable(RCU_UART1);
201+
} else if (huart->instance == UART2_BASE) {
202+
hal_rcu_periph_clk_enable(RCU_UART2);
160203
} else {
161204
return; /* Not support! */
162205
}
163206

207+
hal_uart_deinit(huart->instance);
164208
hal_uart_setbaud(huart->instance, huart->init.baud);
209+
hal_uart_setparam(huart->instance, &huart->init);
165210

166211
if (huart->init.mode != UART_MODE_TX) {
167212
hal_uart_control(huart->instance, UART_RX_ENABLE, HAL_ENABLE);

bsp/frdm-k64f/applications/startup.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ void rtthread_startup(void)
7373
/* init scheduler system */
7474
rt_system_scheduler_init();
7575

76-
/* init all device */
77-
rt_device_init_all();
78-
7976
/* init application */
8077
rt_application_init();
8178

bsp/lpc43xx/M0/SConstruct

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ if rtconfig.CROSS_TOOL == 'gcc':
3535

3636
if sys.platform.startswith('linux'):
3737
import glob
38-
ocwd = os.getcwdu()
38+
ocwd = os.getcwd()
3939
res = os.system('cd ../Libraries/; find -name \*.o -exec rm {} \;')
4040
os.chdir(ocwd)
4141
else:
4242
# Assume Windows.
43-
ocwd = os.getcwdu()
43+
ocwd = os.getcwd()
4444
print('TODO: remove the object files in ../Libraries')
4545
os.chdir(ocwd)
4646

0 commit comments

Comments
 (0)