home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / driverkit / debugging.h < prev    next >
Text File  |  1993-02-16  |  2KB  |  94 lines

  1. /*     Copyright (c) 1991 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  * debugging.h - public interface for driver debugging module (DDM) This 
  4.  *        interface is used by modules which generate DDM data (as 
  5.  *        opposed to Apps which collect or analyze debugging data).
  6.  *
  7.  * HISTORY
  8.  * 22-Feb-91    Doug Mitchell at NeXT
  9.  *      Created. 
  10.  */
  11.  
  12. /*
  13.  * The DDM provides fast, cheap text logging functions. These
  14.  * functions are typically invoked via macros which are defined to be
  15.  * null unless the DDM_DEBUG cpp flag is defined true. Thus, a debug
  16.  * configuration would typically define DDM_DEBUG true and a release
  17.  * configuration would not define DDM_DEBUG. 
  18.  */
  19.  
  20. #import <kernserv/clock_timer.h>    /* for ns_time_t */
  21.  
  22. #define IO_NUM_DDM_MASKS    4
  23.  
  24. /*
  25.  * Bitmask used to filter storing of events.
  26.  */
  27. extern unsigned int IODDMMasks[IO_NUM_DDM_MASKS];
  28.  
  29. /*
  30.  * Initialize. Client must call this once, before using any services.
  31.  */
  32. #ifdef    KERNEL
  33. void IOInitDDM(int numBufs);
  34. #else    KERNEL
  35. void IOInitDDM(int numBufs, char *serverPortName);
  36. #endif    KERNEL
  37.  
  38. /*
  39.  * add one entry to debugging log.
  40.  * This function is actually the same in User and Kernel space; the Kernel
  41.  * prototype has no argument for backwards compatibility with callers who
  42.  * did not specify all 6 arguments.
  43.  */
  44. #ifdef    KERNEL
  45. extern void IOAddDDMEntry();
  46. #else    KERNEL
  47. void IOAddDDMEntry(char *str, int arg1, int arg2, int arg3, 
  48.     int arg4, int arg5);
  49. #endif    KERNEL
  50.  
  51. /*
  52.  * Clear the debugging log.
  53.  */
  54. void IOClearDDM();
  55.  
  56. /*
  57.  * Get/Set bit mask of IODebuggingMasks[index].
  58.  */
  59. void IOSetDDMMask(int index, unsigned int bitmask);
  60. unsigned IOGetDDMMask(int index);
  61.  
  62. /*
  63.  * Obtain one sprintf'd entry from the debugging log. 'index' indicates 
  64.  * which entry to return, counting backwards from the last (latest) entry.
  65.  * Returns nonzero if specified entry does not exist.
  66.  */
  67. int IOGetDDMEntry(
  68.     int         entry,         // desired entry
  69.     int         outStringSize,    // memory available in outString
  70.     char         *outString,     // result goes here
  71.     ns_time_t     *timestamp,    // returned
  72.     int         *cpuNum);    // returned
  73.  
  74. /*
  75.  * return a malloc'd copy of instring.
  76.  */
  77. const char *IOCopyString(const char *instring);
  78.  
  79. #if    DDM_DEBUG
  80.  
  81. #define IODEBUG(index, mask, x, a, b, c, d, e) {             \
  82.     if(IODDMMasks[index] & mask) {                    \
  83.         IOAddDDMEntry(x, (int)a, (int)b, (int)c,         \
  84.                        (int)d, (int)e);         \
  85.     }                                \
  86. }
  87.  
  88. #else    DDM_DEBUG
  89.  
  90. #define IODEBUG(index, mask, x, a, b, c, d, e)
  91.  
  92. #endif    DDM_DEBUG
  93.  
  94.