Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
48ca812d
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,发现更多精彩内容 >>
提交
48ca812d
编写于
3月 11, 2019
作者:
J
jicheng0622
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change license, update Readme and fixed some compability issues
上级
82cc9a9e
变更
33
展开全部
隐藏空白更改
内联
并排
Showing
33 changed file
with
345 addition
and
1207 deletion
+345
-1207
bsp/imxrt/Libraries/imxrt1021/drivers/drv_cache.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_cache.c
+2
-6
bsp/imxrt/Libraries/imxrt1021/drivers/drv_codec.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_codec.c
+22
-12
bsp/imxrt/Libraries/imxrt1021/drivers/drv_codec.h
bsp/imxrt/Libraries/imxrt1021/drivers/drv_codec.h
+8
-0
bsp/imxrt/Libraries/imxrt1021/drivers/drv_eth.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_eth.c
+29
-32
bsp/imxrt/Libraries/imxrt1021/drivers/drv_flexspi_nor.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_flexspi_nor.c
+1
-0
bsp/imxrt/Libraries/imxrt1021/drivers/drv_hwtimer.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_hwtimer.c
+21
-34
bsp/imxrt/Libraries/imxrt1021/drivers/drv_hwtimer.h
bsp/imxrt/Libraries/imxrt1021/drivers/drv_hwtimer.h
+6
-19
bsp/imxrt/Libraries/imxrt1021/drivers/drv_i2c.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_i2c.c
+29
-41
bsp/imxrt/Libraries/imxrt1021/drivers/drv_i2c.h
bsp/imxrt/Libraries/imxrt1021/drivers/drv_i2c.h
+3
-7
bsp/imxrt/Libraries/imxrt1021/drivers/drv_pcf8574.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_pcf8574.c
+2
-6
bsp/imxrt/Libraries/imxrt1021/drivers/drv_pcf8574.h
bsp/imxrt/Libraries/imxrt1021/drivers/drv_pcf8574.h
+2
-6
bsp/imxrt/Libraries/imxrt1021/drivers/drv_pin.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_pin.c
+155
-210
bsp/imxrt/Libraries/imxrt1021/drivers/drv_pin.h
bsp/imxrt/Libraries/imxrt1021/drivers/drv_pin.h
+2
-6
bsp/imxrt/Libraries/imxrt1021/drivers/drv_rtc.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_rtc.c
+15
-18
bsp/imxrt/Libraries/imxrt1021/drivers/drv_rtc.h
bsp/imxrt/Libraries/imxrt1021/drivers/drv_rtc.h
+2
-6
bsp/imxrt/Libraries/imxrt1021/drivers/drv_sdio.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_sdio.c
+3
-29
bsp/imxrt/Libraries/imxrt1021/drivers/drv_sdram.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_sdram.c
+4
-33
bsp/imxrt/Libraries/imxrt1021/drivers/drv_spi_bus.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_spi_bus.c
+3
-6
bsp/imxrt/Libraries/imxrt1021/drivers/drv_spi_bus.h
bsp/imxrt/Libraries/imxrt1021/drivers/drv_spi_bus.h
+2
-6
bsp/imxrt/Libraries/imxrt1021/drivers/drv_spi_flash.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_spi_flash.c
+2
-6
bsp/imxrt/Libraries/imxrt1021/drivers/drv_spi_flash.h
bsp/imxrt/Libraries/imxrt1021/drivers/drv_spi_flash.h
+2
-6
bsp/imxrt/Libraries/imxrt1021/drivers/drv_uart.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_uart.c
+3
-6
bsp/imxrt/Libraries/imxrt1021/drivers/drv_uart.h
bsp/imxrt/Libraries/imxrt1021/drivers/drv_uart.h
+3
-6
bsp/imxrt/Libraries/imxrt1021/drivers/drv_usbd.c
bsp/imxrt/Libraries/imxrt1021/drivers/drv_usbd.c
+2
-6
bsp/imxrt/imxrt1021-evk/README.md
bsp/imxrt/imxrt1021-evk/README.md
+13
-14
bsp/imxrt/imxrt1021-evk/applications/device_test.c
bsp/imxrt/imxrt1021-evk/applications/device_test.c
+0
-517
bsp/imxrt/imxrt1021-evk/applications/mem_dump.c
bsp/imxrt/imxrt1021-evk/applications/mem_dump.c
+0
-50
bsp/imxrt/imxrt1021-evk/applications/mem_test.c
bsp/imxrt/imxrt1021-evk/applications/mem_test.c
+0
-103
bsp/imxrt/imxrt1021-evk/drivers/board.c
bsp/imxrt/imxrt1021-evk/drivers/board.c
+3
-6
bsp/imxrt/imxrt1021-evk/drivers/board.h
bsp/imxrt/imxrt1021-evk/drivers/board.h
+3
-7
bsp/imxrt/imxrt1021-evk/rtconfig.py
bsp/imxrt/imxrt1021-evk/rtconfig.py
+1
-1
bsp/imxrt/imxrt1021-evk/template.uvoptx
bsp/imxrt/imxrt1021-evk/template.uvoptx
+1
-1
bsp/imxrt/imxrt1021-evk/template.uvprojx
bsp/imxrt/imxrt1021-evk/template.uvprojx
+1
-1
未找到文件。
bsp/imxrt/Libraries/imxrt1021/drivers/drv_cache.c
浏览文件 @
48ca812d
/*
* File : drv_cache.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* Copyright (c) 2006-2018, 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/imxrt/Libraries/imxrt1021/drivers/drv_codec.c
浏览文件 @
48ca812d
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
*/
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
...
...
@@ -55,21 +65,21 @@ static void _InitPins(void)
{
CLOCK_EnableClock
(
kCLOCK_Iomuxc
);
IOMUXC_SetPinMux
(
IOMUXC_GPIO_AD_B1_
00
_LPI2C1_SCL
,
1
);
IOMUXC_SetPinMux
(
IOMUXC_GPIO_AD_B1_
01
_LPI2C1_SDA
,
1
);
IOMUXC_SetPinMux
(
IOMUXC_GPIO_AD_B1_
14
_LPI2C1_SCL
,
1
);
IOMUXC_SetPinMux
(
IOMUXC_GPIO_AD_B1_
15
_LPI2C1_SDA
,
1
);
IOMUXC_SetPinConfig
(
IOMUXC_GPIO_AD_B1_
00
_LPI2C1_SCL
,
0xD8B0u
);
IOMUXC_SetPinConfig
(
IOMUXC_GPIO_AD_B1_01
_LPI2C1_SDA
,
0xD8B0u
);
IOMUXC_SetPinConfig
(
IOMUXC_GPIO_AD_B1_
14
_LPI2C1_SCL
,
0xD8B0u
);
IOMUXC_SetPinConfig
(
IOMUXC_GPIO_AD_B1_15
_LPI2C1_SDA
,
0xD8B0u
);
IOMUXC_SetPinMux
(
IOMUXC_GPIO_AD_B1_0
9
_SAI1_MCLK
,
1U
);
IOMUXC_SetPinMux
(
IOMUXC_GPIO_AD_B1_
1
3_SAI1_TX_DATA00
,
1U
);
IOMUXC_SetPinMux
(
IOMUXC_GPIO_AD_B1_
14
_SAI1_TX_BCLK
,
1U
);
IOMUXC_SetPinMux
(
IOMUXC_GPIO_AD_B1_
15
_SAI1_TX_SYNC
,
1U
);
IOMUXC_SetPinMux
(
IOMUXC_GPIO_AD_B1_0
0
_SAI1_MCLK
,
1U
);
IOMUXC_SetPinMux
(
IOMUXC_GPIO_AD_B1_
0
3_SAI1_TX_DATA00
,
1U
);
IOMUXC_SetPinMux
(
IOMUXC_GPIO_AD_B1_
01
_SAI1_TX_BCLK
,
1U
);
IOMUXC_SetPinMux
(
IOMUXC_GPIO_AD_B1_
02
_SAI1_TX_SYNC
,
1U
);
IOMUXC_SetPinConfig
(
IOMUXC_GPIO_AD_B1_0
9
_SAI1_MCLK
,
0x10B0u
);
IOMUXC_SetPinConfig
(
IOMUXC_GPIO_AD_B1_
1
3_SAI1_TX_DATA00
,
0x10B0u
);
IOMUXC_SetPinConfig
(
IOMUXC_GPIO_AD_B1_
14
_SAI1_TX_BCLK
,
0x10B0u
);
IOMUXC_SetPinConfig
(
IOMUXC_GPIO_AD_B1_
15
_SAI1_TX_SYNC
,
0x10B0u
);
IOMUXC_SetPinConfig
(
IOMUXC_GPIO_AD_B1_0
0
_SAI1_MCLK
,
0x10B0u
);
IOMUXC_SetPinConfig
(
IOMUXC_GPIO_AD_B1_
0
3_SAI1_TX_DATA00
,
0x10B0u
);
IOMUXC_SetPinConfig
(
IOMUXC_GPIO_AD_B1_
01
_SAI1_TX_BCLK
,
0x10B0u
);
IOMUXC_SetPinConfig
(
IOMUXC_GPIO_AD_B1_
02
_SAI1_TX_SYNC
,
0x10B0u
);
}
static
void
BOARD_EnableSaiMclkOutput
(
bool
enable
)
...
...
bsp/imxrt/Libraries/imxrt1021/drivers/drv_codec.h
浏览文件 @
48ca812d
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
*/
#ifndef __DRV_CODEC_H__
#define __DRV_CODEC_H__
...
...
bsp/imxrt/Libraries/imxrt1021/drivers/drv_eth.c
浏览文件 @
48ca812d
/*
* File : application.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* Copyright (c) 2006-2018, 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
* 2017-06-08 tanek first implementation
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
*/
#include <rtthread.h>
#include "board.h"
...
...
@@ -386,13 +383,13 @@ static void _enet_config(void)
/* Set SMI to get PHY link status. */
sysClock
=
CLOCK_GetFreq
(
kCLOCK_AhbClk
);
dbg_log
(
DBG_LOG
,
"deinit
\n
"
);
LOG_D
(
"deinit
\n
"
);
ENET_Deinit
(
imxrt_eth_device
.
enet_base
);
dbg_log
(
DBG_LOG
,
"init
\n
"
);
LOG_D
(
"init
\n
"
);
ENET_Init
(
imxrt_eth_device
.
enet_base
,
&
imxrt_eth_device
.
enet_handle
,
&
config
,
&
buffConfig
,
&
imxrt_eth_device
.
dev_addr
[
0
],
sysClock
);
dbg_log
(
DBG_LOG
,
"set call back
\n
"
);
LOG_D
(
"set call back
\n
"
);
ENET_SetCallback
(
&
imxrt_eth_device
.
enet_handle
,
_enet_callback
,
&
imxrt_eth_device
);
dbg_log
(
DBG_LOG
,
"active read
\n
"
);
LOG_D
(
"active read
\n
"
);
ENET_ActiveRead
(
imxrt_eth_device
.
enet_base
);
}
...
...
@@ -436,7 +433,7 @@ static void packet_dump(const char *msg, const struct pbuf *p)
/* initialize the interface */
static
rt_err_t
rt_imxrt_eth_init
(
rt_device_t
dev
)
{
dbg_log
(
DBG_LOG
,
"rt_imxrt_eth_init...
\n
"
);
LOG_D
(
"rt_imxrt_eth_init...
\n
"
);
_enet_config
();
return
RT_EOK
;
...
...
@@ -444,33 +441,33 @@ static rt_err_t rt_imxrt_eth_init(rt_device_t dev)
static
rt_err_t
rt_imxrt_eth_open
(
rt_device_t
dev
,
rt_uint16_t
oflag
)
{
dbg_log
(
DBG_LOG
,
"rt_imxrt_eth_open...
\n
"
);
LOG_D
(
"rt_imxrt_eth_open...
\n
"
);
return
RT_EOK
;
}
static
rt_err_t
rt_imxrt_eth_close
(
rt_device_t
dev
)
{
dbg_log
(
DBG_LOG
,
"rt_imxrt_eth_close...
\n
"
);
LOG_D
(
"rt_imxrt_eth_close...
\n
"
);
return
RT_EOK
;
}
static
rt_size_t
rt_imxrt_eth_read
(
rt_device_t
dev
,
rt_off_t
pos
,
void
*
buffer
,
rt_size_t
size
)
{
dbg_log
(
DBG_LOG
,
"rt_imxrt_eth_read...
\n
"
);
LOG_D
(
"rt_imxrt_eth_read...
\n
"
);
rt_set_errno
(
-
RT_ENOSYS
);
return
0
;
}
static
rt_size_t
rt_imxrt_eth_write
(
rt_device_t
dev
,
rt_off_t
pos
,
const
void
*
buffer
,
rt_size_t
size
)
{
dbg_log
(
DBG_LOG
,
"rt_imxrt_eth_write...
\n
"
);
LOG_D
(
"rt_imxrt_eth_write...
\n
"
);
rt_set_errno
(
-
RT_ENOSYS
);
return
0
;
}
static
rt_err_t
rt_imxrt_eth_control
(
rt_device_t
dev
,
int
cmd
,
void
*
args
)
{
dbg_log
(
DBG_LOG
,
"rt_imxrt_eth_control...
\n
"
);
LOG_D
(
"rt_imxrt_eth_control...
\n
"
);
switch
(
cmd
)
{
case
NIOCTL_GADDR
:
...
...
@@ -679,7 +676,7 @@ rt_err_t rt_imxrt_eth_tx(rt_device_t dev, struct pbuf *p)
RT_ASSERT
(
p
!=
NULL
);
RT_ASSERT
(
enet_handle
!=
RT_NULL
);
dbg_log
(
DBG_LOG
,
"rt_imxrt_eth_tx: %d
\n
"
,
p
->
len
);
LOG_D
(
"rt_imxrt_eth_tx: %d
\n
"
,
p
->
len
);
#ifdef ETH_TX_DUMP
packet_dump
(
"send"
,
p
);
...
...
@@ -733,18 +730,18 @@ struct pbuf *rt_imxrt_eth_rx(rt_device_t dev)
}
else
{
dbg_log
(
DBG_LOG
,
" A frame read failed
\n
"
);
LOG_D
(
" A frame read failed
\n
"
);
pbuf_free
(
p
);
}
}
else
{
dbg_log
(
DBG_LOG
,
" pbuf_alloc faild
\n
"
);
LOG_D
(
" pbuf_alloc faild
\n
"
);
}
}
else
if
(
status
==
kStatus_ENET_RxFrameError
)
{
dbg_log
(
DBG_WARNING
,
"ENET_GetRxFrameSize: kStatus_ENET_RxFrameError
\n
"
);
LOG_W
(
"ENET_GetRxFrameSize: kStatus_ENET_RxFrameError
\n
"
);
/* Update the received buffer when error happened. */
/* Get the error information of the received g_frame. */
ENET_GetRxErrBeforeReadFrame
(
enet_handle
,
error_statistic
);
...
...
@@ -782,20 +779,20 @@ static void phy_monitor_thread_entry(void *parameter)
if
(
kPHY_Speed10M
==
speed
)
{
dbg_log
(
DBG_LOG
,
"10M
\n
"
);
LOG_D
(
"10M
\n
"
);
}
else
{
dbg_log
(
DBG_LOG
,
"100M
\n
"
);
LOG_D
(
"100M
\n
"
);
}
if
(
kPHY_HalfDuplex
==
duplex
)
{
dbg_log
(
DBG_LOG
,
"half dumplex
\n
"
);
LOG_D
(
"half dumplex
\n
"
);
}
else
{
dbg_log
(
DBG_LOG
,
"full dumplex
\n
"
);
LOG_D
(
"full dumplex
\n
"
);
}
if
((
imxrt_eth_device
.
speed
!=
(
enet_mii_speed_t
)
speed
)
...
...
@@ -804,19 +801,19 @@ static void phy_monitor_thread_entry(void *parameter)
imxrt_eth_device
.
speed
=
(
enet_mii_speed_t
)
speed
;
imxrt_eth_device
.
duplex
=
(
enet_mii_duplex_t
)
duplex
;
dbg_log
(
DBG_LOG
,
"link up, and update eth mode.
\n
"
);
LOG_D
(
"link up, and update eth mode.
\n
"
);
rt_imxrt_eth_init
((
rt_device_t
)
&
imxrt_eth_device
);
}
else
{
dbg_log
(
DBG_LOG
,
"link up, eth not need re-config.
\n
"
);
LOG_D
(
"link up, eth not need re-config.
\n
"
);
}
dbg_log
(
DBG_LOG
,
"link up.
\n
"
);
LOG_D
(
"link up.
\n
"
);
eth_device_linkchange
(
&
imxrt_eth_device
.
parent
,
RT_TRUE
);
}
else
// link down
{
dbg_log
(
DBG_LOG
,
"link down.
\n
"
);
LOG_D
(
"link down.
\n
"
);
eth_device_linkchange
(
&
imxrt_eth_device
.
parent
,
RT_FALSE
);
}
}
...
...
@@ -858,20 +855,20 @@ static int rt_hw_imxrt_eth_init(void)
imxrt_eth_device
.
parent
.
eth_rx
=
rt_imxrt_eth_rx
;
imxrt_eth_device
.
parent
.
eth_tx
=
rt_imxrt_eth_tx
;
dbg_log
(
DBG_LOG
,
"sem init: tx_wait
\r\n
"
);
LOG_D
(
"sem init: tx_wait
\r\n
"
);
/* init tx semaphore */
rt_sem_init
(
&
imxrt_eth_device
.
tx_wait
,
"tx_wait"
,
0
,
RT_IPC_FLAG_FIFO
);
/* register eth device */
dbg_log
(
DBG_LOG
,
"eth_device_init start
\r\n
"
);
LOG_D
(
"eth_device_init start
\r\n
"
);
state
=
eth_device_init
(
&
(
imxrt_eth_device
.
parent
),
"e0"
);
if
(
RT_EOK
==
state
)
{
dbg_log
(
DBG_LOG
,
"eth_device_init success
\r\n
"
);
LOG_D
(
"eth_device_init success
\r\n
"
);
}
else
{
dbg_log
(
DBG_LOG
,
"eth_device_init faild: %d
\r\n
"
,
state
);
LOG_D
(
"eth_device_init faild: %d
\r\n
"
,
state
);
}
eth_device_linkchange
(
&
imxrt_eth_device
.
parent
,
RT_FALSE
);
...
...
bsp/imxrt/Libraries/imxrt1021/drivers/drv_flexspi_nor.c
浏览文件 @
48ca812d
...
...
@@ -6,6 +6,7 @@
* Change Logs:
* Date Author Notes
* 2018-07-05 ZYH the first version
* 2019-03-11 JiCheng Remove section"itcm", use scatter file to allocate drv_flexspi.o to itcm
*/
#include <rtthread.h>
#define PRINTF rt_kprintf
...
...
bsp/imxrt/Libraries/imxrt1021/drivers/drv_hwtimer.c
浏览文件 @
48ca812d
/*
* File : drv_hwtimer.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2017, 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.
*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-04-17 WangBing the first version.
* 2019-03-11 JiCheng Change API name from rt1052 to rt1021
*/
#include <rtthread.h>
...
...
@@ -47,7 +34,7 @@ static void NVIC_Configuration(void)
EnableIRQ
(
GPT1_IRQn
);
}
static
rt_err_t
rt10
52
_hwtimer_control
(
rt_hwtimer_t
*
timer
,
rt_uint32_t
cmd
,
void
*
args
)
static
rt_err_t
rt10
21
_hwtimer_control
(
rt_hwtimer_t
*
timer
,
rt_uint32_t
cmd
,
void
*
args
)
{
rt_err_t
err
=
RT_EOK
;
GPT_Type
*
hwtimer_dev
;
...
...
@@ -73,7 +60,7 @@ static rt_err_t rt1052_hwtimer_control(rt_hwtimer_t *timer, rt_uint32_t cmd, voi
return
err
;
}
static
rt_uint32_t
rt10
52
_hwtimer_count_get
(
rt_hwtimer_t
*
timer
)
static
rt_uint32_t
rt10
21
_hwtimer_count_get
(
rt_hwtimer_t
*
timer
)
{
rt_uint32_t
CurrentTimer_Count
;
GPT_Type
*
hwtimer_dev
;
...
...
@@ -86,7 +73,7 @@ static rt_uint32_t rt1052_hwtimer_count_get(rt_hwtimer_t *timer)
return
CurrentTimer_Count
;
}
static
void
rt10
52
_hwtimer_init
(
rt_hwtimer_t
*
timer
,
rt_uint32_t
state
)
static
void
rt10
21
_hwtimer_init
(
rt_hwtimer_t
*
timer
,
rt_uint32_t
state
)
{
GPT_Type
*
hwtimer_dev
;
gpt_config_t
gptConfig
;
...
...
@@ -108,7 +95,7 @@ static void rt1052_hwtimer_init(rt_hwtimer_t *timer, rt_uint32_t state)
}
}
static
rt_err_t
rt10
52
_hwtimer_start
(
rt_hwtimer_t
*
timer
,
rt_uint32_t
cnt
,
rt_hwtimer_mode_t
mode
)
static
rt_err_t
rt10
21
_hwtimer_start
(
rt_hwtimer_t
*
timer
,
rt_uint32_t
cnt
,
rt_hwtimer_mode_t
mode
)
{
GPT_Type
*
hwtimer_dev
;
hwtimer_dev
=
(
GPT_Type
*
)
timer
->
parent
.
user_data
;
...
...
@@ -128,7 +115,7 @@ static rt_err_t rt1052_hwtimer_start(rt_hwtimer_t *timer, rt_uint32_t cnt, rt_hw
return
RT_EOK
;
}
static
void
rt10
52
_hwtimer_stop
(
rt_hwtimer_t
*
timer
)
static
void
rt10
21
_hwtimer_stop
(
rt_hwtimer_t
*
timer
)
{
GPT_Type
*
hwtimer_dev
;
hwtimer_dev
=
(
GPT_Type
*
)
timer
->
parent
.
user_data
;
...
...
@@ -138,16 +125,16 @@ static void rt1052_hwtimer_stop(rt_hwtimer_t *timer)
GPT_StopTimer
(
hwtimer_dev
);
}
static
const
struct
rt_hwtimer_ops
rt10
52
_hwtimer_ops
=
static
const
struct
rt_hwtimer_ops
rt10
21
_hwtimer_ops
=
{
rt10
52
_hwtimer_init
,
rt10
52
_hwtimer_start
,
rt10
52
_hwtimer_stop
,
rt10
52
_hwtimer_count_get
,
rt10
52
_hwtimer_control
,
rt10
21
_hwtimer_init
,
rt10
21
_hwtimer_start
,
rt10
21
_hwtimer_stop
,
rt10
21
_hwtimer_count_get
,
rt10
21
_hwtimer_control
,
};
static
const
struct
rt_hwtimer_info
rt10
52
_hwtimer_info
=
static
const
struct
rt_hwtimer_info
rt10
21
_hwtimer_info
=
{
25000000
,
/* the maximum count frequency can be set */
6103
,
/* the minimum count frequency can be set */
...
...
@@ -157,12 +144,12 @@ static const struct rt_hwtimer_info rt1052_hwtimer_info =
static
rt_hwtimer_t
GPT_timer1
;
int
rt10
52
_hw_hwtimer_init
(
void
)
int
rt10
21
_hw_hwtimer_init
(
void
)
{
int
ret
=
RT_EOK
;
GPT_timer1
.
info
=
&
rt10
52
_hwtimer_info
;
GPT_timer1
.
ops
=
&
rt10
52
_hwtimer_ops
;
GPT_timer1
.
info
=
&
rt10
21
_hwtimer_info
;
GPT_timer1
.
ops
=
&
rt10
21
_hwtimer_ops
;
rt_device_hwtimer_register
(
&
GPT_timer1
,
"_timer"
,
GPT1
);
...
...
@@ -184,6 +171,6 @@ void GPT1_IRQHandler(void)
#endif
}
INIT_DEVICE_EXPORT
(
rt10
52
_hw_hwtimer_init
);
INIT_DEVICE_EXPORT
(
rt10
21
_hw_hwtimer_init
);
#endif
/*RT_USING_HWTIMER*/
bsp/imxrt/Libraries/imxrt1021/drivers/drv_hwtimer.h
浏览文件 @
48ca812d
/*
* File : drv_hwtimer.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2017, 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.
*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-04-17 WangBing the first version.
* 2019-03-11 JiCheng Change API name from rt1052 to rt1021
*/
#ifndef __DRV_HWTIMER_H__
...
...
@@ -28,7 +15,7 @@
#include <rtthread.h>
#include <rtdevice.h>
int
rt10
52
_hw_hwtimer_init
(
void
);
int
rt10
21
_hw_hwtimer_init
(
void
);
#endif
bsp/imxrt/Libraries/imxrt1021/drivers/drv_i2c.c
浏览文件 @
48ca812d
/*
* File : drv_i2c.c
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
* Copyright (c) 2006-2018, 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-08-08 Yang the first version
* 2018-03-24 LaiYiKeTang add hardware iic
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
*/
#include <rtthread.h>
...
...
@@ -44,7 +32,7 @@
#define LPI2C_CLOCK_FREQUENCY ((CLOCK_GetFreq(kCLOCK_Usb1PllClk) / 8) / (LPI2C_CLOCK_SOURCE_DIVIDER))
#ifdef RT_USING_HW_I2C1
static
struct
rt10
52
_i2c_bus
lpi2c1
=
static
struct
rt10
21
_i2c_bus
lpi2c1
=
{
.
I2C
=
LPI2C1
,
.
device_name
=
I2C1BUS_NAME
,
...
...
@@ -52,7 +40,7 @@ static struct rt1052_i2c_bus lpi2c1 =
#endif
/* RT_USING_HW_I2C1 */
#ifdef RT_USING_HW_I2C2
static
struct
rt10
52
_i2c_bus
lpi2c2
=
static
struct
rt10
21
_i2c_bus
lpi2c2
=
{
.
I2C
=
LPI2C2
,
.
device_name
=
I2C2BUS_NAME
,
...
...
@@ -60,7 +48,7 @@ static struct rt1052_i2c_bus lpi2c2 =
#endif
/* RT_USING_HW_I2C2 */
#ifdef RT_USING_HW_I2C3
static
struct
rt10
52
_i2c_bus
lpi2c3
=
static
struct
rt10
21
_i2c_bus
lpi2c3
=
{
.
I2C
=
LPI2C3
,
.
device_name
=
I2C3BUS_NAME
,
...
...
@@ -68,7 +56,7 @@ static struct rt1052_i2c_bus lpi2c3 =
#endif
/* RT_USING_HW_I2C3 */
#ifdef RT_USING_HW_I2C4
static
struct
rt10
52
_i2c_bus
lpi2c4
=
static
struct
rt10
21
_i2c_bus
lpi2c4
=
{
.
I2C
=
LPI2C4
,
.
device_name
=
I2C4BUS_NAME
,
...
...
@@ -94,7 +82,7 @@ static const struct rt_i2c_bus_device_ops imxrt_i2c_ops =
imxrt_i2c_bus_control
,
};
void
imxrt_lpi2c_gpio_init
(
struct
rt10
52
_i2c_bus
*
bus
)
void
imxrt_lpi2c_gpio_init
(
struct
rt10
21
_i2c_bus
*
bus
)
{
if
(
bus
->
I2C
==
LPI2C1
)
{
...
...
@@ -162,7 +150,7 @@ void imxrt_lpi2c_gpio_init(struct rt1052_i2c_bus *bus)
}
}
static
rt_err_t
imxrt_lpi2c_configure
(
struct
rt10
52
_i2c_bus
*
bus
,
lpi2c_master_config_t
*
cfg
)
static
rt_err_t
imxrt_lpi2c_configure
(
struct
rt10
21
_i2c_bus
*
bus
,
lpi2c_master_config_t
*
cfg
)
{
RT_ASSERT
(
bus
!=
RT_NULL
);
RT_ASSERT
(
cfg
!=
RT_NULL
);
...
...
@@ -250,36 +238,36 @@ static rt_size_t imxrt_i2c_mst_xfer(struct rt_i2c_bus_device *bus,
struct
rt_i2c_msg
msgs
[],
rt_uint32_t
num
)
{
struct
rt10
52_i2c_bus
*
rt1052
_i2c
;
struct
rt10
21_i2c_bus
*
rt1021
_i2c
;
rt_size_t
i
;
RT_ASSERT
(
bus
!=
RT_NULL
);
rt10
52_i2c
=
(
struct
rt1052
_i2c_bus
*
)
bus
;
rt10
21_i2c
=
(
struct
rt1021
_i2c_bus
*
)
bus
;
rt10
52
_i2c
->
msg
=
msgs
;
rt10
52
_i2c
->
msg_ptr
=
0
;
rt10
52
_i2c
->
msg_cnt
=
num
;
rt10
52
_i2c
->
dptr
=
0
;
rt10
21
_i2c
->
msg
=
msgs
;
rt10
21
_i2c
->
msg_ptr
=
0
;
rt10
21
_i2c
->
msg_cnt
=
num
;
rt10
21
_i2c
->
dptr
=
0
;
for
(
i
=
0
;
i
<
num
;
i
++
)
{
if
(
rt10
52
_i2c
->
msg
[
i
].
flags
&
RT_I2C_RD
)
if
(
rt10
21
_i2c
->
msg
[
i
].
flags
&
RT_I2C_RD
)
{
if
(
LPI2C_MasterStart
(
rt10
52_i2c
->
I2C
,
rt1052
_i2c
->
msg
[
i
].
addr
,
kLPI2C_Read
)
!=
kStatus_Success
)
if
(
LPI2C_MasterStart
(
rt10
21_i2c
->
I2C
,
rt1021
_i2c
->
msg
[
i
].
addr
,
kLPI2C_Read
)
!=
kStatus_Success
)
{
i
=
0
;
break
;
}
if
(
LPI2C_MasterWaitForTxFifoAllEmpty
(
rt10
52
_i2c
->
I2C
)
!=
kStatus_Success
)
if
(
LPI2C_MasterWaitForTxFifoAllEmpty
(
rt10
21
_i2c
->
I2C
)
!=
kStatus_Success
)
{
i
=
0
;
break
;
}
if
(
LPI2C_MasterReceive
(
rt10
52_i2c
->
I2C
,
rt1052_i2c
->
msg
[
i
].
buf
,
rt1052
_i2c
->
msg
[
i
].
len
)
!=
kStatus_Success
)
if
(
LPI2C_MasterReceive
(
rt10
21_i2c
->
I2C
,
rt1021_i2c
->
msg
[
i
].
buf
,
rt1021
_i2c
->
msg
[
i
].
len
)
!=
kStatus_Success
)
{
i
=
0
;
break
;
}
if
(
LPI2C_MasterWaitForTxFifoAllEmpty
(
rt10
52
_i2c
->
I2C
)
!=
kStatus_Success
)
if
(
LPI2C_MasterWaitForTxFifoAllEmpty
(
rt10
21
_i2c
->
I2C
)
!=
kStatus_Success
)
{
i
=
0
;
break
;
...
...
@@ -287,22 +275,22 @@ static rt_size_t imxrt_i2c_mst_xfer(struct rt_i2c_bus_device *bus,
}
else
{
if
(
LPI2C_MasterStart
(
rt10
52_i2c
->
I2C
,
rt1052
_i2c
->
msg
[
i
].
addr
,
kLPI2C_Write
)
!=
kStatus_Success
)
if
(
LPI2C_MasterStart
(
rt10
21_i2c
->
I2C
,
rt1021
_i2c
->
msg
[
i
].
addr
,
kLPI2C_Write
)
!=
kStatus_Success
)
{
i
=
0
;
break
;
}
if
(
LPI2C_MasterWaitForTxFifoAllEmpty
(
rt10
52
_i2c
->
I2C
)
!=
kStatus_Success
)
if
(
LPI2C_MasterWaitForTxFifoAllEmpty
(
rt10
21
_i2c
->
I2C
)
!=
kStatus_Success
)
{
i
=
0
;
break
;
}
if
(
LPI2C_MasterSend
(
rt10
52_i2c
->
I2C
,
rt1052_i2c
->
msg
[
i
].
buf
,
rt1052
_i2c
->
msg
[
i
].
len
)
!=
kStatus_Success
)
if
(
LPI2C_MasterSend
(
rt10
21_i2c
->
I2C
,
rt1021_i2c
->
msg
[
i
].
buf
,
rt1021
_i2c
->
msg
[
i
].
len
)
!=
kStatus_Success
)
{
i
=
0
;
break
;
}
if
(
LPI2C_MasterWaitForTxFifoAllEmpty
(
rt10
52
_i2c
->
I2C
)
!=
kStatus_Success
)
if
(
LPI2C_MasterWaitForTxFifoAllEmpty
(
rt10
21
_i2c
->
I2C
)
!=
kStatus_Success
)
{
i
=
0
;
break
;
...
...
@@ -310,15 +298,15 @@ static rt_size_t imxrt_i2c_mst_xfer(struct rt_i2c_bus_device *bus,
}
}
i2c_dbg
(
"send stop condition
\n
"
);
if
(
LPI2C_MasterStop
(
rt10
52
_i2c
->
I2C
)
!=
kStatus_Success
)
if
(
LPI2C_MasterStop
(
rt10
21
_i2c
->
I2C
)
!=
kStatus_Success
)
{
i
=
0
;
}
rt10
52
_i2c
->
msg
=
RT_NULL
;
rt10
52
_i2c
->
msg_ptr
=
0
;
rt10
52
_i2c
->
msg_cnt
=
0
;
rt10
52
_i2c
->
dptr
=
0
;
rt10
21
_i2c
->
msg
=
RT_NULL
;
rt10
21
_i2c
->
msg_ptr
=
0
;
rt10
21
_i2c
->
msg_cnt
=
0
;
rt10
21
_i2c
->
dptr
=
0
;
return
i
;
}
...
...
bsp/imxrt/Libraries/imxrt1021/drivers/drv_i2c.h
浏览文件 @
48ca812d
/*
* File : drv_i2c.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009, RT-Thread Development Team
* Copyright (c) 2006-2018, 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
...
...
@@ -19,7 +15,7 @@
#include <rtthread.h>
#include <rtdevice.h>
#include "board.h"
struct
rt10
52
_i2c_bus
struct
rt10
21
_i2c_bus
{
struct
rt_i2c_bus_device
parent
;
LPI2C_Type
*
I2C
;
...
...
bsp/imxrt/Libraries/imxrt1021/drivers/drv_pcf8574.c
浏览文件 @
48ca812d
/*
* File : drv_pcf8574.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
* Copyright (c) 2006-2018, 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/imxrt/Libraries/imxrt1021/drivers/drv_pcf8574.h
浏览文件 @
48ca812d
/*
* File : drv_pcf8574.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
* Copyright (c) 2006-2018, 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/imxrt/Libraries/imxrt1021/drivers/drv_pin.c
浏览文件 @
48ca812d
此差异已折叠。
点击以展开。
bsp/imxrt/Libraries/imxrt1021/drivers/drv_pin.h
浏览文件 @
48ca812d
/*
* File : drv_pin.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
* Copyright (c) 2006-2018, 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/imxrt/Libraries/imxrt1021/drivers/drv_rtc.c
浏览文件 @
48ca812d
/*
* File : drv_rtc.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
* Copyright (c) 2006-2018, 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
* 2018-03-15 Liuguang the first version.
* 2019-03-11 JiCheng Change the name from rt1052 to RT1021
*/
#include "drv_rtc.h"
...
...
@@ -62,7 +59,7 @@ static int set_timestamp(time_t timestamp)
return
RT_EOK
;
}
static
rt_err_t
rt10
52
_hp_rtc_init
(
rt_device_t
dev
)
static
rt_err_t
rt10
21
_hp_rtc_init
(
rt_device_t
dev
)
{
snvs_hp_rtc_config_t
snvsRtcConfig
;
...
...
@@ -74,27 +71,27 @@ static rt_err_t rt1052_hp_rtc_init(rt_device_t dev)
return
RT_EOK
;
}
static
rt_err_t
rt10
52
_hp_rtc_open
(
rt_device_t
dev
,
rt_uint16_t
oflag
)
static
rt_err_t
rt10
21
_hp_rtc_open
(
rt_device_t
dev
,
rt_uint16_t
oflag
)
{
return
RT_EOK
;
}
static
rt_err_t
rt10
52
_hp_rtc_close
(
rt_device_t
dev
)
static
rt_err_t
rt10
21
_hp_rtc_close
(
rt_device_t
dev
)
{
return
RT_EOK
;
}
static
rt_size_t
rt10
52
_hp_rtc_read
(
rt_device_t
dev
,
rt_off_t
pos
,
void
*
buffer
,
rt_size_t
size
)
static
rt_size_t
rt10
21
_hp_rtc_read
(
rt_device_t
dev
,
rt_off_t
pos
,
void
*
buffer
,
rt_size_t
size
)
{
return
0
;
}
static
rt_size_t
rt10
52
_hp_rtc_write
(
rt_device_t
dev
,
rt_off_t
pos
,
const
void
*
buffer
,
rt_size_t
size
)
static
rt_size_t
rt10
21
_hp_rtc_write
(
rt_device_t
dev
,
rt_off_t
pos
,
const
void
*
buffer
,
rt_size_t
size
)
{
return
0
;
}
static
rt_err_t
rt10
52
_hp_rtc_control
(
rt_device_t
dev
,
int
cmd
,
void
*
args
)
static
rt_err_t
rt10
21
_hp_rtc_control
(
rt_device_t
dev
,
int
cmd
,
void
*
args
)
{
RT_ASSERT
(
dev
!=
RT_NULL
);
...
...
@@ -122,12 +119,12 @@ static rt_err_t rt1052_hp_rtc_control(rt_device_t dev, int cmd, void *args)
static
struct
rt_device
device
=
{
.
type
=
RT_Device_Class_RTC
,
.
init
=
rt10
52
_hp_rtc_init
,
.
open
=
rt10
52
_hp_rtc_open
,
.
close
=
rt10
52
_hp_rtc_close
,
.
read
=
rt10
52
_hp_rtc_read
,
.
write
=
rt10
52
_hp_rtc_write
,
.
control
=
rt10
52
_hp_rtc_control
,
.
init
=
rt10
21
_hp_rtc_init
,
.
open
=
rt10
21
_hp_rtc_open
,
.
close
=
rt10
21
_hp_rtc_close
,
.
read
=
rt10
21
_hp_rtc_read
,
.
write
=
rt10
21
_hp_rtc_write
,
.
control
=
rt10
21
_hp_rtc_control
,
};
int
rt_hw_hp_rtc_init
(
void
)
...
...
bsp/imxrt/Libraries/imxrt1021/drivers/drv_rtc.h
浏览文件 @
48ca812d
/*
* File : drv_rtc.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
* Copyright (c) 2006-2018, 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/imxrt/Libraries/imxrt1021/drivers/drv_sdio.c
浏览文件 @
48ca812d
/*
* File : syscall_write.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team
* Copyright (c) 2006-2018, 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-10-10 Tanek first version
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
*/
#include <rtthread.h>
...
...
@@ -480,19 +467,6 @@ static void log_toggle(int en)
FINSH_FUNCTION_EXPORT
(
log_toggle
,
toglle
log
dumple
);
#endif
//static rt_int32_t _mmc_get_card_status(struct rt_mmcsd_host *host)
//{
// MMCSD_DGB("%s, start\n", __func__);
// MMCSD_DGB("%s, end\n", __func__);
//
// return 0;
//}
//
//static void _mmc_enable_sdio_irq(struct rt_mmcsd_host *host, rt_int32_t enable)
//{
//
//}
static
const
struct
rt_mmcsd_host_ops
ops
=
{
_mmc_request
,
...
...
bsp/imxrt/Libraries/imxrt1021/drivers/drv_sdram.c
浏览文件 @
48ca812d
/*
* File : board.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 RT-Thread Develop Team
* Copyright (c) 2006-2018, 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
* 2017-12-04 Tanek first implementation
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
*/
#include <stdint.h>
#include <rthw.h>
...
...
@@ -50,32 +47,6 @@ static void _clock_init(void)
_WDWORD
(
0x400D8030
,
0x00002001
);
_WDWORD
(
0x400D8100
,
0x001d0000
);
_WDWORD
(
0x400FC014
,
0x00010D40
);
// // Enable SYS PLL
// _WDWORD(0x400D8030,0x00002001);
// do
// {
// reg = _RDWORD(0x400D8030);
// }while((reg & 0x80000000) == 0);
// // Ungate SYS PLL PFD2
// reg = _RDWORD(0x400D8100);
// reg &= ~0x800000;
// _WDWORD(0x400D8100,reg);
// // SEMC clock source selection.
// // SDRAM running at 133Mhz
// // CBCDR:
// // SEMC_ALT_CLK_SEL: 0 PLL2 (SYS PLL) PFD2
// // SEMC_CLK_SEL: 1 SEMC_ALT_CLK
// // SEMC_PODF: 2 divide by 3
// reg = _RDWORD(0x400FC014);
// reg |= 0x20040;
// _WDWORD(0x400FC014,reg);
// // Disable MPU which will be enabled by ROM to prevent code execution
// reg = _RDWORD(0xE000ED94);
// reg &= ~0x1;
// _WDWORD(0xE000ED94, reg);
}
static
void
_sdr_Init
(
void
)
...
...
@@ -219,5 +190,5 @@ int imxrt_sdram_init(void)
return
0
;
}
INIT_PREV_EXPORT
(
imxrt_sdram_init
);
/*@}*/
bsp/imxrt/Libraries/imxrt1021/drivers/drv_spi_bus.c
浏览文件 @
48ca812d
/*
* File : drv_spi_bus.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
* Copyright (c) 2006-2018, 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
* 2018-03-27 Liuguang the first version.
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
*/
#include "drv_spi_bus.h"
...
...
bsp/imxrt/Libraries/imxrt1021/drivers/drv_spi_bus.h
浏览文件 @
48ca812d
/*
* File : drv_spi_bus.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
* Copyright (c) 2006-2018, 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/imxrt/Libraries/imxrt1021/drivers/drv_spi_flash.c
浏览文件 @
48ca812d
/*
* File : drv_spi_flash.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
* Copyright (c) 2006-2018, 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/imxrt/Libraries/imxrt1021/drivers/drv_spi_flash.h
浏览文件 @
48ca812d
/*
* File : drv_spi_flash.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
* Copyright (c) 2006-2018, 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/imxrt/Libraries/imxrt1021/drivers/drv_uart.c
浏览文件 @
48ca812d
/*
* File : drv_uart.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
* Copyright (c) 2006-2018, 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
* 2017-10-10 Tanek the first version
* 2018-03-17 laiyiketang Add other uart.
* 2019-03-11 JiCheng Adapt RT1021's IO MAP
*/
#include <rtthread.h>
#include "drv_uart.h"
...
...
bsp/imxrt/Libraries/imxrt1021/drivers/drv_uart.h
浏览文件 @
48ca812d
/*
* File : drv_uart.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009, RT-Thread Development Team
* Copyright (c) 2006-2018, 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
* 2017-10-10 Tanek the first version
* 2018-03-17 laiyiketang Add other uart.
*/
#ifndef __DRV_UART_H__
...
...
bsp/imxrt/Libraries/imxrt1021/drivers/drv_usbd.c
浏览文件 @
48ca812d
/*
* File : drv_usbc.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 RT-Thread Develop Team
* Copyright (c) 2006-2018, 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/imxrt/imxrt1021-evk/README.md
浏览文件 @
48ca812d
...
...
@@ -15,7 +15,7 @@ BSP默认支持的i.MX RT1021处理器具备以下简要的特性:
## 2. 编译说明
i.MX RT102
1
板级包支持MDK5﹑IAR开发环境和GCC编译器,以下是具体版本信息:
i.MX RT102
0
板级包支持MDK5﹑IAR开发环境和GCC编译器,以下是具体版本信息:
| IDE/编译器 | 已测试版本 |
| ---------- | --------- |
...
...
@@ -26,15 +26,11 @@ i.MX RT1021板级包支持MDK5﹑IAR开发环境和GCC编译器,以下是具
### 3.1 配置工程
i.MX RT1021 BSP支持多块开发板,包括官方开发板MIMXRT1020-EVK。如果不是基于官方开发板,那么需要重新配置并生成工程:
-
在bsp下打开env工具
-
输入
`menuconfig`
命令,
`RT1021 Board select (***)-->`
选择正确的开发板。
-
输入
`scons --target=mdk5 -s`
或
`scons --target=iar`
来生成需要的工程
i.MX RT1020 BSP默认支持官方开发板MIMXRT1020-EVK。
### 3.2 下载和仿真
#### 3.2.1 MIMXRT102
1
-EVK
#### 3.2.1 MIMXRT102
0
-EVK
EVK开发板有板载OpenSDA仿真器,仿真器还连接到i.MX RT1021的UART1。使用USB线连接电脑和仿真器的USB口(J23),就可以进行下载和仿真。在终端工具里打开仿真器的虚拟串口。
...
...
@@ -46,19 +42,22 @@ EVK开发板有板载OpenSDA仿真器,仿真器还连接到i.MX RT1021的UART1
\ | /
- RT - Thread Operating System
/ | \ 3.0.4 build May 2 2018
2006 - 2018 Copyright by rt-thread team
/ | \ 4.0.1 build Mar 11 2019
2006 - 2019 Copyright by rt-thread team
[I/FLEXSPI] NorFlash Init
[I/FLEXSPI] Vendor ID: 0x15
[I/FLEXSPI] NorFlash Init Done
lwIP-2.0.2 initialized!
using armcc, version: 5060750
build time: Ma
y 2 2018 21:52:40
build time: Ma
r 11 2019 22:24:46
msh />[PHY] wait autonegotiation complete...
SD card capacity 123904 KB
probe mmcsd block device!
found part[0], begin: 32256, size: 120.992MB
[I/SDIO] SD card capacity 15558144 KB.
found part[0], begin: 32256, size: 14.857GB
File System initialized!
[PHY] wait autonegotiation complete...
```
## 4. 驱动支持情况及计划
| 驱动 | 支持情况 | 备注 |
...
...
@@ -76,7 +75,7 @@ File System initialized!
## 5. 联系人信息
维护人:
-
[
JiCheng
](
https://github.com/jicheng0622
)
## 6. 参考
...
...
bsp/imxrt/imxrt1021-evk/applications/device_test.c
已删除
100644 → 0
浏览文件 @
82cc9a9e
/*
* File : device_test.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2011, 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.
*
* Change Logs:
* Date Author Notes
* 2011-01-01 aozima the first version.
* 2012-02-11 aozima add multiple sector speed test.
* 2012-05-27 aozima use rt_deice API.
*/
#include <rtthread.h>
/* calculate speed */
static
void
calculate_speed_print
(
rt_uint32_t
speed
)
{
rt_uint32_t
k
,
m
;
k
=
speed
/
1024UL
;
if
(
k
)
{
m
=
k
/
1024UL
;
if
(
m
)
{
rt_kprintf
(
"%d.%dMbyte/s"
,
m
,
k
%
1024UL
*
100
/
1024UL
);
}
else
{
rt_kprintf
(
"%d.%dKbyte/s"
,
k
,
speed
%
1024UL
*
100
/
1024UL
);
}
}
else
{
rt_kprintf
(
"%dbyte/s"
,
speed
);
}
}
static
rt_err_t
_block_device_test
(
rt_device_t
device
)
{
rt_err_t
result
;
struct
rt_device_blk_geometry
geometry
;
rt_uint8_t
*
read_buffer
=
RT_NULL
;
rt_uint8_t
*
write_buffer
=
RT_NULL
;
rt_kprintf
(
"
\r\n
"
);
if
(
(
device
->
flag
&
RT_DEVICE_FLAG_RDWR
)
==
RT_DEVICE_FLAG_RDWR
)
{
// device can read and write.
// step 1: open device
result
=
rt_device_open
(
device
,
RT_DEVICE_FLAG_RDWR
);
if
(
result
!=
RT_EOK
)
{
return
result
;
}
// step 2: get device info
rt_memset
(
&
geometry
,
0
,
sizeof
(
geometry
));
result
=
rt_device_control
(
device
,
RT_DEVICE_CTRL_BLK_GETGEOME
,
&
geometry
);
if
(
result
!=
RT_EOK
)
{
rt_kprintf
(
"device : %s cmd RT_DEVICE_CTRL_BLK_GETGEOME failed.
\r\n
"
);
return
result
;
}
rt_kprintf
(
"device info:
\r\n
"
);
rt_kprintf
(
"sector size : %d byte
\r\n
"
,
geometry
.
bytes_per_sector
);
rt_kprintf
(
"sector count : %d
\r\n
"
,
geometry
.
sector_count
);
rt_kprintf
(
"block size : %d byte
\r\n
"
,
geometry
.
block_size
);
rt_kprintf
(
"
\r\n
"
);
read_buffer
=
rt_malloc
(
geometry
.
bytes_per_sector
);
if
(
read_buffer
==
RT_NULL
)
{
rt_kprintf
(
"no memory for read_buffer!
\r\n
"
);
goto
__return
;
}
write_buffer
=
rt_malloc
(
geometry
.
bytes_per_sector
);
if
(
write_buffer
==
RT_NULL
)
{
rt_kprintf
(
"no memory for write_buffer!
\r\n
"
);
goto
__return
;
}
/* step 3: R/W test */
{
rt_uint32_t
i
,
err_count
,
sector_no
;
rt_uint8_t
*
data_point
;
i
=
rt_device_read
(
device
,
0
,
read_buffer
,
1
);
if
(
i
!=
1
)
{
rt_kprintf
(
"read device :%s "
,
device
->
parent
.
name
);
rt_kprintf
(
"the first sector failed.
\r\n
"
);
goto
__return
;
}
data_point
=
write_buffer
;
for
(
i
=
0
;
i
<
geometry
.
bytes_per_sector
;
i
++
)
{
*
data_point
++
=
(
rt_uint8_t
)
i
;
}
/* write first sector */
sector_no
=
0
;
data_point
=
write_buffer
;
*
data_point
++
=
(
rt_uint8_t
)
sector_no
;
i
=
rt_device_write
(
device
,
sector_no
,
write_buffer
,
1
);
if
(
i
!=
1
)
{
rt_kprintf
(
"read the first sector success!
\r\n
"
);
rt_kprintf
(
"but write device :%s "
,
device
->
parent
.
name
);
rt_kprintf
(
"the first sector failed.
\r\n
"
);
rt_kprintf
(
"maybe readonly!
\r\n
"
);
goto
__return
;
}
/* write the second sector */
sector_no
=
1
;
data_point
=
write_buffer
;
*
data_point
++
=
(
rt_uint8_t
)
sector_no
;
i
=
rt_device_write
(
device
,
sector_no
,
write_buffer
,
1
);
if
(
i
!=
1
)
{
rt_kprintf
(
"write device :%s "
,
device
->
parent
.
name
);
rt_kprintf
(
"the second sector failed.
\r\n
"
);
goto
__return
;
}
/* write the end sector */
sector_no
=
geometry
.
sector_count
-
1
;
data_point
=
write_buffer
;
*
data_point
++
=
(
rt_uint8_t
)
sector_no
;
i
=
rt_device_write
(
device
,
sector_no
,
write_buffer
,
1
);
if
(
i
!=
1
)
{
rt_kprintf
(
"write device :%s "
,
device
->
parent
.
name
);
rt_kprintf
(
"the end sector failed.
\r\n
"
);
goto
__return
;
}
/* verify first sector */
sector_no
=
0
;
i
=
rt_device_read
(
device
,
sector_no
,
read_buffer
,
1
);
if
(
i
!=
1
)
{
rt_kprintf
(
"read device :%s "
,
device
->
parent
.
name
);
rt_kprintf
(
"the first sector failed.
\r\n
"
);
goto
__return
;
}
err_count
=
0
;
data_point
=
read_buffer
;
if
(
(
*
data_point
++
)
!=
(
rt_uint8_t
)
sector_no
)
{
err_count
++
;
}
for
(
i
=
1
;
i
<
geometry
.
bytes_per_sector
;
i
++
)
{
if
(
(
*
data_point
++
)
!=
(
rt_uint8_t
)
i
)
{
err_count
++
;
}
}
if
(
err_count
>
0
)
{
rt_kprintf
(
"verify device :%s "
,
device
->
parent
.
name
);
rt_kprintf
(
"the first sector failed.
\r\n
"
);
goto
__return
;
}
/* verify sector sector */
sector_no
=
1
;
i
=
rt_device_read
(
device
,
sector_no
,
read_buffer
,
1
);
if
(
i
!=
1
)
{
rt_kprintf
(
"read device :%s "
,
device
->
parent
.
name
);
rt_kprintf
(
"the second sector failed.
\r\n
"
);
goto
__return
;
}
err_count
=
0
;
data_point
=
read_buffer
;
if
(
(
*
data_point
++
)
!=
(
rt_uint8_t
)
sector_no
)
{
err_count
++
;
}
for
(
i
=
1
;
i
<
geometry
.
bytes_per_sector
;
i
++
)
{
if
(
(
*
data_point
++
)
!=
(
rt_uint8_t
)
i
)
{
err_count
++
;
}
}
if
(
err_count
>
0
)
{
rt_kprintf
(
"verify device :%s "
,
device
->
parent
.
name
);
rt_kprintf
(
"the second sector failed.
\r\n
"
);
goto
__return
;
}
/* verify the end sector */
sector_no
=
geometry
.
sector_count
-
1
;
i
=
rt_device_read
(
device
,
sector_no
,
read_buffer
,
1
);
if
(
i
!=
1
)
{
rt_kprintf
(
"read device :%s "
,
device
->
parent
.
name
);
rt_kprintf
(
"the end sector failed.
\r\n
"
);
goto
__return
;
}
err_count
=
0
;
data_point
=
read_buffer
;
if
(
(
*
data_point
++
)
!=
(
rt_uint8_t
)
sector_no
)
{
err_count
++
;
}
for
(
i
=
1
;
i
<
geometry
.
bytes_per_sector
;
i
++
)
{
if
(
(
*
data_point
++
)
!=
(
rt_uint8_t
)
i
)
{
err_count
++
;
}
}
if
(
err_count
>
0
)
{
rt_kprintf
(
"verify device :%s "
,
device
->
parent
.
name
);
rt_kprintf
(
"the end sector failed.
\r\n
"
);
goto
__return
;
}
rt_kprintf
(
"device R/W test pass!
\r\n
"
);
}
/* step 3: I/O R/W test */
rt_kprintf
(
"
\r\n
RT_TICK_PER_SECOND:%d
\r\n
"
,
RT_TICK_PER_SECOND
);
// step 4: continuous single sector speed test
{
rt_uint32_t
tick_start
,
tick_end
;
rt_uint32_t
i
;
rt_kprintf
(
"
\r\n
continuous single sector speed test:
\r\n
"
);
if
(
geometry
.
sector_count
<
10
)
{
rt_kprintf
(
"device sector_count < 10, speed test abort!
\r\n
"
);
}
else
{
unsigned
int
sector
;
// sign sector write
rt_kprintf
(
"write: "
);
sector
=
0
;
tick_start
=
rt_tick_get
();
for
(
i
=
0
;
i
<
200
;
i
++
)
{
sector
+=
rt_device_write
(
device
,
i
,
read_buffer
,
1
);
if
((
i
!=
0
)
&&
((
i
%
4
)
==
0
)
)
{
if
(
sector
<
4
)
{
rt_kprintf
(
"#"
);
}
else
{
rt_kprintf
(
"<"
);
}
sector
=
0
;
}
}
tick_end
=
rt_tick_get
();
rt_kprintf
(
"
\r\n
write 200 sector from %d to %d, "
,
tick_start
,
tick_end
);
calculate_speed_print
(
(
geometry
.
bytes_per_sector
*
200UL
*
RT_TICK_PER_SECOND
)
/
(
tick_end
-
tick_start
)
);
rt_kprintf
(
"
\r\n
"
);
// sign sector read
rt_kprintf
(
"read : "
);
sector
=
0
;
tick_start
=
rt_tick_get
();
for
(
i
=
0
;
i
<
200
;
i
++
)
{
sector
+=
rt_device_read
(
device
,
i
,
read_buffer
,
1
);
if
((
i
!=
0
)
&&
((
i
%
4
)
==
0
)
)
{
if
(
sector
<
4
)
{
rt_kprintf
(
"#"
);
}
else
{
rt_kprintf
(
">"
);
}
sector
=
0
;
}
}
tick_end
=
rt_tick_get
();
rt_kprintf
(
"
\r\n
read 200 sector from %d to %d, "
,
tick_start
,
tick_end
);
calculate_speed_print
(
(
geometry
.
bytes_per_sector
*
200UL
*
RT_TICK_PER_SECOND
)
/
(
tick_end
-
tick_start
)
);
rt_kprintf
(
"
\r\n
"
);
}
}
// step 4: speed test
// step 5: random single sector speed test
{
rt_uint32_t
tick_start
,
tick_end
;
rt_uint32_t
i
;
rt_kprintf
(
"
\r\n
random single sector speed test:
\r\n
"
);
if
(
geometry
.
sector_count
<
10
)
{
rt_kprintf
(
"device sector_count < 10, speed test abort!
\r\n
"
);
}
else
{
unsigned
int
sector
;
// sign sector write
rt_kprintf
(
"write: "
);
sector
=
0
;
tick_start
=
rt_tick_get
();
for
(
i
=
0
;
i
<
200
;
i
++
)
{
sector
+=
rt_device_write
(
device
,
(
geometry
.
sector_count
/
10
)
*
(
i
%
10
)
+
(
i
%
10
),
read_buffer
,
1
);
if
((
i
!=
0
)
&&
((
i
%
4
)
==
0
)
)
{
if
(
sector
<
4
)
{
rt_kprintf
(
"#"
);
}
else
{
rt_kprintf
(
"<"
);
}
sector
=
0
;
}
}
tick_end
=
rt_tick_get
();
rt_kprintf
(
"
\r\n
write 200 sector from %d to %d, "
,
tick_start
,
tick_end
);
calculate_speed_print
(
(
geometry
.
bytes_per_sector
*
200UL
*
RT_TICK_PER_SECOND
)
/
(
tick_end
-
tick_start
)
);
rt_kprintf
(
"
\r\n
"
);
// sign sector read
rt_kprintf
(
"read : "
);
sector
=
0
;
tick_start
=
rt_tick_get
();
for
(
i
=
0
;
i
<
200
;
i
++
)
{
sector
+=
rt_device_read
(
device
,
(
geometry
.
sector_count
/
10
)
*
(
i
%
10
)
+
(
i
%
10
),
read_buffer
,
1
);
if
((
i
!=
0
)
&&
((
i
%
4
)
==
0
)
)
{
if
(
sector
<
4
)
{
rt_kprintf
(
"#"
);
}
else
{
rt_kprintf
(
">"
);
}
sector
=
0
;
}
}
tick_end
=
rt_tick_get
();
rt_kprintf
(
"
\r\n
read 200 sector from %d to %d, "
,
tick_start
,
tick_end
);
calculate_speed_print
(
(
geometry
.
bytes_per_sector
*
200UL
*
RT_TICK_PER_SECOND
)
/
(
tick_end
-
tick_start
)
);
rt_kprintf
(
"
\r\n
"
);
}
}
// step 4: speed test
/* step 6: multiple sector speed test */
{
rt_uint8_t
*
multiple_buffer
;
rt_uint8_t
*
ptr
;
rt_uint32_t
tick_start
,
tick_end
;
rt_uint32_t
sector
,
i
;
rt_kprintf
(
"
\r\n
multiple sector speed test
\r\n
"
);
for
(
sector
=
2
;
sector
<
256
;
sector
=
sector
*
2
)
{
multiple_buffer
=
rt_malloc
(
geometry
.
bytes_per_sector
*
sector
);
if
(
multiple_buffer
==
RT_NULL
)
{
rt_kprintf
(
"no memory for %d sector! multiple sector speed test abort!
\r\n
"
,
sector
);
break
;
}
rt_memset
(
multiple_buffer
,
sector
,
geometry
.
bytes_per_sector
*
sector
);
rt_kprintf
(
"write: "
);
tick_start
=
rt_tick_get
();
for
(
i
=
0
;
i
<
10
;
i
++
)
{
rt_size_t
n
;
n
=
rt_device_write
(
device
,
50
,
multiple_buffer
,
sector
);
if
(
n
==
sector
)
{
rt_kprintf
(
"<"
);
}
else
{
rt_kprintf
(
"#"
);
}
}
tick_end
=
rt_tick_get
();
rt_kprintf
(
"
\r\n
"
);
rt_kprintf
(
"multiple write %d sector speed : "
,
sector
);
calculate_speed_print
(
(
geometry
.
bytes_per_sector
*
sector
*
10
*
RT_TICK_PER_SECOND
)
/
(
tick_end
-
tick_start
)
);
rt_kprintf
(
"
\r\n
"
);
rt_memset
(
multiple_buffer
,
~
sector
,
geometry
.
bytes_per_sector
*
sector
);
rt_kprintf
(
"read : "
);
tick_start
=
rt_tick_get
();
for
(
i
=
0
;
i
<
10
;
i
++
)
{
rt_size_t
n
;
n
=
rt_device_read
(
device
,
50
,
multiple_buffer
,
sector
);
if
(
n
==
sector
)
{
rt_kprintf
(
">"
);
}
else
{
rt_kprintf
(
"#"
);
}
}
tick_end
=
rt_tick_get
();
rt_kprintf
(
"
\r\n
"
);
rt_kprintf
(
"multiple read %d sector speed : "
,
sector
);
calculate_speed_print
(
(
geometry
.
bytes_per_sector
*
sector
*
10
*
RT_TICK_PER_SECOND
)
/
(
tick_end
-
tick_start
)
);
ptr
=
multiple_buffer
;
for
(
i
=
0
;
i
<
geometry
.
bytes_per_sector
*
sector
;
i
++
)
{
if
(
*
ptr
!=
sector
)
{
rt_kprintf
(
" but data verify fail!"
);
break
;
}
ptr
++
;
}
rt_kprintf
(
"
\r\n\r\n
"
);
rt_free
(
multiple_buffer
);
}
}
/* step 5: multiple sector speed test */
return
RT_EOK
;
}
// device can read and write.
else
{
// device read only
return
RT_EOK
;
}
// device read only
__return:
if
(
read_buffer
!=
RT_NULL
)
{
rt_free
(
read_buffer
);
}
if
(
write_buffer
!=
RT_NULL
)
{
rt_free
(
write_buffer
);
}
return
RT_ERROR
;
}
int
device_test
(
const
char
*
device_name
)
{
rt_device_t
device
=
RT_NULL
;
// step 1:find device
device
=
rt_device_find
(
device_name
);
if
(
device
==
RT_NULL
)
{
rt_kprintf
(
"device %s: not found!
\r\n
"
);
return
RT_ERROR
;
}
// step 2:init device
if
(
!
(
device
->
flag
&
RT_DEVICE_FLAG_ACTIVATED
))
{
rt_err_t
result
;
result
=
rt_device_init
(
device
);
if
(
result
!=
RT_EOK
)
{
rt_kprintf
(
"To initialize device:%s failed. The error code is %d
\r\n
"
,
device
->
parent
.
name
,
result
);
return
result
;
}
else
{
device
->
flag
|=
RT_DEVICE_FLAG_ACTIVATED
;
}
}
// step 3: device test
switch
(
device
->
type
)
{
case
RT_Device_Class_Block
:
rt_kprintf
(
"block device!
\r\n
"
);
return
_block_device_test
(
device
);
default:
rt_kprintf
(
"unkown device type : %02X"
,
device
->
type
);
return
RT_ERROR
;
}
}
#ifdef RT_USING_FINSH
#include <finsh.h>
FINSH_FUNCTION_EXPORT
(
device_test
,
e
.
g
:
device_test
(
"sd0"
));
#endif
bsp/imxrt/imxrt1021-evk/applications/mem_dump.c
已删除
100644 → 0
浏览文件 @
82cc9a9e
/*
* File : clock.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, 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.
*
* Change Logs:
* Date Author Notes
* 2017-12-05 Tanek first version
*/
#include <rtthread.h>
static
void
mem_dump
(
uint32_t
buffer
,
uint32_t
length
)
{
uint32_t
*
buf
=
(
uint32_t
*
)
buffer
;
int
i
;
for
(
i
=
0
;
i
<
length
/
4
;
i
++
)
{
rt_kprintf
(
"0x%08X,"
,
buf
[
i
]);
if
(
i
%
8
==
7
)
{
rt_kprintf
(
"
\n
"
);
}
else
{
rt_kprintf
(
" "
);
}
}
}
#ifdef RT_USING_FINSH
#include <finsh.h>
FINSH_FUNCTION_EXPORT
(
mem_dump
,
dump
memory
);
#endif
bsp/imxrt/imxrt1021-evk/applications/mem_test.c
已删除
100644 → 0
浏览文件 @
82cc9a9e
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
void
mem_test
(
uint32_t
address
,
uint32_t
size
)
{
uint32_t
i
;
rt_kprintf
(
"memtest,address: 0x%08X size: 0x%08X
\r\n
"
,
address
,
size
);
/**< 8bit test */
{
uint8_t
*
p_uint8_t
=
(
uint8_t
*
)
address
;
for
(
i
=
0
;
i
<
size
/
sizeof
(
uint8_t
);
i
++
)
{
*
p_uint8_t
++
=
(
uint8_t
)
i
;
}
p_uint8_t
=
(
uint8_t
*
)
address
;
for
(
i
=
0
;
i
<
size
/
sizeof
(
uint8_t
);
i
++
)
{
if
(
*
p_uint8_t
!=
(
uint8_t
)
i
)
{
rt_kprintf
(
"8bit test fail @ 0x%08X
\r\n
system halt!!!!!"
,(
uint32_t
)
p_uint8_t
);
while
(
1
);
}
p_uint8_t
++
;
}
rt_kprintf
(
"8bit test pass!!
\r\n
"
);
}
/**< 16bit test */
{
uint16_t
*
p_uint16_t
=
(
uint16_t
*
)
address
;
for
(
i
=
0
;
i
<
size
/
sizeof
(
uint16_t
);
i
++
)
{
*
p_uint16_t
++
=
(
uint16_t
)
i
;
}
p_uint16_t
=
(
uint16_t
*
)
address
;
for
(
i
=
0
;
i
<
size
/
sizeof
(
uint16_t
);
i
++
)
{
if
(
*
p_uint16_t
!=
(
uint16_t
)
i
)
{
rt_kprintf
(
"16bit test fail @ 0x%08X
\r\n
system halt!!!!!"
,(
uint32_t
)
p_uint16_t
);
while
(
1
);
}
p_uint16_t
++
;
}
rt_kprintf
(
"16bit test pass!!
\r\n
"
);
}
/**< 32bit test */
{
uint32_t
*
p_uint32_t
=
(
uint32_t
*
)
address
;
for
(
i
=
0
;
i
<
size
/
sizeof
(
uint32_t
);
i
++
)
{
*
p_uint32_t
++
=
(
uint32_t
)
i
;
}
p_uint32_t
=
(
uint32_t
*
)
address
;
for
(
i
=
0
;
i
<
size
/
sizeof
(
uint32_t
);
i
++
)
{
if
(
*
p_uint32_t
!=
(
uint32_t
)
i
)
{
rt_kprintf
(
"32bit test fail @ 0x%08X
\r\n
system halt!!!!!"
,(
uint32_t
)
p_uint32_t
);
while
(
1
);
}
p_uint32_t
++
;
}
rt_kprintf
(
"32bit test pass!!
\r\n
"
);
}
/**< 32bit Loopback test */
{
uint32_t
*
p_uint32_t
=
(
uint32_t
*
)
address
;
for
(
i
=
0
;
i
<
size
/
sizeof
(
uint32_t
);
i
++
)
{
*
p_uint32_t
=
(
uint32_t
)
p_uint32_t
;
p_uint32_t
++
;
}
p_uint32_t
=
(
uint32_t
*
)
address
;
for
(
i
=
0
;
i
<
size
/
sizeof
(
uint32_t
);
i
++
)
{
if
(
*
p_uint32_t
!=
(
uint32_t
)
p_uint32_t
)
{
rt_kprintf
(
"32bit Loopback test fail @ 0x%08X"
,
(
uint32_t
)
p_uint32_t
);
rt_kprintf
(
" data:0x%08X
\r\n
"
,
(
uint32_t
)
*
p_uint32_t
);
rt_kprintf
(
"system halt!!!!!"
,(
uint32_t
)
p_uint32_t
);
while
(
1
);
}
p_uint32_t
++
;
}
rt_kprintf
(
"32bit Loopback test pass!!
\r\n
"
);
}
}
#ifdef RT_USING_FINSH
#include <finsh.h>
FINSH_FUNCTION_EXPORT
(
mem_test
,
mem_test
(
0xA0000000
,
0x00100000
)
);
#endif
bsp/imxrt/imxrt1021-evk/drivers/board.c
浏览文件 @
48ca812d
/*
* File : board.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 RT-Thread Develop Team
* Copyright (c) 2006-2018, 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
* 2009-01-05 Bernard first implementation
* 2019-03-11 JiCheng Change clock setting for RT1020
*/
#include <stdint.h>
#include <rthw.h>
...
...
bsp/imxrt/imxrt1021-evk/drivers/board.h
浏览文件 @
48ca812d
/*
* File : board.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009, RT-Thread Development Team
* Copyright (c) 2006-2018, 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
* 2009-0
9-22 Bernard add board.h to this bsp
* 2009-0
1-05 Bernard first implementation
*/
// <<< Use Configuration Wizard in Context Menu >>>
...
...
bsp/imxrt/imxrt1021-evk/rtconfig.py
浏览文件 @
48ca812d
...
...
@@ -43,7 +43,7 @@ if PLATFORM == 'gcc':
DEVICE
=
' -mcpu=cortex-m7 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
CFLAGS
=
DEVICE
+
' -std=c99 -Wall -D__FPU_PRESENT -eentry'
AFLAGS
=
' -c'
+
DEVICE
+
' -x assembler-with-cpp -Wa,-mimplicit-it=thumb -D__START=entry'
LFLAGS
=
DEVICE
+
' -lm -lgcc -lc'
+
' -nostartfiles -Wl,--gc-sections,-Map=rtthread
-imxrt-gcc
.map,-cref,-u,Reset_Handler -T flexspi_nor.ld'
LFLAGS
=
DEVICE
+
' -lm -lgcc -lc'
+
' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T flexspi_nor.ld'
CPATH
=
''
LPATH
=
''
...
...
bsp/imxrt/imxrt1021-evk/template.uvoptx
浏览文件 @
48ca812d
...
...
@@ -22,7 +22,7 @@
</DaveTm>
<Target>
<TargetName>
RT-Thread IMXRT1021
</TargetName>
<TargetName>
rtthread
</TargetName>
<ToolsetNumber>
0x4
</ToolsetNumber>
<ToolsetName>
ARM-ADS
</ToolsetName>
<TargetOption>
...
...
bsp/imxrt/imxrt1021-evk/template.uvprojx
浏览文件 @
48ca812d
...
...
@@ -7,7 +7,7 @@
<Targets>
<Target>
<TargetName>
RT-Thread IMXRT1021
</TargetName>
<TargetName>
rtthread
</TargetName>
<ToolsetNumber>
0x4
</ToolsetNumber>
<ToolsetName>
ARM-ADS
</ToolsetName>
<pCCUsed>
5060528::V5.06 update 5 (build 528)::ARMCC
</pCCUsed>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录