168353368SRudolf Cornelissen/* Some commmon support functions */
268353368SRudolf Cornelissen/* Mark Watson 2/2000;
368353368SRudolf Cornelissen * Rudolf Cornelissen 1/2004 */
468353368SRudolf Cornelissen
568353368SRudolf Cornelissen#define MODULE_BIT 0x00000800
668353368SRudolf Cornelissen
768353368SRudolf Cornelissen#include <stdarg.h>
8886dbf81SRudolf Cornelissen#include "std.h"
968353368SRudolf Cornelissen
1068353368SRudolf Cornelissen/*delays in multiple of microseconds*/
1168353368SRudolf Cornelissenvoid delay(bigtime_t i)
1268353368SRudolf Cornelissen{
1368353368SRudolf Cornelissen	bigtime_t start=system_time();
1468353368SRudolf Cornelissen	while(system_time()-start<i);
1568353368SRudolf Cornelissen}
1668353368SRudolf Cornelissen
1768353368SRudolf Cornelissen/*debug logging*/
189d063f00SRudolf Cornelissenvoid eng_log(char *fmt, ...)
1968353368SRudolf Cornelissen{
2068353368SRudolf Cornelissen	char     buffer[1024];
2168353368SRudolf Cornelissen	char     fname[64];
2268353368SRudolf Cornelissen	FILE    *myhand;
2368353368SRudolf Cornelissen	va_list  args;
2468353368SRudolf Cornelissen
2568353368SRudolf Cornelissen	sprintf (fname, "/boot/home/" DRIVER_PREFIX ".accelerant.%d.log", accelerantIsClone);
2668353368SRudolf Cornelissen	myhand=fopen(fname,"a+");
2768353368SRudolf Cornelissen
2868353368SRudolf Cornelissen	if (myhand == NULL) return;
2968353368SRudolf Cornelissen
3068353368SRudolf Cornelissen	va_start(args,fmt);
3168353368SRudolf Cornelissen	vsprintf (buffer, fmt, args);
3268353368SRudolf Cornelissen	fprintf(myhand, "%s", buffer);
3368353368SRudolf Cornelissen	fclose(myhand);
3468353368SRudolf Cornelissen}
35