📄 ata.h
字号:
/*----------------------------------------------------------------------
*
* Filename: ata.h
*
* Contents: class ATA
*
* Authors: Whing, Anderson, Sean, ...
*
* Notes:
* 1.
* 2.
*
* Copyright (c) 2005 SAMSUNG Electronics.
*----------------------------------------------------------------------
*/
#ifndef __ATA_H__
#define __ATA_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "def.h"
//#include "myLIB.h"
//#include "def.h"
//#include "fat.h"
void Ch23_Ata(void);
//void INTC_Mask(int nInt);
void WaitForDeviceAccessReady(void);
U16 GetDataFromDevice() ;
U8 ReadDeviceReg(U32 nRegister) ;
U32 WaitForNoBusyStatus(void);
void WaitForTransferDone(void);
void WriteOnTaskFileReg(U32 nRegister,U32 nValue) ;
U32 GetMaxSectors();
void IdentifyDevice(void);
void SetAtaOnOff(U8 OnOff);
void SetLittleEndian(void);
void ATA_Init(void);
void SetPioMode(int pmode);
void SetMultiple(U32 nSector);
void SetAtaDevice(U32 uLBA, U32 uSectorCount);
void SetUdmaMode(int umode) ;
U32 OpenMedia(int mode);
void SetConfigMode(int mode, U32 isWriteMode);
void SetTransferCommand(U8 command);
void PutDataToDevice(U16 data) ;
void VerifyData(U32 writeBufferAddr, U32 readBufferAddr, U32 sectors);
U32 ReadSectors_Pio(U32 uLBA, U32 uSectorCount, U32 uDesAddress);
U32 WriteSectors_Pio(U32 nLBA,U32 nSectorCount,U32 nSrcAddress);
U32 ReadSector_PioDma(U32 uLBA, U32 uDesAddress) ;
U32 WriteSector_PioDma(U32 uLBA, U32 uSrcAddress);
U32 ReadSectors_Udma(U32 uLBA,U32 uSectorCount,U32 uDstAddress);
U32 WriteSectors_Udma(U32 uLBA,U32 uSectorCount,U32 uSrcAddress) ;
U32 ReadBlocks(U32 uStBlock, U32 uBlocks, U32 uBufAddr);
U32 WriteBlocks(U32 uStBlock, U32 uBlocks, U32 uBufAddr);
U32 Compare32(U32 a0, U32 a1, U32 words);
void Dump32(U32 addr, U32 words);
void TestPioDmaMode(void);
void TestPioDmaModeRead(void);
void TestPioMode(void);
void TestPioModeRead(void);
//+daedoo 060919
void ATA_ClearPending(U32 nbit);
//void ATA_FindInterruptRequest(U32& nthBit);
void ATA_ClearAllInterrupt(void);
U32 IsDmaDone(void);
void TestPioIntMode(void);
void TestPioDmaIntMode(void);
void Start(void);
void Stop (void);
void ReadTime(U32 count);
struct ATA_DEV_INFO
{
U32 CurrentCommand;
U32 MaxMultiple;
U32 CurrentMultiple;
U32 MaxSectors;
U32 DeviceType;
int MaxPioMode;
int MaxUdmaMode;
int CurrentPioMode;
int CurrentUdmaMode;
} ;
enum ATA_ERR
{
ATA_NO_ERROR,
ATA_TIMEOUT,
ATA_ABORT,
ATA_OUT_OF_ADDRESS,
ATA_UNCORRECTABLE_DATA,
ATA_DEV_INFO_BUSY,
ATA_UNKNOWN
};
#define PIO0 0
#define PIO1 1
#define PIO2 2
#define PIO3 3
#define PIO4 4
#define UDMA0 1
#define UDMA1 2
#define UDMA2 3
#define UDMA3 4
#define UDMA4 5
#define true 1
#define false 0
enum ATA_TRANSFER_COMMAND
{
ATA_CMD_STOP, ATA_CMD_START, ATA_CMD_ABORT, ATA_CMD_CONTINUE
};
enum ATA_INT_SRC
{
ATA_INT_XFER_DONE=0, ATA_INT_UDMA_HOLD, ATA_INT_IRQ, ATA_INT_TBUF_FULL, ATA_INT_SBUF_EMPTY
};
#define PIO 1
#define PIODMA 2
#define UDMA 3
#define SRC_INT_NUM 6
#ifdef __cplusplus
}
#endif
#endif // __ATA_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -