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