Exemplo n.º 1
0
size_t write (int d, const void *buf, size_t nbytes)
{
//  void *dl_handle;
  int (*o_write) (int d, const void *buf, size_t nbytes);
  
  o_write = dlsym(RTLD_NEXT, "write");
  printf("write called.\n");
  return (o_write(d, buf, nbytes));
}
Exemplo n.º 2
0
/* write header for relocatable output format */
int h_write(FILE *fp, int tbase, int tlen, int dbase, int dlen, 
				int bbase, int blen, int zbase, int zlen) {

	fputc(1, fp);			/* version byte */
	fputc(0, fp);			/* hi address 0 -> no C64 */
	fputc("o", fp);
	fputc("6", fp);
	fputc("5", fp);			
	fputc(0, fp);			/* format version */
	fputw(mode, fp);		/* file mode */
	fputw(tbase,fp);		/* text base */
	fputw(tlen,fp);			/* text length */
	fputw(dbase,fp);		/* data base */
	fputw(dlen,fp);			/* data length */
	fputw(bbase,fp);		/* bss base */
	fputw(blen,fp);			/* bss length */
	fputw(zbase,fp);		/* zerop base */
	fputw(zlen,fp);			/* zerop length */

	o_write(fp);

	return 0;
}
Exemplo n.º 3
0
int main( void )
{
	 puts("starting MAIN execution\n");
	 //unsigned char data[16] = {12, 15, 20, 210, 124, 16, 54, 156, 134, 21, 7, 15, 46, 97, 84, 161}; 

    unsigned short tmp;

	 unsigned char max, min;
	 unsigned short beta;
	 unsigned int data_pack, min_max_pack;
	 unsigned int beta_mini;
	 unsigned char mini, maxi;
	 int i;
	 unsigned int start_c, stop_c;
	 
	 unsigned int col_nb, row_nb, pixel_nb;
	 unsigned int A_row_ix, A_col_ix, B_row_ix, B_col_ix, row, col; 
	 volatile unsigned int dump;
	 A_row_ix = 25;
	 A_col_ix = 50;
	 B_row_ix = 75;
	 B_col_ix = 100;
	 
	 // on récupère le nombre de colonnes dans l'image
	 col_nb = i_read();
	 my_printf("nbre de colonnes dans l'image: ", col_nb);
	 
	 // on récupère le nombre de lignes dans l'image
	 row_nb = i_read();
	 my_printf("nbre de lignes dans l'image: ", row_nb);
	 
	 pixel_nb=col_nb*row_nb;
	 my_printf("nbre de pixel dans l'image: ", pixel_nb);

	 if(pixel_nb > 32768){
		  puts("WARNING :image trop volumineuse, taille max = 32768 octets");		  
	 }
	 
	 
#ifdef CROP
 row=col=i=0;
 
 while( i_empty() == 0 )//tant que la FIFO d'entrée n'est pas vide
  {	 
	 //if the pixel is in the zoom area, we store it
	 if(row < B_row_ix && row > A_row_ix && col < B_col_ix && col > A_col_ix){
		R[i] = i_read();
		G[i] = i_read();
		B[i] = i_read(); 
	   i++;
	 }
	 // otherwise, we dump 
	 else{
		dump = i_read();
		dump = i_read();
		dump = i_read();
	 }
	 col++;
	 if(col >= col_nb){
		col = 0;
		row++;
	 }
  }  
puts("Lecture de la FIFO d'entrée terminée\n");

  col_nb = B_col_ix-A_col_ix;
  my_printf("col_nb cropped: ", col_nb);
  row_nb = B_row_ix-A_row_ix;
  my_printf("row_nb cropped: ", row_nb);
  pixel_nb = row_nb*col_nb;
  my_printf("pixel_nb cropped: ", pixel_nb);
  
  o_write( col_nb);
  o_write( row_nb);
  o_write( 255 );
  for(i=0;i<pixel_nb;i++){ // pour chaque échantillon 
	 o_write( R[i] );
	 o_write( G[i] );
	 o_write( B[i] );
	 //my_printf("dataout", data[i]);
  } 
puts("Ecriture des resultats dans la FIFO de sortie\n");
#endif


  
#ifdef RED
  o_write( col_nb);
  o_write( row_nb);
  o_write( 255 );
  for(i=0;i<pixel_nb;i++){ // pour chaque échantillon 
	 o_write( i_read() );
	 o_write( 0 );
	 o_write( 0 );
	 dump = i_read();
	 dump = i_read();
	 //my_printf("dataout", data[i]);
  } 
  /*while( i_empty() == 0 )//tant que la FIFO d'entrée n'est pas vide
  {	 
	 o_write( i_read());
  }*/  
  
#endif

#ifdef DEBUG
  // Affichage des valeurs de sortie sur la sortie standard
	for(i=0;i<pixel_nb;i++){
		my_printf(" scaled val=> ", data[i]);
	}
#endif

  // arrêt du programme
  puts("Fin du programme\n");
  stop();
}