Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2345VOR
rt-thread
提交
5a2df50e
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,发现更多精彩内容 >>
提交
5a2df50e
编写于
3月 16, 2018
作者:
L
liuguang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[BSP] add rt1050 hp rtc driver.| 添加RT1050 高功耗RTC驱动.
上级
bce9bc47
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
215 addition
and
28 deletion
+215
-28
bsp/imxrt1052-evk/.config
bsp/imxrt1052-evk/.config
+4
-2
bsp/imxrt1052-evk/Kconfig
bsp/imxrt1052-evk/Kconfig
+9
-7
bsp/imxrt1052-evk/drivers/SConscript
bsp/imxrt1052-evk/drivers/SConscript
+3
-0
bsp/imxrt1052-evk/drivers/drv_hp_rtc.c
bsp/imxrt1052-evk/drivers/drv_hp_rtc.c
+150
-0
bsp/imxrt1052-evk/drivers/drv_hp_rtc.h
bsp/imxrt1052-evk/drivers/drv_hp_rtc.h
+23
-0
bsp/imxrt1052-evk/project.uvoptx
bsp/imxrt1052-evk/project.uvoptx
+6
-13
bsp/imxrt1052-evk/project.uvprojx
bsp/imxrt1052-evk/project.uvprojx
+16
-4
bsp/imxrt1052-evk/rtconfig.h
bsp/imxrt1052-evk/rtconfig.h
+4
-2
未找到文件。
bsp/imxrt1052-evk/.config
浏览文件 @
5a2df50e
...
...
@@ -130,7 +130,9 @@ CONFIG_RT_USING_I2C_BITOPS=y
CONFIG_RT_USING_PIN
=
y
# CONFIG_RT_USING_MTD_NOR is not set
# CONFIG_RT_USING_MTD_NAND is not set
# CONFIG_RT_USING_RTC is not set
CONFIG_RT_USING_RTC
=
y
# CONFIG_RT_USING_SOFT_RTC is not set
# CONFIG_RTC_SYNC_USING_NTP is not set
CONFIG_RT_USING_SDIO
=
y
# CONFIG_RT_USING_SPI is not set
# CONFIG_RT_USING_WDT is not set
...
...
@@ -312,5 +314,5 @@ CONFIG_LWIP_NETIF_LOOPBACK=0
# CONFIG_PKG_USING_HELLO is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
CONFIG_SOC_IMXRT1052
=
y
CONFIG_RT_USING_UART
=
y
CONFIG_RT_USING_UART1
=
y
CONFIG_RT_USING_HP_RTC
=
y
bsp/imxrt1052-evk/Kconfig
浏览文件 @
5a2df50e
...
...
@@ -23,13 +23,15 @@ config SOC_IMXRT1052
select ARCH_ARM_CORTEX_M7
default y
config RT_USING_UART
bool "Using RT_USING_UART"
default y
if RT_USING_UART
if RT_USING_SERIAL
config RT_USING_UART1
bool "Using RT_USING_UART1"
default y
default y
endif
if RT_USING_RTC
config RT_USING_HP_RTC
bool "Using RT_USING_HP_RTC"
default n
endif
bsp/imxrt1052-evk/drivers/SConscript
浏览文件 @
5a2df50e
...
...
@@ -18,6 +18,9 @@ CPPDEFINES = []
if
GetDepend
(
'RT_USING_PIN'
):
src
+=
[
'drv_pin.c'
]
if
GetDepend
(
'RT_USING_HP_RTC'
):
src
+=
[
'drv_hp_rtc.c'
]
if
GetDepend
(
'RT_USING_LWIP'
):
src
+=
[
'drv_eth.c'
,
'fsl_phy.c'
]
CPPDEFINES
+=
[
'FSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE'
]
...
...
bsp/imxrt1052-evk/drivers/drv_hp_rtc.c
0 → 100644
浏览文件 @
5a2df50e
/*
* File : drv_hp_rtc.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, 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
*
* Change Logs:
* Date Author Notes
* 2018-03-15 Liuguang the first version.
*/
#include "drv_hp_rtc.h"
#include <time.h>
#include "fsl_common.h"
#include "fsl_snvs_hp.h"
#include "fsl_snvs_lp.h"
#ifdef RT_USING_RTC
#if defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL
#error "Please don't define 'FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL'!"
#endif
static
time_t
get_timestamp
(
void
)
{
struct
tm
tm_new
=
{
0
};
snvs_hp_rtc_datetime_t
rtcDate
;
SNVS_HP_RTC_GetDatetime
(
SNVS
,
&
rtcDate
);
tm_new
.
tm_sec
=
rtcDate
.
second
;
tm_new
.
tm_min
=
rtcDate
.
minute
;
tm_new
.
tm_hour
=
rtcDate
.
hour
;
tm_new
.
tm_mday
=
rtcDate
.
day
;
tm_new
.
tm_mon
=
rtcDate
.
month
-
1
;
tm_new
.
tm_year
=
rtcDate
.
year
-
1900
;
return
mktime
(
&
tm_new
);
}
static
int
set_timestamp
(
time_t
timestamp
)
{
struct
tm
*
p_tm
;
snvs_hp_rtc_datetime_t
rtcDate
;
p_tm
=
localtime
(
&
timestamp
);
rtcDate
.
second
=
p_tm
->
tm_sec
;
rtcDate
.
minute
=
p_tm
->
tm_min
;
rtcDate
.
hour
=
p_tm
->
tm_hour
;
rtcDate
.
day
=
p_tm
->
tm_mday
;
rtcDate
.
month
=
p_tm
->
tm_mon
+
1
;
rtcDate
.
year
=
p_tm
->
tm_year
+
1900
;
SNVS_HP_RTC_SetDatetime
(
SNVS
,
&
rtcDate
);
return
RT_EOK
;
}
/* ӿ */
static
rt_err_t
rt1052_hp_rtc_init
(
rt_device_t
dev
)
{
snvs_hp_rtc_config_t
snvsRtcConfig
;
SNVS_HP_RTC_GetDefaultConfig
(
&
snvsRtcConfig
);
SNVS_HP_RTC_Init
(
SNVS
,
&
snvsRtcConfig
);
SNVS_HP_RTC_StartTimer
(
SNVS
);
return
RT_EOK
;
}
static
rt_err_t
rt1052_hp_rtc_open
(
rt_device_t
dev
,
rt_uint16_t
oflag
)
{
return
RT_EOK
;
}
static
rt_err_t
rt1052_hp_rtc_close
(
rt_device_t
dev
)
{
return
RT_EOK
;
}
static
rt_size_t
rt1052_hp_rtc_read
(
rt_device_t
dev
,
rt_off_t
pos
,
void
*
buffer
,
rt_size_t
size
)
{
return
0
;
}
static
rt_size_t
rt1052_hp_rtc_write
(
rt_device_t
dev
,
rt_off_t
pos
,
const
void
*
buffer
,
rt_size_t
size
)
{
return
0
;
}
static
rt_err_t
rt1052_hp_rtc_control
(
rt_device_t
dev
,
int
cmd
,
void
*
args
)
{
RT_ASSERT
(
dev
!=
RT_NULL
);
switch
(
cmd
)
{
case
RT_DEVICE_CTRL_RTC_GET_TIME
:
{
*
(
uint32_t
*
)
args
=
get_timestamp
();
}
break
;
case
RT_DEVICE_CTRL_RTC_SET_TIME
:
{
set_timestamp
(
*
(
time_t
*
)
args
);
}
break
;
/* Ч */
default:
return
RT_EINVAL
;
}
return
RT_EOK
;
}
static
struct
rt_device
device
=
{
.
type
=
RT_Device_Class_RTC
,
.
init
=
rt1052_hp_rtc_init
,
.
open
=
rt1052_hp_rtc_open
,
.
close
=
rt1052_hp_rtc_close
,
.
read
=
rt1052_hp_rtc_read
,
.
write
=
rt1052_hp_rtc_write
,
.
control
=
rt1052_hp_rtc_control
,
};
int
rt_hw_hp_rtc_init
(
void
)
{
rt_err_t
ret
=
RT_EOK
;
ret
=
rt_device_register
(
&
device
,
"rtc"
,
RT_DEVICE_FLAG_RDWR
);
if
(
ret
!=
RT_EOK
)
{
return
ret
;
}
rt_device_open
(
&
device
,
RT_DEVICE_OFLAG_RDWR
);
return
RT_EOK
;
}
INIT_DEVICE_EXPORT
(
rt_hw_hp_rtc_init
);
#endif
/*RT_USING_RTC */
bsp/imxrt1052-evk/drivers/drv_hp_rtc.h
0 → 100644
浏览文件 @
5a2df50e
/*
* File : drv_hp_rtc.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, 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
*
* Change Logs:
* Date Author Notes
* 2018-03-15 Liuguang the first version.
*/
#ifndef __DRV_RTC_H__
#define __DRV_RTC_H__
#include <rtthread.h>
#include <rtdevice.h>
int
rt_hw_hp_rtc_init
(
void
);
#endif
bsp/imxrt1052-evk/project.uvoptx
浏览文件 @
5a2df50e
...
...
@@ -73,7 +73,7 @@
<LExpSel>
0
</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>
0
</tvExp>
<tvExp>
1
</tvExp>
<tvExpOptDlg>
0
</tvExpOptDlg>
<IsCurrentTarget>
1
</IsCurrentTarget>
</OPTFL>
...
...
@@ -101,9 +101,7 @@
<sRunDeb>
0
</sRunDeb>
<sLrtime>
0
</sLrtime>
<bEvRecOn>
1
</bEvRecOn>
<bSchkAxf>
0
</bSchkAxf>
<bTchkAxf>
0
</bTchkAxf>
<nTsel>
3
</nTsel>
<nTsel>
2
</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
...
...
@@ -166,16 +164,11 @@
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
<bLintAuto>
0
</bLintAuto>
<Lin2Executable></Lin2Executable>
<Lin2ConfigFile></Lin2ConfigFile>
<bLin2Auto>
0
</bLin2Auto>
<bAutoGenD>
0
</bAutoGenD>
<LntExFlags>
0
</LntExFlags>
<pMisraName></pMisraName>
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
<bAuto2GenD>
0
</bAuto2GenD>
</TargetOption>
</Target>
...
...
bsp/imxrt1052-evk/project.uvprojx
浏览文件 @
5a2df50e
...
...
@@ -8,13 +8,11 @@
<ToolsetNumber>
0x4
</ToolsetNumber>
<ToolsetName>
ARM-ADS
</ToolsetName>
<pCCUsed>
5060528::V5.06 update 5 (build 528)::ARMCC
</pCCUsed>
<uAC6>
0
</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>
MIMXRT1052:M7
</Device>
<Vendor>
NXP
</Vendor>
<PackID>
NXP.iMXRT_DFP.1.0.2
</PackID>
<PackURL>
http://mcuxpresso.nxp.com/cmsis_pack/repo/
</PackURL>
<PackID>
NXP.iMXRT_DFP.1.0.1
</PackID>
<Cpu>
IRAM(0x20000000,0x00060000) IRAM2(0x00000000,0x00020000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE
</Cpu>
<FlashUtilSpec
/>
<StartupFile
/>
...
...
@@ -333,7 +331,7 @@
<MiscControls>
--library_interface=armcc --library_type=standardlib --diag_suppress=66,1296,186
</MiscControls>
<Define>
SKIP_SYSCLK_INIT, CPU_MIMXRT1052DVL6A, FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1, EVK_MCIMXRM, FSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE, RT_USING_ARM_LIBC
</Define>
<Undefine
/>
<IncludePath>
applications;.;drivers;Libraries;Libraries\drivers;Libraries\utilities;Libraries\CMSIS\Include;..\..\include;..\..\libcpu\arm\cortex-m7;..\..\libcpu\arm\common;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\dfs\filesystems\elmfat;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\armlibc;..\..\components\net\lwip-2.0.2\src;..\..\components\net\lwip-2.0.2\src\include;..\..\components\net\lwip-2.0.2\src\include\ipv4;..\..\components\net\lwip-2.0.2\src\arch\include;..\..\components\net\lwip-2.0.2\src\include\netif;..\..\components\net\lwip-2.0.2\src\include\posix
</IncludePath>
<IncludePath>
applications;.;drivers;Libraries;Libraries\drivers;Libraries\utilities;Libraries\CMSIS\Include;..\..\include;..\..\libcpu\arm\cortex-m7;..\..\libcpu\arm\common;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\dfs\filesystems\elmfat;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\
drivers\include;..\..\components\
finsh;..\..\components\libc\compilers\armlibc;..\..\components\net\lwip-2.0.2\src;..\..\components\net\lwip-2.0.2\src\include;..\..\components\net\lwip-2.0.2\src\include\ipv4;..\..\components\net\lwip-2.0.2\src\arch\include;..\..\components\net\lwip-2.0.2\src\include\netif;..\..\components\net\lwip-2.0.2\src\include\posix
</IncludePath>
</VariousControls>
</Cads>
<Aads>
...
...
@@ -442,6 +440,13 @@
<FilePath>
drivers\drv_pin.c
</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>
drv_hp_rtc.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
drivers\drv_hp_rtc.c
</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>
drv_eth.c
</FileName>
...
...
@@ -1115,6 +1120,13 @@
<FilePath>
..\..\components\drivers\misc\pin.c
</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>
rtc.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
..\..\components\drivers\rtc\rtc.c
</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>
block_dev.c
</FileName>
...
...
bsp/imxrt1052-evk/rtconfig.h
浏览文件 @
5a2df50e
...
...
@@ -121,7 +121,9 @@
#define RT_USING_PIN
/* RT_USING_MTD_NOR is not set */
/* RT_USING_MTD_NAND is not set */
/* RT_USING_RTC is not set */
#define RT_USING_RTC
/* RT_USING_SOFT_RTC is not set */
/* RTC_SYNC_USING_NTP is not set */
#define RT_USING_SDIO
/* RT_USING_SPI is not set */
/* RT_USING_WDT is not set */
...
...
@@ -277,7 +279,7 @@
/* PKG_USING_HELLO is not set */
/* PKG_USING_MULTIBUTTON is not set */
#define SOC_IMXRT1052
#define RT_USING_UART
#define RT_USING_UART1
#define RT_USING_HP_RTC
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录