This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TIRTOS中的串口中断配置问题



各位大神帮我看看我哪里写错了啊,谢谢,编译一直有错误

Description Resource Path Location Type
#68 expected a "}" main.c /freertos_demo line 335 C/C++ Problem

static void uart0_handle(void)
{
int i;
long data;

//获取经过屏蔽的中断状态
i = UARTIntStatus(UARTA0_BASE,true);
//接收中断
if(i&UART_INT_RX)
{
//判断FIFO有没有数据
while(UARTCharsAvail(UARTA0_BASE))
{
//获取接收的数据,并直接再发送
//UARTCharPut(UARTA0_BASE,UARTCharGet(UARTA0_BASE));
data = UARTCharGet(UARTA0_BASE);
osi_MsgQWrite(&MsgQ, &data, OSI_NO_WAIT);
}
//清除中断标志位
UARTIntClear(UARTA0_BASE,UART_INT_RX);
}

void vTestTask1( void *pvParameters )
{
char pcMessage[MAX_MSG_LENGTH];
for( ;; )
{
/* Wait for a message to arrive. */
osi_MsgQRead(&MsgQ, pcMessage, OSI_WAIT_FOREVER);

UART_PRINT("message = ");
UART_PRINT(pcMessage);
UART_PRINT("\n\r");
//osi_Sleep(200);
}
}


//*****************************************************************************
int main( void )
{

BoardInit();

PinMuxConfig();

UARTConfigSetExpClk(UARTA0_BASE,PRCMPeripheralClockGet(PRCM_UARTA0),
UART_BAUD_RATE, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
//设置中断回调函数
UARTIntRegister(UARTA0_BASE,uart0_handle);
//设置接收中断
UARTIntEnable(UARTA0_BASE,UART_INT_RX);


UARTFIFODisable(UARTA0_BASE);

InitTerm();


ClearTerm();

/
DisplayBanner(APP_NAME);


OsiReturnVal_e osi_retVal;
osi_retVal = osi_MsgQCreate(&MsgQ, "MSGQ", MAX_MSG_LENGTH, 10);
if(osi_retVal != OSI_OK)
{
// Queue was not created and must not be used.
while(1);
}

//
// Create the Queue Receive task
//
osi_TaskCreate( vTestTask1, "TASK1",\
OSI_STACK_SIZE, NULL, 1, NULL );

osi_start();

return 0;
}

  • //----------------------------------------------------下面这段代码的函数最后少了一个}-------------------------------------------------

    static void uart0_handle(void)
    {
    int i;
    long data;

    //获取经过屏蔽的中断状态
    i = UARTIntStatus(UARTA0_BASE,true);
    //接收中断
    if(i&UART_INT_RX)
    {
    //判断FIFO有没有数据
    while(UARTCharsAvail(UARTA0_BASE))
    {
    //获取接收的数据,并直接再发送
    //UARTCharPut(UARTA0_BASE,UARTCharGet(UARTA0_BASE));
    data = UARTCharGet(UARTA0_BASE);
    osi_MsgQWrite(&MsgQ, &data, OSI_NO_WAIT);
    }
    //清除中断标志位
    UARTIntClear(UARTA0_BASE,UART_INT_RX);
    }

    }

    //-----------------------------------------------------------------------------------------------------------------------------------------