void *fb_routine(void *ptr) { fb_init(); INFO("Feamebuffer Init - OK"); unsigned char rr, gg, bb; srand(time(NULL)); INFO(" width=%d\n height=%d", fb_dev.width, fb_dev.height); while(1) { switch (cmd) { case DRAW: page_flip(r, g, b); break; case RANDOM_COLOR: rr = rand() % 0xFF; gg = rand() % 0xFF; bb = rand() % 0xFF; page_flip(rr, gg, bb); break; case DPMS_ON: case DPMS_OFF: case DPMS_SUSPEND: case DPMS_STANDBY: DPMS_set(cmd); cmd = DEFAULT; break; case REINIT: fb_init(); cmd = 0; break; default: sleep(1); printf("default"); break; } } close(fb_dev.fb_fd); return NULL; }
// Bootstrap processor starts running C code here. // Allocate a real stack and switch to it, first // doing some setup required for memory allocator to work. int main(void) { unsigned char FB[]="MESSAGE WRITTEN THROUGH FRAMEBUFFER!!"; fb_init(); // initialize framebuffer device (2015.11.02) cprintf("\nUsing Framebuffer still presents some problems :(\n\n"); cprintf("\nSuggestion: review the way it is used in console.c\n\n"); fb_write(FB, sizeof(FB)); // Framebuffer maybe could be used before this moment (2015.11.02) see_mylock(MYLOCK); kinit1(end, P2V(4*1024*1024)); // phys page allocator kvmalloc(); // kernel page table mpinit(); // collect info about this machine lapicinit(); seginit(); // set up segments cprintf("\ncpu%d: starting xv6\n\n", cpu->id); picinit(); // interrupt controller ioapicinit(); // another interrupt controller consoleinit(); // I/O devices & their interrupts uartinit(); // serial port pinit(); // process table tvinit(); // trap vectors binit(); // buffer cache fileinit(); // file table ideinit(); // disk if(!ismp) timerinit(); // uniprocessor timer startothers(); // start other processors kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers() userinit(); // first user process // Finish setting up this processor in mpmain. mpmain(); }
int main(int argc, char *argv[]) { fb_info_t fb; pthread_t tid[3]; int i; if(fb_init(NULL, &fb) == NULL) err_sys("fail to fb_init"); sem_init(&sem, 0, 1); pthread_rwlock_init(&rwlock, NULL); pthread_create(&tid[0], NULL, do_renew, NULL); pthread_create(&tid[1], NULL, do_dispjpg, (void *)&fb); pthread_create(&tid[2], NULL, do_mouse, (void *)&fb); pthread_join(tid[0], NULL); pthread_join(tid[1], NULL); pthread_join(tid[2], NULL); fb_destroy(&fb); pic_destroy(&pic_head); sem_destroy(&sem); pthread_rwlock_destroy(&rwlock); return 0; }
int main(int argc, char **argv) { debug_init(); debug(INFO, "starting...\n"); int shell_pid = 0; pts_fn = fbterm_openpty(&pty); if (shell_pid = fork()) { if (fb_init("/dev/fb0")) { exit(-1); } if (fbterm_init(&term[0]) < 0) { debug(1, "Error initalizing fbterm\n"); exit(-1); } kbd_fd = open(KBD_PATH, O_RDONLY); if (kbd_fd < 0) { debug(1, "Error initalizing keyboard\n"); exit(-1); } pthread_t aqkb; pthread_create(&aqkb, NULL, aqkb_thread, NULL); fbterm_main(); } else { launch_shell(); } return 0; }
int main() { u32 depth = 16; //u32 depth = 24; // true color doesn't work? struct fb_info *fb; /* initialize early so we can use it for debugging */ serial_init(); mem_init(); fb = fb_init(depth); if (fb) { printk("hello world\n"); printk("resolution: %dx%d\n", fb->width, fb->height); } printk("firmware revision: 0x%x\n", get_firmware_revision()); printk("board model: 0x%x\n", get_board_model()); printk("board revision: 0x%x\n", get_board_revision()); exception_init(); init(); while (1) { int c; serial_printk("$ "); c = serial_getchar(); serial_printk("got this char: %c (%d) (0x%x)\n", c, c, c); } while(1) ; return 0; }
int main(int argc, char **argv) { struct fb fb; struct pt p; struct sigaction sa; sa.sa_handler = &sighandler; sigaction(SIGINT, &sa, NULL); srand(time(NULL)); fb_init(&fb); int w = fb.vinfo.xres; int h = fb.vinfo.yres; int min_r = 5; int max_r = 200; while (running) { set_color(&fb, rand()); p.x = rand() % w; p.y = rand() % h; double radius = rand() % (max_r - min_r) + min_r; if (p.x - radius < 0 || p.x + radius >= w || p.y - radius < 0 || p.y + radius >= h) { continue; } fill_circle(&fb, p, radius); buffer_swap(&fb); refresh(&fb); usleep(100); } fb_uninit(&fb); return 0; }
tracking_run* trackcorr_c_init() { int step; tracking_run *ret; /* Remaining globals: see below for communication globals. */ ret = (tracking_run *) malloc(sizeof(tracking_run)); tr_init(ret, "parameters/sequence.par", "parameters/track.par", "parameters/criteria.par", "parameters/ptv.par"); fb_init(ret->fb, 4, ret->cpar->num_cams, MAX_TARGETS, "res/rt_is", "res/ptv_is", "res/added", ret->seq_par->img_base_name); /* Prime the buffer with first frames */ for (step = ret->seq_par->first; step < ret->seq_par->first + 3; step++) { fb_read_frame_at_end(ret->fb, step, 0); fb_next(ret->fb); } fb_prev(ret->fb); ret->lmax = norm((ret->tpar->dvxmin - ret->tpar->dvxmax), \ (ret->tpar->dvymin - ret->tpar->dvymax), \ (ret->tpar->dvzmin - ret->tpar->dvzmax)); volumedimension (glob_cal, &(ret->vpar->X_lay[1]), &(ret->vpar->X_lay[0]), &(ret->ymax), &(ret->ymin), &(ret->vpar->Zmax_lay[1]), &(ret->vpar->Zmin_lay[0]), cpar); // Denis - globals below are used in trackcorr_finish npart=0; nlinks=0; return ret; }
int main(int argc, char **argv) { char *hide = "\x1b[2J\x1b[H\x1b[?25l"; char *show = "\x1b[?25h"; char **args = argv + 1; if (fb_init(FBDEV)) { fprintf(stderr, "fbpad: failed to initialize the framebuffer\n"); return 1; } if (sizeof(fbval_t) != FBM_BPP(fb_mode())) { fprintf(stderr, "fbpad: fbval_t does not match framebuffer depth\n"); return 1; } if (pad_init()) { fprintf(stderr, "fbpad: cannot find fonts\n"); return 1; } write(1, hide, strlen(hide)); signalsetup(); fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK); while (args[0] && args[0][0] == '-') args++; mainloop(args[0] ? args : NULL); write(1, show, strlen(show)); pad_free(); scr_done(); fb_free(); return 0; }
/** * * @param boot_dev * @param arm_m_type * @param atags * @return */ int notmain(uint32_t boot_dev, uint32_t arm_m_type, uint32_t atags) { #ifdef ENABLE_FRAMEBUFFER fb_init(); #else bcm2835_uart_begin(); #endif printf("Compiled on %s at %s\n\n", __DATE__, __TIME__); mem_info(); cpu_info(); printf("\n"); printf("EMMC Clock rate (Hz): %ld\n", bcm2835_vc_get_clock_rate(BCM2835_VC_CLOCK_ID_EMMC)); printf("UART Clock rate (Hz): %ld\n", bcm2835_vc_get_clock_rate(BCM2835_VC_CLOCK_ID_UART)); printf("ARM Clock rate (Hz): %ld\n", bcm2835_vc_get_clock_rate(BCM2835_VC_CLOCK_ID_ARM)); printf("CORE Clock rate (Hz): %ld\n", bcm2835_vc_get_clock_rate(BCM2835_VC_CLOCK_ID_CORE)); printf("\n"); printf("Set UART Clock rate 4000000 Hz: %ld\n", bcm2835_vc_set_clock_rate(BCM2835_VC_CLOCK_ID_UART, 4000000)); printf("UART Clock rate (Hz): %ld\n", bcm2835_vc_get_clock_rate(BCM2835_VC_CLOCK_ID_UART)); printf("\n"); uint8_t mac_address[6]; bcm2835_vc_get_board_mac_address(mac_address); printf("MAC address : %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n", mac_address[0],mac_address[1],mac_address[2],mac_address[3],mac_address[4],mac_address[5]); printf("\nProgram ending...\n"); return 0; }
void main(void) { unsigned char tmp; unsigned char x = 0; P1_4 = 1; //P1_4 = 0; fb_init(); keyboard_init(); EA = 1; // enable global interrupts clearDisplay(); drawRectangle(0,0,13,19); while(1) { /* tmp = readBuf(); if(tmp == 0x34) { if(x == 0){ setPx(2,2); x = 1; } else { clearPx(2,2); x = 0; } } */ } }
void main(void) { unsigned char difficulty = 0; unsigned char input = 0; P1_4 = 1; /* init hardware */ fb_init(); keyboard_init(); EA = 1; // enable global interrupts /* show our startdisplay */ display_start(difficulty); while(1) { input = readBuf(); /* change difficulty which results in changing speed */ if(input == SHIFT_KEY) { difficulty++; if(difficulty > 2) { difficulty = 0; } display_start(difficulty); } /* start game with space */ if(input == SPACE_KEY) { clearDisplay(); start_game(15000 - difficulty*5000); display_start(difficulty); } } }
int main(int argc, const char *argv[]) { FBDEV fbdev; strcpy(fbdev.dev, "/dev/fb0"); if (fb_init(&fbdev) == -1) { return -1; } ////test //int i, j; //for (i = 0; i < 30; i++) //{ //for (j = 0; j < 100; j++) //{ //draw_pixel(&fbdev, 200+i, 200+j, 0x00ff0000); //} //} ////end test //draw_pixel(&fbdev, 500, 500, 0x0000ff00); mouse_main(&fbdev); fb_destroy(&fbdev); //fun_test(); return 0; }
/** Initialize the primary console. * @param tags Tag list. */ void primary_console_init(kboot_tag_t *tags) { kboot_tag_video_t *video; log_init(tags); while (tags->type != KBOOT_TAG_NONE) { if (tags->type == KBOOT_TAG_VIDEO) { console_out_t *console = NULL; video = (kboot_tag_video_t *)tags; if (video->type == KBOOT_VIDEO_LFB && video->lfb.flags & KBOOT_LFB_RGB) { current_video_mode = malloc(sizeof(*current_video_mode)); current_video_mode->type = VIDEO_MODE_LFB; current_video_mode->width = video->lfb.width; current_video_mode->height = video->lfb.height; current_video_mode->pitch = video->lfb.pitch; current_video_mode->format.bpp = video->lfb.bpp; current_video_mode->format.red_size = video->lfb.red_size; current_video_mode->format.red_pos = video->lfb.red_pos; current_video_mode->format.green_size = video->lfb.green_size; current_video_mode->format.green_pos = video->lfb.green_pos; current_video_mode->format.blue_size = video->lfb.blue_size; current_video_mode->format.blue_pos = video->lfb.blue_pos; current_video_mode->mem_phys = video->lfb.fb_phys; current_video_mode->mem_virt = video->lfb.fb_virt; current_video_mode->mem_size = video->lfb.fb_size; fb_init(); console = fb_console_create(); } #ifdef CONFIG_ARCH_X86 if (video->type == KBOOT_VIDEO_VGA) { current_video_mode = malloc(sizeof(*current_video_mode)); current_video_mode->type = VIDEO_MODE_VGA; current_video_mode->width = video->vga.cols; current_video_mode->height = video->vga.lines; current_video_mode->x = video->vga.x; current_video_mode->y = video->vga.y; current_video_mode->mem_phys = video->vga.mem_phys; current_video_mode->mem_virt = video->vga.mem_virt; current_video_mode->mem_size = video->vga.mem_size; console = vga_console_create(); } #endif if (console && console->ops->init) console->ops->init(console); primary_console.out = console; break; } tags = (kboot_tag_t *)round_up((ptr_t)tags + tags->size, 8); } }
void notmain() { gpio_init(); led_init(); timer_init(); fb_init(); keyboard_init(); while (1) {led_toggle();} }
int main() { info_t fb; fb_init(&fb); mouse_test(&fb); fb_close(&fb); return 0; }
int main(int argc, char **argv) { fbuf_t seq[2]; const char **pp; size_t ilen, clen, slen; int flip; fb_init(&seq[0]); fb_init(&seq[1]); ilen = fb_readall(&seq[0], stdin); clen = fb_subst(&seq[1], &seq[0], ">.*|\n", ""); for (pp = variants; *pp; pp++) printf("%s %d\n", *pp, fb_countmatches(&seq[1], *pp)); for (slen = 0, flip = 1, pp = subst; *pp; pp += 2, flip = 1-flip) slen = fb_subst(&seq[1-flip], &seq[flip], *pp, pp[1]); printf("\n%zu\n%zu\n%zu\n", ilen, clen, slen); return 0; }
/** * Init the LCD controller * * @param lcdbase Base address of LCD frame buffer * @return 0 if ok, -ve error code on error */ int lcd_ctrl_init(unsigned long int fb_size, struct exynos5_fimd_panel *panel_data, void *lcdbase) { int ret = 0; fimd_bypass(); fb_init(fb_size, lcdbase, panel_data); return ret; }
void main(void) { fb_init(WIDTH, HEIGHT, DEPTH, FB_SINGLEBUFFER); for( int y = 0; y < HEIGHT; y += 16 ) draw_hline(y, GL_WHITE); for( int x = 0; x < WIDTH; x += 16 ) draw_vline(x, GL_WHITE); }
void setup() { Serial.begin(115200); fdevopen(&serial_putc, 0); fb_init(fb_default()); init_task(); vTaskStartScheduler(); }
int main() { uint8_t buf[BUFSIZE]; ssize_t size; fd_set fds; struct timeval tv; struct framebuffer fb; struct terminal term; /* init */ setlocale(LC_ALL, ""); if (atexit(tty_die) != 0) fatal("atexit failed"); tty_init(); fb_init(&fb, term.color_palette); check_env(&fb); term_init(&term, fb.res, fb.rotate); /* fork and exec shell */ eforkpty(&term.fd, term.lines, term.cols); /* main loop */ while (tty.loop_flag) { if (tty.redraw_flag) { redraw(&term); refresh(&fb, &term); tty.redraw_flag = false; } check_fds(&fds, &tv, STDIN_FILENO, term.fd); if (FD_ISSET(STDIN_FILENO, &fds)) { size = read(STDIN_FILENO, buf, BUFSIZE); if (size > 0) ewrite(term.fd, buf, size); } if (FD_ISSET(term.fd, &fds)) { size = read(term.fd, buf, BUFSIZE); if (size > 0) { if (DEBUG) ewrite(STDOUT_FILENO, buf, size); parse(&term, buf, size); if (tty.lazy_draw && size == BUFSIZE) continue; refresh(&fb, &term); } } } /* die */ term_die(&term); fb_die(&fb); return EXIT_SUCCESS; }
void fb_3d_demo() { fb_init(); uint16_t background; background = fb_createcolor(0,5,10); fb_paintbackground(background); uint16_t clr; clr = fb_createcolor(10,10,10); fb_paintcube(100, 100, 70, 70, clr); fb_paintcube(150, 150, 100, 100, clr); }
void debug_init (void) { /* Clear interrupt mask. */ write32(0x0c003004, 0); /* Unlock EXI. */ write32(0x0d00643c, 0); fb_init(); debug_inited = 1; }
int drv_dbox2_init (void) { #ifdef CONFIG_DBOX2_FB fb_init (); strcpy (fbdev.name, "fb"); stdio_register (&fbdev); #endif /* CONFIG_DBOX2_FB */ return 1; }
int gp_init() { if(common_init()) return -1; //armv6 works. if(cmd_init()) return -1; if(memory_init()) return -1; if(task_init()) return -1; if(bdev_init()) return -1; if(image_init()) return -1; if(nvram_init()) return -1; if(fs_init()) return -1; if(fb_init()) return -1; gGpHasInit = TRUE; return 0; }
bool screen_init (void) { #ifdef LINUXFB use_fb = 1; if (fb_init ()) { use_fb = 0; return false; } #endif #ifdef VGALIB use_fb = 0; vga_init (); vga_setmode(DEFAULT_VGA_MODE); gl_setcontextvga(DEFAULT_VGA_MODE); physical_screen = gl_allocatecontext(); gl_getcontext(physical_screen); gl_setcontextvgavirtual(DEFAULT_VGA_MODE); virtual_screen = gl_allocatecontext(); gl_getcontext(virtual_screen); gl_setcontext(virtual_screen); //vga_ext_set(VGA_EXT_SET, VGA_CLUT8); // color table: // http://en.wikipedia.org/wiki/ANSI_escape_code#Colors gl_setpalettecolor(BLUE, 0, 0, 63); // blue gl_setpalettecolor(BLACK, 0, 0, 0); // black gl_setpalettecolor(GREEN, 0, 63, 0); gl_setpalettecolor(RED, 63, 0, 0); gl_setpalettecolor(BROWN, 170/4, 85/4, 0); gl_setpalettecolor(MAGENTA, 170/4, 0, 170/4); gl_setpalettecolor(CYAN, 0, 170/4, 170/4); gl_setpalettecolor(GRAY, 48, 48, 48); gl_setpalettecolor(LIGHTBLACK, 85/4, 85/4, 85/4); gl_setpalettecolor(LIGHTBLUE, 85/4, 85/4, 255/4); gl_setpalettecolor(LIGHTGREEN, 85/4, 255/4, 85/4); gl_setpalettecolor(LIGHTCYAN, 85/4, 255/4, 255/4); gl_setpalettecolor(LIGHTRED, 25/45/4, 85/4, 85/4); gl_setpalettecolor(LIGHTMAGENTA, 255/4, 85/4, 255/4); gl_setpalettecolor(LIGHTBROWN, 255/4, 255/4, 85/4); #endif active_console = 1; return true; }
int bitmap_play(char * filename) { char ch; if (fb_init()) { printf ("Unable to init framebuffer device\n"); return 2; } fb_pixel * bmp_buffer; if ((bmp_buffer = bitmap_load(filename)) == NULL) { fb_uninit(); printf ("Error while reading bitmap\n"); return 1; } fb_clear_screen(screen); bitmap_render(bmp_buffer); init_keyboard(); ch=0; while (1) { if (!kbhit()) { ch = readch(); if (ch == KEY_ESC) break; if (ch == KEY_UP && position_y >= JUMP_SIZE) position_y-=JUMP_SIZE; if (ch == KEY_DOWN && fb_yres <= (bmp_info.bi_height-position_y-JUMP_SIZE)) position_y+=JUMP_SIZE; if (ch == KEY_LEFT && position_x >= JUMP_SIZE) position_x-=JUMP_SIZE; if (ch == KEY_RIGHT && fb_xres <= (bmp_info.bi_width-position_x-JUMP_SIZE)) position_x+=JUMP_SIZE; ch = 0; bitmap_render(bmp_buffer); } } close_keyboard(); fflush(stdin); fb_clear_screen(screen); bitmap_free(bmp_buffer); fb_uninit(); return 0; }
int __init init_module(void) { int err; /* Initialisation du timer */ if (TIMER_PERIODIC) err = rt_timer_set_mode(MS); else err = rt_timer_set_mode(TM_ONESHOT); if (err != 0) { printk("rt-app: %s: Error timer: %d\n", __func__, err); return -1; } /* Initialize FB */ fb_init(); printk("rt-app: Framebuffer initialized\n"); xeno_ts_init(); printk("rt-app: Touchscreen initialized\n"); /* Open Philips controller err = pca9554_open(NULL, NULL); if (err != 0) { printk("rt-app: %s: I2C slave open error: %d\n", __func__, err); goto fail_open; }*/ /* Initializing IRQ */ err = rt_intr_create(&isrDesc, "IMX_I2C", INT_I2C, imx_i2c_handler, NULL, 0); if (err != 0) { printk("rt-app: %s: Error interrupt registration: %d\n", __func__, err); goto fail_intr; } printk("rt-app: ISR initialized\n"); /* To Be Completed */ return space_invader(); //fail_open: // pca9554_close(NULL, NULL); fail_intr: xeno_ts_exit(); return -1; }
static TAPTR fb_modopen(WINDISPLAY *mod, TTAGITEM *tags) { struct TExecBase *TExecBase = TGetExecBase(mod); TBOOL success = TFALSE; TLock(mod->fbd_Lock); if (mod->fbd_RefCount == 0) success = fb_init(mod, tags); if (success) mod->fbd_RefCount++; TUnlock(mod->fbd_Lock); if (success) return mod; return TNULL; }
static int console_ioctl(struct inode* inode, int req, void* arg) { if(unlikely(!inode || !inode->userdata)) { errno = EINVAL; return -1; } context_t* cx = (context_t*) inode->userdata; switch(req) { case KDGETLED: case KDSETLED: case KDGKBLED: case KDSKBLED: errno = ENOSYS; return -1; case KDGKBTYPE: return 0x02; /* KB_101 */ case KDADDIO: case KDDELIO: case KDENABIO: errno = ENOSYS; return -1; case KDSETMODE: switch((int) arg) { case KD_TEXT: errno = ENOSYS; return -1; case KD_GRAPHICS: if(fb_init(cx) != 0) return -1; cx->vmode = KD_GRAPHICS; return 0; default: errno = EINVAL; return -1; } case KDGETMODE: return cx->vmode; case KDMKTONE: case KIOCSOUND: errno = ENOSYS; return -1; } errno = EINVAL; return -1; }
/** * Initialises the emulator * * @param emu Reference to the emulator structure */ void emulator_init(emulator_t* emu) { cpu_init(&emu->cpu, emu); vfp_init(&emu->vfp, emu); memory_init(&emu->memory, emu); gpio_init(&emu->gpio, emu); mbox_init(&emu->mbox, emu); fb_init(&emu->fb, emu); pr_init(&emu->pr, emu); nes_init(&emu->nes, emu); emu->terminated = 0; emu->system_timer_base = emulator_get_time() * 1000; emu->last_refresh = 0; }