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

📄 os_viewc.c

📁 官方的UCOSii的移植文件
💻 C
📖 第 1 页 / 共 2 页
字号:
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_0
    U0IER = 0;
#endif

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

/*
*********************************************************************************************************
*                                       Enable Rx Interrupts
*********************************************************************************************************
*/

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

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

/*
*********************************************************************************************************
*                                 Rx Communication handler for uC/OS-View
*
* Description: This function is called by OSView_RxISR (see OS_VIEWa.ASM) to process a received
*              character interrupt.
*
* Note(s)    : This adaptation of uC/OS-View assumes that a 'combined' interrupt is generated by the UART
*              and thus this function is not needed.
*********************************************************************************************************
*/

void  OSView_RxISRHandler (void)
{
}

/*
*********************************************************************************************************
*                                Rx/Tx Communication handler for uC/OS-View
*
* Description: This function is NOT called because the M16C has a separate Rx and Tx ISR.
*********************************************************************************************************
*/

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
}

/*$PAGE*/
/*
*********************************************************************************************************
*                                      Communication for uC/OS-View
*
* Description: Send 1 character to COM Port
*********************************************************************************************************
*/

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
}

/*$PAGE*/
/*
*********************************************************************************************************
*                                       Disable Tx Interrupts
*********************************************************************************************************
*/

void  OSView_TxIntDis (void)
{
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_0
    U0IER = BIT0;                                                       /* Just enable the receive interrupts                       */
#endif

#if OS_VIEW_COMM_SEL == OS_VIEW_UART_1
    U1IER = BIT0;                                                       /* Just enable the receive interrupts                       */
#endif
}

/*
*********************************************************************************************************
*                                       Enable Tx Interrupts
*********************************************************************************************************
*/

void  OSView_TxIntEn (void)
{
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_0
    U0IER = BIT1 | BIT0;
#endif

#if OS_VIEW_COMM_SEL == OS_VIEW_UART_1
    U1IER = BIT1 | BIT0;
#endif
}

/*
*********************************************************************************************************
*                                 Tx Communication handler for uC/OS-View
*                                            (PORT SPECIFIC)
*
* Description: Handle transmission of a character
*
* Note(s)    : 1) This function is called by OSView_RxISR (see OS_VIEWa.ASM)
*              2) This adaptation of uC/OS-View assumes that a 'combined' interrupt is generated by the
*                 UART and thus this function is not needed.
*********************************************************************************************************
*/

void  OSView_TxISRHandler (void)
{
}


⌨️ 快捷键说明

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