AT91RM9200HDD.h
上传用户:yj_qqy
上传日期:2017-01-28
资源大小:2911k
文件大小:3k
- //*----------------------------------------------------------------------------
- //* ATMEL Microcontroller Software Support - ROUSSET -
- //*----------------------------------------------------------------------------
- //* The software is delivered "AS IS" without warranty or condition of any
- //* kind, either express, implied or statutory. This includes without
- //* limitation any warranty or condition with respect to merchantability or
- //* fitness for any particular purpose, or against the infringements of
- //* intellectual property rights of others.
- //*----------------------------------------------------------------------------
- //* File Name : hdd.h
- //* Object : main application written in C
- //* Creation : GGi 12/11/2002
- //*
- //*----------------------------------------------------------------------------
- #ifndef HDD_H
- #define HDD_H
- #include "AT91RM9200.h"
- #include "lib_AT91RM9200.h"
- /*--------------------------- Constants definition -------------------------*/
- #define ATA_STATUS_OFFSET 7
- #define ATA_ST_ERR (1)
- #define ATA_ST_CORR (1 << 2)
- #define ATA_ST_DRQ (1 << 3)
- #define ATA_ST_DSC (1 << 4)
- #define ATA_ST_DWF (1 << 5)
- #define ATA_ST_RDY (1 << 6)
- #define ATA_ST_BUSY (1 << 7)
- #define BUF_SIZE 512
- #define ATA_SIGNATURE 0x0040
- /*------------------- ATA command set -------------------------*/
- #define CHK_POWMOD 0xe5 //or 0x98
- #define DRIVE_DIAG 0x90
- #define ERASE_SECTOR 0xc0
- #define FORMAT_TRACK 0x50
- #define DRIVE_ID 0xec
- #define IDLE 0xe3 //or 0x97
- #define IDLE_IMM 0xe1 //or 0x95
- #define INIT_DRIVE_PARAM 0x91
- #define READ_BUF 0xe4
- #define READ_LONG_SECTOR 0x22 //or 0x23
- #define READ_MULT 0xc4
- #define READ_SECTOR 0x20 //or 0x21
- #define READ_VERIF_SECTOR 0x40 //or 0x41
- #define RECALIBRATE 0x10 //in fact 1xh
- #define REQ_SENSE 0x03
- #define SECU_DIS_PASS 0xf6
- #define SECU_ERASE_PREP 0xf3
- #define SECU_ERASE_UNIT 0xf4
- #define SECU_FREEZE_LOCK 0xf5
- #define SECU_SET_PASS 0xf1
- #define SECU_UNLOCK 0xf2
- #define SEEK 0x70 //in fact 7xh
- #define SET_FEATURES 0xef
- #define SET_MULT_MODE 0xc6
- #define SET_SLEEP_MODE 0xe6 //or 0x99
- #define STAND_BY 0xe2 //or 0x96
- #define STAND_BY_IMM 0xe0 //or 0x94
- #define TRANS_SECTOR 0x87
- #define WEAR_LEVEL 0xf5
- #define WRITE_BUF 0xe8
- #define WRITE_LONG_SECTOR 0x32 //or 0x33
- #define WRITE_MULT 0xc5
- #define WRITE_MULT_WO_ER 0xcd
- #define WRITE_SECTOR 0x30 //or 0x31
- #define WRITE_SECTOR_WO_ER 0x38
- #define WRITE_VERIFY 0x3c
- /*------------------- SMC values -------------------------*/
- #define HDD_IO_RWH (3 << 28)
- #define HDD_IO_RWS (5 << 24)
- #define HDD_IO_TDF (0 << 8)
- #define HDD_IO_NWS (10)
- /*--------------------------- Function Prototyping -------------------------*/
- int AT91F_HDDRead(unsigned short *,int);
- int AT91F_HDDWrite(unsigned short *,int);
- int AT91F_HDDErase(int);
- void AT91F_HDDOpen(void);
- int AT91F_HDDSleep(void);
- int AT91F_HDDRead_ID (unsigned short *);
- #endif // HDD_H