Commit 0c81312d authored by Pavel Pisa's avatar Pavel Pisa

seminaries/mzapo/lcd/mzapo_lcdip: add reset parameter to cause LCD controller HW reset.

Signed-off-by: Pavel Pisa's avatarPavel Pisa <pisa@cmp.felk.cvut.cz>
parent 0a181b66
......@@ -52,6 +52,7 @@ char *memdev="/dev/mem";
#define PARLCD_REG_BASE_PHYS 0x43c00000
#define PARLCD_REG_SIZE 0x00004000
#define PARLCD_REG_CR_o 0x0000
#define PARLCD_REG_CMD_o 0x0008
#define PARLCD_REG_DATA_o 0x000C
......@@ -85,6 +86,11 @@ void *map_phys_address(off_t region_base, size_t region_size, int opt_cached)
return mem;
}
void parlcd_write_cr(unsigned char *parlcd_mem_base, uint16_t data)
{
*(volatile uint16_t*)(parlcd_mem_base + PARLCD_REG_CR_o) = data;
}
void parlcd_write_cmd(unsigned char *parlcd_mem_base, uint16_t cmd)
{
*(volatile uint16_t*)(parlcd_mem_base + PARLCD_REG_CMD_o) = cmd;
......@@ -377,6 +383,12 @@ int main(int argc, char *argv[])
struct ifaddrs *ifa = NULL;
struct ifaddrs *ifa_it;
int lcd_hw_reset = 0;
if (argc >= 2)
if(!strcmp(argv[1], "reset"))
lcd_hw_reset = 1;
if (getifaddrs(&ifa)) {
return -1;
}
......@@ -404,6 +416,13 @@ int main(int argc, char *argv[])
if (parlcd_mem_base == NULL)
exit(1);
if (lcd_hw_reset) {
parlcd_write_cr(parlcd_mem_base, 2);
parlcd_delay(100);
parlcd_write_cr(parlcd_mem_base, 0);
parlcd_delay(100);
}
parlcd_hx8357_init(parlcd_mem_base);
parlcd_hx8357_init(parlcd_mem_base);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment