📄 hal4sys.h
字号:
#ifndef __HAL4SYS_H__
#define __HAL4SYS_H__
#define USBRST 0x00000400
#define SUSP 0x00002000
#define USBINT 0x00010000
#define D12_command (*((volatile unsigned char *) 0x82000001))
#define D12_data (*((volatile unsigned char *) 0x82000000))
#define D12_NOP (*((volatile unsigned char *) 0x80000000))
/* EeayARM2200和IDE接口连接 */
#define ATA_DATA 0xffff0000 /* EeayARM2200和IDE接口直接相连,p2.16~p2.31 */
#define IDE_A0 0x00010000 /* EeayARM2200和IDE接口直接相连,p1.16 */
#define IDE_A1 0x00020000 /* EeayARM2200和IDE接口直接相连,p1.17 */
#define IDE_A2 0x00040000 /* EeayARM2200和IDE接口直接相连,p1.18 */
#define IDE_CS0 0x00080000 /* EeayARM2200和IDE接口直接相连,p1.19 */
#define IDE_CS1 0x00100000 /* EeayARM2200和IDE接口直接相连,p1.20 */
#define IDE_DMACK 0x00200000 /* EeayARM2200和IDE接口直接相连,p1.21 */
#define IDE_DASP 0x00400000 /* EeayARM2200和IDE接口直接相连,p1.22 */
#define IDE_CSEL 0x00800000 /* EeayARM2200和IDE接口直接相连,p1.23 */
#define IDE_IOCS16 0x01000000 /* EeayARM2200和IDE接口直接相连,p1.24 */
#define IDE_PDIAG 0x02000000 /* EeayARM2200和IDE接口直接相连,p1.25 */
#define IDE_RST 0x00020000 /* EeayARM2200和IDE接口直接相连,p0.17 */
#define IDE_DMAREQ 0x00040000 /* EeayARM2200和IDE接口直接相连,p0.18 */
#define IDE_WR 0x00080000 /* EeayARM2200和IDE接口直接相连,p0.19 */
#define IDE_INTRQ 0x00100000 /* EeayARM2200和IDE接口直接相连,p0.20 */
#define IDE_RD 0x00200000 /* EeayARM2200和IDE接口直接相连,p0.21 */
// 输出口
/* EeayARM2104 */
/*
#define OUT_PUT IDE_CS0 + IDE_CS1 + IDE_RST + \
IDE_A0 + IDE_A1 + IDE_A2 + \
IDE_RD + IDE_WR + IDE_CSEL
*/
/* EeayARM2200 */
#define OUT_PUT_P0 IDE_RST + IDE_WR + IDE_RD
#define MASK_P0 ~(IDE_RST + IDE_WR + IDE_RD)
#define OUT_PUT_P1 IDE_A0 + IDE_A1 +IDE_A2 + IDE_CS0 + IDE_CS1 + IDE_CSEL
#define MASK_P1 ~(IDE_A0 + IDE_A1 +IDE_A2 + IDE_CS0 + IDE_CS1 + IDE_CSEL)
#define OUT_PUT_P2 ATA_DATA
#define MASK_P2 ~ATA_DATA
//ATA总线驱动器PIO(并行输入输出)的存贮器地址:
#define IDE_DATA IDE_CS1 // 数据寄存器
#define IDE_ERROR IDE_CS1 + IDE_A0 // 读错误寄存器
#define IDE_FEATURE IDE_CS1 + IDE_A0 // 写功能寄存器
#define IDE_SECCNT IDE_CS1 + IDE_A1 // 扇区计数器
#define IDE_SECTOR IDE_CS1 + IDE_A1 + IDE_A0 // 扇区号
#define IDE_CYLINDER_LOW IDE_CS1 + IDE_A2 // 柱面低8位
#define IDE_CYLINDER_HIGH IDE_CS1 + IDE_A2 + IDE_A0 // 柱面高8位
#define IDE_DEVICE_HEAD IDE_CS1 + IDE_A2 + IDE_A1 // 选择主从,模式,磁头
#define IDE_COMMAND IDE_CS1 + IDE_A2 + IDE_A1 + IDE_A0 // 写命令寄存器
#define IDE_STATUS IDE_CS1 + IDE_A2 + IDE_A1 + IDE_A0 // 读状态寄存器 0x041e0000
#define IDE_CONTROL IDE_CS0 + IDE_A2 + IDE_A1 // 写控制寄存器
#define IDE_ASTATUS IDE_CS0 + IDE_A2 + IDE_A1 // 读辅助状态寄存器
uint16 Hal4Sys_SwapINT16(uint16 wData);
uint32 Hal4Sys_SwapINT32(uint32 dData);
void Hal4Sys_InitTimer0(void);
void Hal4Sys_Wait4US(void);
void Hal4Sys_WaitInUS(uint32 time);
void Hal4Sys_WaitInMS(uint32 time);
void Hal4Sys_D12CmdPortOutB( uint8 val);
void Hal4Sys_D12DataPortOutB( uint8 val);
uint8 Hal4Sys_D12DataPortInB( void);
void Hal4Sys_ResetD12(void);
void Hal4Sys_InitD12(void);
// something different
void Hal4Sys_ATAPortOutB(uint32 Addr, uint8 Data);
uint8 Hal4Sys_ATAPortInB(uint32 Addr);
uint16 Hal4Sys_ATADataPortInW(void);
uint16 IDE_Read(uint32 reg);
void IDE_Write(uint32 reg, uint16 data);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -