tools/testing/selftests/ptp/testptp.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/ptp/testptp.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/ptp/testptp.c
Extension
.c
Size
17123 bytes
Lines
695
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

switch (c) {
		case 'c':
			capabilities = 1;
			break;
		case 'd':
			device = optarg;
			break;
		case 'e':
			extts = atoi(optarg);
			break;
		case 'E':
			edge = atoi(optarg);
			edge = (edge & 1 ? PTP_RISING_EDGE : 0) |
				(edge & 2 ? PTP_FALLING_EDGE : 0);
			break;
		case 'f':
			adjfreq = atoi(optarg);
			break;
		case 'F':
			channel = atoi(optarg);
			break;
		case 'g':
			gettime = 1;
			break;
		case 'H':
			perout_phase = atoll(optarg);
			break;
		case 'i':
			index = atoi(optarg);
			break;
		case 'k':
			pct_offset = 1;
			n_samples = atoi(optarg);
			break;
		case 'l':
			list_pins = 1;
			break;
		case 'L':
			cnt = sscanf(optarg, "%d,%d", &pin_index, &pin_func);
			if (cnt != 2) {
				usage(progname);
				return -1;
			}
			break;
		case 'n':
			adjns = atoi(optarg);
			break;
		case 'o':
			adjphase = atoi(optarg);
			break;
		case 'p':
			perout = atoll(optarg);
			break;
		case 'P':
			pps = atoi(optarg);
			break;
		case 'r':
			readonly = 1;
			break;
		case 's':
			settime = 1;
			break;
		case 'S':
			settime = 2;
			break;
		case 't':
			adjtime = atoi(optarg);
			break;
		case 'T':
			settime = 3;
			seconds = atoi(optarg);
			break;
		case 'w':
			pulsewidth = atoi(optarg);
			break;
		case 'x':
			getextended = atoi(optarg);
			if (getextended < 1 || getextended > PTP_MAX_SAMPLES) {
				fprintf(stderr,
					"number of extended timestamp samples must be between 1 and %d; was asked for %d\n",
					PTP_MAX_SAMPLES, getextended);
				return -1;
			}
			break;
		case 'X':
			getcross = 1;
			break;
		case 'y':
			if (!strcasecmp(optarg, "realtime"))
				ext_clockid = CLOCK_REALTIME;

Annotation

Implementation Notes