OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [or1ksim/] [peripheral/] [generic.c] - Diff between revs 93 and 101

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 93 Rev 101
Line 126... Line 126...
 
 
      /* Set the mask, read and get the result */
      /* Set the mask, read and get the result */
      memset (mask, 0, sizeof (mask));
      memset (mask, 0, sizeof (mask));
      mask[bytenum] = 0xff;
      mask[bytenum] = 0xff;
 
 
      if (0 != config.ext.read_up (NULL, wordaddr, mask, res, 4))
      if (0 != config.ext.read_up (config.ext.class_ptr, wordaddr, mask, res,
 
                                   4))
        {
        {
          fprintf (stderr, "Warning: external byte read failed.\n");
          fprintf (stderr, "Warning: external byte read failed.\n");
          return  0;
          return  0;
        }
        }
 
 
Line 183... Line 184...
      /* Set the mask and write data do the write. */
      /* Set the mask and write data do the write. */
      memset (mask, 0, sizeof (mask));
      memset (mask, 0, sizeof (mask));
      mask[bytenum] = 0xff;
      mask[bytenum] = 0xff;
      val[bytenum]  = value;
      val[bytenum]  = value;
 
 
      if (0 != config.ext.write_up (NULL, wordaddr, mask, val, 4))
      if (0 != config.ext.write_up (config.ext.class_ptr, wordaddr, mask, val,
 
                                    4))
        {
        {
          fprintf (stderr, "Warning: external byte write failed.\n");
          fprintf (stderr, "Warning: external byte write failed.\n");
        }
        }
    }
    }
}       /* generic_write_byte() */
}       /* generic_write_byte() */
Line 247... Line 249...
      /* Set the mask, read and get the result */
      /* Set the mask, read and get the result */
      memset (mask, 0, sizeof (mask));
      memset (mask, 0, sizeof (mask));
      mask[hwnum    ] = 0xff;
      mask[hwnum    ] = 0xff;
      mask[hwnum + 1] = 0xff;
      mask[hwnum + 1] = 0xff;
 
 
      if (0 != config.ext.read_up (NULL, wordaddr, mask, res, 4))
      if (0 != config.ext.read_up (config.ext.class_ptr, wordaddr, mask, res,
 
                                   4))
        {
        {
          fprintf (stderr, "Warning: external half word read failed.\n");
          fprintf (stderr, "Warning: external half word read failed.\n");
          return  0;
          return  0;
        }
        }
 
 
Line 325... Line 328...
#else
#else
      val[hwnum + 1] = (unsigned char) (value >> 8);
      val[hwnum + 1] = (unsigned char) (value >> 8);
      val[hwnum    ] = (unsigned char) (value     );
      val[hwnum    ] = (unsigned char) (value     );
#endif
#endif
 
 
      if (0 != config.ext.write_up (NULL, wordaddr, mask, val, 4))
      if (0 != config.ext.write_up (config.ext.class_ptr, wordaddr, mask, val,
 
                                    4))
        {
        {
          fprintf (stderr, "Warning: external half word write failed.\n");
          fprintf (stderr, "Warning: external half word write failed.\n");
        }
        }
    }
    }
}       /* generic_write_hw() */
}       /* generic_write_hw() */
Line 381... Line 385...
      unsigned char      res[4];
      unsigned char      res[4];
 
 
      /* Set the mask, read and get the result */
      /* Set the mask, read and get the result */
      memset (mask, 0xff, sizeof (mask));
      memset (mask, 0xff, sizeof (mask));
 
 
      if (0 != config.ext.read_up (NULL, wordaddr, mask, res, 4))
      if (0 != config.ext.read_up (config.ext.class_ptr, wordaddr, mask, res,
 
                                   4))
        {
        {
          fprintf (stderr, "Warning: external full word read failed.\n");
          fprintf (stderr, "Warning: external full word read failed.\n");
          return  0;
          return  0;
        }
        }
 
 
Line 460... Line 465...
      val[2] = (unsigned char) (value >> 16);
      val[2] = (unsigned char) (value >> 16);
      val[1] = (unsigned char) (value >>  8);
      val[1] = (unsigned char) (value >>  8);
      val[0] = (unsigned char) (value      );
      val[0] = (unsigned char) (value      );
#endif
#endif
 
 
      if (0 != config.ext.write_up (NULL, wordaddr, mask, val, 4))
      if (0 != config.ext.write_up (config.ext.class_ptr, wordaddr, mask, val,
 
                                    4))
        {
        {
          fprintf (stderr, "Warning: external full word write failed.\n");
          fprintf (stderr, "Warning: external full word write failed.\n");
        }
        }
    }
    }
}       /* generic_write_word() */
}       /* generic_write_word() */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.