GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
fpga_spidev.h
Go to the documentation of this file.
1/*!
2 * \file fpga_spidev.h
3 * \brief FPGA SPI control.
4 *
5 * -----------------------------------------------------------------------------
6 *
7 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
8 * This file is part of GNSS-SDR.
9 *
10 * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
11 * SPDX-License-Identifier: GPL-3.0-or-later
12 *
13 * -----------------------------------------------------------------------------
14 */
15
16#ifndef GNSS_SDR_FPGA_SPIDEV_H
17#define GNSS_SDR_FPGA_SPIDEV_H
18
19#include <cstdint>
20#include <string>
21
23{
24public:
25 /*!
26 * \brief Default constructor.
27 */
28 Fpga_spidev() = default;
29
30 /*!
31 * \brief Default destructor.
32 */
33 ~Fpga_spidev() = default;
34
35 /*!
36 * \brief write a register through the SPI.
37 */
38 int write_reg32(char addr, uint32_t data);
39
40 /*!
41 * \brief read a register through the SPI.
42 */
43 int read_reg32(uint8_t addr, uint32_t* copy_to);
44 /*!
45 * \brief Open the SPI device driver.
46 */
47 int SPI_open(std::string spi_device_name);
48
49 /*!
50 * \brief Close the SPI device driver
51 */
52 int SPI_close(void) const;
53
54private:
55 static const uint32_t SPI_SPEED = 250000;
56 // const std::string SPI_DEVICE_NAME = std::string("/dev/spidev2.0"); // Switch UIO device name
57
58 int d_fd;
59};
60
61
62#endif // GNSS_SDR_FPGA_SPIDEV_H
int SPI_open(std::string spi_device_name)
Open the SPI device driver.
int write_reg32(char addr, uint32_t data)
write a register through the SPI.
Fpga_spidev()=default
Default constructor.
int read_reg32(uint8_t addr, uint32_t *copy_to)
read a register through the SPI.
~Fpga_spidev()=default
Default destructor.
int SPI_close(void) const
Close the SPI device driver.