Intel 8254x: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
[unchecked revision][unchecked revision]
m (Add syntax highlighting.)
mNo edit summary
Line 27:
There is also a BAR that will contain an I/O base address, this can be detected by looking at each BAR and testing bit 1.
 
When using MMIO, reading/writing to/from registers is very straight-forward.
 
<source lang="c">
*(uint32_t *)(ioaddr + reg) = val; // writes "val" to an MMIO address
val = *(uint32_t *)(ioaddr + reg); // reads "val" from an MMIO address
</source>
 
Line 39:
 
<source lang="c">
out32(ioaddr + 0x00, reg); // set the IOADDR window
out32(ioaddr + 0x04, val); // write the value to the IOADDR window which will end up in the register in IOADDR
in32(ioaddr + 0x04); // read back the value
</source>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu