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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [peripheral/] [atahost.c] - Diff between revs 1748 and 1751

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

Rev 1748 Rev 1751
Line 32... Line 32...
#include <stdlib.h>
#include <stdlib.h>
 
 
/* Package includes */
/* Package includes */
#include "atahost.h"
#include "atahost.h"
#include "sim-config.h"
#include "sim-config.h"
#include "debug.h"
 
#include "abstract.h"
#include "abstract.h"
#include "pic.h"
#include "pic.h"
#include "toplevel-support.h"
#include "toplevel-support.h"
#include "sim-cmd.h"
#include "sim-cmd.h"
 
 
Line 49... Line 48...
 
 
#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
static void
ata_reset (void *dat)
ata_reset (void *dat)
{
{
Line 113... Line 111...
      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 184... Line 181...
      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 203... Line 199...
              ata->regs.stat &= ~ATA_IDEIS;
              ata->regs.stat &= ~ATA_IDEIS;
            }
            }
          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;
Line 286... Line 273...
 
 
  if (ata->baseaddr == 0)
  if (ata->baseaddr == 0)
    return;
    return;
 
 
  PRINTF ("\nOCIDEC-%1d at: 0x%" PRIxADDR "\n", ata->dev_id, ata->baseaddr);
  PRINTF ("\nOCIDEC-%1d at: 0x%" PRIxADDR "\n", ata->dev_id, ata->baseaddr);
  PRINTF ("ATA CTRL     : 0x%08X\n", ata->regs.ctrl);
  PRINTF ("ATA CTRL     : 0x%08" PRIx32 "\n", ata->regs.ctrl);
  PRINTF ("ATA STAT     : 0x%08x\n", ata->regs.stat);
  PRINTF ("ATA STAT     : 0x%08" PRIx32 "\n", ata->regs.stat);
  PRINTF ("ATA PCTR     : 0x%08x\n", ata->regs.pctr);
  PRINTF ("ATA PCTR     : 0x%08" PRIx32 "n", ata->regs.pctr);
 
 
  if (ata->dev_id > 1)
  if (ata->dev_id > 1)
    {
    {
      PRINTF ("ATA FCTR0    : 0x%08x\n", ata->regs.pftr0);
      PRINTF ("ATA FCTR0    : 0x%08" PRIx32 "\n", ata->regs.pftr0);
      PRINTF ("ATA FCTR1    : 0x%08x\n", ata->regs.pftr1);
      PRINTF ("ATA FCTR1    : 0x%08" PRIx32 "\n", ata->regs.pftr1);
    }
    }
 
 
  if (ata->dev_id > 2)
  if (ata->dev_id > 2)
    {
    {
      PRINTF ("ATA DTR0     : 0x%08x\n", ata->regs.dtr0);
      PRINTF ("ATA DTR0     : 0x%08" PRIx32 "\n", ata->regs.dtr0);
      PRINTF ("ATA DTR1     : 0x%08x\n", ata->regs.dtr1);
      PRINTF ("ATA DTR1     : 0x%08" PRIx32 "\n", ata->regs.dtr1);
      PRINTF ("ATA TXD      : 0x%08x\n", ata->regs.txb);
      PRINTF ("ATA TXD      : 0x%08" PRIx32 "\n", ata->regs.txb);
      PRINTF ("ATA RXD      : 0x%08x\n", ata->regs.rxb);
      PRINTF ("ATA RXD      : 0x%08" PRIx32 "\n", ata->regs.rxb);
    }
    }
}
}
 
 
/* ========================================================================= */
/* ========================================================================= */
 
 

powered by: WebSVN 2.1.0

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