Text Compare
Produced: 9/27/2012 6:38:25 PM
   
Mode:  All, Ignoring Unimportant  
Left file: E:\uart\Uart.c     Right file: E:\uart\Uart_Modified.c  
/** = /**
*  \brief   Perform read/write transfer   *  \brief   Perform read/write transfer
*   *
*           This function is called from ISR and Task context to do transfer   *           This function is called from ISR and Task context to do transfer
*   *
*  \param   chanHandle     [IN]     Handle to the channel   *  \param   chanHandle     [IN]     Handle to the channel
*   *
*  \return  None   *  \return  None
*   *
*  \enter   chanHandle  must be a valid pointer and should not be null.   *  \enter   chanHandle  must be a valid pointer and should not be null.
*   *
*  \leave   Not Implemented.   *  \leave   Not Implemented.
*   *
*/   */
static Void uartIntrHandler(Uart_ChanObj *chanHandle)   static Void uartIntrHandler(Uart_ChanObj *chanHandle)
{   {
    UInt32           xfer       = 0;       UInt32           xfer       = 0;
    IOM_Packet      *ioPacket   = NULL;       IOM_Packet      *ioPacket   = NULL;
    Uart_Object     *instHandle = NULL;       Uart_Object     *instHandle = NULL;
#ifdef BIOS_PWRM_ENABLE   #ifdef BIOS_PWRM_ENABLE
    Power_Status     status     = Power_SOK;       Power_Status     status     = Power_SOK;
    UInt32           count      = 0x00;       UInt32           count      = 0x00;
#endif   #endif
     
    assert(NULL != chanHandle);       assert(NULL != chanHandle);
    instHandle = (Uart_Object*)(chanHandle->devHandle);       instHandle = (Uart_Object*)(chanHandle->devHandle);
    assert(NULL != instHandle);       assert(NULL != instHandle);
     
    /* If this is called from SWI(Tasklet) context                            */       /* If this is called from SWI(Tasklet) context                            */
    if (Uart_OpMode_INTERRUPT == instHandle->opMode)       if (Uart_OpMode_INTERRUPT == instHandle->opMode)
    {       {
        EventCombiner_enableEvent(instHandle->deviceInfo.cpuEventNumber);           EventCombiner_enableEvent(instHandle->deviceInfo.cpuEventNumber);
    }       }
     
    ioPacket = chanHandle->activeIOP;       ioPacket = chanHandle->activeIOP;
     
    if (NULL  != ioPacket)       if (NULL  != ioPacket)
    {       {
        xfer = uartXfer(chanHandle,           xfer = uartXfer(chanHandle,
                        chanHandle->activeBuf,                           chanHandle->activeBuf,
                        chanHandle->bytesRemaining);                           chanHandle->bytesRemaining);
     
        chanHandle->bytesRemaining    -= xfer;           chanHandle->bytesRemaining    -= xfer;
        chanHandle->activeBuf         += xfer;           chanHandle->activeBuf         += xfer;
     
        if (Uart_INPUT == chanHandle->mode)           if (Uart_INPUT == chanHandle->mode)
        {           {
            instHandle->stats.rxBytes  += xfer;               instHandle->stats.rxBytes  += xfer;
            /* Re-enable the interrupt here, because it was disabled in ISR   *               /* Re-enable the interrupt here, because it was disabled in ISR   *
             * before posting the SWI. This interrupt will be aprropriately   *                * before posting the SWI. This interrupt will be aprropriately   *
             * disabled below                                                 */                * disabled below                                                 */
  -+             if (0 != chanHandle->bytesRemaining)
                {
            uartIntrEnable(instHandle, (UInt32)Uart_Intr_RHR); =                 uartIntrEnable(instHandle, (UInt32)Uart_Intr_RHR);
  -+             }
        } =         }
        else           else
        {           {
            instHandle->stats.txBytes  += xfer;               instHandle->stats.txBytes  += xfer;
            /* Re-enable the interrupt here, because it was disabled in ISR   *               /* Re-enable the interrupt here, because it was disabled in ISR   *
             * before posting the SWI. This interrupt will be aprropriately   *                * before posting the SWI. This interrupt will be aprropriately   *
             * disabled below                                                 */                * disabled below                                                 */
  -+             if (0 != chanHandle->bytesRemaining)
                {
            uartIntrEnable(instHandle, (UInt32)Uart_Intr_THR); =                 uartIntrEnable(instHandle, (UInt32)Uart_Intr_THR);
  -+             }
        } =         }
     
/*** ---- ~~ Skipped Lines ~~ ---- ***/   /*** ---- ~~ Skipped Lines ~~ ---- ***/
     
}   }