www.delorie.com/djgpp/v2faq/faq150.html | search |
| Previous | Next | Up | Top |
__dpmi__XXX
wrappers in the DJGPP library. Here's a somewhat schematic example:
#include <dpmi.h> . . __dpmi_meminfo mi; int selector; . . /* Map the physical device address to linear memory. */ mi.address = physical_address; mi.size = physical_address_size; __dpmi_physical_address_mapping (&mi); /* Now mi.address holds the linear address. */ . . /* Allocate an LDT descriptor and set it up to span the entire device on-board memory. */ selector = __dpmi_allocate_ldt_descriptor (1); __dpmi_set_segment_base_address (selector, mi.address); __dpmi_set_segment_limit (selector, mi.size - 1);Note that the segment limit should be one less than the size. Also, segments over 1MB in length must be a multiple of 4KB, otherwise the DPMI server might fail the call, or silently change the limit. You can then use the functions from the sys/farptr.h header file to access that device. See accessing memory-mapped devices, for more details about accessing memory-mapped devices given their linear address.
webmaster donations bookstore | delorie software privacy |
Copyright ⌐ 1998 by Eli Zaretskii | Updated Sep 1998 |
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)