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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [orpmon/] [include/] [common.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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