新闻中心

EEPW首页 > 测试测量 > 设计应用 > DS26303 LIU的初始化和配置

DS26303 LIU的初始化和配置

——
作者:时间:2007-01-26来源:《Maxim》收藏

引言

  在为一个新设计的电信系统开发软件时,最棘手的任务莫过于实现基本的设备操作。收发器的大量功能和多端口操作使软件开发更趋复杂。 为了方便初期系统开发,Dallas Semiconductor公司提供了C风格范例代码,它可以在T1或E1模式下初始化设备,软件开发人员只需针对所需的操作修改代码,或编写与特定系统相关的功能。一旦代码编译完毕,即可载入系统进行测试与评估。需要注意的是有两个版本,分别是-120和DS26303-75。它们的区别很小,只会影响到几个设置,因此需要弄清楚设计中用到的是哪个器件。

代码范例

  图1中所示的范例代码在稍加修改之后就可以正确编译以供目标系统使用。write(address,data)和wait(milliseconds)两个函数调用过程与系统相关,因此需要根据所用的微处理器编写。该代码假定设备被映射到16位的本地总线(地址偏移0x0000),并且设备的数据总线为8位。 对于其他情况,则需要修改代码或编写函数调用来解决。此段代码还包含某些寄存器的多种不同设置,从而为开发人员提供了时钟频率、线路编码等参数的多种选择。虽然包含了大量的基本功能,但该代码并不完备。当需要实现其他附加功能时,请参考数据资料。


/*
Configuration Example For DS26303-120 running in E1 mode.

This Example assumes E1 operation so the function call for T1/J1 configuration
has been commented out. Simply comment out the E1 configuration function
call and uncomment the T1 configuration function call for T1 operation. An
individual function call for J1 operation is not present because it is very
similar to T1 operation and could easily be implemented in that function.

This file follows C style conventions. However actual code for the function
calls listed below are implementation specific and need to be added:

Function Calls: write(address, data), wait(milliseconds)


The following comments only indicate some of the possible clock sources
that can be used for either E1 or T1/J1 operation.

Master clock configuration can use multiples of n = 1, 2, 4, or 8
MCLK = Can be a n x 1.544 or n x 2.048 MHz signal for E1 or T1/J1 Operation

TCLK = Must be a 2.048 MHz Signal for E1 Operation
TCLK = Must be a 1.544 MHz signal for T1/J1 Operation
*/

void initialization_main()
{
/* Global Initialization Begin */

/* Reset all channels to their default values */
write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank
Write(0x000A, 0xFF); // SWR, Reset All Channels

/* Wait 1 ms for reset to complete */
wait (1);

/* The Master Clock Select Register is important for proper */
/* device operation consult the data sheet for all possible configurations. */
write(0x001F, 0x01); // ADDP, Set Address Pointer to Individual Register Bank
write(0x0006, 0x00); // MC, E1 Mode Only MCLK-2.048, TECLK & CLKA Disabled
// write(0x0006, 0x00); // MC, T1/J1 Mode Only MCLK-1.544, TECLK & CLKA Disabled

// write(0x0006, 0x03); // MC, T1/J1 or E1 Mode MCLK-1.544, TECLK & CLKA Disabled
// write(0x0006, 0x07); // MC, T1/J1 or E1 Mode MCLK-3.088, TECLK & CLKA Disabled
// write(0x0006, 0x0B); // MC, T1/J1 or E1 Mode MCLK-6.176, TECLK & CLKA Disabled
// write(0x0006, 0x0F); // MC, T1/J1 or E1 Mode MCLK-12.352, TECLK & CLKA Disabled

// write(0x0006, 0x01); // MC, T1/J1 or E1 Mode MCLK-2.048, TECLK & CLKA Disabled
// write(0x0006, 0x05); // MC, T1/J1 or E1 Mode MCLK-4.096, TECLK & CLKA Disabled
// write(0x0006, 0x09); // MC, T1/J1 or E1 Mode MCLK-8.192, TECLK & CLKA Disabled
// write(0x0006, 0x0D); // MC, T1/J1 or E1 Mode MCLK-16.384, TECLK & CLKA Disabled

/* Wait 1 ms for clock to settle after configuration */
wait (1);

/* The GC register is able to globally control the AIS During LOS, Short Circuit */
/* Protection, Line Coding, JA Depth, JA Position, and JA Enable functions */
write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank
write(0x000F, 0x80); // GC, Enable RX Internal Impedance, Disable Global Controls


/* Global Initialization Complete */


/* Configuration Begin */

e1_configure();

// t1_configure();

/* Configuration Complete */
}{{分页}}

void e1_configure()
{
/* E1 Initilization Begin */

/* This function assumes all ports are configured identically. Otherwise, */
/* the function needs to be revised to support individual port addressing */
/* and identification. */

/* Configure analog, remote, or digital loopback as necessary */
write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank
write(0x0001, 0x00); // ALBC, Disable Analog Loopback for 8 Channels
// write(0x0001, 0xFF); // ALBC, Enable Analog Loopback for 8 Channels
write(0x0002, 0x00); // RLBC, Disable Remote Loopback for 8 Channels
// write(0x0002, 0xFF); // RLBC, Enable Remote Loopback for 8 Channels
write(0x000C, 0x00); // DLBC, Disable Digital Loopback for 8 Channels
// write(0x000C, 0xFF); // DLBC, Enable Digital Loopback for 8 Channels

/* Configure LOS / AIS criteria in E1 mode */
write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank
write(0x000D, 0x00); // LASCS, Use G.775 Criteria for 8 Channels
// write(0x000D, 0xFF); // LASCS, Use ETSI 300233 Criteria for 8 Channels

write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank
write(0x0003, 0x00); // TAOE, Disable Transmit All Ones for 8 Channels
// write(0x0003, 0xFF); // TAOE, Enable Transmit All Ones for 8 Channels

write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank
write(0x000E, 0x00); // ATAOS, Disable Automatic Transmit All Ones for 8 Channels
// write(0x000E, 0xFF); // ATAOS, Enable Automatic Transmit All Ones for 8 Channels

write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank
write(0x0012, 0x00); // OEB, Disable TX Output High Impedance for 8 Channels
// write(0x0012, 0xFF); // OEB, Enable TX Output High Impedance for 8 Channels

write(0x001F, 0xAA); // ADDP, Set Address Pointer to Secondary Register Bank
write(0x0003, 0x00); // RPDE, Disable Receive Power-Down for 8 Channels
// write(0x0003, 0xFF); // RPDE, Enable Receive Power-Down for 8 Channels

write(0x001F, 0xAA); // ADDP, Set Address Pointer to Secondary Register Bank
write(0x0004, 0x00); // TPDE, Disable Transmit Power-Down for 8 Channels
// write(0x0004, 0xFF); // TPDE, Enable Transmit Power-Down for 8 Channels

/* In single rail mode (SMRS register) with HDB3/B8ZS (LCS register) enabled, */
/* the EZDE and CVDEB registers can enable the excessive zero and code */
/* violation detection output on the RNEG pin. */
write(0x001F, 0xAA); // ADDP, Set Address Pointer to Secondary Register Bank
// write(0x0000, 0x00); // SRMS, Disable Single Rail Mode I/O for 8 Channels
write(0x0000, 0xFF); // SRMS, Enable Single Rail Mode I/O for 8 Channels

write(0x001F, 0xAA); // ADDP, Set Address Pointer to Secondary Register Bank
write(0x0005, 0x00); // EZDE, Disable Excessive Zero Detect for 8 Channels
// write(0x0005, 0xFF); // EZDE, Enable Excessive Zero Detect for 8 Channels

write(0x001F, 0xAA); // ADDP, Set Address Pointer to Secondary Register Bank
write(0x0006, 0x00); // CVDEB, Enable Code Violation Detect for 8 Channels
// write(0x0006, 0xFF); // CVDEB, Disable Code Violation Detect for 8 Channels

/* The following six functions can be controlled individually on a per channel */
/* basis or globally using the GC register. The IAISEL, ISCPD, LCS, IJAFDS, */
/* IJAPS, and IJAE are ignored when the corresponding function in the GC */
/* register is enabled. */
write(0x001F, 0x01); // ADDP, Set Address Pointer to Individual Register Bank
write(0x0005, 0x00); // IAISEL, Disable Indiv AIS During LOS for 8 Channels
// write(0x0005, 0xFF); // IAISEL, Enable Indiv AIS During LOS for 8 Channels

write(0x001F, 0x01); // ADDP, Set Address Pointer to Individual Register Bank
write(0x0004, 0x00); // ISCPD, Enable Indiv Short Protection for 8 Channels
// write(0x0004, 0xFF); // ISCPD, Disable Indiv Short Protection for 8 Channels

write(0x001F, 0xAA); // ADDP, Set Address Pointer to Secondary Register Bank
write(0x0001, 0x00); // LCS, Enable B8ZS/HDB3 Operation for 8 Channels
// write(0x0001, 0xFF); // LCS, Enable AMI Operation for 8 Channels

write(0x001F, 0x01); // ADDP, Set Address Pointer to Individual Register Bank
// write(0x0002, 0x00); // IJAFDS, Indiv JA 32 Bit Depth for 8 Channels
write(0x0002, 0xFF); // IJAFDS, Indiv JA 128 Bit Depth for 8 Channels

write(0x001F, 0x01); // ADDP, Set Address Pointer to Individual Register Bank
// write(0x0001, 0x00); // IJAPS, Indiv JA Transmit Path for 8 Channels
write(0x0001, 0xFF); // IJAPS, Indiv JA Receive Path for 8 Channels

write(0x001F, 0x01); // ADDP, Set Address Pointer to Individual Register Bank
// write(0x0000, 0x00); // IJAE, Disable Indiv Jitter Attenuator for 8 Channels
write(0x0000, 0xFF); // IJAE, Enable Indiv Jitter Attenuator for 8 Channels

/* Configure all channels for a E1 pulse template output. This example uses */
/* the DS26303-120 device so, TS.TIMPRM = 0 for 120 ohm line impedances. If */
/* the device were a DS26303-75, TS.TIMPRM = 1 for 120 ohm line impedances. */
write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank

Write(0x0010, 0x00) // TST, Select Channel 1 for Template Configuration
Write(0x0011, 0x00) // TS, E1 Mode 120 ohm G.703 TX/RX Impedance Match

Write(0x0010, 0x01) // TST, Select Channel 2 for Template Configuration
Write(0x0011, 0x00) // TS, E1 Mode 120 ohm G.703 TX/RX Impedance Match

Write(0x0010, 0x02) // TST, Select Channel 3 for Template Configuration
Write(0x0011, 0x00) // TS, E1 Mode 120 ohm G.703 TX/RX Impedance Match

Write(0x0010, 0x03) // TST, Select Channel 4 for Template Configuration
Write(0x0011, 0x00) // TS, E1 Mode 120 ohm G.703 TX/RX Impedance Match

Write(0x0010, 0x04) // TST, Select Channel 5 for Template Configuration
Write(0x0011, 0x00) // TS, E1 Mode 120 ohm G.703 TX/RX Impedance Match

Write(0x0010, 0x05) // TST, Select Channel 6 for Template Configuration
Write(0x0011, 0x00) // TS, E1 Mode 120 ohm G.703 TX/RX Impedance Match

Write(0x0010, 0x06) // TST, Select Channel 7 for Template Configuration
Write(0x0011, 0x00) // TS, E1 Mode 120 ohm G.703 TX/RX Impedance Match

Write(0x0010, 0x07) // TST, Select Channel 8 for Template Configuration
Write(0x0011, 0x00) // TS, E1 Mode 120 ohm G.703 TX/RX Impedance Match
}{{分页}}

void t1_configure()
{
/* T1 Initilization Begin */

/* This function assumes all ports are configured identically. Otherwise, */
/* the function needs to be revised to support individual port addressing */
/* and identification. */

/* Configure analog, remote, or digital loopback as necessary */
write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank
write(0x0001, 0x00); // ALBC, Disable Analog Loopback for 8 Channels
// write(0x0001, 0xFF); // ALBC, Enable Analog Loopback for 8 Channels
write(0x0002, 0x00); // RLBC, Disable Remote Loopback for 8 Channels
// write(0x0002, 0xFF); // RLBC, Enable Remote Loopback for 8 Channels
write(0x000C, 0x00); // DLBC, Disable Digital Loopback for 8 Channels
// write(0x000C, 0xFF); // DLBC, Enable Digital Loopback for 8 Channels

write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank
write(0x0003, 0x00); // TAOE, Disable Transmit All Ones for 8 Channels
// write(0x0003, 0xFF); // TAOE, Enable Transmit All Ones for 8 Channels

write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank
write(0x000E, 0x00); // ATAOS, Disable Automatic Transmit All Ones for 8 Channels
// write(0x000E, 0xFF); // ATAOS, Enable Automatic Transmit All Ones for 8 Channels

write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank
write(0x0012, 0x00); // OEB, Disable TX Output High Impedance for 8 Channels
// write(0x0012, 0xFF); // OEB, Enable TX Output High Impedance for 8 Channels

write(0x001F, 0xAA); // ADDP, Set Address Pointer to Secondary Register Bank
write(0x0003, 0x00); // RPDE, Disable Receive Power-Down for 8 Channels
// write(0x0003, 0xFF); // RPDE, Enable Receive Power-Down for 8 Channels

write(0x001F, 0xAA); // ADDP, Set Address Pointer to Secondary Register Bank
write(0x0004, 0x00); // TPDE, Disable Transmit Power-Down for 8 Channels
// write(0x0004, 0xFF); // TPDE, Enable Transmit Power-Down for 8 Channels

/* In single rail mode (SMRS register) with HDB3/B8ZS (LCS register) enabled, */
/* the EZDE and CVDEB registers can enable the excessive zero and code */
/* violation detection output on the RNEG pin. */
write(0x001F, 0xAA); // ADDP, Set Address Pointer to Secondary Register Bank
// write(0x0000, 0x00); // SRMS, Disable Single Rail Mode I/O for 8 Channels
write(0x0000, 0xFF); // SRMS, Enable Single Rail Mode I/O for 8 Channels

write(0x001F, 0xAA); // ADDP, Set Address Pointer to Secondary Register Bank
write(0x0005, 0x00); // EZDE, Disable Excessive Zero Detect for 8 Channels
// write(0x0005, 0xFF); // EZDE, Enable Excessive Zero Detect for 8 Channels

write(0x001F, 0xAA); // ADDP, Set Address Pointer to Secondary Register Bank
write(0x0006, 0x00); // CVDEB, Enable Code Violation Detect for 8 Channels
// write(0x0006, 0xFF); // CVDEB, Disable Code Violation Detect for 8 Channels

/* The following six functions can be controlled individually on a per channel */
/* basis or globally using the GC register. The IAISEL, ISCPD, LCS, IJAFDS, */
/* IJAPS, and IJAE are ignored when the corresponding function in the GC */
/* register is enabled. */
write(0x001F, 0x01); // ADDP, Set Address Pointer to Individual Register Bank
write(0x0005, 0x00); // IAISEL, Disable Indiv AIS During LOS for 8 Channels
// write(0x0005, 0xFF); // IAISEL, Enable Indiv AIS During LOS for 8 Channels

write(0x001F, 0x01); // ADDP, Set Address Pointer to Individual Register Bank
write(0x0004, 0x00); // ISCPD, Enable Indiv Short Protection for 8 Channels
// write(0x0004, 0xFF); // ISCPD, Disable Indiv Short Protection for 8 Channels

write(0x001F, 0xAA); // ADDP, Set Address Pointer to Secondary Register Bank
write(0x0001, 0x00); // LCS, Enable B8ZS/HDB3 Operation for 8 Channels
// write(0x0001, 0xFF); // LCS, Enable AMI Operation for 8 Channels

write(0x001F, 0x01); // ADDP, Set Address Pointer to Individual Register Bank
// write(0x0002, 0x00); // IJAFDS, Indiv JA 32 Bit Depth for 8 Channels
write(0x0002, 0xFF); // IJAFDS, Indiv JA 128 Bit Depth for 8 Channels

write(0x001F, 0x01); // ADDP, Set Address Pointer to Individual Register Bank
// write(0x0001, 0x00); // IJAPS, Indiv JA Transmit Path for 8 Channels
write(0x0001, 0xFF); // IJAPS, Indiv JA Receive Path for 8 Channels

write(0x001F, 0x01); // ADDP, Set Address Pointer to Individual Register Bank
// write(0x0000, 0x00); // IJAE, Disable Indiv Jitter Attenuator for 8 Channels
write(0x0000, 0xFF); // IJAE, Enable Indiv Jitter Attenuator for 8 Channels

/* Configure all channels for a T1 pulse template output */
write(0x001F, 0x00); // ADDP, Set Address Pointer to Primary Register Bank

Write(0x0010, 0x00) // TST, Select Channel 1 for Template Configuration
Write(0x0011, 0x07) // TS, T1 Mode 100 ohm 533-655 ft. TX/RX Impedance Match

Write(0x0010, 0x01) // TST, Select Channel 2 for Template Configuration
Write(0x0011, 0x07) // TS, T1 Mode 100 ohm 533-655 ft. TX/RX Impedance Match

Write(0x0010, 0x02) // TST, Select Channel 3 for Template Configuration
Write(0x0011, 0x07) // TS, T1 Mode 100 ohm 533-655 ft. TX/RX Impedance Match

Write(0x0010, 0x03) // TST, Select Channel 4 for Template Configuration
Write(0x0011, 0x07) // TS, T1 Mode 100 ohm 533-655 ft. TX/RX Impedance Match

Write(0x0010, 0x04) // TST, Select Channel 5 for Template Configuration
Write(0x0011, 0x07) // TS, T1 Mode 100 ohm 533-655 ft. TX/RX Impedance Match

Write(0x0010, 0x05) // TST, Select Channel 6 for Template Configuration
Write(0x0011, 0x07) // TS, T1 Mode 100 ohm 533-655 ft. TX/RX Impedance Match

Write(0x0010, 0x06) // TST, Select Channel 7 for Template Configuration
Write(0x0011, 0x07) // TS, T1 Mode 100 ohm 533-655 ft. TX/RX Impedance Match

Write(0x0010, 0x07) // TST, Select Channel 8 for Template Configuration
Write(0x0011, 0x07) // TS, T1 Mode 100 ohm 533-655 ft. TX/RX Impedance Match

linux操作系统文章专题:linux操作系统详解(linux不再难懂)


关键词: DS26303 LIU 嵌入式

评论


相关推荐

技术专区

关闭