/* blink.c -- Blink program for Christmas trees Copyright 2000, 2001, 2002 Free Software Foundation, Inc. Written by Stephane Carrez (stcarrez@nerim.fr) This file is part of GTAM. GTAM is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GTAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GTAM; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #define BIT_0 (1<<0) #define BIT_1 (1<<1) #define BIT_2 (1<<2) #define BIT_3 (1<<3) #define BIT_4 (1<<4) #define BIT_5 (1<<5) #define BIT_6 (1<<6) #define BIT_7 (1<<7) int __attribute__((noreturn)) main (void); void _start (void); void delay_ms (unsigned ms); void _start() { __asm__ __volatile__ ("lds #0xFF"); __asm__ __volatile__ ("bra main"); } /* Wait 'ms' milliseconds (not accurate (:- (:-), hand adjusted and based on human time accuracy (understand, SCz feeling). */ void delay_ms(unsigned ms) { while (ms > 0) { unsigned char i; unsigned short tcnt; for (i = 100; --i != 0;) tcnt = get_timer_counter (); ms--; } } int main() { while (1) { _io_ports[M6811_PORTA] |= BIT_6; delay_ms (1); _io_ports[M6811_PORTA] &= ~BIT_6; delay_ms (1); } }