; This file holds configuration for bladerf module

[general]

; priority: integer: Priority of radio create message handler
; Defaults to 90
;priority=90

; serial: string: Optional device serial number to use when opening one
;serial=

; fpga_load: boolean: Load FPGA from file on device open
; Allowed values:
;  Boolean yes: Always load
;  Boolean no: Don't load (not recommended)
;  auto: Check if already loaded. Load only if check fails or not loaded
; Defaults to boolean 'yes' if missing or invalid
;fpga_load=yes

; fpga_file_115: string: 115KLE FPGA file to load
;fpga_file_115=${sharedpath}/data/hostedx115.rbf

; fpga_file_40: string: 40KLE FPGA file to load
;fpga_file_40=${sharedpath}/data/hostedx40.rbf

; tx_fpga_corr_phase: integer: TX FPGA PHASE correction
; Interval allowed: [-4096..4096]
; Defaults to 0 if missing or invalid
;tx_fpga_corr_phase=0

; tx_fpga_corr_gain: integer: TX FPGA GAIN correction
; Interval allowed: [-4096..4096]
; Defaults to 0 if missing or invalid
;tx_fpga_corr_gain=0

; tx_powerbalance: float: TX I/Q power balance
; This parameter is ignored if tx_fpga_corr_gain_software is enabled
; Interval allowed: (0..2)
; Defaults to 1 if missing or invalid
;tx_powerbalance=1

; rxcheckts: integer: Check timestamps after reading from device
; Put a debug message if incorrect
; This parameter is applied on reload
; Values:
;   0: disable
;   negative: forever, until changed
;   positive: the number of times to check
;rxcheckts=-1

; buffered_samples: integer: Length of internal I/O buffers in samples
; This value will be decreased to fit an integral number of USB frames
; With timestamps enabled: 252 samples on USB2 and 508 samples on USB3
; Interval allowed [1024 .. 16384]
;buffered_samples=2048

; tx_min_buffers: integer: Minimum number of buffers (USB frames) to send
; This option is used to accumulate data before sending it (avoid short write operations)
; Minimum allowed value is 1
; Defaults to the number of allocated buffers
;tx_min_buffers=

; srate_buffered_samples: string: Comma separated list of sampling rate thresholds,
;  'buffered_samples' and optional 'tx_min_buffers'
; This parameter can be used to adjust 'buffered_samples' and/or 'tx_min_buffers'
;  from sampling rates configured at runtime
; List item format: samplerate/buffered_samples[/tx_min_buffers]
; E.g. 2166667/2048,4000000/4000/5
; NOTE: If no threshold is found when sampling rate changes the initial values of
;       'buffered_samples' and 'tx_min_buffers' will be used
;srate_buffered_samples=

; silence_time: integer: Interval (in milliseconds) to silence timestamp related debug messages
; Allowed interval [0..60000]
;silence_time=5000

; rx_ts_past_error_interval: integer: Interval (in milliseconds) for allowed late timestamps
;  when reading from device. I.e. how many old samples in a row we accept when reading
; This value is used to make sure we are returning from device read (with error): avoid
;  reading forever if we have a faulty device
; Allowed interval [50..10000]
; Defaults to 200
;rx_ts_past_error_interval=200

; warn_clamped: integer: Threshold for sent clamped samples warning
; This parameter is a percent: clamped_samples/requested_samples
; Allowed interval [0..100]
; Defaults to 0 (always warn if there is at least 1 sample clamped)
;warn_clamped=0

; tx_fpga_corr_gain_software: boolean: Use software TX FPGA GAIN correction
; This parameter is applied on reload for new devices only
; Defaults to yes
;tx_fpga_corr_gain_software=yes

; max_delay: integer: Maximum delay (in microseconds) expected for pinning a sample measurement with
;  its associated timestamp, used when disciplining the VCTCXO to the local machine clock
; Allowed interval [100..2000]
; Defaults to 550 microseconds on USB 3.0 or 750 on USB 2.0
;max_delay=550

; best_delay: integer: Best delay (in microseconds) expected for pinning a sample measurement with
;  its associated timestamp, used when disciplining the VCTCXO to the local machine clock
; Allowed interval [100..max_delay]
; Defaults to 450 microseconds on USB 3.0 or 600 on USB 2.0
;best_delay=450

; known_delay: integer: Known delay (in microseconds) expected for pinning a sample measurement
;  with its associated timestamp, used when disciplining the VCTCXO to the local machine clock
; This parameter configures a known 'fixed' timestamp read time (i.e. the duration of USB
;  transfer(s) needed to read board's timestamp)
; Allowed interval [100..best_delay]
; Defaults to 400 microseconds on USB 3.0 or 500 on USB 2.0
;known_delay=400

; system_accuracy: integer: Accuracy (in microseconds) of the whole sync mechanism to the real
;  time (includes local clock's drift)
; Used to calculate interval needed to do a frequency calibration
; Allowed interval [100..2000]
; Defaults to 300 microseconds
;system_accuracy=300

; accuracy_ppb: integer: Desired accuracy of the frequency calibration expressed in parts-per-billion
; Used to calculate interval needed to do a frequency calibration
; Allowed interval [10..200]
; Defaults to 30 ppb
;accuracy_ppb=30

; trace_discipliner: boolean: Enable debug messages for VCTCXO discipliner behavior (trace)
; Disabled by default
;trace_discipliner=disable

; max_samplerate_super: integer: Maximum allowed sampling rate for super speed (USB3)
; max_samplerate_high: integer: Maximum allowed sampling rate for high speed (USB2)
; Trying to set a sampling rate higher than this leads to failure
; This is not a global sampling rate (TX+RX), it configures max sampling rate per direction
;max_samplerate_super=40000000
;max_samplerate_high=4000000

; lms_autocal: boolean: Run LMS chip auto-calibration on power on
; Defaults to 'no'
;lms_autocal=no

; rxoutsw: boolean: Enable (close) the RXOUTSW switch
; This parameter is applied on reload
;rxoutsw=no


[libusb]
; This section configures libusb backend related data

; debug_level: libusb debug level
; Default to 0 (no debug messages)
; Currently libusb defines the follwing levels:
;  1: ERROR, 2: WARNING, 3: INFO, 4: DEBUG
;debug_level=0

; sync_transfer_timeout: integer: Sync transfer timeout in milliseconds
; This parameter is applied on device creation
; This parameter is used when transferring radio data (samples)
; Allowed interval: [20 .. 500]
; Defaults to 50
;sync_transfer_timeout=50

; ctrl_transfer_timeout: integer: Control transfer timeout in milliseconds
; This parameter is applied on device creation
; Allowed interval: [200 .. 2000]
; Defaults to 500
;ctrl_transfer_timeout=500

; bulk_transfer_timeout: integer: Bulk transfer timeout in milliseconds
; This parameter is applied on device creation
; Allowed interval: [200 .. 2000]
; Defaults to 500
;bulk_transfer_timeout=500


[filedump]
; This section configures file data dump
; All parameters are applied on reload
; This section is always handled on reload (e.g. dump settings are applied, old dump is reset)
; Dump files are closed when the condition is met (count changes to 0 or reaches 0)
; TX/RX data dump is done when send/recv is executed (e.g. if no recv is requested by the
;  upper layer the RX file(s) won't change)

; tx-data-mode: string/boolean: Configures the device send data dump mode (before
;  sending it to device, after applying changes on data received from upper layer)
; Values:
;  Boolean false (disable): Disable data dump
;  Boolean true (on): Enable data dump, dump forever (until changed)
;  count: Enable data dump, dump the number of buffers set in 'tx-data-count'
;tx-data-mode=disable

; tx-data-count: integer: The number of device send data buffers to dump
; The number of buffers is in device buffers
; This parameter is ignored if 'tx-data-mode' is not 'count'
;tx-data-count=10

; tx-data-file: string: File to dump data sent to device
; 'bordserial' is the serial of the device
;tx-data-file=tx-data-${boardserial}

; tx-app-mode: string/boolean: Configures the send data dump mode (as received from
;  from upper layer, before applying any changes)
; Values:
;  Boolean false (disable): Disable data dump
;  Boolean true (on): Enable data dump, dump forever (until changed)
;  count: Enable data dump, dump the number of buffers set in 'tx-app-count'
;tx-app-mode=disable

; tx-app-count: integer: The number of send buffers to dump
; The number of buffers is in send requests (e.g. a buffer will be counted on each request)
; This parameter is ignored if 'tx-data-mode' is not 'count'
;tx-app-count=10

; tx-app-file: string: File to dump data received from upper layer
; 'bordserial' is the serial of the device
;tx-app-file=tx-app-${boardserial}

; rx-data-mode
; rx-data-count
; rx-data-file
; rx-app-mode
; rx-app-count
; rx-app-file
; See the corresponding TX parameters
; rx-data-file: The data is dumped after read from device, before applying any changes
; rx-app-file: The data is dumped before returning it to upper layer


[calibrate-bb]
; This section configures the baseband calibration process (TX DC offset and I/Q Imbalance)
; Parameters should be changed for debug purposes only!
; 'dc_' or 'imbalance_' prefix means the parameter is applied per calibration category
; NOTE: the following combination would allow the calibration process to run longer
;       when failing (TX/RX data can be checked with an oscilloscope or spectrum analyzer):
;       dc_loops=10
;       recv_fail_stop=0
;       recv_fail_loops=1000

; dc_disable/imbalance_disable: boolean: Disable specific process
; Defaults to no

; samples: integer: Number of samples to use (read buffer length)
; Minimum allowed: 1000
; Defaults to the number of samples read from device in one request
;samples=

; {dc_|imbalance_}loops: integer: Number of specific calibration loops to execute
; Interval allowed: 1..10
;loops=2

; {dc_|imbalance_}trace: integer: DC/Imbalance process trace
; Values:
;  1: Output params at start and result at end
;  2,3,4: Output more data
;  Greater than 4: Output data as read from device (e.g. 6 means output 2 read buffers in each loop)
; Defaults to 0

; {dc_|imbalance_}trace_repeat: boolean: Output repeated data check loops
; Defaults to yes

; {dc_|imbalance_}trace_failed: boolean: Output failed data check
; Defaults to yes

; {dc_|imbalance_}dump_status_start: boolean: Output state data if trace is enabled
; Defaults to no

; dump_dev: boolean: Output device info on start. Ignored if 'dump_status_start' is disabled
;dump_dev=no

; dump_lms_modules: boolean: Output some LMS info on start. Ignored if 'dump_status_start' is disabled
;dump_lms_modules=no

; dump_loopback_status: boolean: Output loopback switches on start. Ignored if 'dump_status_start' is disabled
;dump_loopback_status=no

; dump_lms: boolean: Output all LMS registers. Ignored if 'dump_status_start' is disabled
; dump_lms_str: string: Hex string with specific LMS address(es) to output on start.
;  Ignored if 'dump_status_start' is disabled
; dump_lms=no
; dump_lms_str=

; recv_fail_loops: integer: Number of retries if signal check fails
; This apply for each calibrated value. E.g. for a specific DC I and specific DC Q
; Allowed interval: 1..1000
;recv_fail_loops=5

; recv_fail_stop: integer: Stop (fail) the process on data check failure
; A negative value leads to calibration stop and wait in a loop to be
;  cancelled (data send/receive are not stopped)
;recv_fail_stop=1

; loopback: string: Override default loopback
; Possible values: lpf-to-rxout, lpf-to-vga2, vga1-to-vga2, lpf-to-lpf, vga1-to-lpf,
;   pa-to-lna1, pa-to-lna2, pa-to-lna3, none
;loopback=pa-to-lna1/pa-to-lna2

; loopback_transmit: boolean: Enable TX RF during calibration
;loopback_transmit=enabled for loopback=none, disabled for all other values

; txpattern: string: Transmit pattern to use
; May be:
;  - circle: 1,0,0,1,-1,0,0,-1
;  - circle_reverse: Reversed circle: 1,0,0,-1,-1,0,0,1
;  - circle_div[_reverse]_{divisor}: [reversed] circle pattern divided by requested divisor (must be at least 1)
;  - circle_points[_reverse]_{length}[_div_{divisor}]: Build a [reversed] circle using given length
;      (which must be a multiple of 4). Use optional divisor
;  - Comma separated list of values (e.g. 1,0.5,-0.4,0.3). The number of values MUST be an even one.
;      Each value must be in interval [-1..1]
;  - zero: same as 0,0
;txpattern=circle

; {dc_|imbalance_}txvga1, txvga2, rxvga1, rxvga2: integer: Override default VGA gains
; Defaults: txvga1=-14, txvga2=20, rxvga1=30, rxvga2=3

; lms_write: string: Hex string describing LMS values to be wrote to chip
;  before setting up specific calibration
; Must contain addr/value pairs (e.g. 1248 writes 0x48 at address 0x12)
;lms_write=

; lms_write_alter: string: Hex string describing LMS values to be wrote to chip
;  after setup, before starting specific calibration
; Must contain addr/value pairs (e.g. 1248 writes 0x48 at address 0x12)
;lms_write_alter=

; sample_limit: float: Allowed range for read data
; Read data is validated for interval [-sample_limit .. sample_limit]
; Positive value (clamped to interval [0 ..1]): data must be inside configured interval
; Negative value: data must be outside configured interval
;sample_limit=1

; {dc_|imbalance_}file_dump: string: File used to dump results

; dump_filter_test: string: Format to use to dump test filter vector values
; The following parameters are replaced: ${newline}, ${tab}, ${time}
; Values are set in ${data} location
;dump_filter_test=

; dump_buf_ok_format, dump_buf_fail_format: string: Format used to dump read data values
; The following parameters are replaced: ${newline}, ${tab}, ${time}
; If set, read data values are set in ${data} location

; dump_buf_ok: integer: Number of valid buffers to dump
; dump_buf_fail: integer: Number of failed buffers to dump
; These parameters are ignored 'dump_buf_ok_format'/'dump_buf_fail_format' are not set
; 0: none, negative: all
;dump_buf_ok=0
;dump_buf_fail=0


[loopback-check]
; This section configures the loopback check process (runs when calibrating)
; Parameters should be changed for debug purposes only!

; samples: integer: Number of samples to use (read buffer length)
; Minimum allowed: 1000
; Defaults to the number of samples read from device in one request
;samples=

; trace: integer: Loopback check process trace
; Values:
;  1: Output params at start and result at end
;  Greater than 1: Output values calculated for each buffer
;trace=0

; dump_status_start: boolean: Output state data if trace is enabled
;dump_status_start=no

; dump_dev: boolean: Output device info on start. Ignored if 'dump_status_start' is disabled
;dump_dev=no

; dump_lms_modules: boolean: Output some LMS info on start. Ignored if 'dump_status_start' is disabled
;dump_lms_modules=no

; dump_loopback_status: boolean: Output loopback switches on start. Ignored if 'dump_status_start' is disabled
;dump_loopback_status=no

; dump_lms: boolean: Output all LMS registers. Ignored if 'dump_status_start' is disabled
; dump_lms_str: string: Hex string with specific LMS address(es) to output on start.
;  Ignored if 'dump_status_start' is disabled
; dump_lms=no
; dump_lms_str=

; buffers: integer: The number of buffers to check
;buffers=10

; allow_fail: integer: How many data check failures are allowed
; Allowed interval: [0 .. buffers)
;allow_fail=buffers/4

; loopback: string: Override default loopback
; Possible values: lpf-to-rxout, lpf-to-vga2, vga1-to-vga2, lpf-to-lpf, vga1-to-lpf,
;   pa-to-lna1, pa-to-lna2, pa-to-lna3, none
;loopback=pa-to-lna1/pa-to-lna2

; loopback_transmit: boolean: Enable TX RF during loopback check
;loopback_transmit=enabled for loopback=none, disabled for all other values

; delta_freq: integer: Override TX/RX frequency difference
;delta_freq=

; txpattern: string: Transmit pattern to use
; May be:
;  - circle: 1,0,0,1,-1,0,0,-1
;  - circle_reverse: Reversed circle: 1,0,0,-1,-1,0,0,1
;  - circle_div[_reverse]_{divisor}: [reversed] circle pattern divided by requested divisor (must be at least 1)
;  - circle_points[_reverse]_{length}[_div_{divisor}]: Build a [reversed] circle using given length
;      (which must be a multiple of 4). Use optional divisor
;  - Comma separated list of values (e.g. 1,0.5,-0.4,0.3). The number of values MUST be an even one.
;      Each value must be in interval [-1..1]
;  - zero: same as 0,0
;txpattern=circle

; txfrequency: integer: TX tune frequency
; samplerate: integer: Sampling rate to use
; bandwidth: integer: Filter bandwidth to use
; These parameters default to values required by calibration

; txvga1, txvga2, rxvga1, rxvga2: integer: Override default VGA gains
; Defaults: txvga1=-14, txvga2=0, rxvga1=30, rxvga2=3

; lms_write: string: Hex string describing LMS values to be wrote to chip
;  after setup, before starting the loopback check process
; Must contain addr/value pairs (e.g. 1248 writes 0x48 at address 0x12)
;lms_write=

; test_pattern: string: Algorithm test pattern. Replaces data read from board
; See txpattern for format
;test_pattern=

; sample_limit: float: Allowed range for read data
; Read data is validated for interval [-sample_limit .. sample_limit]
; Positive value (clamped to interval [0 ..1]): data must be inside configured interval
; Negative value: data must be outside configured interval
;sample_limit=0.9965 (2040/2047)

; sample_limit_allow_fail: integer: How many sample limit failures are allowed
; Allowed interval: [0 .. buffers)
;sample_limit_allow_fail=buffers/4

; dump_file: string: File used to dump results
;dump_file=

; dump_buf_ok_format, dump_buf_fail_format: string: Format used to dump read data values
; The following parameters are replaced: ${newline}, ${tab}, ${time}
; If set, read data values are set in ${data} location

; dump_buf_ok: integer: Number of valid buffers to dump
; dump_buf_fail: integer: Number of failed buffers to dump
; These parameters are ignored 'dump_buf_ok_format'/'dump_buf_fail_format' are not set
; 0: none, negative: all
;dump_buf_ok=0
;dump_buf_fail=0
