108705d96Sshatty /* Some commmon support functions */
2a243b54eSRudolf Cornelissen /* Mark Watson 2/2000;
321ef619eSRudolf Cornelissen * Rudolf Cornelissen 1/2004-11/2005 */
408705d96Sshatty
508705d96Sshatty #define MODULE_BIT 0x00000800
608705d96Sshatty
708705d96Sshatty #include <stdarg.h>
808705d96Sshatty #include "nv_std.h"
908705d96Sshatty
1008705d96Sshatty /*delays in multiple of microseconds*/
delay(bigtime_t i)1108705d96Sshatty void delay(bigtime_t i)
1208705d96Sshatty {
1308705d96Sshatty bigtime_t start=system_time();
1408705d96Sshatty while(system_time()-start<i);
1508705d96Sshatty }
1608705d96Sshatty
1708705d96Sshatty /*debug logging*/
nv_log(char * fmt,...)1808705d96Sshatty void nv_log(char *fmt, ...)
1908705d96Sshatty {
2008705d96Sshatty char buffer[1024];
21a243b54eSRudolf Cornelissen char fname[64];
2208705d96Sshatty FILE *myhand;
2308705d96Sshatty va_list args;
2408705d96Sshatty
2521ef619eSRudolf Cornelissen /* determine the logfile name:
2621ef619eSRudolf Cornelissen * we need split-up logging per card and instance of the accelerant */
2779917d55SRudolf Cornelissen sprintf (fname, "/boot/home/" DRIVER_PREFIX "." DEVICE_FORMAT ".%d.log",
2821ef619eSRudolf Cornelissen si->vendor_id, si->device_id, si->bus, si->device, si->function,
2921ef619eSRudolf Cornelissen accelerantIsClone);
30a243b54eSRudolf Cornelissen myhand=fopen(fname,"a+");
31a243b54eSRudolf Cornelissen
3208705d96Sshatty if (myhand == NULL) return;
3308705d96Sshatty
3408705d96Sshatty va_start(args,fmt);
3508705d96Sshatty vsprintf (buffer, fmt, args);
36*5bb7d60aSJérôme Duval va_end(args);
3708705d96Sshatty fprintf(myhand, "%s", buffer);
3808705d96Sshatty fclose(myhand);
3908705d96Sshatty }
40