]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - avr/virt_ports.asm
* MMC/SD Bootloader support
[avrcpm.git] / avr / virt_ports.asm
index bffb78fdea8fc7ef33854a16b0680cda44e6b365..05cfd933b47ee9d9ba0b5e87b34414c38742a379 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)
 ;
-;40    64-71   in/out  - Timer/Clock controll. 
-;46
+;
+;
+;------------------------ Wall Clock and Timers --------------------------
+;40    64-71   in/out  - Timer/Clock control.  
+;41-46
+;
+;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
@@ -76,16 +93,39 @@ vport_tbl:
        .dw     uartin
        .dw     uartout
 
-       .db     13,9            ; Port 13-21, (lenth 9)
-       .dw     dsk_param_rd
-       .dw     dsk_param_wr
+       .db     13,9            ; Port 13-21, (length 9)
+       .dw     dsk_param_get
+       .dw     dsk_param_set
        .db     22,1
        .dw     dskErrorRet
        .dw     dskDoIt
 
        .db     TIMERPORT,7
+       .dw     utimeget
+       .dw     utimeput
+
+       .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
 
 ;---------------------------------------------------------------------
@@ -100,6 +140,8 @@ portRead:
        clt
 
 vprw_start:
+       push    yh
+       push    yl
 .if PORT_DEBUG > 1
        tst     temp2
        brne    dvp_1           ;don't debug console status
@@ -135,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
@@ -157,13 +199,22 @@ vprw_found:
        icall
        rcall   printhex
        printstring " "
+       pop     yl
+       pop     yh
        ret
 dvp_2:
        rcall   printhex
        printstring " "
-       ijmp                    ; relative port # in temp3
+                               ; relative port # in temp3
+       icall
+       pop     yl
+       pop     yh
+       ret
 .else
-       ijmp
+       icall
+       pop     yl
+       pop     yh
+       ret
 .endif
 
 vprw_exit:
@@ -174,6 +225,8 @@ vprw_exit:
 vport_in_dummy:
        ldi     temp,0xff
 vport_out_dummy:
+       pop     yl
+       pop     yh
        ret
        
 
@@ -193,14 +246,14 @@ uartin:
        clr     temp
        lds     temp2,rxcount
        cpse    temp2,_0
-        rjmp   uartgetc
+        ljmp   uartgetc
        ret
 
 uartout:
        lds     temp2,txcount
        cpi     temp2,TXBUFSIZE
        breq    uartout_1
-       rjmp uartputc
+       ljmp uartputc
 uartout_1:
        ret
 
@@ -215,9 +268,19 @@ conStatus:
 dbgOut:
        printnewline
        printstring "Debug: "
-       rcall printhex
+       lcall printhex
+       ret
+
+
+dbg_stat:
+       ldi     temp,0
        ret
 
+dbg_ctrl:
+       bmov    intstat,i_trace, temp,0
+       ret
+
+
 
 ;---------------------------------------------------------------------
 ; vim:set ts=8 noet nowrap