File: utilities.h

package info (click to toggle)
xc3sprog 0%2Bsvn795%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 8,800 kB
  • sloc: cpp: 15,983; ansic: 849; vhdl: 410; makefile: 3
file content (55 lines) | stat: -rw-r--r-- 1,112 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <sys/time.h>
#include <memory>
#include <vector>
#include "bitfile.h"

#include "devicedb.h"
#include "jtag.h"
#include "cabledb.h"

class DeviceDB;


void detect_chain(Jtag *jtag, DeviceDB *db);
int getIO(std::auto_ptr<IOBase> *io, struct cable_t*,
          char const *dev, const char *serial, bool verbose, bool ftd2xx,
          unsigned int freq);
const char *getCableName(int type);
void xc3sprog_Usleep(unsigned int usec);

#define OSNAME_LEN	64
void get_os_name(char *buf, int buflen);


/* Split string on delimiting character. */
std::vector<std::string> splitString(const std::string& s, char delim);


/* Utility class for measuring execution times. */
class Timer
{
 private:
  struct timeval m_tv;

 public:
  // Construct and start timer.
  Timer()
  {
    start();
  }

  // Restart timer from zero.
  void start()
  {
    gettimeofday(&m_tv, NULL);
  }

  // Return number of seconds elapsed since starting the timer.
  double elapsed() const
  {
    struct timeval t;
    gettimeofday(&t, NULL);
    return t.tv_sec + 1.0e-6 * t.tv_usec - m_tv.tv_sec - 1.0e-6 * m_tv.tv_usec;
  }
};