Hi. I am seriously confused as to how to access a memory address+offset and bit field. My attempt is below:
Code:
#define secPerTrk 0x3F //= 63
#define maxHeadNm 0xFE //= 254
#define intATACmd 0x91 //= initialize ata command
//initialize ata
pci_write_config_dword(&pci, ((BAR5+0x90)>>16), secPerTrk);
pci_write_config_dword(&pci, ((BAR5+0x94)>>16), maxHeadNm);
pci_write_config_dword(&pci, ((BAR5+0x94)>>24), intATACmd);
//poll status
pci_read_config_dword(&pci, (BAR5+0x94), &i);
while(!((i >> 24) & 0x80) == 0) //is busy?
{
delay(10);
pci_read_config_dword(&pci, ((BAR5+0x94)>>24), &i);
}
//ready
printf(0x0F,3,10,"Device Ready!");
I am returning Device Ready, but I just don't believe it is working as I do not trust my shifts. Can someone please take a look at my code and tell me what I am doing wrong?
Thanks