Logo
NGFC_WaveGenRx_Demo

Demo program for WaveGen Rx IP Core.

The Usage() function shows how to execute the test program, options available and default values set for different configuration variables. The Variables section specifies variables used in the test program, what they specify, the values it holds and can take. The main() function specifies sequence of api calls executed and tested.

Functions

void WaveGenRxUsage ()
 
int main (int argc, char *argv[])
 
void Display_channels ()
 

Variables

double starting_angle =0
 Starting angle of the carrier of the WaveGen Rx IP Core Channel. It takes values -360 to 360 in degrees and defaults to 0 degree.
 
uint enable =1
 enable mode bit for the WaveGen Rx IP Core Channel. Toggling the enable signal will cause the registers to revert to default power-on states. It takes values 0 or 1 and defaults to 1
 
uint activate =0
 output enable for the WaveGen Rx IP Core Channel. Enable this after configuring the registers associated with api calls starting with C. It takes values 0 or 1 and defaults to 0
 
double frequency_tx = 10000
 Frequency of the carrier input for the WaveGen Rx IP Core in Hertz. It defaults to 10000 Hz.
 
uint negate_input =0
 negate_input takes value 0 or 1, the I/Q output will be negated when this is set to 1, the phase is rotated by 180 degrees.
 
uint excitation_mode =0
 excitation_mode takes value 0 or 1, when set to 0 the carrier is internally generated and when set to 1 it is external input - sin and cos.
 
uint filter_count =127
 filter_count is the filter count used in the debouncing circuit. It takes value 0 to 127.
 
uint fifo_depth =127
 fifo_depth is the depth of the FIFO and takes value 0 to 127.
 
uint dead_limit =1000000
 dead_limit specifies the number of clock cycles after a high or a low whereby the output will assume dead low or dead high. It is calculated by multiplying time out in seconds by 100MHz.
 
fpgawb_ipcore_t ip_core
 fpgawb_ipcore_t struct which stores useful information about the IP Core after executing get IP Info api call. Check fpgawb_lib.h or api call documentation for more information
 
int channel =-1
 Channel number for the WaveGen Rx IP Core Channel. It takes values 0 to (number of IP Core channels-1) and defaults to -1 (test program executed for all channels)
 
uint config_mode =0
 Configuration mode for the test program. Indicates to run the program in static mode or dynamic mode. It takes values 0-Configuration/1-Read Freq/Amplitude/Phase on the fly. It defaults to 0.
 

Function Documentation

void Display_channels ( )

Step 8: SEIZE MSGDMA
ccrtNGFC_MsgDma_Seize(handle)
Seizes the MsgDma for data transfer

Step 9: MSGDMA INITIALIZE
fpgawb_IpCore_MsgDma_Initialize(handle,&IpCodeSelect)
This call initializes Modular Scatter-Gather DMA for the selected IP Cores specified using the _fpgawb_ipcode_select_t struct. The api call calculates and allocates physical memory for the DMA transfer and configures the DMA Descriptors

Step 10: MSGDMA FIRE
fpgawb_IpCore_MsgDma_Fire(handle)
This call commences the MsgDma transfer

Step 11: READ CHANNEL DATA
fpgawb_Wavegen_Rx_Get_Ch_Data(handle,channel,info)
This api calls reads information such as frequency, phase and amplitude in the info struct

Step 12: RELEASE MSGDMA
ccrtNGFC_MsgDma_Release(handle)
This call releases the seized MsgDma. Release the MsgDma once done with the transfer

int main ( int  argc,
char *  argv[] 
)

Step 1: OPEN DEVICE
ccrtNGFC_Open(&handle,board_no,oflags)
Before using any API calls, the user needs to open the device and get a handle. This handle is then used as the first argument in most of the following APIs.

Step 2: GET DRIVER INFO
ccrtNGFC_Get_Driver_Info(handle, &binfo)
This call returns useful driver information and saves in the ccrtngfc_driver_info_t structure for later use.

Step 3: GET LIBRARY INFO
ccrtNGFC_Get_Library_Info(handle, &linfo)
This call returns useful library information and saves in the ccrtngfc_library_info_t structure for later use.

Step 4: GET IP INFO
fpgawb_Wavegen_Rx_Get_Ip_Info(handle, &ip_core)
This call returns useful IP Core information and saves in the fpgawb_ipcore_t structure for later use.

Step 5: ACTIVATE WAVEGEN RX CHANNEL
fpgawb_Wavegen_Rx_Activate_Ch(handle,chan,enable,activate)
This call activates the WaveGen Rx IP Core Channel. Note to set activate to 0 because we will be using the Config api calls which requires activate be 0. The default for activate is 0 in this test program. It is set to 1 at the end. Please be careful to give in the value as 0 when running the test program.

Step 6: CONFIGURE/SETUP WAVEGEN RX CHANNEL
C_fpgawb_Wavegen_Rx_Configure_Ch(handle,chan,&config)
This call configures/setup the WaveGen Rx with the initial parameters such as negate input signal, excitation mode, filter count, fifo depth, dead limit and start angle.

Step 7: ACTIVATE WAVEGEN RX CHANNEL
fpgawb_Wavegen_Rx_Activate_Ch(handle,chan,1,1)
This call activates the WaveGen Rx channel for Running after the configuration phase. Note that you put the activate to 0 before configuration so make it 1 now.

Step 13: CLOSE DEVICE
ccrtNGFC_Close(handle)
Closes the device with the handle.

void WaveGenRxUsage ( )

Usage:
./fpgawb_ipcore_wavegen_rx [-A Activate] [-b BoardNumber] [-c channelNumber] [-C config_mode] [-e Enable] [-E ExcitationMode] [-d FifoDepth] [-D dead_limit] [-f filter_count] [-F frequency] [-n NegateInput] [-s StartAngle]

Options Default value
-A Activate (0/1) 0
-b Board Number 0
-c channel Number (0-(Numchans-1) -1 (all channels)
-C Config Mode (0-Configuration/1-No Configuration- change Phase Increment) 0
-d fifo_depth (0 to 127) 127
-D Dead Limit (timeout in seconds * ClockFreq(100Mhz)) 1000000
-e Enable (0/1) 1
-E Excitation Mode (0/1) 0
-f filter_count (0 to 127) 127
-F Frequency of excitation signal(carrier) in Hz 10000
-n Negate Input signal (0 - no negation/1 - shifts by 180) 0
-s Starting Angle (-360 degrees - 360 degrees) 0


Examples:
SETUP: ./fpgawb_ipcore_wavegen_rx
RUNTIME:./fpgawb_ipcore_wavegen_rx -C1 -F10000