home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / DEV / DASD / IBM / IBM2ADSK / LOGEVENT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-14  |  4.1 KB  |  147 lines

  1. /*DDK*************************************************************************/
  2. /*                                                                           */
  3. /* COPYRIGHT (C) Microsoft Corporation, 1989                                 */
  4. /* COPYRIGHT    Copyright (C) 1995 IBM Corporation                           */
  5. /*                                                                           */
  6. /*    The following IBM OS/2 WARP source code is provided to you solely for  */
  7. /*    the purpose of assisting you in your development of OS/2 WARP device   */
  8. /*    drivers. You may use this code in accordance with the IBM License      */
  9. /*    Agreement provided in the IBM Device Driver Source Kit for OS/2. This  */
  10. /*    Copyright statement may not be removed.                                */
  11. /*                                                                           */
  12. /*****************************************************************************/
  13. /*static char *SCCSID = "src/dev/dasd/ibm/ibm2adsk/logevent.c, adsk, ddk_subset, b_bdd.032 94/03/23";*/
  14. /**************************************************************************
  15.  *
  16.  * SOURCE FILE NAME =  LOGEVENT.C
  17.  *
  18.  * DESCRIPTIVE NAME =  IBM2ADSK.ADD - Adapter Driver for ABIOS DASD Devices
  19.  *
  20.  *
  21.  *
  22.  * VERSION = V2.0
  23.  *
  24.  * DATE
  25.  *
  26.  * DESCRIPTION : ABIOS Debug Log Handler
  27.  *
  28.  *
  29. */#include <os2.h>
  30. #include <devcmd.h>
  31.  
  32. #define INCL_INITRP_ONLY
  33. #include <reqpkt.h>
  34.  
  35. #include <scb.h>
  36. #include <abios.h>
  37.  
  38. #include <iorb.h>
  39. #include <addcalls.h>
  40.  
  41. #include <dhcalls.h>
  42.  
  43. #include <adskcons.h>
  44. #include <adsktype.h>
  45. #include <adskpro.h>
  46. #include <adskextn.h>
  47. #include <log.h>
  48.  
  49. #if defined (LOGGING)
  50.  
  51. /*
  52.  *  LogEvent - Logs events into the log buffer
  53.  *
  54.  * Entry:
  55.  *
  56.  *    cLogID    = ID number so we know what log entry this is
  57.  *    cLidIndex = LID we're currently working with
  58.  *    nLine     = line number where LogEvent(...) is found in the file
  59.  *    nIntFlags = Current settings of IntFlags
  60.  *    cLidCount = Count of operations pending on this LID
  61.  *    cIntCount = Interrupting stages counter
  62.  *    nParm1    = 1rd parameter from logger
  63.  *    nParm2    = 2th parameter from logger
  64.  *    nParm3    = 3th parameter from logger
  65.  *    nParm4    = 4th parameter from logger
  66.  *
  67.  * At any time, you can use the debugger to dump _aloghistory to get the
  68.  * 16-byte log entries.  _plogcurrent points to the head/tail of the log,
  69.  * and an entry of FF's makes this easy to see.  Pass the output of the log
  70.  * through XLATELOG.CMD, and it'll be almost human-readable.
  71.  */
  72. #define PLOGNEXT(p) ((p) >= &alogHistory[MAXLOGBUF-1] ? &alogHistory[0] : (p) + 1)
  73.  
  74. void
  75. LogEvent( UCHAR  cLogID,
  76.           UCHAR  cLidIndex,
  77.           USHORT nLine,
  78.           USHORT nIntFlags,
  79.           UCHAR  cLidCount,
  80.           UCHAR  cIntCount,
  81.           USHORT nParm1,
  82.           USHORT nParm2,
  83.           USHORT nParm3,
  84.           USHORT nParm4 )
  85. {
  86.     NPUSHORT plogTmp;
  87.     USHORT nTmp;
  88.  
  89.     /* bump log ptr */
  90.     _asm
  91.     {
  92.        pushf
  93.        pop nTmp
  94.        cli
  95.     }
  96.     plogCurrent = PLOGNEXT (plogCurrent);
  97.     _asm
  98.     {
  99.        push nTmp
  100.        popf
  101.     }
  102.  
  103.     /*
  104.      * set log info
  105.      */
  106.  
  107.     plogCurrent->cLogID    = cLogID;
  108.     plogCurrent->cLidIndex = cLidIndex;
  109.     plogCurrent->nLine     = nLine;
  110.     plogCurrent->nIntFlags = nIntFlags;
  111.     plogCurrent->cLidCount = cLidCount;
  112.     plogCurrent->cIntCount = cIntCount;
  113.     plogCurrent->nParm1    = nParm1;
  114.     plogCurrent->nParm2    = nParm2;
  115.     plogCurrent->nParm3    = nParm3;
  116.     plogCurrent->nParm4    = nParm4;
  117.  
  118.     _asm
  119.     {
  120.        pushf
  121.        pop nTmp
  122.        cli
  123.     }
  124.     (PLOG)plogTmp = PLOGNEXT (plogCurrent);
  125.     _asm
  126.     {
  127.        push nTmp
  128.        popf
  129.     }
  130.     for (nTmp = 0;nTmp < sizeof(LOG)/2;nTmp++,plogTmp++)
  131.     {
  132.        *plogTmp = 0xFFFF;
  133.     }
  134. /*    plogTmp->cLogID    = 0xFF;
  135.     plogTmp->cLidIndex = 0xFF;
  136.     plogTmp->nLine     = 0xFFFF;
  137.     plogTmp->nIntFlags = 0xFFFF;
  138.     plogTmp->cLidCount = 0xFF;
  139.     plogTmp->cIntCount = 0xFF;
  140.     plogTmp->nParm1    = 0xFFFF;
  141.     plogTmp->nParm2    = 0xFFFF;
  142.     plogTmp->nParm3    = 0xFFFF;
  143.     plogTmp->nParm4    = 0xFFFF; */
  144. }
  145.  
  146. #endif
  147.