;
            if abs(trueY - y0) > .5
                y0 = y0+sign(dy);
                len = len+sqrt(2);
            else
                len = len + 1;
            end
        end
    else
        % part de (x0,y0) en incrementant y0
        trueX = x0;
        dy = sign(dy);
        while img(y0, x0)
            y0 = y0 + dy;
            trueX = trueX + dx;
            if abs(trueX - x0) > .5
                x0 = x0+sign(dx);
                len = len+sqrt(2);
            else
                len = len + 1;
            end
        end
    end

    ori(i) = len;
end


/*
 * Copyright (c) 2010-2011 Atheros Communications Inc.
 *
 * 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 <linux/export.h>
#include "hw.h"
#include "ar9003_phy.h"
#include "ar9003_eeprom.h"

#define AR9300_OFDM_RATES	8
#define AR9300_HT_SS_RATES	8
#define AR9300_HT_DS_RATES	8
#define AR9300_HT_TS_RATES	8

#define AR9300_11NA_OFDM_SHIFT		0
#define AR9300_11NA_HT_SS_SHIFT		8
#define AR9300_11NA_HT_DS_SHIFT		16
#define AR9300_11NA_HT_TS_SHIFT		24

#define AR9300_11NG_OFDM_SHIFT		4
#define AR9300_11NG_HT_SS_SHIFT		12
#define AR9300_11NG_HT_DS_SHIFT		20
#define AR9300_11NG_HT_TS_SHIFT		28

static const int firstep_table[] =
/* level:  0   1   2   3   4   5   6   7   8  */
	{ -4, -2,  0,  2,  4,  6,  8, 10, 12 }; /* lvl 0-8, default 2 */

static const int cycpwrThr1_t