📄 os_viewc.c
字号:
/*
*********************************************************************************************************
* Enable Rx Interrupts
*********************************************************************************************************
*/
void OSView_RxIntEn (void)
{
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_5
U5IER |= BIT0; /* Enable Receive Interrupts */
#endif
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_7
HSU7_CTRL |= BIT6; /* Enable Receive Interrupts */
#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_5
iir = U5IIR & 0x0F;
while (iir != 1) {
switch (iir) {
case 2: /* Transmitted character? */
OSView_TxHandler(); /* Call the Tx handler, Int. cleared by read of U5IIR */
break;
case 4: /* Received a character? */
rx_data = U5RBR; /* Read the data. Int. cleared by read of U5RBR */
OSView_RxHandler(rx_data); /* Call the generic Rx handler */
break;
case 6: /* Receive Line Status interrupt? */
lsr = U5LSR; /* Read the Line Status Register to clear the interrupt */
break;
case 12: /* CTI interrupt? */
rx_data = U5RBR; /* Read the data register to clear the interrupt */
break;
}
iir = U5IIR & 0x0F;
}
#endif
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_7
iir = (HSU7_IIR & 0x3F); /* Read the interrupt status register */
if ((iir & BIT0) == BIT0) { /* Tx complete interrupt */
HSU7_IIR |= BIT0; /* Clear the Interrupt source */
OSView_TxHandler(); /* Call the Tx handler, Int. cleared by read of U5IIR */
}
if ((iir & BIT1) == BIT1) { /* If FIFO is below threshhold */
while ((HSU7_LEVEL & 0xFF) > 0) { /* Read bytes from FIFO while there is data present */
rx_data = (HSU7_RX & 0xFF); /* Read the data. Int. cleared by read of U5RBR */
OSView_RxHandler(rx_data); /* Call the generic Rx handler */
}
}
if ((iir & BIT3) == BIT3) { /* Framing Error */
HSU7_IIR |= BIT3; /* Clear the Interrupt source */
}
if ((iir & BIT4) == BIT4) { /* Break Interrupt */
HSU7_IIR |= BIT4; /* Clear the Interrupt source */
}
if ((iir & BIT5) == BIT5) { /* Overrun Interrupt */
HSU7_IIR |= BIT5; /* Clear the Interrupt source */
}
#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_5
U5THR = c;
#endif
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_7
HSU7_TX = c;
#endif
}
/*$PAGE*/
/*
*********************************************************************************************************
* Disable Tx Interrupts
*********************************************************************************************************
*/
void OSView_TxIntDis (void)
{
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_5
U5IER &= ~BIT1; /* Disable UART5 Tx interrupts */
#endif
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_7
HSU7_CTRL &= ~BIT5; /* Disable UART7 Tx interrupts */
#endif
}
/*
*********************************************************************************************************
* Enable Tx Interrupts
*********************************************************************************************************
*/
void OSView_TxIntEn (void)
{
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_5
U5IER |= BIT1; /* Enable Tx interrupts */
#endif
#if OS_VIEW_COMM_SEL == OS_VIEW_UART_7
HSU7_CTRL |= BIT5; /* Enable Tx interrupts */
#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 + -