piyush619 said:Also i m not too sure but dos.h and direct memory access will not work in C++
from a code called as dma.cpp
// Allocate an adapter object on the stack
DMA_ADAPTER_OBJECT AdapterObject;
AdapterObject.ObjectSize = sizeof(AdapterObject);
AdapterObject.InterfaceType = Local;
AdapterObject.BusNumber = 0;
// Allocate a single paged 4 KB output buffer
dma_out_page[0] = (PUCHAR) HalAllocateCommonBuffer(&AdapterObject, dma_buffer_size * VIDEO_DMA_BUFFERS, &dma_out_logical_address, FALSE);
if (!dma_out_page[0]) {
ERRMSG(": DMA Buffer Page Allocation Failed");
return FALSE;
}
C++ introduces high overhead, C is still very popular in my segment ( Embedded Systems) and all my bootloader and HAL (hardware abstraction layer) is coded in a mix of asm and C.pathiks said:afaik all c codes work in c++ ...
but wats the use... c++ codes codes give u added functionality...
aceman said:AFAIK,Printf and scanf are supported in C++...........all my drivers are in C++ but I use printf to display the output.
aceman said:Direct Memory Access ( DMA ) will work in c++, it will work in C and heck it can even work in asm.I am not very sure what you meant in the above statement, could you please elaborate ?
This how I use DMA
Actually these header files are loaded by deafult by the compiler, but I do accept my compiler compiles both C and C++.piyush619 said:printf() and scanf() are defined in <stdio.h> u need to include this file and it is only available with C Compiler.
today mostly compilers comes for C and C++ both
try only C or only C++ compliler
piyush619 said:I m not talking about DMA structure
i dont know about Embedded Systems
i m talking about
Display Adapter Address
e.g
using long far pointer in C we can access video memory addresses using itt86() function
Best of my knowledge only some typecasting is required for c++, whereas I can get away without that in C.Otherwise pointers should behave more or less the same in both.from somevideodriver.cpp
BYTE gFrameBuffer;
gFrameBuffer = (PBYTE)VirtualAlloc(NULL,size,MEM_RESERVE,PAGE_NOACCESS);
VirtualCopy(gFrameBuffer,pVirtAddr,size,PAGE_READWRITE|PAGE_NOCACHE);
or a More down to earth Implementation
BYTE *gFrameBuffer;
gFrameBuffer= (BYTE *) MmMapIoSpace(
<<PHYSICAL_ADDRESS>> 0x80000,
<<NumberOfBytes>> 1024*1024,
<<CacheEnable>> FALSE
);
aceman said:Actually these header files are loaded by deafult by the compiler, but I do accept my compiler compiles both C and C++.
aceman said:No more clarification is that a int86() function or itt86() ? ie You want to access some portion of memory directly by using a pointer.
If I get it right, you meant "Directly accessing the Memory" and Not "Direct Memory Access (DMA)" like a passing a pointer and using that accessing the memory area ?
aceman said:if this is the requirment then it is very much possible in C++ by using the code snippet as follows.This reserves a protion of video memory and can be accessed by using that pointer
aceman said:Best of my knowledge only some typecasting is required for c++, whereas I can get away without that in C.Otherwise pointers should behave more or less the same in both.
no OS permission is requiredaceman said:I beileve accessing memory directly has more to do with OS permissions than with any limitations in C or C++.
lol.........you are just too childish....I never accused you of anything.....we were just having a healthy debate...b/w I am a device driver developer with TI with about 4+ years experence and TI generally takes people who do do not know whats is stdio.h .Stop using deragatory terms like "if u dont know read any C book " ........I am your daddy when it comes to C/C++.I had even written portions of a cross compiler for a new architecture.piyush619 said:see there are functions defined in header file <stdio.h>
if u dont know read any C book ..................
n2casey said:Codes which can b executed in C++ can't b executed in C but is there any code in C which can't b executed in C++??????