From owner-svn-src-all@FreeBSD.ORG Mon Feb 18 04:20:44 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B23C5B51; Mon, 18 Feb 2013 04:20:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 959699E7; Mon, 18 Feb 2013 04:20:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1I4KiU3011100; Mon, 18 Feb 2013 04:20:44 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1I4KhxJ011096; Mon, 18 Feb 2013 04:20:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201302180420.r1I4KhxJ011096@svn.freebsd.org> From: Adrian Chadd Date: Mon, 18 Feb 2013 04:20:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246935 - head/tools/tools/ath/athalq X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2013 04:20:44 -0000 Author: adrian Date: Mon Feb 18 04:20:43 2013 New Revision: 246935 URL: http://svnweb.freebsd.org/changeset/base/246935 Log: * Add initial debugging of the interrupt status entry * Add in the TDMA debugging entries that I added a while ago Added: head/tools/tools/ath/athalq/tdma.c (contents, props changed) head/tools/tools/ath/athalq/tdma.h (contents, props changed) Modified: head/tools/tools/ath/athalq/Makefile head/tools/tools/ath/athalq/main.c Modified: head/tools/tools/ath/athalq/Makefile ============================================================================== --- head/tools/tools/ath/athalq/Makefile Mon Feb 18 04:19:21 2013 (r246934) +++ head/tools/tools/ath/athalq/Makefile Mon Feb 18 04:20:43 2013 (r246935) @@ -3,7 +3,7 @@ PROG= athalq NOMAN= yes -SRCS= main.c ar5210_ds.c ar5211_ds.c ar5212_ds.c ar5416_ds.c +SRCS= main.c ar5210_ds.c ar5211_ds.c ar5212_ds.c ar5416_ds.c tdma.c # SRCS+= ar9300_ds.c .include <../Makefile.inc> Modified: head/tools/tools/ath/athalq/main.c ============================================================================== --- head/tools/tools/ath/athalq/main.c Mon Feb 18 04:19:21 2013 (r246934) +++ head/tools/tools/ath/athalq/main.c Mon Feb 18 04:20:43 2013 (r246935) @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #include "ar5212_ds.h" #include "ar5416_ds.h" +#include "tdma.h" + #define AR5210_MAGIC 0x19980124 #define AR5211_MAGIC 0x19570405 #define AR5212_MAGIC 0x19541014 @@ -58,6 +60,21 @@ ath_alq_print_hdr(struct if_ath_alq_init be32toh(hdr->sc_hal_magic)); } +static void +ath_alq_print_intr_status(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_interrupt is; + + /* XXX len check! */ + memcpy(&is, &a->payload, sizeof(is)); + + printf("[%u.%06u] [%llu] INTR: status=0x%08x\n", + (unsigned int) be32toh(a->hdr.tstamp_sec), + (unsigned int) be32toh(a->hdr.tstamp_usec), + (unsigned long long) be64toh(a->hdr.threadid), + be32toh(is.intr_status)); +} + int main(int argc, const char *argv[]) { @@ -112,6 +129,24 @@ main(int argc, const char *argv[]) memcpy(&hdr, a->payload, sizeof(hdr)); ath_alq_print_hdr(&hdr); break; + case ATH_ALQ_TDMA_BEACON_STATE: + ath_tdma_beacon_state(a); + break; + case ATH_ALQ_TDMA_TIMER_CONFIG: + ath_tdma_timer_config(a); + break; + case ATH_ALQ_TDMA_SLOT_CALC: + ath_tdma_slot_calc(a); + break; + case ATH_ALQ_TDMA_TSF_ADJUST: + ath_tdma_tsf_adjust(a); + break; + case ATH_ALQ_TDMA_TIMER_SET: + ath_tdma_timer_set(a); + break; + case ATH_ALQ_INTR_STATUS: + ath_alq_print_intr_status(a); + break; default: if (be32toh(hdr.sc_hal_magic) == AR5210_MAGIC) ar5210_alq_payload(a); Added: head/tools/tools/ath/athalq/tdma.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athalq/tdma.c Mon Feb 18 04:20:43 2013 (r246935) @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2013 Adrian Chadd + * All Rights Reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include "tdma.h" + +void +ath_tdma_beacon_state(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_tdma_beacon_state t; + static uint64_t last_beacon_tx = 0; + + memcpy(&t, &a->payload, sizeof(t)); + + printf("[%u.%06u] [%llu] BEACON: RX TSF=%llu Beacon TSF=%llu (%d)\n", + (unsigned int) be32toh(a->hdr.tstamp_sec), + (unsigned int) be32toh(a->hdr.tstamp_usec), + (unsigned long long) be64toh(a->hdr.threadid), + (unsigned long long) be64toh(t.rx_tsf), + (unsigned long long) be64toh(t.beacon_tsf), + be64toh(t.beacon_tsf) - last_beacon_tx); + + last_beacon_tx = be64toh(t.beacon_tsf); +} + +void +ath_tdma_timer_config(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_tdma_timer_config t; + + memcpy(&t, &a->payload, sizeof(t)); +} + +void +ath_tdma_slot_calc(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_tdma_slot_calc t; + + memcpy(&t, &a->payload, sizeof(t)); + printf("[%u.%06u] [%llu] SLOTCALC: NEXTTBTT=%llu nextslot=%llu " + "tsfdelta=%d avg (%d/%d)\n", + (unsigned int) be32toh(a->hdr.tstamp_sec), + (unsigned int) be32toh(a->hdr.tstamp_usec), + (unsigned long long) be64toh(a->hdr.threadid), + (unsigned long long) be64toh(t.nexttbtt), + (unsigned long long) be64toh(t.next_slot), + (int) be32toh(t.tsfdelta), + (int) be32toh(t.avg_plus), + (int) be32toh(t.avg_minus)); +} + +void +ath_tdma_tsf_adjust(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_tdma_tsf_adjust t; + + memcpy(&t, &a->payload, sizeof(t)); + printf("[%u.%06u] [%llu] TSFADJUST: TSF64 was %llu, adj=%d, " + "now %llu\n", + (unsigned int) be32toh(a->hdr.tstamp_sec), + (unsigned int) be32toh(a->hdr.tstamp_usec), + (unsigned long long) be64toh(a->hdr.threadid), + (unsigned long long) be64toh(t.tsf64_old), + (int) be32toh(t.tsfdelta), + (unsigned long long) be64toh(t.tsf64_new)); +} + +void +ath_tdma_timer_set(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_tdma_timer_set t; + + memcpy(&t, &a->payload, sizeof(t)); + printf("[%u.%06u] [%llu] TIMERSET: bt_intval=%d nexttbtt=%d " + "nextdba=%d nextswba=%d nextatim=%d flags=0x%x tdmadbaprep=%d " + "tdmaswbaprep=%d\n", + (unsigned int) be32toh(a->hdr.tstamp_sec), + (unsigned int) be32toh(a->hdr.tstamp_usec), + (unsigned long long) be64toh(a->hdr.threadid), + be32toh(t.bt_intval), + be32toh(t.bt_nexttbtt), + be32toh(t.bt_nextdba), + be32toh(t.bt_nextswba), + be32toh(t.bt_nextatim), + be32toh(t.bt_flags), + be32toh(t.sc_tdmadbaprep), + be32toh(t.sc_tdmaswbaprep)); +} Added: head/tools/tools/ath/athalq/tdma.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athalq/tdma.h Mon Feb 18 04:20:43 2013 (r246935) @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2013 Adrian Chadd + * All Rights Reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ +#ifndef __TDMA_H__ +#define __TDMA_H__ + +extern void ath_tdma_beacon_state(struct if_ath_alq_payload *a); +extern void ath_tdma_timer_config(struct if_ath_alq_payload *a); +extern void ath_tdma_slot_calc(struct if_ath_alq_payload *a); +extern void ath_tdma_tsf_adjust(struct if_ath_alq_payload *a); +extern void ath_tdma_timer_set(struct if_ath_alq_payload *a); + +#endif /* __TDMA_H__ */