📄 epic.c
字号:
{
// V24INT_PRINT(("\nSwitch PCM->CFI: "));
/* Set downstream connection. */
address = Epic_Encode_Time_Slot (PCM, src_port_numb, src_slot);
address &= ~0x80;
Out (EPIC_MADR , address);
// V24INT_PRINT(("(Down:)PCM_Src=0x%02X,",address));
address = Epic_Encode_Time_Slot (CFI, dst_port_numb, dst_slot);
address &= ~0x80;
Out (EPIC_MAAR , address);
// V24INT_PRINT(("CFI_Dst=0x%02X",address));
Out (EPIC_MACR , 0x71);
WHILE_NOT_ABORT ( In (EPIC_STAR) > 0x7F);
if (G_Abort == TRUE) printf(": EPIC_STAR4\n");
}
/* Set following switch:
PCM -> PCM */
if ((src_port_type == 0) && (dst_port_type == 0))
{
// V24INT_PRINT(("\nSwitch PCM->PCM: "));
/* Set downstream connection. */
address = Epic_Encode_Time_Slot (PCM, src_port_numb, src_slot);
address &= ~0x80;
Out (EPIC_MADR , address);
// V24INT_PRINT(("(Down:)PCM_Src=0x%02X,",address));
address = Epic_Encode_Time_Slot (CFI, dst_port_numb, dst_slot);
address &= ~0x80;
Out (EPIC_MAAR , address);
// V24INT_PRINT(("CFI_Dst=0x%02X ",address));
Out (EPIC_MACR , 0x71);
WHILE_NOT_ABORT ( In (EPIC_STAR) > 0x7F);
if (G_Abort == TRUE) printf(": EPIC_STAR5\n");
/* Set upstream connection. */
address = Epic_Encode_Time_Slot (PCM, dst_port_numb, dst_slot);
address &= ~0x80;
Out (EPIC_MADR , address);
// V24INT_PRINT(("(Up:)PCM_Dst=0x%02X,",address));
address = Epic_Encode_Time_Slot (CFI, dst_port_numb, dst_slot);
address |= 0x80;
Out (EPIC_MAAR , address);
// V24INT_PRINT(("CFI_Dst=0x%02X ",address));
Out (EPIC_MACR , 0x71);
WHILE_NOT_ABORT ( In(EPIC_STAR) > 0x7F);
if (G_Abort == TRUE) printf(": EPIC_STAR6\n");
/* Release tristate. */
Out (EPIC_MADR , 0x0F);
address = Epic_Encode_Time_Slot (PCM, dst_port_numb, dst_slot);
address |= 0x80;
Out (EPIC_MAAR , address);
// V24INT_PRINT(("(Tri:)PCM_Dst=0x%02X",address));
Out (EPIC_MACR , 0x60);
WHILE_NOT_ABORT ( In(EPIC_STAR) > 0x7F);
if (G_Abort == TRUE) printf(": EPIC_STAR7\n");
}
/* Only used if Epic_extra_switching = 1
Set following switch:
CFI0 (PCM1 odd slot ->
PCM1 odd slot) -> CFI1 odd slot */
if ((src_port_type == 1) && (dst_port_type == 1) && (Epic_extra_switching == 1))
{
// V24INT_PRINT(("\nextra Switch CFI->CFI: "));
/* Set upstream connection. */
address = Epic_Encode_Time_Slot (PCM, dst_port_numb, (dst_slot+1));
address |= 0x80;
Out (EPIC_MADR , address);
// V24INT_PRINT(("(Up:)PCM_Dst=0x%02X,",address));
address = Epic_Encode_Time_Slot (CFI, src_port_numb, src_slot);
address |= 0x80;
Out (EPIC_MAAR , address);
// V24INT_PRINT(("CFI_Src=0x%02X ",address));
Out (EPIC_MACR , 0x71);
WHILE_NOT_ABORT ( In(EPIC_STAR) > 0x7F);
if (G_Abort == TRUE) printf(": EPIC_STAR8\n");
/* Set downstream connection. */
address = Epic_Encode_Time_Slot (PCM, dst_port_numb, (dst_slot+1));
address |= 0x80;
Out (EPIC_MADR , address);
// V24INT_PRINT(("(Down:)PCM_Dst=0x%02X,",address));
address = Epic_Encode_Time_Slot (CFI, dst_port_numb, (dst_slot+1));
address &= ~0x80;
Out (EPIC_MAAR , address);
// V24INT_PRINT(("CFI_Dst=0x%02X",address));
Out (EPIC_MACR , 0x71);
WHILE_NOT_ABORT ( In(EPIC_STAR) > 0x7F);
if (G_Abort == TRUE) printf(": EPIC_STAR9\n");
/* Release tristate. */
Out (EPIC_MADR , 0x0F);
address = Epic_Encode_Time_Slot (PCM, dst_port_numb, (dst_slot+1));
address |= 0x80;
Out (EPIC_MAAR , address);
// V24INT_PRINT(("(Tri:)PCM_Dst=0x%02X ",address));
Out (EPIC_MACR , 0x60);
WHILE_NOT_ABORT ( In(EPIC_STAR) > 0x7F);
if (G_Abort == TRUE) printf(": EPIC_STAR10\n");
}
/* Set following switch:
CFI -> CFI */
if ((src_port_type == 1) && (dst_port_type == 1) && (Epic_extra_switching != 1))
{
// V24INT_PRINT(("\nnormal Switch CFI->CFI: "));
/* Set upstream connection. */
address = Epic_Encode_Time_Slot (PCM, src_port_numb, dst_slot);
address |= 0x80;
Out (EPIC_MADR , address);
// V24INT_PRINT(("(Up:)PCM_Dst=0x%02X,",address));
address = Epic_Encode_Time_Slot (CFI, src_port_numb, src_slot);
address |= 0x80;
Out (EPIC_MAAR , address);
// V24INT_PRINT(("CFI_Src=0x%02X ",address));
Out (EPIC_MACR , 0x71);
WHILE_NOT_ABORT ( In(EPIC_STAR) > 0x7F);
if (G_Abort == TRUE) printf(": EPIC_STAR11\n");
/* Set downstream connection. */
address = Epic_Encode_Time_Slot (PCM, src_port_numb, dst_slot);
address |= 0x80;
Out (EPIC_MADR , address);
// V24INT_PRINT(("(Down:)PCM_Dst=0x%02X,",address));
address = Epic_Encode_Time_Slot (CFI, dst_port_numb, dst_slot);
address &= ~0x80;
Out (EPIC_MAAR , address);
// V24INT_PRINT(("CFI_Dst=0x%02X",address));
Out (EPIC_MACR , 0x71);
WHILE_NOT_ABORT ( In(EPIC_STAR) > 0x7F);
if (G_Abort == TRUE) printf(": EPIC_STAR12\n");
/* Release tristate. */
Out (EPIC_MADR , 0x0F);
address = Epic_Encode_Time_Slot (PCM, src_port_numb, dst_slot);
address |= 0x80;
Out (EPIC_MAAR , address);
// V24INT_PRINT(("(Tri:)PCM_Dst=0x%02X ",address));
Out (EPIC_MACR , 0x60);
WHILE_NOT_ABORT ( In(EPIC_STAR) > 0x7F);
if (G_Abort == TRUE) printf(": EPIC_STAR13\n");
}
}
/*******************************************************************************
Description:
Disconnect all time slots from another.
Arguments:
NONE.
Return:
NONE.
Remarks:
NONE.
******************************************************************************/
static void Epic_Reset_All_Connections (void)
{
WORD16 i;
/* Reset all connections. */
Out (EPIC_MADR , 0xFF);
for (i = 0;i < 0x100; i++)
{
Out (EPIC_MAAR , i);
Out (EPIC_MACR , 0x70);
WHILE_NOT_ABORT ( In (EPIC_STAR) > 0x7F);
if (G_Abort == TRUE) printf(": EPIC_STAR0\n");
}
/* Lock tristate. */
Out (EPIC_MADR , 0x00);
Out (EPIC_MACR , 0x68);
WHILE_NOT_ABORT ( In(EPIC_STAR) > 0x7F);
if (G_Abort == TRUE) printf(": EPIC_STAR1\n");
}
/*******************************************************************************
Description:
Calculates the time slot encoding for EPIC Memory Access,
depending on the EPIC PCM and CFI mode.
Arguments:
type - Interface type PCM (type=0) or CFI (type=1).
port - Port number.
slot - Slot number.
Return:
WORD8 - Returns the calculated address.
Remarks:
NONE.
******************************************************************************/
static WORD8 Epic_Encode_Time_Slot (WORD8 type, WORD8 port, WORD8 slot)
{
WORD8 address = 0;
/* Calculate time slot encoding
for PCM mode0 and CFI mode0. */
if (((type == PCM) && (Epic_Pcm_Mode == 0)) || ((type == CFI) && (Epic_Cfi_Mode == 0)))
{
port &= 0x03;
slot &= 0x1F;
address = slot & 0x01;
slot = slot >> 1;
slot = slot << 3;
address |= slot;
port = port << 1;
address |= port;
}
/* Calculate time slot encoding
for PCM mode1. */
if ((type == PCM) && (Epic_Pcm_Mode == 1))
{
port &= 0x01;
slot &= 0x3F;
address = slot & 0x03;
slot = slot >> 2;
slot = slot << 3;
address |= slot;
port = port << 2;
address |= port;
}
/* Calculate time slot encoding
for CFI mode1. */
if ((type == CFI) && (Epic_Cfi_Mode == 1))
{
port &= 0x01;
slot &= 0x3F;
address = slot & 0x01;
slot = slot >> 1;
slot = slot << 2;
address |= slot;
port = port << 1;
address |= port;
}
/* Calculate time slot encoding
for PCM mode2 and CFI mode2. */
if (((type == PCM) && (Epic_Pcm_Mode == 2)) || ((type == CFI) && (Epic_Cfi_Mode == 2)))
{
slot &= 0x7F;
address = slot;
}
/* Return calculated address. */
return address;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -