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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [include/] [common.h] - Blame information for rev 743

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 marcus.erl
#ifndef _COMMON_H_
2
#define _COMMON_H_
3
 
4
#include "board.h"
5
 
6
/* max number of images saved in flash */
7
#ifndef MAX_IMAGES
8
#define MAX_IMAGES 40
9
#endif
10
 
11
#ifdef  DEBUG
12
#define debug(fmt,args...) printf (fmt ,##args)
13
#else
14
#define debug(fmt,args...) __printf (fmt ,##args)
15
#endif
16
 
17 464 julius
/* Stack top */
18 467 julius
extern unsigned long _stack_top;
19 464 julius
 
20 2 marcus.erl
/* A Board Information structure that is given to a program when
21
 * ppcboot starts it up. */
22
typedef struct bd_info {
23
  enum bi_console_type_t {
24
    CT_NONE,
25
    CT_UART,
26
    CT_CRT,
27
    CT_SIM,
28
  } bi_console_type;
29
  unsigned long bi_memstart;    /* start of  DRAM memory                */
30
  unsigned long bi_memsize;     /* size  of  DRAM memory in bytes       */
31
  unsigned long bi_flashstart;  /* start of FLASH memory                */
32
  unsigned long bi_flashsize;   /* size  of FLASH memory                */
33
  unsigned long bi_flashoffset; /* reserved area for startup monitor    */
34
  unsigned long bi_sramstart;   /* start of  SRAM memory                */
35
  unsigned long bi_sramsize;    /* size  of  SRAM memory                */
36
  unsigned long bi_bootflags;   /* boot / reboot flag (for LynxOS)      */
37
  unsigned long bi_ip_addr;     /* IP Address                           */
38
  unsigned short bi_ethspeed;   /* Ethernet speed in Mbps               */
39
  unsigned long bi_intfreq;     /* Internal Freq, in MHz                */
40
  unsigned long bi_busfreq;     /* Bus Freq, in MHz                     */
41
  unsigned long bi_baudrate;    /* Console Baudrate                     */
42
} bd_t;
43
 
44
typedef struct {
45
  unsigned long src_addr;
46
  unsigned long dst_addr;
47
  unsigned long start_addr;
48
  unsigned long length;
49
  unsigned long ip;
50
  unsigned long gw_ip;
51
  unsigned long mask;
52
  unsigned long srv_ip;
53
  unsigned char eth_add[6];
54
  unsigned long erase_method; /* 0 = do not erase, 1 = fully, 2 = as needed */
55
} global_struct;
56
 
57
 
58
/* structure for command interpreter                                  */
59
typedef struct {
60
  const char *name;
61
  const char *params;
62
  const char *help;
63
  int (*func)(int argc, char *argv[]);
64
} command_struct;
65
 
66 140 julius
// Keep a CRC during TFTP receive
67
#define TFTP_CALC_CRC
68
 
69 2 marcus.erl
typedef struct  {
70
  unsigned long eth_ip;
71
  unsigned long eth_mask;
72
  unsigned long eth_gw;
73
  unsigned long tftp_srv_ip;
74
  char tftp_filename[64];
75
  unsigned long img_number;
76
  unsigned long img_start_addr[MAX_IMAGES];
77
  unsigned long img_length[MAX_IMAGES];
78
} flash_cfg_struct;
79
 
80
extern bd_t bd;
81
extern global_struct global;
82
 
83
/* stdio */
84
extern int getc (void);
85
extern int testc (void);
86
extern int ctrlc (void);
87
extern void putc (const char c);
88
extern int printf (const char *fmt, ...);
89 140 julius
extern void show_mem (int start, int stop);
90 2 marcus.erl
extern unsigned long parse_ip (char *ip);
91
 
92
/* simulator stdout */
93
extern void __printf (const char *fmt, ...);
94
 
95
/* Reports a 32bit value to the simulator */
96
extern void report(unsigned long value);
97
 
98
/* Commands stuff */
99
#if HELP_ENABLED
100
#define register_command(name,params,help,funct) register_command_func (name, params, help, funct)
101
#else /* !HELP_ENABLED */
102
#define register_command(name,params,help,funct) register_command_func (name, "", "", funct)
103
#endif /* HELP_ENABLED */
104
 
105
extern void register_command_func (const char *name, const char *params, const char *help, int (*func)(int argc, char *argv[]));
106
 
107
/* Redirects console */
108
extern void change_console_type (enum bi_console_type_t con_type);
109
 
110
/* OR1k specific */
111
/* For writing into SPR. */
112
extern void mtspr(unsigned long spr, unsigned long value);
113
 
114
/* For reading SPR. */
115
extern unsigned long mfspr(unsigned long spr);
116
 
117
 
118
#endif  /* _COMMON_H_ */
119
 

powered by: WebSVN 2.1.0

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