1 | #ifndef _EXTRALIB_H
|
---|
2 | #define _EXTRALIB_H
|
---|
3 |
|
---|
4 | /* Extra system library definitions to support device drivers and servers.
|
---|
5 | *
|
---|
6 | * Created:
|
---|
7 | * Mar 15, 2004 by Jorrit N. Herder
|
---|
8 | *
|
---|
9 | * Changes:
|
---|
10 | * May 31, 2005: added printf, kputc (relocated from syslib)
|
---|
11 | * May 31, 2005: added getuptime
|
---|
12 | * Mar 18, 2005: added tickdelay
|
---|
13 | * Oct 01, 2004: added env_parse, env_prefix, env_panic
|
---|
14 | * Jul 13, 2004: added fkey_ctl
|
---|
15 | * Apr 28, 2004: added report, panic
|
---|
16 | * Mar 31, 2004: setup like other libraries, such as syslib
|
---|
17 | */
|
---|
18 |
|
---|
19 | /*==========================================================================*
|
---|
20 | * Miscellaneous helper functions.
|
---|
21 | *==========================================================================*/
|
---|
22 |
|
---|
23 | /* Environment parsing return values. */
|
---|
24 | #define EP_BUF_SIZE 128 /* local buffer for env value */
|
---|
25 | #define EP_UNSET 0 /* variable not set */
|
---|
26 | #define EP_OFF 1 /* var = off */
|
---|
27 | #define EP_ON 2 /* var = on (or field left blank) */
|
---|
28 | #define EP_SET 3 /* var = 1:2:3 (nonblank field) */
|
---|
29 | #define EP_EGETKENV 4 /* sys_getkenv() failed ... */
|
---|
30 |
|
---|
31 | _PROTOTYPE( void env_setargs, (int argc, char *argv[]) );
|
---|
32 | _PROTOTYPE( int env_get_param, (char *key, char *value, int max_size) );
|
---|
33 | _PROTOTYPE( int env_prefix, (char *env, char *prefix) );
|
---|
34 | _PROTOTYPE( void env_panic, (char *key) );
|
---|
35 | _PROTOTYPE( int env_parse, (char *env, char *fmt, int field, long *param,
|
---|
36 | long min, long max) );
|
---|
37 |
|
---|
38 | #define fkey_map(fkeys, sfkeys) fkey_ctl(FKEY_MAP, (fkeys), (sfkeys))
|
---|
39 | #define fkey_unmap(fkeys, sfkeys) fkey_ctl(FKEY_UNMAP, (fkeys), (sfkeys))
|
---|
40 | #define fkey_events(fkeys, sfkeys) fkey_ctl(FKEY_EVENTS, (fkeys), (sfkeys))
|
---|
41 | _PROTOTYPE( int fkey_ctl, (int req, int *fkeys, int *sfkeys) );
|
---|
42 |
|
---|
43 | _PROTOTYPE( int printf, (const char *fmt, ...));
|
---|
44 | _PROTOTYPE( void kputc, (int c));
|
---|
45 | _PROTOTYPE( void report, (char *who, char *mess, int num));
|
---|
46 | _PROTOTYPE( void panic, (char *who, char *mess, int num));
|
---|
47 | _PROTOTYPE( int getuptime, (clock_t *ticks));
|
---|
48 | _PROTOTYPE( int tickdelay, (clock_t ticks));
|
---|
49 |
|
---|
50 | #endif /* _EXTRALIB_H */
|
---|
51 |
|
---|