#include <stdlib.h>
#include <stdio.h>
#include <hw/inout.h>
#include <sys/mman.h>
#define GPIO_DATAIN 0x138
#define SPI_MEM_SIZE 0x1000
#define DRA72X_GPIO7_BASE 0x48051000 // 192-223
int Lvds_lock_status_ctrl()
{
uintptr_t lvds_lock;
uintptr_t pointer2;
lvds_lock = DRA72X_GPIO7_BASE;
pointer2 = mmap_device_io(SPI_MEM_SIZE, lvds_lock + GPIO_DATAIN);
if(pointer2 == (uintptr_t) MAP_FAILED)
{
printf("Unable to map in device registers (%d).\n", errno);
return 0;
}
else
{
if((in32(pointer2) >> 26 & 1) == 0)
{
return 0;
}
return 1;
}
}
int main(void)
{
int ret = 0;
while(1)
{
ret = Lvds_lock_status_ctrl();//locked return 1
usleep(1000*500);
}
return 0;
}