Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
人间散章
rt-thread
提交
3c99a5bf
R
rt-thread
项目概览
人间散章
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
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,发现更多精彩内容 >>
提交
3c99a5bf
编写于
9月 24, 2014
作者:
wuyangyong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update RW009 wifi driver.
上级
ab205542
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
464 addition
and
218 deletion
+464
-218
components/drivers/spi/spi_wifi_rw009.c
components/drivers/spi/spi_wifi_rw009.c
+380
-182
components/drivers/spi/spi_wifi_rw009.h
components/drivers/spi/spi_wifi_rw009.h
+84
-36
未找到文件。
components/drivers/spi/spi_wifi_rw009.c
浏览文件 @
3c99a5bf
此差异已折叠。
点击以展开。
components/drivers/spi/spi_wifi_rw009.h
浏览文件 @
3c99a5bf
...
...
@@ -20,6 +20,7 @@
* Change Logs:
* Date Author Notes
* 2014-07-31 aozima the first version
* 2014-09-18 aozima update command & response.
*/
#ifndef SPI_WIFI_H_INCLUDED
...
...
@@ -28,7 +29,7 @@
#include <stdint.h>
// little-endian
struct
cmd_request
struct
spi_
cmd_request
{
uint32_t
flag
;
uint32_t
M2S_len
;
// master to slave data len.
...
...
@@ -42,7 +43,7 @@ struct cmd_request
#define CMD_FLAG_MRDY (0x01)
// little-endian
struct
response
struct
spi_
response
{
uint32_t
flag
;
uint32_t
S2M_len
;
// slave to master data len.
...
...
@@ -55,20 +56,16 @@ struct response
#define RESP_MAGIC2 (0x10325476)
/* spi slave configure. */
#define
MAX_DATA_LEN
1520
#define
SPI_MAX_DATA_LEN
1520
#define SPI_TX_POOL_SIZE 2
#define SPI_RX_POOL_SIZE 2
// align check
#if (MAX_DATA_LEN & 0x03) != 0
#error MAX_DATA_LEN must ALIGN to 4byte!
#endif
typedef
enum
{
data_type_eth_data
=
0
,
data_type_cmd
,
data_type_resp
,
data_type_status
,
}
app_data_type_typedef
;
...
...
@@ -76,52 +73,103 @@ struct spi_data_packet
{
uint32_t
data_len
;
uint32_t
data_type
;
char
buffer
[
MAX_DATA_LEN
];
char
buffer
[
SPI_
MAX_DATA_LEN
];
};
/* tools */
#define node_entry(node, type, member) \
((type *)((char *)(node) - (unsigned long)(&((type *)0)->member)))
#define member_offset(type, member) \
((unsigned long)(&((type *)0)->member))
/********************************* RW009 **************************************/
#define MAX_SPI_PACKET_SIZE (member_offset(struct spi_data_packet, buffer) + MAX_DATA_LEN)
/* option */
#define RW009_CMD_TIMEOUT (RT_TICK_PER_SECOND*3)
#define SSID_NAME_LENGTH_MAX (32)
#define PASSWORD_LENGTH_MAX (64)
/********************************* RW009 **************************************/
typedef
struct
_rw009_ap_info
{
char
ssid
[
SSID_NAME_LENGTH_MAX
];
uint8_t
bssid
[
8
];
// 6byte + 2byte PAD.
int
rssi
;
/* Receive Signal Strength Indication in dBm. */
uint32_t
max_data_rate
;
/* Maximum data rate in kilobits/s */
uint32_t
security
;
/* Security type */
uint32_t
channel
;
/* Radio channel that the AP beacon was received on */
}
rw009_ap_info
;
typedef
struct
_rw009_cmd_init
{
uint32_t
mode
;
}
rw009_cmd_init
;
typedef
struct
_rw009_resp_init
{
uint8_t
mac
[
8
];
// 6byte + 2byte PAD.
uint8_t
sn
[
24
];
// serial.
char
version
[
16
];
// firmware version.
}
rw009_resp_init
;
typedef
struct
_rw009_cmd_easy_join
{
char
ssid
[
SSID_NAME_LENGTH_MAX
];
char
passwd
[
PASSWORD_LENGTH_MAX
];
}
rw009_cmd_easy_join
;
typedef
struct
_rw009_cmd_join
{
uint8_t
bssid
[
8
];
// 6byte + 2byte PAD.
char
passwd
[
PASSWORD_LENGTH_MAX
];
}
rw009_cmd_join
;
struct
spi_wifi_cmd
typedef
struct
_rw009_cmd_rssi
{
uint8_t
bssid
[
8
];
// 6byte + 2byte PAD.
}
rw009_cmd_rssi
;
typedef
struct
_rw009_resp_join
{
rw009_ap_info
ap_info
;
}
rw009_resp_join
;
struct
rw009_cmd
{
uint32_t
cmd
;
char
buffer
[
128
];
uint32_t
len
;
/** command body */
union
{
rw009_cmd_init
init
;
rw009_cmd_easy_join
easy_join
;
rw009_cmd_join
join
;
rw009_cmd_rssi
rssi
;
}
params
;
};
struct
spi_wifi
_resp
struct
rw009
_resp
{
uint32_t
cmd
;
char
buffer
[
128
];
uint32_t
len
;
int32_t
result
;
// result for CMD.
/** resp Body */
union
{
rw009_resp_init
init
;
rw009_ap_info
ap_info
;
}
resp
;
};
#define SPI_WIFI_CMD_INIT 128 //wait
#define SPI_WIFI_CMD_SCAN 129 //no wait
#define SPI_WIFI_CMD_JOIN 130 //no wait
#define RW009_CMD_INIT 128
#define RW009_CMD_SCAN 129
#define RW009_CMD_JOIN 130
#define RW009_CMD_EASY_JOIN 131
#define RW009_CMD_RSSI 132
/* porting */
extern
void
spi_wifi_hw_init
(
void
);
extern
void
spi_wifi_int_cmd
(
rt_bool_t
cmd
);
extern
rt_bool_t
spi_wifi_is_busy
(
void
);
#define SSID_NAME_LENGTH_MAX (32)
#define PASSWORD_LENGTH_MAX (32)
struct
cmd_join
{
char
ssid
[
SSID_NAME_LENGTH_MAX
];
char
passwd
[
PASSWORD_LENGTH_MAX
];
uint8_t
bssid
[
8
];
// 6byte + 2byte PAD.
uint32_t
channel
;
uint32_t
security
;
};
/* export API. */
extern
int32_t
rw009_rssi
(
void
);
extern
rt_err_t
rw009_join
(
const
char
*
SSID
,
const
char
*
passwd
);
#endif // SPI_WIFI_H_INCLUDED
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录