File: booter.h

package info (click to toggle)
mol 0.9.61-6
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 6,140 kB
  • ctags: 8,491
  • sloc: ansic: 50,560; asm: 2,826; sh: 458; makefile: 373; perl: 165; lex: 135; yacc: 131
file content (75 lines) | stat: -rw-r--r-- 2,271 bytes parent folder | download
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
/* 
 *   Creation Date: <1999/10/31 18:16:04 samuel>
 *   Time-stamp: <2001/06/16 19:08:00 samuel>
 *   
 *	<booter.h>
 *	
 *	World interface to NewWorld booting replacement
 *   
 *   Copyright (C) 1999, 2000, 2001 Samuel Rydh (samuel@ibrium.se)
 *   
 *   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
 *   
 */

#ifndef _H_BOOTER
#define _H_BOOTER

extern void 	booter_init( void );
extern void 	booter_cleanup( void );
extern void 	booter_startup( void );

extern void 	newworld_booter_init( void );
extern void 	bootx_init( void );
extern void 	oldworld_booter_init( void );
extern void 	elf_booter_init( void );

typedef struct {
	// Booter
	void	(*booter_startup)( void );
	void	(*booter_cleanup)( void );
	
	// Mouse/keyboard interface
	void	(*adb_key_event)( unsigned char key );
	void	(*zap_keyboard)( void );
	void	(*mouse_event)( int dx, int dy, int buttons );

	// Config
	char	*nvram_image_name;
	char	*oftree_filename;
} platform_expert_ops_t;

enum { 
	/* mouse_event buttons */
	/* WARNING: hardcoded in console.c and xvideo.c */
	kButton1=1, kButton2=2, kButton3=4, kButtonMask = 7
};


extern platform_expert_ops_t gPE;

// Useful inlines

static inline void PE_adb_key_event( unsigned char key )
	{ if( gPE.adb_key_event ) gPE.adb_key_event(key); }
static inline void PE_zap_keyboard( void )
	{ if( gPE.zap_keyboard ) gPE.zap_keyboard(); }
static inline void PE_mouse_event( int dx, int dy, int buttons ) 
	{ if( gPE.mouse_event ) gPE.mouse_event(dx,dy,buttons); }


// Boot method queries

extern int _boot_method_globals_inited;
extern int _boot_is_newworld, _boot_is_oldworld, _boot_is_bootx, _boot_is_elf;
extern void _init_boot_method_globals( void );
#define INIT_GLOBALS if( !_boot_method_globals_inited ) _init_boot_method_globals()
static inline int is_newworld_boot( void ) { INIT_GLOBALS; return _boot_is_newworld; };
static inline int is_oldworld_boot( void ) { INIT_GLOBALS; return _boot_is_oldworld; }
static inline int is_bootx_boot( void ) { INIT_GLOBALS; return _boot_is_bootx; }
static inline int is_elf_boot( void ) { INIT_GLOBALS; return _boot_is_elf; }
#undef INIT_GLOBALS

#endif   /* _H_BOOTER */