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

Subversion Repositories de1_olpcl2294_system

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /de1_olpcl2294_system/trunk/sw/ecos/shell
    from Rev 7 to Rev 10
    Reverse comparison

Rev 7 → Rev 10

/dbg_sh.c
9,209 → 9,15
#include <cyg/io/io.h>
#include <cyg/io/ttyio.h>
 
// #include <redboot.h>
#include "lib_dbg_sh.h"
#include "parse.h"
 
#include "shell_cmds.h"
 
CYG_HAL_TABLE_BEGIN( __RedBoot_CMD_TAB__, RedBoot_commands );
CYG_HAL_TABLE_END( __RedBoot_CMD_TAB_END__, RedBoot_commands );
extern struct cmd __RedBoot_CMD_TAB__[], __RedBoot_CMD_TAB_END__;
 
 
//--------------------------------------------------------------------------
//
//
 
#include "memtest.h"
 
extern datum memTestDataBus(volatile datum *address);
extern datum *memTestAddressBus(volatile datum *baseAddress, unsigned long nBytes);
extern datum *memTestDevice(volatile datum *baseAddress, unsigned long nBytes);
 
static void do_memtest (int argc, char *argv[]);
RedBoot_cmd ("memtest", "Test Memory", "-b <location> -l <length>", do_memtest);
 
 
static void
do_memtest (int argc, char *argv[])
{
struct option_info opts[2];
unsigned long location, length, result;
bool location_set, length_set;
 
init_opts (&opts[0], 'b', true, OPTION_ARG_TYPE_NUM,
&location, &location_set, "location");
init_opts (&opts[1], 'l', true, OPTION_ARG_TYPE_NUM,
&length, &length_set, "length");
if (!scan_opts (argc, argv, 1, opts, 2, 0, 0, "")) {
return;
}
if (!location_set) {
printf ("memtest: what location?\n");
return;
}
if (!length_set) {
printf ("memtest: what length?\n");
return;
}
result = memTestDataBus( (volatile datum *)location );
if( result == 0 ) {
printf( "memTestDataBus: passes\n" );
} else {
printf( "memTestDataBus: failed with %x\n", result );
return;
}
 
result = memTestAddressBus( (volatile datum *)location, length );
if( result == NULL ) {
printf( "memTestAddressBus: passes\n" );
} else {
printf( "memTestAddressBus: failed at address %x\n", result );
return;
}
 
result = memTestDevice( (volatile datum *)location, length );
if( result == NULL ) {
printf( "memTestDevice: passes\n" );
} else {
printf( "memTestDevice: failed at address %x\n", result );
return;
}
printf( "memtest: done\n" );
 
return;
}
 
 
//--------------------------------------------------------------------------
//
//
RedBoot_cmd("iopeek",
"Read I/O location",
"[-b <location>] [-1|2|4]",
do_iopeek
);
RedBoot_cmd("iopoke",
"Write I/O location",
"[-b <location>] [-1|2|4] -v <value>",
do_iopoke
);
 
void
do_iopoke(int argc, char *argv[])
{
struct option_info opts[5];
unsigned long base;
bool base_set, value_set;
bool set_32bit = false;
bool set_16bit = false;
bool set_8bit = false;
cyg_uint32 value;
int size = 1;
 
init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM,
&base, &base_set, "base address");
init_opts(&opts[1], 'v', true, OPTION_ARG_TYPE_NUM,
&value, &value_set, "valuex");
init_opts(&opts[2], '4', false, OPTION_ARG_TYPE_FLG,
&set_32bit, 0, "output 32 bit units");
init_opts(&opts[3], '2', false, OPTION_ARG_TYPE_FLG,
&set_16bit, 0, "output 16 bit units");
init_opts(&opts[4], '1', false, OPTION_ARG_TYPE_FLG,
&set_8bit, 0, "output 8 bit units");
if (!scan_opts(argc, argv, 1, opts, 5, 0, 0, "")) {
return;
}
if (!base_set) {
printf("iopoke what <location>?\n");
return;
}
if (!value_set) {
printf("iopoke what <value>?\n");
return;
}
if (set_32bit) {
size = 4;
} else if (set_16bit) {
size = 2;
} else if (set_8bit) {
size = 1;
}
 
switch (size) {
case 4:
HAL_WRITE_UINT32 ( base, value );
break;
case 2:
HAL_WRITE_UINT16 ( base, value );
break;
case 1:
HAL_WRITE_UINT8 ( base, value );
break;
}
}
 
void
do_iopeek(int argc, char *argv[])
{
struct option_info opts[4];
unsigned long base;
bool base_set;
bool set_32bit = false;
bool set_16bit = false;
bool set_8bit = false;
int size = 1, value;
 
init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM,
&base, &base_set, "base address");
init_opts(&opts[1], '4', false, OPTION_ARG_TYPE_FLG,
&set_32bit, 0, "output 32 bit units");
init_opts(&opts[2], '2', false, OPTION_ARG_TYPE_FLG,
&set_16bit, 0, "output 16 bit units");
init_opts(&opts[3], '1', false, OPTION_ARG_TYPE_FLG,
&set_8bit, 0, "output 8 bit units");
if (!scan_opts(argc, argv, 1, opts, 4, 0, 0, "")) {
return;
}
if (!base_set) {
printf("iopeek what <location>?\n");
return;
}
if (set_32bit) {
size = 4;
} else if (set_16bit) {
size = 2;
} else if (set_8bit) {
size = 1;
}
 
switch (size) {
case 4:
HAL_READ_UINT32 ( base, value );
printf("0x%04lx = 0x%08x\n", base, value );
break;
case 2:
HAL_READ_UINT16 ( base, value );
printf("0x%04lx = 0x%04x\n", base, value );
break;
case 1:
HAL_READ_UINT8 ( base, value );
printf("0x%04lx = 0x%02x\n", base, value );
break;
}
}
 
 
//--------------------------------------------------------------------------
//
//
RedBoot_cmd("help",
"Help about help?",
"[<topic>]",
/dbg_sh.h
3,58 → 3,6
//
 
 
// #include <pkgconf/hal.h>
// #include <cyg/hal/hal_if.h>
// #include <cyg/hal/hal_tables.h>
 
 
// // CLI support functions
// // externC bool parse_num(char *s, unsigned long *val, char **es, char *delim);
// // externC bool parse_bool(char *s, bool *val);
 
// typedef void cmd_fun(int argc, char *argv[]);
// struct cmd {
// char *str;
// char *help;
// char *usage;
// cmd_fun *fun;
// struct cmd *sub_cmds, *sub_cmds_end;
// } CYG_HAL_TABLE_TYPE;
// // externC struct cmd *cmd_search(struct cmd *tab, struct cmd *tabend, char *arg);
// // externC void cmd_usage(struct cmd *tab, struct cmd *tabend, char *prefix);
// #define RedBoot_cmd(_s_,_h_,_u_,_f_) cmd_entry(_s_,_h_,_u_,_f_,0,0,RedBoot_commands)
// #define RedBoot_nested_cmd(_s_,_h_,_u_,_f_,_subs_,_sube_) cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,RedBoot_commands)
// #define _cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_) \
// cmd_fun _f_; \
// struct cmd _cmd_tab_##_f_ CYG_HAL_TABLE_QUALIFIED_ENTRY(_n_,_f_) = {_s_, _h_, _u_, _f_, _subs_, _sube_};
// #define cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_) \
// extern _cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_)
// #define local_cmd_entry(_s_,_h_,_u_,_f_,_n_) \
// static _cmd_entry(_s_,_h_,_u_,_f_,0,0,_n_)
 
// #define CYGBLD_REDBOOT_MAX_MEM_SEGMENTS 1
// #define CYGNUM_REDBOOT_CMD_LINE_EDITING 16
 
// #define MAX_ARGV 16
 
// // Option processing support
 
// struct option_info {
// char flag;
// bool takes_arg;
// int arg_type;
// void *arg;
// bool *arg_set;
// char *name;
// };
 
// #define NUM_ELEMS(s) (sizeof(s)/sizeof(s[0]))
 
// #define OPTION_ARG_TYPE_NUM 0 // Numeric data
// #define OPTION_ARG_TYPE_STR 1 // Generic string
// #define OPTION_ARG_TYPE_FLG 2 // Flag only
 
 
//-----------------------------------------------------------------------------
// String functions. Some of these are duplicates of the same functions in
// the I18N package.
/Makefile
6,11 → 6,11
 
# INSTALL_DIR=$$(INSTALL_DIR) # override on make command line
# INSTALL_DIR = ../ROM_slow/install
INSTALL_DIR = ../LPC2294_ram/LPC2294_ram_install
INSTALL_DIR = ../LPC2294_ram/install
 
OBJECT_FILES = dbg_sh.o parse.o main.o memtest.o
LIB_OBJECT_FILES = dbg_sh.o parse.o memtest.o
HEADER_FILES = lpc22xx.h dbg_sh.h parse.h memtest.h
OBJECT_FILES = parse.o main.o mem_func.o memtest.o dbg_sh.o
LIB_OBJECT_FILES = parse.o mem_func.o memtest.o dbg_sh.o
HEADER_FILES = lpc22xx.h dbg_sh.h parse.h shell_cmds.h memtest.h
 
 
include $(INSTALL_DIR)/include/pkgconf/ecos.mak

powered by: WebSVN 2.1.0

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