mirror of
https://github.com/LuckfoxTECH/luckfox-pico.git
synced 2026-01-19 17:59:18 +01:00
project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp: Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem. sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately. sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades. sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for fastboot. Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
78
sysdrv/source/mcu/rt-thread/third_party/netutils/ntp/README.md
vendored
Normal file
78
sysdrv/source/mcu/rt-thread/third_party/netutils/ntp/README.md
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
# NTP:网络时间协议
|
||||
|
||||
## 1、介绍
|
||||
|
||||
[NTP](https://baike.baidu.com/item/NTP) 是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机时间的协议。
|
||||
|
||||
在 RT-Thread 上实现了 NTP 客户端,连接上网络后,可以获取当前 UTC 时间,并更新至 RTC 中。
|
||||
|
||||
## 2、使用
|
||||
|
||||
首先打开 meunconfig ,配置并开启 netutils 软件包。在配置选项中,默认提供了 3 个 NTP 服务器,保证了 NTP 功能的可靠性。
|
||||
|
||||
### 2.1 获取 UTC 时间
|
||||
|
||||
[UTC 时间](https://baike.baidu.com/item/%E5%8D%8F%E8%B0%83%E4%B8%96%E7%95%8C%E6%97%B6/787659?fromtitle=UTC&fromid=5899996) 又称世界统一时间、世界标准时间、国际协调时间。北京时间为 UTC+8 时间,比 UTC 时间多 8 小时,或者理解为早 8 小时。
|
||||
|
||||
API: `time_t ntp_get_time(void)`
|
||||
|
||||
|参数 |描述|
|
||||
|:----- |:----|
|
||||
|return |`>0`: 当前 UTC 时间,`=0`:获取时间失败|
|
||||
|
||||
|
||||
示例代码:
|
||||
|
||||
```C
|
||||
#include <ntp.h>
|
||||
|
||||
void main(void)
|
||||
{
|
||||
time_t cur_time;
|
||||
|
||||
cur_time = ntp_get_time();
|
||||
|
||||
if (cur_time)
|
||||
{
|
||||
rt_kprintf("NTP Server Time: %s", ctime((const time_t*) &cur_time));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2.2 获取本地时间
|
||||
|
||||
本地时间比 UTC 时间多了时区的概念,例如:北京时间为东八区,比 UTC 时间多 8 个小时。
|
||||
|
||||
在 `menuconfig` 中可以设置当前时区,默认为 `8`
|
||||
|
||||
API: `time_t ntp_get_local_time(void)`
|
||||
|
||||
|参数 |描述|
|
||||
|:----- |:----|
|
||||
|return |`>0`: 当前本地时间,`=0`:获取时间失败|
|
||||
|
||||
该 API 使用方法与 `ntp_get_time()` 类似
|
||||
|
||||
### 2.3 同步本地时间至 RTC
|
||||
|
||||
如果开启 RTC 设备,还可以使用下面的命令及 API 同步 NTP 的本地时间至 RTC 设备。
|
||||
|
||||
Finsh/MSH 命令效果如下:
|
||||
|
||||
```
|
||||
msh />ntp_sync
|
||||
Get local time from NTP server: Sat Feb 10 15:22:33 2018
|
||||
The system time is updated. Timezone is 8.
|
||||
msh />
|
||||
```
|
||||
|
||||
API: `time_t ntp_sync_to_rtc(void)`
|
||||
|
||||
|参数 |描述|
|
||||
|:----- |:----|
|
||||
|return |`>0`: 当前本地时间,`=0`:同步时间失败|
|
||||
|
||||
## 3、注意事项
|
||||
|
||||
- 1、NTP API 方法执行时会占用较多的线程堆栈,使用时保证堆栈空间充足(≥1.5K);
|
||||
- 2、NTP API 方法 **不支持可重入** ,并发使用时,请注意加锁。
|
||||
Reference in New Issue
Block a user