![]() |
libbladeRF
2.5.0
Nuand bladeRF library
|
Trigger functionality introduced in bladeRF FPGA v0.6.0 allows TX and/or RX samples to be gated via a trigger signal. This allows multiple devices to synchronize their TX/RX operations upon the reception of a trigger event.
The set of functions presented in this section of the API provides control over this triggering functionality. It is intended that these functions be used prior to starting sample streams. Attempting to use these functions while streaming may yield undefined and undesirable behavior.
These functions are thread-safe.
For devices running at the same sample rate, the trigger event should achieve synchronization within +/- 1 sample on each device in the chain.
mini_exp[1]
has been allocated as the trigger signal. However, this API section is designed to allow future signals to be added, including users' software and hardware customizations.enable = false
). Otherwise, the operation of shutting down streams will block for the entire duration of the stream timeout (or infinitely if the timeouts were set to 0).These functions are thread-safe.
The standard usage of these functions is shown below. This example assumes:
mini_exp[1]
pins are connected. mini_exp[1]
is J71-4 on bladeRF x40/x115, and J51-1 on bladeRF xA4/xA5/xA9.Data Structures | |
struct | bladerf_trigger |
Functions | |
API_EXPORT int CALL_CONV | bladerf_trigger_init (struct bladerf *dev, bladerf_channel ch, bladerf_trigger_signal signal, struct bladerf_trigger *trigger) |
API_EXPORT int CALL_CONV | bladerf_trigger_arm (struct bladerf *dev, const struct bladerf_trigger *trigger, bool arm, uint64_t resv1, uint64_t resv2) |
API_EXPORT int CALL_CONV | bladerf_trigger_fire (struct bladerf *dev, const struct bladerf_trigger *trigger) |
API_EXPORT int CALL_CONV | bladerf_trigger_state (struct bladerf *dev, const struct bladerf_trigger *trigger, bool *is_armed, bool *has_fired, bool *fire_requested, uint64_t *resv1, uint64_t *resv2) |
enum bladerf_trigger_role |
This value denotes the role of a device in a trigger chain.
Definition at line 1567 of file libbladeRF.h.
Trigger signal selection
This selects pin or signal used for the trigger.
The BLADERF_TRIGGER_USER_*
values have been added to allow users to modify both hardware and software implementations to add custom triggers, while maintaining libbladeRF API compatibility. Official bladeRF releases will not utilize these user signal IDs.
Definition at line 1606 of file libbladeRF.h.
API_EXPORT int CALL_CONV bladerf_trigger_arm | ( | struct bladerf * | dev, |
const struct bladerf_trigger * | trigger, | ||
bool | arm, | ||
uint64_t | resv1, | ||
uint64_t | resv2 | ||
) |
Configure and (dis)arm a trigger on the specified device.
arm
.dev | Device to configure | |
[in] | trigger | Trigger configure |
[in] | arm | (Re)Arm trigger if true, disarm if false |
[in] | resv1 | Reserved for future use. Set to 0. |
[in] | resv2 | Reserved for future use. Set to 0. |
API_EXPORT int CALL_CONV bladerf_trigger_fire | ( | struct bladerf * | dev, |
const struct bladerf_trigger * | trigger | ||
) |
Fire a trigger event.
Calling this functiona with a trigger whose role is anything other than BLADERF_TRIGGER_REG_MASTER will yield a BLADERF_ERR_INVAL return value.
dev | Device handle | |
[in] | trigger | Trigger to assert |
API_EXPORT int CALL_CONV bladerf_trigger_init | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
bladerf_trigger_signal | signal, | ||
struct bladerf_trigger * | trigger | ||
) |
Initialize a bladerf_trigger structure based upon the current configuration of the specified trigger signal.
While it is possible to simply declare and manually fill in a bladerf_trigger structure, it is recommended to use this function to retrieve the current role
and options
values.
dev | Device to query | |
[in] | ch | Channel |
[in] | signal | Trigger signal to query |
[out] | trigger | Updated to describe trigger |
API_EXPORT int CALL_CONV bladerf_trigger_state | ( | struct bladerf * | dev, |
const struct bladerf_trigger * | trigger, | ||
bool * | is_armed, | ||
bool * | has_fired, | ||
bool * | fire_requested, | ||
uint64_t * | resv1, | ||
uint64_t * | resv2 | ||
) |
Query the fire request status of a master trigger
dev | Device handle | |
[in] | trigger | Trigger to query |
[out] | is_armed | Set to true if the trigger is armed, and false otherwise. May be NULL. |
[out] | has_fired | Set to true if the trigger has fired, and false otherwise. May be NULL. |
[out] | fire_requested | Only applicable to a trigger master. Set to true if a fire request has been previously submitted. May be NULL. |
[out] | resv1 | Reserved for future use. This field is written as 0 if not set to NULL. |
[out] | resv2 | Reserved for future use. This field is written as 0 if not set to NULL. |