openFPGALoader/src/xilinx.hpp

51 lines
1.4 KiB
C++
Raw Normal View History

2021-06-26 15:24:07 +02:00
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright (C) 2019 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
*/
2019-09-26 18:29:20 +02:00
#ifndef XILINX_HPP
#define XILINX_HPP
#include <string>
2021-02-04 07:29:35 +01:00
#include "configBitstreamParser.hpp"
2019-09-26 18:29:20 +02:00
#include "device.hpp"
#include "jtag.hpp"
#include "spiInterface.hpp"
2019-09-26 18:29:20 +02:00
class Xilinx: public Device, SPIInterface {
2019-09-26 18:29:20 +02:00
public:
Xilinx(Jtag *jtag, const std::string &filename,
const std::string &file_type,
Device::prog_type_t prg_type,
std::string device_package,
bool verify, int8_t verbose);
2019-09-26 18:29:20 +02:00
~Xilinx();
void program(unsigned int offset = 0) override;
2021-02-04 07:29:35 +01:00
void program_spi(ConfigBitstreamParser * bit, unsigned int offset = 0);
void program_mem(ConfigBitstreamParser *bitfile);
2021-06-25 11:28:19 +02:00
bool dumpFlash(const std::string &filename,
uint32_t base_addr, uint32_t len);
2020-08-19 16:57:07 +02:00
int idCode() override;
void reset() override;
/* spi interface */
int spi_put(uint8_t cmd, uint8_t *tx, uint8_t *rx,
uint32_t len) override;
int spi_put(uint8_t *tx, uint8_t *rx, uint32_t len) override;
int spi_wait(uint8_t cmd, uint8_t mask, uint8_t cond,
uint32_t timeout, bool verbose = false) override;
private:
2021-06-25 11:28:19 +02:00
/*!
* \brief with xilinx devices SPI flash direct access is not possible
* so a bridge must be loaded in RAM to access flash
* \return false if missing device mode, true otherwise
*/
bool load_bridge();
std::string _device_package;
2019-09-26 18:29:20 +02:00
};
#endif