mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-30 06:00:27 +08:00
Merge pull request #4501 from mysterywolf/mb9bf618s
[mb9bf618s] manual & auto formatted
This commit is contained in:
commit
bc618dd409
@ -3,16 +3,16 @@
|
|||||||
#define __RTTHREAD_CFG_H__
|
#define __RTTHREAD_CFG_H__
|
||||||
|
|
||||||
/* RT_NAME_MAX*/
|
/* RT_NAME_MAX*/
|
||||||
#define RT_NAME_MAX 8
|
#define RT_NAME_MAX 8
|
||||||
|
|
||||||
/* RT_ALIGN_SIZE*/
|
/* RT_ALIGN_SIZE*/
|
||||||
#define RT_ALIGN_SIZE 4
|
#define RT_ALIGN_SIZE 4
|
||||||
|
|
||||||
/* PRIORITY_MAX */
|
/* PRIORITY_MAX */
|
||||||
#define RT_THREAD_PRIORITY_MAX 64
|
#define RT_THREAD_PRIORITY_MAX 64
|
||||||
|
|
||||||
/* Tick per Second */
|
/* Tick per Second */
|
||||||
#define RT_TICK_PER_SECOND 100
|
#define RT_TICK_PER_SECOND 100
|
||||||
|
|
||||||
/* SECTION: RT_DEBUG */
|
/* SECTION: RT_DEBUG */
|
||||||
/* Thread Debug */
|
/* Thread Debug */
|
||||||
@ -60,9 +60,9 @@
|
|||||||
/* #define RT_TINY_SIZE */
|
/* #define RT_TINY_SIZE */
|
||||||
#define RT_USING_CONSOLE
|
#define RT_USING_CONSOLE
|
||||||
/* the buffer size of console */
|
/* the buffer size of console */
|
||||||
#define RT_CONSOLEBUF_SIZE 128
|
#define RT_CONSOLEBUF_SIZE 128
|
||||||
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart1" />
|
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart1" />
|
||||||
#define RT_CONSOLE_DEVICE_NAME "uart0"
|
#define RT_CONSOLE_DEVICE_NAME "uart0"
|
||||||
|
|
||||||
/* SECTION: finsh, a C-Express shell */
|
/* SECTION: finsh, a C-Express shell */
|
||||||
/* Using FinSH as Shell*/
|
/* Using FinSH as Shell*/
|
||||||
|
@ -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) 2009 - 2011, 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
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* File : startup.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2009 - 2011, 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
|
||||||
@ -43,7 +39,7 @@ void rtthread_startup(void)
|
|||||||
|
|
||||||
/* show version */
|
/* show version */
|
||||||
rt_show_version();
|
rt_show_version();
|
||||||
|
|
||||||
/* init timer system */
|
/* init timer system */
|
||||||
rt_system_timer_init();
|
rt_system_timer_init();
|
||||||
|
|
||||||
|
@ -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) 2009 - 2011 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
|
||||||
@ -64,7 +60,7 @@ rt_uint32_t rt_hw_tick_get_microsecond(void)
|
|||||||
rt_tick_t tick;
|
rt_tick_t tick;
|
||||||
rt_uint32_t value;
|
rt_uint32_t value;
|
||||||
|
|
||||||
#define TICK_US (1000000/RT_TICK_PER_SECOND)
|
#define TICK_US (1000000/RT_TICK_PER_SECOND)
|
||||||
|
|
||||||
tick = rt_tick_get();
|
tick = rt_tick_get();
|
||||||
value = tick * TICK_US + (SysTick->LOAD - SysTick->VAL) * TICK_US / SysTick->LOAD;
|
value = tick * TICK_US + (SysTick->LOAD - SysTick->VAL) * TICK_US / SysTick->LOAD;
|
||||||
|
@ -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
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
*/
|
||||||
|
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
@ -129,16 +138,16 @@ static rt_err_t rt_led_control (rt_device_t dev, int cmd, void *args)
|
|||||||
|
|
||||||
void rt_led_hw_init(void)
|
void rt_led_hw_init(void)
|
||||||
{
|
{
|
||||||
fm3_led.parent.type = RT_Device_Class_Char;
|
fm3_led.parent.type = RT_Device_Class_Char;
|
||||||
fm3_led.parent.rx_indicate = RT_NULL;
|
fm3_led.parent.rx_indicate = RT_NULL;
|
||||||
fm3_led.parent.tx_complete = RT_NULL;
|
fm3_led.parent.tx_complete = RT_NULL;
|
||||||
fm3_led.parent.init = rt_led_init;
|
fm3_led.parent.init = rt_led_init;
|
||||||
fm3_led.parent.open = rt_led_open;
|
fm3_led.parent.open = rt_led_open;
|
||||||
fm3_led.parent.close = rt_led_close;
|
fm3_led.parent.close = rt_led_close;
|
||||||
fm3_led.parent.read = rt_led_read;
|
fm3_led.parent.read = rt_led_read;
|
||||||
fm3_led.parent.write = rt_led_write;
|
fm3_led.parent.write = rt_led_write;
|
||||||
fm3_led.parent.control = rt_led_control;
|
fm3_led.parent.control = rt_led_control;
|
||||||
fm3_led.parent.user_data = RT_NULL;
|
fm3_led.parent.user_data = RT_NULL;
|
||||||
|
|
||||||
/* register a character device */
|
/* register a character device */
|
||||||
rt_device_register(&fm3_led.parent, "led", RT_DEVICE_FLAG_RDWR);
|
rt_device_register(&fm3_led.parent, "led", RT_DEVICE_FLAG_RDWR);
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* File : serial.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006, 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
|
||||||
@ -258,16 +254,16 @@ rt_err_t rt_hw_serial_register(rt_device_t device, const char* name,
|
|||||||
{
|
{
|
||||||
RT_ASSERT(device != RT_NULL);
|
RT_ASSERT(device != RT_NULL);
|
||||||
|
|
||||||
device->type = RT_Device_Class_Char;
|
device->type = RT_Device_Class_Char;
|
||||||
device->rx_indicate = RT_NULL;
|
device->rx_indicate = RT_NULL;
|
||||||
device->tx_complete = RT_NULL;
|
device->tx_complete = RT_NULL;
|
||||||
device->init = rt_serial_init;
|
device->init = rt_serial_init;
|
||||||
device->open = rt_serial_open;
|
device->open = rt_serial_open;
|
||||||
device->close = rt_serial_close;
|
device->close = rt_serial_close;
|
||||||
device->read = rt_serial_read;
|
device->read = rt_serial_read;
|
||||||
device->write = rt_serial_write;
|
device->write = rt_serial_write;
|
||||||
device->control = rt_serial_control;
|
device->control = rt_serial_control;
|
||||||
device->user_data = serial;
|
device->user_data = serial;
|
||||||
|
|
||||||
/* register a character device */
|
/* register a character device */
|
||||||
return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag);
|
return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag);
|
||||||
@ -303,7 +299,7 @@ void rt_hw_serial_isr(rt_device_t device)
|
|||||||
|
|
||||||
#ifdef RT_USING_UART0
|
#ifdef RT_USING_UART0
|
||||||
/* UART0 device driver structure */
|
/* UART0 device driver structure */
|
||||||
#define UART0 FM3_MFS0_UART
|
#define UART0 FM3_MFS0_UART
|
||||||
struct serial_int_rx uart0_int_rx;
|
struct serial_int_rx uart0_int_rx;
|
||||||
struct serial_device uart0 =
|
struct serial_device uart0 =
|
||||||
{
|
{
|
||||||
@ -327,7 +323,7 @@ void MFS0RX_IRQHandler(void)
|
|||||||
|
|
||||||
#ifdef RT_USING_UART2
|
#ifdef RT_USING_UART2
|
||||||
/* UART2 device driver structure */
|
/* UART2 device driver structure */
|
||||||
#define UART2 FM3_MFS2_UART
|
#define UART2 FM3_MFS2_UART
|
||||||
struct serial_int_rx uart2_int_rx;
|
struct serial_int_rx uart2_int_rx;
|
||||||
struct serial_device uart2 =
|
struct serial_device uart2 =
|
||||||
{
|
{
|
||||||
@ -351,7 +347,7 @@ void MFS2RX_IRQHandler(void)
|
|||||||
|
|
||||||
#ifdef RT_USING_UART4
|
#ifdef RT_USING_UART4
|
||||||
/* UART4 device driver structure */
|
/* UART4 device driver structure */
|
||||||
#define UART4 FM3_MFS4_UART
|
#define UART4 FM3_MFS4_UART
|
||||||
struct serial_int_rx uart4_int_rx;
|
struct serial_int_rx uart4_int_rx;
|
||||||
struct serial_device uart4 =
|
struct serial_device uart4 =
|
||||||
{
|
{
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* File : serial.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006, 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
|
||||||
* 2006-03-13 Bernard first version
|
* 2006-03-13 Bernard first version
|
||||||
* 2011-05-15 lgnq modified according bernard's implementaion.
|
* 2011-05-15 lgnq modified according bernard's implementaion.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RT_HW_SERIAL_H__
|
#ifndef __RT_HW_SERIAL_H__
|
||||||
@ -57,21 +53,21 @@
|
|||||||
#define ESCR_DATABITS_7 0x03U
|
#define ESCR_DATABITS_7 0x03U
|
||||||
#define ESCR_DATABITS_9 0x04U
|
#define ESCR_DATABITS_9 0x04U
|
||||||
|
|
||||||
#define BPS 115200 /* serial baudrate */
|
#define BPS 115200 /* serial baudrate */
|
||||||
|
|
||||||
#define UART_RX_BUFFER_SIZE 64
|
#define UART_RX_BUFFER_SIZE 64
|
||||||
#define UART_TX_BUFFER_SIZE 64
|
#define UART_TX_BUFFER_SIZE 64
|
||||||
|
|
||||||
struct serial_int_rx
|
struct serial_int_rx
|
||||||
{
|
{
|
||||||
rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE];
|
rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE];
|
||||||
rt_uint32_t read_index, save_index;
|
rt_uint32_t read_index, save_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct serial_int_tx
|
struct serial_int_tx
|
||||||
{
|
{
|
||||||
rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE];
|
rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE];
|
||||||
rt_uint32_t write_index, save_index;
|
rt_uint32_t write_index, save_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -83,14 +79,14 @@ struct serial_int_tx
|
|||||||
|
|
||||||
struct serial_device
|
struct serial_device
|
||||||
{
|
{
|
||||||
FM3_MFS03_UART_TypeDef* uart_device;
|
FM3_MFS03_UART_TypeDef* uart_device;
|
||||||
/* irq number */
|
/* irq number */
|
||||||
IRQn_Type rx_irq, tx_irq;
|
IRQn_Type rx_irq, tx_irq;
|
||||||
|
|
||||||
/* rx structure */
|
/* rx structure */
|
||||||
struct serial_int_rx* int_rx;
|
struct serial_int_rx* int_rx;
|
||||||
/* tx structure */
|
/* tx structure */
|
||||||
struct serial_int_tx* int_tx;
|
struct serial_int_tx* int_tx;
|
||||||
};
|
};
|
||||||
|
|
||||||
void rt_hw_serial_isr(rt_device_t device);
|
void rt_hw_serial_isr(rt_device_t device);
|
||||||
|
@ -3,16 +3,16 @@
|
|||||||
#define __RTTHREAD_CFG_H__
|
#define __RTTHREAD_CFG_H__
|
||||||
|
|
||||||
/* RT_NAME_MAX*/
|
/* RT_NAME_MAX*/
|
||||||
#define RT_NAME_MAX 8
|
#define RT_NAME_MAX 8
|
||||||
|
|
||||||
/* RT_ALIGN_SIZE*/
|
/* RT_ALIGN_SIZE*/
|
||||||
#define RT_ALIGN_SIZE 4
|
#define RT_ALIGN_SIZE 4
|
||||||
|
|
||||||
/* PRIORITY_MAX */
|
/* PRIORITY_MAX */
|
||||||
#define RT_THREAD_PRIORITY_MAX 32
|
#define RT_THREAD_PRIORITY_MAX 32
|
||||||
|
|
||||||
/* Tick per Second */
|
/* Tick per Second */
|
||||||
#define RT_TICK_PER_SECOND 100
|
#define RT_TICK_PER_SECOND 100
|
||||||
|
|
||||||
/* SECTION: RT_DEBUG */
|
/* SECTION: RT_DEBUG */
|
||||||
/* Thread Debug */
|
/* Thread Debug */
|
||||||
@ -60,9 +60,9 @@
|
|||||||
/* #define RT_TINY_SIZE */
|
/* #define RT_TINY_SIZE */
|
||||||
#define RT_USING_CONSOLE
|
#define RT_USING_CONSOLE
|
||||||
/* the buffer size of console */
|
/* the buffer size of console */
|
||||||
#define RT_CONSOLEBUF_SIZE 128
|
#define RT_CONSOLEBUF_SIZE 128
|
||||||
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart1" />
|
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart1" />
|
||||||
#define RT_CONSOLE_DEVICE_NAME "uart0"
|
#define RT_CONSOLE_DEVICE_NAME "uart0"
|
||||||
|
|
||||||
/* SECTION: finsh, a C-Express shell */
|
/* SECTION: finsh, a C-Express shell */
|
||||||
/* Using FinSH as Shell*/
|
/* Using FinSH as Shell*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user