[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: Accessing memory with TNT



At 01:06 PM 8/28/96 +-100, Adam Barnes wrote:
>>> I am using PharLap's TNT Extender trying to write some code
>>> to access share memory on some network adapter board.
>>> From the Base Address Register, looks like the board is
>>> mapped to 0xF0000000.  Now, what system call in TNT (or other
>>> ways) can I use to read and write this memory?
>>> I've tried all these _dx_??? routines and still couldn't get
>>> it to work.  May be I wasn't using them right.  One more
>>> thing, I am using Microsoft Visual C 2.0.
>>> Thank you
>>> Henry Lau
>
>Try the following at your own risk!
>(Based largely on reading section 11.11
>of the TNT DOS-Extender Reference Manual).
>
>Compile with:
> cl /c filename.c
> 386link @msvc32.dos filename.obj
>
>/****************************************************************************/
>
>#include <stdlib.h>
>#include <stdio.h>
>#include <pharlap.h>
>#include <pldos32.h>
>
>int map_phys( int phys_base, int size, int *lin_base )
>{
>       .....
>	_dx_config_inf(&config, buf) ;
>	err = _dx_map_phys( config.c_ds_sel, mybase, mypages, (ULONG *)(&p) ) ;
>	switch( err )
>	{
>       .....
>	*lin_base = ((phys_base - mybase) + (int)p ) ;
>}
>
>main()
>{
>	int *mem ;
>
>	map_phys( 0xF0000000, 0x100000, (int *)&mem ) ;
>}
>
>/****************************************************************************/
>
>Adam Barnes
>Transtech Parallel Systems
>amb@transtech.co.uk
>
Thank you for your response.  I've tried this and it came back with 
error 130 for the _dx_map_phys() call meaning this is not supported in
my DPMI.  I am running Windows/95, so what else can I do?

By the way, I am using v7.0 of the TNT DOS Extender.

Thanks again
Henry Lau
+-----------------------------------------+----------------------------+
| Henry Lau                               | Phone: 619-674-5000 x222   |
| Director of Software Development        | Fax:   619-674-5005        |
| METACOMP, Inc.                          | Email: henrylau@cts.com    |
| 10989 Via Frontera, San Diego, CA 92127 | http://www.metacompinc.com |
+-----------------------------------------+----------------------------+
 <)