9x25 PPS test 代码分析 2016.07.14

it2022-05-09  22

9x25 PPS test 代码分析 2016.07.14

pps-tools-master\Ppstest.c main find_source(char *path, pps_handle_t *handle, int *avail_mode) open(path, O_RDWR); time_pps_create(ret, handle); ioctl(source, PPS_GETPARAMS, &dummy); *handle = source; time_pps_getcap(*handle, avail_mode); ioctl(handle, PPS_GETCAP, mode); time_pps_getparams(*handle, ¶ms); ioctl(handle, PPS_GETPARAMS, &__ppsparams); time_pps_setparams(*handle, ¶ms); ioctl(handle, PPS_SETPARAMS, &__ppsparams); while (1) { //loop, printing the most recent timestamp every second or so fetch_source(i, &handle[i], &avail_mode[i]) if (*avail_mode & PPS_CANWAIT) time_pps_fetch(*handle, PPS_TSFMT_TSPEC, &infobuf,&timeout); ioctl(handle, PPS_FETCH, &__fdata); else { sleep(1); time_pps_fetch(*handle, PPS_TSFMT_TSPEC, &infobuf,&timeout); ioctl(handle, PPS_FETCH, &__fdata); }\linux-2.6.39-at91\drivers\pps\Pps.c

static const struct file_operations pps_cdev_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .poll = pps_cdev_poll, .fasync = pps_cdev_fasync, .unlocked_ioctl = pps_cdev_ioctl, .open = pps_cdev_open, .release = pps_cdev_release,};

pps_cdev_ioctl case PPS_GETPARAMS: dev_dbg(pps->dev, "PPS_GETPARAMS\n"); copy_to_user(uarg, ¶ms, sizeof(struct pps_kparams))

case PPS_GETCAP: dev_dbg(pps->dev, "PPS_GETCAP\n"); put_user(pps->info.mode, iuarg); case PPS_SETPARAMS: dev_dbg(pps->dev, "PPS_SETPARAMS\n"); copy_from_user(¶ms, uarg, sizeof(struct pps_kparams)); case PPS_FETCH: { copy_from_user(&fdata, uarg, sizeof(struct pps_fdata)); wait_event_interruptible(pps->queue,ev != pps->last_ev); wait_event_interruptible_timeout(pps->queue,ev != pps->last_ev,ticks); copy_to_user(uarg, &fdata, sizeof(struct pps_fdata)); pps_cdev_poll poll_wait(file, &pps->queue, wait); p->qproc(filp, wait_address, p);pps_register_cdev cdev_init(&pps->cdev, &pps_cdev_fops); cdev_add(&pps->cdev, devt, 1); device_create(pps_class, pps->info.dev, devt, pps,kobject_add

转载于:https://www.cnblogs.com/liushuhe1990/p/9608992.html

相关资源:PPS最灵验的测试

最新回复(0)