home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / acorn / 7960 < prev    next >
Encoding:
Internet Message Format  |  1992-07-20  |  2.8 KB

  1. Path: sparky!uunet!mcsun!uknet!stl!bnr.co.uk!row
  2. From: row@bnr.co.uk
  3. Newsgroups: comp.sys.acorn
  4. Subject: IOC and IIC serial bus
  5. Message-ID: <1992Jul21.082331.22460@bnr.co.uk>
  6. Date: 21 Jul 92 08:23:31 GMT
  7. Sender: daemon@bnr.co.uk
  8. Reply-To: row@bnr.co.uk ()
  9. Organization: BNR Europe Limited, London Road, Harlow, Essex, GB
  10. Lines: 60
  11.  
  12. I am currently adding a couple of new devices to the IIC bus
  13. on my Archimedes and have the hardware working BUT the IIC
  14. SWI is pretty useless as it stands and I therefore need to 
  15. enhance this module.
  16.  
  17. Below is a partial disassembly of the IIC module, could someone
  18. please explain the bits with the questions in the comments please ?
  19. All the comments shown are my interpretations of what I think the
  20. code is doing, and the parameters it takes, I maybe completely
  21. wrong, if so what does it do #?!
  22.  
  23. ;
  24. ; This function I think places data on the IIC bus - any comments.
  25. ; On Entry: (I think)
  26. ;   R0 - status of data line
  27. ;   R1 - status of clock line
  28. ;
  29.  
  30.   .callD          STMDB   R13!,{R0-R2,R14}
  31.                   BIC     R14,R14,#&40000000     ; 
  32.   .callC          ORR     R14,R14,#&08000000     ;
  33.                   TEQP    R14,#0                 ;
  34.  
  35.                   ADD     R0,R0,R1,LSL #1        ; Value to poke to device 
  36.  
  37.                   MOV     R2,#0                  ; What does
  38.                   LDRB    R1,[R2,#262]           ; this bit
  39.                   BIC     R1,R1,#3               ; do ?
  40.                   ORR     R1,R1,R0               ; What is at address
  41.                   ORR     R1,R1,#&C0             ; #262 ?
  42.                   STRB    R1,[R2,#262]           ; Cos I don't know !!
  43.  
  44.                   MOV     R2,#&03200000          ; IIC device address
  45.                   STRB    R1,[R2,#0]             ; Place data on IIC lines
  46.   .loop1          LDREQB  R1,[R2,#0]             ; Read IIC lines
  47.                   TSTEQ   R1,#2                  ; Wait for bit 2 (IIC clock)
  48.                   BEQ     loop1                  ; to go high.
  49.                   MOV     R0,#&0A                ;
  50.                   BL      call3                  ; Call delay
  51.                   LDMIA   R13!,{R0-R2,PC}^
  52.  
  53. How do the timers used below work ? What is the delay ?
  54.  
  55.   .call3          STMDB   R13!,{R14}
  56.                   STRB    R0,[R2,#76]            ; T0 latch command
  57.                   LDRB    R1,[R2,#64]            ; T0 count low
  58.   .loop2          STRB    R0,[R2,#76]            ; T0 latch command
  59.                   LDRB    R14,[R2,#64]           ; T0 count low
  60.                   TEQ     R14,R1                 ;
  61.                   MOVNE   R1,R14                 ;
  62.                   BEQ     loop2                  ;
  63.                   SUBS    R0,R0,#1               ;
  64.                   BNE     loop2                  ;
  65.                   LDMIA   R13!,{PC}
  66.  
  67.  
  68. Any help would be appreciated.
  69.  
  70. Reuben Wells
  71. Reuben O. Wells    - BNR Europe Ltd - (+44) 279 403704
  72.