[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-commit] [2346] Replaced the 'C' version of system_tick() with
From: |
Mike Rice |
Subject: |
[avr-libc-commit] [2346] Replaced the 'C' version of system_tick() with the assembly version. |
Date: |
Sun, 14 Apr 2013 15:54:54 +0000 |
Revision: 2346
http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2346
Author: swfltek
Date: 2013-04-14 15:54:53 +0000 (Sun, 14 Apr 2013)
Log Message:
-----------
Replaced the 'C' version of system_tick() with the assembly version.
Modified Paths:
--------------
trunk/avr-libc/include/time.h
trunk/avr-libc/libc/time/Files.am
Added Paths:
-----------
trunk/avr-libc/libc/time/system_tick.S
Removed Paths:
-------------
trunk/avr-libc/libc/time/system_tick.c
trunk/avr-libc/libc/time/system_tick_i.S
Modified: trunk/avr-libc/include/time.h
===================================================================
--- trunk/avr-libc/include/time.h 2013-04-11 23:58:48 UTC (rev 2345)
+++ trunk/avr-libc/include/time.h 2013-04-14 15:54:53 UTC (rev 2346)
@@ -233,12 +233,6 @@
/**
This function increments the system clock, and must be called at a
rate of one Hertz
- to maintain the system time.
- */
- void system_tick(void);
-
- /**
- This function increments the system clock, and must be called at a
rate of one Hertz
to maintain the system time. This function is safe to be called from a
'naked' ISR...
ISR(TIMER2_COMPA_vect, ISR_NAKED)
@@ -246,11 +240,8 @@
system_tick_i();
reti();
}
-
- This is an experimental function. If it can be ensured to work in all
cases,
- it should replace the original 'c' code system_tick().
*/
- void system_tick_i(void);
+ void system_tick(void);
/**
Enumerated labels for the days of the week.
Modified: trunk/avr-libc/libc/time/Files.am
===================================================================
--- trunk/avr-libc/libc/time/Files.am 2013-04-11 23:58:48 UTC (rev 2345)
+++ trunk/avr-libc/libc/time/Files.am 2013-04-14 15:54:53 UTC (rev 2346)
@@ -59,13 +59,12 @@
strftime.c \
sun_rise.c \
sun_set.c \
- system_tick.c \
system_time.c \
time.c \
tm_store.c \
utc_offset.c \
week_of_month.c \
- week_of_year.c
+ week_of_year.c
time_a_asm_sources = \
- system_tick_i.S
+ system_tick.S
Added: trunk/avr-libc/libc/time/system_tick.S
===================================================================
--- trunk/avr-libc/libc/time/system_tick.S (rev 0)
+++ trunk/avr-libc/libc/time/system_tick.S 2013-04-14 15:54:53 UTC (rev
2346)
@@ -0,0 +1,68 @@
+/*
+ * (c)2012 Michael Duane Rice 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. Neither the name of the copyright holders
+ * nor the names of 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.
+ */
+
+/* $Id$ */
+
+/*
+ This function increments __system time by one second. It is safe to
call from a 'naked' ISR.
+*/
+
+#include <avr/common.h>
+
+ .global system_tick
+ .type system_tick, @function
+system_tick:
+ push r24
+ push r25
+ push r26
+ push r27
+ push r1
+ in r1,_SFR_IO_ADDR(SREG)
+ push r1
+ clr r1
+ cli
+ lds r24,__system_time
+ lds r25,__system_time+1
+ lds r26,__system_time+2
+ lds r27,__system_time+3
+ adiw r24,1
+ adc r26,r1
+ adc r27,r1
+ sts __system_time,r24
+ sts __system_time+1,r25
+ sts __system_time+2,r26
+ sts __system_time+3,r27
+ pop r1
+ out _SFR_IO_ADDR(SREG),r1
+ pop r1
+ pop r27
+ pop r26
+ pop r25
+ pop r24
+ ret
+ .size system_tick, .-system_tick
Property changes on: trunk/avr-libc/libc/time/system_tick.S
___________________________________________________________________
Added: svn:keywords
+ ID
Deleted: trunk/avr-libc/libc/time/system_tick.c
===================================================================
--- trunk/avr-libc/libc/time/system_tick.c 2013-04-11 23:58:48 UTC (rev
2345)
+++ trunk/avr-libc/libc/time/system_tick.c 2013-04-14 15:54:53 UTC (rev
2346)
@@ -1,55 +0,0 @@
-/*
- * (c)2012 Michael Duane Rice 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. Neither the name of the copyright holders
- * nor the names of 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.
- */
-
-/* $Id$ */
-
-/*
- This function is to be called at a 1 Hz rate to maintain the system
time. Though
- probably it will only be called at interrupt time, we make it atomic
just to be
- safe.
-*/
-
-#include <time.h>
-
-extern volatile time_t __system_time;
-
-void
-system_tick()
-{
-
- asm volatile(
- "in __tmp_reg__, __SREG__" "\n\t"
- "cli" "\n\t"
- ::
- );
- __system_time++;
- asm volatile(
- "out __SREG__, __tmp_reg__" "\n\t"
- ::
- );
-}
Deleted: trunk/avr-libc/libc/time/system_tick_i.S
===================================================================
--- trunk/avr-libc/libc/time/system_tick_i.S 2013-04-11 23:58:48 UTC (rev
2345)
+++ trunk/avr-libc/libc/time/system_tick_i.S 2013-04-14 15:54:53 UTC (rev
2346)
@@ -1,80 +0,0 @@
-/*
- * (c)2012 Michael Duane Rice 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. Neither the name of the copyright holders
- * nor the names of 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.
- */
-
-/* $Id$ */
-
-/*
- Calling this function from a 'naked' ISR saves some stack activity.
-
- ISR(TIMER2_COMPA_vect, ISR_NAKED)
- {
- system_tick_i();
- reti();
- }
-
- This is an experimental function not really meant for release. If it can
be ensured to work in
- all cases, it should replace the original 'c' code system_tick().
-*/
-
-__SREG__ = 0x3f
-__tmp_reg__ = 0
-__zero_reg__ = 1
-
- .global system_tick_i
- .type system_tick_i, @function
-system_tick_i:
- push r1
- push r0
- in r0,__SREG__
- push r0
- clr __zero_reg__
- push r24
- push r25
- push r26
- push r27
- lds r24,__system_time
- lds r25,__system_time+1
- lds r26,__system_time+2
- lds r27,__system_time+3
- adiw r24,1
- adc r26,__zero_reg__
- adc r27,__zero_reg__
- sts __system_time,r24
- sts __system_time+1,r25
- sts __system_time+2,r26
- sts __system_time+3,r27
- pop r27
- pop r26
- pop r25
- pop r24
- pop r0
- out __SREG__,r0
- pop r0
- pop r1
- ret
- .size system_tick_i, .-system_tick_i
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-commit] [2346] Replaced the 'C' version of system_tick() with the assembly version.,
Mike Rice <=