summaryrefslogtreecommitdiff
path: root/Radio/HW/BladeRF/src/driver/si5338.h
blob: 331f8c138aacae299b8eb7f24d1d3115f3d5e90f (plain) (blame)
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
129
130
131
132
133
134
/**
 * @file si5338.h
 *
 * @brief SI5339 Support
 *
 * This file is part of the bladeRF project:
 *   http://www.github.com/nuand/bladeRF
 *
 * Copyright (C) 2013 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_SI5338_H_
#define DRIVER_SI5338_H_

#include <libbladeRF.h>

#include "board/board.h"

/**
 * Set the rational sample rate of the specified channel.
 *
 * @param       dev     Device handle
 * @param[in]   ch      Channel
 * @param[in]   rate    Rational rate requested
 * @param[out]  actual  Rational rate actually set
 *
 * @return 0 on success, BLADERF_ERR_* value on failure
 */
int si5338_set_rational_sample_rate(struct bladerf *dev,
                                    bladerf_channel ch,
                                    const struct bladerf_rational_rate *rate,
                                    struct bladerf_rational_rate *actual);

/**
 * Get the rational sample rate of the specified channel.
 *
 * @param       dev     Device handle
 * @param[in]   ch      Channel
 * @param[out]  rate    Rational rate
 *
 * @return 0 on success, BLADERF_ERR_* value on failure
 */
int si5338_get_rational_sample_rate(struct bladerf *dev,
                                    bladerf_channel ch,
                                    struct bladerf_rational_rate *rate);

/**
 * Set the integral sample rate of the specified channel.
 *
 * @param       dev     Device handle
 * @param[in]   ch      Channel
 * @param[in]   rate    Integral rate requested
 * @param[out]  actual  Integral rate actually set
 *
 * @return 0 on success, BLADERF_ERR_* value on failure
 */
int si5338_set_sample_rate(struct bladerf *dev,
                           bladerf_channel ch,
                           uint32_t rate,
                           uint32_t *actual);

/**
 * Get the integral sample rate of the specified channel.
 *
 * @param       dev     Device handle
 * @param[in]   ch      Channel
 * @param[out]  rate    Integral rate
 *
 * @return 0 on success, BLADERF_ERR_* value on failure
 */
int si5338_get_sample_rate(struct bladerf *dev,
                           bladerf_channel ch,
                           unsigned int *rate);

/**
 * Set the rational frequency of the external SMB port.
 *
 * @param       dev     Device handle
 * @param[in]   rate    Rational rate requested
 * @param[out]  actual  Rational rate actually set
 *
 * @return 0 on success, BLADERF_ERR_* value on failure
 */
int si5338_set_rational_smb_freq(struct bladerf *dev,
                                 const struct bladerf_rational_rate *rate,
                                 struct bladerf_rational_rate *actual);

/**
 * Get the rational sample rate of the external SMB port.
 *
 * @param       dev     Device handle
 * @param[out]  rate    Rational rate
 *
 * @return 0 on success, BLADERF_ERR_* value on failure
 */
int si5338_get_rational_smb_freq(struct bladerf *dev,
                                 struct bladerf_rational_rate *rate);

/**
 * Set the integral sample rate of the external SMB port.
 *
 * @param       dev     Device handle
 * @param[in]   rate    Integral rate requested
 * @param[out]  actual  Integral rate actually set
 *
 * @return 0 on success, BLADERF_ERR_* value on failure
 */
int si5338_set_smb_freq(struct bladerf *dev, uint32_t rate, uint32_t *actual);

/**
  Get the integral sample rate of the external SMB port.
 *
 * @param       dev     Device handle
 * @param[out]  rate    Integral rate
 *
 * @return 0 on success, BLADERF_ERR_* value on failure
 */
int si5338_get_smb_freq(struct bladerf *dev, unsigned int *rate);

#endif