VirtualBox

Changeset 46499 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jun 11, 2013 3:54:48 PM (12 years ago)
Author:
vboxsync
Message:

DevDMA: Set TC status bit on transfer completion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevDMA.cpp

    r45025 r46499  
    170170    CTL_W_CLRMASK,  /* Clear all DRQ mask bits. */
    171171    CTL_W_MASK      /* Write all DRQ mask bits. */
     172};
     173
     174/* DMA transfer modes. */
     175enum {
     176    DMODE_DEMAND,   /* Demand transfer mode. */
     177    DMODE_SINGLE,   /* Single transfer mode. */
     178    DMODE_BLOCK,    /* Block transfer mode. */
     179    DMODE_CASCADE   /* Cascade mode. */
    172180};
    173181
     
    541549    /* Addresses and counts are shifted for 16-bit channels. */
    542550    start_cnt = ch->u16CurCount << dc->is16bit;
     551    /* NB: The device is responsible for examining the DMA mode and not
     552     * transferring more than it should if auto-init is not in use.
     553     */
    543554    end_cnt = ch->pfnXferHandler(pThis->pDevIns, ch->pvUser, (ctlidx * 4) + chidx,
    544555                                 start_cnt, (ch->u16BaseCount + 1) << dc->is16bit);
    545556    ch->u16CurCount = end_cnt >> dc->is16bit;
     557    /* Set the TC (Terminal Count) bit if transfer was completed. */
     558    if (ch->u16CurCount == ch->u16BaseCount + 1)
     559        switch (opmode)
     560        {
     561        case DMODE_DEMAND:
     562        case DMODE_SINGLE:
     563        case DMODE_BLOCK:
     564            dc->u8Status |= RT_BIT(chidx);
     565            Log3(("TC set for DMA channel %d\n", (ctlidx * 4) + chidx));
     566            break;
     567        default:
     568            break;
     569        }
    546570    Log3(("DMA position %d, size %d\n", end_cnt, (ch->u16BaseCount + 1) << dc->is16bit));
    547571}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette