SayoriOS 0.3.3

atapi.h
1 #pragma once
2
3 #include "common.h"
4 #include "drv/disk/ata.h"
5 #include "io/ports.h"
6 #include <mem/vmm.h>
7
8 #define ATAPI_CMD_READY 0x00
9 #define ATAPI_CMD_RQ_SENSE 0x03
10 #define ATAPI_CMD_START_STOP 0x1B
11 #define ATAPI_READ_CAPACITY 0x25
12 #define ATAPI_CMD_READ 0xA8
13
14 typedef struct {
15 bool valid;
16
17 uint8_t sense_key;
18 uint8_t sense_code;
19 uint8_t sense_code_qualifier;
20 } atapi_error_code;
21
22 bool ata_scsi_status_wait(uint8_t bus);
23 bool ata_scsi_send(uint16_t bus, bool slave, uint16_t lba_mid_hi, uint8_t command[12]);
24
25 size_t ata_scsi_receive_size_of_transfer(uint16_t bus);
26 void ata_scsi_read_result(uint16_t bus, size_t size, uint16_t* buffer);
27 size_t atapi_read_size(uint16_t bus, bool slave);
28 size_t atapi_read_block_size(uint16_t bus, bool slave);
29
30 bool atapi_read_sectors(uint16_t drive, uint8_t *buf, uint32_t lba, size_t sector_count);
31 bool atapi_eject(uint8_t bus, bool slave);
32
34 bool atapi_check_media_presence(uint8_t bus, bool slave);
35 atapi_error_code atapi_request_sense(uint8_t bus, bool slave, uint8_t out[18]);
common.h
Основные определения ядра
atapi_error_code
Definition: atapi.h:14