Commit 556915bc authored by Leon Hiemstra's avatar Leon Hiemstra

added UPE (legacy) registers for service port access

parent 22b5eaf1
......@@ -136,7 +136,7 @@ bool Periph_system::read_system_info(ostringstream& strs)
sprintf(str,"Firmware version = %d.%d\n",firmware_version,firmware_subversion); strs << str;
sprintf(str,"Hardware version = %d\n",hardware_version); strs << str;
if(design_name == my_expected_design_name && firmware_version == my_expected_firmware_version) {
if(design_name == my_expected_design_name && firmware_version >= my_expected_firmware_version) {
my_current_status = "online";
retval = true;
} else {
......@@ -311,7 +311,9 @@ RegisterMap Periph_system::read_reg_map(void)
cout << "Periph_system::read_reg_map:\n" << reg_map_str << endl;
delete[] data;
istringstream iss_regmap(reg_map_str);
return ccfg_to_regmap(iss_regmap);
istringstream iss_regmap_step1(reg_map_str);
istringstream iss_regmap_step2(reg_map_str);
reg = ccfg_to_regmap(iss_regmap_step1);
return ccfg_upe_to_regmap_add(iss_regmap_step2, reg);
}
......@@ -144,6 +144,7 @@ void control_server(TCPSSocket *sock, const int clientId, std::atomic<size_t> *n
quit = true;
} else if(cmdstatus.status == CMD_REQUEST_SIGHUP) {
raise(SIGHUP);
cmdstatus.status = CMD_STATUS_OK;
}
}
}
......
......@@ -171,6 +171,185 @@ RegisterMap ccfg_to_regmap(std::istringstream& iss)
return regmap;
}
RegisterMap ccfg_upe_to_regmap_add(std::istringstream& iss, RegisterMap &regmap)
{
ostringstream err_str;
// # peripheral=system start=0x0000 span=0x0080 count=01 idx=0 stop=0x0080
#define RE_CCFG_UPE_LINE_peripheral "^#\\s*peripheral=\\w+\\s+start=0x\\S+\\s+span=0x\\S+\\s+\\S+\\s+\\S+\\s+\\S+$"
// # REG-SLAVE=pio_system_info no.slaves=1 len=1 (base=0x80)
#define RE_CCFG_UPE_LINE_REG_SLAVE "^#\\s*REG-SLAVE=\\w+\\s+no.slaves=\\S+\\s+len=\\S+\\s+\\S+$"
// # RAM-SLAVE=avs_eth_0_ram
#define RE_CCFG_UPE_LINE_RAM_SLAVE "^#\\s*RAM-SLAVE=\\w+\\s+$"
// # FIFO-SLAVE=not_seen_any_yet
#define RE_CCFG_UPE_LINE_FIFO_SLAVE "^#\\s*FIFO-SLAVE=\\w+\\s+$"
boost::regex spaces_re, peripheral_re, REG_SLAVE_re, RAM_SLAVE_re, FIFO_SLAVE_re;
boost::cmatch matches;
spaces_re = string("^\\s*$");
peripheral_re = string(RE_CCFG_UPE_LINE_peripheral);
REG_SLAVE_re = string(RE_CCFG_UPE_LINE_REG_SLAVE);
RAM_SLAVE_re = string(RE_CCFG_UPE_LINE_RAM_SLAVE);
FIFO_SLAVE_re = string(RE_CCFG_UPE_LINE_FIFO_SLAVE);
uint peripheral_addr, peripheral_span, stage = 0;
char line[250];
while(iss.getline(line, sizeof(line))) {
if (regex_match(line, spaces_re)) {
cout << "ccfg_upe_to_regmap_add match: spaces ok" << endl;
} else if (regex_match(line, peripheral_re)) {
cout << "ccfg_upe_to_regmap_add match: RE_CCFG_UPE_LINE_peripheral ok" << endl;
stringstream ss(line);
string prefx;
char c;
// # peripheral=system start=0x0000 span=0x0080 count=01 idx=0 stop=0x0080
ss >> c; // #
ss >> prefx;
ss >> c; // s
ss >> c; // t
ss >> c; // a
ss >> c; // r
ss >> c; // t
ss >> c; // =
ss >> hex >> peripheral_addr; // in dword addresses
ss >> c; // 's'
ss >> c; // 'p'
ss >> c; // 'a'
ss >> c; // 'n'
ss >> c; // '='
ss >> hex >> peripheral_span; // in dwords
stage = 1;
if (ss.fail() || ss.bad()) {
cerr << "ccfg_upe_to_regmap_add: invalid peripheral base/span" << endl;
} else {
//regmap.add_register("mm/"+peripheral+"/"+regname+"/"+regfield,base,span,0xffffffff,0,perm);
cout << "ccfg_upe_to_regmap_add: base=0x"
<< hex << peripheral_addr << " span=0x" << hex << peripheral_span << endl;
}
} else if (regex_match(line, REG_SLAVE_re)) {
cout << "ccfg_upe_to_regmap_add match: RE_CCFG_UPE_LINE_REG_SLAVE ok" << endl;
stringstream ss(line);
string peripheral;
char c;
// # REG-SLAVE=pio_system_info no.slaves=1 len=1 (base=0x80)
ss >> c; // #
ss >> c; // R
ss >> c; // E
ss >> c; // G
ss >> c; // -
ss >> c; // S
ss >> c; // L
ss >> c; // A
ss >> c; // V
ss >> c; // E
ss >> c; // =
ss >> peripheral;
if (ss.fail() || ss.bad()) {
cerr << "ccfg_upe_to_regmap_add: invalid peripheral name" << endl;
} else {
transform(peripheral.begin(), peripheral.end(), peripheral.begin(), ::toupper);
cout << "ccfg_upe_to_regmap_add: peripheral=" << peripheral << endl;
if(stage == 1) {
regmap.add_register("mm/"+peripheral,peripheral_addr,peripheral_span,
0xffffffff,0,"RW");
}
}
stage = 0;
} else if (regex_match(line, RAM_SLAVE_re)) {
cout << "ccfg_upe_to_regmap_add match: RE_CCFG_UPE_LINE_RAM_SLAVE ok" << endl;
stringstream ss(line);
string peripheral;
char c;
// # RAM-SLAVE=avs_eth_0_ram
ss >> c; // #
ss >> c; // R
ss >> c; // A
ss >> c; // M
ss >> c; // -
ss >> c; // S
ss >> c; // L
ss >> c; // A
ss >> c; // V
ss >> c; // E
ss >> c; // =
ss >> peripheral;
if (ss.fail() || ss.bad()) {
cerr << "ccfg_upe_to_regmap_add: invalid peripheral name" << endl;
} else {
transform(peripheral.begin(), peripheral.end(), peripheral.begin(), ::toupper);
cout << "ccfg_upe_to_regmap_add: peripheral=" << peripheral << endl;
if(stage == 1) {
regmap.add_register("mm/"+peripheral,peripheral_addr,peripheral_span,
0xffffffff,0,"RW");
}
}
stage = 0;
} else if (regex_match(line, FIFO_SLAVE_re)) {
cout << "ccfg_upe_to_regmap_add match: RE_CCFG_UPE_LINE_FIFO_SLAVE ok" << endl;
stringstream ss(line);
string peripheral;
char c;
// # FIFO-SLAVE=not_seen_any_yet
ss >> c; // #
ss >> c; // F
ss >> c; // I
ss >> c; // F
ss >> c; // O
ss >> c; // -
ss >> c; // S
ss >> c; // L
ss >> c; // A
ss >> c; // V
ss >> c; // E
ss >> c; // =
ss >> peripheral;
if (ss.fail() || ss.bad()) {
cerr << "ccfg_upe_to_regmap_add: invalid peripheral name" << endl;
} else {
transform(peripheral.begin(), peripheral.end(), peripheral.begin(), ::toupper);
cout << "ccfg_upe_to_regmap_add: peripheral=" << peripheral << endl;
if(stage == 1) {
regmap.add_register("mm/"+peripheral,peripheral_addr,peripheral_span,
0xffffffff,0,"RW");
}
}
stage = 0;
} else {
cerr << "ccfg_upe_to_regmap_add: error! illegal line: [" << line << "]" << endl;
}
}
cout << "regmap:" << endl;
regmap.print_screen();
return regmap;
}
/*
* Some help on REGEX's
......
......@@ -34,5 +34,6 @@
namespace ublas = boost::numeric::ublas;
RegisterMap ccfg_to_regmap(std::istringstream& iss);
RegisterMap ccfg_upe_to_regmap_add(std::istringstream& iss, RegisterMap& reg);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment