Skip to content

Commit

Permalink
[XDMAC] Add missing interrupt events to interrupt handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Pertsch committed Dec 21, 2021
1 parent f692803 commit 3f3cad3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
30 changes: 21 additions & 9 deletions peripheral/xdmac_11161/templates/plib_xdmac.c.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ void ${DMA_INSTANCE_NAME}_InterruptHandler( void )
XDMAC_CH_OBJECT *xdmacChObj = (XDMAC_CH_OBJECT *)&xdmacChannelObj[0];
uint8_t channel = 0U;
volatile uint32_t chanIntStatus = 0U;

XDMAC_TRANSFER_EVENT event = XDMAC_TRANSFER_NONE;

/* Iterate all channels */
for (channel = 0U; channel < XDMAC_ACTIVE_CHANNELS_MAX; channel++)
{
event = XDMAC_TRANSFER_NONE;

/* Process events only channels that are active and has global interrupt enabled */
if ((1 == xdmacChObj->inUse) && (${DMA_INSTANCE_NAME}_REGS->XDMAC_GIM & (XDMAC_GIM_IM0_Msk << channel)) )
{
Expand All @@ -97,22 +100,31 @@ void ${DMA_INSTANCE_NAME}_InterruptHandler( void )

if (chanIntStatus & ( XDMAC_CIS_RBEIS_Msk | XDMAC_CIS_WBEIS_Msk | XDMAC_CIS_ROIS_Msk))
{
xdmacChObj->busyStatus = false;

/* It's an error interrupt */
if (NULL != xdmacChObj->callback)
{
xdmacChObj->callback(XDMAC_TRANSFER_ERROR, xdmacChObj->context);
}
event = XDMAC_TRANSFER_ERROR;
}
else if (chanIntStatus & XDMAC_CIS_BIS_Msk)
{
/* It's a block transfer complete interrupt */
event = XDMAC_TRANSFER_COMPLETE;
}
else if (chanIntStatus & XDMAC_CIS_LIS_Msk)
{
/* It's an end of linked list interrupt */
event = XDMAC_TRANSFER_LINKED_LIST_END;
}
else if (chanIntStatus & XDMAC_CIS_FIS_Msk)
{
/* It's an end of flush operation interrupt */
event = XDMAC_TRANSFER_FLUSH_END;
}

if (event != XDMAC_TRANSFER_NONE) {
xdmacChObj->busyStatus = false;

/* It's a block transfer complete interrupt */
if (NULL != xdmacChObj->callback)
{
xdmacChObj->callback(XDMAC_TRANSFER_COMPLETE, xdmacChObj->context);
xdmacChObj->callback(event, xdmacChObj->context);
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion peripheral/xdmac_11161/templates/plib_xdmac_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,13 @@ typedef enum
XDMAC_TRANSFER_COMPLETE = 1,

/* Error while processing the request */
XDMAC_TRANSFER_ERROR = 2
XDMAC_TRANSFER_ERROR = 2,

/* Reached end of linked list */
XDMAC_TRANSFER_LINKED_LIST_END = 3,

/* Requested flush operation has ended */
XDMAC_TRANSFER_FLUSH_END = 4

} XDMAC_TRANSFER_EVENT;

Expand Down

0 comments on commit 3f3cad3

Please sign in to comment.