mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Add port isolation methods
This commit is contained in:
@@ -435,3 +435,20 @@ void port_stats_print(void) __banked
|
|||||||
print_string("\n");
|
print_string("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void port_isolate(register uint8_t port, __xdata uint16_t pmask)
|
||||||
|
{
|
||||||
|
if (port <= maxPort)
|
||||||
|
REG_SET(RTL837X_PORT_ISOLATION_BASE + (port << 2), pmask);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t port_isolation_get(register uint8_t port)
|
||||||
|
{
|
||||||
|
if (port > maxPort)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
reg_read_m(RTL837X_PORT_ISOLATION_BASE + (port << 2));
|
||||||
|
return ((uint16_t)sfr_data[2]) << 8 | sfr_data[3];
|
||||||
|
}
|
||||||
|
|||||||
@@ -121,6 +121,12 @@
|
|||||||
#define RTL837x_TRUNK_CTRL_A 0x4f38
|
#define RTL837x_TRUNK_CTRL_A 0x4f38
|
||||||
#define RTL837x_TRUNK_CTRL_B 0x4f3c
|
#define RTL837x_TRUNK_CTRL_B 0x4f3c
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Port isolation
|
||||||
|
*/
|
||||||
|
#define RTL837X_PORT_ISOLATION_BASE 0x50c0
|
||||||
|
|
||||||
|
|
||||||
#ifdef REGDBG
|
#ifdef REGDBG
|
||||||
|
|
||||||
#define REG_SET(r, v) SFR_DATA_24 = ((v) >> 24) & 0xff; \
|
#define REG_SET(r, v) SFR_DATA_24 = ((v) >> 24) & 0xff; \
|
||||||
|
|||||||
Reference in New Issue
Block a user