Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
4f521a0c
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,发现更多精彩内容 >>
提交
4f521a0c
编写于
5月 12, 2019
作者:
lymzzyh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[BSP][qemu-a9] auto generate mac address from host
上级
9eef6441
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
6 deletion
+47
-6
bsp/qemu-vexpress-a9/.gitignore
bsp/qemu-vexpress-a9/.gitignore
+1
-0
bsp/qemu-vexpress-a9/drivers/automac.h
bsp/qemu-vexpress-a9/drivers/automac.h
+15
-0
bsp/qemu-vexpress-a9/drivers/drv_smc911x.c
bsp/qemu-vexpress-a9/drivers/drv_smc911x.c
+7
-6
bsp/qemu-vexpress-a9/rtconfig.py
bsp/qemu-vexpress-a9/rtconfig.py
+24
-0
未找到文件。
bsp/qemu-vexpress-a9/.gitignore
浏览文件 @
4f521a0c
...
...
@@ -41,3 +41,4 @@ settings/
*.uvguix*
cconfig.h
.settings
drivers/automac.h
bsp/qemu-vexpress-a9/drivers/automac.h
0 → 100644
浏览文件 @
4f521a0c
#ifndef __MAC_AUTO_GENERATE_H__
#define __MAC_AUTO_GENERATE_H__
/* Automatically generated file; DO NOT EDIT. */
/* mac configure file for RT-Thread qemu */
#define AUTOMAC0 0x52
#define AUTOMAC1 0x54
#define AUTOMAC2 0x00
#define AUTOMAC3 0x28
#define AUTOMAC4 0xae
#define AUTOMAC5 0xeb
#endif
bsp/qemu-vexpress-a9/drivers/drv_smc911x.c
浏览文件 @
4f521a0c
...
...
@@ -2,6 +2,7 @@
#include <rtthread.h>
#include <netif/ethernetif.h>
#include <lwipopts.h>
#include <automac.h>
#define MAX_ADDR_LEN 6
#define SMC911X_EMAC_DEVICE(eth) (struct eth_device_smc911x*)(eth)
...
...
@@ -512,12 +513,12 @@ int smc911x_emac_hw_init(void)
smc911x_reg_write
(
&
_emac
,
INT_CFG
,
INT_CFG_IRQ_POL
|
INT_CFG_IRQ_TYPE
);
/* test MAC address */
_emac
.
enetaddr
[
0
]
=
0x52
;
_emac
.
enetaddr
[
1
]
=
0x54
;
_emac
.
enetaddr
[
2
]
=
0x00
;
_emac
.
enetaddr
[
3
]
=
0x11
;
_emac
.
enetaddr
[
4
]
=
0x22
;
_emac
.
enetaddr
[
5
]
=
0x33
;
_emac
.
enetaddr
[
0
]
=
AUTOMAC0
;
_emac
.
enetaddr
[
1
]
=
AUTOMAC1
;
_emac
.
enetaddr
[
2
]
=
AUTOMAC2
;
_emac
.
enetaddr
[
3
]
=
AUTOMAC3
;
_emac
.
enetaddr
[
4
]
=
AUTOMAC4
;
_emac
.
enetaddr
[
5
]
=
AUTOMAC5
;
#ifdef RT_USING_DEVICE_OPS
_emac
.
parent
.
parent
.
ops
=
&
smc911x_emac_ops
;
...
...
bsp/qemu-vexpress-a9/rtconfig.py
浏览文件 @
4f521a0c
import
os
import
uuid
def
get_mac_address
():
mac
=
uuid
.
UUID
(
int
=
uuid
.
getnode
()).
hex
[
-
12
:]
return
"#define AUTOMAC"
.
join
([
str
(
e
/
2
+
1
)
+
' 0x'
+
mac
[
e
:
e
+
2
]
+
'
\n
'
for
e
in
range
(
5
,
11
,
2
)])
header
=
'''
#ifndef __MAC_AUTO_GENERATE_H__
#define __MAC_AUTO_GENERATE_H__
/* Automatically generated file; DO NOT EDIT. */
/* mac configure file for RT-Thread qemu */
#define AUTOMAC0 0x52
#define AUTOMAC1 0x54
#define AUTOMAC2 0x00
#define AUTOMAC'''
end
=
'''
#endif
'''
with
open
(
'drivers/automac.h'
,
'w'
)
as
f
:
f
.
write
(
header
+
get_mac_address
()
+
end
)
# toolchains options
ARCH
=
'arm'
CPU
=
'cortex-a'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录