lpcware

Bug report : lpcopen_2_10_lpcxpresso_nxp_lpcxpresso_1769, gpdma_17xx_40xx.c

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by thedaz on Mon Apr 04 11:53:02 MST 2016
The function

IntStatus Chip_GPDMA_IntGetStatus(LPC_GPDMA_T *pGPDMA, GPDMA_STATUS_T type, uint8_t channel)


contains bad a bad implementation casting a logical and operation on the DMA interrupt status registers into the IntStatus enumeration type. Because the logical and will result in values != 0 or 1 the function will deliver an invalid return code unless it is called for DMA channel 0 only.


switch (type) {
case GPDMA_STAT_INT:/* check status of DMA channel interrupts */
return (IntStatus) (pGPDMA->INTSTAT & (((1UL << channel) & 0xFF)));
        ...


should instead be


switch (type) {
case GPDMA_STAT_INT:/* check status of DMA channel interrupts */
return (pGPDMA->INTSTAT & (((1UL << channel) & 0xFF))) ? SET : RESET;
        ...

Outcomes