![]() |
Demo program for IgnInj 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 | IgnInjUsage () |
int | main (int argc, char *argv[]) |
Variables | |
uint | active_high =1 |
Active High for the IgnInj IP Core Channel. It takes values 0 or 1 and defaults to 1. | |
uint | enable =1 |
Enable for the IgnInj IP Core which is used to Activate/Deactivate the IP Core Channel. It takes values 0 or 1 and defaults to 1. | |
fpgawb_ipcore_igninj_configure_t | config |
fpgawb_ipcore_igninj_configure_t struct passed as argument to channel configure api call. Check fpgawb_lib.h or api call documentation for more information | |
uint | tdc_crank_angle =0 |
TDC Crank Angle for the IgnInj IP Core Channel. It takes values 0 to 720 in degrees and defaults to 0 degree. | |
uint | filter_count =0 |
Filter count for the IgnInj IP Core Channel. It takes positive integer values >=0 and defaults to 0. | |
uint | window_start_crank_angle =0 |
Window Start Crank Angle for the IgnInj IP Core Channel. It takes values 0 to 720 in degrees and defaults to 0 degree. | |
uint | window_stop_crank_angle =0 |
Window Stop Crank Angle for the IgnInj IP Core Channel. It takes values 0 to 720 in degrees and defaults to 0 degree. | |
int | channel =-1 |
Channel number for the IgnInj 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_igninj_info_t | info [8] |
Array of fpgawb_ipcore_igninj_info_t struct to read channel data for the IgnInj IP Core. Since FIFO depth is 32 words and four words (start CA, stop CA, Duration, Cycle) correspond to single IgnInj pulse, the total number of pulses for a single read would be 8 if FIFO is full (8*4=32), hence the size 8 for the array of struct. Check fpgawb_lib.h or api call documentation for more information on the struct members. | |
fpgawb_ipcore_igninj_status_info_t | status_info |
fpgawb_ipcore_igninj_status_info_t struct to read status information for the IgnInj IP Core channel. | |
int | xfer_mode = 0 |
Transfer mode for the IgnInj 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. | |
void IgnInjUsage | ( | ) |
Usage:
./fpgawb_ipcore_igninj [-a ActiveHigh] [-b BoardNumber] [-c channelNumber] [-C config_mode] [-e Enable] [-f FilterCount] [-m xfer_mode] [-s WindowStartCrankAngle] [-S WindowStopCrankAngle] [-t TDCCrankAngle]
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 255 | 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 |
-s Window Start Crank angle (0 degrees - 720 degrees) | 0 |
-S Window Stop Crank angle (0 degrees - 720 degrees) | 0 |
-t TDC Crank Angle (0 degrees - 720 degrees) | 0 |
Examples:
./fpgawb_ipcore_igninj
./fpgawb_ipcore_igninj -b0 -c0 -C1 -a1 -e1 > regualaroutput
./fpgawb_ipcore_igninj -b0 -a1 -C1 -e1 -m1 > msgdmaoutput
int main | ( | int | argc, |
char * | argv[] | ||
) |
Step 1: OPEN DEVICE
ccurPMFC_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
ccurPMFC_Get_Driver_Info(handle, &binfo)
This call returns useful driver information and saves in the ccurpmfc_driver_info_t structure for later use
Step 3: GET LIBRARY INFO
ccurPMFC_Get_Library_Info(handle, &linfo)
This call returns useful library information and saves in the ccurpmfc_library_info_t structure for later use
Step 4: GET IP INFO
fpgawb_IgnInj_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 IGNINJ
fpgawb_IgnInj_Activate_Ch(handle,chan,enable)
This call activates the IgnInj IP Core Channel. Set enable to 1 to activate the IgnInj IP Core Channel
Step 6: SET IGNINJ ACTIVE HIGH
fpgawb_IgnInj_Set_Ch_Active_High(handle,chan,active_high)
This call configures active high for the IgnInj IP Core Channel. Set active_high to 1
Step 7: CONFIGURE IGNINJ CHANNEL
fpgawb_IgnInj_Configure_Ch(handle,chan,&config)
Configures the fields specified in the struct fpgawb_ipcore_igninj_configure_t for the IgnInj IP Core Channel
Step 8: READ IGNINJ CHANNEL DATA
fpgawb_IgnInj_Read_Ch_Data(handle,chan, info,&status_info)
Returns the IgnInj IP Core Channel data in the info struct passed as third argument
Step 9: SEIZE MSGDMA
ccurPMFC_MsgDma_Seize(handle)
Seizes the MsgDma for data transfer
Step 10: 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 11: MSGDMA FIRE
fpgawb_ip_core_MsgDma_Fire(handle)
This call commences the MsgDma transfer
Step 12: READ MSGDMA DATA
fpgawb_IgnInj_Read_MsgDma_Data(handle, all_info,all_status_info)
Returns data for all the channels in the all_info struct passed as second argument
Step 13: RELEASE MSGDMA
ccurPMFC_MsgDma_Release(handle)
This call releases the seized MsgDma. Release the MsgDma once done with the transfer
Step 14: CLOSE DEVICE
ccurPMFC_Close(handle)
Closes the device with the handle