From owner-svn-src-user@FreeBSD.ORG Mon Jun 25 22:19:21 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E6F41065672; Mon, 25 Jun 2012 22:19:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 309008FC12; Mon, 25 Jun 2012 22:19:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5PMJL5p098882; Mon, 25 Jun 2012 22:19:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5PMJKcq098879; Mon, 25 Jun 2012 22:19:20 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206252219.q5PMJKcq098879@svn.freebsd.org> From: Adrian Chadd Date: Mon, 25 Jun 2012 22:19:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237577 - user/adrian/ath_radar_stuff/lib/libradarpkt X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 22:19:21 -0000 Author: adrian Date: Mon Jun 25 22:19:20 2012 New Revision: 237577 URL: http://svn.freebsd.org/changeset/base/237577 Log: Add some notes about how to interpret the TSF values. Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.c user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.c ============================================================================== --- user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.c Mon Jun 25 22:14:24 2012 (r237576) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.c Mon Jun 25 22:19:20 2012 (r237577) @@ -89,6 +89,18 @@ ar5416_radar_decode(struct ieee80211_rad */ re->re_rssi = rssi; + /* + * XXX TODO: + * + * The radar event is timestamped by the MAC the end of the event. + * To work around this particular issue, a "best guess" of the event + * start time involves its duration. + * + * For the AR5416 we can fake this as we know that in 5GHz mode + * the MAC clock is 40MHz, so we can just convert the duration to + * a microsecond value and subtract that from the TSF. + */ + re->re_timestamp = tsf; /* XXX TODO: re->re_freq */ re->re_dur = pkt[len - 1] & 0xff; Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c ============================================================================== --- user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Mon Jun 25 22:14:24 2012 (r237576) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Mon Jun 25 22:19:20 2012 (r237577) @@ -99,6 +99,27 @@ ar9280_radar_decode(struct ieee80211_rad ); #endif + /* + * XXX TODO: + * + * The radar event is timestamped by the MAC the end of the event. + * To work around this particular issue, a "best guess" of the event + * start time involves its duration. + * + * For the AR5416 we can fake this as we know that in 5GHz mode + * the MAC clock is 40MHz, so we can just convert the duration to + * a microsecond value and subtract that from the TSF. + * This also holds true for the AR9130/AR9160 in 5GHz mode. + * + * However, for the AR9280, 5GHz operation may be in "fast clock" + * mode, where the duration is actually not 0.8uS, but slightly + * smaller. + * + * Since there's currently no way to record this information in + * the vendor radiotap header (but there should be, hint hint) + * should have a flags field somewhere which includes (among other + * things) whether the pulse duration is based on 40MHz or 44MHz. + */ re->re_timestamp = tsf; re->re_rssi = pri_rssi; /* XXX extension rssi? */ re->re_dur = pkt[len - 3]; /* XXX extension duration? */