TapascoStatusScreen.hpp 2.34 KB
Newer Older
1
/**
2
3
 *  @file	TapascoStatusScreen.hpp
 *  @brief	Kernel map screen for tapasco-debug.
4
5
 *  @author	J. Korinth, TU Darmstadt (jk@esa.cs.tu-darmstadt.de)
 **/
6
7
#ifndef __TAPASCO_STATUS_SCREEN_HPP__
#define __TAPASCO_STATUS_SCREEN_HPP__
8

9
#include <tapasco_api.hpp>
10
11
#include <platform_api.h>
#include "MenuScreen.hpp"
12
using namespace tapasco;
13

14
class TapascoStatusScreen: public MenuScreen {
15
public:
16
  TapascoStatusScreen(Tapasco *tapasco): MenuScreen("", vector<string>()) {
17
18
    delay_us = 10000;
  }
19
  virtual ~TapascoStatusScreen() {}
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
56
57
58
59
60
61
62
63
64
65
66
67
protected:
  virtual void render() {
    const int col_d = 16; //(cols - 4) / 4;
    int start_c = (cols - 4 * col_d) / 2;
    int start_r = (rows - 6 - 32) / 2;
    const string t = "Current Bitstream Kernel Map (via TPC Status Core)";
    mvprintw(start_r, (cols - t.length()) / 2, t.c_str());
    for (int col = 0; col < 4; ++col) {
      for (int row = 0; row < 32; ++row) {
        attron(A_REVERSE);
	mvprintw(start_r + 2 + row, start_c + col * col_d, "%03d:", col * 32 + row);
	attroff(A_REVERSE);
        if (id[col * 32 + row] > 0 && id[col * 32 + row] != 0xDEADBEEF)
          mvprintw(start_r + 2 + row, start_c + 4 + col * col_d, " 0x%08x", id[col * 32 + row]);
	else
          mvprintw(start_r + 2 + row, start_c + 4 + col * col_d, "           ", col * 32 + row);
      }
    }
    attron(A_REVERSE);
    mvprintw(start_r + 35, (cols - 17) / 2, "#intc: %10u", intcs);
    attroff(A_REVERSE);
    mvprintw(start_r + 37, (cols - text_press_key.length()) / 2, text_press_key.c_str());
  }

  virtual void update() {
    const platform::platform_ctl_addr_t status =
        platform::platform_address_get_special_base(platform::PLATFORM_SPECIAL_CTL_STATUS);
    for (int s = 0; s < 128; ++s) {
      if (platform::platform_read_ctl(status + 0x100 + s * 0x10, 4, &id[s],
          platform::PLATFORM_CTL_FLAGS_NONE) != platform::PLATFORM_SUCCESS)
        id[s] = 0xDEADBEEF;
    }
    if (platform::platform_read_ctl(status + 0x04, 4, &intcs,
        platform::PLATFORM_CTL_FLAGS_NONE) != platform::PLATFORM_SUCCESS)
      intcs = 0;
  }

  virtual int perform(const int choice) {
    if (choice == ERR) delay();
    return choice;
  }

private:
  uint32_t id[128];
  uint32_t intcs;
  const string text_press_key { "--- press any key to exit ---" };
};

68
#endif /* __TAPASCO_STATUS_SCREEN_HPP__ */
69
/* vim: set foldmarker=@{,@} foldlevel=0 foldmethod=marker : */