[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-commit] [2319] Added experimental function ' void system_tick_
From: |
Mike Rice |
Subject: |
[avr-libc-commit] [2319] Added experimental function ' void system_tick_i(void) '. |
Date: |
Sun, 31 Mar 2013 21:05:10 +0000 |
Revision: 2319
http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2319
Author: swfltek
Date: 2013-03-31 21:05:09 +0000 (Sun, 31 Mar 2013)
Log Message:
-----------
Added experimental function ' void system_tick_i(void) '. This function should
be suitable for call from a 'naked' ISR.
Modified Paths:
--------------
trunk/avr-libc/devtools/Architecture.am
trunk/avr-libc/include/time.h
trunk/avr-libc/libc/time/Files.am
Added Paths:
-----------
trunk/avr-libc/libc/time/system_tick_i.S
Modified: trunk/avr-libc/devtools/Architecture.am
===================================================================
--- trunk/avr-libc/devtools/Architecture.am 2013-03-30 11:59:28 UTC (rev
2318)
+++ trunk/avr-libc/devtools/Architecture.am 2013-03-31 21:05:09 UTC (rev
2319)
@@ -88,7 +88,8 @@
$(stdio_a_asm_sources) \
$(libm_a_c_sources) \
$(libm_a_asm_sources) \
- $(time_a_c_sources)
+ $(time_a_c_sources) \
+ $(time_a_asm_sources)
nodist_libm_a_SOURCES = \
$(libm_a_c_sources) \
@@ -106,4 +107,4 @@
echo all distdir install installdirs clean distclean uninstall check:
-endif
\ No newline at end of file
+endif
Modified: trunk/avr-libc/include/time.h
===================================================================
--- trunk/avr-libc/include/time.h 2013-03-30 11:59:28 UTC (rev 2318)
+++ trunk/avr-libc/include/time.h 2013-03-31 21:05:09 UTC (rev 2319)
@@ -234,6 +234,18 @@
*/
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)
+ {
+ system_tick_i();
+ reti();
+ }
+*/
+void system_tick_i(void);
+
enum _WEEK_DAYS_{
SUNDAY,
MONDAY,
Modified: trunk/avr-libc/libc/time/Files.am
===================================================================
--- trunk/avr-libc/libc/time/Files.am 2013-03-30 11:59:28 UTC (rev 2318)
+++ trunk/avr-libc/libc/time/Files.am 2013-03-31 21:05:09 UTC (rev 2319)
@@ -66,3 +66,6 @@
utc_offset.c \
week_of_month.c \
week_of_year.c
+
+time_a_asm_sources = \
+ system_tick_i.S
Added: trunk/avr-libc/libc/time/system_tick_i.S
===================================================================
--- trunk/avr-libc/libc/time/system_tick_i.S (rev 0)
+++ trunk/avr-libc/libc/time/system_tick_i.S 2013-03-31 21:05:09 UTC (rev
2319)
@@ -0,0 +1,78 @@
+/*
+ * (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$ */
+
+/*
+ Call this function at 1 Hz rate from a 'naked' ISR ( followed by reti )
to save a lot of
+ stack activity.
+
+ ISR(TIMER2_COMPA_vect, ISR_NAKED)
+ {
+ system_tick_i();
+ reti();
+ }
+*/
+
+__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] [2319] Added experimental function ' void system_tick_i(void) '.,
Mike Rice <=