示例#1
0
文件: main.c 项目: walafc0/soclib
void display()
{
    int	image = 0;

    tty_printf(" !!!  Processor %d running !!!\n", procid());

    while(image < NIMAGES)
    {
        while( buf_out_empty == TRUE ) {} // synchro

        tty_printf("\n *** starting display for image %d at cycle %d\n", image, proctime());
        if ( fb_write(0, buf_out, NLINES*NPIXELS) )
        {
                tty_printf("echec fb_sync_write\n");
                exit();
        }
        else
        {
            tty_printf("*** success fb_write ***\n");
        }

        if ( fb_completed() )
        {
            tty_printf("echec fb_completed\n");
            exit();
        }

        buf_out_empty = TRUE;

        tty_printf(" *** completing display for image %d at cycle %d\n", image, proctime());
        image++;
    } // end while image
    exit();
} // end display
示例#2
0
文件: main.c 项目: Masshat/Mp-Soc
__attribute__((constructor)) void display()
{
    char     byte;
    char     buf[NB_LINES][NB_PIXELS];
    int      base = 0;
    int      image = 0;
    int      npixels;      // number of pixels per processor      
    int      nblocks;       // number of blocks per processor



    npixels = NB_PIXELS*NB_LINES;
    nblocks = npixels/BLOCK_SIZE;

    // main loop
    while(1)
    {
        tty_printf("\n  *** image %d au cycle : %d *** \n", image, proctime());

        /* Phase 1 : lecture image sur le disque et transfert vers buf */
        if (ioc_read(base + nblocks, buf , nblocks))
        {
            tty_printf("\n!!! echec ioc_read au cycle : %d !!!\n", proctime()); 
            exit();
        }
        if ( ioc_completed() )
        {
            tty_printf("\n!!! echec ioc_completed au cycle : %d !!!\n", proctime());
            exit();
        }
        tty_printf("- image chargee au cycle = %d \n",proctime());

	tty_printf("test\n");
        /* Phase 3 : transfert de buf vers le frame buffer */
        if (fb_write(0,  buf, sizeof(buf)))
        { 
            tty_printf("\n!!! echec fb_write au cycle : %d !!!\n", proctime()); 
            exit();
        }
        fb_completed();
        tty_printf("- image affichee au cycle = %d \n",proctime());

        base  = base + nblocks;
        image = image + 1;

        tty_getc_irq(&byte);
	if (base == 640) base =0;

    } // end while

    exit();
} // end main