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
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()
__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(); }
void display(int image) { // int image = 0; // while(image < NMAX) { while( buf_out_empty == TRUE ) {} // synchro tty_printf("\n *** starting display for image %d at cycle %d\n", image, proctime()); if ( fb_sync_write(0, buf_out, NLINES*NPIXELS) ) { tty_printf("echec fb_sync_write\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
__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
void transpose() { int l,p; int image = 0; tty_printf(" !!! Processor %d running !!!\n", procid()); while( image < NIMAGES ) { while( (buf_in_empty == TRUE) || (buf_out_empty == FALSE) ) {} // synchro tty_printf("\n *** Starting transpose for image %d *** at cycle %d \n", image, proctime()); for( l=0 ; l<NLINES ; l++) { for( p=0 ; p<NPIXELS ; p++) { buf_out[l][p] = buf_in[p][l]; } } buf_in_empty = TRUE; buf_out_empty = FALSE; tty_printf(" *** Completing transpose for image %d *** at cycle %d \n", image, proctime()); image++; } // end while image exit(); } // end transpose
void transpose(int image) { int dx,dy,g; int l,p; // int image = 0; // while( image < NMAX ) { while( (buf_in_empty == TRUE) || (buf_out_empty == FALSE) ) {} // synchro tty_printf("\n *** Starting transpose for image %d *** at cycle %d \n", image, proctime()); for( l=0 ; l<NLINES ; l++) { for( p=0 ; p<NPIXELS ; p++) { /* if ( (l==NLINES-1) || (l==0) || (p==NPIXELS-1) || (p==0) ) { buf_out[l][p] = 0; } else { // derivee en x dx = (int)buf_in[l-1][p-1] + (int)buf_in[l][p-1]*2 + (int)buf_in[l+1][p-1] - (int)buf_in[l-1][p+1] - (int)buf_in[l][p+1]*2 - (int)buf_in[l+1][p+1]; dy = (int)buf_in[l-1][p-1] + (int)buf_in[l-1][p]*2 + (int)buf_in[l-1][p+1] - (int)buf_in[l+1][p-1] - (int)buf_in[l+1][p]*2 - (int)buf_in[l+1][p+1]; if ( dy < 0 ) dy = -dy; g = dx + dy; if ( g > 255 ) g = 255; buf_out[l][p] = g; } */ buf_out[l][p] = buf_out[p][l]; } // end for p } // end for l buf_in_empty = TRUE; buf_out_empty = FALSE; tty_printf(" *** Completing transpose for image %d *** at cycle %d \n", image, proctime()); // image++; } // end while image // exit(); } // end transpose