X-Git-Url: http://cloudbase.mooo.com/gitweb/avrcpm.git/blobdiff_plain/5482d75ffeb537629e1fe0a82c3eb22986dcbbc5..623dd899f6326f34aaf298fd4f83dbd69d7ef750:/avr/virt_ports.asm diff --git a/avr/virt_ports.asm b/avr/virt_ports.asm index 022d5d4..05cfd93 100644 --- a/avr/virt_ports.asm +++ b/avr/virt_ports.asm @@ -32,6 +32,14 @@ ;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 @@ -53,8 +61,17 @@ ;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. -;46 +;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,7 +93,7 @@ vport_tbl: .dw uartin .dw uartout - .db 13,9 ; Port 13-21, (lenth 9) + .db 13,9 ; Port 13-21, (length 9) .dw dsk_param_get .dw dsk_param_set .db 22,1 @@ -84,8 +101,31 @@ vport_tbl: .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