Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
eb8a0236
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
eb8a0236
编写于
3月 31, 2021
作者:
B
Bernard Xiong
提交者:
GitHub
3月 31, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4543 from mysterywolf/amebaz
[amebaz] auto & manual formatted
上级
61be3180
590c84cf
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
57 addition
and
167 deletion
+57
-167
bsp/amebaz/applications/main.c
bsp/amebaz/applications/main.c
+2
-6
bsp/amebaz/applications/smartconfig_app.c
bsp/amebaz/applications/smartconfig_app.c
+2
-16
bsp/amebaz/drivers/board.c
bsp/amebaz/drivers/board.c
+5
-9
bsp/amebaz/drivers/board.h
bsp/amebaz/drivers/board.h
+2
-6
bsp/amebaz/drivers/drv_uart.c
bsp/amebaz/drivers/drv_uart.c
+15
-29
bsp/amebaz/drivers/drv_uart.h
bsp/amebaz/drivers/drv_uart.h
+2
-16
bsp/amebaz/drivers/wlan/drv_wifi.c
bsp/amebaz/drivers/wlan/drv_wifi.c
+7
-21
bsp/amebaz/drivers/wlan/drv_wifi.h
bsp/amebaz/drivers/wlan/drv_wifi.h
+3
-17
bsp/amebaz/drivers/wlan/drv_wlan.c
bsp/amebaz/drivers/wlan/drv_wlan.c
+9
-23
bsp/amebaz/drivers/wlan/drv_wlan.h
bsp/amebaz/drivers/wlan/drv_wlan.h
+10
-24
未找到文件。
bsp/amebaz/applications/main.c
浏览文件 @
eb8a0236
/*
* 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
...
...
bsp/amebaz/applications/smartconfig_app.c
浏览文件 @
eb8a0236
/*
* 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
...
...
bsp/amebaz/drivers/board.c
浏览文件 @
eb8a0236
/*
* 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
);
...
...
bsp/amebaz/drivers/board.h
浏览文件 @
eb8a0236
/*
* 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
...
...
bsp/amebaz/drivers/drv_uart.c
浏览文件 @
eb8a0236
/*
* 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
,
...
...
bsp/amebaz/drivers/drv_uart.h
浏览文件 @
eb8a0236
/*
* 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
...
...
bsp/amebaz/drivers/wlan/drv_wifi.c
浏览文件 @
eb8a0236
/*
* 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
,
...
...
bsp/amebaz/drivers/wlan/drv_wifi.h
浏览文件 @
eb8a0236
/*
* 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__
...
...
bsp/amebaz/drivers/wlan/drv_wlan.c
浏览文件 @
eb8a0236
/*
* 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
(
"
\n
WIFI 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
;
}
...
...
bsp/amebaz/drivers/wlan/drv_wlan.h
浏览文件 @
eb8a0236
/*
* 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
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录