From: asterix Date: Mon, 27 Apr 2009 14:10:02 +0000 (+0000) Subject: Move this code in sam7 proj. X-Git-Tag: 2.1.0~6 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=cbabb5e82238a5297656c219ff24710b13701d7f;p=bertos.git Move this code in sam7 proj. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2676 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/examples/at91sam7x/at91sam7s.mk b/examples/at91sam7x/at91sam7s.mk deleted file mode 100644 index 2a3bcfc8..00000000 --- a/examples/at91sam7x/at91sam7s.mk +++ /dev/null @@ -1,48 +0,0 @@ -# -# $Id: at91sam7x.mk 18234 2007-10-08 13:39:48Z rasky $ -# Copyright 2006 Develer S.r.l. (http://www.develer.com/) -# All rights reserved. -# -# Makefile fragment for DevLib at91sam7x application. -# -# Author: Bernie Innocenti -# -# - -# Set to 1 for debug builds -at91sam7x_DEBUG = 1 - -# Our target application -TRG += at91sam7x - -at91sam7x_CSRC = \ - examples/at91sam7x/at91sam7x.c \ - bertos/drv/timer.c \ - bertos/drv/ser.c \ - bertos/cpu/arm/drv/sysirq_at91.c \ - bertos/cpu/arm/drv/ser_at91.c \ - bertos/cpu/arm/drv/timer_at91.c \ - bertos/mware/event.c \ - bertos/mware/formatwr.c \ - bertos/mware/hex.c \ - bertos/kern/kfile.c \ - bertos/kern/proc.c \ - bertos/kern/coop.c \ - bertos/kern/proc_test.c \ - bertos/kern/monitor.c \ - bertos/kern/signal.c \ - # - -at91sam7x_CPPASRC = \ - bertos/cpu/arm/hw/crtat91sam7_rom.S \ - bertos/cpu/arm/hw/switch_ctx_arm.S \ - # - -at91sam7x_PREFIX = arm-none-eabi- - -at91sam7x_CPPAFLAGS = -O0 -g -gdwarf-2 -g -gen-debug -at91sam7x_CPPFLAGS = -O0 -D'ARCH=0' -D__ARM_AT91SAM7X256__ -D'CPU_FREQ=(48023000UL)' -D'WIZ_AUTOGEN' -g3 -gdwarf-2 -fverbose-asm -Iexamples/at91sam7x -Ibertos/cpu/arm -at91sam7x_LDFLAGS = -nostartfiles -T bertos/cpu/arm/scripts/at91sam7_256_rom.ld -Wl,--no-warn-mismatch - -at91sam7x_CPU = arm7tdmi - diff --git a/examples/at91sam7x/at91sam7x.c b/examples/at91sam7x/at91sam7x.c deleted file mode 100644 index ffc83c4c..00000000 --- a/examples/at91sam7x/at91sam7x.c +++ /dev/null @@ -1,189 +0,0 @@ -/** - * \file - * - * - * \version $Id: at91sam7s.c 2663 2009-04-24 16:30:11Z asterix $ - * - * \author Francesco Sacchi - * \author Daniele Basile - * - * \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 - -#include - -#include - -#include -#include -#include - -#include - -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/at91sam7x/cfg/cfg_monitor.h b/examples/at91sam7x/cfg/cfg_monitor.h deleted file mode 100644 index 5e97031e..00000000 --- a/examples/at91sam7x/cfg/cfg_monitor.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * \file - * - * - * \brief Kernel monitor configuration parameters - * - * \version $Id: cfg_monitor.h 2429 2009-03-25 16:30:24Z batt $ - * \author Bernie Innocenti - */ - -#ifndef CFG_MONITOR_H -#define CFG_MONITOR_H - -/** - * Process monitor. - * $WIZ$ type = "autoenabled" - */ -#define CONFIG_KERN_MONITOR 1 - -#endif /* CFG_MONITOR_H */ diff --git a/examples/at91sam7x/cfg/cfg_proc.h b/examples/at91sam7x/cfg/cfg_proc.h deleted file mode 100644 index 7f818f49..00000000 --- a/examples/at91sam7x/cfg/cfg_proc.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - * \file - * - * - * \brief Kernel configuration parameters - * - * \version $Id: cfg_proc.h 2659 2009-04-24 09:28:30Z batt $ - * \author Bernie Innocenti - */ - -#ifndef CFG_PROC_H -#define CFG_PROC_H - -/** - * Enable the multithreading kernel. - * - * $WIZ$ type = "autoenabled" - */ -#define CONFIG_KERN 1 - -/** - * Kernel interrupt supervisor. - * $WIZ$ type = "boolean" - */ -#define CONFIG_KERN_IRQ 0 - -/** - * Dynamic memory allocation for processes. - * - * $WIZ$ type = "boolean" - * $WIZ$ supports = "False" - */ -#define CONFIG_KERN_HEAP 0 - -/** - * Preemptive process scheduling. WARNING: Experimental, still incomplete! - * - * $WIZ$ type = "boolean" - */ -#define CONFIG_KERN_PREEMPT 0 - -/** - * Priority-based scheduling policy. - * $WIZ$ type = "boolean" - */ -#define CONFIG_KERN_PRI 0 - -/** - * Time sharing quantum (a prime number prevents interference effects) [ms]. - * - * $WIZ$ type = "int" - * $WIZ$ min = "0" - */ -#define CONFIG_KERN_QUANTUM 47 - -/** - * Module logging level. - * - * $WIZ$ type = "enum" - * $WIZ$ value_list = "log_level" - */ -#define KERN_LOG_LEVEL LOG_LVL_ERR - -/** - * Module logging format. - * - * $WIZ$ type = "enum" - * $WIZ$ value_list = "log_format" - */ -#define KERN_LOG_FORMAT LOG_FMT_VERBOSE - -#endif /* CFG_PROC_H */ diff --git a/examples/at91sam7x/cfg/cfg_sem.h b/examples/at91sam7x/cfg/cfg_sem.h deleted file mode 100644 index 6e3cfab7..00000000 --- a/examples/at91sam7x/cfg/cfg_sem.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * \file - * - * - * \brief Kernel semaphores configuration parameters. - * - * \version $Id: cfg_sem.h 2429 2009-03-25 16:30:24Z batt $ - * \author Bernie Innocenti - */ - -#ifndef CFG_SEM_H -#define CFG_SEM_H - -/** - * Re-entrant mutual exclusion primitives. - * $WIZ$ type = "autoenabled" - */ -#define CONFIG_KERN_SEMAPHORES 1 - -#endif /* CFG_SEM_H */ diff --git a/examples/at91sam7x/cfg/cfg_ser.h b/examples/at91sam7x/cfg/cfg_ser.h deleted file mode 100644 index a00ab85d..00000000 --- a/examples/at91sam7x/cfg/cfg_ser.h +++ /dev/null @@ -1,107 +0,0 @@ -/** - * \file - * - * - * \brief Configuration file for serial module. - * - * \version $Id: cfg_ser.h 2571 2009-04-20 10:37:07Z batt $ - * - * \author Daniele Basile - */ - -#ifndef CFG_SER_H -#define CFG_SER_H - -/** - * Example of setting for serial port and - * spi port. - * Edit these define for your project. - */ - -/// [bytes] Size of the outbound FIFO buffer for port 0. -#define CONFIG_UART0_TXBUFSIZE 32 - -/// [bytes] Size of the inbound FIFO buffer for port 0. -#define CONFIG_UART0_RXBUFSIZE 32 - -/// [bytes] Size of the outbound FIFO buffer for port 1. -#define CONFIG_UART1_TXBUFSIZE 32 - -/// [bytes] Size of the inbound FIFO buffer for port 1. -#define CONFIG_UART1_RXBUFSIZE 32 - - -/// [bytes] Size of the outbound FIFO buffer for SPI port (AVR only) -#define CONFIG_SPI_TXBUFSIZE 32 - -/// [bytes] Size of the inbound FIFO buffer for SPI port (AVR only) -#define CONFIG_SPI_RXBUFSIZE 32 - -/// [bytes] Size of the outbound FIFO buffer for SPI port 0. -#define CONFIG_SPI0_TXBUFSIZE 32 - -/// [bytes] Size of the inbound FIFO buffer for SPI port 0. -#define CONFIG_SPI0_RXBUFSIZE 32 - -/// [bytes] Size of the outbound FIFO buffer for SPI port 1. -#define CONFIG_SPI1_TXBUFSIZE 32 - -/// [bytes] Size of the inbound FIFO buffer for SPI port 1. -#define CONFIG_SPI1_RXBUFSIZE 32 - -/// SPI data order (AVR only). -#define CONFIG_SPI_DATA_ORDER SER_MSB_FIRST - -/// SPI clock division factor (AVR only). -#define CONFIG_SPI_CLOCK_DIV 16 - -/// SPI clock polarity: 0 = normal low, 1 = normal high (AVR only). -#define CONFIG_SPI_CLOCK_POL 0 - -/// SPI clock phase: 0 = sample on first edge, 1 = sample on second clock edge (AVR only). -#define CONFIG_SPI_CLOCK_PHASE 0 - -/// Default transmit timeout (ms). Set to -1 to disable timeout support. -#define CONFIG_SER_TXTIMEOUT -1 - -/// Default receive timeout (ms). Set to -1 to disable timeout support. -#define CONFIG_SER_RXTIMEOUT -1 - -/// Use RTS/CTS handshake -#define CONFIG_SER_HWHANDSHAKE 0 - -/// Default baud rate (set to 0 to disable). -#define CONFIG_SER_DEFBAUDRATE 0 - -/// For serial debug. -#define CONFIG_SER_STROBE 0 - -#endif /* CFG_SER_H */ diff --git a/examples/at91sam7x/cfg/cfg_signal.h b/examples/at91sam7x/cfg/cfg_signal.h deleted file mode 100644 index 86feb726..00000000 --- a/examples/at91sam7x/cfg/cfg_signal.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * \file - * - * - * \brief Kernel signals configuration parameters - * - * \version $Id: cfg_signal.h 2429 2009-03-25 16:30:24Z batt $ - * \author Bernie Innocenti - */ - -#ifndef CFG_SIGNAL_H -#define CFG_SIGNAL_H - -/** - * Inter-process signals. - * $WIZ$ type = "autoenabled" - */ -#define CONFIG_KERN_SIGNALS 1 - -#endif /* CFG_SIGNAL_H */ diff --git a/examples/at91sam7x/cfg/cfg_timer.h b/examples/at91sam7x/cfg/cfg_timer.h deleted file mode 100644 index ac66befa..00000000 --- a/examples/at91sam7x/cfg/cfg_timer.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * \file - * - * - * \brief Configuration file for timer module. - * - * \version $Id: cfg_timer.h 1969 2008-12-03 16:23:56Z asterix $ - * - * \author Daniele Basile - */ - -#ifndef CFG_TIMER_H -#define CFG_TIMER_H - -/// Hardware timer selection for drv/timer.c -#define CONFIG_TIMER TIMER_DEFAULT - -/// Debug timer interrupt using a strobe pin. -#define CONFIG_TIMER_STROBE 0 - -/// Enable asynchronous timers -#define CONFIG_TIMER_EVENTS 1 - -/// Support hi-res timer_usleep() -#define CONFIG_TIMER_UDELAY 1 - -#endif /* CFG_TIMER_H */ diff --git a/examples/at91sam7x/hw/hw_ser.h b/examples/at91sam7x/hw/hw_ser.h deleted file mode 100644 index 0a87ec12..00000000 --- a/examples/at91sam7x/hw/hw_ser.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * \file - * - * - * \brief Serial hardware-specific definitions - * - * \version $Id: hw_ser.h 982 2007-11-07 16:32:20Z batt $ - * - * \author Daniele Basile - */ - - diff --git a/examples/at91sam7x/verstag.h b/examples/at91sam7x/verstag.h deleted file mode 100644 index bf43c463..00000000 --- a/examples/at91sam7x/verstag.h +++ /dev/null @@ -1,94 +0,0 @@ -/** - * \file - * - * - * \version $Id: verstag.h 1532 2008-08-04 07:21:26Z bernie $ - * - * \author Bernie Innocenti - * - * \brief Declare application version strings - */ -#ifndef DEVLIB_VERSTAG_H -#define DEVLIB_VERSTAG_H - -#ifndef ARCH_CONFIG_H - #include "cfg/arch_config.h" -#endif - -#define APP_NAME "AT91SAM7X-EK porting test" -#define APP_DESCRIPTION "AT91SAM7X-EK porting test" -#define APP_AUTHOR "Develer" -#define APP_COPYRIGHT "Copyright 2009 Develer (http://www.develer.com/)" - -#define VERS_MAJOR 0 -#define VERS_MINOR 1 -#define VERS_REV 0 -#define VERS_LETTER "" - -/** - * If _SNAPSHOT is defined, \c VERS_TAG contains the build date - * date instead of a numeric version string. - */ -//#define _SNAPSHOT - -#ifdef _DEBUG - #define VERS_DBG "D" -#else - #define VERS_DBG "" -#endif - -#define __STRINGIZE(x) #x -#define _STRINGIZE(x) __STRINGIZE(x) - -/** Build application version string (i.e.: "1.7.0") */ -#define MAKE_VERS(maj,min,rev) _STRINGIZE(maj) "." _STRINGIZE(min) "." _STRINGIZE(rev) VERS_LETTER VERS_DBG -#ifdef _SNAPSHOT - #define VERS_TAG "snapshot" " " __DATE__ " " __TIME__ " " VERS_LETTER " " VERS_DBG -#else - #define VERS_TAG MAKE_VERS(VERS_MAJOR,VERS_MINOR,VERS_REV) -#endif - -/** Build application version string suitable for MS windows resource files (i.e.: "1, 7, 0, 1") */ -#define MAKE_RCVERS(maj,min,rev,bld) _STRINGIZE(maj) ", " _STRINGIZE(min) ", " _STRINGIZE(rev) ", " _STRINGIZE(bld) -#define RCVERSION_TAG MAKE_VERS(VERS_MAJOR,VERS_MINOR,VERS_REV) - -/** The revision string (contains VERS_TAG) */ -extern const char vers_tag[]; - -/** Sequential build number (contains VERS_BUILD) */ -extern const int vers_build_nr; -//extern const char vers_build_str[]; - -/** Hostname of the machine used to build this binary (contains VERS_HOST) */ -extern const char vers_host[]; - -#endif /* DEVLIB_VERSTAG_H */