Skip to content

Commit

Permalink
usbBlaster: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
trabucayre committed Jul 30, 2023
1 parent 75d98d1 commit 2f8056c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/usbBlaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <vector>

#include "display.hpp"
#include "usbBlaster.hpp"
#include "ftdipp_mpsse.hpp"
#include "fx2_ll.hpp"
#include "usbBlaster.hpp"

using namespace std;

Expand All @@ -39,7 +39,7 @@ using namespace std;

UsbBlaster::UsbBlaster(const cable_t &cable, const std::string &firmware_path,
int8_t verbose):
_verbose(verbose>1), _nb_bit(0),
_verbose(verbose > 1), _nb_bit(0),
_curr_tms(0), _buffer_size(64)
{
if (cable.pid == 0x6001)
Expand Down Expand Up @@ -211,7 +211,7 @@ int UsbBlaster::writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool end)
int num_read = _nb_bit;
if (writeBit((rx)? rx_ptr:NULL, num_read/2) < 0)
return -EXIT_FAILURE;
if (rx) // realign bits
if (rx) // realign bits
*rx_ptr >>= (8 - nb_bit);
}

Expand All @@ -223,7 +223,7 @@ int UsbBlaster::writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool end)
mask |= _tdi_pin;
_in_buf[_nb_bit++] = mask;
_in_buf[_nb_bit++] = mask | mode | _tck_pin;
uint8_t tmp;
uint8_t tmp = 0;
if (writeBit((rx)? &tmp:NULL, 1) < 0)
return -EXIT_FAILURE;
if (rx)
Expand Down
14 changes: 5 additions & 9 deletions src/usbBlaster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
* Copyright (C) 2020 Gwenhael Goavec-Merou <[email protected]>
*/

#ifndef USBBLASTER_H
#define USBBLASTER_H
#ifndef SRC_USBBLASTER_HPP_
#define SRC_USBBLASTER_HPP_
#include <ftdi.h>
#include <iostream>
#include <string>
#include <vector>

#include "cable.hpp"
#include "jtagInterface.hpp"
#include "ftdipp_mpsse.hpp"
#include "fx2_ll.hpp"
#include "jtagInterface.hpp"

/*!
* \file UsbBlaster.hpp
Expand Down Expand Up @@ -111,11 +111,7 @@ class UsbBlasterI: public UsbBlaster_ll {
int write(uint8_t *wr_buf, int wr_len,
uint8_t *rd_buf, int rd_len) override;
private:
/*
* \brief init and configure FT245
*/
void init_internal();
struct ftdi_context *_ftdi; /*!< ftid_context */
struct ftdi_context *_ftdi; /*!< ftdi_context */
};

/*!
Expand All @@ -136,4 +132,4 @@ class UsbBlasterII: public UsbBlaster_ll {
private:
FX2_ll *fx2;
};
#endif
#endif // SRC_USBBLASTER_HPP_

0 comments on commit 2f8056c

Please sign in to comment.