home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / DEV / PCMCIA / CLSAMPLE / CLCARDIF.ASM next >
Encoding:
Assembly Source File  |  1995-04-14  |  6.6 KB  |  220 lines

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  4. ;
  5. ;    The following IBM OS/2 WARP source code is provided to you solely for
  6. ;    the purpose of assisting you in your development of OS/2 WARP device
  7. ;    drivers. You may use this code in accordance with the IBM License
  8. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  9. ;    Copyright statement may not be removed.;
  10. ;*****************************************************************************/
  11. ;*****************************************************************************/
  12. ;
  13. ;
  14. ;    The following IBM OS/2 2.1 source code is provided to you solely for
  15. ;    the purpose of assisting you in your development of OS/2 2.x device
  16. ;    drivers. You may use this code in accordance with the IBM License
  17. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  18. ;    Copyright statement may not be removed.;
  19. ;*****************************************************************************/
  20. ;/*****************************************************************************
  21. ;*
  22. ;* SOURCE FILE NAME = CLCARDIF.ASM
  23. ;*
  24. ;* DESCRIPTIVE NAME = Client Services Sample Card interface subrutines
  25. ;*
  26. ;*
  27. ;*
  28. ;*
  29. ;* The following IBM OS/2 2.1 source code is provided to you solely for
  30. ;* the purpose of assisting you in your development of OS/2 2.x device
  31. ;* drivers. You may use this code in accordance with the IBM License
  32. ;* Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  33. ;* Copyright statement may not be removed.
  34. ;*
  35. ;*
  36. ;*
  37. ;* VERSION
  38. ;*
  39. ;* DATE         06/22/93
  40. ;*
  41. ;* DESCRIPTION  There are callback entry from Card Services and the part
  42. ;*              which calls to Card Services from Client Services.
  43. ;*
  44. ;* FUNCTIONS
  45. ;*
  46. ;* NOTES        NONE
  47. ;*
  48. ;* STRUCTURES   NONE
  49. ;*
  50. ;* EXTERNAL REFERENCES
  51. ;*
  52. ;*              NONE
  53. ;*
  54. ;* EXTERNAL FUNCTIONS
  55. ;*
  56. ;*              NONE
  57. ;*
  58. ;***************************************************************************/
  59.  
  60.  
  61.  
  62.         EXTRN  _CBHandler:near
  63.         EXTRN  _CBMTDHandler:near
  64.         EXTRN  _CSEntry:dword
  65.  
  66.         public _CBEntry
  67.  
  68.         public _CSCall
  69. ;
  70. ; card services event definition
  71. ;
  72. MTD_REQUEST     equ      012h
  73.  
  74. Code     segment word public 'CODE'
  75. Code     ends
  76.  
  77. InitCode segment word public 'CODE'
  78. InitCode ends
  79.  
  80. SwapCode segment word public 'CODE'
  81. SwapCode ends
  82.  
  83. StaticGroup   group   _TEXT, InitCode
  84. SwapGroup     group   SwapCode
  85.  
  86.  
  87. _TEXT   segment word public 'CODE'
  88.  
  89.         assume  cs:_TEXT
  90.         .286P
  91.  
  92.  
  93. ;/***************************************************************************
  94. ;*
  95. ;* FUNCTION NAME = _CBEntry
  96. ;*
  97. ;* DESCRIPTION   = Entry point for callback request from Card Services.
  98. ;*
  99. ;* INPUT         = [AL]      Function
  100. ;*                 [CX]      Socket
  101. ;*                 [DX]      Information
  102. ;*                 [DI]      ClientVal field from ClientData structure
  103. ;*                 [DS]      ClientDS field from ClientData structure
  104. ;*                 [SI]      ClientOff field from ClientData structure
  105. ;*                 [SS]:[BP] MTD Request
  106. ;*                 [ES]:[BX] Buffer argument
  107. ;*                 [BX]      Miscellaneous argument, when no buffer argument
  108. ;*
  109. ;* OUTPUT        = [AX]  Return code
  110. ;*
  111. ;* RETURN-NORMAL =
  112. ;* RETURN-ERROR  =
  113. ;*
  114. ;**************************************************************************/
  115.  
  116. _CBEntry        proc    far
  117.  
  118.                 cmp     al,MTD_REQUEST
  119.                 jz      CBEMTDReq
  120.  
  121.                 push    es                   ; buffer
  122.                 push    bx                   ; buffer / miscellaneous
  123.                 push    si                   ; client data
  124.                 push    ds                   ; client data
  125.                 push    di                   ; client data
  126.                 push    dx                   ; information
  127.                 push    cx                   ; socket
  128.                 and     ax,00FFh
  129.                 push    ax                   ; function
  130.  
  131.                 call    _CBHandler
  132.  
  133.                 add     sp,16
  134.                 jmp     short CBEexit
  135.  
  136. CBEMTDReq:
  137.                 push    es                   ; buffer
  138.                 push    bx                   ; buffer
  139.                 push    ss                   ; MTD request
  140.                 push    bp                   ; MTD request
  141.                 push    si                   ; client data
  142.                 push    ds                   ; client data
  143.                 push    di                   ; client data
  144.                 push    cx                   ; socket
  145.                 and     ax,00FFh
  146.                 push    ax                   ; fucntion
  147.  
  148.                 call    _CBMTDHandler
  149.  
  150.                 add     sp,18
  151.  
  152. CBEexit:
  153.                 ret
  154. _CBEntry        endp
  155.  
  156.  
  157.  
  158.         .286P
  159. ;/***************************************************************************
  160. ;*
  161. ;* FUNCTION NAME = _CSCall
  162. ;*
  163. ;* DESCRIPTION   = This routine calls to Card Services directly.
  164. ;*
  165. ;* INPUT         = [BP+4]          function argument
  166. ;*                 [BP+6]          handle argument
  167. ;*                 [BP+10]:[BP+8]  pointer argument
  168. ;*                 [BP+12]         Arglength argument
  169. ;*                 [BP+16]:[BP+14] ArgPointer argument
  170. ;*
  171. ;* OUTPUT        = [AX]            Status argument
  172. ;*                 [DX]            handle
  173. ;*
  174. ;* RETURN-NORMAL =
  175. ;* RETURN-ERROR  =
  176. ;*
  177. ;**************************************************************************/
  178.  
  179. _CSCall         proc    near
  180.  
  181.                 push    bp
  182.                 mov     bp,sp
  183.  
  184.                 push    bx                   ; seve registers
  185.                 push    cx
  186.                 push    di
  187.                 push    si
  188.                 push    es
  189.  
  190.                 mov     ax,word ptr [bp+4]   ; function
  191.                 mov     dx,word ptr [bp+6]   ; handle
  192.                 mov     di,word ptr [bp+10]  ; pointer
  193.                 mov     si,word ptr [bp+8]   ; 
  194.                 mov     cx,word ptr [bp+12]  ; argument length
  195.                 mov     es,word ptr [bp+16]
  196.                 mov     bx,word ptr [bp+14]
  197.  
  198.                 call    _CSEntry             ; call Card Services
  199.  
  200. ;*
  201. ;* Please check carry flag.
  202. ;*
  203.                 jc      save_error
  204.                 xor     ax,ax
  205. save_error:
  206.                 pop     es                   ; restore registers
  207.                 pop     si
  208.                 pop     di
  209.                 pop     cx
  210.                 pop     bx
  211.  
  212.                 pop     bp
  213.                 ret                          ; 
  214.  
  215. _CSCall         endp
  216.  
  217.  
  218. _TEXT   ends
  219.          end
  220.