Lines Matching defs:txc
213 static inline void pps_fill_timex(struct ntp_data *ntpdata, struct __kernel_timex *txc)
215 txc->ppsfreq = shift_right((ntpdata->pps_freq >> PPM_SCALE_INV_SHIFT) *
217 txc->jitter = ntpdata->pps_jitter;
219 txc->jitter = ntpdata->pps_jitter / NSEC_PER_USEC;
220 txc->shift = ntpdata->pps_shift;
221 txc->stabil = ntpdata->pps_stabil;
222 txc->jitcnt = ntpdata->pps_jitcnt;
223 txc->calcnt = ntpdata->pps_calcnt;
224 txc->errcnt = ntpdata->pps_errcnt;
225 txc->stbcnt = ntpdata->pps_stbcnt;
245 static inline void pps_fill_timex(struct ntp_data *ntpdata, struct __kernel_timex *txc)
248 txc->ppsfreq = 0;
249 txc->jitter = 0;
250 txc->shift = 0;
251 txc->stabil = 0;
252 txc->jitcnt = 0;
253 txc->calcnt = 0;
254 txc->errcnt = 0;
255 txc->stbcnt = 0;
938 * Propagate a new txc->status value into the NTP state:
940 static inline void process_adj_status(struct ntp_data *ntpdata, const struct __kernel_timex *txc)
942 if ((ntpdata->time_status & STA_PLL) && !(txc->status & STA_PLL)) {
954 if (!(ntpdata->time_status & STA_PLL) && (txc->status & STA_PLL))
959 ntpdata->time_status |= txc->status & ~STA_RONLY;
962 static inline void process_adjtimex_modes(struct ntp_data *ntpdata, const struct __kernel_timex *txc,
965 if (txc->modes & ADJ_STATUS)
966 process_adj_status(ntpdata, txc);
968 if (txc->modes & ADJ_NANO)
971 if (txc->modes & ADJ_MICRO)
974 if (txc->modes & ADJ_FREQUENCY) {
975 ntpdata->time_freq = txc->freq * PPM_SCALE;
982 if (txc->modes & ADJ_MAXERROR)
983 ntpdata->time_maxerror = clamp(txc->maxerror, 0, NTP_PHASE_LIMIT);
985 if (txc->modes & ADJ_ESTERROR)
986 ntpdata->time_esterror = clamp(txc->esterror, 0, NTP_PHASE_LIMIT);
988 if (txc->modes & ADJ_TIMECONST) {
989 ntpdata->time_constant = clamp(txc->constant, 0, MAXTC);
995 if (txc->modes & ADJ_TAI && txc->constant >= 0 && txc->constant <= MAX_TAI_OFFSET)
996 *time_tai = txc->constant;
998 if (txc->modes & ADJ_OFFSET)
999 ntp_update_offset(ntpdata, txc->offset);
1001 if (txc->modes & ADJ_TICK)
1002 ntpdata->tick_usec = txc->tick;
1004 if (txc->modes & (ADJ_TICK|ADJ_FREQUENCY|ADJ_OFFSET))
1012 int ntp_adjtimex(unsigned int tkid, struct __kernel_timex *txc, const struct timespec64 *ts,
1018 if (txc->modes & ADJ_ADJTIME) {
1021 if (!(txc->modes & ADJ_OFFSET_READONLY)) {
1023 ntpdata->time_adjust = txc->offset;
1030 txc->offset = save_adjust;
1033 if (txc->modes) {
1040 process_adjtimex_modes(ntpdata, txc, time_tai);
1049 txc->offset = shift_right(ntpdata->time_offset * NTP_INTERVAL_FREQ, NTP_SCALE_SHIFT);
1051 txc->offset = div_s64(txc->offset, NSEC_PER_USEC);
1058 txc->freq = shift_right((ntpdata->time_freq >> PPM_SCALE_INV_SHIFT) *
1060 txc->maxerror = ntpdata->time_maxerror;
1061 txc->esterror = ntpdata->time_esterror;
1062 txc->status = ntpdata->time_status;
1063 txc->constant = ntpdata->time_constant;
1064 txc->precision = 1;
1065 txc->tolerance = MAXFREQ_SCALED / PPM_SCALE;
1066 txc->tick = ntpdata->tick_usec;
1067 txc->tai = *time_tai;
1070 pps_fill_timex(ntpdata, txc);
1072 txc->time.tv_sec = ts->tv_sec;
1073 txc->time.tv_usec = ts->tv_nsec;
1075 txc->time.tv_usec = ts->tv_nsec / NSEC_PER_USEC;
1081 txc->tai++;
1082 txc->time.tv_sec--;
1086 txc->tai--;
1087 txc->time.tv_sec++;