Changeset 0af682c in rtems


Ignore:
Timestamp:
Nov 9, 2020, 8:16:51 AM (2 months ago)
Author:
Christian Mauderer <christian.mauderer@…>
Branches:
5
Children:
1dbdf94e
Parents:
f84c4a5
git-author:
Christian Mauderer <christian.mauderer@…> (11/09/20 08:16:51)
git-committer:
Christian Mauderer <christian.mauderer@…> (11/12/20 07:31:41)
Message:

bsp/atsam: Fix XDMAD status

In "bsp/atsam: Simplify XDMAD_Handler()" (5f813694f68cee) the interrupt
callback has been made unconditional. That allowed to avoid some special
deadlock situations in error cases. But it removed part of the XDMAD
status handling.

This patch adds the ability to update the XDMAD status from the
callback if that is necessary for the driver.

Fixes #4172

Location:
bsps/arm/atsam
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bsps/arm/atsam/contrib/libraries/libchip/source/xdmad.c

    rf84c4a5 r0af682c  
    133133}
    134134
     135/*
     136 * Update the internal xdmad state. Returns true if further processing in the
     137 * callback is recommended.
     138 *
     139 * In an earlier version of the API this has been done by the interrupt handler
     140 * directly. But in some cases the application might want to process some of the
     141 * other interrupts too. Therefore the user callback should now decide itself
     142 * whether this is necessary or not.
     143 */
     144bool XDMAD_UpdateStatusFromCallback(sXdmad *pXdmad,
     145                uint32_t Channel,
     146                uint32_t status)
     147{
     148        Xdmac *pXdmac;
     149        uint32_t xdmaGlobalChStatus;
     150        bool bExec;
     151
     152        bExec = false;
     153        pXdmac = pXdmad->pXdmacs;
     154        xdmaGlobalChStatus = XDMAC_GetGlobalChStatus(pXdmac);
     155
     156        if ((xdmaGlobalChStatus & (XDMAC_GS_ST0 << Channel)) == 0) {
     157                uint32_t xdmaChannelIntMask;
     158                sXdmadChannel *pCh;
     159
     160                pCh = &pXdmad->XdmaChannels[Channel];
     161
     162                xdmaChannelIntMask = XDMAC_GetChannelItMask(pXdmac, Channel);
     163                status &= xdmaChannelIntMask;
     164
     165                if (status & XDMAC_CIS_BIS) {
     166                        if ((xdmaChannelIntMask & XDMAC_CIM_LIM) == 0) {
     167                                pCh->state = XDMAD_STATE_DONE;
     168                                bExec = true;
     169                        }
     170                }
     171
     172                if (status & XDMAC_CIS_LIS) {
     173                        pCh->state = XDMAD_STATE_DONE;
     174                        bExec = true;
     175                }
     176
     177                if (status & XDMAC_CIS_DIS) {
     178                        pCh->state = XDMAD_STATE_DONE;
     179                        bExec = true;
     180                }
     181        } else {
     182                /* Block end interrupt for LLI dma mode */
     183                if (XDMAC_GetChannelIsr(pXdmac, Channel) & XDMAC_CIS_BIS) {
     184                        bExec = true;
     185                }
     186        }
     187
     188        return bExec;
     189}
     190
    135191void XDMAD_DoNothingCallback(uint32_t Channel, void *pArg, uint32_t status)
    136192{
    137         /* Do nothing */
     193        /* Do nothing except status update */
     194        XDMAD_UpdateStatusFromCallback((sXdmad *)pArg, Channel, status);
    138195}
    139196
     
    158215        for (j = 0; j < pXdmad->numChannels; j ++) {
    159216                pXdmad->XdmaChannels[j].fCallback = XDMAD_DoNothingCallback;
     217                pXdmad->XdmaChannels[j].pArg = (void *)pXdmad;
    160218        }
    161219
  • bsps/arm/atsam/include/libchip/include/xdmad.h

    rf84c4a5 r0af682c  
    242242extern void XDMAD_DoNothingCallback(uint32_t Channel, void *pArg, uint32_t status);
    243243
     244extern bool XDMAD_UpdateStatusFromCallback(sXdmad *pXdmad,
     245                uint32_t Channel,
     246                uint32_t status);
     247
    244248extern eXdmadRC XDMAD_SetCallback(sXdmad *pXdmad,
    245249                                                                   uint32_t dwChannel,
Note: See TracChangeset for help on using the changeset viewer.