2 * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org>
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #include <sys/cdefs.h>
19 __FBSDID("$FreeBSD$");
28 #include <sys/types.h>
30 #include <sys/endian.h>
32 #include <dev/ath/if_ath_alq.h>
37 ath_tdma_beacon_state(struct if_ath_alq_payload *a)
39 struct if_ath_alq_tdma_beacon_state t;
40 static uint64_t last_beacon_tx = 0;
42 memcpy(&t, &a->payload, sizeof(t));
44 printf("[%u.%06u] [%llu] BEACON: RX TSF=%llu Beacon TSF=%llu (%d)\n",
45 (unsigned int) be32toh(a->hdr.tstamp_sec),
46 (unsigned int) be32toh(a->hdr.tstamp_usec),
47 (unsigned long long) be64toh(a->hdr.threadid),
48 (unsigned long long) be64toh(t.rx_tsf),
49 (unsigned long long) be64toh(t.beacon_tsf),
50 be64toh(t.beacon_tsf) - last_beacon_tx);
52 last_beacon_tx = be64toh(t.beacon_tsf);
56 ath_tdma_timer_config(struct if_ath_alq_payload *a)
58 struct if_ath_alq_tdma_timer_config t;
60 memcpy(&t, &a->payload, sizeof(t));
64 ath_tdma_slot_calc(struct if_ath_alq_payload *a)
66 struct if_ath_alq_tdma_slot_calc t;
68 memcpy(&t, &a->payload, sizeof(t));
69 printf("[%u.%06u] [%llu] SLOTCALC: NEXTTBTT=%llu nextslot=%llu "
70 "tsfdelta=%d avg (%d/%d)\n",
71 (unsigned int) be32toh(a->hdr.tstamp_sec),
72 (unsigned int) be32toh(a->hdr.tstamp_usec),
73 (unsigned long long) be64toh(a->hdr.threadid),
74 (unsigned long long) be64toh(t.nexttbtt),
75 (unsigned long long) be64toh(t.next_slot),
76 (int) be32toh(t.tsfdelta),
77 (int) be32toh(t.avg_plus),
78 (int) be32toh(t.avg_minus));
82 ath_tdma_tsf_adjust(struct if_ath_alq_payload *a)
84 struct if_ath_alq_tdma_tsf_adjust t;
86 memcpy(&t, &a->payload, sizeof(t));
87 printf("[%u.%06u] [%llu] TSFADJUST: TSF64 was %llu, adj=%d, "
89 (unsigned int) be32toh(a->hdr.tstamp_sec),
90 (unsigned int) be32toh(a->hdr.tstamp_usec),
91 (unsigned long long) be64toh(a->hdr.threadid),
92 (unsigned long long) be64toh(t.tsf64_old),
93 (int) be32toh(t.tsfdelta),
94 (unsigned long long) be64toh(t.tsf64_new));
98 ath_tdma_timer_set(struct if_ath_alq_payload *a)
100 struct if_ath_alq_tdma_timer_set t;
102 memcpy(&t, &a->payload, sizeof(t));
103 printf("[%u.%06u] [%llu] TIMERSET: bt_intval=%d nexttbtt=%d "
104 "nextdba=%d nextswba=%d nextatim=%d flags=0x%x tdmadbaprep=%d "
106 (unsigned int) be32toh(a->hdr.tstamp_sec),
107 (unsigned int) be32toh(a->hdr.tstamp_usec),
108 (unsigned long long) be64toh(a->hdr.threadid),
109 be32toh(t.bt_intval),
110 be32toh(t.bt_nexttbtt),
111 be32toh(t.bt_nextdba),
112 be32toh(t.bt_nextswba),
113 be32toh(t.bt_nextatim),
115 be32toh(t.sc_tdmadbaprep),
116 be32toh(t.sc_tdmaswbaprep));