freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于linux操作系統(tǒng)下rtc驅(qū)動開發(fā)(參考版)

2025-01-21 16:15本頁面
  

【正文】 += 5。 exit(errno)。rtc_tm)。 exit(errno)。 } retval = ioctl(fd, RTC_UIE_OFF, 0)。 fflush(stderr)。 exit(errno)。data, sizeof(unsigned long))。 exit(errno)。tv)。 retval = select(fd+1, amp。 FD_SET(fd, amp。 FD_ZERO(amp。 i++) { struct timeval tv = {5, 0}。 for (i=1。 } fprintf(stderr, \nAgain, from using select(2) on /dev/rtc:)。 fflush(stderr)。 exit(errno)。data, sizeof(unsigned long))。 i6。 fflush(stderr)。 exit(errno)。 goto test_READ。 } retval = ioctl(fd, RTC_UIE_ON, 0)。 if (fd == 1) { perror(rtc)。 return 1。 case 1: break。 const char *rtc = default_rtc。 unsigned long tmp, data。}附錄B Makefile文件ifeq ($(KERNELRELEASE),)KERNELDIR ?=/root/Desktop/Linux_kernel/PWD:=$(shell pwd)modules: $(MAKE) C $(KERNELDIR) M=$(PWD) modulesclean: rm rf *.o *core *.depend *.cmd *.ko *.mod.* *.order *.symvers.PHONY:modules cleanelseobjm:=endif附錄C 應用層測試程序include include linux/include sys/include sys/include sys/include include include include static const char default_rtc[] = /dev/rtc0。 if (err 0) printk(KERN_ERR %s: failed to allocate char dev region\n, __FILE__)。 err = alloc_chrdev_region(amp。rtcchar_dev)。 else pr_debug(%s: dev (%d:%d)\n, rtcname,MAJOR(rtc_devt), rtcid)。}void rtc_dev_add_device(struct rtc_device *rtc){ if (cdev_add(amp。rtc_dev_fops)。endif cdev_init(amp。 setup_timer(amp。ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL INIT_WORK(amp。 return。void rtc_dev_prepare(struct rtc_device *rtc){ if (!rtc_devt) return。 return 0。 clear_bit_unlock(RTC_DEV_BUSY, amp。 rtc_irq_set_state(rtc, NULL, 0)。 rtc_dev_ioctl(file, RTC_UIE_OFF, 0)。rtcasync_queue)。}static int rtc_dev_fasync(int fd, struct file *file, int on){ struct rtc_device *rtc = fileprivate_data。rtcops_lock)。 break。 if (err == ENOIOCTLCMD) err = ENOTTY。 return err。 if (copy_to_user(uarg, amp。alarm)。rtcops_lock)。alarm)。alarm, uarg, sizeof(alarm))) return EFAULT。rtcops_lock)。 break。endif break。 } rtc_epoch = arg。if 0 case RTC_EPOCH_SET:ifndef rtc_epoch if (arg 1900) { err = EINVAL。 case RTC_IRQP_READ: err = put_user(rtcirq_freq, (unsigned long __user *)uarg)。 case RTC_IRQP_SET: err = rtc_irq_set_freq(rtc, NULL, arg)。rtcops_lock)。 return rtc_update_irq_enable(rtc, 1)。 case RTC_UIE_ON: mutex_unlock(amp。rtcops_lock)。 return rtc_alarm_irq_enable(rtc, 1)。 case RTC_AIE_ON: mutex_unlock(amp。 case RTC_PIE_OFF: err = rtc_irq_set_state(rtc, NULL, 0)。 case RTC_PIE_ON: err = rtc_irq_set_state(rtc, NULL, 1)。 return rtc_set_time(rtc, amp。 if (copy_from_user(amp。 case RTC_SET_TIME: mutex_unlock(amp。tm, sizeof(tm))) err = EFAULT。 if (err 0) return err。 err = rtc_read_time(rtc, amp。 case RTC_RD_TIME: mutex_unlock(amp。 } } return rtc_set_alarm(rtc, amp。 = 。tm)。then)。 rtc_tm_to_time(amp。)。 = 。 = 。tm, amp。 if (err 0) return err。 err = rtc_read_time(rtc, amp。 = 1。 = 1。 = 0。 if (copy_from_user(amp。 case RTC_ALM_SET: mutex_unlock(amp。, sizeof(tm))) err = EFAULT。 if (err 0) return err。 err = rtc_read_alarm(rtc, amp。 switch (cmd) { case RTC_ALM_READ: mutex_unlock(amp。 break。amp。 break。amp。 break。 if (err) return err。 err = mutex_lock_interruptible(amp。 struct rtc_wkalrm alarm。 const struct rtc_class_ops *ops = rtcops。}static long rtc_dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg){ int err = 0。 data = rtcirq_data。 poll_wait(file, amp。}static unsigned int rtc_dev_poll(struct file *file, poll_table *wait){ struct rtc_device *rtc = fileprivate_data。 else ret = put_user(data, (unsigned long __user *)buf) ?: sizeof(unsigned long)。amp。 if (ret == 0) { if (rtcopsread_callback) data = rtcopsread_callback(rtc, data)。rtcirq_queue, amp。 set_current_state(TASK_RUNNING)。 } schedule()。 } if (signal_pending(current)) { ret = ERESTARTSYS。 O_NONBLOCK) { ret = EAGAIN。 break。rtcirq_lock)。 rtcirq_data = 0。rtcirq_lock)。 do { __set_current_state(TASK_INTERRUPTIBLE)。rtcirq_queue, amp。 count sizeof(unsigned long)) return EINVAL。 if (count != sizeof(unsigned int) amp。 unsigned long data。endif /* CONFIG_RTC_INTF_DEV_UIE_EMUL */static ssize_trtc_dev_read(struct file *file, char __user *buf, size_t count, loff_t *ppos){ struct rtc_device *rtc = fileprivate_data。 else return clear_uie(rtc)。 return 0。 spin_unlock_irq(amp。rtcuie_task) == 0) rtcuie_task_active = 0。 rtcuie_task_active = 1。 rtcstop_uie_polling = 0。rtcirq_lock)。 if (err) return err。 err = rtc_read_time(rtc, amp。}static int set_uie(struct rtc_device *rtc){ struct rtc_time tm。rtcirq_lock)。 } rtcuie_irq_active = 0。 spin_lock_irq(amp。rtcirq_lock)。 rtcuie_timer_active = 0。 spin_lock_irq(amp。 del_timer_sync(amp。 if (rtcuie_timer_active) { spin_unlock_irq(amp。rtcirq_lock)。rtcirq_lock, flags)。rtcuie_task) == 0)) rtcuie_task_active = 0。 rtcuie_task_active = 1。rtcirq_lock, flags)。 unsigned long flags。 if (num) rtc_handle_legacy_irq(rtc, num, RTC_UF)。 } spin_unlock_irq(amp。 } else if (schedule_work(amp。 add_timer(amp。 rtcuie_timer_active = 1。 rtcoldsecs = 。 if (rtcstop_uie_polling || err) { rtcuie_task_active = 0。 spin_lock_irq(amp。 err = rtc_read_time(rtc, amp。} int num = 0。rtcflags)。 return 0。 spin_unlock_irq(amp。ifdef CONFIG_RTC_INTF_DEV_UIE_EMULstatic void rtc_uie_task(struct work_struct *work){ struct rtc_device *rtc = container_of(work, struct rtc_device, uie_task)。rtcirq_lock)。 err = opsopen ? ops
點擊復制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1