SatNOGS-COMMS
4.1.0
A COMMS subsystem for CubeSats
Toggle main menu visibility
Loading...
Searching...
No Matches
fpga.hpp
Go to the documentation of this file.
1
/*
2
* SatNOGS-COMMS control library
3
*
4
* Copyright (C) 2024, Libre Space Foundation <http://libre.space>
5
*
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*
19
* SPDX-License-Identifier: GNU General Public License v3.0 or later
20
*/
21
22
#pragma once
23
24
#include <cstdint>
25
#include <etl/string.h>
26
#include <
satnogs-comms-lib/bsp/gpio.hpp
>
27
#include <
satnogs-comms-lib/bsp/spi.hpp
>
28
#include <
satnogs-comms-lib/power.hpp
>
29
30
namespace
satnogs::comms::lib
31
{
32
class
fpga
33
{
34
public
:
35
enum class
reg
: uint32_t
36
{
37
id
= 0,
38
version
= 1,
39
status
= 2
40
};
41
42
enum class
hw
: uint8_t
43
{
44
NONE
,
45
ALINX_AC7Z020
,
46
LIBREWAVE
47
};
48
49
enum class
boot_mode
: uint8_t
50
{
51
JTAG
,
52
NAND
,
53
QSPI
,
54
EMMC
55
};
56
57
fpga
(
hw
h,
bsp::spi
&spi,
power
&pwr,
bsp::gpio
&
fpga_done
,
58
bsp::gpio
&boot_sel_1,
bsp::gpio
&boot_sel_0);
59
60
void
61
enable
(
bool
en =
true
);
62
63
bool
64
enabled
()
const
;
65
66
void
67
write_reg
(uint32_t
reg
, uint32_t val);
68
69
uint32_t
70
read_reg
(uint32_t
reg
);
71
72
void
73
write_reg
(
reg
r, uint32_t val);
74
75
uint32_t
76
read_reg
(
reg
r);
77
78
bool
79
get_fpga_done
()
const
;
80
81
void
82
set_boot_mode
(
boot_mode
mode);
83
84
boot_mode
85
get_boot_mode
()
const
;
86
87
private
:
88
const
hw
m_hw;
89
etl::string<32> m_name;
90
bsp::spi
&m_spi;
91
power
&m_pwr;
92
bsp::gpio
&m_fpga_done;
93
bsp::gpio
&m_boot_sel_1;
94
bsp::gpio
&m_boot_sel_0;
95
};
96
97
}
// namespace satnogs::comms::lib
satnogs::comms::lib::bsp::gpio
GPIO device abstraction.
Definition
gpio.hpp:38
satnogs::comms::lib::bsp::spi
SPI device abstraction.
Definition
spi.hpp:41
satnogs::comms::lib::fpga::boot_mode
boot_mode
Definition
fpga.hpp:50
satnogs::comms::lib::fpga::boot_mode::NAND
@ NAND
Definition
fpga.hpp:52
satnogs::comms::lib::fpga::boot_mode::QSPI
@ QSPI
Definition
fpga.hpp:53
satnogs::comms::lib::fpga::boot_mode::EMMC
@ EMMC
Definition
fpga.hpp:54
satnogs::comms::lib::fpga::boot_mode::JTAG
@ JTAG
Definition
fpga.hpp:51
satnogs::comms::lib::fpga::fpga
fpga(hw h, bsp::spi &spi, power &pwr, bsp::gpio &fpga_done, bsp::gpio &boot_sel_1, bsp::gpio &boot_sel_0)
Construct a new fpga::fpga object and disables it to ensure now excess power is accidentally used dur...
Definition
fpga.cpp:49
satnogs::comms::lib::fpga::get_boot_mode
boot_mode get_boot_mode() const
Definition
fpga.cpp:164
satnogs::comms::lib::fpga::reg
reg
Definition
fpga.hpp:36
satnogs::comms::lib::fpga::reg::version
@ version
Definition
fpga.hpp:38
satnogs::comms::lib::fpga::reg::status
@ status
Definition
fpga.hpp:39
satnogs::comms::lib::fpga::set_boot_mode
void set_boot_mode(boot_mode mode)
Definition
fpga.cpp:133
satnogs::comms::lib::fpga::read_reg
uint32_t read_reg(uint32_t reg)
Definition
fpga.cpp:107
satnogs::comms::lib::fpga::hw
hw
Definition
fpga.hpp:43
satnogs::comms::lib::fpga::hw::ALINX_AC7Z020
@ ALINX_AC7Z020
Definition
fpga.hpp:45
satnogs::comms::lib::fpga::hw::LIBREWAVE
@ LIBREWAVE
Definition
fpga.hpp:46
satnogs::comms::lib::fpga::hw::NONE
@ NONE
Definition
fpga.hpp:44
satnogs::comms::lib::fpga::write_reg
void write_reg(uint32_t reg, uint32_t val)
Definition
fpga.cpp:101
satnogs::comms::lib::fpga::enable
void enable(bool en=true)
Enable/disable the FPGA subsystem.
Definition
fpga.cpp:83
satnogs::comms::lib::fpga::get_fpga_done
bool get_fpga_done() const
Definition
fpga.cpp:127
satnogs::comms::lib::fpga::enabled
bool enabled() const
Returns the state of the FPGA.
Definition
fpga.cpp:95
satnogs::comms::lib::power
Manages power supplies and monitors subsystem status.
Definition
power.hpp:43
gpio.hpp
satnogs::comms::lib
Definition
ad8318.hpp:30
satnogs::comms::fpga_done
const struct gpio_dt_spec fpga_done
Definition
startup.cpp:46
power.hpp
spi.hpp
libsatnogs-comms
include
satnogs-comms-lib
fpga.hpp
Generated by
1.17.0