Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2345VOR
rt-thread
提交
67ffce7a
R
rt-thread
项目概览
2345VOR
/
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,发现更多精彩内容 >>
提交
67ffce7a
编写于
10月 21, 2017
作者:
B
Bernard Xiong
提交者:
GitHub
10月 21, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #895 from weety/rtt3_9260
[BSP] update at91sam9260 bsp code.
上级
82ca200f
ab7d4fd6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
109 addition
and
11 deletion
+109
-11
bsp/at91sam9260/applications/application.c
bsp/at91sam9260/applications/application.c
+16
-8
bsp/at91sam9260/drivers/board.c
bsp/at91sam9260/drivers/board.c
+93
-3
未找到文件。
bsp/at91sam9260/applications/application.c
浏览文件 @
67ffce7a
...
...
@@ -48,6 +48,8 @@ static int rt_led_app_init(void);
int
main
(
void
)
{
int
timeout
=
0
;
/* Filesystem Initialization */
#ifdef RT_USING_DFS
{
...
...
@@ -74,21 +76,27 @@ int main(void)
rt_mmcsd_core_init
();
rt_mmcsd_blk_init
();
at91_mci_init
();
rt_thread_delay
(
RT_TICK_PER_SECOND
*
2
);
/* mount sd card fat partition 1 as root directory */
timeout
=
0
;
while
((
rt_device_find
(
"sd0"
)
==
RT_NULL
)
&&
(
timeout
++
<
RT_TICK_PER_SECOND
*
2
))
{
rt_thread_delay
(
1
);
}
if
(
timeout
<
RT_TICK_PER_SECOND
*
2
)
{
/* mount sd card fat partition 1 as root directory */
if
(
dfs_mount
(
"sd0"
,
"/"
,
"elm"
,
0
,
0
)
==
0
)
{
rt_kprintf
(
"File System initialized!
\n
"
);
}
else
rt_kprintf
(
"File System initialzation failed!
\n
"
);
#endif
rt_kprintf
(
"File System initialzation failed!%d
\n
"
,
rt_get_errno
());
}
#endif
#ifdef RT_USING_I2C
else
{
rt_i2c_core_init
();
rt_kprintf
(
"No SD card found.
\n
"
);
}
#endif
}
#endif
...
...
bsp/at91sam9260/drivers/board.c
浏览文件 @
67ffce7a
...
...
@@ -150,17 +150,107 @@ static void at91sam926x_pit_init(void)
writel
(
0xffff
,
AT91SAM9260_BASE_TC0
+
AT91_TC_CV
);
}
#define RXRDY 0x01
#define TXRDY (1 << 1)
#define BPS 115200
/* serial baudrate */
typedef
struct
uartport
{
volatile
rt_uint32_t
CR
;
volatile
rt_uint32_t
MR
;
volatile
rt_uint32_t
IER
;
volatile
rt_uint32_t
IDR
;
volatile
rt_uint32_t
IMR
;
volatile
rt_uint32_t
CSR
;
volatile
rt_uint32_t
RHR
;
volatile
rt_uint32_t
THR
;
volatile
rt_uint32_t
BRGR
;
volatile
rt_uint32_t
RTOR
;
volatile
rt_uint32_t
TTGR
;
volatile
rt_uint32_t
reserved0
[
5
];
volatile
rt_uint32_t
FIDI
;
volatile
rt_uint32_t
NER
;
volatile
rt_uint32_t
reserved1
;
volatile
rt_uint32_t
IFR
;
volatile
rt_uint32_t
reserved2
[
44
];
volatile
rt_uint32_t
RPR
;
volatile
rt_uint32_t
RCR
;
volatile
rt_uint32_t
TPR
;
volatile
rt_uint32_t
TCR
;
volatile
rt_uint32_t
RNPR
;
volatile
rt_uint32_t
RNCR
;
volatile
rt_uint32_t
TNPR
;
volatile
rt_uint32_t
TNCR
;
volatile
rt_uint32_t
PTCR
;
volatile
rt_uint32_t
PTSR
;
}
uartport
;
#define CIDR FIDI
#define EXID NER
#define FNR reserved1
#define DBGU ((struct uartport *)AT91SAM9260_BASE_DBGU)
static
void
at91_usart_putc
(
char
c
)
{
while
(
!
(
DBGU
->
CSR
&
TXRDY
));
DBGU
->
THR
=
c
;
}
/**
* This function is used to display a string on console, normally, it's
* invoked by rt_kprintf
*
* @param str the displayed string
*/
void
rt_hw_console_output
(
const
char
*
str
)
{
while
(
*
str
)
{
if
(
*
str
==
'\n'
)
{
at91_usart_putc
(
'\r'
);
}
at91_usart_putc
(
*
str
++
);
}
}
static
void
rt_hw_console_init
(
void
)
{
int
div
;
int
mode
=
0
;
DBGU
->
CR
=
AT91_US_RSTTX
|
AT91_US_RSTRX
|
AT91_US_RXDIS
|
AT91_US_TXDIS
;
mode
|=
AT91_US_USMODE_NORMAL
|
AT91_US_USCLKS_MCK
|
AT91_US_CHMODE_NORMAL
;
mode
|=
AT91_US_CHRL_8
;
mode
|=
AT91_US_NBSTOP_1
;
mode
|=
AT91_US_PAR_NONE
;
DBGU
->
MR
=
mode
;
div
=
(
clk_get_rate
(
clk_get
(
"mck"
))
/
16
+
BPS
/
2
)
/
BPS
;
DBGU
->
BRGR
=
div
;
DBGU
->
CR
=
AT91_US_RXEN
|
AT91_US_TXEN
;
}
/**
* This function will init at91sam9260 board
*/
void
rt_hw_board_init
()
{
/* initialize the system clock */
rt_hw_clock_init
();
/* initialize console */
rt_hw_console_init
();
/* initialize mmu */
rt_hw_mmu_init
(
at91_mem_desc
,
sizeof
(
at91_mem_desc
)
/
sizeof
(
at91_mem_desc
[
0
]));
/* initialize hardware interrupt */
/* initialize hardware interrupt */
rt_hw_interrupt_init
();
/* initialize the system clock */
rt_hw_clock_init
();
/* initialize early device */
#ifdef RT_USING_COMPONENTS_INIT
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录