Skip to content

Commit 2f8056c

Browse files
committed
usbBlaster: cleanup
1 parent 75d98d1 commit 2f8056c

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

src/usbBlaster.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010
#include <iostream>
1111
#include <map>
12-
#include <vector>
1312
#include <string>
13+
#include <vector>
1414

1515
#include "display.hpp"
16-
#include "usbBlaster.hpp"
1716
#include "ftdipp_mpsse.hpp"
1817
#include "fx2_ll.hpp"
18+
#include "usbBlaster.hpp"
1919

2020
using namespace std;
2121

@@ -39,7 +39,7 @@ using namespace std;
3939

4040
UsbBlaster::UsbBlaster(const cable_t &cable, const std::string &firmware_path,
4141
int8_t verbose):
42-
_verbose(verbose>1), _nb_bit(0),
42+
_verbose(verbose > 1), _nb_bit(0),
4343
_curr_tms(0), _buffer_size(64)
4444
{
4545
if (cable.pid == 0x6001)
@@ -211,7 +211,7 @@ int UsbBlaster::writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool end)
211211
int num_read = _nb_bit;
212212
if (writeBit((rx)? rx_ptr:NULL, num_read/2) < 0)
213213
return -EXIT_FAILURE;
214-
if (rx) // realign bits
214+
if (rx) // realign bits
215215
*rx_ptr >>= (8 - nb_bit);
216216
}
217217

@@ -223,7 +223,7 @@ int UsbBlaster::writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool end)
223223
mask |= _tdi_pin;
224224
_in_buf[_nb_bit++] = mask;
225225
_in_buf[_nb_bit++] = mask | mode | _tck_pin;
226-
uint8_t tmp;
226+
uint8_t tmp = 0;
227227
if (writeBit((rx)? &tmp:NULL, 1) < 0)
228228
return -EXIT_FAILURE;
229229
if (rx)

src/usbBlaster.hpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
* Copyright (C) 2020 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
44
*/
55

6-
#ifndef USBBLASTER_H
7-
#define USBBLASTER_H
6+
#ifndef SRC_USBBLASTER_HPP_
7+
#define SRC_USBBLASTER_HPP_
88
#include <ftdi.h>
99
#include <iostream>
1010
#include <string>
1111
#include <vector>
1212

1313
#include "cable.hpp"
14-
#include "jtagInterface.hpp"
1514
#include "ftdipp_mpsse.hpp"
1615
#include "fx2_ll.hpp"
16+
#include "jtagInterface.hpp"
1717

1818
/*!
1919
* \file UsbBlaster.hpp
@@ -111,11 +111,7 @@ class UsbBlasterI: public UsbBlaster_ll {
111111
int write(uint8_t *wr_buf, int wr_len,
112112
uint8_t *rd_buf, int rd_len) override;
113113
private:
114-
/*
115-
* \brief init and configure FT245
116-
*/
117-
void init_internal();
118-
struct ftdi_context *_ftdi; /*!< ftid_context */
114+
struct ftdi_context *_ftdi; /*!< ftdi_context */
119115
};
120116

121117
/*!
@@ -136,4 +132,4 @@ class UsbBlasterII: public UsbBlaster_ll {
136132
private:
137133
FX2_ll *fx2;
138134
};
139-
#endif
135+
#endif // SRC_USBBLASTER_HPP_

0 commit comments

Comments
 (0)