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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [common/] [support.c] - Diff between revs 246 and 406

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

Rev 246 Rev 406
Line 25... Line 25...
#if 0
#if 0
  va_list args;
  va_list args;
  va_start(args, fmt);
  va_start(args, fmt);
  __asm__ __volatile__ ("  l.addi\tr3,%1,0\n \
  __asm__ __volatile__ ("  l.addi\tr3,%1,0\n \
                           l.addi\tr4,%2,0\n \
                           l.addi\tr4,%2,0\n \
                           l.nop %0": :"K" (NOP_PRINTF), "r" (fmt), "r"  (args) : "r3", "r4");
                           l.nop %0"::"K"(NOP_PRINTF), "r"(fmt), "r"(args):"r3", "r4");
#endif
#endif
}
}
 
 
/* print long */
/* print long */
void report(unsigned long value)
void report(unsigned long value)
Line 55... Line 55...
  unsigned long value;
  unsigned long value;
  asm("l.mfspr\t\t%0,%1,0" : "=r" (value) : "r" (spr));
  asm("l.mfspr\t\t%0,%1,0" : "=r" (value) : "r" (spr));
  return value;
  return value;
}
}
 
 
 
 
 
 
/* Parses hex or decimal number */
/* Parses hex or decimal number */
unsigned long strtoul (const char *str, char **endptr, int base)
unsigned long strtoul (const char *str, char **endptr, int base)
{
{
 
 
  {
  {
 
 
    unsigned long number = 0;
    unsigned long number = 0;
    char *pos = (char *) str;
    char *pos = (char *) str;
    char *fail_char = (char *) str;
    char *fail_char = (char *) str;
 
 
 
                while (isspace(*pos))
  while (isspace(*pos)) pos++;  /* skip leading whitespace */
                        pos++;  /* skip leading whitespace */
 
 
  if ((base == 16) && (*pos == '0')) { /* handle option prefix */
  if ((base == 16) && (*pos == '0')) { /* handle option prefix */
    ++pos;
    ++pos;
    fail_char = pos;
    fail_char = pos;
    if ((*pos == 'x') || (*pos == 'X')) ++pos;
                        if ((*pos == 'x') || (*pos == 'X'))
 
                                ++pos;
  }
  }
 
 
  if (base == 0) {               /* dynamic base */
  if (base == 0) {               /* dynamic base */
    base = 10;          /* default is 10 */
    base = 10;          /* default is 10 */
    if (*pos == '0') {
    if (*pos == '0') {
Line 99... Line 98...
          digit = (*pos - '0');
          digit = (*pos - '0');
      } else if (*pos >= 'a') {
      } else if (*pos >= 'a') {
          digit = (*pos - 'a' + 10);
          digit = (*pos - 'a' + 10);
      } else if (*pos >= 'A') {
      } else if (*pos >= 'A') {
          digit = (*pos - 'A' + 10);
          digit = (*pos - 'A' + 10);
      } else break;
                                } else
 
                                        break;
 
 
      if (digit >= base) break;
                                if (digit >= base)
 
                                        break;
 
 
      fail_char = ++pos;
      fail_char = ++pos;
      number = number * base + digit;
      number = number * base + digit;
    }
    }
 
 
  if (endptr) *endptr = fail_char; {
                if (endptr)
 
                        *endptr = fail_char; {
    return number;
    return number;
  }
  }
  }
  }
}
}
 
 
Line 127... Line 129...
void set_timer (unsigned long t)
void set_timer (unsigned long t)
{
{
  timestamp = t;
  timestamp = t;
}
}
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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