mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Add mtu command
This commit is contained in:
@@ -457,6 +457,37 @@ void parse_port(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void parse_mtu(void)
|
||||||
|
{
|
||||||
|
__xdata uint16_t mtu;
|
||||||
|
uint8_t p;
|
||||||
|
|
||||||
|
print_string("\nMTU ");
|
||||||
|
if (cmd_words_b[1] > 0 && cmd_compare(1, "show")) {
|
||||||
|
for (p = machine.min_port; p <= machine.max_port; p++) {
|
||||||
|
reg_read_m(RTL8373_REG_MAC_L2_PORT_MAX_LEN + ((uint16_t) p << 8));
|
||||||
|
mtu = SFR_DATA_U16 & 0x3fff;
|
||||||
|
print_string("Port "); print_byte(machine.log_to_phys_port[p]);
|
||||||
|
print_string(" MTU: 0x"); print_short(mtu); write_char('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p = cmd_buffer[cmd_words_b[1]] - '1';
|
||||||
|
p = machine.phys_to_log_port[p];
|
||||||
|
print_byte(p);
|
||||||
|
if (cmd_words_b[2] <= 0) {
|
||||||
|
print_string("mtu [port] [size]");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
atoi_short(&mtu, cmd_words_b[2]);
|
||||||
|
if (mtu > 0x3fff) {
|
||||||
|
print_string("Maximum MTU is 16383\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
REG_WRITE(RTL8373_REG_MAC_L2_PORT_MAX_LEN + ((uint16_t) p << 8), (mtu >> 10) & 0xf, (mtu >> 2) & 0xff,
|
||||||
|
((mtu & 0x3) << 6) | ((mtu >> 8) & 0x3f), mtu & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void sfp_print_measurements(uint8_t sfp)
|
void sfp_print_measurements(uint8_t sfp)
|
||||||
{
|
{
|
||||||
print_string("Options: "); print_byte(sfp_read_reg(sfp, 92)); write_char('\n');
|
print_string("Options: "); print_byte(sfp_read_reg(sfp, 92)); write_char('\n');
|
||||||
@@ -730,6 +761,8 @@ void cmd_parser(void) __banked
|
|||||||
flash_write_bytes(flash_buf);
|
flash_write_bytes(flash_buf);
|
||||||
} else if (cmd_compare(0, "port") && cmd_words_b[1] > 0) {
|
} else if (cmd_compare(0, "port") && cmd_words_b[1] > 0) {
|
||||||
parse_port();
|
parse_port();
|
||||||
|
} else if (cmd_compare(0, "mtu") && cmd_words_b[1] > 0) {
|
||||||
|
parse_mtu();
|
||||||
} else if (cmd_compare(0, "ip")) {
|
} else if (cmd_compare(0, "ip")) {
|
||||||
print_string("Got ip command: ");
|
print_string("Got ip command: ");
|
||||||
if (!parse_ip(cmd_words_b[1]))
|
if (!parse_ip(cmd_words_b[1]))
|
||||||
|
|||||||
@@ -136,6 +136,8 @@
|
|||||||
#define RTL837x_L2_TBL_FLUSH_CNF 0x53dc
|
#define RTL837x_L2_TBL_FLUSH_CNF 0x53dc
|
||||||
#define RTL837X_L2_LRN_PORT_CONSTRAINT 0x5384
|
#define RTL837X_L2_LRN_PORT_CONSTRAINT 0x5384
|
||||||
#define RTL837X_L2_LRN_PORT_CONSTRT_ACT 0x4f80
|
#define RTL837X_L2_LRN_PORT_CONSTRT_ACT 0x4f80
|
||||||
|
#define RTL8373_REG_MAC_L2_PORT_MAX_LEN 0x1250
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* VLAN configuration
|
* VLAN configuration
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user