diff --git a/os/drivers/lcd/lcd_dev.c b/os/drivers/lcd/lcd_dev.c index a21e5ab847..ddc0b55fb5 100644 --- a/os/drivers/lcd/lcd_dev.c +++ b/os/drivers/lcd/lcd_dev.c @@ -93,7 +93,6 @@ struct lcd_s { bool do_wait; #endif }; -static struct lcd_s *lcd_info; /**************************************************************************** * Private Function Prototypes ****************************************************************************/ @@ -376,10 +375,12 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } #if defined(CONFIG_LCD_FLUSH_THREAD) -static void lcd_flushing_thread(void) +static void lcd_flushing_thread(int argc, char **argv) { int ret; + DEBUGASSERT(argc == 2); FAR struct lcddev_area_s *lcd_area; + struct lcd_s *lcd_info = (struct lcd_s *)strtoul(argv[1], NULL, 16); lcd_area = &(lcd_info->lcd_area); while (true) { while (sem_wait(&lcd_info->flushing_sem) != 0) { @@ -423,13 +424,15 @@ int lcddev_register(struct lcd_dev_s *dev) { char devname[16] = { 0, }; int ret; + char *task_info[2]; + char lcd_info_addr[9]; /* for storing 32 bit address */ if (!dev) { return -EINVAL; } /* Allocate a new lcd_dev driver instance */ - lcd_info = (struct lcd_s *)kmm_zalloc(sizeof(struct lcd_s)); + struct lcd_s *lcd_info = (struct lcd_s *)kmm_zalloc(sizeof(struct lcd_s)); if (!lcd_info) { return -ENOMEM; } @@ -444,8 +447,10 @@ int lcddev_register(struct lcd_dev_s *dev) lcddbg("ERROR: Failed to allocate memory for LCD flush swap buffer\n"); return -ENOMEM; } - - int pid = kernel_thread("LCD Frame flusing", 204, 8192, lcd_flushing_thread, NULL); + itoa((int)lcd_info, lcd_info_addr, 16); + task_info[0] = lcd_info_addr; + task_info[1] = NULL; + int pid = kernel_thread("LCD Frame flusing", 204, 8192, lcd_flushing_thread, (FAR char *const *)task_info); if (pid < 0) { lcddbg("ERROR: Failed to start LCD Frame Flusing thread\n"); return -ENOMEM;