快乐虾
http://blog.csdn.net/lights_joy/
lights@hb165.com
本文适用于
ADI bf561 DSP
uclinux-2008r1.5-rc3 ( 移植到 vdsp5)
Visual DSP++ 5.0(update 5)
欢迎转载,但请保留作者信息
/* Initialise UART - when booting from u-boot, the UART is not disabled
* so if we dont initalize here, our serial console gets hosed */
p0.h = hi(UART_LCR);
p0.l = lo(UART_LCR);
r0 = 0x0(Z);
w[p0] = r0.L; /* To enable DLL writes */
ssync;
p0.h = hi(UART_DLL);
p0.l = lo(UART_DLL);
r0 = 0x0(Z);
w[p0] = r0.L;
ssync;
p0.h = hi(UART_DLH);
p0.l = lo(UART_DLH);
r0 = 0x00(Z);
w[p0] = r0.L;
ssync;
p0.h = hi(UART_GCTL);
p0.l = lo(UART_GCTL);
r0 = 0x0(Z);
w[p0] = r0.L; /* To enable UART clock */
ssync;
这段代码用于关闭串串口,但是这里有个问题,在设置 UART_DLL 和 UART_DLH 时必须将 UART_LCR 的最高位设置为 1 ,但是原始代码中却未设置,这样就造成了设置 UART_DLL 和 UART_DLH 必然失败。所以
r0 = 0x0(Z);
应该改为
r0 = 0x80(Z);
下面的说明来自于 vdsp 文档:
The UART _ DLL register is mapped to the same address as the UART_THR and UART_RBR registers. The UART_DLH register is mapped to the same address as the Interrupt Enable register ( UART_IER ). The DLAB bit in UART_LCR must be set before the UART Divisor Latch registers can be accessed.
在将 UART_DLH 和 UART_DLL 置 0 后,它的 Divisor 将变成 65536 。
这一句
w[p0] = r0.L; /* To enable UART clock */
也相当奇怪,如果按照注释的说法是要启用 UART clock ,但是将 UART_GCTL 的值设置为 0 却明显是关闭 clock 。
1 参考资料
head.s 分析 (1) :保存 u-boot 传递过来的指针 (2009-1-19)
head.s 分析 (2) : SYSCFG 配置 (2009-1-19)
head.s 分析 (3) :数据及指针寄存器清 0 (2009-1-19)
head.s 分析 (4) :关闭 CACHE (2009-01-19)