1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/*
* This file is part of the bladeRF project:
* http://www.github.com/nuand/bladeRF
*
* Copyright (C) 2016 Nuand LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DRIVER_FPGA_TRIGGER_H_
#define DRIVER_FPGA_TRIGGER_H_
#include "board/board.h"
/**
* Read trigger control register
*
* @param dev Device handle
* @param[in] ch Channel
* @param[in] signal Trigger signal control register to read from
* @param[out] val Pointer to variable that register is read into See the
* BLADERF_TRIGGER_REG_* macros for the meaning of each
* bit.
*
* @return 0 on success, BLADERF_ERR_* value on failure
*/
int fpga_trigger_read(struct bladerf *dev,
bladerf_channel ch,
bladerf_trigger_signal trigger,
uint8_t *val);
/**
* Write trigger control register
*
* @param dev Device handle
* @param[in] ch Channel
* @param[in] signal Trigger signal to configure
* @param[in] val Data to write into the trigger control register. See
* the BLADERF_TRIGGER_REG_* macros for options.
*
* @return 0 on success, BLADERF_ERR_* value on failure
*/
int fpga_trigger_write(struct bladerf *dev,
bladerf_channel ch,
bladerf_trigger_signal trigger,
uint8_t val);
/**
* Initialize a bladerf_trigger structure based upon the current state
* of a channel's trigger control register.
*
* @param dev Device to query
* @param[in] ch Channel
* @param[in] signal Trigger signal to query
* @param[out] trigger Updated to describe trigger
*
* @return 0 on success, BLADERF_ERR_* value on failure
*/
int fpga_trigger_init(struct bladerf *dev,
bladerf_channel ch,
bladerf_trigger_signal signal,
struct bladerf_trigger *trigger);
/**
* Arm or re-arm the specified trigger.
*
* @param dev Device handle
* @param[in] trigger Description of trigger to arm
* @param[in] arm If true, the specified trigger will be armed. Setting
* this to false will disarm the trigger specified in
* `config`.
*
* @return 0 on success, BLADERF_ERR_* value on failure
*/
int fpga_trigger_arm(struct bladerf *dev,
const struct bladerf_trigger *trigger,
bool arm);
/**
* 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.
*
* @param dev Device handle
* @param[in] trigger Trigger to assert
*
* @return 0 on success, BLADERF_ERR_* value on failure
*/
int fpga_trigger_fire(struct bladerf *dev,
const struct bladerf_trigger *trigger);
/**
* Query the fire request status of a master trigger
*
* @param dev Device handle
* @param[in] trigger Trigger to query
* @param[out] is_armed Set to true if the trigger is armed, and false
* otherwise. May be NULL.
* @param[out] has_fired Set to true if the trigger has fired, and false
* otherwise. May be NULL.
* @param[out] fire_requested Only applicable to a trigger master. Set to
* true if a fire request has been previously
* submitted. May be NULL.
* @param[out] resv1 Reserved parameter. Set to NULL.
*
* @return 0 on success, BLADERF_ERR_* value on failure
*/
int fpga_trigger_state(struct bladerf *dev,
const struct bladerf_trigger *trigger,
bool *is_armed,
bool *has_fired,
bool *fire_requested);
#endif
|