Skip to content

Commit

Permalink
adrv9009: Add ADRV9008_2 Rx obs components
Browse files Browse the repository at this point in the history
Add Rx pbserver components for ADRV90008-2 and a DMA transfer
example.

Signed-off-by: George Mois <[email protected]>
  • Loading branch information
danmois authored and amiclaus committed Feb 27, 2024
1 parent e518b90 commit 926a732
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
4 changes: 4 additions & 0 deletions projects/adrv9009/src/app/app_talise.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,11 @@ adiHalErr_t talise_setup(taliseDevice_t * const pd, taliseInit_t * const pi)
goto error_11;
}

#ifndef ADRV9008_2
talAction = TALISE_setRxTxEnable(pd, TAL_RX1RX2_EN, TAL_TX1TX2);
#else
talAction = TALISE_setRxTxEnable(pd, TAL_ORX1_EN, TAL_TX1TX2);
#endif
if (talAction != TALACT_NO_ACTION) {
/*** < User: decide what to do based on Talise recovery action returned > ***/
printf("error: TALISE_setRxTxEnable() failed\n");
Expand Down
51 changes: 47 additions & 4 deletions projects/adrv9009/src/app/headless.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ int main(void)
};
struct axi_adc *rx_adc;

struct axi_adc_init rx_os_adc_init = {
"rx_os_adc",
RX_OS_CORE_BASEADDR,
TALISE_NUM_CHANNELS / 2
};
struct axi_adc *rx_os_adc;

struct axi_dac_init tx_dac_init = {
"tx_dac",
TX_CORE_BASEADDR,
Expand All @@ -222,6 +229,13 @@ int main(void)
};
struct axi_dmac *rx_dmac;

struct axi_dmac_init rx_os_dmac_init = {
"rx_os_dmac",
RX_OS_DMA_BASEADDR,
IRQ_DISABLED
};
struct axi_dmac *rx_os_dmac;

struct axi_dmac_init tx_dmac_init = {
"tx_dmac",
TX_DMA_BASEADDR,
Expand Down Expand Up @@ -355,6 +369,13 @@ int main(void)
}

#endif

status = axi_adc_init(&rx_os_adc, &rx_os_adc_init);
if (status) {
printf("OBS axi_adc_init() failed with status %d\n", status);
goto error_3;
}

#ifndef ADRV9008_1
status = axi_dmac_init(&tx_dmac, &tx_dmac_init);
if (status) {
Expand All @@ -371,6 +392,12 @@ int main(void)
}
#endif

status = axi_dmac_init(&rx_os_dmac, &rx_os_dmac_init);
if (status) {
printf("OBS axi_dmac_init() rx init error: %d\n", status);
goto error_3;
}

#ifdef DMA_EXAMPLE
gpio_init_plddrbypass.extra = &hal_gpio_param;
#ifndef ALTERA_PLATFORM
Expand All @@ -384,7 +411,7 @@ int main(void)
printf("no_os_gpio_get() failed with status %d", status);
goto error_3;
}
no_os_gpio_direction_output(gpio_plddrbypass, 0);
no_os_gpio_direction_output(gpio_plddrbypass, 1);

#ifndef ADRV9008_1
axi_dac_load_custom_data(tx_dac, sine_lut_iq,
Expand Down Expand Up @@ -417,7 +444,6 @@ int main(void)
#endif

/* Transfer 16384 samples from ADC to MEM */
#ifndef ADRV9008_2
struct axi_dma_transfer transfer_rx = {
// Number of bytes to write/read
.size = 16384 * TALISE_NUM_CHANNELS *
Expand All @@ -431,16 +457,33 @@ int main(void)
// Address of data destination
.dest_addr = (uintptr_t)(DDR_MEM_BASEADDR + 0x800000)
};
axi_dmac_transfer_start(rx_dmac, &transfer_rx);
#ifndef ADRV9008_2
status = axi_dmac_transfer_start(rx_dmac, &transfer_rx);
if(status)
return status;
printf("Rx ");
status = axi_dmac_transfer_wait_completion(rx_dmac, 500);
uint8_t num_chans = rx_adc_init.num_channels;
#else
status = axi_dmac_transfer_start(rx_os_dmac, &transfer_rx);
if(status)
return status;
printf("Rx obs ");
status = axi_dmac_transfer_wait_completion(rx_os_dmac, 500);
uint8_t num_chans = rx_os_adc_init.num_channels;
#endif
if(status)
return status;
#ifndef ALTERA_PLATFORM
Xil_DCacheInvalidateRange(DDR_MEM_BASEADDR + 0x800000,
16384 * TALISE_NUM_CHANNELS *
NO_OS_DIV_ROUND_UP(talInit.jesd204Settings.framerA.Np, 8));
#endif
#endif
printf("DMA_EXAMPLE: address=%#lx samples=%lu channels=%u bits=%u\n",
transfer_rx.dest_addr, transfer_rx.size / NO_OS_DIV_ROUND_UP(
talInit.jesd204Settings.framerA.Np, 8),
num_chans,
8 * NO_OS_DIV_ROUND_UP(talInit.jesd204Settings.framerA.Np, 8));
#endif

#ifdef IIO_SUPPORT
Expand Down
1 change: 1 addition & 0 deletions projects/adrv9009/src/devices/adi_hal/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@
#else
#define RX_DMA_BASEADDR XPAR_AXI_ADRV9009_RX_DMA_BASEADDR
#define TX_DMA_BASEADDR XPAR_AXI_ADRV9009_TX_DMA_BASEADDR
#define RX_OS_DMA_BASEADDR XPAR_AXI_ADRV9009_RX_OS_DMA_BASEADDR
#endif

#define DDR_MEM_BASEADDR XPAR_DDR_MEM_BASEADDR
Expand Down

0 comments on commit 926a732

Please sign in to comment.