📄 ide_func.h
字号:
/*
* description : ATA/ATAPI Interface
* Maker : Hideyuki Nekoshima
* Copyright : (C)2003,SEIKO EPSON Corp. All Rights Reserved.
*/
#ifndef IDE_FUNC_H
#define IDE_FUNC_H
#include "SPRDEF.h"
#include "ATA_ATAPIIF.h"
#include "IDEDMA_IF.h"
typedef struct ideidentify{
USHORT IdeTrack; /* IDE HDD Track Count 2 */
USHORT IdeCylinder; /* IDE HDD Cylinder Count 6 */
USHORT IdeHeader; /* IDE HDD Header Count 12 */
UCHAR DevicePara[40]; /* IDE Device Prameter 54 */
ULONG MaxLba; /* IDE HDD Max LBA 120 */
}IDE_FUNCIDENTIFY;
/* Device List Parameter */
typedef struct idedevicelist{
UCHAR deviceCount; /* The number of connected devices */
UCHAR deviceType[ATA_IF_MAX_PORT * 2];/* Device type */
UCHAR bigDrive[ATA_IF_MAX_PORT * 2]; /* Type when at HDD */
IDE_FUNCIDENTIFY identify[ATA_IF_MAX_PORT * 2];/* IDENTIFY information */
}IDE_FUNCDEVICELIST;
/* Device Command Parameter */
typedef struct idecmdpara{
UCHAR commandMode; /* Command type of ATA/ATAPI */
UCHAR commandBlock[12]; /* Command block */
}IDE_FUNCCMDPARA;
/* Transfer Parameter */
typedef struct idetranpara{
UCHAR direction; /* Transfer direction */
ULONG dataSize; /* Bytes number of data transfer */
ULONG dataPointer; /* Buffer pointer of the Data transfer */
ULONG transferSize; /* Not used */
}IDE_FUNCTRANPARA;
typedef struct idexferpara{
UCHAR PIOMode; /* POI transfer */
UCHAR multiDMAMode; /* Multi word DMA */
UCHAR ultraDMAMode; /* Ultra DMA */
}IDE_FUNCXFERPARA;
/* IDEDMA IF functions list */
extern LONG IDE_FuncReset( void );
extern LONG IDE_FuncOpen( void );
extern LONG IDE_FuncDeviceReset( USHORT id, USHORT deviceNo );
extern LONG IDE_FuncGetDeviceList( USHORT id, IDE_FUNCDEVICELIST *pList );
extern LONG IDE_FuncGetDeviceParameter( USHORT id, USHORT deviceNo, UCHAR *pDataptr );
extern LONG IDE_FuncCommandOut( USHORT id, USHORT deviceNo, UCHAR transferMode, IDE_FUNCCMDPARA *pCmdBlock );
extern LONG IDE_FuncCommandStop( USHORT id, USHORT deviceNo );
extern LONG IDE_FuncDMAStartA( USHORT id, USHORT deviceNo, UCHAR transferMode, IDE_FUNCTRANPARA *pTranPara );
extern LONG IDE_FuncDMAStop( USHORT id, USHORT deviceNo );
extern LONG IDE_FuncGetDMAStatus( USHORT id, USHORT deviceNo, ULONG *pStatus );
extern LONG IDE_FuncSoftDataTransfer( USHORT id, USHORT deviceNo, UCHAR transferMode, IDE_FUNCTRANPARA *pTranPara );
extern LONG IDE_FuncGetStatus( USHORT id, USHORT deviceNo, ULONG *pStatus, ULONG *pTransferSize, UCHAR *pSenseData );
extern LONG IDE_FuncSyncCommand( USHORT id, USHORT deviceNo, UCHAR transferMode, IDE_FUNCCMDPARA *pCmdBlock,
IDE_FUNCTRANPARA *pTranPara, ULONG *pStatus, UCHAR *pSenseData );
extern LONG IDE_FuncNotifyDmaComp(ULONG portNumber, ULONG lReserve1, VOID *pReserve );
extern LONG IDE_FuncNotifyIntrq( ULONG portNumber, ULONG lReserve1, VOID *pReserve );
extern LONG IDE_FuncXferRateSet( USHORT id, USHORT deviceNo );
extern LONG IDE_FuncXferRateChange( USHORT deviceNo, IDE_FUNCXFERPARA *pXferPara );
extern LONG IDE_FuncGetInterrupt( UCHAR mainIntEnb, UCHAR *pStatus );
/* Device Type */
#define IDE_FUNC_HDD 0x00 /* Hard disk */
#define IDE_FUNC_CD 0x05 /* CD/CD-RW/DVD drive */
#define IDE_FUNC_MO 0x07 /* MO drive */
#define IDE_FUNC_HDD_NORMAL 0x00 /* Hard disk(Except for Big Driver) */
#define IDE_FUNC_HDD_BIG 0x01 /* Hard disk(Big Driver) */
/* Data Transfer Mode */
#define IDE_FUNC_PIO_MODE 0x00 /* PIO transfer mode */
#define IDE_FUNC_DMA_MODE 0x01 /* DMA transfer mode */
/* Data Transfer Direction */
#define IDE_FUNC_IN 0x00 /* Read from device */
#define IDE_FUNC_OUT 0x01 /* Write to device */
/* Command Type */
#define IDE_FUNC_ATA 0x00 /* ATA command */
#define IDE_FUNC_ATAPI 0x01 /* ATAPI command */
/* Command Transfer Status */
#define IDE_FUNC_STATUS_CMD_STOP 0x1000 /* Command under suspension */
#define IDE_FUNC_STATUS_CMD_EXEC 0x1001 /* Command on executing */
#define IDE_FUNC_STATUS_CMD_COMP 0x1002 /* Command completion */
/* DMA Transfer Status */
#define IDE_FUNC_STATUS_DMA_STOP 0x2000 /* DMA completion */
#define IDE_FUNC_STATUS_DMA_EXEC 0x2001 /* DMA transfering */
#define IDE_FUNC_STATUS_DMA_COMP 0x2002 /* DMA completion */
#define IDE_FUNC_STATUS_INTRQ 0x2003 /* INTRQ assert */
/* Transfer Status */
#define IDE_FUNC_STATUS_ERROR 0x1010 /* IDE Function Error Status */
#define IDE_FUNC_STATUS_BSY 0x1011 /* IDE Function BSY Status */
#define IDE_FUNC_STATUS_NOT_READY 0x1012 /* IDE Function Trabsfer Not Ready Status */
/* Device Status */
#define IDE_FUNC_CMD_STOP 0x00 /* Command under suspension */
#define IDE_FUNC_CMD_EXEC 0x01 /* Command on executing */
#define IDE_FUNC_CMD_COMP 0x02 /* Command completion */
#define IDE_FUNC_ID_ERR 0x03 /* Error of specified ID */
#define IDE_FUNC_ID_EXEC 0x04 /* The specified Device is executing with other ID. */
#define IDE_FUNC_BSY 0x05 /* the specified device is in BSY state */
#define IDE_FUNC_TRAN_READY 0x06 /* Transfer is ready */
#define IDE_FUNC_DEVICE_ERR 0x07 /* Error occured in device */
#define IDE_FUNC_CRC_ERR 0x08 /* CRC error */
#define IDE_FUNC_WP_ERR 0x09 /* Write protection errot */
#define IDE_FUNC_MC_ERR 0x0A /* On detecting dedia */
#define IDE_FUNC_IDNF_ERR 0x0B /* Address error */
#define IDE_FUNC_MCR_ERR 0x0C /* The media is changed */
#define IDE_FUNC_ABORT_ERR 0x0D /* Command aborted */
#define IDE_FUNC_NM_ERR 0x0E /* No media */
#define IDE_FUNC_PIOIN_READY 0x10 /* PIO DATA IN READY */
#define IDE_FUNC_PIOOUT_READY 0x11 /* PIO DATA OUT READY */
#define IDE_FUNC_MAX_PORT IDEDMA_IF_MAX_PORT/* Number of IDE DMA PORTs */
#define IDE_FUNC_PORT_LOCK IDEDMA_IF_PORT_LOCK/* PORT LOCK */
#define IDE_FUNC_PORT_UNLOCK IDEDMA_IF_PORT_UNLOCK/* PORT UNLOCK */
#define IDE_FUNC_PIO_MODE0 IDEDMA_IF_PIO_MODE0/* PIO Transfer Mode */
#define IDE_FUNC_PIO_MODE1 IDEDMA_IF_PIO_MODE1/* PIO Transfer Mode */
#define IDE_FUNC_PIO_MODE2 IDEDMA_IF_PIO_MODE2/* PIO Transfer Mode */
#define IDE_FUNC_PIO_MODE3 IDEDMA_IF_PIO_MODE3/* PIO Transfer Mode */
#define IDE_FUNC_PIO_MODE4 IDEDMA_IF_PIO_MODE4/* PIO Transfer Mode */
#define IDE_FUNC_MULTI_MODE0 IDEDMA_IF_MULTI_MODE0/* MultiWord DMA Transfer Mode*/
#define IDE_FUNC_MULTI_MODE1 IDEDMA_IF_MULTI_MODE1/* MultiWord DMA Transfer Mode*/
#define IDE_FUNC_MULTI_MODE2 IDEDMA_IF_MULTI_MODE2/* MultiWord DMA Transfer Mode*/
#define IDE_FUNC_ULTRA_MODE0 IDEDMA_IF_ULTRA_MODE0/* ULTRA DMA Transfer Mode*/
#define IDE_FUNC_ULTRA_MODE1 IDEDMA_IF_ULTRA_MODE1/* ULTRA DMA Transfer Mode*/
#define IDE_FUNC_ULTRA_MODE2 IDEDMA_IF_ULTRA_MODE2/* ULTRA DMA Transfer Mode*/
#define IDE_FUNC_ULTRA_MODE3 IDEDMA_IF_ULTRA_MODE3/* ULTRA DMA Transfer Mode*/
#define IDE_FUNC_ULTRA_MODE4 IDEDMA_IF_ULTRA_MODE4/* ULTRA DMA Transfer Mode*/
#define IDE_FUNC_ULTRA_MODE5 IDEDMA_IF_ULTRA_MODE5/* ULTRA DMA Transfer Mode*/
#define IDE_FUNC_ULTRA_MODE6 IDEDMA_IF_ULTRA_MODE6/* ULTRA DMA Transfer Mode*/
#define IDE_FUNC_IDE_IN IDEDMA_IF_IDE_IN/* IDE Data Transfer Direction IN */
#define IDE_FUNC_IDE_OUT IDEDMA_IF_IDE_OUT/* IDE Data Transfer Direction OUT*/
#define IDE_FUNC_PIO IDEDMA_IF_PIO /* IDE PIO Data Transfer */
#define IDE_FUNC_MULTI IDEDMA_IF_MULTI /* IDE MutiWord DMA Data Transfer */
#define IDE_FUNC_ULTRA IDEDMA_IF_ULTRA /* IDE ULTRA DMA Data Transfer */
#define IDE_FUNC_DMA_STOP IDEDMA_IF_STOP/* IDE DMA STOP */
#define IDE_FUNC_DMA_EXEC IDEDMA_IF_EXEC/* IDE DMA Execution */
#define IDE_FUNC_DMA_COMP IDEDMA_IF_COMP/* IDE DMA Complete */
#define PORT_DEVICE 0x02 /* number of device connected to 1 port */
#define MAX_DEVICE ( ATA_IF_MAX_PORT * PORT_DEVICE )/* The maximum number of device */
/* Device Interrupt Status */
#define IDE_FUNC_INT_REGCMP 0x80
#define IDE_FUNC_INT_REGERR 0x40
#define IDE_FUNC_INT_SEQWRREGCMP 0x20
#define IDE_FUNC_INT_CMPINTRQ 0x10
#define IDE_FUNC_INT_IDECMP 0x04
#define IDE_FUNC_INT_DETECTINTRQ 0x02
#define IDE_FUNC_INT_DETECTTERM 0x01
#endif /* IDE_FUNC_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -