read: the standard read function call. ssize_t read(int file_handler, viod *buf, size_t nbytes); In the RTC driver, the read function is used to wait for the RTC device interrupt. When call the read function, the application is locked until a interrupt is generated. USAGE: ------ int fd; int ret; struct rtc_time rtc_tm; unsigned long data; ===> why "unsigned long" type. fd = open("/dev/rtc", O_RDONLY, 0); ret = ioctl(fd, RTC_ALM_SET, &rtc_tm); // call the read function to wait the Alarm interrupt ret = read(fd, &data, sizeof(unsigned long)); ... close(fd); Reference: http://www.uclinux.org/pub/uClinux/ports/blackfin/docs/Device%20Driver%20Integration%20Notes%20and%20Tests/RTC_device_driver.txt http://ww2.cs.fsu.edu/~rosentha/linux/2.6.26.5/docs/rtc.txt
[RTC] Read function in RTC Driver
最新推荐文章于 2024-01-30 12:47:11 发布