home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / Vector18.lha / ParNetExample / pio_wakeup.asm < prev    next >
Encoding:
Assembly Source File  |  1993-12-18  |  2.2 KB  |  120 lines

  1. ;/*
  2. ; * This code was originally written by Matthew Dillon and put into Public Domain
  3. ; *
  4. ; * All changes concerning the adaption of Matt's original code to the
  5. ; * Vector Connection I/O board are © 1991-1993 by Henning Schmiedehausen
  6. ; * All rights for this changes are reserved. The original code is Public Domain
  7. ; *
  8. ; * This code is distributed with the expressed written permission of Matthew
  9. ; * Dillon (Thank you very much, Matt)
  10. ; *
  11. ; */
  12.  
  13.         ;   WAKEUP.ASM
  14.         ;
  15.  
  16.         INCLUDE "exec/types.i"
  17.         INCLUDE "exec/execbase.i"
  18.         INCLUDE "exec/io.i"
  19.         INCLUDE "devices/pio.i"
  20.         INCLUDE "devices/pio_hard.i"
  21.  
  22.         section __MERGED,DATA
  23.  
  24.         xdef    _VTask
  25.         xdef    _VMask
  26.  
  27.         xref    _PIOBase
  28.         xref    _UnitBase
  29.         xref    PIOIntBit
  30.         xref    CTL_MASK
  31.  
  32. _VTask        dc.l    0
  33. _VMask        dc.l    0
  34.  
  35.  
  36.         ;   ICR interrupt
  37.  
  38.         section text,code
  39.  
  40.         xref    _SysBase
  41.         xref    _LVOSignal
  42.  
  43.         xdef    _PioInt
  44.         xdef    _SetUpPIO
  45.         xdef    _ClearPIOInt
  46.         xdef    _SetPIOInt
  47.  
  48. _PioInt:    movem.l    d1-d7/a0-a6,-(a7)
  49.  
  50.         move.l    _PIOBase,a1
  51.         move.b    PIO_PSR(a1),d0
  52.         btst.l    #PIOIntBit,d0
  53.         bne.s    .isMine
  54.  
  55.         movem.l    (a7)+,d1-d7/a0-a6
  56.         moveq    #0,d0
  57.         rts
  58.  
  59. .isMine        jsr    _ClearPIOInt
  60.  
  61.         move.l    _SysBase,A6
  62.         move.l    _VTask,A1
  63.         move.l    _VMask,D0
  64.         jsr    _LVOSignal(A6)
  65.  
  66. ;        movea.l #LED,a1            ; test-toggle power LED
  67. ;        move.b    (a1),d0
  68. ;        bchg    #1,d0
  69. ;        move.b    d0,(a1)
  70.  
  71.         movem.l    (sp)+,d1-d7/a0-a6    ; restore registers
  72.         moveq.l #1,D0        ; clear interrupt.
  73.         rts
  74.  
  75. ; ***********************************************************************
  76. ;
  77. ; PIO spezifischer Code
  78. ;
  79. ; ***********************************************************************
  80.  
  81. ;
  82. ; SetUpPio stellt die PIO auf die richtige Betriebsart
  83. ;
  84.  
  85. _SetUpPIO:    move.l    _UnitBase,a1        ; Zeiger auf den Kanal holen
  86.         move.b    #0,PIOR_PDR(a1)        ; Alles Eingänge
  87.  
  88.         move.b    #%10000000,PIOR_PCR(a1)    ; Port auf Bitmode schalten
  89.  
  90.         move.l    _PIOBase,a1        ; Port C holen
  91.         move.b    PIO_PCDDR(a1),d0
  92.         and.l    #CTL_MASK,d0
  93.         move.b    d0,PIO_PCDDR(a1)    ; Control-Leitungen auf Input schalten
  94.  
  95.         rts
  96.  
  97. _ClearPIOInt:    move.l    _UnitBase,a1
  98.         bclr.b    #1,PIOR_PCR(a1)        ; Interrupts sperren
  99.  
  100.         move.l    _PIOBase,a1
  101.         moveq.b    #0,d0
  102.         bset.l    #PIOIntBit,d0
  103.         move.b    d0,PIO_PSR(a1)        ; Interrupt löschen
  104.  
  105.         rts
  106.  
  107. _SetPIOInt:    move.l    _UnitBase,a1
  108.         bset.l    #1,PIOR_PCR(a1)        ; Interrupts freigeben
  109.  
  110.         rts
  111.  
  112.  
  113.  
  114.  
  115.         END
  116.  
  117.  
  118.  
  119.  
  120.