Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert egrep to grep #4

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ language: c
dist: trusty
sudo: required
env:
- CPU=ka10 TYPE340=0
- CPU=ka10 TYPE340=1
- CPU=ki10 TYPE340=0
- CPU=pdp10-ka
- CPU=pdp10-ki
install: sh -ex dependencies.sh install_linux
script: make $CPU TYPE340=$TYPE340
script: make $CPU
notifications:
email: [email protected]
63 changes: 37 additions & 26 deletions PDP10/ka10_ten11.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ static uint64 ten11_pager[256];
t_addr ten11_base = 03000000;
t_addr ten11_end = 04000000;

/* Number of Unibuses. */
#define UNIBUSES 8

/* Physical address of 10-11 control page. */
#define T11CPA 0776000 //Offset inside TEN11 moby.

Expand Down Expand Up @@ -116,8 +119,8 @@ DEVICE ten11_dev = {
&ten11_description, /* description */
};

static TMLN ten11_ldsc; /* line descriptor */
static TMXR ten11_desc = { 1, 0, 0, &ten11_ldsc }; /* mux descriptor */
static TMLN ten11_ldsc[UNIBUSES]; /* line descriptor */
static TMXR ten11_desc = { 8, 0, 0, ten11_ldsc }; /* mux descriptor */

static t_stat ten11_reset (DEVICE *dptr)
{
Expand Down Expand Up @@ -175,14 +178,20 @@ static void build (unsigned char *request, unsigned char octet)

static t_stat ten11_svc (UNIT *uptr)
{
int i;
tmxr_poll_rx (&ten11_desc);
if (ten11_ldsc.rcve && !ten11_ldsc.conn) {
ten11_ldsc.rcve = 0;
tmxr_reset_ln (&ten11_ldsc);

for (i = 0; i < UNIBUSES; i++) {
if (ten11_ldsc[i].rcve && !ten11_ldsc[i].conn) {
ten11_ldsc[i].rcve = 0;
tmxr_reset_ln (&ten11_ldsc[i]);
}
}
if (tmxr_poll_conn(&ten11_desc) >= 0) {

i = tmxr_poll_conn(&ten11_desc);
if (i >= 0) {
sim_debug(DBG_CMD, &ten11_dev, "got connection\n");
ten11_ldsc.rcve = 1;
ten11_ldsc[i].rcve = 1;
uptr->wait = TEN11_POLL;
}
sim_clock_coschedule (uptr, uptr->wait);
Expand Down Expand Up @@ -214,38 +223,40 @@ static const char *ten11_description (DEVICE *dptr)
return "Rubin PDP-10 to PDP-11 interface";
}

static int error (const char *message)
static int error (int unibus, const char *message)
{
sim_debug (DBG_TRC, &ten11_dev, "%s\r\n", message);
sim_debug (DBG_TRC, &ten11_dev, "Port %d: %s\r\n", unibus, message);
sim_debug (DBG_TRC, &ten11_dev, "CLOSE\r\n");
ten11_ldsc.rcve = 0;
tmxr_reset_ln (&ten11_ldsc);
ten11_ldsc[unibus].rcve = 0;
tmxr_reset_ln (&ten11_ldsc[unibus]);
return -1;
}

static int transaction (unsigned char *request, unsigned char *response)
static int transaction (int unibus, unsigned char *request, unsigned char *response)
{
const uint8 *ten11_request;
size_t size;
t_stat stat;

stat = tmxr_put_packet_ln (&ten11_ldsc, request + 1, (size_t)request[0]);
stat = tmxr_put_packet_ln (&ten11_ldsc[unibus], request + 1, (size_t)request[0]);
if (stat != SCPE_OK)
return error ("Write error in transaction");
return error (unibus, "Write error in transaction");

do {
tmxr_poll_rx (&ten11_desc);
stat = tmxr_get_packet_ln (&ten11_ldsc, &ten11_request, &size);
stat = tmxr_get_packet_ln (&ten11_ldsc[unibus], &ten11_request, &size);
if (!ten11_ldsc[unibus].conn)
return error (unibus, "Connection lost");
} while (stat != SCPE_OK || size == 0);

if (size > 7)
return error ("Malformed transaction");
return error (unibus, "Malformed transaction");

memcpy (response, ten11_request, size);
return 0;
}

static int read_word (t_addr addr, int *data)
static int read_word (int unibus, t_addr addr, int *data)
{
unsigned char request[8];
unsigned char response[8];
Expand All @@ -263,7 +274,7 @@ static int read_word (t_addr addr, int *data)
build (request, (addr >> 8) & 0377);
build (request, (addr) & 0377);

if (transaction (request, response) == -1) {
if (transaction (unibus, request, response) == -1) {
/* Network error. */
*data = 0;
return 0;
Expand All @@ -285,7 +296,7 @@ static int read_word (t_addr addr, int *data)
*data = 0;
break;
default:
return error ("Protocol error");
return error (unibus, "Protocol error");
}

return 0;
Expand Down Expand Up @@ -325,8 +336,8 @@ int ten11_read (t_addr addr, uint64 *data)
uaddr = ((mapping & T11ADDR) >> 10) + offset;
uaddr <<= 2;

read_word (uaddr, &word1);
read_word (uaddr + 2, &word2);
read_word (unibus, uaddr, &word1);
read_word (unibus, uaddr + 2, &word2);
*data = ((uint64)word1 << 20) | (word2 << 4);

sim_debug (DBG_TRC, &ten11_dev,
Expand All @@ -336,7 +347,7 @@ int ten11_read (t_addr addr, uint64 *data)
return 0;
}

static int write_word (t_addr addr, uint16 data)
static int write_word (int unibus, t_addr addr, uint16 data)
{
unsigned char request[8];
unsigned char response[8];
Expand All @@ -355,7 +366,7 @@ static int write_word (t_addr addr, uint16 data)
build (request, (data >> 8) & 0377);
build (request, (data) & 0377);

transaction (request, response);
transaction (unibus, request, response);

switch (response[0])
{
Expand All @@ -368,7 +379,7 @@ static int write_word (t_addr addr, uint16 data)
fprintf (stderr, "TEN11: Write timeout %06o\r\n", addr);
break;
default:
return error ("Protocol error");
return error (unibus, "Protocol error");
}

return 0;
Expand Down Expand Up @@ -417,9 +428,9 @@ int ten11_write (t_addr addr, uint64 data)
unibus, uaddr, data);

if ((data & 010) == 0)
write_word (uaddr, (data >> 20) & 0177777);
write_word (unibus, uaddr, (data >> 20) & 0177777);
if ((data & 004) == 0)
write_word (uaddr + 2, (data >> 4) & 0177777);
write_word (unibus, uaddr + 2, (data >> 4) & 0177777);
}
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions PDP10/tests/diagnostics.rim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
������������������������������������������������������������������������������������������������������������������������
23 changes: 23 additions & 0 deletions PDP10/tests/ka10_test.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
:: ka10_test.ini
:: This script will run the available CPU instruction and core
:: functional diagnostics for the KA10 simulator.
::
:: Default output summarizes success or failure.
:: if the script is invoked with -v as a parameter, verbose
:: diagnostic output will be produced.
::
:: The related diagnostic files must be located in the same directory
:: as this procedure.
::
cd %~p0
set env DIAG_QUIET_MODE=0
if ("%1" == "-v") set console notelnet
else set -qu console telnet=65432,telnet=buffered; set env -a DIAG_QUIET_MODE=1
goto DIAG_%SIM_BIN_NAME%

:DIAG_PDP10-KA
echo Booting paper tape.
at ptr diagnostics.rim
b ptr
if (PC != 000100) echof "\r\n*** FAILED - %SIM_NAME%\n"; exit 1
else echof "\r\n*** PASSED - %SIM_NAME%\n"; exit 0
4 changes: 2 additions & 2 deletions sim_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -1783,9 +1783,9 @@ static void eth_get_nic_hw_addr(ETH_DEV* dev, const char *devname, int set_on)
NULL};
const char *patterns[] = {
"ip link show %.*s 2>/dev/null | grep [0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]",
"ip link show %.*s 2>/dev/null | egrep [0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]",
"ip link show %.*s 2>/dev/null | grep -E [0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]",
"ifconfig %.*s 2>/dev/null | grep [0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]",
"ifconfig %.*s 2>/dev/null | egrep [0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]",
"ifconfig %.*s 2>/dev/null | grep -E [0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]:[0-9a-fA-F]?[0-9a-fA-F]",
NULL};

memset(command, 0, sizeof(command));
Expand Down