fix(rf_path): Port rad1o pin config
This commit is contained in:
@ -81,9 +81,12 @@ static struct gpio_t gpio_rf_ldo_enable = GPIO(2, 9);
|
||||
#endif
|
||||
|
||||
/* RF supply (VAA) control */
|
||||
#if (defined HACKRF_ONE || defined RAD1O)
|
||||
#ifdef HACKRF_ONE
|
||||
static struct gpio_t gpio_vaa_disable = GPIO(2, 9);
|
||||
#endif
|
||||
#ifdef RAD1O
|
||||
static struct gpio_t gpio_vaa_enable = GPIO(2, 9);
|
||||
#endif
|
||||
|
||||
static struct gpio_t gpio_w25q80bv_hold = GPIO(1, 14);
|
||||
static struct gpio_t gpio_w25q80bv_wp = GPIO(1, 15);
|
||||
@ -105,9 +108,18 @@ static struct gpio_t gpio_amp_bypass = GPIO(0, 14);
|
||||
static struct gpio_t gpio_rx_amp = GPIO(1, 11);
|
||||
static struct gpio_t gpio_no_rx_amp_pwr = GPIO(1, 12);
|
||||
#endif
|
||||
|
||||
// XXX
|
||||
#ifdef RAD1O
|
||||
static struct gpio_t gpio_tx_rx_n = GPIO(0, 11);
|
||||
static struct gpio_t gpio_tx_rx = GPIO(0, 14);
|
||||
static struct gpio_t gpio_by_mix = GPIO(1, 12);
|
||||
static struct gpio_t gpio_by_mix_n = GPIO(2, 10);
|
||||
static struct gpio_t gpio_by_amp = GPIO(1, 0);
|
||||
static struct gpio_t gpio_by_amp_n = GPIO(5, 5);
|
||||
static struct gpio_t gpio_mixer_en = GPIO(5, 16);
|
||||
static struct gpio_t gpio_low_high_filt = GPIO(2, 11);
|
||||
static struct gpio_t gpio_low_high_filt_n = GPIO(2, 12);
|
||||
static struct gpio_t gpio_tx_amp = GPIO(2, 15);
|
||||
static struct gpio_t gpio_rx_lna = GPIO(5, 15);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
@ -276,6 +288,17 @@ rf_path_t rf_path = {
|
||||
.gpio_no_rx_amp_pwr = &gpio_no_rx_amp_pwr,
|
||||
#endif
|
||||
#ifdef RAD1O
|
||||
.gpio_tx_rx_n = &gpio_tx_rx_n,
|
||||
.gpio_tx_rx = &gpio_tx_rx,
|
||||
.gpio_by_mix = &gpio_by_mix,
|
||||
.gpio_by_mix_n = &gpio_by_mix_n,
|
||||
.gpio_by_amp = &gpio_by_amp,
|
||||
.gpio_by_amp_n = &gpio_by_amp_n,
|
||||
.gpio_mixer_en = &gpio_mixer_en,
|
||||
.gpio_low_high_filt = &gpio_low_high_filt,
|
||||
.gpio_low_high_filt_n = &gpio_low_high_filt_n,
|
||||
.gpio_tx_amp = &gpio_tx_amp,
|
||||
.gpio_rx_lna = &gpio_rx_lna,
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -851,10 +874,13 @@ void pin_setup(void) {
|
||||
gpio_output(&gpio_led[0]);
|
||||
gpio_output(&gpio_led[1]);
|
||||
gpio_output(&gpio_led[2]);
|
||||
#ifdef RAD1O
|
||||
gpio_output(&gpio_led[3]);
|
||||
#endif
|
||||
|
||||
gpio_output(&gpio_1v8_enable);
|
||||
|
||||
#if (defined HACKRF_ONE || defined RAD1O)
|
||||
#ifdef HACKRF_ONE
|
||||
/* Configure RF power supply (VAA) switch control signal as output */
|
||||
gpio_output(&gpio_vaa_disable);
|
||||
|
||||
@ -863,7 +889,11 @@ void pin_setup(void) {
|
||||
#endif
|
||||
|
||||
#ifdef RAD1O
|
||||
gpio_output(&gpio_led[4]);
|
||||
/* Configure RF power supply (VAA) switch control signal as output */
|
||||
gpio_output(&gpio_vaa_enable);
|
||||
|
||||
/* Safe state: start with VAA turned off: */
|
||||
disable_rf_power();
|
||||
#endif
|
||||
|
||||
/* enable input on SCL and SDA pins */
|
||||
@ -901,11 +931,11 @@ void disable_rf_power(void) {
|
||||
|
||||
#ifdef RAD1O
|
||||
void enable_rf_power(void) {
|
||||
gpio_set(&gpio_vaa_disable);
|
||||
gpio_set(&gpio_vaa_enable);
|
||||
}
|
||||
|
||||
void disable_rf_power(void) {
|
||||
gpio_clear(&gpio_vaa_disable);
|
||||
gpio_clear(&gpio_vaa_enable);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -259,11 +259,7 @@ extern "C"
|
||||
|
||||
#define SCU_PINMUX_GP_CLKIN (P4_7)
|
||||
|
||||
#ifdef RAD1O
|
||||
#define PIN_LED4 (BIT26) /* GPIO5[26] on PB_6 */
|
||||
#define PORT_LED4 (GPIO5) /* PORT for LED4 */
|
||||
#endif
|
||||
|
||||
#if 0 //XXX
|
||||
#ifdef RAD1O
|
||||
#define PIN_XCVR_RXHP (BIT1) /* GPIO4[1] on P8_1 */
|
||||
#define PORT_XCVR_RXHP (GPIO4)
|
||||
@ -283,46 +279,17 @@ extern "C"
|
||||
#define PORT_VCO_LE (GPIO2)
|
||||
#define PIN_VCO_MUX (BIT25) /* GPIO5[25] on PB_5 */
|
||||
#define PORT_VCO_MUX (GPIO5)
|
||||
#define PIN_MIXER_EN (BIT16) /* GPIO5[16] on P6_8 */
|
||||
#define PORT_MIXER_EN (GPIO5)
|
||||
#define PIN_SYNT_RFOUT_EN (BIT5) /* GPIO3[5] on P6_9 */
|
||||
#define PORT_SYNT_RFOUT_EN (GPIO3)
|
||||
#endif
|
||||
|
||||
#ifdef RAD1O
|
||||
#define PIN_VAA_ENABLE (BIT9) /* GPIO2[9] on P5_0 */
|
||||
#define PORT_VAA_ENABLE (GPIO2) /* PORT for VAA_ENABLE */
|
||||
#endif
|
||||
|
||||
#ifdef RAD1O
|
||||
#define PIN_BY_AMP (GPIOPIN0) /* GPIO1[0] on P1_7 */
|
||||
#define PORT_BY_AMP (GPIO1)
|
||||
#define PIN_BY_AMP_N (GPIOPIN5) /* GPIO5[5] on P2_5 */
|
||||
#define PORT_BY_AMP_N (GPIO5)
|
||||
#define PIN_TX_RX (GPIOPIN14) /* GPIO0[14] on P2_10 */
|
||||
#define PORT_TX_RX (GPIO0)
|
||||
#define PIN_TX_RX_N (GPIOPIN11) /* GPIO1[11] on P2_11 */
|
||||
#define PORT_TX_RX_N (GPIO1)
|
||||
#define PIN_BY_MIX (GPIOPIN12) /* GPIO1[12] on P2_12 */
|
||||
#define PORT_BY_MIX (GPIO1)
|
||||
#define PIN_BY_MIX_N (GPIOPIN10) /* GPIO2[10] on P5_1 */
|
||||
#define PORT_BY_MIX_N (GPIO2)
|
||||
#define PIN_LOW_HIGH_FILT (GPIOPIN11) /* GPIO2[11] on P5_2 */
|
||||
#define PORT_LOW_HIGH_FILT (GPIO2)
|
||||
#define PIN_LOW_HIGH_FILT_N (GPIOPIN12) /* GPIO2[12] on P5_3 */
|
||||
#define PORT_LOW_HIGH_FILT_N (GPIO2)
|
||||
#define PIN_TX_AMP (GPIOPIN15) /* GPIO2[15] on P5_6 */
|
||||
#define PORT_TX_AMP (GPIO2)
|
||||
#define PIN_RX_LNA (GPIOPIN15) /* GPIO5[15] on P6_7 */
|
||||
#define PORT_RX_LNA (GPIO5)
|
||||
#endif
|
||||
|
||||
#if (defined HACKRF_ONE || defined RAD1O)
|
||||
#define PIN_CPLD_TMS (GPIOPIN4)
|
||||
#define PORT_CPLD_TMS (GPIO3)
|
||||
#define PIN_CPLD_TDI (GPIOPIN1)
|
||||
#define PORT_CPLD_TDI (GPIO3)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
TRANSCEIVER_MODE_OFF = 0,
|
||||
|
@ -87,78 +87,6 @@ uint8_t switchctrl = SWITCHCTRL_SAFE;
|
||||
*/
|
||||
#define SWITCHCTRL_ANT_PWR (1 << 6) /* turn on antenna port power */
|
||||
|
||||
#ifdef RAD1O
|
||||
static void switchctrl_set_rad1o(rf_path_t* const rf_path, uint8_t ctrl) {
|
||||
#if 0 //XXX
|
||||
if (ctrl & SWITCHCTRL_TX) {
|
||||
gpio_set(PORT_TX_RX_N, PIN_TX_RX_N);
|
||||
gpio_clear(PORT_TX_RX, PIN_TX_RX);
|
||||
} else {
|
||||
gpio_clear(PORT_TX_RX_N, PIN_TX_RX_N);
|
||||
gpio_set(PORT_TX_RX, PIN_TX_RX);
|
||||
}
|
||||
|
||||
if (ctrl & SWITCHCTRL_MIX_BYPASS) {
|
||||
gpio_clear(PORT_BY_MIX, PIN_BY_MIX);
|
||||
gpio_set(PORT_BY_MIX_N, PIN_BY_MIX_N);
|
||||
gpio_clear(PORT_MIXER_EN, PIN_MIXER_EN);
|
||||
} else {
|
||||
gpio_set(PORT_BY_MIX, PIN_BY_MIX);
|
||||
gpio_clear(PORT_BY_MIX_N, PIN_BY_MIX_N);
|
||||
gpio_set(PORT_MIXER_EN, PIN_MIXER_EN);
|
||||
}
|
||||
|
||||
if (ctrl & SWITCHCTRL_HP) {
|
||||
gpio_set(PORT_LOW_HIGH_FILT, PIN_LOW_HIGH_FILT);
|
||||
gpio_clear(PORT_LOW_HIGH_FILT_N, PIN_LOW_HIGH_FILT_N);
|
||||
} else {
|
||||
gpio_clear(PORT_LOW_HIGH_FILT, PIN_LOW_HIGH_FILT);
|
||||
gpio_set(PORT_LOW_HIGH_FILT_N, PIN_LOW_HIGH_FILT_N);
|
||||
}
|
||||
|
||||
if (ctrl & SWITCHCTRL_AMP_BYPASS) {
|
||||
gpio_clear(PORT_BY_AMP, PIN_BY_AMP);
|
||||
gpio_set(PORT_BY_AMP_N, PIN_BY_AMP_N);
|
||||
|
||||
gpio_clear(PORT_TX_AMP, PIN_TX_AMP);
|
||||
gpio_clear(PORT_RX_LNA, PIN_RX_LNA);
|
||||
|
||||
} else if (ctrl & SWITCHCTRL_TX) {
|
||||
gpio_set(PORT_BY_AMP, PIN_BY_AMP);
|
||||
gpio_clear(PORT_BY_AMP_N, PIN_BY_AMP_N);
|
||||
|
||||
gpio_set(PORT_TX_AMP, PIN_TX_AMP);
|
||||
gpio_clear(PORT_RX_LNA, PIN_RX_LNA);
|
||||
|
||||
} else {
|
||||
gpio_set(PORT_BY_AMP, PIN_BY_AMP);
|
||||
gpio_clear(PORT_BY_AMP_N, PIN_BY_AMP_N);
|
||||
|
||||
gpio_clear(PORT_TX_AMP, PIN_TX_AMP);
|
||||
gpio_set(PORT_RX_LNA, PIN_RX_LNA);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* These normally shouldn't be set post-Jawbreaker, but they can be
|
||||
* used to explicitly turn off power to the amplifiers while AMP_BYPASS
|
||||
* is unset:
|
||||
*/
|
||||
if (ctrl & SWITCHCTRL_NO_TX_AMP_PWR) {
|
||||
gpio_clear(PORT_TX_AMP, PIN_TX_AMP);
|
||||
}
|
||||
if (ctrl & SWITCHCTRL_NO_RX_AMP_PWR) {
|
||||
gpio_clear(PORT_RX_LNA, PIN_RX_LNA);
|
||||
}
|
||||
|
||||
if (ctrl & SWITCHCTRL_ANT_PWR) {
|
||||
// TODO
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HACKRF_ONE
|
||||
static void switchctrl_set_hackrf_one(rf_path_t* const rf_path, uint8_t ctrl) {
|
||||
if (ctrl & SWITCHCTRL_TX) {
|
||||
@ -232,6 +160,74 @@ static void switchctrl_set_hackrf_one(rf_path_t* const rf_path, uint8_t ctrl) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RAD1O
|
||||
static void switchctrl_set_rad1o(rf_path_t* const rf_path, uint8_t ctrl) {
|
||||
if (ctrl & SWITCHCTRL_TX) {
|
||||
gpio_set(rf_path->gpio_tx_rx_n);
|
||||
gpio_clear(rf_path->gpio_tx_rx);
|
||||
} else {
|
||||
gpio_clear(rf_path->gpio_tx_rx_n);
|
||||
gpio_set(rf_path->gpio_tx_rx);
|
||||
}
|
||||
|
||||
if (ctrl & SWITCHCTRL_MIX_BYPASS) {
|
||||
gpio_clear(rf_path->gpio_by_mix);
|
||||
gpio_set(rf_path->gpio_by_mix_n);
|
||||
gpio_clear(rf_path->gpio_mixer_en);
|
||||
} else {
|
||||
gpio_set(rf_path->gpio_by_mix);
|
||||
gpio_clear(rf_path->gpio_by_mix_n);
|
||||
gpio_set(rf_path->gpio_mixer_en);
|
||||
}
|
||||
|
||||
if (ctrl & SWITCHCTRL_HP) {
|
||||
gpio_set(rf_path->gpio_low_high_filt);
|
||||
gpio_clear(rf_path->gpio_low_high_filt_n);
|
||||
} else {
|
||||
gpio_clear(rf_path->gpio_low_high_filt);
|
||||
gpio_set(rf_path->gpio_low_high_filt_n);
|
||||
}
|
||||
|
||||
if (ctrl & SWITCHCTRL_AMP_BYPASS) {
|
||||
gpio_clear(rf_path->gpio_by_amp);
|
||||
gpio_set(rf_path->gpio_by_amp_n);
|
||||
|
||||
gpio_clear(rf_path->gpio_tx_amp);
|
||||
gpio_clear(rf_path->gpio_rx_lna);
|
||||
|
||||
} else if (ctrl & SWITCHCTRL_TX) {
|
||||
gpio_set(rf_path->gpio_by_amp);
|
||||
gpio_clear(rf_path->gpio_by_amp_n);
|
||||
|
||||
gpio_set(rf_path->gpio_tx_amp);
|
||||
gpio_clear(rf_path->gpio_rx_lna);
|
||||
|
||||
} else {
|
||||
gpio_set(rf_path->gpio_by_amp);
|
||||
gpio_clear(rf_path->gpio_by_amp_n);
|
||||
|
||||
gpio_clear(rf_path->gpio_tx_amp);
|
||||
gpio_set(rf_path->gpio_rx_lna);
|
||||
}
|
||||
|
||||
/*
|
||||
* These normally shouldn't be set post-Jawbreaker, but they can be
|
||||
* used to explicitly turn off power to the amplifiers while AMP_BYPASS
|
||||
* is unset:
|
||||
*/
|
||||
if (ctrl & SWITCHCTRL_NO_TX_AMP_PWR) {
|
||||
gpio_clear(rf_path->gpio_tx_amp);
|
||||
}
|
||||
if (ctrl & SWITCHCTRL_NO_RX_AMP_PWR) {
|
||||
gpio_clear(rf_path->gpio_rx_lna);
|
||||
}
|
||||
|
||||
if (ctrl & SWITCHCTRL_ANT_PWR) {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void switchctrl_set(rf_path_t* const rf_path, const uint8_t gpo) {
|
||||
#ifdef JAWBREAKER
|
||||
mixer_set_gpo(&mixer, gpo);
|
||||
@ -278,16 +274,9 @@ void rf_path_pin_setup(rf_path_t* const rf_path) {
|
||||
gpio_output(rf_path->gpio_tx);
|
||||
gpio_output(rf_path->gpio_mix_bypass);
|
||||
gpio_output(rf_path->gpio_rx);
|
||||
|
||||
/*
|
||||
* Safe (initial) switch settings turn off both amplifiers and antenna port
|
||||
* power and enable both amp bypass and mixer bypass.
|
||||
*/
|
||||
switchctrl_set(rf_path, SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_MIX_BYPASS);
|
||||
#endif
|
||||
|
||||
#ifdef RAD1O
|
||||
#if 0 //XXX
|
||||
/* Configure RF switch control signals */
|
||||
scu_pinmux(SCU_BY_AMP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
|
||||
scu_pinmux(SCU_BY_AMP_N, SCU_GPIO_FAST | SCU_CONF_FUNCTION4);
|
||||
@ -305,25 +294,24 @@ void rf_path_pin_setup(rf_path_t* const rf_path) {
|
||||
scu_pinmux(SCU_VAA_ENABLE, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
|
||||
|
||||
/* Configure RF switch control signals as outputs */
|
||||
GPIO0_DIR |= PIN_TX_RX;
|
||||
GPIO1_DIR |= PIN_BY_AMP | PIN_TX_RX_N | PIN_BY_MIX;
|
||||
GPIO2_DIR |= PIN_BY_MIX_N | PIN_LOW_HIGH_FILT | PIN_LOW_HIGH_FILT_N | PIN_TX_AMP;
|
||||
GPIO5_DIR |= PIN_BY_AMP_N | PIN_RX_LNA;
|
||||
GPIO_DIR(PORT_MIXER_EN) |= PIN_MIXER_EN;
|
||||
gpio_output(rf_path->gpio_tx_rx_n);
|
||||
gpio_output(rf_path->gpio_tx_rx);
|
||||
gpio_output(rf_path->gpio_by_mix);
|
||||
gpio_output(rf_path->gpio_by_mix_n);
|
||||
gpio_output(rf_path->gpio_by_amp);
|
||||
gpio_output(rf_path->gpio_by_amp_n);
|
||||
gpio_output(rf_path->gpio_mixer_en);
|
||||
gpio_output(rf_path->gpio_low_high_filt);
|
||||
gpio_output(rf_path->gpio_low_high_filt_n);
|
||||
gpio_output(rf_path->gpio_tx_amp);
|
||||
gpio_output(rf_path->gpio_rx_lna);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Safe (initial) switch settings turn off both amplifiers and antenna port
|
||||
* power and enable both amp bypass and mixer bypass.
|
||||
*/
|
||||
switchctrl_set(SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_MIX_BYPASS);
|
||||
|
||||
/* Configure RF power supply (VAA) switch control signal as output */
|
||||
GPIO_DIR(PORT_VAA_ENABLE) |= PIN_VAA_ENABLE;
|
||||
|
||||
/* Safe state: start with VAA turned off: */
|
||||
disable_rf_power();
|
||||
#endif
|
||||
#endif
|
||||
switchctrl_set(rf_path, SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_MIX_BYPASS);
|
||||
}
|
||||
|
||||
void rf_path_init(rf_path_t* const rf_path) {
|
||||
@ -335,7 +323,6 @@ void rf_path_init(rf_path_t* const rf_path) {
|
||||
max2837_setup(&max2837);
|
||||
max2837_start(&max2837);
|
||||
|
||||
//XXX
|
||||
mixer_setup(&mixer);
|
||||
switchctrl_set(rf_path, switchctrl);
|
||||
}
|
||||
|
@ -56,8 +56,18 @@ typedef struct rf_path_t {
|
||||
gpio_t gpio_rx_amp;
|
||||
gpio_t gpio_no_rx_amp_pwr;
|
||||
#endif
|
||||
/// XXX
|
||||
#ifdef RAD1O
|
||||
gpio_t gpio_tx_rx_n;
|
||||
gpio_t gpio_tx_rx;
|
||||
gpio_t gpio_by_mix;
|
||||
gpio_t gpio_by_mix_n;
|
||||
gpio_t gpio_by_amp;
|
||||
gpio_t gpio_by_amp_n;
|
||||
gpio_t gpio_mixer_en;
|
||||
gpio_t gpio_low_high_filt;
|
||||
gpio_t gpio_low_high_filt_n;
|
||||
gpio_t gpio_tx_amp;
|
||||
gpio_t gpio_rx_lna;
|
||||
#endif
|
||||
} rf_path_t;
|
||||
|
||||
|
Reference in New Issue
Block a user