2013/03/15

ATA Operations

Access ATA registers.
PC/AT ports information:
http://stanislavs.org/helppc/ports.html

// Get Taskfile cylinder high register value
#include 
#define kinp(p)      inp(p)
#define ide_cyh0     ((U16)0x01f5) /* cylinder high register */

cyl_high = (U8)kinp(ide_cyh0);



DMA Access
DMA setting up is via BIOS interrupt call:
http://en.wikipedia.org/wiki/BIOS_interrupt_call

__asm {
    mov ax, 0xB10B
    mov bh, Base_B_Number
    mov bl, Base_DF_Number
    mov di, 0x48
    mov cl, hcl
    int 0x1A

Sequence of w/r DMA transfer:
  - Setup PRD table ( http://wiki.osdev.org/ATA/ATAPI_using_DMA ) 
  - Config DMA resigsers
  - Set IDE PRD table address to IDE port
  - Interrupt config
  - Sent out command to ide status/command port
  - Polling status port to wait for the command ends

No comments:

Post a Comment

Post Code on Blogger

Simplest way to post code to blogger for me: <pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black;overflow-x:...