我用普通的中断方式实现uart串口通信可以, 但用bios 方式中断却没有中断产生不知为什么? 恳请各位高手给指点一下!万分感激! 公司买的开发板,在上面做DM642做UART串口通信实验。它是由一个外围芯片TL16C752B提供两个中断请求信号INTA、INTB分别用于通道A和B申请TMS320DM642的中断。在DM642中,INTA和ITB相与,复用DM642的INT5. 大家帮看一下哪里bios写的程序哪里存在问题? 这是普通方式实现的程序: #include <csl.h> #include <csl_emifa.h> #include <csl_irq.h> #include <csl_chip.h> #include "stdio.h"
#include "seeddm642.h" #include "seeddm642_uart.h"
/*SEEDDM642的emifa的设置结构*/ EMIFA_Config Seeddm642ConfigA ={ 0x00052078,/*gblctl EMIFA(B)global control register value */ /*将CLK6、4、1使能;将MRMODE置1;使能EK2EN,EK2RATE*/ 0xffffffd3,/*cectl0 CE0 space control register value*/ /*将CE0空间设为SDRAM*/ 0x73a28e01,/*cectl1 CE1 space control register value*/ /*Read hold: 1 clock; MTYPE : 0000,选择8位的异步接口 Read strobe :001110;14个clock宽度 TA:2 clock; Read setup 2 clock; Write hold :2 clock; Write strobe: 14 clock Write setup :7 clock -- --------------- 14c /1c ----------------/ */ 0x22a28a22, /*cectl2 CE2 space control register value*/ 0x22a28a42, /*cectl3 CE3 space control register value*/ 0x57115000, /*sdctl SDRAM control register value*/ 0x0000081b, /*sdtim SDRAM timing register value*/ 0x001faf4d, /*sdext SDRAM extension register value*/ 0x00000002, /*cesec0 CE0 space secondary control register value*/ 0x00000002, /*cesec1 CE1 space secondary control register value*/ 0x00000002, /*cesec2 CE2 space secondary control register value*/ 0x00000073 /*cesec3 CE3 space secondary control register value*/ };
SEEDDM642_UART_Config UartConfig ={ 0x01,/*寄存器IER*/ 0x57,/*寄存器FCR*/ 0x03,/*寄存器LCR*/ 0x08,/*寄存器MCR*/ };
extern far void vectors();
Uint8 IOreadback; Uint16 buffer; SEEDDM642_UART_Handle SEEDuartHandleA; SEEDDM642_UART_Handle SEEDuartHandleB;
/*此程序可将四个采集口的数据经过Video Port0送出*/ void main() { /*-------------------------------------------------------*/ /* perform all initializations */ /*-------------------------------------------------------*/ /*Initialise CSL,初始化CSL库*/ CSL_init(); /*----------------------------------------------------------*/ /*EMIFA的初始化,将CE0设为SDRAM空间,CE1设为异步空间 注,DM642支持的是EMIFA,而非EMIF*/ EMIFA_config(&Seeddm642ConfigA); /*----------------------------------------------------------*/ IRQ_globalDisable(); //IRQ_reset(IRQ_EVT_EXTINT5); IRQ_nmiEnable(); IRQ_enable(IRQ_EVT_EXTINT5); IRQ_globalEnable(); /*中断向量表的初始化*/ //Point to the IRQ vector table /*测试串口A*/ /* Open UART */ SEEDuartHandleA = SEEDDM642_UART_open(SEEDDM642_UARTA, SEEDDM642_UART_BAUD9600, &UartConfig); /*Open UARTB*/ SEEDuartHandleB = SEEDDM642_UART_open(SEEDDM642_UARTB, SEEDDM642_UART_BAUD9600, &UartConfig); IRQ_setVecs(vectors); printf("Uart Test Begin...
"); /* Loop through 256 bytes */ /* for (;;) { buffer = SEEDDM642_UART_getChar(SEEDuartHandleA); // buffer = 0x55; SEEDDM642_UART_putChar(SEEDuartHandleA, (buffer & 0xff)); }*/ while(1);
}
interrupt void uart_isr(void) { Uint16 Data_Temp; Data_Temp = SEEDDM642_UART_rget(SEEDuartHandleA,0); printf("DATA : %x
",Data_Temp); }
下面为用bios方式写的程序: #include <csl.h> #include <csl_emifa.h> #include <csl_irq.h> #include <csl_chip.h> #include "stdio.h"
#include "seeddm642.h" #include "seeddm642_uart.h"
/*SEEDDM642的emifa的设置结构*/ EMIFA_Config Seeddm642ConfigA ={ 0x00052078,/*gblctl EMIFA(B)global control register value */ /*将CLK6、4、1使能;将MRMODE置1;使能EK2EN,EK2RATE*/ 0xffffffd3,/*cectl0 CE0 space control register value*/ /*将CE0空间设为SDRAM*/ 0x73a28e01,/*cectl1 CE1 space control register value*/ /*Read hold: 1 clock; MTYPE : 0000,选择8位的异步接口 Read strobe :001110;14个clock宽度 TA:2 clock; Read setup 2 clock; Write hold :2 clock; Write strobe: 14 clock Write setup :7 clock -- --------------- 14c /1c ----------------/ */ 0x22a28a22, /*cectl2 CE2 space control register value*/ 0x22a28a42, /*cectl3 CE3 space control register value*/ 0x57115000, /*sdctl SDRAM control register value*/ 0x0000081b, /*sdtim SDRAM timing register value*/ 0x001faf4d, /*sdext SDRAM extension register value*/ 0x00000002, /*cesec0 CE0 space secondary control register value*/ 0x00000002, /*cesec1 CE1 space secondary control register value*/ 0x00000002, /*cesec2 CE2 space secondary control register value*/ 0x00000073 /*cesec3 CE3 space secondary control register value*/ };
SEEDDM642_UART_Config UartConfig ={ 0x01,/*寄存器IER*/ 0x57,/*寄存器FCR*/ 0x03,/*寄存器LCR*/ 0x08,/*寄存器MCR*/ };
extern far void vectors();
Uint8 IOreadback; Uint16 buffer; SEEDDM642_UART_Handle SEEDuartHandleA; SEEDDM642_UART_Handle SEEDuartHandleB;
/*此程序可将四个采集口的数据经过Video Port0送出*/ void main() { /*-------------------------------------------------------*/ /* perform all initializations */ /*-------------------------------------------------------*/ /*Initialise CSL,初始化CSL库*/ CSL_init(); /*----------------------------------------------------------*/ /*EMIFA的初始化,将CE0设为SDRAM空间,CE1设为异步空间 注,DM642支持的是EMIFA,而非EMIF*/ EMIFA_config(&Seeddm642ConfigA); /*----------------------------------------------------------*/ IRQ_globalDisable(); IRQ_Reset(IRQ_EVT_EXTINT5); IRQ_nmiEnable(); IRQ_enable(IRQ_EVT_EXTINT5); IRQ_globalEnable(); /*中断向量表的初始化*/ //Point to the IRQ vector table /*测试串口A*/ /* Open UART */ SEEDuartHandleA = SEEDDM642_UART_open(SEEDDM642_UARTA, SEEDDM642_UART_BAUD9600, &UartConfig); /*Open UARTB*/ SEEDuartHandleB = SEEDDM642_UART_open(SEEDDM642_UARTB, SEEDDM642_UART_BAUD9600, &UartConfig); printf("Uart Test Begin...
");
}
interrupt void uart_isr(void) { Uint16 Data_Temp; Data_Temp = SEEDDM642_UART_rget(SEEDuartHandleA,0); printf("DATA : %x
",Data_Temp); }
|
|