OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [peripheral/] [mc.c] - Diff between revs 261 and 344

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

Rev 261 Rev 344
Line 41... Line 41...
/* Set a specific MC register with value. */
/* Set a specific MC register with value. */
void mc_write_word(unsigned long addr, unsigned long value)
void mc_write_word(unsigned long addr, unsigned long value)
{
{
        int chipsel;
        int chipsel;
 
 
        debug("mc_write_word(%x,%08x)\n", addr, (unsigned)value);
        debug(5, "mc_write_word(%x,%08x)\n", addr, (unsigned)value);
 
 
  addr -= config.mc.baseaddr;
  addr -= config.mc.baseaddr;
 
 
        switch (addr) {
        switch (addr) {
          case MC_CSR:
          case MC_CSR:
Line 66... Line 66...
                      mc.csc[addr >> 3] = value;
                      mc.csc[addr >> 3] = value;
 
 
                    set_csc_tms (addr >> 3, mc.csc[addr >> 3], mc.tms[addr >> 3]);
                    set_csc_tms (addr >> 3, mc.csc[addr >> 3], mc.tms[addr >> 3]);
                    break;
                    break;
                  } else
                  } else
                        debug("write out of range (addr %x)\n", addr + config.mc.baseaddr);
                        debug(1, "write out of range (addr %x)\n", addr + config.mc.baseaddr);
        }
        }
}
}
 
 
/* Read a specific MC register. */
/* Read a specific MC register. */
unsigned long mc_read_word(unsigned long addr)
unsigned long mc_read_word(unsigned long addr)
{
{
        unsigned char value = 0;
        unsigned char value = 0;
        int chipsel;
        int chipsel;
 
 
        debug("mc_read_word(%x)\n", addr);
        debug(5, "mc_read_word(%x)\n", addr);
 
 
  addr -= config.mc.baseaddr;
  addr -= config.mc.baseaddr;
 
 
        switch (addr) {
        switch (addr) {
          case MC_CSR:
          case MC_CSR:
Line 98... Line 98...
                    if ((addr >> 2) & 1)
                    if ((addr >> 2) & 1)
                      value = mc.tms[addr >> 3];
                      value = mc.tms[addr >> 3];
                    else
                    else
                      value = mc.csc[addr >> 3];
                      value = mc.csc[addr >> 3];
                  } else
                  } else
                        debug("read out of range (addr %x)\n", addr + config.mc.baseaddr);
                        debug(1, "read out of range (addr %x)\n", addr + config.mc.baseaddr);
            break;
            break;
        }
        }
        return value;
        return value;
}
}
 
 

powered by: WebSVN 2.1.0

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