xref: /haiku/src/add-ons/accelerants/neomagic/engine/nm_support.c (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /* Some commmon support functions */
2 /* Mark Watson 2/2000;
3  * Rudolf Cornelissen 1/2004 */
4 
5 #define MODULE_BIT 0x00000800
6 
7 #include <stdarg.h>
8 #include "nm_std.h"
9 
10 /*delays in multiple of microseconds*/
11 void delay(bigtime_t i)
12 {
13 	bigtime_t start=system_time();
14 	while(system_time()-start<i);
15 }
16 
17 /*debug logging*/
18 void nm_log(char *fmt, ...)
19 {
20 	char     buffer[1024];
21 	char     fname[64];
22 	FILE    *myhand;
23 	va_list  args;
24 
25 	sprintf (fname, "/boot/home/" DRIVER_PREFIX ".accelerant.%d.log", accelerantIsClone);
26 	myhand=fopen(fname,"a+");
27 
28 	if (myhand == NULL) return;
29 
30 	va_start(args,fmt);
31 	vsprintf (buffer, fmt, args);
32 	va_end(args);
33 	fprintf(myhand, "%s", buffer);
34 	fclose(myhand);
35 }
36