home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / CD32 / CD32_Support / examples / SA_Examples / cd / CDTest / interrupt.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-27  |  3.7 KB  |  202 lines

  1. /*
  2. **  cd.device Test
  3. **  Written by John J. Szucs
  4. **  Copyright © 1993-1999 Amiga, Inc.
  5. **  All Rights Reserved
  6. */
  7.  
  8. /*
  9. **  ANSI includes
  10. */
  11.  
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14. #include <string.h>
  15. #include <math.h>
  16.  
  17. /*
  18. **  System includes
  19. */
  20.  
  21. #include <exec/types.h>
  22. #include <exec/interrupts.h>
  23. #include <exec/io.h>
  24.  
  25. #include <utility/tagitem.h>
  26.  
  27. #include <dos/dos.h>
  28.  
  29. #include <devices/cd.h>
  30.  
  31. #include <devices/trackdisk.h>
  32.  
  33. #include <rexx/rxslib.h>
  34. #include <rexx/storage.h>
  35. #include <rexx/errors.h>
  36.  
  37. #include <clib/exec_protos.h>
  38. #include <clib/dos_protos.h>
  39. #include <clib/rexxsyslib_protos.h>
  40. #include <clib/alib_protos.h>
  41. /*#include <clib/debug_protos.h>*/
  42. extern void kprintf(const char *,...);
  43.  
  44. /*
  45. **  Local includes
  46. */
  47.  
  48. #include "simplerexx.h"
  49. #include "cdtest.h"
  50.  
  51. /****** interrupt/changeInterruptCode ******************************************
  52. *
  53. *   NAME
  54. *       changeInterruptCode - disk change interrupt code
  55. *
  56. *   SYNOPSIS
  57. *       changeInterruptCode(intData);
  58. *
  59. *       void __asm __interrupt __saveds
  60. *           changeInterruptCode(register __a1 APTR intData);
  61. *
  62. *   FUNCTION
  63. *       Disk change interrupt code.
  64. *
  65. *   INPUTS
  66. *       intData     -   interrupt data
  67. *
  68. *   RESULT
  69. *       None
  70. *
  71. *   EXAMPLE
  72. *
  73. *   NOTES
  74. *       intData is compared against a magic cookie (COOKIE_CHANGEINT).
  75. *
  76. *   BUGS
  77. *
  78. *   SEE ALSO
  79. *
  80. ******************************************************************************
  81. *
  82. */
  83.  
  84. void __asm __interrupt __saveds changeInterruptCode(register __a1 APTR intData)
  85. {
  86.  
  87.     /* Increment total call count */
  88.     changeIntCall++;
  89.  
  90.     /* Verify interrupt data */
  91.     if (intData!=(APTR) COOKIE_CHANGEINT) {
  92.         changeIntBadData++;
  93.     }
  94.  
  95. }
  96.  
  97. /****** interrupt/frameInterruptCode ******************************************
  98. *
  99. *   NAME
  100. *       frameInterruptCode - frame interrupt code
  101. *
  102. *   SYNOPSIS
  103. *       frameInterruptCode(intData);
  104. *
  105. *       void __asm __interrupt __saveds
  106. *           frameInterruptCode(register __a1 APTR intData);
  107. *
  108. *   FUNCTION
  109. *       Frame interrupt code.
  110. *
  111. *   INPUTS
  112. *       intData     -   interrupt data
  113. *
  114. *   RESULT
  115. *       None
  116. *
  117. *   EXAMPLE
  118. *
  119. *   NOTES
  120. *       intData is compared against a magic cookie (COOKIE_FRAMEINT).
  121. *
  122. *   BUGS
  123. *
  124. *   SEE ALSO
  125. *
  126. ******************************************************************************
  127. *
  128. */
  129.  
  130. void __asm __interrupt __saveds frameInterruptCode(register __a1 APTR intData)
  131. {
  132.  
  133.     if (debugMode) {
  134.         kprintf("frameInterruptCode: Entry\n");
  135.     }
  136.  
  137.     /* Increment total call count */
  138.     frameIntCall++;
  139.  
  140.     /* Verify interrupt data */
  141.     if (intData!=(APTR) COOKIE_FRAMEINT) {
  142.         frameIntBadData++;
  143.     }
  144.  
  145. }
  146.  
  147. STRPTR getChangeInt(struct RexxMsg *rxMsg,STRPTR args,LONG *error)
  148. {
  149.  
  150.     struct options {
  151.         STRPTR stem;
  152.     } options;
  153.     struct RDArgs *rdArgs;
  154.  
  155.     /* Parse arguments */
  156.     rdArgs=obtainArgs(args,"STEM/A",&options,sizeof(options));
  157.     if (!rdArgs) {
  158.         *error=RC_ERROR;
  159.         return(NULL);
  160.     }
  161.  
  162.     /* Return change interrupt data */
  163.     setStemVarInt(rxMsg,options.stem,"Call",changeIntCall);
  164.     setStemVarInt(rxMsg,options.stem,"BadData",changeIntBadData);
  165.  
  166.     /* Return with no result */
  167.     return(NULL);
  168.  
  169. }
  170.  
  171. STRPTR getFrameInt(struct RexxMsg *rxMsg,STRPTR args,LONG *error)
  172. {
  173.  
  174.     struct options {
  175.         STRPTR stem;
  176.     } options;
  177.     struct RDArgs *rdArgs;
  178.  
  179.     /* Parse arguments */
  180.     rdArgs=obtainArgs(args,"STEM/A",&options,sizeof(options));
  181.     if (!rdArgs) {
  182.         *error=RC_ERROR;
  183.         return(NULL);
  184.     }
  185.  
  186. #ifdef DUMMY
  187.  
  188.     printf("getFrameInt\n");
  189.  
  190. #else
  191.  
  192.     /* Return frame interrupt data */
  193.     setStemVarInt(rxMsg,options.stem,"Call",frameIntCall);
  194.     setStemVarInt(rxMsg,options.stem,"BadData",frameIntBadData);
  195.  
  196. #endif /* DUMMY */
  197.  
  198.     /* Return with no result */
  199.     return(NULL);
  200.  
  201. }
  202.