Logo
NGFC_HPFP_Demo

Demo program for High Pressure Fuel Pump 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 HPFPUsage ()
 
int main (int argc, char *argv[])
 

Variables

uint active_high =1
 Active High for the HPFP IP Core Channel. It takes values 0 or 1 and defaults to 1.
 
uint enable =1
 Enable for the HPFP IP Core which is used to Activate/Deactivate the IP Core Channel. It takes values 0 or 1 and defaults to 1.
 
fpgawb_ipcore_hpfp_configure_t config
 fpgawb_ipcore_hpfp_configure_t struct passed as argument to configure channel api call. It has fields to specify active_high and filter_count. Check fpgawb_lib.h or api call documentation for more information
 
uint filter_count =0
 Filter count for the HPFP IP Core Channel. Filter count to filter out a noisy digital input signal. The filter count is a 24 bit interger with the count reprensting the clock cycles. After a digital input rising or falling edge, the input must remain high/low for greater than the “Filter Count” clock cycles to be counted and thus stored in the FIFO. It takes positive integer values >=0 and < 16777216 and defaults to 0.
 
int channel =-1
 Channel number for the HPFP IP Core Channel. It takes values 0 to (number of IP Core channels-1) and defaults to -1 (test program executed for all channels)
 
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
 
fpgawb_ipcore_hpfp_info_t info
 Array of fpgawb_ipcore_hpfp_info_t struct to read channel data for the HPFP IP Core. Since FIFO depth is 16 words, fpgawb_ipcore_hpfp_info_t has fields angle and edge which are of size 16. Check fpgawb_lib.h or api call documentation for more information on the struct members.
 
int xfer_mode = 0
 Transfer mode for the HPFP IP Core which specifies regular read or MsgDma read. It takes values 0 (regular) or 1 (MsgDma) and defaults to 0.
 
int config_mode =0
 Configuration mode for the test program which indicates to run the program in configure or read mode. It takes values 0-Configuration Mode/1-Read Mode and defaults to 0.
 

Function Documentation

void HPFPUsage ( )

Usage:
./fpgawb_ipcore_hpfp [-a ActiveHigh] [-b BoardNumber] [-c channelNumber] [-C config_mode] [-e Enable] [-f FilterCount] [-m xfer_mode]

Options Default value
-a Active High (0/1) 1
-b Board Number or Device Number 0
-c channel Number (0- (NumChans-1)) -1 (all channels)
-C Config Mode (0/1) 0-Configuration Mode, 1-Read Mode 0
-e Enable (0/1) 1
-f Filter Count - O to 16777215 (Clock cycles) 0
-m Transfer mode for reading the FIFO data (0 is for Programmed I/O mode and 1 is for Modular Scatter-Gather DMA mode) 0


Examples:
./fpgawb_ipcore_hpfp
./fpgawb_ipcore_hpfp -b0 -c0 -C1 -a1 -e1 > regualaroutput
./fpgawb_ipcore_hpfp -b0 -a1 -C1 -e1 -m1 > msgdmaoutput

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_HPFP_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 HPFP
fpgawb_HPFP_Activate_Ch(handle,chan,enable)
This call activates the High Pressure Fuel Pump IP Core Channel. Set enable to 1 to activate the High Pressure Fuel Pump IP Core Channel

Step 6: CONFIGURE HPFP CHANNEL
fpgawb_HPFP_Configure_Ch(handle,chan,&config)
Configures active high and filter count using fpgawb_ipcore_hpfp_configure_t struct for the High Pressure Fuel Pump IP Core Channel

Step 7: READ HPFP CHANNEL DATA
fpgawb_HPFP_Read_Ch_Data(handle,chan, &info)
Returns the High Pressure Fuel Pump IP Core Channel's FIFO data in the info struct passed as third argument

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

Step 9: MSGDMA INITIALIZE
IPCODE_SELECT_INIT(IpCodeSelect)
IPCODE_SELECT_SET(IpCodeSelect,CCRTNGFC_IPCODE_HIGH_PRESSURE_FUEL_PUMP)
fpgawb_IpCore_MsgDma_Initialize_Plus(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_ip_core_MsgDma_Fire(handle)
This call commences the MsgDma transfer

Step 11: READ MSGDMA DATA
fpgawb_HPFP_Read_MsgDma_Data(handle, all_info)
Returns data for all the channels in the all_info struct passed as second argument

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

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