本应用笔记介绍如何使用DS31256的接收BERT功能执行分数T1(FT1)环路或环路下降检测(V.54),如分数T1.403附录B规范中所述。工作算法和编码示例说明了DS31256易于适应终端用户应用。
DS31256只有一个BERT引擎,但有16个V.54引擎(每个端口一个)。因此,如果测试多个端口,软件带宽必须处理所需的多路复用。
算法
下面图 1 和图 2 中的流程图详细描述了环上和下环操作。假定只有端口 0 在查找 FT1 模式。基本算法设置 BERT 以查找环路模式。同步后,算法检查以确保BERT在可编程周期(代码中为0.6秒)内同步,然后查找全一模式。然后,对循环代码遵循相同的同步和检查方法,然后是 all one 模式。
尽管此示例使用 0.6s 作为确保 BERT 同步的时间段,但必须根据 sync_loop 函数的执行速度调整此时间段。

图1.FT1(环上环和环下)探测器操作流程图。

图2.FT1(环上环和环下)检测器操作流程图(续)。
编码示例函数调用的定义

函数的编码示例
测试 FT1 的功能
void FT1Test()
{
int status = 0;
FT1Setting(0, 0); -- Configure the device for BERT
status = sync_loop(1, 300, 5000); -- FT1 loop-up test
if(status == 1) -- Return status is synced
{
status = sync_loop(3, 300, 5000); -- FT1 all ones test
if(status == 1)
{
loopbackSetup(1); -- Place channelized in network loopback
status = sync_loop(2, 300, 5000); -- FT1 loop-down test
if(status == 1)
{
status = sync_loop(3, 300, 5000); -- FT1 all ones test
if(status == 1)
loopbackSetup(0); -- Take out from channelized loopback
else
checkstatus(3); -- Print out test status
}
else
{
checkstatus(2); -- Print out test status
}
}
else
{
checkstatus(3); -- Print out test status
}
}
else
{
checkstatus(1); -- Print out test status
}
}
1. 打印测试状态消息的功能
void checkstatus(int type)
{
switch(type)
{
case 1: printf("Loopup pattern not found");
break;
case 2: printf("Loopdown pattern not found");
break;
case 3: printf("All 1's pattern not found");
break;
}
}
2. 配置FT1的功能
此示例假定端口 0 用于 FT1 检测
void FT1Setting(int dev, int port)
{
int mc = 0; -- Variables to be used
int ds0 = 0;
int rcfg = 0;
mc = read_reg (0x10); -- Read Master Control(MC) 0x00 register
mc = mc & 0xf07f; -- Mask out the read-back value from MC
write_reg (0x10, mc); -- Assign the BERT to port 0 (MC.BPS4-0)
write_reg(0x0304, 0x4000); -- Configure port 0 in receive port
for(ds0 = 0; ds0 < 128; ds0 = ds0 + 1) -- Configure register
{ --Assign timeslot R[0]CFG[ds0].RBERT bit
write_ind_reg(0x0300, 0x0100 + ds0); -- Assign all 128 ds0’s to RBERT
}
printf("FT1 configuration completed.");
}
3. 执行FT1测试的功能
int sync_loop(int pattern, int sync_cnt, int timeout)
{
int timeCnt = 0; -- Variables will be used
int cnt = 0;
int status = 0;
int temp = 0;
int sync = 0;
int bertc0 = 0;
int bertec0 = 0;
BertSetup(pattern); -- Set up the BERT
bertc0 = read_reg (0x500); -- Toggle RESYNC
bertc0 = bertc0 | 0x0001; -- Mask the read BERTC0 value
write_reg (0x500, bertc0); -- Write a 1 into BERTC0.RESYNC
bertc0 = bertc0 & 0xfffe; -- Mask out read-back value
write_reg (0x500, bertc0); -- Write 0 into BERTC0.RESYNC
bertc0 = read_reg (0x500); -- Read BERTC0
bertec0 = read_reg (0x518); -- Read BERTEC0
sync = ((bertec0 & 0x0001) == 0x0001);
timeCnt = timeCnt + 1;
while(cnt= timeout)
{
printf("Time Out while searching for pattern.");
return status = 0;
}
}
delay(2000);
timeCnt = timeCnt +1;
bertec0 = read_reg (0x518); -- Read value of BERTEC0
temp = ((bertec0 & 0x0010) == 0x0010); -- Check BERTEC0.RLOS
if(temp == 1)
{
sync = 0;
cnt = 0;
}
else
{
cnt = cnt+1;
}
if(cnt == sync_cnt)
{
printf("Synced to pattern.");
return status = 1;
}
}
return 0;
}
4. 在BERT寄存器中设置模式
void BertSetup(int pattern)
{
switch (pattern)
{
case 1:
write_reg (0x500, 0x0 & 0x003c); -- Disable BERTC0.RINV
break; -- Set 2E7-1 pattern
case 2:
write_reg (0x500, 0x0020 & 0x003c);--Enable BERTC0.RINV
break; -- Set 2E7-1 pattern
default:
write_reg (0x508, 0xffff); -- Set BERT Repetitive Pattern Set
write_reg (0x50C, 0xffff); -- in BERTBRP0-1
write_reg (0x500, 0x0010 & 0x003c);-- Disable BERTC0.RINV
break; -- Set to repetitive pattern
}
}
5. 设置环回模式的功能
此示例假定端口 0 放置在环回中。
void loopbackSetup(int val)
{
int a = 0;
int tmp = 0;
tmp = val<<11;
write_reg(0x0304, tmp); -- Set port and channel 0
for (a = 0; a < 128; a++) -- Set T[0]CFG[a].CNLB to place channel in
{ -- loopback
write_ind_reg(0x0300, 0x0200 + a);
}
if(val ==1)
{
write_reg(0x0200, 0x0008); -- Enable TP[0]CR.TFDA1 to allow data to
printf("Loopup detected"); -- be transmitted normally
printf("Channel placed in loopback");
}
else
{
write_reg(0x0200, 0x0000); -- Disable TP[0]CR.TFDA1 bit
printf("Loopdown detected");
printf("Channel taken out from loopback");
}
}
结论
本应用笔记介绍了如何在DS31256中使用接收BERT功能。示例代码和软件算法说明了执行FT1环路或环路检测是多么容易。
审核编辑:郭婷
全部0条评论
快来发表一下你的评论吧 !