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>
|
|
|
|
|
*/
|
|
|
|
|
|
2021-07-08 20:51:51 +02:00
|
|
|
#ifndef SRC_EPCQ_HPP_
|
|
|
|
|
#define SRC_EPCQ_HPP_
|
|
|
|
|
|
2023-04-19 22:27:09 +02:00
|
|
|
#include <cstdint>
|
2019-09-26 18:29:20 +02:00
|
|
|
#include <iostream>
|
|
|
|
|
#include <vector>
|
2023-04-19 22:27:09 +02:00
|
|
|
|
2021-07-08 20:51:51 +02:00
|
|
|
#include "spiInterface.hpp"
|
|
|
|
|
#include "spiFlash.hpp"
|
|
|
|
|
|
2019-09-26 18:29:20 +02:00
|
|
|
using namespace std;
|
|
|
|
|
|
2021-07-08 20:51:51 +02:00
|
|
|
class EPCQ: public SPIFlash {
|
2019-09-26 18:29:20 +02:00
|
|
|
public:
|
2021-12-22 19:11:35 +01:00
|
|
|
EPCQ(SPIInterface *spi, bool unprotect_flash, int8_t verbose);
|
2019-09-26 18:29:20 +02:00
|
|
|
~EPCQ();
|
|
|
|
|
|
2021-07-08 20:51:51 +02:00
|
|
|
void read_id() override;
|
2019-09-26 18:29:20 +02:00
|
|
|
|
2021-12-22 19:11:35 +01:00
|
|
|
void reset() override;
|
|
|
|
|
|
2021-07-08 20:51:51 +02:00
|
|
|
/* not supported */
|
|
|
|
|
void power_up() override {}
|
|
|
|
|
void power_down() override {}
|
2019-09-26 18:29:20 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
unsigned char convertLSB(unsigned char src);
|
|
|
|
|
|
|
|
|
|
/* trash */
|
|
|
|
|
void dumpJICFile(char *jic_file, char *out_file, size_t max_len);
|
|
|
|
|
|
|
|
|
|
unsigned char _device_id;
|
|
|
|
|
unsigned char _silicon_id;
|
|
|
|
|
};
|
2021-07-08 20:51:51 +02:00
|
|
|
|
|
|
|
|
#endif // SRC_EPCQ_HPP_
|