58 lines
1.4 KiB
C
58 lines
1.4 KiB
C
/* ATA.h - This file is a part of NutsOS
|
|
*
|
|
* NutsOS
|
|
* Copyright (C) 2013 Free Software Foundation, Inc.
|
|
*
|
|
* NutsOS 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) any later version.
|
|
*
|
|
* NutsOS 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 NutsOS; If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Valentin Verdier <valentin.verdier03@gmail.com>
|
|
*/
|
|
|
|
#pragma once
|
|
#ifndef NOS_ATA_H
|
|
#define NOS_ATA_H
|
|
|
|
#include "../types.h"
|
|
|
|
#define ATA_LBA_MODE 0xE0
|
|
#define ATA_CHS_MODE 0xA0
|
|
|
|
#define ATA_MASTER 0x00
|
|
#define ATA_SLAVE 0x10
|
|
|
|
#define ATA_0_PORT 0x1F0
|
|
#define ATA_1_PORT 0x170
|
|
#define ATA_2_PORT 0x1E8
|
|
#define ATA_3_PORT 0x168
|
|
|
|
#define ATA_0_CTRL_PORT 0x3F6
|
|
#define ATA_1_CTRL_PORT 0x376
|
|
#define ATA_2_CTRL_PORT 0x3E6
|
|
#define ATA_3_CTRL_PORT 0x366
|
|
|
|
#define ATA_CMD_READ 0x20
|
|
#define ATA_CMD_IDENTIFY 0xEC
|
|
|
|
typedef struct {
|
|
T_word ata_port;
|
|
T_word ata_ctrl_port;
|
|
T_byte drive;
|
|
} T_ATA_device;
|
|
|
|
|
|
int ata_select_drive(unsigned int, unsigned int, T_ATA_device*);
|
|
void ata_read(T_ATA_device, T_dword, T_byte, void*);
|
|
|
|
#endif
|