aboutsummaryrefslogtreecommitdiff
path: root/src/survive_driverman.h
blob: fb385da22299917436606f5b45d1302d41252c4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef SURVIVE_DRIVERMAN_H
#define SURVIVE_DRIVERMAN_H

//Driver registration
#define MAX_DRIVERS 32

void   RegisterDriver( const char * name, void * data );
void * GetDriver( const char * name );
const char * GetDriverNameMatching( const char * prefix, int place );
void   ListDrivers();

#define REGISTER_LINKTIME( func ) \
	void __attribute__((constructor)) Register##func() { RegisterDriver( #func, &func ); }

struct SurviveContext;

typedef int (*DeviceDriver)( struct SurviveContext * ctx );
typedef int (*DeviceDriverCb)( struct SurviveContext * ctx, void * driver );
typedef int (*DeviceDriverMagicCb)( struct SurviveContext * ctx, void * driver, int magic_code, void * data, int datalen );

#endif