home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / CMDSYS.ZIP / C / DEVHLP.INC < prev   
Text File  |  1992-12-07  |  3KB  |  73 lines

  1. ;
  2. ;    devhlp.inc    Date=921207
  3. ;
  4. ;    DevHelp interface for ASM device drivers
  5. ;
  6. ;
  7.  
  8. ;========================================================================
  9.  
  10. YIELD        EQU    002h            ; yields the CPU to any eligible threads
  11. BLOCK        EQU    004h            ; blocks requesting thread
  12. RUN        EQU    005h            ; unblocks blocked thread
  13. SEM_REQUEST    EQU    006h            ; request a semaphore
  14. SEM_CLEAR    EQU    007h            ; clears (releases) a RAM or system semaphore
  15. SEM_HANDLE    EQU    008h            ; creates or releases a semaphore handle
  16. PHYS_TO_VIRT    EQU    015h            ; converts a physical address to virtual address
  17. VIRT_TO_PHYS    EQU    016h            ; converts virtual address to a physical address
  18. PHYS_TO_UVIRT    EQU    017h            ; converts a physical address to a virtual address
  19. ALLOC_PHYS    EQU    018h            ; allocates a fixed block of memory
  20. FREE_PHYS    EQU    019h            ; releases memory allocated by _AllocPhys
  21. SET_IRQ        EQU    01Bh            ; captures hardware interrupt vector
  22. UNSET_IRQ    EQU    01Ch            ; releases ownership of a hardware interrupt
  23. VERIFY_ACCESS    EQU    027h            ; verifies access to a range of memory addresses
  24. ATTACH_DD    EQU    02Ah            ; attach to a device
  25. ALLOC_GDT_SEL    EQU    02Dh            ; allocate a GDT selector
  26. PHYS_TO_GDT_SEL    EQU    02Eh            ; maps a 32 bit physical address to a GDT selector
  27. REAL_TO_PROT    EQU    02Fh            ; switch form real mode to protected mode
  28. PROT_TO_REAL    EQU    030h            ; switch from protected mode to real mode
  29. EOI        EQU    031h            ; issues end of interrupt
  30. UNPHYS_TO_VIRT    EQU    032h            ; releases virtual addresses
  31. STACK_USAGE    EQU    03ah            ; indicate stack usage
  32. DISPLAY_MESSAGE    EQU    03dh            ; display a message
  33.  
  34. PVT_DSSI    EQU    000h            ; put result of PhysToVirt in ds:si
  35. PVT_ESDI    EQU    001h            ; put result of PhysToVirt in es:di
  36.  
  37. BL_NORMAL    EQU    0000h            ; normal wakeup from Block
  38. BL_TIMEOUT    EQU    0100h            ; timeout wakeup
  39. BL_ABNORMAL    EQU    0200h            ; abnormal wakeup
  40. BL_INTERRUPT    EQU    0400h            ; sleep was interrupted
  41.  
  42. ;========================================================================
  43.  
  44. ;    PDDPhysToVirt
  45.  
  46. ;    Notes:    This macro converts a physical address to a virtual address
  47.  
  48. ;    Modified registers:    ax, bx, cx, dx
  49.  
  50. @PDDPhysToVirt    MACRO    pvAddr,pvLen,pvType
  51.         mov    ax,WPTR pvAddr+2    ; MSW of i/o buffer address
  52.         mov    bx,WPTR pvAddr        ; LSW of i/o buffer address
  53.         mov    cx,WPTR pvLen        ; length of i/o buffer
  54.         mov    dh,pvType        ; specifies destination of result
  55.         mov    dl,PHYS_TO_VIRT        ; convert physical to virtual
  56.         call    DevHelp            ; call kernel
  57.         ENDM
  58.  
  59. ;========================================================================
  60.  
  61. ;    PDDPhysToVirt
  62.  
  63. ;    Notes:    This macro releases virtual memory
  64.  
  65. ;    Modified registers:    dx
  66.  
  67. @PDDReleaseVirt    MACRO
  68.         mov    dl,UNPHYS_TO_VIRT    ; release virtual memory
  69.         call    DevHelp            ; call kernel
  70.         ENDM
  71.  
  72. ;========================================================================
  73.