// ***************************************************************************** // ***************************************************************************** // Section: System Interrupt Vector Functions // ***************************************************************************** // ***************************************************************************** void __ISR(_UART_2_VECTOR, ipl4AUTO) _IntHandlerDrvUsartInstance0(void) { DRV_USART_TasksTransmit(sysObj.drvUsart0); DRV_USART_TasksReceive(sysObj.drvUsart0); DRV_USART_TasksError(sysObj.drvUsart0); }
static void _SYS_Tasks ( void ) { while(1) { /* Maintain system services */ SYS_DEVCON_Tasks(sysObj.sysDevcon); /* Maintain Device Drivers */ DRV_USART_TasksTransmit(sysObj.drvUsart0); DRV_USART_TasksReceive(sysObj.drvUsart0); DRV_USART_TasksError (sysObj.drvUsart0); /* Maintain Middleware */ /* Task Delay */ } }
/******************************************************************************* Function: void _DRV_USART_DMA_EventHandler(SYS_DMA_TRANSFER_EVENT event, SYS_DMA_CHANNEL_HANDLE handle, uintptr_t contextHandle) Summary: Callback for the DMA channels Description: Callback for the DMA channels Remarks: None */ void _DRV_USART_DMA_EventHandler(SYS_DMA_TRANSFER_EVENT event, SYS_DMA_CHANNEL_HANDLE handle, uintptr_t contextHandle) { DRV_USART_OBJ *drvObj; DRV_USART_BUFFER_OBJ *bufObject; DRV_USART_CLIENT_OBJ *clientObj; if(SYS_DMA_CHANNEL_HANDLE_INVALID == handle || 0 == handle || 0 == contextHandle ) { /* This means the handle is invalid */ SYS_DEBUG(SYS_ERROR_DEBUG, "Handle is invalid \r\n"); return; } drvObj = (DRV_USART_OBJ *)contextHandle; if(handle == drvObj->dmaChannelHandleWrite) { bufObject = drvObj->queueWrite; } else { bufObject = drvObj->queueRead; } clientObj = bufObject->hClient; if(SYS_DMA_TRANSFER_EVENT_COMPLETE == event) { bufObject->size = 0; clientObj->bufferEvent = DRV_USART_BUFFER_EVENT_COMPLETE; } else if(SYS_DMA_TRANSFER_EVENT_ABORT == event) { bufObject->size = DRV_USART_DMA_TRANSFER_ABORT; clientObj->bufferEvent = DRV_USART_BUFFER_EVENT_ABORT; } else if(SYS_DMA_TRANSFER_EVENT_ERROR == event) { bufObject->size = DRV_USART_DMA_TRANSFER_ERROR; clientObj->bufferEvent = DRV_USART_BUFFER_EVENT_ERROR; } else { ; } /* Call the USART Tasks */ if(handle == drvObj->dmaChannelHandleWrite) { SYS_MODULE_OBJ usartModule; /* Find out the index of drvObj in gDrvUSARTObj array because DRV_USART_TasksTransmit expects an index as parameter */ usartModule = drvObj - (DRV_USART_OBJ *)&gDrvUSARTObj[0]; DRV_USART_TasksTransmit(usartModule); } else if(handle == drvObj->dmaChannelHandleRead) { SYS_MODULE_OBJ usartModule; /* Find out the index of drvObj in gDrvUSARTObj array because DRV_USART_TasksTransmit expects an index as parameter */ usartModule = drvObj - (DRV_USART_OBJ *)&gDrvUSARTObj[0]; DRV_USART_TasksReceive(usartModule); } /*TBD: To be Enabled when DRV_USART_TasksError function is implemented */ //DRV_USART_TasksError((SYS_MODULE_OBJ)drvObj); }