67b4e7f958
This patch uses the new pl080 DMA driver for I2S playback and LCD update. I have tried to be as fiel as possible to the current behaviour, algorithms and configurations are the same, but using the new driver. Other modifications: Playback: - CHUNK_SIZE is decreased from 42988 to 8188 bytes, it does not affect normal playback (block size 1024), was tested using metronome (block size 46080). This change is needed because the new code commits d-cache range instead of commiting the whole d-cache, maximum time spent commiting the range should be limited, CHUNK_SIZE can be decreased even more if necessary. - pcm_play_dma_start() calls pcm_play_dma_stop() to stop the channel when it is running (metronome replays the tick sound without stopping the channel). - pcm_play_dma_get_peak_buffer(): same as actual SVN function but returns samples count instead of bytes count. TODO: AFAIK, actually this function is not used in RB. Not tested, but probably this function will fail because it returns pointers to the internal double buffer. LCD update: - suppresses lcd_wakeup semaphore and uses yield() Change-Id: I79b8aa47a941e0dd91847150618f3f7f676c26ef
68 lines
2.1 KiB
C
68 lines
2.1 KiB
C
/***************************************************************************
|
|
* __________ __ ___.
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
* \/ \/ \/ \/ \/
|
|
* $Id$
|
|
*
|
|
* Copyright (C) 2014 by Cástor Muñoz
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
* KIND, either express or implied.
|
|
*
|
|
****************************************************************************/
|
|
|
|
#include <config.h>
|
|
|
|
#include "s5l8702.h"
|
|
#include "pl080.h"
|
|
#include "dma-s5l8702.h"
|
|
|
|
/* s5l8702 PL080 controllers configuration */
|
|
struct dmac s5l8702_dmac0 = {
|
|
.baddr = S5L8702_DMAC0_BASE,
|
|
.m1 = DMACCONFIG_M_LITTLE_ENDIAN,
|
|
.m2 = DMACCONFIG_M_LITTLE_ENDIAN,
|
|
};
|
|
|
|
struct dmac s5l8702_dmac1 = {
|
|
.baddr = S5L8702_DMAC1_BASE,
|
|
.m1 = DMACCONFIG_M_LITTLE_ENDIAN,
|
|
.m2 = DMACCONFIG_M_LITTLE_ENDIAN,
|
|
};
|
|
|
|
void ICODE_ATTR INT_DMAC0(void)
|
|
{
|
|
dmac_callback(&s5l8702_dmac0);
|
|
}
|
|
|
|
void ICODE_ATTR INT_DMAC1(void)
|
|
{
|
|
dmac_callback(&s5l8702_dmac1);
|
|
}
|
|
|
|
void dma_init_ctrl(struct dmac* dmac, int irq, int clockgate, int onoff)
|
|
{
|
|
/* init DMAC */
|
|
VIC0INTENCLEAR = (1 << irq); /* disable interrupts */
|
|
PWRCON(0) &= ~(1 << clockgate); /* unmask clock gate */
|
|
dmac_open(dmac); /* init/reset controller */
|
|
|
|
if (onoff)
|
|
VIC0INTENABLE = (1 << irq); /* enable interrupts */
|
|
else
|
|
PWRCON(0) |= (1 << clockgate); /* mask clockgate */
|
|
}
|
|
|
|
void dma_init(void)
|
|
{
|
|
dma_init_ctrl(&s5l8702_dmac0, IRQ_DMAC0, CLOCKGATE_DMAC0, 1);
|
|
dma_init_ctrl(&s5l8702_dmac1, IRQ_DMAC1, CLOCKGATE_DMAC1, 0);
|
|
}
|