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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [orpmon/] [common/] [common.c] - Diff between revs 872 and 878

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

Rev 872 Rev 878
Line 12... Line 12...
 
 
bd_t bd;
bd_t bd;
 
 
int num_commands = 0;
int num_commands = 0;
 
 
struct command_struct {
command_struct command[MAX_COMMANDS];
  const char *name;
 
  const char *params;
 
  const char *help;
 
  int (*func)(int argc, char *argv[]);
 
} command[MAX_COMMANDS];
 
 
 
void putc (const char c)
void putc (const char c)
{
{
  debug ("putc %i, %i = %c\n", bd.bi_console_type, c, c);
  debug ("putc %i, %i = %c\n", bd.bi_console_type, c, c);
  switch (bd.bi_console_type) {
  switch (bd.bi_console_type) {
Line 195... Line 192...
      break;
      break;
  }
  }
 
 
  {
  {
    int i, found = 0;
    int i, found = 0;
 
 
    for (i = 0; i < num_commands; i++)
    for (i = 0; i < num_commands; i++)
      if (strcmp (command_str, command[i].name) == 0) {
      if (strcmp (command_str, command[i].name) == 0)
        switch (command[i].func (argc, &argv[0])) {
      {
 
        switch ( command[i].func(argc, &argv[0]) )
 
        {
        case -1:
        case -1:
          printf ("Missing/wrong parameters, usage: %s %s\n", command[i].name, command[i].params);
          printf ("Missing/wrong parameters, usage: %s %s\n", command[i].name, command[i].params);
          break;
          break;
        }
        }
        found = 1;
 
 
        found++;
        break;
        break;
      }
      }
    if (!found) printf ("Unknown command. Type 'help' for help.\n");
 
 
      if (!found)
 
        printf ("Unknown command. Type 'help' for help.\n");
  }
  }
 
 
}
}
 
 
#if HELP_ENABLED
#if HELP_ENABLED
/* Displays help screen */
/* Displays help screen */
int help_cmd (int argc, char *argv[])
int help_cmd (int argc, char *argv[])
Line 228... Line 232...
void module_dhry_init (void);
void module_dhry_init (void);
void module_camera_init (void);
void module_camera_init (void);
void module_load_init (void);
void module_load_init (void);
void tick_init(void);
void tick_init(void);
void module_touch_init (void);
void module_touch_init (void);
 
void module_ata_init (void);
 
 
/* List of all initializations */
/* List of all initializations */
void mon_init (void)
void mon_init (void)
{
{
  /* Set defaults */
  /* Set defaults */
Line 254... Line 259...
  module_eth_init ();
  module_eth_init ();
  module_dhry_init ();
  module_dhry_init ();
  module_camera_init ();
  module_camera_init ();
  module_load_init ();
  module_load_init ();
  module_touch_init ();
  module_touch_init ();
 
  module_ata_init ();
 
 
  tick_init();
  tick_init();
}
}
 
 
/* Main shell loop */
/* Main shell loop */
Line 266... Line 272...
  extern unsigned long calc_mycrc32 (void);
  extern unsigned long calc_mycrc32 (void);
  unsigned long t;
  unsigned long t;
#if 1
#if 1
  extern unsigned long mycrc32, mysize;
  extern unsigned long mycrc32, mysize;
#endif
#endif
 
 
  int_init ();
  int_init ();
  change_console_type (CONSOLE_TYPE);
  change_console_type (CONSOLE_TYPE);
  mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_IEE);
  mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_IEE);
 
 
#if SELF_CHECK
#if SELF_CHECK
  printf ("Self check... ");
  printf ("Self check... ");
  if ((t = calc_mycrc32 ())) printf ("FAILED!!!\n");
  if ((t = calc_mycrc32 ()))
  else printf ("OK\n");
      printf ("FAILED!!!\n");
 
  else
 
      printf ("OK\n");
#endif /* SELF_CHECK */
#endif /* SELF_CHECK */
 
 
  mon_init ();
  mon_init ();
 
 
  if (HELP_ENABLED) register_command ("help", "", "shows this help", help_cmd);
  if (HELP_ENABLED) register_command ("help", "", "shows this help", help_cmd);

powered by: WebSVN 2.1.0

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