summaryrefslogtreecommitdiff
path: root/public.h
blob: a84b6f62d74aa71ddea2494c0252d825fc79a13b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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__*/