+++ /dev/null
-/*This file is prepared for Doxygen automatic documentation generation.*/\r
-/*! \file *********************************************************************\r
- *\r
- * \brief FreeRTOS demonstration for AVR32 UC3.\r
- *\r
- * - Compiler: IAR EWAVR32 and GNU GCC for AVR32\r
- * - Supported devices: All AVR32 devices can be used.\r
- * - AppNote:\r
- *\r
- * \author Atmel Corporation: http://www.atmel.com \n\r
- * Support and FAQ: http://support.atmel.no/\r
- *\r
- ******************************************************************************/\r
-\r
-/* Copyright (c) 2007, Atmel Corporation All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions are met:\r
- *\r
- * 1. Redistributions of source code must retain the above copyright notice,\r
- * this list of conditions and the following disclaimer.\r
- *\r
- * 2. Redistributions in binary form must reproduce the above copyright notice,\r
- * this list of conditions and the following disclaimer in the documentation\r
- * and/or other materials provided with the distribution.\r
- *\r
- * 3. The name of ATMEL may not be used to endorse or promote products derived\r
- * from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED\r
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND\r
- * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,\r
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\r
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
- */\r
-\r
-\r
-#ifndef FREERTOS_CONFIG_H\r
-#define FREERTOS_CONFIG_H\r
-\r
-#include "board.h"\r
-\r
-\r
-/*-----------------------------------------------------------\r
- * Application specific definitions.\r
- *\r
- * These definitions should be adjusted for your particular hardware and\r
- * application requirements.\r
- *\r
- * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE\r
- * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. \r
- *\r
- * See http://www.freertos.org/a00110.html.\r
- *----------------------------------------------------------*/\r
-\r
-#define configUSE_PREEMPTION 1\r
-#define configUSE_IDLE_HOOK 0\r
-#define configUSE_TICK_HOOK 0\r
-#define configCPU_CLOCK_HZ ( FOSC0 ) /* Hz clk gen */\r
-#define configPBA_CLOCK_HZ ( FOSC0 )\r
-#define configTICK_RATE_HZ ( ( portTickType ) 1000 )\r
-#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 8 )\r
-#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )\r
-/* configTOTAL_HEAP_SIZE is not used when heap_3.c is used. */\r
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 1024*25 ) )\r
-#define configMAX_TASK_NAME_LEN ( 16 )\r
-#define configUSE_TRACE_FACILITY 0\r
-#define configUSE_16_BIT_TICKS 0\r
-#define configIDLE_SHOULD_YIELD 1\r
-\r
-/* Co-routine definitions. */\r
-#define configUSE_CO_ROUTINES 0\r
-#define configMAX_CO_ROUTINE_PRIORITIES ( 0 )\r
-\r
-/* Set the following definitions to 1 to include the API function, or zero\r
-to exclude the API function. */\r
-\r
-#define INCLUDE_vTaskPrioritySet 1\r
-#define INCLUDE_uxTaskPriorityGet 1\r
-#define INCLUDE_vTaskDelete 1\r
-#define INCLUDE_vTaskCleanUpResources 0\r
-#define INCLUDE_vTaskSuspend 1\r
-#define INCLUDE_vTaskDelayUntil 1\r
-#define INCLUDE_vTaskDelay 1\r
-#define INCLUDE_xTaskGetCurrentTaskHandle 0\r
-#define INCLUDE_xTaskGetSchedulerState 1\r
-\r
-/* configTICK_USE_TC is a boolean indicating whether to use a Timer Counter\r
- for the tick generation. Timer Counter will generate an accurate Tick;\r
- otherwise the CPU will generate a tick but with time drift.\r
- configTICK_TC_CHANNEL is the TC channel. */\r
-#define configTICK_USE_TC 1\r
-#define configTICK_TC_CHANNEL 2\r
-\r
-/* configHEAP_INIT is a boolean indicating whether to initialize the heap with\r
- 0xA5 in order to be able to determine the maximal heap consumption. */\r
-#define configHEAP_INIT 0\r
-\r
-/* Debug trace configuration.\r
- configDBG is a boolean indicating whether to activate the debug trace. */\r
-#if BOARD == EVK1100\r
-#define configDBG 1\r
-#define configDBG_USART (&AVR32_USART1)\r
-#define configDBG_USART_RX_PIN AVR32_USART1_RXD_0_PIN\r
-#define configDBG_USART_RX_FUNCTION AVR32_USART1_RXD_0_FUNCTION\r
-#define configDBG_USART_TX_PIN AVR32_USART1_TXD_0_PIN\r
-#define configDBG_USART_TX_FUNCTION AVR32_USART1_TXD_0_FUNCTION\r
-#define configDBG_USART_BAUDRATE 57600\r
-#define serialPORT_USART (&AVR32_USART0)\r
-#define serialPORT_USART_RX_PIN AVR32_USART0_RXD_0_PIN\r
-#define serialPORT_USART_RX_FUNCTION AVR32_USART0_RXD_0_FUNCTION\r
-#define serialPORT_USART_TX_PIN AVR32_USART0_TXD_0_PIN\r
-#define serialPORT_USART_TX_FUNCTION AVR32_USART0_TXD_0_FUNCTION\r
-#define serialPORT_USART_IRQ AVR32_USART0_IRQ\r
-#define serialPORT_USART_BAUDRATE 57600\r
-#elif BOARD == EVK1101\r
-#define configDBG 1\r
-#define configDBG_USART (&AVR32_USART1)\r
-#define configDBG_USART_RX_PIN AVR32_USART1_RXD_0_0_PIN\r
-#define configDBG_USART_RX_FUNCTION AVR32_USART1_RXD_0_0_FUNCTION\r
-#define configDBG_USART_TX_PIN AVR32_USART1_TXD_0_0_PIN\r
-#define configDBG_USART_TX_FUNCTION AVR32_USART1_TXD_0_0_FUNCTION\r
-#define configDBG_USART_BAUDRATE 57600\r
-#define serialPORT_USART (&AVR32_USART1)\r
-#define serialPORT_USART_RX_PIN AVR32_USART1_RXD_0_0_PIN\r
-#define serialPORT_USART_RX_FUNCTION AVR32_USART1_RXD_0_0_FUNCTION\r
-#define serialPORT_USART_TX_PIN AVR32_USART1_TXD_0_0_PIN\r
-#define serialPORT_USART_TX_FUNCTION AVR32_USART1_TXD_0_0_FUNCTION\r
-#define serialPORT_USART_IRQ AVR32_USART1_IRQ\r
-#define serialPORT_USART_BAUDRATE 57600\r
-#endif\r
-\r
-\r
-#endif /* FREERTOS_CONFIG_H */\r
+++ /dev/null
-/*This file is prepared for Doxygen automatic documentation generation.*/\r
-/*! \file *********************************************************************\r
- *\r
- * \brief FreeRTOS application example for AVR32 UC3.\r
- *\r
- * - Compiler: IAR EWAVR32 and GNU GCC for AVR32\r
- * - Supported devices: All AVR32 devices can be used.\r
- * - AppNote:\r
- *\r
- * \author Atmel Corporation: http://www.atmel.com \n\r
- * Support and FAQ: http://support.atmel.no/\r
- *\r
- ******************************************************************************/\r
-\r
-/*! \mainpage\r
- * \section intro Introduction\r
- *\r
- * This is the documentation for the data structures, functions, variables,\r
- * defines, enums, and typedefs for the FreeRTOS application.\r
- *\r
- * \image html freertos.gif\r
- *\r
- * FreeRTOS.orgTM is a portable, open source, mini Real Time Kernel - a\r
- * free to download and royalty free RTOS that can be used in commercial\r
- * applications (see license text). This site shows how a complete embedded\r
- * real time system can be created from a Windows host using quality open\r
- * source development tools (where available). See the FreeRTOS.org features\r
- * summary.\r
- * Highlights include:\r
- * - Free RTOS kernel - preemptive, cooperative and hybrid configuration options.\r
- * - Designed to be small, simple and easy to use.\r
- * - Very portable code structure predominantly written in C.\r
- * - Supports both tasks and co-routines.\r
- * - No software restriction on the number of tasks that can be created.\r
- * - No software restriction on the number of priorities that can be used.\r
- * - No restrictions imposed on priority assignment - more than one task can be assigned the same priority.\r
- * - Queues and semaphores for communication and synchronisation between tasks, or between tasks and interrupts.\r
- * - Free embedded software source code.\r
- * - Royalty free.\r
- * - Cross development from a standard Windows host.\r
- * - Pre-configured demo applications for selected single board computers allowing 'out of the box' operation and fast learning curve.\r
- * - Compile time configuration allows small FLASH footprint\r
- * - The SafeRTOS derivative product provides a high level of confidence in the code integrity.\r
- *\r
- * \section files Main Files\r
- * - main.c : FreeRTOS example\r
- *\r
- * \section compilinfo Compilation Information\r
- * This software is written for GNU GCC for AVR32 and for IAR Embedded Workbench\r
- * for Atmel AVR32. Other compilers may or may not work.\r
- *\r
- * \section deviceinfo Device Information\r
- * All AVR32 devices can be used.\r
- *\r
- * \section configinfo Configuration Information\r
- * This example has been tested with the following configuration:\r
- * - EVK1100 evaluation kit;\r
- * - CPU clock: 12 MHz;\r
- * - USART0 connected to a PC serial port via a standard RS232 DB9 cable;\r
- * - PC terminal settings:\r
- * - 57600 bps,\r
- * - 8 data bits,\r
- * - no parity bit,\r
- * - 1 stop bit,\r
- * - no flow control.\r
- *\r
- * \section contactinfo Contact Information\r
- * For further information, visit\r
- * <A href="http://www.atmel.com/products/AVR32/" >Atmel AVR32</A>. and\r
- * <A href="http://www.freertos.org/" >FreeRTOS home page</A>.\n\r
- * Support and FAQ: http://support.atmel.no/\r
- */\r
+++ /dev/null
-# Doxyfile 1.4.7
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "AVR32 UC3 - FreeRTOS Real Time Kernel"
-PROJECT_NUMBER =
-OUTPUT_DIRECTORY =
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = YES
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = YES
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = YES
-INHERIT_DOCS = YES
-SEPARATE_MEMBER_PAGES = NO
-TAB_SIZE = 4
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = YES
-OPTIMIZE_OUTPUT_JAVA = NO
-BUILTIN_STL_SUPPORT = NO
-DISTRIBUTE_GROUP_DOC = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = YES
-CASE_SENSE_NAMES = YES
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = YES
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = NO
-SHOW_DIRECTORIES = NO
-FILE_VERSION_FILTER =
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = YES
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_NO_PARAMDOC = NO
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ./ ./../../Source ./../Common/include ./../Common/Minimal
-FILE_PATTERNS = *.c \
- *.h
-RECURSIVE = YES
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH = ./
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = YES
-INLINE_SOURCES = YES
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-REFERENCES_LINK_SOURCE = YES
-USE_HTAGS = NO
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = DOC
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = YES
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = RTF
-COMPACT_RTF = NO
-RTF_HYPERLINKS = YES
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = YES
-EXPAND_ONLY_PREDEF = YES
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED = __GNUC__=4 \
- __attribute__()= \
- __AVR32__=1 \
- __AVR32_UC3A0512__=1 \
- __AVR32_ABI_COMPILER__ \
- BOARD=EVK1100
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = NO
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = NO
-CLASS_GRAPH = NO
-COLLABORATION_GRAPH = NO
-GROUP_GRAPHS = NO
-UML_LOOK = YES
-TEMPLATE_RELATIONS = YES
-INCLUDE_GRAPH = NO
-INCLUDED_BY_GRAPH = NO
-CALL_GRAPH = NO
-CALLER_GRAPH = NO
-GRAPHICAL_HIERARCHY = NO
-DIRECTORY_GRAPH = NO
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 0
-DOT_TRANSPARENT = NO
-DOT_MULTI_TARGETS = NO
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
+++ /dev/null
-/*This file has been prepared for Doxygen automatic documentation generation.*/\r
-/*! \file *********************************************************************\r
- *\r
- * \brief FreeRTOS Real Time Kernel example.\r
- *\r
- * Creates all the demo application tasks, then starts the scheduler. The WEB\r
- * documentation provides more details of the demo application tasks.\r
- *\r
- * Main. c also creates a task called "Check". This only executes every three\r
- * seconds but has the highest priority so is guaranteed to get processor time.\r
- * Its main function is to check that all the other tasks are still operational.\r
- * Each task that does not flash an LED maintains a unique count that is\r
- * incremented each time the task successfully completes its function. Should\r
- * any error occur within such a task the count is permanently halted. The\r
- * check task inspects the count of each task to ensure it has changed since\r
- * the last time the check task executed. If all the count variables have\r
- * changed all the tasks are still executing error free, and the check task\r
- * toggles an LED. Should any task contain an error at any time the LED toggle\r
- * will stop.\r
- *\r
- * The LED flash and communications test tasks do not maintain a count.\r
- *\r
- * - Compiler: IAR EWAVR32 and GNU GCC for AVR32\r
- * - Supported devices: All AVR32 devices with GPIO.\r
- * - AppNote:\r
- *\r
- * \author Atmel Corporation: http://www.atmel.com \n\r
- * Support and FAQ: http://support.atmel.no/\r
- *\r
- *****************************************************************************/\r
-\r
-/*\r
- FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.\r
-\r
- ***************************************************************************\r
- * *\r
- * If you are: *\r
- * *\r
- * + New to FreeRTOS, *\r
- * + Wanting to learn FreeRTOS or multitasking in general quickly *\r
- * + Looking for basic training, *\r
- * + Wanting to improve your FreeRTOS skills and productivity *\r
- * *\r
- * then take a look at the FreeRTOS eBook *\r
- * *\r
- * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *\r
- * http://www.FreeRTOS.org/Documentation *\r
- * *\r
- * A pdf reference manual is also available. Both are usually delivered *\r
- * to your inbox within 20 minutes to two hours when purchased between 8am *\r
- * and 8pm GMT (although please allow up to 24 hours in case of *\r
- * exceptional circumstances). Thank you for your support! *\r
- * *\r
- ***************************************************************************\r
-\r
- This file is part of the FreeRTOS distribution.\r
-\r
- FreeRTOS is free software; you can redistribute it and/or modify it under\r
- the terms of the GNU General Public License (version 2) as published by the\r
- Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
- ***NOTE*** The exception to the GPL is included to allow you to distribute\r
- a combined work that includes FreeRTOS without being obliged to provide the\r
- source code for proprietary components outside of the FreeRTOS kernel.\r
- FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
- more details. You should have received a copy of the GNU General Public \r
- License and the FreeRTOS license exception along with FreeRTOS; if not it \r
- can be viewed here: http://www.freertos.org/a00114.html and also obtained \r
- by writing to Richard Barry, contact details for whom are available on the\r
- FreeRTOS WEB site.\r
-\r
- 1 tab == 4 spaces!\r
-\r
- http://www.FreeRTOS.org - Documentation, latest information, license and\r
- contact details.\r
-\r
- http://www.SafeRTOS.com - A version that is certified for use in safety\r
- critical systems.\r
-\r
- http://www.OpenRTOS.com - Commercial support, development, porting,\r
- licensing and training services.\r
-*/\r
-\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-\r
-/* Environment header files. */\r
-#include "pm.h"\r
-\r
-/* Scheduler header files. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-\r
-/* Demo file headers. */\r
-#include "partest.h"\r
-#include "serial.h"\r
-#include "integer.h"\r
-#include "comtest.h"\r
-#include "flash.h"\r
-#include "PollQ.h"\r
-#include "semtest.h"\r
-#include "dynamic.h"\r
-#include "BlockQ.h"\r
-#include "death.h"\r
-#include "flop.h"\r
-\r
-/*! \name Priority definitions for most of the tasks in the demo application.\r
- * Some tasks just use the idle priority.\r
- */\r
-//! @{\r
-#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
-#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
-#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
-#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
-#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 3 )\r
-#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 )\r
-#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )\r
-//! @}\r
-\r
-//! Baud rate used by the serial port tasks.\r
-#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 57600 )\r
-\r
-//! LED used by the serial port tasks. This is toggled on each character Tx,\r
-//! and mainCOM_TEST_LED + 1 is toggled on each character Rx.\r
-#define mainCOM_TEST_LED ( 3 )\r
-\r
-//! LED that is toggled by the check task. The check task periodically checks\r
-//! that all the other tasks are operating without error. If no errors are found\r
-//! the LED is toggled. If an error is found at any time the LED toggles faster.\r
-#define mainCHECK_TASK_LED ( 6 )\r
-\r
-//! LED that is set upon error.\r
-#define mainERROR_LED ( 7 )\r
-\r
-//! The period between executions of the check task.\r
-#define mainCHECK_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS )\r
-\r
-//! If an error is detected in a task, the vErrorChecks task will enter in an\r
-//! infinite loop flashing the LED at this rate.\r
-#define mainERROR_FLASH_RATE ( (portTickType) 500 / portTICK_RATE_MS )\r
-\r
-/*! \name Constants used by the vMemCheckTask() task.\r
- */\r
-//! @{\r
-#define mainCOUNT_INITIAL_VALUE ( ( unsigned portLONG ) 0 )\r
-#define mainNO_TASK ( 0 )\r
-//! @}\r
-\r
-/*! \name The size of the memory blocks allocated by the vMemCheckTask() task.\r
- */\r
-//! @{\r
-#define mainMEM_CHECK_SIZE_1 ( ( size_t ) 51 )\r
-#define mainMEM_CHECK_SIZE_2 ( ( size_t ) 52 )\r
-#define mainMEM_CHECK_SIZE_3 ( ( size_t ) 15 )\r
-//! @}\r
-\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
- * The task that executes at the highest priority and calls\r
- * prvCheckOtherTasksAreStillRunning(). See the description at the top\r
- * of the file.\r
- */\r
-static void vErrorChecks( void *pvParameters );\r
-\r
-/*\r
- * Checks that all the demo application tasks are still executing without error\r
- * - as described at the top of the file.\r
- */\r
-static portBASE_TYPE prvCheckOtherTasksAreStillRunning( void );\r
-\r
-/*\r
- * A task that exercises the memory allocator.\r
- */\r
-static void vMemCheckTask( void *pvParameters );\r
-\r
-/*\r
- * Called by the check task following the detection of an error to set the\r
- * LEDs into a state that shows an error has beeen found.\r
- */\r
-static void prvIndicateError( void );\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-int main( void )\r
-{\r
- /* Start the crystal oscillator 0 and switch the main clock to it. */\r
- pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);\r
-\r
- portDBG_TRACE("Starting the FreeRTOS AVR32 UC3 Demo...");\r
-\r
- /* Setup the LED's for output. */\r
- vParTestInitialise();\r
-\r
- /* Start the standard demo tasks. See the WEB documentation for more\r
- information. */\r
- vStartLEDFlashTasks( mainLED_TASK_PRIORITY );\r
- vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
- vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
- vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
- vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
- vStartDynamicPriorityTasks();\r
- vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
- vStartMathTasks( tskIDLE_PRIORITY );\r
-\r
- /* Start the demo tasks defined within this file, specifically the check\r
- task as described at the top of this file. */\r
- xTaskCreate(\r
- vErrorChecks\r
- , (const signed portCHAR *)"ErrCheck"\r
- , configMINIMAL_STACK_SIZE\r
- , NULL\r
- , mainCHECK_TASK_PRIORITY\r
- , NULL );\r
-\r
- /* Start the scheduler. */\r
- vTaskStartScheduler();\r
-\r
- /* Will only get here if there was insufficient memory to create the idle\r
- task. */\r
-\r
- return 0;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/*!\r
- * \brief The task function for the "Check" task.\r
- */\r
-static void vErrorChecks( void *pvParameters )\r
-{\r
-static volatile unsigned portLONG ulDummyVariable = 3UL;\r
-unsigned portLONG ulMemCheckTaskRunningCount;\r
-xTaskHandle xCreatedTask;\r
-portBASE_TYPE bSuicidalTask = 0;\r
-\r
- /* The parameters are not used. Prevent compiler warnings. */\r
- ( void ) pvParameters;\r
-\r
- /* Cycle for ever, delaying then checking all the other tasks are still\r
- operating without error.\r
-\r
- In addition to the standard tests the memory allocator is tested through\r
- the dynamic creation and deletion of a task each cycle. Each time the\r
- task is created memory must be allocated for its stack. When the task is\r
- deleted this memory is returned to the heap. If the task cannot be created\r
- then it is likely that the memory allocation failed. */\r
-\r
- for( ;; )\r
- {\r
- /* Do this only once. */\r
- if( bSuicidalTask == 0 )\r
- {\r
- bSuicidalTask++;\r
-\r
- /* This task has to be created last as it keeps account of the number of\r
- tasks it expects to see running. However its implementation expects\r
- to be called before vTaskStartScheduler(). We're in the case here where\r
- vTaskStartScheduler() has already been called (thus the hidden IDLE task\r
- has already been spawned). Since vCreateSuicidalTask() supposes that the\r
- IDLE task isn't included in the response from uxTaskGetNumberOfTasks(),\r
- let the MEM_CHECK task play that role. => this is why vCreateSuicidalTasks()\r
- is not called as the last task. */\r
- vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
- }\r
-\r
- /* Reset xCreatedTask. This is modified by the task about to be\r
- created so we can tell if it is executing correctly or not. */\r
- xCreatedTask = mainNO_TASK;\r
-\r
- /* Dynamically create a task - passing ulMemCheckTaskRunningCount as a\r
- parameter. */\r
- ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE;\r
-\r
- if( xTaskCreate( vMemCheckTask,\r
- ( signed portCHAR * ) "MEM_CHECK",\r
- configMINIMAL_STACK_SIZE,\r
- ( void * ) &ulMemCheckTaskRunningCount,\r
- tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS )\r
- {\r
- /* Could not create the task - we have probably run out of heap.\r
- Don't go any further and flash the LED faster to provide visual\r
- feedback of the error. */\r
- prvIndicateError();\r
- }\r
-\r
- /* Delay until it is time to execute again. */\r
- vTaskDelay( mainCHECK_PERIOD );\r
-\r
- /* Delete the dynamically created task. */\r
- if( xCreatedTask != mainNO_TASK )\r
- {\r
- vTaskDelete( xCreatedTask );\r
- }\r
-\r
- /* Perform a bit of 32bit maths to ensure the registers used by the\r
- integer tasks get some exercise. The result here is not important -\r
- see the demo application documentation for more info. */\r
- ulDummyVariable *= 3;\r
-\r
- /* Check all other tasks are still operating without error.\r
- Check that vMemCheckTask did increment the counter. */\r
- if( ( prvCheckOtherTasksAreStillRunning() != pdFALSE )\r
- || ( ulMemCheckTaskRunningCount == mainCOUNT_INITIAL_VALUE ) )\r
- {\r
- /* An error has occurred in one of the tasks.\r
- Don't go any further and flash the LED faster to give visual\r
- feedback of the error. */\r
- prvIndicateError();\r
- }\r
- else\r
- {\r
- /* Toggle the LED if everything is okay. */\r
- vParTestToggleLED( mainCHECK_TASK_LED );\r
- }\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-\r
-/*!\r
- * \brief Checks that all the demo application tasks are still executing without error.\r
- */\r
-static portBASE_TYPE prvCheckOtherTasksAreStillRunning( void )\r
-{\r
-static portBASE_TYPE xErrorHasOccurred = pdFALSE;\r
-\r
- if( xAreComTestTasksStillRunning() != pdTRUE )\r
- {\r
- xErrorHasOccurred = pdTRUE;\r
- }\r
-\r
- if( xArePollingQueuesStillRunning() != pdTRUE )\r
- {\r
- xErrorHasOccurred = pdTRUE;\r
- }\r
-\r
- if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
- {\r
- xErrorHasOccurred = pdTRUE;\r
- }\r
-\r
- if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
- {\r
- xErrorHasOccurred = pdTRUE;\r
- }\r
-\r
- if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
- {\r
- xErrorHasOccurred = pdTRUE;\r
- }\r
-\r
- if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
- {\r
- xErrorHasOccurred = pdTRUE;\r
- }\r
-\r
- if( xAreMathsTaskStillRunning() != pdTRUE )\r
- {\r
- xErrorHasOccurred = pdTRUE;\r
- }\r
-\r
- if( xIsCreateTaskStillRunning() != pdTRUE )\r
- {\r
- xErrorHasOccurred = pdTRUE;\r
- }\r
-\r
- return ( xErrorHasOccurred );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-\r
-/*!\r
- * \brief Dynamically created and deleted during each cycle of the vErrorChecks()\r
- * task. This is done to check the operation of the memory allocator.\r
- * See the top of vErrorChecks for more details.\r
- *\r
- * \param *pvParameters Parameters for the task (can be of any kind)\r
- */\r
-static void vMemCheckTask( void *pvParameters )\r
-{\r
-unsigned portLONG *pulMemCheckTaskRunningCounter;\r
-void *pvMem1, *pvMem2, *pvMem3;\r
-static portLONG lErrorOccurred = pdFALSE;\r
-\r
- /* This task is dynamically created then deleted during each cycle of the\r
- vErrorChecks task to check the operation of the memory allocator. Each time\r
- the task is created memory is allocated for the stack and TCB. Each time\r
- the task is deleted this memory is returned to the heap. This task itself\r
- exercises the allocator by allocating and freeing blocks.\r
-\r
- The task executes at the idle priority so does not require a delay.\r
-\r
- pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the\r
- vErrorChecks() task that this task is still executing without error. */\r
-\r
- pulMemCheckTaskRunningCounter = ( unsigned portLONG * ) pvParameters;\r
-\r
- for( ;; )\r
- {\r
- if( lErrorOccurred == pdFALSE )\r
- {\r
- /* We have never seen an error so increment the counter. */\r
- ( *pulMemCheckTaskRunningCounter )++;\r
- }\r
- else\r
- {\r
- /* There has been an error so reset the counter so the check task\r
- can tell that an error occurred. */\r
- *pulMemCheckTaskRunningCounter = mainCOUNT_INITIAL_VALUE;\r
- }\r
-\r
- /* Allocate some memory - just to give the allocator some extra\r
- exercise. This has to be in a critical section to ensure the\r
- task does not get deleted while it has memory allocated. */\r
-\r
- vTaskSuspendAll();\r
- {\r
- pvMem1 = pvPortMalloc( mainMEM_CHECK_SIZE_1 );\r
-\r
- if( pvMem1 == NULL )\r
- {\r
- lErrorOccurred = pdTRUE;\r
- }\r
- else\r
- {\r
- memset( pvMem1, 0xaa, mainMEM_CHECK_SIZE_1 );\r
- vPortFree( pvMem1 );\r
- }\r
- }\r
- xTaskResumeAll();\r
-\r
- /* Again - with a different size block. */\r
- vTaskSuspendAll();\r
- {\r
- pvMem2 = pvPortMalloc( mainMEM_CHECK_SIZE_2 );\r
-\r
- if( pvMem2 == NULL )\r
- {\r
- lErrorOccurred = pdTRUE;\r
- }\r
- else\r
- {\r
- memset( pvMem2, 0xaa, mainMEM_CHECK_SIZE_2 );\r
- vPortFree( pvMem2 );\r
- }\r
- }\r
- xTaskResumeAll();\r
-\r
- /* Again - with a different size block. */\r
- vTaskSuspendAll();\r
- {\r
- pvMem3 = pvPortMalloc( mainMEM_CHECK_SIZE_3 );\r
- if( pvMem3 == NULL )\r
- {\r
- lErrorOccurred = pdTRUE;\r
- }\r
- else\r
- {\r
- memset( pvMem3, 0xaa, mainMEM_CHECK_SIZE_3 );\r
- vPortFree( pvMem3 );\r
- }\r
- }\r
- xTaskResumeAll();\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvIndicateError( void )\r
-{\r
- /* The check task has found an error in one of the other tasks.\r
- Set the LEDs to a state that indicates this. */\r
- vParTestSetLED(mainERROR_LED,pdTRUE);\r
-\r
- for(;;)\r
- {\r
- #if( BOARD==EVK1100 )\r
- vParTestToggleLED( mainCHECK_TASK_LED );\r
- vTaskDelay( mainERROR_FLASH_RATE );\r
- #endif\r
- #if ( BOARD==EVK1101 )\r
- vParTestSetLED( 0, pdTRUE );\r
- vParTestSetLED( 1, pdTRUE );\r
- vParTestSetLED( 2, pdTRUE );\r
- vParTestSetLED( 3, pdTRUE );\r
- #endif\r
- }\r
-}\r
-\r