Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 May 2011 19:49:32 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222322 - head/tools/tools/ath/ath_ee_9287_print
Message-ID:  <201105261949.p4QJnWPU078396@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Thu May 26 19:49:32 2011
New Revision: 222322
URL: http://svn.freebsd.org/changeset/base/222322

Log:
  Include an EEPROM dump program for the AR9287 EEPROM format.

Added:
  head/tools/tools/ath/ath_ee_9287_print/
  head/tools/tools/ath/ath_ee_9287_print/9287.c   (contents, props changed)
  head/tools/tools/ath/ath_ee_9287_print/9287.h   (contents, props changed)
  head/tools/tools/ath/ath_ee_9287_print/Makefile   (contents, props changed)
  head/tools/tools/ath/ath_ee_9287_print/eeprom.c   (contents, props changed)
  head/tools/tools/ath/ath_ee_9287_print/eeprom.h   (contents, props changed)
  head/tools/tools/ath/ath_ee_9287_print/main.c   (contents, props changed)

Added: head/tools/tools/ath/ath_ee_9287_print/9287.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/ath/ath_ee_9287_print/9287.c	Thu May 26 19:49:32 2011	(r222322)
@@ -0,0 +1,316 @@
+/*
+ * Copyright (c) 2010-2011 Adrian Chadd, Xenion Pty Ltd.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <err.h>
+
+typedef enum {
+        AH_FALSE = 0,           /* NB: lots of code assumes false is zero */
+        AH_TRUE  = 1,
+} HAL_BOOL;
+
+typedef enum {
+        HAL_OK          = 0,    /* No error */
+} HAL_STATUS;
+
+struct ath_hal;
+
+#include "ah_eeprom_v14.h"
+#include "ah_eeprom_9287.h"
+
+void
+eeprom_9287_base_print(uint16_t *buf)
+{
+	HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
+	BASE_EEP_9287_HEADER *eh = &eep->ee_base.baseEepHeader;
+	int i;
+
+	printf("| Version: 0x%.4x   | Length: 0x%.4x | Checksum: 0x%.4x ",
+	    eh->version, eh->length, eh->checksum);
+	printf("| CapFlags: 0x%.2x  | eepMisc: 0x%.2x | RegDomain: 0x%.4x 0x%.4x | \n",
+	    eh->opCapFlags, eh->eepMisc, eh->regDmn[0], eh->regDmn[1]);
+	printf("| MAC: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x ",
+	    eh->macAddr[0], eh->macAddr[1], eh->macAddr[2],
+	    eh->macAddr[3], eh->macAddr[4], eh->macAddr[5]);
+	printf("| RxMask: 0x%.2x | TxMask: 0x%.2x | RfSilent: 0x%.4x | btOptions: 0x%.4x |\n",
+	    eh->rxMask, eh->txMask, eh->rfSilent, eh->blueToothOptions);
+	printf("| DeviceCap: 0x%.4x | binBuildNumber: %.8x | deviceType: 0x%.2x | openLoopPwrCntl 0x%.2x |\n",
+	    eh->deviceCap, eh->binBuildNumber, eh->deviceType, eh->openLoopPwrCntl);
+	printf("| pwrTableOffset: %d | tempSensSlope: %d | tempSensSlopePalOn: %d |\n",
+	    eh->pwrTableOffset, eh->tempSensSlope, eh->tempSensSlopePalOn);
+
+	printf("Future:\n");
+	for (i = 0; i < sizeof(eh->futureBase) / sizeof(uint16_t); i++) {
+		printf("0x%.2x ", eh->futureBase[i]);
+	}
+	printf("\n");
+}
+
+void
+eeprom_9287_custdata_print(uint16_t *buf)
+{
+	HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
+	uint8_t *custdata = (uint8_t *) &eep->ee_base.custData;
+	int i;
+
+	printf("\n| Custdata:                                       |\n");
+	for (i = 0; i < 20; i++) {
+		printf("%s0x%.2x %s",
+		    i % 16 == 0 ? "| " : "",
+		    custdata[i],
+		    i % 16 == 15 ? "|\n" : "");
+	}
+	printf("\n");
+}
+
+void
+eeprom_9287_modal_print(uint16_t *buf)
+{
+	HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
+	MODAL_EEP_9287_HEADER *mh = &eep->ee_base.modalHeader;
+	int i;
+
+	printf("| antCtrlCommon: 0x%.8x |\n", mh->antCtrlCommon);
+	printf("| switchSettling: 0x%.2x |\n", mh->switchSettling);
+	printf("| adcDesiredSize: %d |\n", mh->adcDesiredSize);
+
+	for (i = 0; i < AR9287_MAX_CHAINS; i++) {
+		printf("| Chain %d:\n", i);
+		printf("| antCtrlChain:        0:0x%.4x |\n", mh->antCtrlChain[i]);
+		printf("| antennaGainCh:       0:0x%.2x |\n", mh->antennaGainCh[i]);
+		printf("| txRxAttenCh:         0:0x%.2x |\n", mh->txRxAttenCh[i]);
+		printf("| rxTxMarginCh:        0:0x%.2x |\n", mh->rxTxMarginCh[i]);
+		printf("| noiseFloorThresCh:   0:0x%.2x |\n", mh->noiseFloorThreshCh[i]);
+		printf("| iqCalICh:            0:0x%.2x |\n", mh->iqCalICh[i]);
+		printf("| iqCalQCh:            0:0x%.2x |\n", mh->iqCalQCh[i]);
+		printf("| bswAtten:            0:0x%.2x |\n", mh->bswAtten[i]);
+		printf("| bswMargin:           0:0x%.2x |\n", mh->bswMargin[i]);
+		printf("\n");
+	}
+
+	printf("| txEndToXpaOff: 0x%.2x | txEndToRxOn: 0x%.2x | txFrameToXpaOn: 0x%.2x |\n",
+	    mh->txEndToXpaOff, mh->txEndToRxOn, mh->txFrameToXpaOn);
+	printf("| thres62: 0x%.2x\n", mh->thresh62);
+	printf("| xpdGain: 0x%.2x | xpd: 0x%.2x |\n", mh->xpdGain, mh->xpd);
+
+	printf("| pdGainOverlap: 0x%.2x xpaBiasLvl: 0x%.2x |\n", mh->pdGainOverlap, mh->xpaBiasLvl);
+	printf("| txFrameToDataStart: 0x%.2x | txFrameToPaOn: 0x%.2x |\n", mh->txFrameToDataStart, mh->txFrameToPaOn);
+	printf("| ht40PowerIncForPdadc: 0x%.2x |\n", mh->ht40PowerIncForPdadc);
+	printf("| swSettleHt40: 0x%.2x |\n", mh->swSettleHt40);
+
+	printf("| Modal Version: %.2x |\n", mh->version);
+	printf("| db1 = %d | db2 = %d |\n", mh->db1, mh->db2);
+	printf("| ob_cck = %d | ob_psk = %d | ob_qam = %d | ob_pal_off = %d |\n",
+	    mh->ob_cck, mh->ob_psk, mh->ob_qam, mh->ob_pal_off);
+
+	printf("| futureModal: ");
+	for (i = 0; i < sizeof(mh->futureModal) / sizeof(uint16_t); i++) {
+	    printf("0x%.2x ", mh->futureModal[i]);
+	}
+	printf("\n");
+
+	/* and now, spur channels */
+	for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) {
+		printf("| Spur %d: spurChan: 0x%.4x spurRangeLow: 0x%.2x spurRangeHigh: 0x%.2x |\n",
+		    i, mh->spurChans[i].spurChan,
+		    (int) mh->spurChans[i].spurRangeLow,
+		    (int) mh->spurChans[i].spurRangeHigh);
+	}
+}
+
+static void
+eeprom_9287_print_caldata_oploop(struct cal_data_op_loop_ar9287 *f)
+{
+	int i, j;
+
+	/* XXX flesh out the rest */
+	for (i = 0; i < 2; i++) {
+		printf("    pwrPdg:");
+		for (j = 0; j < 5; j++) {
+			printf("[%d][%d]=%d, ", i, j, f->pwrPdg[i][j]);
+		}
+		printf("\n");
+
+		printf("    vpdPdg:");
+		for (j = 0; j < 5; j++) {
+			printf("[%d][%d]=%d, ", i, j, f->vpdPdg[i][j]);
+		}
+		printf("\n");
+
+		printf("    pcdac:");
+		for (j = 0; j < 5; j++) {
+			printf("[%d][%d]=%d, ", i, j, f->pcdac[i][j]);
+		}
+		printf("\n");
+
+		printf("    empty:");
+		for (j = 0; j < 5; j++) {
+			printf("[%d][%d]=%d, ", i, j, f->empty[i][j]);
+		}
+		printf("\n\n");
+	}
+}
+
+void
+eeprom_9287_calfreqpiers_print(uint16_t *buf)
+{
+	HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
+	int i, n;
+
+	/* 2ghz cal piers */
+	printf("calFreqPier2G: ");
+	for (i = 0; i < AR9287_NUM_2G_CAL_PIERS; i++) {
+		printf(" 0x%.2x ", eep->ee_base.calFreqPier2G[i]);
+	}
+	printf("|\n");
+
+	for (i = 0; i < AR9287_NUM_2G_CAL_PIERS; i++) {
+		if (eep->ee_base.calFreqPier2G[i] == 0xff)
+			continue;
+		printf("2Ghz Cal Pier %d\n", i);
+		for (n = 0; n < AR9287_MAX_CHAINS; n++) {
+			printf("  Chain %d:\n", n);
+			eeprom_9287_print_caldata_oploop((void *)&eep->ee_base.calPierData2G[n][i]);
+		}
+	}
+
+	printf("\n");
+}
+
+/* XXX these should just reference the v14 print routines */
+static void
+eeprom_v14_target_legacy_print(CAL_TARGET_POWER_LEG *l)
+{
+	int i;
+	if (l->bChannel == 0xff)
+		return;
+	printf("  bChannel: %d;", l->bChannel);
+	for (i = 0; i < 4; i++) {
+		printf(" %.2f", (float) l->tPow2x[i] / 2.0);
+	}
+	printf(" (dBm)\n");
+}
+
+static void
+eeprom_v14_target_ht_print(CAL_TARGET_POWER_HT *l)
+{
+	int i;
+	if (l->bChannel == 0xff)
+		return;
+	printf("  bChannel: %d;", l->bChannel);
+	for (i = 0; i < 8; i++) {
+		printf(" %.2f", (float) l->tPow2x[i] / 2.0);
+	}
+	printf(" (dBm)\n");
+}
+
+void
+eeprom_9287_print_targets(uint16_t *buf)
+{
+	HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
+	int i;
+
+	/* 2ghz rates */
+	printf("2Ghz CCK:\n");
+	for (i = 0; i < AR9287_NUM_2G_CCK_TARGET_POWERS; i++) {
+		eeprom_v14_target_legacy_print(&eep->ee_base.calTargetPowerCck[i]);
+	}
+	printf("2Ghz 11g:\n");
+	for (i = 0; i < AR9287_NUM_2G_20_TARGET_POWERS; i++) {
+		eeprom_v14_target_legacy_print(&eep->ee_base.calTargetPower2G[i]);
+	}
+	printf("2Ghz HT20:\n");
+	for (i = 0; i < AR9287_NUM_2G_20_TARGET_POWERS; i++) {
+		eeprom_v14_target_ht_print(&eep->ee_base.calTargetPower2GHT20[i]);
+	}
+	printf("2Ghz HT40:\n");
+	for (i = 0; i < AR9287_NUM_2G_40_TARGET_POWERS; i++) {
+		eeprom_v14_target_ht_print(&eep->ee_base.calTargetPower2GHT40[i]);
+	}
+
+}
+
+static void
+eeprom_9287_ctl_edge_print(struct cal_ctl_data_ar9287 *ctl)
+{
+	int i, j;
+	uint8_t pow, flag;
+
+	for (i = 0; i < AR9287_MAX_CHAINS; i++) {
+		printf("  chain %d: ", i);
+		for (j = 0; j < AR9287_NUM_BAND_EDGES; j++) {
+			pow = ctl->ctlEdges[i][j].tPowerFlag & 0x3f;
+			flag = (ctl->ctlEdges[i][j].tPowerFlag & 0xc0) >> 6;
+			printf(" %d:pow=%d,flag=%.2x", j, pow, flag);
+		}
+		printf("\n");
+	}
+}
+
+void
+eeprom_9287_ctl_print(uint16_t *buf)
+{
+	HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
+	int i;
+
+	for (i = 0; i < AR9287_NUM_CTLS; i++) {
+		if (eep->ee_base.ctlIndex[i] == 0)
+			continue;
+		printf("| ctlIndex: offset %d, value %d\n", i, eep->ee_base.ctlIndex[i]);
+		eeprom_9287_ctl_edge_print(&eep->ee_base.ctlData[i]);
+	}
+}
+
+void
+eeprom_9287_print_edges(uint16_t *buf)
+{
+	HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
+	int i;
+
+	printf("| eeNumCtls: %d\n", eep->ee_numCtls);
+	for (i = 0; i < NUM_EDGES*eep->ee_numCtls; i++) {
+		/* XXX is flag 8 or 32 bits? */
+		printf("|  edge %2d/%2d: rdEdge: %5d EdgePower: %.2f dBm Flag: 0x%.8x\n",
+			i / NUM_EDGES, i % NUM_EDGES,
+			eep->ee_rdEdgesPower[i].rdEdge,
+			(float) eep->ee_rdEdgesPower[i].twice_rdEdgePower / 2.0,
+			eep->ee_rdEdgesPower[i].flag);
+
+		if (i % NUM_EDGES == (NUM_EDGES -1))
+			printf("|\n");
+	}
+}
+
+void
+eeprom_9287_print_other(uint16_t *buf)
+{
+	HAL_EEPROM_9287 *eep = (HAL_EEPROM_9287 *) buf;
+}

Added: head/tools/tools/ath/ath_ee_9287_print/9287.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/ath/ath_ee_9287_print/9287.h	Thu May 26 19:49:32 2011	(r222322)
@@ -0,0 +1,15 @@
+/* $FreeBSD$ */
+
+#ifndef	__9287_H__
+#define	__9287_H__
+
+extern void eeprom_9287_base_print(uint16_t *buf);
+extern void eeprom_9287_custdata_print(uint16_t *buf);
+extern void eeprom_9287_modal_print(uint16_t *buf);
+extern void eeprom_9287_calfreqpiers_print(uint16_t *buf);
+extern void eeprom_9287_ctl_print(uint16_t *buf);
+extern void eeprom_9287_print_targets(uint16_t *buf);
+extern void eeprom_9287_print_edges(uint16_t *buf);
+extern void eeprom_9287_print_other(uint16_t *buf);
+
+#endif

Added: head/tools/tools/ath/ath_ee_9287_print/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/ath/ath_ee_9287_print/Makefile	Thu May 26 19:49:32 2011	(r222322)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+.PATH:  ${.CURDIR}/../../../../sys/dev/ath/ath_hal
+
+PROG=	ath_ee_9287_print
+SRCS=	main.c eeprom.c 9287.c
+NOMAN=	yes
+NO_MAN=	yes
+
+.include <../Makefile.inc>
+
+.include <bsd.prog.mk>

Added: head/tools/tools/ath/ath_ee_9287_print/eeprom.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/ath/ath_ee_9287_print/eeprom.c	Thu May 26 19:49:32 2011	(r222322)
@@ -0,0 +1,72 @@
+
+/*
+ * Copyright (c) 2010-2011 Adrian Chadd, Xenion Pty Ltd.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <err.h>
+
+#include "eeprom.h"
+
+void
+load_eeprom_dump(const char *file, uint16_t *buf)
+{
+	unsigned int r[8];
+	FILE *fp;
+	char b[1024];
+	int i;
+
+	fp = fopen(file, "r");
+	if (!fp)
+		err(1, "fopen");
+
+	while (!feof(fp)) {
+		if (fgets(b, 1024, fp) == NULL)
+			break;
+		if (feof(fp))
+			break;
+		if (strlen(b) > 0)
+			b[strlen(b)-1] = '\0';
+		if (strlen(b) == 0)
+			break;
+		sscanf(b, "%x: %x %x %x %x %x %x %x %x\n",
+		    &i, &r[0], &r[1], &r[2], &r[3], &r[4],
+		    &r[5], &r[6], &r[7]);
+		buf[i++] = r[0];
+		buf[i++] = r[1];
+		buf[i++] = r[2];
+		buf[i++] = r[3];
+		buf[i++] = r[4];
+		buf[i++] = r[5];
+		buf[i++] = r[6];
+		buf[i++] = r[7];
+	}
+	fclose(fp);
+}

Added: head/tools/tools/ath/ath_ee_9287_print/eeprom.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/ath/ath_ee_9287_print/eeprom.h	Thu May 26 19:49:32 2011	(r222322)
@@ -0,0 +1,8 @@
+/* $FreeBSD$ */
+
+#ifndef	__EEPROM_H__
+#define	__EEPROM_H__
+
+extern void load_eeprom_dump(const char *file, uint16_t *buf);
+
+#endif

Added: head/tools/tools/ath/ath_ee_9287_print/main.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/ath/ath_ee_9287_print/main.c	Thu May 26 19:49:32 2011	(r222322)
@@ -0,0 +1,85 @@
+
+/*
+ * Copyright (c) 2010-2011 Adrian Chadd, Xenion Pty Ltd.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <err.h>
+
+#include "eeprom.h"
+#include "9287.h"
+
+void
+usage(char *argv[])
+{
+	printf("Usage: %s <eeprom dump file>\n", argv[0]);
+	printf("\n");
+	printf("  The eeprom dump file is a text hexdump of an EEPROM.\n");
+	printf("  The lines must be formatted as follows:\n");
+	printf("  0xAAAA: 0xDD 0xDD 0xDD 0xDD 0xDD 0xDD 0xDD 0xDD\n");
+	printf("  where each line must have exactly eight data bytes.\n");
+	exit(127);
+}
+
+int
+main(int argc, char *argv[])
+{
+	uint16_t *eep = NULL;
+	eep = calloc(4096, sizeof(int16_t));
+
+	if (argc < 2)
+		usage(argv);
+
+	load_eeprom_dump(argv[1], eep);
+
+	eeprom_9287_base_print(eep);
+	eeprom_9287_custdata_print(eep);
+	printf("\n2.4ghz:\n");
+	eeprom_9287_modal_print(eep);
+	printf("\n");
+
+	eeprom_9287_calfreqpiers_print(eep);
+	printf("\n");
+
+	eeprom_9287_print_targets(eep);
+	printf("\n");
+
+	eeprom_9287_ctl_print(eep);
+	printf("\n");
+
+	eeprom_9287_print_edges(eep);
+	printf("\n");
+
+	eeprom_9287_print_other(eep);
+	printf("\n");
+
+	free(eep);
+	exit(0);
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105261949.p4QJnWPU078396>