Date: Thu, 12 Jun 2014 14:50:04 GMT From: seiya@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r269453 - soc2014/seiya/bootsplash/sys/dev/fb Message-ID: <201406121450.s5CEo4go075578@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: seiya Date: Thu Jun 12 14:50:04 2014 New Revision: 269453 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=269453 Log: use pause() instead of timeout() In man page of timeout, it says that timeout() is old style so I replaced it by kthread and pause(). Modified: soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c Modified: soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c ============================================================================== --- soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c Thu Jun 12 13:59:14 2014 (r269452) +++ soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c Thu Jun 12 14:50:04 2014 (r269453) @@ -34,6 +34,7 @@ #include <sys/libkern.h> #include <sys/systm.h> #include <sys/param.h> +#include <sys/kthread.h> #include <dev/fb/bmp.h> #include <dev/fb/bsplash.h> @@ -55,7 +56,6 @@ return 0; } - static int bsplash_early_init2(void) { @@ -85,33 +85,41 @@ if (draw_bmp(adp, &bmp_info, 0, 1024, 768) != 0){ printf("bsplash: failed to draw BMP\n"); + return 1; + } + + if (kthread_add(update_animation, NULL, NULL, NULL, 0, 0, "bsplash") != 0){ + printf("bsplash: failed to start kernel thread 'update_animation()'\n"); + vidd_set_mode(adp, M_TEXT_80x25); return 1; } - timeout(update_animation, NULL, 1); - return 0; } static void update_animation(void *unused) { - static int count = 0; + static int count = 0; static int y = 0; - if (draw_bmp(adp, &bmp_info, y, 1024, 768) == 0){ - y += 768; - }else{ - y = 0; - draw_bmp(adp, &bmp_info, y, 1024, 768); /* try again */ - } + for (;;){ + if (draw_bmp(adp, &bmp_info, y, 1024, 768) == 0){ + y += 768; + }else{ + y = 0; + if(draw_bmp(adp, &bmp_info, y, 1024, 768) == 0) /* try again */ + y += 768; + } + + /* FIXME */ + if (count > 50){ + vidd_set_mode(adp, M_TEXT_80x25); + kthread_exit(); + } - /* FIXME */ - if (count > 40){ - vidd_set_mode(adp, M_TEXT_80x25); - }else{ count++; - timeout(update_animation, NULL, 1); + pause("bsplash", 15); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406121450.s5CEo4go075578>
