/* * * BRIEF MODULE DESCRIPTION * A DMA channel allocator for Au1x00. API is modeled loosely off of * linux/kernel/dma.c. * * Copyright 2000, 2008 MontaVista Software Inc. * Author: MontaVista Software, Inc. <source@mvista.com> * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) * * 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 PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. *
*/
/* * A note on resource allocation: * * All drivers needing DMA channels, should allocate and release them * through the public routines `request_dma()' and `free_dma()'. * * In order to avoid problems, all processes should allocate resources in * the same sequence and release them in the reverse order. * * So, when allocating DMAs and IRQs, first allocate the DMA, then the IRQ. * When releasing them, first release the IRQ, then release the DMA. The * main reason for this order is that, if you are requesting the DMA buffer * done interrupt, you won't know the irq number until the DMA channel is * returned from request_dma.
*/
/* * Finds a free channel, and binds the requested device to it. * Returns the allocated channel number, or negative on error. * Requests the DMA done IRQ if irqhandler != NULL.
*/ int request_au1000_dma(int dev_id, constchar *dev_str,
irq_handler_t irqhandler, unsignedlong irqflags, void *irq_dev_id)
{ struct dma_chan *chan; conststruct dma_dev *dev; int i, ret;
staticint __init au1000_dma_init(void)
{ int base, i;
switch (alchemy_get_cputype()) { case ALCHEMY_CPU_AU1000:
base = AU1000_DMA_INT_BASE; break; case ALCHEMY_CPU_AU1500:
base = AU1500_DMA_INT_BASE; break; case ALCHEMY_CPU_AU1100:
base = AU1100_DMA_INT_BASE; break; default: goto out;
}
for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++)
au1000_dma_table[i].irq = base + i;
printk(KERN_INFO "Alchemy DMA initialized\n");
out: return 0;
}
arch_initcall(au1000_dma_init);
Messung V0.5
¤ Dauer der Verarbeitung: 0.29 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.