Merge pull request #4496 from mysterywolf/tm4c129x

[tm4c129x] auto formatted
This commit is contained in:
Bernard Xiong 2021-03-23 20:02:36 +08:00 committed by GitHub
commit 7228a1000f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 117 additions and 145 deletions

View File

@ -1,11 +1,7 @@
/* /*
* File : application.c * Copyright (c) 2006-2021, RT-Thread Development Team
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2014, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * SPDX-License-Identifier: Apache-2.0
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -1,11 +1,7 @@
/* /*
* File : board.c * Copyright (c) 2006-2021, RT-Thread Development Team
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2013 RT-Thread Develop Team
* *
* The license and distribution terms for this file may be * SPDX-License-Identifier: Apache-2.0
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -1,11 +1,7 @@
/* /*
* File : board.h * Copyright (c) 2006-2021, RT-Thread Development Team
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * SPDX-License-Identifier: Apache-2.0
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -1,11 +1,7 @@
/* /*
* File : drv_eth.c * Copyright (c) 2006-2021, RT-Thread Development Team
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009-2013 RT-Thread Develop Team
* *
* The license and distribution terms for this file may be * SPDX-License-Identifier: Apache-2.0
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -1,11 +1,7 @@
/* /*
* File : drv_eth.c * Copyright (c) 2006-2021, RT-Thread Development Team
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009-2013 RT-Thread Develop Team
* *
* The license and distribution terms for this file may be * SPDX-License-Identifier: Apache-2.0
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes

View File

@ -1,11 +1,7 @@
/* /*
* File : drv_uart.c * Copyright (c) 2006-2021, RT-Thread Development Team
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009-2013 RT-Thread Develop Team
* *
* The license and distribution terms for this file may be * SPDX-License-Identifier: Apache-2.0
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
@ -35,74 +31,74 @@ typedef struct hw_uart_device
static rt_err_t hw_configure(struct rt_serial_device *serial, struct serial_configure *cfg) static rt_err_t hw_configure(struct rt_serial_device *serial, struct serial_configure *cfg)
{ {
uint32_t config = 0; uint32_t config = 0;
hw_uart_t* uart; hw_uart_t* uart;
RT_ASSERT(serial != RT_NULL); RT_ASSERT(serial != RT_NULL);
uart = mUartGetHwPtr(serial); uart = mUartGetHwPtr(serial);
MAP_UARTDisable(uart->hw_base); MAP_UARTDisable(uart->hw_base);
// build UART Configuration parameter structure // build UART Configuration parameter structure
switch(cfg->data_bits) switch(cfg->data_bits)
{ {
case DATA_BITS_9: case DATA_BITS_9:
// enable 9bit address mode and set DATA_BIT_8 // enable 9bit address mode and set DATA_BIT_8
MAP_UART9BitEnable(uart->hw_base); MAP_UART9BitEnable(uart->hw_base);
case DATA_BITS_8: case DATA_BITS_8:
config |= UART_CONFIG_WLEN_8; config |= UART_CONFIG_WLEN_8;
break; break;
case DATA_BITS_7: case DATA_BITS_7:
config |= UART_CONFIG_WLEN_7; config |= UART_CONFIG_WLEN_7;
break; break;
case DATA_BITS_6: case DATA_BITS_6:
config |= UART_CONFIG_WLEN_6; config |= UART_CONFIG_WLEN_6;
break; break;
case DATA_BITS_5: case DATA_BITS_5:
config |= UART_CONFIG_WLEN_5; config |= UART_CONFIG_WLEN_5;
break; break;
default: default:
RT_ASSERT(0); RT_ASSERT(0);
break; break;
} }
switch(cfg->parity) switch(cfg->parity)
{ {
case PARITY_ODD: case PARITY_ODD:
config |= UART_CONFIG_PAR_ODD; config |= UART_CONFIG_PAR_ODD;
break; break;
case PARITY_EVEN: case PARITY_EVEN:
config |= UART_CONFIG_PAR_EVEN; config |= UART_CONFIG_PAR_EVEN;
break; break;
case PARITY_NONE: case PARITY_NONE:
config |= UART_CONFIG_PAR_NONE; config |= UART_CONFIG_PAR_NONE;
break; break;
default: default:
RT_ASSERT(0); RT_ASSERT(0);
break; break;
} }
switch(cfg->stop_bits) switch(cfg->stop_bits)
{ {
case STOP_BITS_1: case STOP_BITS_1:
config |= UART_CONFIG_STOP_ONE; config |= UART_CONFIG_STOP_ONE;
break; break;
case STOP_BITS_2: case STOP_BITS_2:
config |= UART_CONFIG_STOP_TWO; config |= UART_CONFIG_STOP_TWO;
break; break;
default: default:
RT_ASSERT(0); RT_ASSERT(0);
break; break;
} }
// Initialize UART0 peripheral with given to corresponding parameter // Initialize UART0 peripheral with given to corresponding parameter
MAP_UARTConfigSetExpClk(uart->hw_base, SystemCoreClock, cfg->baud_rate, config); MAP_UARTConfigSetExpClk(uart->hw_base, SystemCoreClock, cfg->baud_rate, config);
MAP_UARTFIFOEnable(uart->hw_base); MAP_UARTFIFOEnable(uart->hw_base);
// Enable the UART. // Enable the UART.
MAP_UARTEnable(uart->hw_base); MAP_UARTEnable(uart->hw_base);
return RT_EOK; return RT_EOK;
} }
static rt_err_t hw_control(struct rt_serial_device *serial, int cmd, void *arg) static rt_err_t hw_control(struct rt_serial_device *serial, int cmd, void *arg)
{ {
hw_uart_t* uart; hw_uart_t* uart;
RT_ASSERT(serial != RT_NULL); RT_ASSERT(serial != RT_NULL);
uart = mUartGetHwPtr(serial); uart = mUartGetHwPtr(serial);
@ -123,7 +119,7 @@ static rt_err_t hw_control(struct rt_serial_device *serial, int cmd, void *arg)
static int hw_putc(struct rt_serial_device *serial, char c) static int hw_putc(struct rt_serial_device *serial, char c)
{ {
hw_uart_t* uart; hw_uart_t* uart;
RT_ASSERT(serial != RT_NULL); RT_ASSERT(serial != RT_NULL);
uart = mUartGetHwPtr(serial); uart = mUartGetHwPtr(serial);
@ -133,11 +129,11 @@ static int hw_putc(struct rt_serial_device *serial, char c)
static int hw_getc(struct rt_serial_device *serial) static int hw_getc(struct rt_serial_device *serial)
{ {
hw_uart_t* uart; hw_uart_t* uart;
RT_ASSERT(serial != RT_NULL); RT_ASSERT(serial != RT_NULL);
uart = mUartGetHwPtr(serial); uart = mUartGetHwPtr(serial);
return MAP_UARTCharGetNonBlocking(uart->hw_base); return MAP_UARTCharGetNonBlocking(uart->hw_base);
} }
static const struct rt_uart_ops hw_uart_ops = static const struct rt_uart_ops hw_uart_ops =
@ -158,7 +154,7 @@ hw_uart_t uart0 =
void UART0_IRQHandler(void) void UART0_IRQHandler(void)
{ {
uint32_t intsrc; uint32_t intsrc;
hw_uart_t *uart = &uart0; hw_uart_t *uart = &uart0;
/* enter interrupt */ /* enter interrupt */
@ -208,15 +204,15 @@ int rt_hw_uart_init(void)
//IntPrioritySet(INT_UART0, ((0x01 << 5) | 0x01)); //IntPrioritySet(INT_UART0, ((0x01 << 5) | 0x01));
/* Enable Interrupt for UART channel */ /* Enable Interrupt for UART channel */
UARTIntRegister(uart->hw_base, UART0_IRQHandler); UARTIntRegister(uart->hw_base, UART0_IRQHandler);
MAP_IntEnable(INT_UART0); MAP_IntEnable(INT_UART0);
MAP_UARTEnable(uart->hw_base); MAP_UARTEnable(uart->hw_base);
/* register UART0 device */ /* register UART0 device */
rt_hw_serial_register(&serial0, "uart0", rt_hw_serial_register(&serial0, "uart0",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
uart); uart);
#endif #endif
return 0; return 0;
} }
INIT_BOARD_EXPORT(rt_hw_uart_init); INIT_BOARD_EXPORT(rt_hw_uart_init);

View File

@ -1,11 +1,7 @@
/* /*
* File : drv_uart.h * Copyright (c) 2006-2021, RT-Thread Development Team
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009-2013 RT-Thread Develop Team
* *
* The license and distribution terms for this file may be * SPDX-License-Identifier: Apache-2.0
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes