X-Git-Url: https://git.smho.de/gw/?p=owSlave2.git;a=blobdiff_plain;f=common%2FOWTimerInterrupt.s;fp=common%2FOWTimerInterrupt.s;h=1ad0afcda48c6b4410a1541affa84a10606732cf;hp=a23009e9aa5f9cdd7cb71fd342305c278df119be;hb=a6a04f58e4afd20f206fdf4a8a7b3ce4062f1b67;hpb=cd92472e6fd63693741f8e168123a4182802651b diff --git a/common/OWTimerInterrupt.s b/common/OWTimerInterrupt.s index a23009e..1ad0afc 100644 --- a/common/OWTimerInterrupt.s +++ b/common/OWTimerInterrupt.s @@ -1,86 +1,86 @@ -// Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the -// distribution. -// * All advertising materials mentioning features or use of this -// software must display the following acknowledgement: This product -// includes software developed by tm3d.de and its contributors. -// * Neither the name of tm3d.de nor the names of its contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -.global TIMER_INTERRUPT -TIMER_INTERRUPT: - sdb - push r_temp - in r_temp,_SFR_IO_ADDR(SREG) - push r_temp - cdb - sbic OW_PIN,OW_PINN ; abkuerzung wenn Leitung schon h - rjmp tint_end ; Leitung 1 kein Reset - ldi r_temp,0 - out TCNT_REG,r_temp - CLEAR_TOV_FLAG -tint_loop_rend: - sbis OW_PIN,OW_PINN ;warten bis leitung wieder h - rjmp tint_loop_rend - JMP_NO_TOV ;ueberspringe wenn kein ueberlauf - rjmp tint_overrun - in r_temp,TCNT_REG ;schauen ob es lange genug gedauert hat fuer reset - cpi r_temp,OWT_RESET2 - brlo tint_end -tint_overrun: - ldi r_temp,0 - out TCNT_REG,r_temp - ;zwischen Reset und Presets -tint_loop_res_pres: - in r_temp,TCNT_REG - cpi r_temp,OWT_RESET_PRESENT - brlo tint_loop_res_pres ;Warten zwischen reset und presets - sbi OW_DDR,OW_PINN ;presents impuls - ;reset impuls -tint_loop_pres: - in r_temp,TCNT_REG - cpi r_temp,OWT_PRESENT - brlo tint_loop_pres - cbi OW_DDR,OW_PINN - ldi r_temp,OW_READ_ROM_COMMAND ; Initialisieren von Rom command - sts mode,r_temp - ldi r_temp,1 - sts reset_indicator,r_temp - sts bcount,r_temp ;bit eins - clr r_temp - sts sendflag,r_temp ;empfangen (rom_command) - ;sts wzero,r_temp ;alles 0 - RESETZEROMARKER - CLEAR_INTERRUPT_FLAG -tint_end: - ;CLEAR_INTERRUPT_FLAG - DIS_TIM_INT - pop r_temp - out _SFR_IO_ADDR(SREG),r_temp - pop r_temp - reti -;;; +// Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the +// distribution. +// * All advertising materials mentioning features or use of this +// software must display the following acknowledgement: This product +// includes software developed by tm3d.de and its contributors. +// * Neither the name of tm3d.de nor the names of its contributors may +// be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +.global TIMER_INTERRUPT +TIMER_INTERRUPT: + sdb + push r_temp + in r_temp,_SFR_IO_ADDR(SREG) + push r_temp + cdb + sbic OW_PIN,OW_PINN ; abkuerzung wenn Leitung schon h + rjmp tint_end ; Leitung 1 kein Reset + ldi r_temp,0 + out TCNT_REG,r_temp + CLEAR_TOV_FLAG +tint_loop_rend: + sbis OW_PIN,OW_PINN ;warten bis leitung wieder h + rjmp tint_loop_rend + JMP_NO_TOV ;ueberspringe wenn kein ueberlauf + rjmp tint_overrun + in r_temp,TCNT_REG ;schauen ob es lange genug gedauert hat fuer reset + cpi r_temp,OWT_RESET2 + brlo tint_end +tint_overrun: + ldi r_temp,0 + out TCNT_REG,r_temp + ;zwischen Reset und Presets +tint_loop_res_pres: + in r_temp,TCNT_REG + cpi r_temp,OWT_RESET_PRESENT + brlo tint_loop_res_pres ;Warten zwischen reset und presets + sbi OW_DDR,OW_PINN ;presents impuls + ;reset impuls +tint_loop_pres: + in r_temp,TCNT_REG + cpi r_temp,OWT_PRESENT + brlo tint_loop_pres + cbi OW_DDR,OW_PINN + ldi r_temp,OW_READ_ROM_COMMAND ; Initialisieren von Rom command + sts mode,r_temp + ldi r_temp,1 + sts reset_indicator,r_temp + sts bcount,r_temp ;bit eins + clr r_temp + sts sendflag,r_temp ;empfangen (rom_command) + ;sts wzero,r_temp ;alles 0 + RESETZEROMARKER + CLEAR_INTERRUPT_FLAG +tint_end: + ;CLEAR_INTERRUPT_FLAG + DIS_TIM_INT + pop r_temp + out _SFR_IO_ADDR(SREG),r_temp + pop r_temp + reti +;;;