[amebaz] auto & manual formatted
This commit is contained in:
parent
1ba020f3c8
commit
590c84cfcb
|
@ -1,11 +1,7 @@
|
|||
/*
|
||||
* File : startup.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
|
|
@ -1,21 +1,7 @@
|
|||
/*
|
||||
* File : smartconfig_demo.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
/*
|
||||
* File : board.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009 RT-Thread Develop Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
@ -44,7 +40,7 @@ void __wrap_rtl_printf(const char *fmt, ...)
|
|||
* length. */
|
||||
length = rt_vsnprintf(rt_log_buf, sizeof(rt_log_buf) - 1, fmt, args);
|
||||
if (length > RT_CONSOLEBUF_SIZE - 1)
|
||||
length = RT_CONSOLEBUF_SIZE - 1;
|
||||
length = RT_CONSOLEBUF_SIZE - 1;
|
||||
rt_kprintf("%s", rt_log_buf);
|
||||
va_end(args);
|
||||
}
|
||||
|
@ -89,11 +85,11 @@ void rt_hw_board_init(void)
|
|||
#ifdef RT_USING_HEAP
|
||||
rt_system_heap_init((void*)HEAP_BEGIN, (void*)HEAP_END);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
rt_components_board_init();
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RT_USING_CONSOLE
|
||||
rt_hw_uart_init();
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
/*
|
||||
* File : board.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
|
|
@ -1,21 +1,7 @@
|
|||
/*
|
||||
* File : drv_uart.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2017, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
@ -125,7 +111,7 @@ static int ameba_uart_getc (struct rt_serial_device *serial)
|
|||
{
|
||||
struct device_uart* uart = serial->parent.user_data;
|
||||
|
||||
if(!serial_readable(&uart->serial))
|
||||
if(!serial_readable(&uart->serial))
|
||||
return -1;
|
||||
|
||||
/* Receive Data Available */
|
||||
|
@ -140,13 +126,13 @@ static rt_size_t ameba_uart_dma_transmit (struct rt_serial_device *serial, rt_ui
|
|||
static void ameba_uart_irq(uint32_t id, SerialIrq event)
|
||||
{
|
||||
struct rt_serial_device *serial = (struct rt_serial_device *)id;
|
||||
if(event == RxIrq)
|
||||
if(event == RxIrq)
|
||||
{
|
||||
rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_IND);
|
||||
}
|
||||
else if(event == TxIrq)
|
||||
}
|
||||
else if(event == TxIrq)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static rt_err_t dbg_configure(struct rt_serial_device *serial, struct serial_configure *cfg);
|
||||
|
@ -155,7 +141,7 @@ static int dbg_putc(struct rt_serial_device *serial, char c);
|
|||
static int dbg_getc(struct rt_serial_device *serial);
|
||||
|
||||
static struct rt_serial_device ameba_dbg_serial;
|
||||
const struct rt_uart_ops _ambed_dbg_ops =
|
||||
const struct rt_uart_ops _ambed_dbg_ops =
|
||||
{
|
||||
dbg_configure,
|
||||
dbg_control,
|
||||
|
@ -177,7 +163,7 @@ void dbg_uart_irq_handler(void * data)
|
|||
DiagSetIsrEnReg(0);
|
||||
|
||||
rt_hw_serial_isr(&ameba_dbg_serial, RT_SERIAL_EVENT_RX_IND);
|
||||
|
||||
|
||||
DiagSetIsrEnReg(IrqEn);
|
||||
}
|
||||
|
||||
|
@ -192,9 +178,9 @@ static rt_err_t dbg_control(struct rt_serial_device *serial, int cmd, void *arg)
|
|||
|
||||
case RT_DEVICE_CTRL_SET_INT:
|
||||
/* install interrupt */
|
||||
DIAG_UartReInit((IRQ_FUN) dbg_uart_irq_handler);
|
||||
DIAG_UartReInit((IRQ_FUN) dbg_uart_irq_handler);
|
||||
/* Enable the UART Interrupt */
|
||||
NVIC_SetPriority(UART_LOG_IRQ, 10); /* this is rom_code_patch */
|
||||
NVIC_SetPriority(UART_LOG_IRQ, 10); /* this is rom_code_patch */
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -214,12 +200,12 @@ static int dbg_getc(struct rt_serial_device *serial)
|
|||
|
||||
if(!UART_Readable(UART2_DEV))
|
||||
return -1;
|
||||
|
||||
|
||||
c = DiagGetChar(_FALSE);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* UART Initiation
|
||||
*/
|
||||
|
@ -231,7 +217,7 @@ int rt_hw_uart_init(void)
|
|||
#ifdef BSP_USING_UART0
|
||||
{
|
||||
struct device_uart *uart;
|
||||
|
||||
|
||||
serial = &serial0;
|
||||
uart = &uart0;
|
||||
|
||||
|
@ -256,7 +242,7 @@ int rt_hw_uart_init(void)
|
|||
|
||||
serial->ops = &_ambed_dbg_ops;
|
||||
serial->config = config;
|
||||
|
||||
|
||||
rt_hw_serial_register(serial,
|
||||
RT_CONSOLE_DEVICE_NAME,
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||
|
|
|
@ -1,21 +1,7 @@
|
|||
/*
|
||||
* File : drv_uart.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2017, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
|
|
@ -1,21 +1,7 @@
|
|||
/*
|
||||
* File : drv_wifi.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2017, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
@ -115,7 +101,7 @@ void netif_pre_sleep_processing(void)
|
|||
}
|
||||
|
||||
unsigned char *rltk_wlan_get_ip(int idx)
|
||||
{
|
||||
{
|
||||
struct ameba_wifi *wifi;
|
||||
|
||||
wifi = rthw_wifi_get_dev(idx);
|
||||
|
@ -130,7 +116,7 @@ unsigned char *rltk_wlan_get_ip(int idx)
|
|||
|
||||
int netif_is_valid_IP(int idx, unsigned char *ip_dest)
|
||||
{
|
||||
LOG_D("F:%s L:%d is run ip: %d:%d:%d:%d", __FUNCTION__, __LINE__,
|
||||
LOG_D("F:%s L:%d is run ip: %d:%d:%d:%d", __FUNCTION__, __LINE__,
|
||||
ip_dest[0], ip_dest[1], ip_dest[2], ip_dest[3]);
|
||||
return 1;
|
||||
}
|
||||
|
@ -376,9 +362,9 @@ static rt_err_t rthw_wlan_join (struct rt_wlan_device *wlan, str
|
|||
ssid = &sta_info->ssid.val[0];
|
||||
if (sta_info->key.len > 0)
|
||||
key = &sta_info->key.val[0];
|
||||
LOG_D("bssid connect bssid: %02x:%02x:%02x:%02x:%02x:%02x ssid:%s ssid_len:%d key:%s key_len%d",
|
||||
LOG_D("bssid connect bssid: %02x:%02x:%02x:%02x:%02x:%02x ssid:%s ssid_len:%d key:%s key_len%d",
|
||||
sta_info->bssid[0],sta_info->bssid[1],sta_info->bssid[2],sta_info->bssid[3],sta_info->bssid[4],sta_info->bssid[5],
|
||||
ssid,
|
||||
ssid,
|
||||
sta_info->ssid.len,
|
||||
key,
|
||||
sta_info->key.len
|
||||
|
@ -608,7 +594,7 @@ exit:
|
|||
return RT_EOK;
|
||||
}
|
||||
|
||||
static const struct rt_wlan_dev_ops ops =
|
||||
static const struct rt_wlan_dev_ops ops =
|
||||
{
|
||||
.wlan_init = rthw_wlan_init ,
|
||||
.wlan_mode = rthw_wlan_mode ,
|
||||
|
|
|
@ -1,27 +1,13 @@
|
|||
/*
|
||||
* File : drv_wifi.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2017, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-5-30 Bernard the first version
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __DRV_WIFI_H__
|
||||
#define __DRV_WIFI_H__
|
||||
|
||||
|
|
|
@ -1,21 +1,7 @@
|
|||
/*
|
||||
* File : drv_wlan.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2017, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
@ -151,20 +137,20 @@ int rthw_wifi_ap_start(char *ssid, char *password, int channel)
|
|||
return -1;
|
||||
}
|
||||
|
||||
while(1)
|
||||
while(1)
|
||||
{
|
||||
char essid[33];
|
||||
if(wext_get_ssid(name, (unsigned char *) essid) > 0)
|
||||
{
|
||||
if(strcmp((const char *) essid, (const char *)ssid) == 0)
|
||||
if(strcmp((const char *) essid, (const char *)ssid) == 0)
|
||||
{
|
||||
rt_kprintf("%s started\n", ssid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(timeout == 0)
|
||||
if(timeout == 0)
|
||||
{
|
||||
rt_kprintf("Start AP timeout\n");
|
||||
rt_kprintf("Start AP timeout\n");
|
||||
return -1;
|
||||
}
|
||||
rt_thread_delay(1 * RT_TICK_PER_SECOND);
|
||||
|
@ -183,7 +169,7 @@ static int rthw_wifi_disconnect(char *name)
|
|||
if (name == RT_NULL)
|
||||
return -1;
|
||||
|
||||
if (wext_get_ssid(name, (unsigned char *) essid) < 0)
|
||||
if (wext_get_ssid(name, (unsigned char *) essid) < 0)
|
||||
{
|
||||
rt_kprintf("\nWIFI disconnected!\n");
|
||||
return -1;
|
||||
|
@ -203,7 +189,7 @@ static int rthw_wifi_disconnect(char *name)
|
|||
break;
|
||||
}
|
||||
|
||||
if(timeout == 0)
|
||||
if(timeout == 0)
|
||||
{
|
||||
rt_kprintf("ERROR: Deassoc timeout!\n");
|
||||
return -1;
|
||||
|
@ -259,7 +245,7 @@ int rthw_wifi_ap_disconnect(void)
|
|||
|
||||
int rthw_wifi_rssi_get(void)
|
||||
{
|
||||
int rssi = 0;
|
||||
int rssi = 0;
|
||||
wifi_get_rssi(&rssi);
|
||||
return rssi;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,7 @@
|
|||
/*
|
||||
* File : drv_wlan.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2017, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
@ -25,14 +11,14 @@
|
|||
#ifndef __DRV_WLAN_H__
|
||||
#define __DRV_WLAN_H__
|
||||
|
||||
typedef enum
|
||||
typedef enum
|
||||
{
|
||||
RTHW_MODE_NONE = 0,
|
||||
RTHW_MODE_STA,
|
||||
RTHW_MODE_AP,
|
||||
RTHW_MODE_STA_AP,
|
||||
RTHW_MODE_PROMISC,
|
||||
RTHW_MODE_P2P
|
||||
RTHW_MODE_NONE = 0,
|
||||
RTHW_MODE_STA,
|
||||
RTHW_MODE_AP,
|
||||
RTHW_MODE_STA_AP,
|
||||
RTHW_MODE_PROMISC,
|
||||
RTHW_MODE_P2P
|
||||
}rthw_mode_t;
|
||||
|
||||
#define SHARED_ENABLED 0x00008000
|
||||
|
@ -66,7 +52,7 @@ typedef enum {
|
|||
typedef enum {
|
||||
RTHW_WIFI_EVENT_CONNECT = 0,
|
||||
RTHW_WIFI_EVENT_DISCONNECT = 1,
|
||||
RTHW_WIFI_EVENT_FOURWAY_HANDSHAKE_DONE = 2,
|
||||
RTHW_WIFI_EVENT_FOURWAY_HANDSHAKE_DONE = 2,
|
||||
RTHW_WIFI_EVENT_SCAN_RESULT_REPORT = 3,
|
||||
RTHW_WIFI_EVENT_SCAN_DONE = 4,
|
||||
RTHW_WIFI_EVENT_RECONNECTION_FAIL = 5,
|
||||
|
|
Loading…
Reference in New Issue