Files
rt-thread/documentation/6.components/device-driver/rtc/dm.md
T
GuEe-GUI cfda3b3d1a
doc_doxygen / doxygen_doc generate (push) Has been cancelled
doc_doxygen / deploy (push) Has been cancelled
[docs] device-driver: add DM subsystem docs and expand INDEX
Add Doxygen pages for RT-Thread device-model drivers: platform/OFW,
DM core (bus, dm, power), clk/regulator/reset/power-domain, PCI/PIC,
Phye, DMA/hwcache, block/SCSI/ATA/NVMe/UFS/SDIO, SCMI, RPMsg,
mailbox, NVMem, NUMA, syscon, thermal, input/LED/IIO/graphic, and
related power/charger/supply docs.
Expand device-driver INDEX.md with ~90 @subpage entries so all new
pages appear in the driver chapter navigation.
Update existing UART/SPI/RTC/pin/framework/dtc pages: UART docs moved
from serial/ to uart/ (uart + uart_dm + uart_earlycon); SPI and RTC
gain DM companion pages; pin links to pin_dm; framework points at DM
topics.
Focus on registration/probe flow and in-tree APIs; no standalone
VirtIO subsystem page (transport code still incomplete).
Test plan: build Doxygen for documentation/ and verify device-driver
INDEX links resolve without missing @ref/@subpage warnings.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2026-05-28 16:09:55 +08:00

1.6 KiB
Executable File
Raw Blame History

@page page_device_rtc_dm RTC DM helpers (rtc_dm.h)

rtc_dm.h API

Header: components/drivers/rtc/rtc_dm.h. Implementation: components/drivers/rtc/rtc_dm.c.

DM RTC chip drivers include this header at probe to set the registered device name and to convert alarm fields. Chip control() / RT_DEVICE_CTRL_RTC_* and application set_date / set_time are documented in @ref page_device_rtc.


rtc_dev_set_name

int rtc_dev_set_name(struct rt_device *rtc_dev);

Assigns the RTC rt_device name before rt_device_register:

Condition Name set
No device named "rtc" yet rtc
"rtc" already exists rtc1, rtc2, … (incrementing id)

Returns the result of rt_dm_dev_set_name (0 on success).

Note: set_date() / set_time() in dev_rtc.c only look up "rtc", not rtc1.


rtc_wkalarm_to_timestamp

time_t rtc_wkalarm_to_timestamp(struct rt_rtc_wkalarm *alarm);

Builds a time_t for todays calendar date (from current time()) with hour/minute/second taken from alarm (tm_hour, tm_min, tm_sec). Other rt_rtc_wkalarm fields are ignored.

Uses localtime_r + timegm.


rtc_timestamp_to_wkalarm

void rtc_timestamp_to_wkalarm(time_t timestamp, struct rt_rtc_wkalarm *alarm);

Fills alarm->tm_hour, tm_min, tm_sec from timestamp (local time). Does not set enable or date fields.


See also

  • @ref page_device_rtc
  • components/drivers/include/drivers/dev_rtc.hstruct rt_rtc_wkalarm, RT_DEVICE_CTRL_RTC_*