epcq: add verbose mode
This commit is contained in:
parent
7b4b2cbadf
commit
d936b09d77
23
epcq.cpp
23
epcq.cpp
|
|
@ -160,11 +160,13 @@ void EPCQ::program(unsigned int start_offset, string filename, bool reverse)
|
||||||
erase_sector(start_sector, (char)nb_sect);
|
erase_sector(start_sector, (char)nb_sect);
|
||||||
|
|
||||||
/* now start programming */
|
/* now start programming */
|
||||||
printf("program in ");
|
if (_verbose) {
|
||||||
if (reverse)
|
printf("program in ");
|
||||||
printf("reverse mode\n");
|
if (reverse)
|
||||||
else
|
printf("reverse mode\n");
|
||||||
printf("direct mode\n");
|
else
|
||||||
|
printf("direct mode\n");
|
||||||
|
}
|
||||||
buffer[0] = WR_BYTES_REG;
|
buffer[0] = WR_BYTES_REG;
|
||||||
for (i= 0; i < nb_iter; i++) {
|
for (i= 0; i < nb_iter; i++) {
|
||||||
do_write_enable();
|
do_write_enable();
|
||||||
|
|
@ -240,17 +242,20 @@ short EPCQ::detect()
|
||||||
tx_buf[0] = 0x9f;
|
tx_buf[0] = 0x9f;
|
||||||
/* 1 cmd byte + 2 dummy_byte */
|
/* 1 cmd byte + 2 dummy_byte */
|
||||||
_spi.ft2232_spi_wr_then_rd(tx_buf, 3, &_device_id, 1);
|
_spi.ft2232_spi_wr_then_rd(tx_buf, 3, &_device_id, 1);
|
||||||
printf("device id 0x%x attendu 0x15\n", _device_id);
|
if (_verbose)
|
||||||
|
printf("device id 0x%x attendu 0x15\n", _device_id);
|
||||||
/* read EPCQ silicon id */
|
/* read EPCQ silicon id */
|
||||||
tx_buf[0] = 0xAB;
|
tx_buf[0] = 0xAB;
|
||||||
/* 1 cmd byte + 3 dummy_byte */
|
/* 1 cmd byte + 3 dummy_byte */
|
||||||
_spi.ft2232_spi_wr_then_rd(tx_buf, 4, &_silicon_id, 1);
|
_spi.ft2232_spi_wr_then_rd(tx_buf, 4, &_silicon_id, 1);
|
||||||
printf("silicon id 0x%x attendu 0x14\n", _silicon_id);
|
if (_verbose)
|
||||||
|
printf("silicon id 0x%x attendu 0x14\n", _silicon_id);
|
||||||
return (_device_id << 8) | _silicon_id;
|
return (_device_id << 8) | _silicon_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
EPCQ::EPCQ(int vid, int pid, unsigned char interface, uint32_t clkHZ):
|
EPCQ::EPCQ(int vid, int pid, unsigned char interface, uint32_t clkHZ,
|
||||||
_spi(vid, pid, interface, clkHZ)
|
bool verbose):
|
||||||
|
_spi(vid, pid, interface, clkHZ, verbose)
|
||||||
{
|
{
|
||||||
unsigned char mode = 0;
|
unsigned char mode = 0;
|
||||||
|
|
||||||
|
|
|
||||||
4
epcq.hpp
4
epcq.hpp
|
|
@ -5,7 +5,8 @@ using namespace std;
|
||||||
|
|
||||||
class EPCQ {
|
class EPCQ {
|
||||||
public:
|
public:
|
||||||
EPCQ(int vid, int pid, unsigned char interface, uint32_t clkHZ);
|
EPCQ(int vid, int pid, unsigned char interface, uint32_t clkHZ,
|
||||||
|
bool verbose = false);
|
||||||
~EPCQ();
|
~EPCQ();
|
||||||
|
|
||||||
short detect();
|
short detect();
|
||||||
|
|
@ -28,6 +29,7 @@ class EPCQ {
|
||||||
|
|
||||||
unsigned char _device_id;
|
unsigned char _device_id;
|
||||||
unsigned char _silicon_id;
|
unsigned char _silicon_id;
|
||||||
|
bool _verbose;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
uint32_t _freq_hz;
|
uint32_t _freq_hz;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue