Line 523... |
Line 523... |
@param[in] len The number of bytes to read.
|
@param[in] len The number of bytes to read.
|
|
|
@return Number of bytes read, or zero if error. */
|
@return Number of bytes read, or zero if error. */
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
int
|
int
|
or1ksim_read_mem (unsigned int addr,
|
or1ksim_read_mem (unsigned long int addr,
|
unsigned char *buf,
|
unsigned char *buf,
|
int len)
|
int len)
|
{
|
{
|
int off; /* Offset into the memory */
|
int off; /* Offset into the memory */
|
|
|
Line 560... |
Line 560... |
@param[in] len The number of bytes to write.
|
@param[in] len The number of bytes to write.
|
|
|
@return Number of bytes written, or zero if error. */
|
@return Number of bytes written, or zero if error. */
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
int
|
int
|
or1ksim_write_mem (unsigned int addr,
|
or1ksim_write_mem (unsigned long int addr,
|
unsigned char *buf,
|
unsigned char *buf,
|
int len)
|
int len)
|
{
|
{
|
int off; /* Offset into the memory */
|
int off; /* Offset into the memory */
|
|
|
Line 597... |
Line 597... |
|
|
@return Non-zero (TRUE) on success, zero (FALSE) otherwise. */
|
@return Non-zero (TRUE) on success, zero (FALSE) otherwise. */
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
int
|
int
|
or1ksim_read_spr (int sprnum,
|
or1ksim_read_spr (int sprnum,
|
unsigned int *sprval_ptr)
|
unsigned long int *sprval_ptr)
|
{
|
{
|
/* SPR numbers are up to 16 bits long */
|
/* SPR numbers are up to 16 bits long */
|
if ((unsigned int) sprnum <= 0xffff)
|
if ((unsigned int) sprnum <= 0xffff)
|
{
|
{
|
*sprval_ptr = (unsigned int) mfspr ((uint16_t) sprnum);
|
*sprval_ptr = (unsigned int) mfspr ((uint16_t) sprnum);
|
Line 622... |
Line 622... |
|
|
@return Non-zero (TRUE) on success, zero (FALSE) otherwise. */
|
@return Non-zero (TRUE) on success, zero (FALSE) otherwise. */
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
int
|
int
|
or1ksim_write_spr (int sprnum,
|
or1ksim_write_spr (int sprnum,
|
unsigned int sprval)
|
unsigned long int sprval)
|
{
|
{
|
/* SPR numbers are up to 16 bits long */
|
/* SPR numbers are up to 16 bits long */
|
if ((unsigned int) sprnum <= 0xffff)
|
if ((unsigned int) sprnum <= 0xffff)
|
{
|
{
|
mtspr ((uint16_t) sprnum, sprval);
|
mtspr ((uint16_t) sprnum, sprval);
|
Line 652... |
Line 652... |
|
|
@return Non-zero (TRUE) on success, zero (FALSE) otherwise. */
|
@return Non-zero (TRUE) on success, zero (FALSE) otherwise. */
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
int
|
int
|
or1ksim_read_reg (int regnum,
|
or1ksim_read_reg (int regnum,
|
unsigned int *regval_ptr)
|
unsigned long int *regval_ptr)
|
{
|
{
|
/* GPR's */
|
/* GPR's */
|
if (regnum < MAX_GPRS)
|
if (regnum < MAX_GPRS)
|
{
|
{
|
return or1ksim_read_spr (regnum + SPR_GPR_BASE, regval_ptr);
|
return or1ksim_read_spr (regnum + SPR_GPR_BASE, regval_ptr);
|
Line 688... |
Line 688... |
|
|
@return Non-zero (TRUE) on success, zero (FALSE) otherwise. */
|
@return Non-zero (TRUE) on success, zero (FALSE) otherwise. */
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
int
|
int
|
or1ksim_write_reg (int regnum,
|
or1ksim_write_reg (int regnum,
|
unsigned int regval)
|
unsigned long int regval)
|
{
|
{
|
/* GPR's */
|
/* GPR's */
|
if (regnum < MAX_GPRS)
|
if (regnum < MAX_GPRS)
|
{
|
{
|
return or1ksim_write_spr (regnum + SPR_GPR_BASE, regval);
|
return or1ksim_write_spr (regnum + SPR_GPR_BASE, regval);
|