本應用筆記介紹了利用DS31256的接收BERT (誤碼率測試)功能實現(xiàn)分數(shù)級T1 (FT1)上環(huán)回或下環(huán)回檢測(V.54)的方法,并給出了示例代碼。
概述
這篇應用筆記介紹了利用DS31256的接收BERT功能實現(xiàn)分數(shù)級T1 (FT1)上環(huán)回或下環(huán)回檢測(V.54)的方法,詳細說明請參考分數(shù)級T1.403附錄B規(guī)范。所提供的算法和示例代碼簡化了DS31256最終用戶的設計。
DS31256只有一個BERT引擎,但有16個V.54引擎(每端口一個)。因此,當測試端口多于一個時,軟件帶寬必須能夠處理多路復用技術。
算法
圖1和圖2所示流程圖詳細說明了上環(huán)回、下環(huán)回的操作流程。假設只有端口0查找FT1模板。基本算法設置BERT查詢上環(huán)回模板。同步后,這個算法檢測并確保BERT同步于可編程周期(例程中為0.6秒),然后查找一個全“1”模板。下環(huán)回例程中采用相同的同步、檢驗,隨后是全“1”模板。
本例中選擇0.6秒周期確保BERT同步,但這個時間周期必須根據(jù)sync_loop函數(shù)運行的快慢進行調(diào)整。
圖1. FT1 (上環(huán)回與下環(huán)回)檢測流程
圖2. FT1 (上環(huán)回與下環(huán)回)檢測流程(續(xù))
示例代碼中函數(shù)調(diào)用定義
在進入特定程序前,必須了解一些假設條件,程序中需要下列函數(shù)。
- write_reg (addr, data)—將特定數(shù)值寫入指定的DS31256寄存器:
addr = DS31256寄存器相對于芯片基地址的偏移量 data = 需要寫入寄存器的數(shù)據(jù)
- read_reg (addr)—讀取DS31256特定地址的寄存器并返回值:
addr = DS31256寄存器相對于芯片基地址的偏移量
- write_ind_reg (addr, data)—將特定數(shù)據(jù)寫入指定的DS31256間接尋址寄存器,然后在返回前等待寄存器的“忙”位被清除:
addr = 要寫入數(shù)據(jù)的間接尋址寄存器 data = 寫入指定的間接尋址寄存器的數(shù)據(jù)
- read_ind_reg (addr, i)—讀取指定地址的DS31256間接尋址寄存器并返回數(shù)值:
addr = DS31256寄存器相對于芯片基地址的偏移量 i = 索引
- 標準的C語言打印函數(shù)printf
函數(shù)示例代碼
FT1測試函數(shù)
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. 打印測試狀態(tài)信息函數(shù)
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函數(shù)
該例程假設端口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. 執(zhí)行FT1測試函數(shù)
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
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. 建立環(huán)回模式函數(shù)
該例程假設將端口0置于環(huán)回模式。
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上回環(huán)和下回環(huán)檢測非常簡單。
審核編輯:郭婷
-
寄存器
+關注
關注
31文章
5432瀏覽量
124002 -
C語言
+關注
關注
180文章
7631瀏覽量
141046 -
代碼
+關注
關注
30文章
4895瀏覽量
70481
發(fā)布評論請先 登錄
DS31256,pdf,datasheet (256-Cha
Enabling Fractional-T1(FT1) Lo

Examples of DS31256 Applicatio

DS31256 HDLC Controller Step-b

DS31256 HDLC Controller Step-b

DS31256 Loopback Modes

DS31256 Gapped Clock Applicati

DS31256的初始化步驟
DS31256 and T1/E1 Interface

DS31256 HDLC控制器的配置步驟—橋接模式

如何利用DS31256 HDLC控制器實現(xiàn)間隔時鐘應用

DS31256 接口 - 電信

DS31256閉合時鐘應用

在DS上啟用分數(shù)T1環(huán)回檢測

評論