summaryrefslogtreecommitdiff
path: root/public.h
diff options
context:
space:
mode:
Diffstat (limited to 'public.h')
-rw-r--r--public.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/public.h b/public.h
new file mode 100644
index 0000000..a84b6f6
--- /dev/null
+++ b/public.h
@@ -0,0 +1,85 @@
+/*
+ Nios-sim - one simple NIOSII simulator only for personal interest and fun.
+ Copyright (C) 2010 chysun2000@gmail.com
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#ifndef __PUBLIC_H__
+#define __PUBLIC_H__
+
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "niosii.h"
+
+#define SIM_FALSE (0)
+#define SIM_TRUE (1)
+
+typedef enum {
+ INVALID_FMT=0x00,
+ SREC_FMT=0x01
+}IMG_FORMAT;
+
+struct image_info{
+ char * path_name;
+ IMG_FORMAT image_format;
+ uint32_t mem_size;
+ uint32_t * mem_base;
+ uint32_t entry_addr;
+ uint32_t base_addr;
+};
+
+struct symbol_obj;
+
+struct symbol_obj{
+ char * sym_name;
+ uint32_t addr;
+ struct symbol_obj * next;
+};
+
+extern void load_image(void);
+extern void alloc_image_mem(void);
+extern void set_image_pathname(char * pathname);
+extern void set_image_format(IMG_FORMAT format);
+extern void set_image_memsize(char * size);
+extern void set_image_entry_addr(uint32_t addr);
+extern void set_image_base_addr(char * addr);
+extern void set_cmdline(char * optarg);
+extern void set_initrd(char * optarg);
+extern void set_fs_image(char * optarg);
+extern void init_cmdline(struct NIOS_CPU * cpu);
+extern void init_initrd(struct NIOS_CPU * cpu);
+extern void init_fs_image(struct NIOS_CPU * cpu);
+extern void print_image_info(void);
+extern void simulating(void);
+extern struct image_info * get_image_info(void);
+extern void set_debug_mode(struct NIOS_CPU * cpu);
+extern void load_symbol_file(char * symbol_file);
+extern struct symbol_obj * get_symbol(uint32_t addr);
+
+#define SIM_MODE (0)
+#define DEBUG_MODE (1)
+#define EXIT_MODE (2)
+extern int32_t get_run_mode(void);
+
+#endif /*__PUBLIC_H__*/
+
+