Hi,
I am allocating memory for some areas. For DB i need 1024 bytes, for DS 1024*2 bytes and so on, and i initialised address as follows.
I initailise devBaseAddr to DB, because DB comes first, and next DC. DB is 1024 bytes , so for DC=DB+1024. This is DC address.
But there is an error in intialisation of DB address.
i.e in Line 8
DB=devBaseAddr;
Because devBaseAddr is of type char and DB is of type size_t.
How to assign address for DB i.e starting address of devBaseAddr;
void deviceBaseAddr()
{
char *devBaseAddr;
const size_t TotalDevMem = 1024+1024+1024*2+1024*4+1024*4+1024*8+1024*8+1024*8+1024*8+1024*8; /*DB+DC+DS+DL+DF+DD+D+M+X+Y*/
size_t DB, DC, DS, DL, DF, DD, D, M, X, Y;
devBaseAddr=(char *)malloc(TotalDevMem);
DB = devBaseAddr;
DC = DB+1024;
DS = DC+1024;
DL = DS+1024*2;
DF = DL+1024*4;
DD = DF+1024*4;
D = DD+ 1024*8;
M = D + 1024*8;
X = M + 1024*8;
Y = X + 1024*8;
size_t baseAddrTable[10] = { DB, DC, DS, DL, DF, DD, D, M, X, Y };
}