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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel-0-3-0-rc3/] [or1ksim/] [peripheral/] [atahost.c] - Diff between revs 1712 and 1713

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

Rev 1712 Rev 1713
Line 31... Line 31...
#include "arch.h"
#include "arch.h"
/* get a prototype for 'reg_mem_area()', and 'adjust_rw_delay()' */
/* get a prototype for 'reg_mem_area()', and 'adjust_rw_delay()' */
#include "abstract.h"
#include "abstract.h"
#include "sim-config.h"
#include "sim-config.h"
#include "sched.h"
#include "sched.h"
 
#include "debug.h"
 
 
#include "atahost.h"
#include "atahost.h"
 
 
/* default timing reset values */
/* default timing reset values */
#define PIO_MODE0_T1 6
#define PIO_MODE0_T1 6
Line 44... Line 45...
 
 
#define DMA_MODE0_TM 4
#define DMA_MODE0_TM 4
#define DMA_MODE0_TD 21
#define DMA_MODE0_TD 21
#define DMA_MODE0_TEOC 21
#define DMA_MODE0_TEOC 21
 
 
 
DEFAULT_DEBUG_CHANNEL(ata);
 
 
/* reset and initialize ATA host core(s) */
/* reset and initialize ATA host core(s) */
static void ata_reset(void *dat)
static void ata_reset(void *dat)
{
{
   ata_host *ata = dat;
   ata_host *ata = dat;
 
 
Line 88... Line 91...
        // Accesses to internal register take 2cycles
        // Accesses to internal register take 2cycles
        adjust_rw_delay( ata->mem, 2, 2 );
        adjust_rw_delay( ata->mem, 2, 2 );
 
 
        switch( addr ) {
        switch( addr ) {
            case ATA_CTRL :
            case ATA_CTRL :
 
                TRACE("Read control register: %"PRIx32"\n", ata->regs.ctrl);
                return ata -> regs.ctrl;
                return ata -> regs.ctrl;
 
 
            case ATA_STAT :
            case ATA_STAT :
                return ata -> regs.stat;
                return ata -> regs.stat;
 
 
Line 150... Line 154...
       // Accesses to internal register take 2cycles
       // Accesses to internal register take 2cycles
       adjust_rw_delay( ata->mem, 2, 2 );
       adjust_rw_delay( ata->mem, 2, 2 );
 
 
        switch( addr ) {
        switch( addr ) {
            case ATA_CTRL :
            case ATA_CTRL :
 
                TRACE("Writting control register: %"PRIx32"\n", value);
                ata -> regs.ctrl =  value;
                ata -> regs.ctrl =  value;
 
 
                /* check if reset bit set, if so reset ata-devices    */
                /* check if reset bit set, if so reset ata-devices    */
                if (value & ATA_RST)
                if (value & ATA_RST)
                  ata_devices_hw_reset(&ata->devices, 1);
                  ata_devices_hw_reset(&ata->devices, 1);
Line 164... Line 169...
            case ATA_STAT :
            case ATA_STAT :
                ata -> regs.stat = (ata -> regs.stat & ~ATA_IDEIS) | (ata -> regs.stat & ATA_IDEIS & value);
                ata -> regs.stat = (ata -> regs.stat & ~ATA_IDEIS) | (ata -> regs.stat & ATA_IDEIS & value);
                break;
                break;
 
 
            case ATA_PCTR :
            case ATA_PCTR :
 
                TRACE("PCTR: Toec = %d, t4 = %d, t2 = %d, t1 = %d\n",
 
                      value >> 24, (value >> 16) & 0xff, (value >> 8) & 0xff,
 
                      value & 0xff);
                ata -> regs.pctr = value;
                ata -> regs.pctr = value;
                break;
                break;
 
 
            case ATA_PFTR0:
            case ATA_PFTR0:
 
                TRACE("PFTR0: Toec = %d, t4 = %d, t2 = %d, t1 = %d\n",
 
                      value >> 24, (value >> 16) & 0xff, (value >> 8) & 0xff,
 
                      value & 0xff);
                ata -> regs.pftr0 = value;
                ata -> regs.pftr0 = value;
                break;
                break;
 
 
            case ATA_PFTR1:
            case ATA_PFTR1:
 
                TRACE("PFTR1: Toec = %d, t4 = %d, t2 = %d, t1 = %d\n",
 
                      value >> 24, (value >> 16) & 0xff, (value >> 8) & 0xff,
 
                      value & 0xff);
                ata -> regs.pftr1 = value;
                ata -> regs.pftr1 = value;
                break;
                break;
 
 
            case ATA_DTR0 :
            case ATA_DTR0 :
                ata -> regs.dtr0  = value;
                ata -> regs.dtr0  = value;

powered by: WebSVN 2.1.0

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