SXXXXXXX_PyDownloadFwViaSRIO/_OLD/Vecchia_app/FpgaBeamMeUp/fpgaflashconfig.h
2026-01-22 17:10:05 +01:00

192 lines
6.3 KiB
C++

/*
* fpgaflashconfig.h
*
*
* author: Luca Vallongo
*
*/
#ifndef FPGAFLASHCONFIG_H
#define FPGAFLASHCONFIG_H
//TEST PARAMETERS
//#define NUM_BLOCKS_ERASE 2
//#define DIM_FILE_WRITE 131072
//number of flash present into system
#define NUM_FLASH 10
//number of Counter repeat before reset
#define MAX_COUNTER_REPEAT 10
//Software Reset Register (SRR)
#define SRR_KEYCODE 0x12ABCDEF
//timeout for spi comunication
#define TIMEOUT_SPI 2000
#define TIMEOUT_RFIF_ESPONSE 2000
#define WAIT_TIME_AFTER_WR 0 //wait after write
#define WAIT_TIME_BEFORE_RD 5 //wait before read ATTENZIONE NON USATO
#define WAIT_TIME_AFTER_RD 0 //wait after read ATTENZIONE INCIDE TANTO SULLE PRESTAZIONI
#define WAIT_TIME_BEFORE_NEW_RD 5 //wait before new read, in case of repeat read
#define WAIT_TIME_BETWEEN_2_OP 0 //wait between two basic operation
#define WAIT_TIME_BETWEEN_2_MACRO 0 //wait between two macro operation(for example, between erase and confirm)
#define WAIT_TIME_INIT_OPERATION 100 //wait for reset, read flash id, set SQPI
/*#define WAIT_TIME_AFTER_WR 0 //wait after write
#define WAIT_TIME_BEFORE_RD 5 //wait before read
#define WAIT_TIME_AFTER_RD 0 //wait after read
#define WAIT_TIME_BEFORE_NEW_RD 5 //wait before new read, in case of repeat read
#define WAIT_TIME_BETWEEN_2_OP 0 //wait between two basic operation
#define WAIT_TIME_BETWEEN_2_MACRO 0 //wait between two macro operation(for example, between erase and confirm)
#define WAIT_TIME_INIT_OPERATION 100 //wait for reset, read flash id, set SQPI*/
//RFIF
#define WAIT_TIME_BEFORE_REQUEST_RESPONSE 1000
#define WAIT_TIME_BETWEEN_RFIF_GET_STATUS 5000 //wait for repeat rfif gets status
#define WAIT_TIME_BETWEEN_RFIF_ERASE 3000 //wait for repeat rfif erase
#define WAIT_TIME_RFIF_ERASE_BLOCK 10 //wait for repeat rfif erase block
#define WAIT_TIME_RFIF_WRITE_BLOCK 1 //wait for repeat rfif write
#define WAIT_TIME_RFIF_READ_BLOCK 1 //wait for repeat rfif read
#define NUM_REPEAT_RFIF_GET_STATUS 3 //number of repeat get rfif status
#define NUM_REPEAT_RFIF_ERASE 4 //number of repeat rfif erase
#define NUM_REPEAT_RFIF_WRITE 5 //number of repeat rfif erase
#define NUM_REPEAT_RFIF_READ 6 //number of repeat rfif erase
#define NUM_REPEAT_READ 3 //number of repeat to read on tftp before error on tftp
#define NUM_REPEAT_WRITE 3 //number of repeat to read on tftp before error on tftp
//base address for interface
#define BASE_ADDRESS_IF 0x47000000
//base address for ddr memory for test
#define BASE_ADDRESS_MEM 0xA0000000
//if define NO_WRITE_ERASE, the app doesn't erase and write the flash
//#define NO_WRITE_ERASE //comment this line for enable write/erase flash memory
// FPGA(s)
#define I2C_FPGA1_ADD 0x60
#define I2C_FPGA2_ADD 0x61
#define FPGA_C_MEM_SLOT_ADD 0x44000000 // Carrier
#define FPGA_C_MEM_WR_ADD 0x44000780 // Carrier
#define FPGA_C_MEM_RD_ADD 0x44000800 // Carrier
#define FPGA_Z_MEM_SLOT_ADD 0x500E0000 // ZYNQ
#define FPGA_Z_MEM_WR_ADD 0x500E0780 // ZYNQ
#define FPGA_Z_MEM_RD_ADD 0x500E0800 // ZYNQ
#define FPGA_FW_PAGE_SIZE 256 // Page size for firmware download [bytes]
#define FLASH_SECTOR_DIM 64 //kbytes, dimension of one sector of the flash
#define FLASH_128Mbit 128
#define FLASH_256Mbit 256
#define DIM_DATA_BUFFER FPGA_FW_PAGE_SIZE
#include <grifo_fw_map.h>
//RFIF FPGA
#define AESA_TX_SIZE_DEF grifo_fw::AESA_TX_SIZE
#define AESA_RX_SIZE_DEF grifo_fw::AESA_RX_SIZE
#define AESA_TX_ADDRESS grifo_fw::AESA_TX_A
#define AESA_RX_ADDRESS grifo_fw::AESA_RX_A
#define FPGA_SRIO_NODE_ID_AESA grifo_fw::FPGA_SRIO_NODE_ID
#define DSP_ETHERNET_IP "192.168.2.101"
#include <QTreeWidgetItem>
//3 types of flash, different characteristics
enum flash_type_t
{
flash_type_xcku040,
flash_type_xcku060,
flash_type_xc7a200,
flash_type_rfif
};
//two different flash area
enum flash_firmware_area_t
{
flash_firmware_area_golden, //not writeable without confirm
flash_firmware_area_user //usualy writeable area
};
/*
class TgtMatch
{
public:
QString appName;
QString slotAddress;
QString archName;
QString description;
QString tgtName;
QString partName;
QString matchStr;
QString address_start_area; //hex address, start fimware area
QString address_stop_area; //hex address, stop fimware area
flash_firmware_area_t firmware_area; //golden/user FW
flash_type_t type; //xcku040, xcku060, xc7a200
reg_moder_byteaddress_t byteaddress ; //3/4 byte address
reg_moder_qspiport_t spiPort; //use primary/secondary SPI interface port
QString tgtSection; //target section into config file
QString ip;
unsigned int port;
QRegExp rexp;
QTreeWidgetItem* wi;
};
class TgtMatchSet
{
public:
QList<TgtMatch> db;
TgtMatch* add(
const QString& aName,
const QString& sName,
const QString& tName,
const QString& pName,
const QString& namePrefix,
const QString& descr,
const QString& arch,
const QString& _address_start_area,
const QString& _address_stop_area,
const flash_firmware_area_t& _firmware_area,
const flash_type_t& _type,
const reg_moder_byteaddress_t& _byteaddress,
const reg_moder_qspiport_t& _spiPort,
const QString& _ip,
const unsigned int& _port,
const QString & _tgtSection
);
const TgtMatch* lookup(const QString& fname);
const TgtMatch* lookupArch(const QString& arc);
TgtMatch* lookupCSCI(const QString& fname, const QString sAddr);
const TgtMatch* lookupTgtSection(QString _tgtSection);
const TgtMatch* lookupAppName(const QString& fname);
};*/
#endif // FPGAFLASHCONFIG_H