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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [common/] [common.c] - Diff between revs 464 and 467

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

Rev 464 Rev 467
Line 2... Line 2...
#include "uart.h"
#include "uart.h"
#include "screen.h"
#include "screen.h"
#include "support.h"
#include "support.h"
#include "keyboard.h"
#include "keyboard.h"
#include "spr-defs.h"
#include "spr-defs.h"
#include "spincursor.h"
 
#include "int.h"
#include "int.h"
 
 
#include "build.h"
#include "build.h"
 
 
#define MAX_COMMANDS  100
#define MAX_COMMANDS  100
 
 
// Value from linker script
 
extern unsigned long _src_addr;
 
 
 
bd_t bd;
bd_t bd;
 
 
int num_commands = 0;
int num_commands = 0;
 
 
command_struct command[MAX_COMMANDS];
command_struct command[MAX_COMMANDS];
Line 57... Line 53...
        case CT_UART:
        case CT_UART:
                return uart_getc();
                return uart_getc();
                break;
                break;
        case CT_NONE:           /* just to satisfy the compiler */
        case CT_NONE:           /* just to satisfy the compiler */
        case CT_SIM:
        case CT_SIM:
 
        default:
                break;
                break;
        }
        }
        return -1;
        return -1;
}
}
 
 
Line 78... Line 75...
        case CT_UART:
        case CT_UART:
                return uart_testc();
                return uart_testc();
                break;
                break;
        case CT_NONE:           /* just to satisfy the compiler */
        case CT_NONE:           /* just to satisfy the compiler */
        case CT_SIM:
        case CT_SIM:
 
        default:
                break;
                break;
        }
        }
        return -1;
        return -1;
}
}
 
 
Line 165... Line 163...
        case CT_UART:
        case CT_UART:
        case CT_CRT:
        case CT_CRT:
        case CT_SIM:
        case CT_SIM:
                break;
                break;
        }
        }
 
 
        bd.bi_console_type = con_type;
        bd.bi_console_type = con_type;
 
 
        /* Initialize new */
        /* Initialize new */
        switch (bd.bi_console_type) {
        switch (bd.bi_console_type) {
        case CT_NONE:
        case CT_NONE:
                break;
                break;
        case CT_UART:
        case CT_UART:
Line 293... Line 293...
                        printf("Unknown command. Type 'help' for help.\n");
                        printf("Unknown command. Type 'help' for help.\n");
        }
        }
 
 
}
}
 
 
#if HELP_ENABLED
 
extern unsigned long _src_addr; // Stack section ends here, will print it out
 
/* Displays help screen */
/* Displays help screen */
int help_cmd(int argc, char *argv[])
int help_cmd(int argc, char *argv[])
{
{
 
#if HELP_ENABLED        
        int i;
        int i;
        for (i = 0; i < num_commands; i++)
        for (i = 0; i < num_commands; i++)
                printf("%-10s %-20s - %s\n", command[i].name, command[i].params,
                printf("%-10s %-20s - %s\n", command[i].name, command[i].params,
                       command[i].help);
                       command[i].help);
 
 
Line 309... Line 309...
        printf("\n");
        printf("\n");
        printf("CPU info\n");
        printf("CPU info\n");
        printf("Frequency\t\t%dMHz\n", IN_CLK / 1000000);
        printf("Frequency\t\t%dMHz\n", IN_CLK / 1000000);
        print_or1k_cache_info();
        print_or1k_cache_info();
        printf("\n");
        printf("\n");
        printf("Info: Stack section addr 0x%x\n", (unsigned long)&_src_addr);
        printf("Info: Stack section addr 0x%x\n", (unsigned long)&_stack_top);
        printf("Build tag: %s", BUILD_VERSION);
        printf("Build tag: %s", BUILD_VERSION);
 
#endif /* HELP_ENABLED */
        return 0;
        return 0;
}
}
#endif /* HELP_ENABLED */
 
 
 
void module_cpu_init(void);
void module_cpu_init(void);
void module_memory_init(void);
void module_memory_init(void);
void module_eth_init(void);
void module_eth_init(void);
void module_dhry_init(void);
void module_dhry_init(void);
Line 333... Line 333...
/* List of all initializations */
/* List of all initializations */
void mon_init(void)
void mon_init(void)
{
{
        /* Set defaults */
        /* Set defaults */
        global.erase_method = 2;        /* as needed */
        global.erase_method = 2;        /* as needed */
        global.src_addr = (unsigned long)&_src_addr;
        global.src_addr = 0;
#ifdef FLASH_BASE_ADDR
#ifdef FLASH_BASE_ADDR
        global.dst_addr = FLASH_BASE_ADDR;
        global.dst_addr = FLASH_BASE_ADDR;
#else
#else
        global.dst_addr = 0;
        global.dst_addr = 0;
#endif
#endif
Line 399... Line 399...
#ifdef TICK_CMDS
#ifdef TICK_CMDS
#endif
#endif
 
 
}
}
 
 
int tboot_cmd(int argc, char *argv[]);
 
 
 
/* Main shell loop */
/* Main shell loop */
int main(int argc, char **argv)
int main(int argc, char **argv)
{
{
        extern unsigned long calc_mycrc32(void);
 
 
 
#if SELF_CHECK
 
        extern unsigned long mycrc32, mysize;
 
#endif
 
 
 
        timestamp = 0;           // clear timer counter
        timestamp = 0;           // clear timer counter
 
 
        int_init();
        /* Init. interface */
 
 
        change_console_type(CONSOLE_TYPE);
        change_console_type(CONSOLE_TYPE);
 
 
        mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_IEE);
        /* Init. processor interrupt handlers */
 
        int_init();
 
 
#if SELF_CHECK
        /* Enable interrupts in processor */
        printf("Self check... ");
        mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_IEE);
        if ((t = calc_mycrc32()))
 
                printf("FAILED!!!\n");
 
        else
 
                printf("OK\n");
 
#endif /* SELF_CHECK */
 
 
 
 
        /* Initialise commands we'll handle */
        num_commands = 0;
        num_commands = 0;
        mon_init();
 
 
 
        disable_spincursor();
        mon_init();
 
 
 
        /* Init processor timers */
        tick_init();
        tick_init();
 
 
        if (HELP_ENABLED)
        if (HELP_ENABLED)
                register_command("help", "", "shows this help", help_cmd);
                register_command("help", "", "shows this help", help_cmd);
 
 

powered by: WebSVN 2.1.0

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