Use same main for both sam7 proj.
authorasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 27 Apr 2009 14:17:01 +0000 (14:17 +0000)
committerasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 27 Apr 2009 14:17:01 +0000 (14:17 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2678 38d2e660-2303-0410-9eaa-f027e97ec537

examples/at91sam7/at91sam7.c [new file with mode: 0644]
examples/at91sam7/at91sam7s.c [deleted file]
examples/at91sam7/at91sam7s.mk
examples/at91sam7/at91sam7x.mk

diff --git a/examples/at91sam7/at91sam7.c b/examples/at91sam7/at91sam7.c
new file mode 100644 (file)
index 0000000..04ee19f
--- /dev/null
@@ -0,0 +1,189 @@
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos 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 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction.  Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License.  This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2009 Develer S.r.l. (http://www.develer.com/)
+ *
+ * -->
+ *
+ * \version $Id$
+ *
+ * \author Francesco Sacchi <batt@develer.com>
+ * \author Daniele Basile <asterix@develer.com>
+ *
+ * \brief Simple BeRTOS test on AT91SAM7X-EK evaluation board.
+ *
+ * This short program shows you a simple demo of some BeRTOS feature:
+ *
+ * - Debug system
+ * - Timer interrupt
+ * - Serial
+ * - Cooperative BeRTOS Kernel
+ *
+ */
+
+#include "cfg/cfg_ser.h"
+#include <cfg/macros.h>
+
+#include <kern/proc.h>
+
+#include <cpu/detect.h>
+
+#include <drv/timer.h>
+#include <drv/sysirq_at91.h>
+#include <drv/ser.h>
+
+#include <io/arm.h>
+
+Timer leds_timer;
+Serial ser_fd;
+
+enum
+{
+       FORWARD,
+       BACKWARD,
+};
+
+int direction = FORWARD;
+
+static void leds_init(void)
+{
+       #if CPU_ARM_AT91SAM7X256
+               /* Set PB19..22 connected to PIOB */
+               PIOB_PER  = 0x780000;
+               /* Set PB19..22 as output */
+               PIOB_OER  = 0x780000;
+
+               /* Set PB19..22 to 1 to turn off leds */
+               PIOB_SODR  = 0x780000;
+
+               /* turn first led on (PB19) */
+               PIOB_CODR  = 0x80000;
+       #elif CPU_ARM_AT91SAM7S256
+               /* Set PA0..3 connected to PIOA */
+               PIOA_PER  = 0x0000001f;
+               /* Set PA0..3 as output */
+               PIOA_OER  = 0x0000001f;
+
+               /* Set PA0..3 to 1 to turn off leds */
+               PIOA_SODR  = 0x0000000f;
+               /* turn first led on (PA0) */
+               PIOA_CODR  = 0x00000001;
+       #endif
+}
+
+#if CPU_ARM_AT91SAM7X256
+       #define GET_PIO_STATUS()  (~PIOB_ODSR & 0x780000)
+       #define LAST_LED                        0x200000
+       #define FIRST_LED                       0x100000
+       #define SET_PIO_BITS                    PIOB_SODR
+       #define CLEAR_PIO_BITS                  PIOB_CODR
+       #define AT91SAM7_MSG      "BeRTOS is run on AT91SAM7X256..\n"
+#elif CPU_ARM_AT91SAM7S256
+       #define GET_PIO_STATUS()  (~PIOA_ODSR & 0x0000000f)
+       #define LAST_LED                        0x00000004
+       #define FIRST_LED                       0x00000002
+       #define SET_PIO_BITS                    PIOA_SODR
+       #define CLEAR_PIO_BITS                  PIOA_CODR
+       #define AT91SAM7_MSG      "BeRTOS is run on AT91SAM7S256..\n"
+#endif
+
+/*
+ * Knight Rider leds effect..
+ */
+static void leds_toggle(void)
+{
+       uint32_t led_status = GET_PIO_STATUS();
+
+       // Turn on led in forward direction
+       if (direction == FORWARD)
+       {
+               if(led_status == LAST_LED)
+                       direction = BACKWARD;
+
+               SET_PIO_BITS = led_status;
+               CLEAR_PIO_BITS = led_status << 1;
+       }
+       // Turn on led in backward direction
+       else if (direction == BACKWARD)
+       {
+               if(led_status == FIRST_LED)
+                       direction = FORWARD;
+
+               SET_PIO_BITS = led_status;
+               CLEAR_PIO_BITS = led_status >> 1;
+       }
+
+       /* Wait for interval time */
+       timer_setDelay(&leds_timer, ms_to_ticks(100));
+       timer_add(&leds_timer);
+}
+
+int main(void)
+{      char msg[]="BeRTOS, be fast be beatiful be realtime";
+
+
+       kdbg_init();
+       timer_init();
+       proc_init();
+       leds_init();
+
+       ASSERT(!IRQ_ENABLED());
+
+       /* Open the main communication port */
+       ser_init(&ser_fd, 0);
+       ser_setbaudrate(&ser_fd, 115200);
+       ser_setparity(&ser_fd, SER_PARITY_NONE);
+
+       IRQ_ENABLE;
+       ASSERT(IRQ_ENABLED());
+
+       /*
+        * Register timer and arm timer interupt.
+        */
+       timer_setSoftint(&leds_timer, (Hook)leds_toggle, 0);
+       timer_setDelay(&leds_timer, ms_to_ticks(100));
+       timer_add(&leds_timer);
+
+       /*
+        * Run process test.
+        */
+       if(!proc_testRun())
+               kfile_printf(&ser_fd.fd, "ProcTest..ok!\n");
+       else
+               kfile_printf(&ser_fd.fd, "ProcTest..FAIL!\n");
+
+
+       kputs(AT91SAM7_MSG);
+
+       // Main loop
+       for(;;)
+       {
+               kfile_printf(&ser_fd.fd, "From serial 0: %s\r\n", msg);
+       }
+       return 0;
+}
diff --git a/examples/at91sam7/at91sam7s.c b/examples/at91sam7/at91sam7s.c
deleted file mode 100644 (file)
index 04ee19f..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/**
- * \file
- * <!--
- * This file is part of BeRTOS.
- *
- * Bertos 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 of the License, or
- * (at your option) any later version.
- *
- * This program 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 this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * As a special exception, you may use this file as part of a free software
- * library without restriction.  Specifically, if other files instantiate
- * templates or use macros or inline functions from this file, or you compile
- * this file and link it with other files to produce an executable, this
- * file does not by itself cause the resulting executable to be covered by
- * the GNU General Public License.  This exception does not however
- * invalidate any other reasons why the executable file might be covered by
- * the GNU General Public License.
- *
- * Copyright 2009 Develer S.r.l. (http://www.develer.com/)
- *
- * -->
- *
- * \version $Id$
- *
- * \author Francesco Sacchi <batt@develer.com>
- * \author Daniele Basile <asterix@develer.com>
- *
- * \brief Simple BeRTOS test on AT91SAM7X-EK evaluation board.
- *
- * This short program shows you a simple demo of some BeRTOS feature:
- *
- * - Debug system
- * - Timer interrupt
- * - Serial
- * - Cooperative BeRTOS Kernel
- *
- */
-
-#include "cfg/cfg_ser.h"
-#include <cfg/macros.h>
-
-#include <kern/proc.h>
-
-#include <cpu/detect.h>
-
-#include <drv/timer.h>
-#include <drv/sysirq_at91.h>
-#include <drv/ser.h>
-
-#include <io/arm.h>
-
-Timer leds_timer;
-Serial ser_fd;
-
-enum
-{
-       FORWARD,
-       BACKWARD,
-};
-
-int direction = FORWARD;
-
-static void leds_init(void)
-{
-       #if CPU_ARM_AT91SAM7X256
-               /* Set PB19..22 connected to PIOB */
-               PIOB_PER  = 0x780000;
-               /* Set PB19..22 as output */
-               PIOB_OER  = 0x780000;
-
-               /* Set PB19..22 to 1 to turn off leds */
-               PIOB_SODR  = 0x780000;
-
-               /* turn first led on (PB19) */
-               PIOB_CODR  = 0x80000;
-       #elif CPU_ARM_AT91SAM7S256
-               /* Set PA0..3 connected to PIOA */
-               PIOA_PER  = 0x0000001f;
-               /* Set PA0..3 as output */
-               PIOA_OER  = 0x0000001f;
-
-               /* Set PA0..3 to 1 to turn off leds */
-               PIOA_SODR  = 0x0000000f;
-               /* turn first led on (PA0) */
-               PIOA_CODR  = 0x00000001;
-       #endif
-}
-
-#if CPU_ARM_AT91SAM7X256
-       #define GET_PIO_STATUS()  (~PIOB_ODSR & 0x780000)
-       #define LAST_LED                        0x200000
-       #define FIRST_LED                       0x100000
-       #define SET_PIO_BITS                    PIOB_SODR
-       #define CLEAR_PIO_BITS                  PIOB_CODR
-       #define AT91SAM7_MSG      "BeRTOS is run on AT91SAM7X256..\n"
-#elif CPU_ARM_AT91SAM7S256
-       #define GET_PIO_STATUS()  (~PIOA_ODSR & 0x0000000f)
-       #define LAST_LED                        0x00000004
-       #define FIRST_LED                       0x00000002
-       #define SET_PIO_BITS                    PIOA_SODR
-       #define CLEAR_PIO_BITS                  PIOA_CODR
-       #define AT91SAM7_MSG      "BeRTOS is run on AT91SAM7S256..\n"
-#endif
-
-/*
- * Knight Rider leds effect..
- */
-static void leds_toggle(void)
-{
-       uint32_t led_status = GET_PIO_STATUS();
-
-       // Turn on led in forward direction
-       if (direction == FORWARD)
-       {
-               if(led_status == LAST_LED)
-                       direction = BACKWARD;
-
-               SET_PIO_BITS = led_status;
-               CLEAR_PIO_BITS = led_status << 1;
-       }
-       // Turn on led in backward direction
-       else if (direction == BACKWARD)
-       {
-               if(led_status == FIRST_LED)
-                       direction = FORWARD;
-
-               SET_PIO_BITS = led_status;
-               CLEAR_PIO_BITS = led_status >> 1;
-       }
-
-       /* Wait for interval time */
-       timer_setDelay(&leds_timer, ms_to_ticks(100));
-       timer_add(&leds_timer);
-}
-
-int main(void)
-{      char msg[]="BeRTOS, be fast be beatiful be realtime";
-
-
-       kdbg_init();
-       timer_init();
-       proc_init();
-       leds_init();
-
-       ASSERT(!IRQ_ENABLED());
-
-       /* Open the main communication port */
-       ser_init(&ser_fd, 0);
-       ser_setbaudrate(&ser_fd, 115200);
-       ser_setparity(&ser_fd, SER_PARITY_NONE);
-
-       IRQ_ENABLE;
-       ASSERT(IRQ_ENABLED());
-
-       /*
-        * Register timer and arm timer interupt.
-        */
-       timer_setSoftint(&leds_timer, (Hook)leds_toggle, 0);
-       timer_setDelay(&leds_timer, ms_to_ticks(100));
-       timer_add(&leds_timer);
-
-       /*
-        * Run process test.
-        */
-       if(!proc_testRun())
-               kfile_printf(&ser_fd.fd, "ProcTest..ok!\n");
-       else
-               kfile_printf(&ser_fd.fd, "ProcTest..FAIL!\n");
-
-
-       kputs(AT91SAM7_MSG);
-
-       // Main loop
-       for(;;)
-       {
-               kfile_printf(&ser_fd.fd, "From serial 0: %s\r\n", msg);
-       }
-       return 0;
-}
index d4585d2795469a66c80cdb691ca0e0c7727b1f3a..55fc19cf66aa741baaea498de5332a66c2f89c9c 100644 (file)
@@ -16,7 +16,7 @@ at91sam7s_DEBUG = 1
 TRG += at91sam7s
 
 at91sam7s_CSRC = \
-       examples/at91sam7s/at91sam7s.c \
+       examples/at91sam7/at91sam7.c \
        bertos/drv/timer.c \
        bertos/drv/ser.c \
        bertos/cpu/arm/drv/sysirq_at91.c \
index 2a3bcfc86efa31446577fbdaf1d5a729c9d61b6d..404d92dafa1c3f91f54817c9647fefe3eb64ccc7 100644 (file)
@@ -16,7 +16,7 @@ at91sam7x_DEBUG = 1
 TRG += at91sam7x
 
 at91sam7x_CSRC = \
-       examples/at91sam7x/at91sam7x.c \
+       examples/at91sam7/at91sam7.c \
        bertos/drv/timer.c \
        bertos/drv/ser.c \
        bertos/cpu/arm/drv/sysirq_at91.c \