alsa.audio: build the bridge link lib only for linux architecture
[AROS.git] / arch / ppc-sam440 / boot / parthenope / src / context.h
blob93236fd22cde0a8ecbf7b98412376ce273f91080
1 #ifndef CONTEXT_H_
2 #define CONTEXT_H_
4 /*
5 * $Id$
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
23 #include "uboot.h"
25 /* The version of context_t we hope to got from U-Boot */
26 #define CALLBACK_VERSION 4
28 typedef struct context {
29 unsigned int c_version;
30 void (*c_printf) (const char *fmt, ...);
31 int (*c_getc) (void);
33 void *c_scan_list;
34 list_t *c_devices_list;
35 SCAN_HANDLE c_curr_device;
37 SCAN_HANDLE(*c_start_unit_scan) (const void *scan_list,
38 uint32_t * const blocksize);
39 SCAN_HANDLE(*c_next_unit_scan) (SCAN_HANDLE h,
40 unsigned int *const blocksize);
41 int (*c_open_specific_unit) (const SCAN_HANDLE h);
42 void (*c_end_unit_scan) (SCAN_HANDLE h);
43 void (*c_end_global_scan) (void);
44 int (*c_loadsector) (const unsigned int sectn,
45 const unsigned int sect_size,
46 const unsigned int numb_sects,
47 void *const dest_buf);
49 int (*c_my_netloop) (char *filename, void *dump_here);
51 char *(*c_getenv) (unsigned char *);
52 void (*c_setenv) (char *, char *);
54 void *(*c_alloc_mem_for_iobuffers) (const int size);
55 void *(*c_alloc_mem_for_kickmodule) (const int size);
56 void *(*c_alloc_mem_for_execNG) (const int size);
57 void *(*c_alloc_mem_for_anythingelse) (const int size);
58 void *(*c_alloc_mem_for_bootloader) (const int size);
59 void (*c_free_mem) (void *const loc);
61 void *(*c_get_board_info) (void);
62 int (*c_BZ2_bzBuffToBuffDecompress) (char *dest,
63 unsigned int *destLen,
64 char *source,
65 unsigned int sourceLen,
66 int small, int verbosity);
68 void (*c_video_clear) (void);
69 void (*c_video_draw_box) (int style, int attr, char *title,
70 int separate, int x, int y, int w, int h);
71 void (*c_video_draw_text) (int x, int y, int attr, char *text,
72 int field);
73 void (*c_video_repeat_char) (int x, int y, int repcnt, int repchar,
74 int attr);
76 unsigned short (*c_set_partial_scroll_limits) (const short start,
77 const short end);
78 void (*c_get_partial_scroll_limits) (short *const start,
79 short *const end);
80 int (*c_video_get_key) (void);
82 int (*c_do_bootm) (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]);
83 void *(*c_memmove) (void *dest, const void *src, int count);
84 void (*c_set_load_addr) (void *const la);
86 int (*c_tstc) (void);
87 void (*c_udelay) (unsigned long);
88 int (*c_sprintf) (char *buf, const char *fmt, ...);
90 int (*c_ext2fs_set_blk_dev_full) (block_dev_desc_t * const rbdd,
91 disk_partition_t * const p);
92 int (*c_ext2fs_open) (char *filename);
93 int (*c_ext2fs_read) (char *buf, unsigned len);
94 int (*c_ext2fs_mount) (unsigned part_length);
95 int (*c_ext2fs_close) (void);
96 int (*c_bootu) (char *device_str);
97 } context_t;
99 void context_init(context_t * ctx);
100 inline context_t *context_get(void);
102 /* terminal IO functions */
103 #define printf(FMT, ARGS...) context_get()->c_printf((FMT), ##ARGS)
104 inline int getc(void);
106 /* devices functions */
107 inline void *get_scan_list(void);
108 inline list_t *get_devices_list(void);
109 inline SCAN_HANDLE get_curr_device(void);
110 inline SCAN_HANDLE start_unit_scan(const void *scan_list,
111 uint32_t * const blocksize);
112 inline SCAN_HANDLE next_unit_scan(SCAN_HANDLE h, unsigned int *const blocksize);
113 inline int open_specific_unit(const SCAN_HANDLE h);
114 inline void end_unit_scan(SCAN_HANDLE h);
115 inline void end_global_scan(void);
116 inline int loadsector(const unsigned int sectn,
117 const unsigned int sect_size,
118 const unsigned int numb_sects, void *const dest_buf);
119 inline int netloop(char *filename, void *dump_here);
121 /* memory functions */
122 inline void *malloc(int size);
123 inline void free(void *ptr);
124 inline void *memmove(void *dest, const void *src, int count);
126 /* ENV functions */
127 inline char *getenv(unsigned char *var);
128 inline void setenv(char *var, char *value);
130 /* misc functions */
131 inline int tstc(void);
132 inline void udelay(unsigned long t);
133 #define sprintf(BUF, FMT, ARGS...) context_get()->c_sprintf((BUF), (FMT), ##ARGS)
135 /* video functions */
136 inline void video_clear(void);
137 inline void video_draw_box(int style, int attr, char *title, int separate,
138 int x, int y, int w, int h);
139 inline void video_draw_text(int x, int y, int attr, char *text, int field);
140 inline void video_repeat_char(int x, int y, int repcnt, int repchar, int attr);
141 inline unsigned short video_set_partial_scroll_limits(const short start,
142 const short end);
143 inline void video_get_partial_scroll_limits(short *const start,
144 short *const end);
145 inline int video_get_key(void);
146 inline int video_display_bitmap(unsigned long, int, int);
148 /* ext2fs functions */
149 inline int ext2fs_set_blk_dev_full(block_dev_desc_t * const rbdd,
150 disk_partition_t * const p);
151 inline int ext2fs_open(char *filename);
152 inline int ext2fs_read(char *buf, unsigned len);
153 inline int ext2fs_mount(unsigned part_length);
154 inline int ext2fs_close(void);
156 /* booting functions */
157 inline int bootm(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]);
158 inline void set_load_addr(void *const la);
159 inline int bootu(char *device);
161 #endif /*CONTEXT_H_ */