OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_42/] [or1ksim/] [peripheral/] [dma.c] - Diff between revs 418 and 424

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 418 Rev 424
Line 30... Line 30...
#include "pic.h"
#include "pic.h"
#include "abstract.h"
#include "abstract.h"
#include "fields.h"
#include "fields.h"
 
 
/* The representation of the DMA controllers */
/* The representation of the DMA controllers */
static struct dma_controller dmas[NR_DMAS];
static struct dma_controller dmas[MAX_DMAS];
 
 
static unsigned long dma_read32( unsigned long addr );
static unsigned long dma_read32( unsigned long addr );
static void dma_write32( unsigned long addr, unsigned long value );
static void dma_write32( unsigned long addr, unsigned long value );
 
 
static unsigned long dma_read_ch_csr( struct dma_channel *channel );
static unsigned long dma_read_ch_csr( struct dma_channel *channel );
Line 115... Line 115...
unsigned long dma_read32( unsigned long addr )
unsigned long dma_read32( unsigned long addr )
{
{
        unsigned i;
        unsigned i;
        struct dma_controller *dma = NULL;
        struct dma_controller *dma = NULL;
 
 
        for ( i = 0; i < NR_DMAS && dma == NULL; ++ i ) {
        for ( i = 0; i < MAX_DMAS && dma == NULL; ++ i ) {
                if ( addr >= dmas[i].baseaddr && addr < dmas[i].baseaddr + DMA_ADDR_SPACE )
                if ( addr >= dmas[i].baseaddr && addr < dmas[i].baseaddr + DMA_ADDR_SPACE )
                        dma = &(dmas[i]);
                        dma = &(dmas[i]);
        }
        }
 
 
        /* verify we found a controller */
        /* verify we found a controller */
Line 189... Line 189...
{
{
        unsigned i;
        unsigned i;
        struct dma_controller *dma = NULL;
        struct dma_controller *dma = NULL;
 
 
        /* Find which controller this is */
        /* Find which controller this is */
        for ( i = 0; i < NR_DMAS && dma == NULL; ++ i ) {
        for ( i = 0; i < MAX_DMAS && dma == NULL; ++ i ) {
                if ( (addr >= dmas[i].baseaddr) && (addr < dmas[i].baseaddr + DMA_ADDR_SPACE) )
                if ( (addr >= dmas[i].baseaddr) && (addr < dmas[i].baseaddr + DMA_ADDR_SPACE) )
                        dma = &(dmas[i]);
                        dma = &(dmas[i]);
        }
        }
 
 
        /* verify we found a controller */
        /* verify we found a controller */
Line 293... Line 293...
 
 
/* Simulation hook. Must be called every clock cycle to simulate DMA. */
/* Simulation hook. Must be called every clock cycle to simulate DMA. */
void dma_clock()
void dma_clock()
{
{
        unsigned i;
        unsigned i;
        for ( i = 0; i < NR_DMAS; ++ i ) {
        for ( i = 0; i < MAX_DMAS; ++ i ) {
                if ( dmas[i].baseaddr != 0 )
                if ( dmas[i].baseaddr != 0 )
                        dma_controller_clock( &(dmas[i]) );
                        dma_controller_clock( &(dmas[i]) );
        }
        }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.