Changeset b7f7183 in mainline


Ignore:
Timestamp:
2011-10-24T15:40:37Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7785e951
Parents:
b130d0e
Message:

sb16: Minor DMA changes.

Clear flip-flop by writing 0.
buffer size is limited to uint16_t.

Location:
uspace/drv/audio/sb16
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/sb16/dma_controller.c

    rb130d0e rb7f7183  
    6262#define DMA_SINGLE_MASK_CHAN_SEL_SHIFT (0)
    6363#define DMA_SINGLE_MASK_CHAN_TO_REG(x) \
    64     (((x % 4) & DMA_SINGLE_MASK_CHAN_SEL_MASK) << DMA_SINGLE_MASK_CHAN_SEL_SHIFT)
     64    ((x & DMA_SINGLE_MASK_CHAN_SEL_MASK) << DMA_SINGLE_MASK_CHAN_SEL_SHIFT)
    6565#define DMA_SINGLE_MASK_MASKED_FLAG (1 << 2)
    6666
     
    6969#define DMA_MODE_CHAN_SELECT_SHIFT (0)
    7070#define DMA_MODE_CHAN_TO_REG(x) \
    71     (((x % 4) & DMA_MODE_CHAN_SELECT_MASK) << DMA_MODE_CHAN_SELECT_SHIFT)
     71    ((x & DMA_MODE_CHAN_SELECT_MASK) << DMA_MODE_CHAN_SELECT_SHIFT)
    7272#define DMA_MODE_CHAN_TRA_MASK (0x3)
    7373#define DMA_MODE_CHAN_TRA_SHIFT (2)
     
    217217}
    218218/*----------------------------------------------------------------------------*/
    219 int dma_setup_channel(unsigned channel, uintptr_t pa, size_t size)
     219int dma_setup_channel(unsigned channel, uintptr_t pa, uint16_t size)
    220220{
    221221        if (channel == 0 || channel == 4)
     
    235235                /* Size is the count of 16bit words */
    236236                assert(size % 2 == 0);
    237                 size /= 2;
     237                size >>= 1;
    238238                /* Address is fun: lower 16bits need to be shifted by 1 */
    239239                pa = ((pa & 0xffff) >> 1) | (pa & 0xff0000);
     
    250250
    251251        /* Set address -- reset flip-flop*/
    252         pio_write_8(dma_channel.flip_flop_address, 1);
     252        pio_write_8(dma_channel.flip_flop_address, 0);
    253253
    254254        /* Low byte */
     
    268268
    269269        /* Set size -- reset flip-flop */
    270         pio_write_8(dma_channel.flip_flop_address, 1);
     270        pio_write_8(dma_channel.flip_flop_address, 0);
    271271
    272272        /* Low byte */
  • uspace/drv/audio/sb16/dma_controller.h

    rb130d0e rb7f7183  
    4343} transfer_mode_t;
    4444
    45 int dma_setup_channel(unsigned channel, uintptr_t pa, size_t size);
     45int dma_setup_channel(unsigned channel, uintptr_t pa, uint16_t size);
    4646
    4747int dma_prepare_channel(
Note: See TracChangeset for help on using the changeset viewer.