#include
#include
#include "rtds_memory_user.h"
int main(int argc, char *argv[])
{
unsigned int *addr, *paddr, offset;
int i, j, k, c, count;
unsigned int mapaddr;
if (argc != 3)
{
printf("wrong arguments\n");
return 0;
}
sscanf(argv[1], "%x", &mapaddr);
// mapaddr = strtol(argv[1], NULL, 16);
offset = (mapaddr & 0xFFF)/4;
mapaddr = mapaddr & 0xFFFFF000;
count = atoi(argv[2]);
addr = (unsigned int*)map_shm_addr(mapaddr);
if(addr == NULL)
{
printf("error in getting shared memory address\n");
return -1;
}
addr += offset;
paddr = (unsigned int*)mapaddr + offset;
k = (count+3)/4;
for(i = 0; i < k; i++)
{
printf("%X: ",(unsigned int)paddr);
c = (count < 4) ? count : 4;
for (j = 0; j < c; j++)
printf("%X ", *(addr + j));
printf("\n");
addr += 4;
paddr += 4;
count -= 4;
}
return 0;
}
#include
#include "rtds_memory_user.h"
int main(int argc, char *argv[])
{
unsigned int *addr, *paddr, offset;
int i, j, k, c, count;
unsigned int mapaddr;
if (argc != 3)
{
printf("wrong arguments\n");
return 0;
}
sscanf(argv[1], "%x", &mapaddr);
// mapaddr = strtol(argv[1], NULL, 16);
offset = (mapaddr & 0xFFF)/4;
mapaddr = mapaddr & 0xFFFFF000;
count = atoi(argv[2]);
addr = (unsigned int*)map_shm_addr(mapaddr);
if(addr == NULL)
{
printf("error in getting shared memory address\n");
return -1;
}
addr += offset;
paddr = (unsigned int*)mapaddr + offset;
k = (count+3)/4;
for(i = 0; i < k; i++)
{
printf("%X: ",(unsigned int)paddr);
c = (count < 4) ? count : 4;
for (j = 0; j < c; j++)
printf("%X ", *(addr + j));
printf("\n");
addr += 4;
paddr += 4;
count -= 4;
}
return 0;
}