⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_viewc.c

📁 lpc2478开发板基于IAR编译器移植ucos实验例程
💻 C
📖 第 1 页 / 共 2 页
字号:
    VICIntEnable    =  (1 << VIC_UART1);                                /* Enable Interrupts                                        */
#endif
}

/*
*********************************************************************************************************
*                                       Disable & Enable Rx Interrupts
*
* Description: These functions enable and disable the Rx interrupt.
*
* Arguments   : none
*
* Returns     : none
*********************************************************************************************************
*/

void  OSView_RxIntDis (void)
{
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_0
    U0IER = 0;
#endif

#if OS_VIEW_COMM_SEL == OS_VIEW_UART_1
    U1IER = 0;
#endif
}

void  OSView_RxIntEn (void)
{
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_0
    U0IER = DEF_BIT_00;
#endif

#if OS_VIEW_COMM_SEL == OS_VIEW_UART_1
    U1IER = DEF_BIT_00;
#endif
}

/*
*********************************************************************************************************
*                                 Rx & Tx Communication handler for uC/OS-View
*
* Note(s)    : This adaptation of uC/OS-View assumes that a 'combined' interrupt is generated by the UART
*              and thus these functions need not be populated.
*********************************************************************************************************
*/

void  OSView_RxISRHandler (void)
{
    ;
}

void  OSView_TxISRHandler (void)
{
    ;
}


/*
*********************************************************************************************************
*                   Rx/Tx Communication handler for uC/OS-View ('combined' interrupt handler)
*
* Description: The Rx/Tx ISR handler.
*
* Arguments   : none.
*
* Returns     : none
*********************************************************************************************************
*/

void  OSView_RxTxISRHandler (void)
{
    volatile  INT8U  rx_data;
    volatile  INT8U  lsr;
    volatile  INT8U  iir;


#if OS_VIEW_COMM_SEL == OS_VIEW_UART_0
    iir = U0IIR & 0x0F;
    while (iir != 1) {
        switch (iir) {
            case  0:                                                    /* Modem interrupt?                                         */
                 break;

            case  2:                                                    /* Transmitted character?                                   */
                 OSView_TxHandler();
                 break;

            case  4:                                                    /* Received a character?                                    */
                 lsr     = U0LSR;
                 rx_data = U0RBR;
                 OSView_RxHandler(rx_data);                             /* Call the generic Rx handler                              */
                 break;

            case  6:                                                    /* Receive Line Status interrupt?                           */
                 break;

            case 12:                                                    /* CTI interrupt?                                           */
                 break;
        }
        iir = U0IIR & 0x0F;
    }
#endif

#if OS_VIEW_COMM_SEL == OS_VIEW_UART_1
    iir = U1IIR & 0x0F;
    while (iir != 1) {
        switch (iir) {
            case  0:                                                    /* Modem interrupt?                                         */
                 break;

            case  2:                                                    /* Transmitted character?                                   */
                 OSView_TxHandler();
                 break;

            case  4:                                                    /* Received a character?                                    */
                 lsr     = U1LSR;
                 rx_data = U1RBR;
                 OSView_RxHandler(rx_data);                             /* Call the generic Rx handler                              */
                 break;

            case  6:                                                    /* Receive Line Status interrupt?                           */
                 break;

            case 12:                                                    /* CTI interrupt?                                           */
                 break;
        }
        iir = U1IIR & 0x0F;
    }
#endif
}


/*
*********************************************************************************************************
*                                      Communication for uC/OS-View
*
* Description: Send 1 character to COM Port
*
* Arguments   : c   is the character to send.
*
* Returns     : none
*********************************************************************************************************
*/

void  OSView_Tx1 (INT8U c)
{
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_0
    U0THR = c;
#endif

#if OS_VIEW_COMM_SEL == OS_VIEW_UART_1
    U1THR = c;
#endif
}

/*
*********************************************************************************************************
*                                       Disable & Enable Tx Interrupts
*
* Description: These functions enable and disable the Tx interrupt.
*
* Arguments   : none
*
* Returns     : none
*********************************************************************************************************
*/

void  OSView_TxIntDis (void)
{
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_0
    U0IER = DEF_BIT_00;
#endif

#if OS_VIEW_COMM_SEL == OS_VIEW_UART_1
    U1IER = DEF_BIT_00;
#endif
}

void  OSView_TxIntEn (void)
{
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_0
    U0IER = DEF_BIT_01 | DEF_BIT_00;
#endif

#if OS_VIEW_COMM_SEL == OS_VIEW_UART_1
    U1IER = DEF_BIT_01 | DEF_BIT_00;
#endif
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -