bladerf_lib.h 3.21 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*******************************************************************************
    OpenAirInterface 
    Copyright(c) 1999 - 2014 Eurecom

    OpenAirInterface is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.


    OpenAirInterface 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with OpenAirInterface.The full GNU General Public License is 
    included in this distribution in the file called "COPYING". If not, 
    see <http://www.gnu.org/licenses/>.

   Contact Information
   OpenAirInterface Admin: openair_admin@eurecom.fr
   OpenAirInterface Tech : openair_tech@eurecom.fr
24
   OpenAirInterface Dev  : openair4g-devel@lists.eurecom.fr
25 26 27 28 29 30 31 32 33
  
   Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE

 *******************************************************************************/

/** bladerf_lib.h
 *
 * Author: navid nikaein
 */
34 35

#include <libbladeRF.h>
36 37 38 39

#include "common_lib.h"
#include "log.h"

40 41 42 43 44
/** @addtogroup _BLADERF_PHY_RF_INTERFACE_
 * @{
 */

/*! \brief BladeRF specific data structure */ 
45 46
typedef struct {

47
  //! opaque BladeRF device struct. An empty ("") or NULL device identifier will result in the first encountered device being opened (using the first discovered backend)
48
  struct bladerf *dev;
49 50
  
  //! Number of buffers
51
  unsigned int num_buffers;
52
  //! Buffer size 
53
  unsigned int buffer_size;
54
  //! Number of transfers
55
  unsigned int num_transfers;
56
  //! RX timeout
navid's avatar
navid committed
57
  unsigned int rx_timeout_ms;
58
  //! TX timeout
navid's avatar
navid committed
59
  unsigned int tx_timeout_ms;
60
  //! Metadata for RX
61
  struct bladerf_metadata meta_rx;
62
  //!Metadata for TX
63
  struct bladerf_metadata meta_tx;
64
  //! Sample rate
65
  unsigned int sample_rate;
66
  //! time offset between transmiter timestamp and receiver timestamp;
67
  double tdiff;
68
  //! TX number of forward samples use brf_time_offset to get this value
69 70 71 72 73 74
  int tx_forward_nsamps; //166 for 20Mhz


  // --------------------------------
  // Debug and output control
  // --------------------------------
75
  //! Number of underflows
76
  int num_underflows;
77
  //! Number of overflows
78
  int num_overflows;
79
  //! number of sequential errors
80
  int num_seq_errors;
81
  //! number of RX errors
82
  int num_rx_errors;
83
  //! Number of TX errors
84 85
  int num_tx_errors;

86
  //! timestamp of current TX
navid's avatar
navid committed
87
  uint64_t tx_current_ts;
88
  //! timestamp of current RX
navid's avatar
navid committed
89
  uint64_t rx_current_ts;
90
  //! number of actual samples transmitted
navid's avatar
navid committed
91
  uint64_t tx_actual_nsamps;
92
  //! number of actual samples received
navid's avatar
navid committed
93
  uint64_t rx_actual_nsamps;
94
  //! number of TX samples
navid's avatar
navid committed
95
  uint64_t tx_nsamps;
96
  //! number of RX samples
navid's avatar
navid committed
97
  uint64_t rx_nsamps;
98
  //! number of TX count
99
  uint64_t tx_count;
100
  //! number of RX count
101
  uint64_t rx_count;
102
  //! timestamp of RX packet
103 104 105
  openair0_timestamp rx_timestamp;

} brf_state_t;
106 107 108 109
/*
 * func prototypes 
 */

110
int brf_error(int status);
111
/*@}*/