[an error occurred while processing this directive]
|
void setUART(void)
{
asm (" mov #0001h,port(#0x9c0c)");//URPECR
asm (" mov #0000000010000011b,port(#0x9c03)");//URLCR ?7?6
asm (" mov #0013h,port(#0x9c00)");//URDLL!!*
asm (" mov #0000h,port(#0x9c01)");//URDLM!!*0004h
asm (" and #1111111101111111b,port(#0x9c03)");//URLCR
asm (" mov #0000000010001001b,port(#0x9c02)");//URFCR*
}
void setDMA(void) {
// DMA ch #3 for UART RX operation
asm (" mov #0000001000001100b, port(#0x0c60)");//DMA_CSDP3*
// ?? DSTB=00 DSTP=0 DST=0011 SRCB=?? SRCP=0
// SRC=0001 DT=01
asm (" mov #0100101101001011b, port(#0x0c61)");//DMA_CCR3*
// * ! DSTAM=00 SRCAM=01 EP=? R=? RPT=? AI=1
// EN=! PRIO=1 FS=0 SYNC=01011 (UART resive event)
asm (" mov #0000000000101000b, port(#0x0c62)");//DMA_CICR3
// ? // FRAME_IE & BLOCK_IE
asm (" mov #(0x9c00 << 1 ) & 0FFFFh, port(#0x0c64)");//DMA_CSSA_L3
asm (" mov #(0x9c00 >> 15) & 1 , port(#0x0c65)");//DMA_CSSA_U3
asm (" mov #(0x4800 << 1 ) & 0FFFFh, port(#0x0c66)");//DMA_CDSA_L3
asm (" mov #(0x4800 >> 15) & 1 , port(#0x0c67)");//DMA_CDSA_U3
asm (" mov #32,port(#0x0c68)");//DMA_CEN3 //256 elements per frame
asm (" mov #1,port(#0x0c69)");//DMA_CFN3 // 1 frames per block
asm (" mov #0,port(#0x0C6A)");//DMA_CSEI3 // clear element index
asm (" mov #0,port(#0x0C6B)");//DMA_CSFI3 // clear frame index
asm (" mov #0,port(#0x0C6E)");//DMA_CDEI3 // clear element index
asm (" mov #0,port(#0x0C6F)");//DMA_CDFI3 // clear frame index
// DMA ch #2 for UART TX operation
asm (" mov #0000011000000000b, port(#0x0c40)");//DMA_CSDP2
// ?? DSTB=00 DSTP=0 DST=0011 SRCB=?? SRCP=0
asm (" mov #0001100101001100b, port(#0x0c41)");//DMA_CCR2 // SRC=0001 DT=01
//asm(" mov #0001100101001100b, port(#0x0c41)");//DMA_CCR2
// ??? ! DSTAM=00 SRCAM=01 EP=? R=? RPT=? AI=1
// EN=! PRIO=1 FS=0 SYNC=01100 (UART transmit event)
asm (" mov #0000000000101000b, port(#0x0c42)");//DMA_CICR2
// ? // FRAME_IE & BLOCK_IE
asm (" mov #(0x4600 << 1 ) & 0FFFFh, port(#0x0c44)");//DMA_CSSA_L2
asm (" mov #(0x4600 >> 15) & 1 , port(#0x0c45)");//DMA_CSSA_U2
asm (" mov #(0x9c00 << 1 ) & 0FFFFh, port(#0x0c46)");//DMA_CDSA_L2
// 0x2c02
asm (" mov #(0x9c00 >> 15) & 1 , port(#0x0c47)");//DMA_CDSA_U2
// 0x2c02 0x4100
asm (" mov #32,port(#0x0c48)");//DMA_CEN2 //256 elements per frame
asm (" mov #1,port(#0x0c49)");//DMA_CFN2 // 1 frames per block
asm (" mov #0,port(#0x0C4A)");//DMA_CSEI2 // clear element index
asm (" mov #0,port(#0x0C4B)");//DMA_CSFI2 // clear frame index
asm (" mov #0,port(#0x0C4E)");//DMA_CDEI2 // clear element index
asm (" mov #0,port(#0x0C4F)");//DMA_CDFI2 // clear frame index
}
void init_perify()
{
setUART();
setDMA();
asm (" or #0x0080,port(#0x0c61)");//DMA_CCR3 // enable DMA ch #3 for UART RX
asm (" or #0x0080,port(#0x0c41)");//DMA_CCR2 // enable DMA ch #2 for UART TX
asm (" or #8000h,port(#0x9c0c)");//URPECR // enable uart
asm (" or #0000000011000000b,port(#0x2c05)");//CLKG, FSG enebled
asm (" or #8000h,port(#0x9c0c)");//URPECR // enable uart
}
void main()
{
asm (" BSET ST1_INTM");
asm (" mov #0x0001,mmap(@IVPH)");
asm (" mov #0x0001,mmap(@IVPD)");
asm (" mov #0x0004,mmap(@DBIER0)");
asm (" mov #0x0025,mmap(@DBIER1)");
asm (" mov #0x0004,mmap(@IER0)");
asm (" mov #0x0025,mmap(@IER1)");
init_perify();
asm (" BCLR ST1_INTM");
for(;;);
}
E-mail: info@telesys.ru