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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [newlib-1.18.0/] [libgloss/] [mips/] [cfe_api.h] - Blame information for rev 842

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

Line No. Rev Author Line
1 207 jeremybenn
/* From: CFE Id: cfe_api.h,v 1.29 2002/07/09 23:29:11 cgd Exp $ */
2
 
3
/*
4
 * Copyright 2000, 2001, 2002
5
 * Broadcom Corporation. All rights reserved.
6
 *
7
 * This software is furnished under license and may be used and copied only
8
 * in accordance with the following terms and conditions.  Subject to these
9
 * conditions, you may download, copy, install, use, modify and distribute
10
 * modified or unmodified copies of this software in source and/or binary
11
 * form. No title or ownership is transferred hereby.
12
 *
13
 * 1) Any source code used, modified or distributed must reproduce and
14
 *    retain this copyright notice and list of conditions as they appear in
15
 *    the source file.
16
 *
17
 * 2) No right is granted to use any trade name, trademark, or logo of
18
 *    Broadcom Corporation.  The "Broadcom Corporation" name may not be
19
 *    used to endorse or promote products derived from this software
20
 *    without the prior written permission of Broadcom Corporation.
21
 *
22
 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED
23
 *    WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
24
 *    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
25
 *    NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE
26
 *    FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE
27
 *    LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28
 *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
 *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30
 *    BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31
 *    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32
 *    OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
 */
34
 
35
/*  *********************************************************************
36
    *
37
    *  Broadcom Common Firmware Environment (CFE)
38
    *
39
    *  Device function prototypes               File: cfe_api.h
40
    *
41
    *  This file contains declarations for doing callbacks to
42
    *  cfe from an application.  It should be the only header
43
    *  needed by the application to use this library
44
    *
45
    *  Authors:  Mitch Lichtenberg, Chris Demetriou
46
    *
47
    ********************************************************************* */
48
 
49
#ifndef CFE_API_H
50
#define CFE_API_H
51
 
52
/*
53
 * Apply customizations here for different OSes.  These need to:
54
 *      * typedef uint64_t, int64_t, intptr_t, uintptr_t.
55
 *      * define cfe_strlen() if use of an existing function is desired.
56
 *      * define CFE_API_IMPL_NAMESPACE if API functions are to use
57
 *        names in the implementation namespace.
58
 * Also, optionally, if the build environment does not do so automatically,
59
 * CFE_API_* can be defined here as desired.
60
 */
61
/* Begin customization. */
62
#include <sys/types.h>          /* for __uint64_t and __int64_t. */
63
#define int64_t __int64_t
64
#define uint64_t __int64_t
65
#include <_ansi.h>              /* for _POINTER_INT. */
66
typedef _POINTER_INT intptr_t;
67
typedef unsigned _POINTER_INT uintptr_t;
68
 
69
#include <string.h>
70
#define cfe_strlen(s)   strlen(s)
71
 
72
#define CFE_API_ALL
73
#define CFE_API_IMPL_NAMESPACE
74
 
75
/* Return the stack size to be used for the program.  Normally 32KB.  The
76
   normal memory allocator uses the bottom of the stack as its heap limit,
77
   so if your application uses a lot of stack space define this function
78
   appropriately to keep the heap from growing into the stack.  */
79
unsigned long __libcfe_stack_size(void) __attribute__((__weak__));
80
 
81
/* Return the (max address + 1) to be used by this program.  (This address
82
   minus '_end' is used as the heap size, so the address should be in the
83
   same address space segments as _end.  The normal memory allocator
84
   queries CFE to determine the available memory.  */
85
void *__libcfe_mem_limit(void) __attribute__((__weak__));
86
 
87
/* If the configuration ability provided by __libcfe_mem_limit() and
88
   __libcfe_stack_size() do not provide enough flexibility for your
89
   application's memory allocation needs, you can replace the normal
90
   low-level allocator by providing the functions listed below and
91
   also the function:
92
 
93
        void *sbrk(ptrdiff_t incr);
94
 
95
   If you provide any of these functions, you should provide all three,
96
   and be sure to link them into your application as a .o file (rather
97
   than a .a).
98
 
99
   __libcfe_meminit() is responsible for initializing the low-level
100
   memory allocator.
101
 
102
   __libcfe_stack_top() returns a pointer to the top (highest address;
103
   the stack grows down from that address) of the stack to be used by
104
   the program.  */
105
void __libcfe_meminit (void);
106
void *__libcfe_stack_top (void);
107
 
108
/* End customization. */
109
 
110
 
111
/*  *********************************************************************
112
    *  Constants
113
    ********************************************************************* */
114
 
115
/* Seal indicating CFE's presence, passed to user program. */
116
#define CFE_EPTSEAL 0x43464531
117
 
118
#define CFE_MI_RESERVED 0                /* memory is reserved, do not use */
119
#define CFE_MI_AVAILABLE 1              /* memory is available */
120
 
121
#define CFE_FLG_WARMSTART     0x00000001
122
#define CFE_FLG_FULL_ARENA    0x00000001
123
#define CFE_FLG_ENV_PERMANENT 0x00000001
124
 
125
#define CFE_CPU_CMD_START 1
126
#define CFE_CPU_CMD_STOP 0
127
 
128
#define CFE_STDHANDLE_CONSOLE   0
129
 
130
#define CFE_DEV_NETWORK         1
131
#define CFE_DEV_DISK            2
132
#define CFE_DEV_FLASH           3
133
#define CFE_DEV_SERIAL          4
134
#define CFE_DEV_CPU             5
135
#define CFE_DEV_NVRAM           6
136
#define CFE_DEV_CLOCK           7
137
#define CFE_DEV_OTHER           8
138
#define CFE_DEV_MASK            0x0F
139
 
140
#define CFE_CACHE_FLUSH_D       1
141
#define CFE_CACHE_INVAL_I       2
142
#define CFE_CACHE_INVAL_D       4
143
#define CFE_CACHE_INVAL_L2      8
144
 
145
#define CFE_FWI_64BIT           0x00000001
146
#define CFE_FWI_32BIT           0x00000002
147
#define CFE_FWI_RELOC           0x00000004
148
#define CFE_FWI_UNCACHED        0x00000008
149
#define CFE_FWI_MULTICPU        0x00000010
150
#define CFE_FWI_FUNCSIM         0x00000020
151
#define CFE_FWI_RTLSIM          0x00000040
152
 
153
typedef struct {
154
    int64_t fwi_version;                /* major, minor, eco version */
155
    int64_t fwi_totalmem;               /* total installed mem */
156
    int64_t fwi_flags;                  /* various flags */
157
    int64_t fwi_boardid;                /* board ID */
158
    int64_t fwi_bootarea_va;            /* VA of boot area */
159
    int64_t fwi_bootarea_pa;            /* PA of boot area */
160
    int64_t fwi_bootarea_size;          /* size of boot area */
161
} cfe_fwinfo_t;
162
 
163
 
164
/*
165
 * cfe_strlen is handled specially: If already defined, it has been
166
 * overridden in this environment with a standard strlen-like function.
167
 */
168
#ifdef cfe_strlen
169
# define CFE_API_STRLEN_CUSTOM
170
#else
171
# ifdef CFE_API_IMPL_NAMESPACE
172
#  define cfe_strlen(a)                 __cfe_strlen(a)
173
# endif
174
int cfe_strlen(char *name);
175
#endif
176
 
177
/*
178
 * Defines and prototypes for functions which take no arguments.
179
 */
180
#ifdef CFE_API_IMPL_NAMESPACE
181
int64_t __cfe_getticks(void);
182
#define cfe_getticks()                  __cfe_getticks()
183
#else
184
int64_t cfe_getticks(void);
185
#endif
186
 
187
/*
188
 * Defines and prototypes for the rest of the functions.
189
 */
190
#ifdef CFE_API_IMPL_NAMESPACE
191
#define cfe_close(a)                    __cfe_close(a)
192
#define cfe_cpu_start(a,b,c,d,e)        __cfe_cpu_start(a,b,c,d,e)
193
#define cfe_cpu_stop(a)                 __cfe_cpu_stop(a)
194
#define cfe_enumenv(a,b,d,e,f)          __cfe_enumenv(a,b,d,e,f)
195
#define cfe_enummem(a,b,c,d,e)          __cfe_enummem(a,b,c,d,e)
196
#define cfe_exit(a,b)                   __cfe_exit(a,b)
197
#define cfe_flushcache(a)               __cfe_cacheflush(a)
198
#define cfe_getdevinfo(a)               __cfe_getdevinfo(a)
199
#define cfe_getenv(a,b,c)               __cfe_getenv(a,b,c)
200
#define cfe_getfwinfo(a)                __cfe_getfwinfo(a)
201
#define cfe_getstdhandle(a)             __cfe_getstdhandle(a)
202
#define cfe_init(a,b)                   __cfe_init(a,b)
203
#define cfe_inpstat(a)                  __cfe_inpstat(a)
204
#define cfe_ioctl(a,b,c,d,e,f)          __cfe_ioctl(a,b,c,d,e,f)
205
#define cfe_open(a)                     __cfe_open(a)
206
#define cfe_read(a,b,c)                 __cfe_read(a,b,c)
207
#define cfe_readblk(a,b,c,d)            __cfe_readblk(a,b,c,d)
208
#define cfe_setenv(a,b)                 __cfe_setenv(a,b)
209
#define cfe_write(a,b,c)                __cfe_write(a,b,c)
210
#define cfe_writeblk(a,b,c,d)           __cfe_writeblk(a,b,c,d)
211
#endif /* CFE_API_IMPL_NAMESPACE */
212
 
213
int cfe_close(int handle);
214
int cfe_cpu_start(int cpu, void (*fn)(void), long sp, long gp, long a1);
215
int cfe_cpu_stop(int cpu);
216
int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen);
217
int cfe_enummem(int idx, int flags, uint64_t *start, uint64_t *length,
218
                uint64_t *type);
219
int cfe_exit(int warm,int status);
220
int cfe_flushcache(int flg);
221
int cfe_getdevinfo(char *name);
222
int cfe_getenv(char *name, char *dest, int destlen);
223
int cfe_getfwinfo(cfe_fwinfo_t *info);
224
int cfe_getstdhandle(int flg);
225
int cfe_init(uint64_t handle,uint64_t ept);
226
int cfe_inpstat(int handle);
227
int cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer,
228
              int length, int *retlen, uint64_t offset);
229
int cfe_open(char *name);
230
int cfe_read(int handle, unsigned char *buffer, int length);
231
int cfe_readblk(int handle, int64_t offset, unsigned char *buffer, int length);
232
int cfe_setenv(char *name, char *val);
233
int cfe_write(int handle, unsigned char *buffer, int length);
234
int cfe_writeblk(int handle, int64_t offset, unsigned char *buffer,
235
                 int length);
236
 
237
#endif /* CFE_API_H */

powered by: WebSVN 2.1.0

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