Using Vitual DMA Services...help !

Using Vitual DMA Services...help !

Post by James Deucha » Tue, 02 Feb 1999 04:00:00



Help.....! I'm still trying to get my DMA to work so I need to get the
actual phy mem address. The VDS method is preferable to copying data into a
buffer below the 1M mark and dmaing that because speed is a factor. What's
wrong with my code (or right with it)........I always get some sort of
error code back...often in reserved registers...please help!

struct DMA_DESCR_STR {
        DWORD size;
        DWORD offset;
        WORD segsel;
        WORD buffID;
        DWORD phy_addr;

Quote:};

DWORD get_phy_addr(     DWORD offset_addr, DWORD size )
{
        DWORD dds_addr;
        struct DMA_DESCR_STR dds;
        __dpmi_regs InRegs;

        //check for VDS at bit 5 of mem 0x0040:007b  ----   HOW CAN I CHECK THIS
BIT????

        dds.size = size;
        dds.segsel = (WORD)_my_ds();                                    //returns an int
        dds.offset = offset_addr ;

        // lock dma region -  Clear register structure */
        memset( &InRegs, 0, sizeof( __dpmi_regs ) );

        InRegs.h.ah = 0x81 ;
        InRegs.h.al = 0x03 ;    //specifies VDS lock dma region
        InRegs.x.dx = 0x3c ;    // do remap and don't allocate buffer

        dds_addr = (DWORD)&dds;
        InRegs.x.es =(WORD)(dds_addr >> 16);                              // upper 16 bits
        InRegs.x.di = (WORD)((DWORD)0xffff & dds_addr);             // lower 16 bits

        if ((__dpmi_int (0x4b, &InRegs)) == -1) {
                printf("get_phy_addr : dpmi_int error...");
                return 0;
        }
        if (InRegs.x.flags & 1) {      /* is carry flag set?  */
                printf("\nget_phy_addr - Call to VDS lock dma region failed...\n");
                printf("Error Code AL = %x\n",InRegs.h.al);
                return ( FALSE );
        } else {
                return dds.phy_addr;
        }

Quote:}                      

Thanks!!!

--

Dept. of Engineering
Durham University
United Kingdom

 
 
 

Using Vitual DMA Services...help !

Post by Peter Remmer » Tue, 02 Feb 1999 04:00:00


James Deuchar schrieb in Nachricht

Quote:>Help.....! I'm still trying to get my DMA to work so I need to get the
>actual phy mem address. The VDS method is preferable to copying data into a
>buffer below the 1M mark and dmaing that because speed is a factor. What's
>wrong with my code (or right with it)........I always get some sort of
>error code back...often in reserved registers...please help!

I had the same problem. I couldn't get VDS to return the physical address of
a malloc'd buffer (not coninuous or so), allocating one with VDS didn't work
either,
I needed a buffer of about 2MB which was too big for VDS.
Then the problem was that it worked under plain DOS but not in a W95 DOS
box.

Then someone told me I should use XMS, which solved my problems.
Allocate your buffer with XMS use the XMS lock handle function to get the
physical
address. Then you can either build a selector for that physical address or
use
the XMS moving functions to access that buffer.

Quote:> //check for VDS at bit 5 of mem 0x0040:007b  ----   HOW CAN I CHECK THIS
>BIT????

That would be something like
  _farpeekb(__dos_ds, 0x4007) & 0x20

good luck!

Peter Remmers

 
 
 

1. Need help on Virtual DMA Services

        I am writing a protected mode DOS application and would like
some examples of how to use VDS to transfer data to and from a hard
disk. Can anybody out there e-mail me some example source code or at
least point me to a site where I could obtain the information.
        Thanks.
--
|\  /~|~\ Melvin Curran              |

|  |  |                              |
|   \_|_/                            |

2. Mac LC II - What is going on??

3. VDS: Looking for info about Virtual DMA Services

4. text modification or page I/O error

5. Virtual DMA Services

6. Win32 for OS/2 : Q2TEST

7. Looking for 68040 FPU emulator for Power Mac

8. Virtual DMA services

9. Calling MSDOS services inside interupt Service Routines?

10. Problem with vitual screens in mode 0x13

11. inform.zip Reports interrupt services a program uses, PC-Mag util

12. How a Driver Uses HIMEM/EMM386 Services