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

Add support for MESA 2x30 pin and pin names report #967

Merged
merged 2 commits into from Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
162 changes: 162 additions & 0 deletions src/hal/drivers/mesa-hostmot2/hm2_eth.c
Expand Up @@ -321,6 +321,134 @@ static char *hm2_7i97_pin_names[] = {
"P1-25"
};

static char *hm2_Mc04_pin_names[] = {
"Relay2",
"Relay3",
"Relay4",
"Relay5",
"Relay1",
"Single led",
"Encoder #0, pin B (Input)",
"Encoder #0, pin A (Input)",
"Encoder #1, pin A (Input)",
"Encoder #0, pin Index (Input)",
"Servo0VRDY",
"StepGen #0, pin Step (Output)",
"StepGen #0, pin Direction (Output)",
"StepGen #1, pin Step (Output)",
"StepGen #1, pin Direction (Output)",
"StepGen #2, pin Step (Output)",
"StepGen #2, pin Direction (Output)",
"StepGen #3, pin Step (Output)",
"StepGen #3, pin Direction (Output)",
"Encoder #2, pin B (Input)",
"Encoder #2, pin A (Input)",
"Encoder #1, pin Index (Input)",
"Encoder #1, pin B (Input)",
"Servo1VRDY",
"Servo2VRDY",
"Encoder #3, pin Index (Input)",
"Encoder #3, pin B (Input)",
"Encoder #3, pin A (Input)",
"Encoder #2, pin Index (Input)",
"Servo3VRDY",
"Servo's on",
"Output0",
"Output1",
"Output2",
"Output3",
"Output4",
"Output5",
"Output6",
"Output7",
"Input7",
"Input6",
"Input5",
"Input4",
"Input3",
"Input2",
"Input1",
"Input0",
"PWMGen #0, pin Out0 (PWM or Up) (Output)",
"PWMGen #0, pin Not-Enable (Output)",
"Spindle-on",
"Spindle-ccw",
"Smart Serial Interface #0, pin txen2 (Output)",
"Smart Serial Interface #0, pin tx2 (Output)",
"Smart Serial Interface #0, pin rx2 (Input)",
"Smart Serial Interface #0, pin txen1 (Output)",
"Smart Serial Interface #0, pin tx1 (Output)",
"Smart Serial Interface #0, pin rx1 (Input)",
"Smart Serial Interface #0, pin txen0 (Output)",
"Smart Serial Interface #0, pin tx0 (Output)",
"Smart Serial Interface #0, pin rx0 (Input)"
};

static char *hm2_8cSS_pin_names[] = {
"Not used",
"Not used",
"Not used",
"Not used",
"Not used",
"Not used",
"Smart Serial Interface #0, pin tx1 (Output)",
"Smart Serial Interface #0, pin rx1 (Input)",
"Smart Serial Interface #0, pin txen1 (Output)",
"Smart Serial Interface #0, pin tx2 (Output)",
"Smart Serial Interface #0, pin rx2 (Input)",
"Smart Serial Interface #0, pin txen2 (Output)",
"Smart Serial Interface #0, pin tx3 (Output)",
"Smart Serial Interface #0, pin rx3 (Input)",
"Smart Serial Interface #0, pin txen3 (Output)",
"Smart Serial Interface #0, pin tx4 (Output)",
"Smart Serial Interface #0, pin rx4 (Input)",
"Smart Serial Interface #0, pin txen4 (Output)",
"Input0",
"Input1",
"Input2",
"Input3",
"Input4",
"Input5",
"Input6",
"Input7",
"Not used",
"Not used",
"Not used",
"Not used",
"Not used",
"Not used",
"Output2",
"Output1",
"Output0",
"Output5",
"Output4",
"Output3",
"Output7",
"Output6",
"Not used",
"Not used",
"Not used",
"Not used",
"Spindle CW",
"Spindle PWM",
"Spindle enable",
"Spindle CCW",
"Smart Serial Interface #0, pin tx8 (Output)",
"Smart Serial Interface #0, pin rx8 (Input)",
"Smart Serial Interface #0, pin txen8 (Output)",
"Smart Serial Interface #0, pin rx7 (Input)",
"Smart Serial Interface #0, pin tx7 (Output)",
"Smart Serial Interface #0, pin txen5 (Output)",
"Smart Serial Interface #0, pin rx5 (Input)",
"Smart Serial Interface #0, pin tx5 (Output)",
"Smart Serial Interface #0, pin txen6 (Output)",
"Smart Serial Interface #0, pin rx6 (Input)",
"Smart Serial Interface #0, pin tx6 (Output)",
"Smart Serial Interface #0, pin txen7 (Output)",

};


#define UDP_PORT 27181
#define SEND_TIMEOUT_US 10
#define RECV_TIMEOUT_US 10
Expand Down Expand Up @@ -1151,6 +1279,40 @@ static int hm2_eth_probe(hm2_eth_t *board) {
board->llio.fpga_part_number = "6slx9tqg144";
board->llio.num_leds = 4;


} else if (strncmp(board_name, "MC04", 4) == 0) {
strncpy(llio_name, board_name, 4);
llio_name[1] = tolower(llio_name[1]);
board->llio.num_ioport_connectors = 2;
board->llio.pins_per_connector = 30;
board->llio.ioport_connector_name[0] = "P1";
board->llio.ioport_connector_name[1] = "P2";
board->llio.fpga_part_number = "6slx9tqg144";
board->llio.num_leds = 4;
board->llio.io_connector_pin_names = hm2_Mc04_pin_names;
board->llio.ioport_connector_name[0] = "P1";
board->llio.ioport_connector_name[1] = "P2";



} else if (strncmp(board_name, "8CSS", 4) == 0) {
strncpy(llio_name, board_name, 4);
llio_name[1] = tolower(llio_name[1]);
board->llio.num_ioport_connectors = 2;
board->llio.pins_per_connector = 30;
board->llio.ioport_connector_name[0] = "P1";
board->llio.ioport_connector_name[1] = "P2";
board->llio.fpga_part_number = "6slx9tqg144";
board->llio.num_leds = 4;
board->llio.io_connector_pin_names = hm2_8cSS_pin_names;
board->llio.ioport_connector_name[0] = "P1";
board->llio.ioport_connector_name[1] = "P2";






} else {
LL_PRINT("Unrecognized ethernet board found: %.16s -- port names will be wrong\n", board_name);
strncpy(llio_name, board_name, 4);
Expand Down
3 changes: 3 additions & 0 deletions src/hal/drivers/mesa-hostmot2/pins.c
Expand Up @@ -747,6 +747,9 @@ int hm2_read_pin_descriptors(hostmot2_t *hm2) {
case 29: /* 7I95 punt on this for now */
pin->port_pin = i + 1;
break;
case 30: /* 8cSS , MC04 boards */
pin->port_pin = i + 1;
break;
default:
HM2_ERR("%s: invalid port width %d\n", __FUNCTION__, hm2->idrom.port_width);
}
Expand Down