| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /* Copyright (C) 2021 Rain */
- /* This file is part of XNIX. */
- /*
- XNIX is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) and later version.
- */
- /*
- XNIX is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- */
- /*
- You should have received a copy of the GNU General Public License
- along with XNIX. If not, see <https://www.gnu.org/licenses/>.
- */
- #ifndef _MOD_IDE_H
- #define _MOD_IDE_H
- #include <kernel/types.h>
- #include <kernel/errno.h>
- errno_t ide_init(void);
- extern void do_ide_intr(void);
- void unexcepted_ide_intr(void);
- void ide_stat(void);
- #define IDE_CMD_ID 0xec
- #define IDE_CMD_RD 0x20
- #define IDE_CMD_RD48 0x24
- #define IDE_CMD_WR 0x30
- #define IDE_CMD_WR48 0x34
- #define DISK0_DATA 0x1f0
- #define DISK0_ERR 0x1f1
- #define DISK0_SECTORS 0x1f2
- #define DISK0_ADDR_LOW 0x1f3
- #define DISK0_ADDR_MID 0x1f4
- #define DISK0_ADDR_HIGH 0x1f5
- #define DISK0_MODE 0x1f6
- #define DISK0_CMD 0x1f7
- #define DISK0_CTL_STAT 0x3f6
- #define DISK1_DATA 0x170
- #define DISK1_ERR 0x171
- #define DISK1_SECTORS 0x172
- #define DISK1_ADDR_LOW 0x173
- #define DISK1_ADDR_MID 0x174
- #define DISK1_ADDR_HIGH 0x175
- #define DISK1_MODE 0x176
- #define DISK1_CMD 0x177
- #define DISK1_CTL_STAT 0x376
- #define STAT_BUSY 0x80
- #define STAT_READY 0x40
- #define STAT_REQ 0x08
- #define STAT_ERR 0x01
- /* enable the irq...but 0 is enable, 1 is disable */
- #define CTL_IRQ 0x02
- #define CTL_RESET 0x04
- /* irq 14 and 15 */
- #define DISK0_INT_NR 0x2e
- #define DISK1_INT_NR 0x2f
- #define DISK0_IRQ_NR 14
- #define DISK1_IRQ_NR 15
- #define MODE_DISK1 0x10
- #define MODE_LBA 0x40
- #endif
|