コード例 #1
0
ファイル: main.c プロジェクト: walafc0/soclib
void load()
{
    int image = 0;

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

    while(image < NIMAGES) 
    {
        while ( buf_in_empty == FALSE ) {}	// synchro
        
        tty_printf("\n *** Starting load for image %d *** at cycle %d \n", image, proctime());
        if( ioc_read(image*NBLOCKS, buf_in, NBLOCKS) )
        {
            tty_printf("echec ioc_read \n");
            exit();
        }
        if ( ioc_completed() )
        {
            tty_printf("echec ioc_completed\n");
            exit();
        }

        buf_in_empty = FALSE;

        tty_printf(" *** Completing load for image %d *** at cycle %d \n", image, proctime());
        image++;
    } // end while image      
    exit();
} // end load()
コード例 #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
コード例 #3
0
ファイル: main_display.c プロジェクト: Masshat/Mp-Soc
__attribute__((constructor)) void main_display()
{
    char            buf[128*128];
    int             x;
    int             base = 0;
    char	    byte;

    while(base < 20*NBLOCS) 
    {
        tty_printf("\n *** starting image %d *** at date = %d \n", base/NBLOCS, proctime());

        /* Phase 1 : lecture image sur le disque */
        x = ioc_read(base, buf, NBLOCS);
        if( x )
        {
                tty_printf("echec ioc_read = %d\n", x);
                exit();
        }
        x = ioc_completed();
        if( x )
        {
                tty_printf("echec ioc_completed = %d\n", x);
                exit();
        }
        
        tty_printf("\n *** completing load  at date = %d \n", proctime());

	/* Phase 2 : affichage image */
        x = fb_sync_write(0, buf, 128*128);
        if( x )
        {
                tty_printf("echec fb_sync_write\n");
                exit();
        }
        base = base + NBLOCS;
        
         tty_printf("\n *** completing display at date = %d\n\n ... new image ?\n", proctime());
        // tty_getc_irq(&byte);
    }
    exit();
}