]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - avr/virt_ports.asm
* I2C Support added
[avrcpm.git] / avr / virt_ports.asm
index 94327aae35679fd7fafa0fc7bc4300a26863e710..b03a268fdbf07387492f4b1a6520974ea56e16fc 100644 (file)
 ;03    3       in      - "UART" status: bit 0 = rx, bit 1 = tx
 ;04    4       in      - "UART" data register, no wait
 ;
+;------------------------ Virtual I2C interface --------------------------
+;05    5       out     - Control Port: 1 = Start read operation
+;                                      2 = Start write operation 
+;05    5       in      - Status of last Transfer: 0 = ok, else fail
+;06    6       in/out  - Number of bytes to transfer, including Slave address
+;07,08 7,8     in/out  - Read/Write address low/high
+;
+;------------------------ Disk I/O ---------------------------------------
 ;0D,0E 13,14   in/out  - Set address of Bios Controll Block
 ;0F    15      in/out  - Disk select
 ;10,11  16,17  in/out  - Track select
 ;16    22      in      - Result of last read/write operation.
 ;                        0x00 = ok, 0xff = error (--> Bad Sector)
 ;
+;
+;
+;------------------------ Wall Clock and Timers --------------------------
 ;40    64-71   in/out  - Timer/Clock control.  
 ;41-46
 ;
-;47-4C         clock   - Binary format: y, m, d, h, m, s
+;47-4D         clock   - BCD format: ss, mm, hh,  DD, MM, YYl, YYh
+;
+;------------------------ Ports ------------------------------------------
+;80-87         in/out  - Port-Expander PCF8574 (max. 8 Chips)
+;88-8F         in/out  - Port-Expander PCF8574A (not implemented yet!)
 
 
 ; ---------------------------------------------- Start of Code Segment
@@ -89,13 +104,28 @@ vport_tbl:
        .dw     utimeget
        .dw     utimeput
 
-       .db     CLOCKPORT,6     ;Clock format (bin): y, m, d, h, m, s
+       .db     CLOCKPORT,7     ;Clock format (bcd): ss, mm, hh,  DD, MM, YYl, YYh
        .dw     clockget
        .dw     clockput
 
        .db     DEBUGPORT,1
        .dw     dbg_stat
        .dw     dbg_ctrl
+
+#if I2C
+       .db     I2CCTRL,1
+       .dw     vi2c_stat_get
+       .dw     vi2c_ctrl
+
+       .db     I2CBLEN,3       ;
+       .dw     vi2c_param_get
+       .dw     vi2c_param_set
+
+       .db     PORT,8
+       .dw     pcf8574_in
+       .dw     pcf8574_out
+#endif
+
        .db     0,0             ; Stop mark
 
 ;---------------------------------------------------------------------
@@ -147,8 +177,8 @@ vprw_next:                  ;port # not in range, test next block.
        adiw    z,4
        rjmp    vprw_loop
 vprw_found:
-       brtc    PC+2
-       adiw    z,2
+       brtc    PC+2            ;read or write?
+       adiw    z,2             ;skip read function pointer
        lpm     _tmp0,z+
        lpm     _tmp1,z+
        movw    z,_tmp0