(Beta) Simplified API Reference

This page contains the (beta) simplified API reference for the Genalyzer library.

Function Groups


Set Functions

int gn_config_set_ttype(tone_type ttype, gn_config *c)

set configuration struct member: tone_type

Parameters:
  • ttype – ENUM value to indicate input tone type. Options: REAL_COSINE, REAL_SINE, COMPLEX_EXP

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_npts(size_t npts, gn_config *c)

set configuration struct member: npts

Parameters:
  • npts – Number of sample points in the generated waveform

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_sample_rate(double sample_rate, gn_config *c)

set configuration struct member: sample_rate

Parameters:
  • sample_rate – Input Sample rate of the data converter

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_data_rate(double data_rate, gn_config *c)

set configuration struct member: data_rate

Parameters:
  • data_rate – Input data rate of the data converter

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_shift_freq(double shift_freq, gn_config *c)

set configuration struct member: shift_freq

Parameters:
  • shift_freq – Shift frequency of the data converter

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_num_tones(size_t num_tones, gn_config *c)

set configuration struct member: num_tones

Parameters:
  • num_tones – Number of tones to generate

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_tone_freq(double *tone_freq, gn_config *c)

set configuration struct member: tone_freq

Parameters:
  • tone_freq – Input array of tone frequencies to generate

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_tone_ampl(double *tone_ampl, gn_config *c)

set configuration struct member: tone_ampl

Parameters:
  • tone_ampl – Input array of tone scales to generate

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_tone_phase(double *tone_phase, gn_config *c)

set configuration struct member: tone_phase

Parameters:
  • tone_phase – Input array of tone phases to generate

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_fsr(double fsr, gn_config *c)

set configuration struct member: fsr

Parameters:
  • fsr – Full-scale range of the waveform

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_qres(int qres, gn_config *c)

set configuration struct member: qres

Parameters:
  • qres – Quantization resolution

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_noise_rms(double noise_rms, gn_config *c)

set configuration struct member: noise_rms

Parameters:
  • noise_rms – RMS Noise

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_code_format(GnCodeFormat code_format, gn_config *c)

set configuration struct member: code_format

Parameters:
  • code_format – Code format of data

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_nfft(size_t nfft, gn_config *c)

set configuration struct member: nfft

Parameters:
  • nfft – FFT order

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_fft_navg(size_t fft_navg, gn_config *c)

set configuration struct member: navg

Parameters:
  • fft_navg – Num. of FFTs to average

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_win(GnWindow win, gn_config *c)

set configuration struct member: win

Parameters:
  • win – Window function used

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_ssb_fund(int ssb_fund, gn_config *c)

set configuration struct member: ssb_fund

Parameters:
  • ssb_fund – Single side bin fundamental

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_ssb_rest(int ssb_rest, gn_config *c)

set configuration struct member: ssb_rest

Parameters:
  • ssb_rest – Single side bins rest

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_max_harm_order(int max_harm_order, gn_config *c)

set configuration struct member: max_harm_order

Parameters:
  • max_harm_order – Max order of harmonic

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_dnla_signal_type(GnDnlSignal dnla_signal_type, gn_config *c)

set configuration struct member: dnla_signal_type

Parameters:
  • dnla_signal_type – DNL analysis signal type

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_inla_fit(GnInlLineFit inla_fit, gn_config *c)

set configuration struct member: inla_fit

Parameters:
  • inla_fit – INL analysis line fit

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_ramp_start(double ramp_start, gn_config *c)

set configuration struct member: ramp_start

Parameters:
  • ramp_start – start value of ramp

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_set_ramp_stop(double ramp_stop, gn_config *c)

set configuration struct member: ramp_stop

Parameters:
  • ramp_stop – stop value of ramp

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise


Get Functions

int gn_config_get_npts(size_t *npts, gn_config *c)

get configuration struct member: npts

Parameters:
  • npts – Number of sample points in the generated waveform

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_get_sample_rate(double *sample_rate, gn_config *c)

get configuration struct member: sample_rate

Parameters:
  • sample_rate – Input Sample rate of the data converter

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_get_nfft(size_t *nfft, gn_config *c)

get configuration struct member: nfft

Parameters:
  • nfft – FFT order

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_get_code_density_size(size_t *code_density_size, gn_config *c)

get configuration struct member: _code_density_size

Parameters:
  • code_density_size – code density size

  • c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_get_wfa_results(char ***rkeys, double **rvalues, size_t *results_size, const int32_t *qwf, gn_config *c)

Do waveform analysis and all get results.

Parameters:
  • results_size – [results_size] size of results

  • qwf – [qwf] Input - Quantized input array pointer

  • c – [c] Input - Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise

int gn_get_ha_results(char ***rkeys, double **rvalues, size_t *results_size, const uint64_t *hist, gn_config *c)

Do histogram analysis and get results.

Parameters:
  • rkeys – [rkeys] Output - Result keys

  • rvalues – [rvalues] Output - Result values

  • results_size – [results_size] Output - Size of results

  • hist – [hist] Input - Histogram input to be analyzed

  • c – [c] Input - Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise

int gn_get_dnla_results(char ***rkeys, double **rvalues, size_t *results_size, const double *dnl, gn_config *c)

Do DNL analysis and get results.

Parameters:
  • rkeys – [rkeys] Output - Result keys

  • rvalues – [rvalues] Output - Result values

  • results_size – [results_size] Output - Size of results

  • dnl – [dnl] Input - DNL input to be analyzed

  • c – [c] Input - Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise

int gn_get_inla_results(char ***rkeys, double **rvalues, size_t *results_size, const double *inl, gn_config *c)

Do INL analysis and get results.

Parameters:
  • rkeys – [rkeys] Output - Result keys

  • rvalues – [rvalues] Output - Result values

  • results_size – [results_size] Output - Size of results

  • inl – [dnl] Input - INL input to be analyzed

  • c – [c] Input - Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise

int gn_get_fa_single_result(double *rvalue, const char *metric_name, double *fft_ilv, gn_config *c)

Do Fourier analysis and get a single result.

Parameters:
  • fft_ilv – [fft_ilv] Input - Interleaved Re/Im array pointer

  • c – [c] Input - Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise

int gn_get_fa_results(char ***rkeys, double **rvalues, size_t *results_size, double *fft_ilv, gn_config *c)

Do Fourier analysis and all get results.

Parameters:
  • results_size – [results_size] size of results

  • fft_ilv – [fft_ilv] Input - Interleaved Re/Im array pointer

  • c – [c] Input - Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise


Config Functions

int gn_config_free(gn_config *c)

free memory for configuration struct

Parameters:

c – genalyzer Configuration struct

Returns:

0 on success, non-zero otherwise

int gn_config_gen_tone(tone_type ttype, size_t npts, double sample_rate, size_t num_tones, double *tone_freq, double *tone_ampl, double *tone_phase, gn_config *c)

Configure tone parameters to be used in measurement.

Parameters:
  • ttype – ENUM value to indicate input tone type. Options: REAL_COSINE, REAL_SINE, COMPLEX_EXP

  • npts – Number of sample points in the generated waveform

  • sample_rate – Input Sample rate of the data converter

  • num_tones – Number of tones to generate

  • tone_freq – Input array of tone frequencies to generate

  • tone_ampl – Input array of tone scales to generate

  • tone_phase – Input array of tone phases to generate

  • c – Configuration struct containing tone parameters

Returns:

0 on success, non-zero otherwise

int gn_config_gen_ramp(size_t npts, double ramp_start, double ramp_stop, gn_config *c)

Configure tone parameters to be used in measurement.

Parameters:
  • npts – Number of sample points in the generated waveform

  • ramp_start – Input start value of ramp

  • ramp_stop – Input stop value of ramp

  • c – Configuration struct containing ramp parameters

Returns:

0 on success, non-zero otherwise

int gn_config_quantize(size_t npts, double fsr, int qres, double qnoise, gn_config *c)

Configure quantization parameters to be used in measurement.

Parameters:
  • npts – Number of sample points in the generated waveform

  • fsr – Full-scale range of the waveform

  • qres – Quantization resolution

  • qnoise – Quantization noise

  • c – Configuration structure

Returns:

0 on success, non-zero otherwise

int gn_config_histz_nla(size_t npts, int qres, gn_config *c)

Configure parameters to compute histogram.

Parameters:
  • npts – Number of sample points in the generated waveform

  • qres – Quantization resolution

  • c – Configuration structure

Returns:

0 on success, non-zero otherwise

int gn_config_fftz(size_t npts, int qres, size_t navg, size_t nfft, GnWindow win, gn_config *c)

Configure FFT parameters.

Parameters:
  • npts – [npts] Number of sample points in the input waveform

  • qres – [qres] Quantization resolution

  • navg – [navg] Number of FFT averages

  • nfft – [nfft] FFT order

  • win – [win] Window function to apply, Options: GnWindowBlackmanHarris, GnWindowHann, GnWindowNoWindow

  • c – [c] Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise

int gn_config_fa(double fixed_tone_freq, gn_config *c)

Generate sinusoidal tone based on supplied configuration.

Parameters:
  • fixed_tone_freq – [fixed_tone_freq] Fixed tone frequency

  • c – [c] Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise

int gn_config_fa_auto(uint8_t ssb_width, gn_config *c)

Generate sinusoidal tone based on supplied configuration without specifying tone manually.

Parameters:
  • ssb_width – [ssb_width] Number of bins to use for fundamental search and keepout of other tones

  • c – [c] Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise


Generate Functions

int gn_gen_ramp(double **out, gn_config *c)

Generate ramp based on supplied configuration.

Parameters:
  • out – Output array of ramp generated

  • c – Configuration structure of test and waveform to generate

int gn_gen_real_tone(double **out, gn_config *c)

Generate sinusoidal tone based on supplied configuration.

Parameters:
  • out – Output array of generated tone

  • c – Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise

int gn_gen_complex_tone(double **outi, double **outq, gn_config *c)

Generate sinusoidal tone based on supplied configuration.

Parameters:
  • outi – In-phase output array of generated tone

  • outq – Quadrature output array of generated tone

  • c – Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise


Operation Functions

int gn_quantize(int32_t **out, const double *in, gn_config *c)

Quantize waveform based on supplied configuration.

Parameters:
  • out – [out] Quantized output waveform

  • in – [in] Input waveform to be quantized

  • c – [c] Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise

int gn_fftz(double **out, const int32_t *in_i, const int32_t *in_q, gn_config *c)

Compute FFT of quantized input waveform.

Parameters:
  • out – [out] Interleaved Re/Im FFT output

  • in_i – [in_i] In-phase input

  • in_q – [in_q] Quadrature input

  • c – [c] Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise

int gn_histz(uint64_t **hist, size_t *hist_len, const int32_t *qwf, gn_config *c)

Compute histogram of quantized waveform.

Parameters:
  • hist – [hist] Output - Histogram of input quantized waveform

  • hist_len – [hist_len] Output - Histogram size

  • qwf – [qwf] Input - Quantized input waveform

  • c – [c] Input - Configuration structure containing test parameters

Returns:

0 on success, non-zero otherwise

int gn_dnlz(double **dnl, size_t *dnl_len, const uint64_t *hist, gn_config *c)

Compute histogram of quantized waveform.

Returns:

0 on success, non-zero otherwise

int gn_inlz(double **inl, size_t *inl_len, const double *dnl, gn_config *c)

Compute histogram of quantized waveform.

Returns:

0 on success, non-zero otherwise