3.2 Initialization

To use a Ndigo6G-12 board, it first needs to be initialized. This is done by calling ndigo6g12_init(). The initialization parameters necessary for ndigo6g12_init() are provided in the ndigo6g12_init_parameters struct.

The general procedure for initialization is as follows:

  1. Load a default set of initialization parameters using ndigo6g12_get_default_init_parameters.

  2. If necessary, adjust default parameters to your specific needs.

  3. Initialize the Ndigo6G-12 board using ndigo6g12_init().

  4. Check that the initialization was successful. If so, the return value of ndigo6g12_init() is CRONO_OK.

Information on the current device will be stored as type ndigo6g12_device.

ndigo6g12_get_default_init_parameters(init)

Macro that calls ndigo6g12_get_default_init_parameters_version with the correct API version.

int ndigo6g12_get_default_init_parameters_version(ndigo6g12_init_parameters *init, int client_api_version)

Sets up the standard parameters.

Gets a set of default parameters for ndigo6g12_init(). This must always be used to initialize the ndigo6g12_init_parameters structure.

For convinience, the macro ndigo6g12_get_default_init_parameters is provided, which automatically sets the correct client_api_version.

Default values:

Parameters:
  • init[in] Pointer to a structure in which to store the initialization values.

  • client_api_version[in] NDIGO6G12_API_VERSION

Returns:

See Function return values.

int ndigo6g12_init(ndigo6g12_device *device, ndigo6g12_init_parameters *params, const char **error_message)

Open and initialize an Ndigo6G-12 board.

Which Ndigo6G-12 board will be initialized is determined by ndigo6g12_init_parameters::card_index.

Parameters:
  • device[out] Pointer to the device struct.

  • params[in] Pointer to the structure that contains the initialization parameters.

  • error_message[out] Location in which to store the error message as plain text.

Returns:

See Function return values.

int ndigo6g12_close(ndigo6g12_device *device)

Finalize the driver for this device.

Parameters:

device[in] Pointer to the device that should be finalized.

Returns:

See Function return values.

struct ndigo6g12_device

Contains information of the Ndigo6G-12 device in use.

Public Members

bool is_valid
void *ndigo6g12
struct ndigo6g12_init_parameters

Struct for the initialization of the Ndigo6G-12.

This structure MUST be completely initialized.

Public Members

int version

The version number.

It is increased when the definition of the structure is changed. The increment can be larger than 1 to match driver version numbers or similar. Set to 0 for all versions up to first release.

Must be set to NDIGO6G12_API_VERSION.

int card_index

The index in the list of Ndigo6G-12 boards that should be initialized.

There might be multiple boards installed in the system that are handled by this driver as reported by ndigo6g12_count_devices(). This index selects one of them. Boards are enumerated depending on the PCIe slot. The lower the bus number and the lower the slot number the lower the card index.

int board_id

The global index in the list of all cronologic devices.

This 8-bit number is filled into each packet created by the board and is useful if data-streams of multiple boards will be merged. If only Ndigo6G-12 boards are used, this number can be set to card_index. If boards of different types that use a compatible data format are used in a system, each board should get a unique ID.

int64_t buffer_size[8]

The minimum size of the DMA buffer.

If set to 0, the default size of 64 MiBytes is used. For the Ndigo6G-12 only the first entry is used.

int dma_read_delay

The update delay of the writing pointer after a packet has been send over PCIe.

Default is 1000. Do not change.

int perf_derating

Default 0, corresponding to 1.6, 3.2, or 6.4 Gsps (depending on application_type).

For internal use only. Do not change.

int led_flashing_mode

Controls the LED flashing mode.

Define what LEDs do during initialization:

  • 0: LEDs are off

  • 1: LEDs light up once

int clock_source

Defines which clock source is used (internal, SMA, AUX2).

Must be one of the following:

NDIGO6G12_CLOCK_SOURCE_INTERNAL

Device is using the internal 10 MHz clock.

NDIGO6G12_CLOCK_SOURCE_SMA

Use an external 10 MHz clock as reference. The input is the SMA socket located on the board.

NDIGO6G12_CLOCK_SOURCE_AUX2

Use an external 10 MHz clock as reference. The input is the TRG LEMO connector located on the slot bracket.

uint32_t application_type

Select the application type.

Note that ndigo6g12_configuration::adc_mode must match the application type chosen here.

Must be one of the following:

NDIGO6G12_APP_TYPE_AVRG

Averaging mode.

For more information, see Section 2.6.

NDIGO6G12_APP_TYPE_4CH

Four ADC channels at 1.6 Gsps.

NDIGO6G12_APP_TYPE_2CH

Two ADC channels at 3.2 Gsps.

NDIGO6G12_APP_TYPE_1CH

One ADC channel at 6.4 Gsps.

NDIGO6G12_APP_TYPE_CURRENT

Use currently installed application type.

crono_bool_t force_bitstream_update

Force a bitstream update that configures the FPGA.

During the initialization of the board, a bitstream configures the FPGA of the Ndigo6G-12. This is only done if during the initialization of the Ndigo6G-12, application_type is different from the application_type that the Ndigo6G-12 is currently configured in. That is, the FPGA is only reconfigured, if application_type changes.

By setting force_bitstream_update to true, one can force a reconfiguration of the FPGA.

int partial_bitstream_size

Size of partial_bitstream.

Reserved for future expandability.

uint32_t *partial_bitstream

Pointer to a buffer with partial bitstream data.

Can be nullptr if application_type matches application_type of currently installed firmware.

Reserved for future expandability.

const char *firmware_locations

Location where firmware is installed.

Pointer to a list of paths (separated by ;) Can be nullptr if application_type matches application_type of currently installed firmware.