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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel-0-3-0-rc1/] [or1ksim/] [peripheral/] [atadevice.h] - Diff between revs 1744 and 1748

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

Rev 1744 Rev 1748
Line 1... Line 1...
/*
/* atadevice.h -- ATA Device code simulation
    atadevice.h -- ATA Device code simulation
 
    Copyright (C) 2002 Richard Herveille, rherveille@opencores.org
    Copyright (C) 2002 Richard Herveille, rherveille@opencores.org
 
   Copyright (C) 2008 Embecosm Limited
 
 
    This file is part of OpenRISC 1000 Architectural Simulator
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
 
 
    This program is free software; you can redistribute it and/or modify
   This file is part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
    it under the terms of the GNU General Public License as published by
 
    the Free Software Foundation; either version 2 of the License, or
   This program is free software; you can redistribute it and/or modify it
    (at your option) any later version
   under the terms of the GNU General Public License as published by the Free
 
   Software Foundation; either version 3 of the License, or (at your option)
    This program is distributed in the hope that it will be useful,
   any later version.
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   This program is distributed in the hope that it will be useful, but WITHOUT
    GNU General Public License for more details.
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
    You should have received a copy of the GNU General Public License
   more details.
    along with this program; if not, write to the Free Software
 
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   You should have received a copy of the GNU General Public License along
*/
   with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 
/* This program is commented throughout in a fashion suitable for processing
 
   with Doxygen. */
 
 
/*
/*
 * Definitions for the Opencores ATA Controller Core, Device model
 * Definitions for the Opencores ATA Controller Core, Device model
 */
 */
 
 
#ifndef __OR1KSIM_ATAD_H
#ifndef ATADEVICE__H
#define __OR1KSIM_ATAD_H
#define ATADEVICE__H
 
 
 
/* Autoconf and/or portability configuration */
 
#include "port.h"
 
 
 
/* System includes */
#include <stdio.h>
#include <stdio.h>
 
 
/* --- Register definitions --- */
/* --- Register definitions --- */
/* ----- ATA Registers                                                */
/* ----- ATA Registers                                                */
/* These are actually the memory locations where the ATA registers    */
/* These are actually the memory locations where the ATA registers    */
Line 107... Line 115...
 
 
 
 
/* ----------------------------                                       */
/* ----------------------------                                       */
/* ----- Structs          -----                                       */
/* ----- Structs          -----                                       */
/* ----------------------------                                       */
/* ----------------------------                                       */
typedef struct ata_dev_s {
struct ata_device
 
{
 
 
        /******* Housekeeping *****************************************/
        /******* Housekeeping *****************************************/
        struct {
  struct
 
  {
                /* Pointer to host that device is attached to         */
                /* Pointer to host that device is attached to         */
                void *host;
                void *host;
                /* device number                                      */
                /* device number                                      */
                int dev;
                int dev;
 
 
Line 139... Line 149...
                /* Current byte being read                            */
                /* Current byte being read                            */
                uint32_t lba;
                uint32_t lba;
                /* Number of sectors still needing to be read         */
                /* Number of sectors still needing to be read         */
                int nr_sect;
                int nr_sect;
                /* function to call when block of data has been transfered*/
                /* function to call when block of data has been transfered*/
                void (*end_t_func)(struct ata_dev_s *);
    void (*end_t_func) (struct ata_device *);
        } internals;
        } internals;
 
 
 
 
        /******* ATA Device Registers *********************************/
        /******* ATA Device Registers *********************************/
        struct {
  struct
 
  {
                uint8_t command;
                uint8_t command;
                uint8_t cylinder_low;
                uint8_t cylinder_low;
                uint8_t cylinder_high;
                uint8_t cylinder_high;
                uint8_t device_control;
                uint8_t device_control;
                uint8_t device_head;
                uint8_t device_head;
Line 160... Line 171...
 
 
                uint16_t dataport_i;
                uint16_t dataport_i;
        } regs;
        } regs;
 
 
        /******** ata device output signals **************************/
        /******** ata device output signals **************************/
        struct {
  struct
 
  {
                int iordy;
                int iordy;
                int intrq;
                int intrq;
                int dmarq;
                int dmarq;
                int pdiagi, pdiago;
                int pdiagi, pdiago;
                int daspi, daspo;
                int daspi, daspo;
        } sigs;
        } sigs;
 
 
        /******** simulator settings **********************************/
        /******** simulator settings **********************************/
        struct {
  struct
 
  {
          char *file;   /* Filename (if type == FILE)                   */
          char *file;   /* Filename (if type == FILE)                   */
          FILE *stream; /* stream where the simulated device connects to*/
          FILE *stream; /* stream where the simulated device connects to*/
          int  type;    /* Simulate device using                        */
          int  type;    /* Simulate device using                        */
                        /* NO_CONNECT: no device connected (dummy)      */
                        /* NO_CONNECT: no device connected (dummy)      */
                        /* FILE      : a file                           */
                        /* FILE      : a file                           */
Line 187... Line 200...
 
 
          char *firmware;
          char *firmware;
          unsigned int mwdma;
          unsigned int mwdma;
          unsigned int pio;
          unsigned int pio;
        } conf;
        } conf;
} ata_device;
};
 
 
typedef struct{
 
  ata_device device[2];
 
} ata_devices;
 
 
 
 
struct ata_devices
 
{
 
  struct ata_device device[2];
 
};
 
 
/* all devices                                                        */
/* all devices                                                        */
void  ata_devices_init(ata_devices *devices);
void ata_devices_init (struct ata_devices *devices);
void  ata_devices_hw_reset(ata_devices *devices, int reset_signal);
void ata_devices_hw_reset (struct ata_devices *devices, int reset_signal);
short ata_devices_read(ata_devices *devices, char adr);
short ata_devices_read (struct ata_devices *devices, char adr);
void  ata_devices_write(ata_devices *devices, char adr, short value);
void ata_devices_write (struct ata_devices *devices, char adr, short value);
 
 
static void ata_device_do_control_register(ata_device *device);
#endif  /* ATADEVICE__H */
static void ata_device_do_command_register(ata_device *device);
 
#endif
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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