File nut/include/dev/idep.h

* This file is part of the AVRIDE device driver.
* Copyright (c) 2002-2003 by Michael Fischer. All rights reserved.
* Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met:
* 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the author nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 COPYRIGHT OWNER OR CONTRIBUTORS 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.
**************************************************************************** * History:
* 14.12.02 mifi First Version * 18.01.03 mifi Change Licence from GPL to BSD. * 19.06.03 mifi Change address for ide port from 0x8000 to 0xE000 * 29.06.03 mifi First ATAPI-Version


Included Files


Preprocessor definitions

#define __IDEP_H__

#define IDE_SUPPORT_CHS 0

#define IDE_BASE_ADDRESS 0xE000

#define IDECS0 0x0000

#define IDECS1 0x0500

#define DATA_WRITE_REG_LOW

#define DATA_WRITE_REG_HIGH

#define DATA_READ_REG_LOW

#define DATA_READ_REG_HIGH

#define ERROR_REG

#define FEATURE_REG

#define SECTOR_COUNT_REG

#define SECTOR_REG

#define CYLINDER_LOW_REG

#define CYLINDER_HIGH_REG

#define DISK_HEAD_REG

#define COMMAND_REG

#define STATUS_REG

#define LBA_0_7

#define LBA_8_15

#define LBA_16_23

#define CF_ERROR_REG

#define CONTROL_REG

#define ALTERNATE_STATUS

#define STATUS_BUSY 0x80

#define STATUS_DRIVE_READY 0x40

#define STATUS_DEVIDE_FAULT 0x20

#define STATUS_SEEK_COMPLETE 0x10

#define STATUS_DATA_REQUEST 0x08

#define STATUS_CORRECTED_DATA 0x04

#define STATUS_INDEX 0x02

#define STATUS_ERROR 0x01

#define ERROR_CRC 0x80

#define ERROR_UNC 0x40

#define ERROR_IDN 0x10

#define ERROR_ABT 0x04

#define ERROR_T0N 0x02

#define ERROR_AMN 0x01

#define COMMAND_DEVICE_INFO 0xEC

#define COMMAND_DEVICE_INFO_P 0xA1

#define COMMAND_READ_SECTORS 0x20

#define COMMAND_WRITE_SECTORS 0x30

#define COMMAND_RECALIBRATE 0x10

#define COMMAND_DIAG 0x90

#define SERIAL_SIZE 20

#define REV_SIZE 8

#define MODEL_SIZE 40

#define ATAPI_CMD_READ_CAPACITY 0x25

#define ATAPI_CMD_MODE_SELECT 0x55

#define ATAPI_CMD_MODE_SENSE 0x5A

#define ATAPI_CMD_READ12 0xA8

#define ATAPI_CMD_SET_CD_SPEED 0xBB


Typedef IDEDEVICEINFO

typedef struct {...} IDEDEVICEINFO
struct  
   {  
      unsigned UnUsed0:1;  
      unsigned HardSector_O:1;  
      unsigned SoftSector_O:1;  
      unsigned MFM_O:1;  
      unsigned SlowHead_O:1;  
      unsigned SynchDriveMotor_O:1;  
      unsigned FixedDevice:1;  
      unsigned RemoveableDevice:1;  
      unsigned DiskTransferRate_O:3;  
      unsigned InaccurateSpeed_O:1;  
      unsigned DataStrobeOffset_O:1;  
      unsigned TrackOffsetOption_O:1;  
      unsigned FormatGapRequired_O:1;  
      unsigned ATAPI:1;  
      WORD Cylinders;  
      WORD UnUsed1;  
      WORD Heads;  
      WORD BytesPerTrack_O;  
      WORD BytesPerSector_O;  
      WORD SectorsPerTrack;  
      WORD VendorSpecific[3];  
      char SerialNumber[20];  
      WORD BufferType_O;  
      WORD BufferSizeSectors_O;  
      WORD ECCBytes;  
      char FirmwareRevision[8];  
      char Model[40];  
      BYTE MaxMultipleSectors;  
      BYTE UnUsed2;  
      WORD Can32Bit_O;  
      unsigned CanDMA_O:1;  
      unsigned UnUsed3:9;  
      unsigned CanDisableIORDY:1;  
      unsigned IORDYSupported:1;  
      unsigned AdvancedTransferMode:1;  
      unsigned ATA3StandbyTimer:1;  
      unsigned UnUsed4:2;  
      WORD UnUsed5;  
      BYTE UnUsed6;  
      BYTE PIOTransferSpeed;  
      BYTE UnUsed7;  
      BYTE DMATransferSpeed;  
      unsigned Fields_6C_75_Valid:1;  
      unsigned Fields_80_8C_Valid:1;  
      unsigned UnUsed8:14;  
      WORD Cylinders2;  
      WORD Heads2;  
      WORD SectorsPerTrack2;  
      DWORD Sectors;  
      BYTE MaxSectorsPerInt;  
      unsigned MaxSectorsPerIntIsValid:1;  
      unsigned UnUsed9:7;  
      DWORD LBASectors;  
      WORD UnUsed10;  
      BYTE SupportedDMAModes;  
      BYTE ActiveDMAModes;  
      BYTE PIOModesSupported;  
      BYTE UnUsed11;  
      WORD DMACycleTime;  
      WORD RecommendedDMACycleTime;  
      WORD PIOCycleTime;  
      WORD IORDYPIOCycleTime;  
      WORD Reserved1[2];  
      WORD Reserved2[4];  
      WORD QueueDepth;  
      WORD Reserved3[4];  
      WORD ATAVersionMajor;  
      WORD ATAVersionMinor;  
      WORD CommandSetSupported[2];  
      WORD CommandSetSupportedExtension;  
      WORD CommandSetEnabled[2];  
      WORD CommandSetDefault;  
      WORD UltraDMAMode;  
      WORD SecurityStatus[2];  
      WORD AdvancedPowerManagement;  
      WORD MasterPasswordRevisionCode;  
      WORD HardwareResetResult;  
      WORD AcousticManagementValue;  
      WORD Reserved4[5];  
      WORD MaximumUserLBA48[4];  
      WORD Reserved5[23];  
   }