#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#define CSI40_BASE (0xFEAA0000)
#define RCAR_CSI2_FCNTM 0X170
#define RCAR_CSI2_PHYDIM 0X180
#define MAP_SIZE 0x99
static int dev_fd;
int main(int argc, char **argv)
{
int i=0;
dev_fd = open("/dev/mem", O_RDWR | O_NDELAY);
printf("open\n");
if (dev_fd < 0)
{
printf("open(/dev/mem) failed.");
return 0;
}
u_int32_t *map_base;
map_base=(u_int32_t * )mmap(NULL, 0x99*sizeof(u_int32_t), PROT_READ, MAP_PRIVATE, dev_fd, CSI40_BASE );
printf("mmap\n");
for(i=0;i<=0x99;i++)
{
printf("0x%x %x \n",CSI40_BASE + i*4, map_base[i]); //Print Reg
}
if(dev_fd)
close(dev_fd);
munmap(map_base,MAP_SIZE);
return 0;
}
在应用层打印内核寄存器
最新推荐文章于 2022-04-19 14:49:56 发布