mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2026-08-21 07:18:22 +08:00
Demo code only:
Add the IntQ standard test to the SAM4S project.
This commit is contained in:
@@ -47,6 +47,7 @@ IF EXIST src\asf\thirdparty\FreeRTOS Goto END
|
||||
copy %COMMON_SOURCE%\countsem.c src\Common-Demo-Source
|
||||
copy %COMMON_SOURCE%\integer.c src\Common-Demo-Source
|
||||
copy %COMMON_SOURCE%\QueueSet.c src\Common-Demo-Source
|
||||
COPY %COMMON_SOURCE%\IntQueue.c src\Common-Demo-Source
|
||||
|
||||
REM Copy the common demo file headers.
|
||||
copy %COMMON_INCLUDE%\*.h src\Common-Demo-Source\include
|
||||
|
||||
@@ -6,10 +6,13 @@ EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
Release|ARM = Release|ARM
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3D8959CD-73CA-4147-9C1B-CFCF2EE40326}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{3D8959CD-73CA-4147-9C1B-CFCF2EE40326}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{3D8959CD-73CA-4147-9C1B-CFCF2EE40326}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{3D8959CD-73CA-4147-9C1B-CFCF2EE40326}.Release|ARM.Build.0 = Release|ARM
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -131,6 +131,7 @@ to exclude the API function. */
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
|
||||
/* Cortex-M specific definitions. */
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
FreeRTOS V8.1.1 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
|
||||
FreeRTOS 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. Full license text is available from the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*
|
||||
* Provides the two timers sources for the standard demo IntQueue test. Also
|
||||
* includes a high frequency timer to maximise the interrupt nesting achieved.
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <limits.h>
|
||||
|
||||
/* Scheduler includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* Demo includes. */
|
||||
#include "IntQueueTimer.h"
|
||||
#include "IntQueue.h"
|
||||
|
||||
/* System includes. */
|
||||
#include "board.h"
|
||||
#include "asf.h"
|
||||
|
||||
/* The frequencies at which the first two timers expire are slightly offset to
|
||||
ensure they don't remain synchronised. The frequency of the highest priority
|
||||
interrupt is 20 times faster so really hammers the interrupt entry and exit
|
||||
code. */
|
||||
#define tmrTIMER_0_FREQUENCY ( 2000UL )
|
||||
#define tmrTIMER_1_FREQUENCY ( 1003UL )
|
||||
#define tmrTIMER_2_FREQUENCY ( 20000UL )
|
||||
|
||||
/* Priorities used by the timer interrupts - these are set differently to make
|
||||
nesting likely/common. The high frequency timer operates above the max
|
||||
system call interrupt priority, but does not use the RTOS API. */
|
||||
#define tmrTIMER_0_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||
#define tmrTIMER_1_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1 )
|
||||
#define tmrTIMER_2_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY - 1 )
|
||||
|
||||
/* The channels used within the TC0 timer. */
|
||||
#define tmrTIMER_0_CHANNEL ( 0 )
|
||||
#define tmrTIMER_1_CHANNEL ( 1 )
|
||||
#define tmrTIMER_2_CHANNEL ( 2 )
|
||||
|
||||
/* TC register bit specifics. */
|
||||
#define tmrTRIGGER_ON_RC ( 1UL << 4UL )
|
||||
#define trmDIVIDER ( 128 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Handers for the timer interrupts. */
|
||||
void TC0_Handler( void );
|
||||
void TC1_Handler( void );
|
||||
void TC2_Handler( void );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Incremented by the high frequency timer, which operates above the max
|
||||
syscall interrupt priority. This is just for inspection. */
|
||||
volatile uint32_t ulHighFrequencyTimerInterrupts = 0;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vInitialiseTimerForIntQueueTest( void )
|
||||
{
|
||||
uint32_t ulInputFrequency;
|
||||
|
||||
/* Calculate the frequency of the clock that feeds the TC. */
|
||||
ulInputFrequency = configCPU_CLOCK_HZ;
|
||||
ulInputFrequency /= trmDIVIDER;
|
||||
|
||||
/* Three channels are used - two that run at or under
|
||||
configMAX_SYSCALL_INTERRUPT_PRIORITY, and one that runs over
|
||||
configMAX_SYSCALL_INTERRUPT_PRIORITY. */
|
||||
sysclk_enable_peripheral_clock( ID_TC0 );
|
||||
sysclk_enable_peripheral_clock( ID_TC1 );
|
||||
sysclk_enable_peripheral_clock( ID_TC2 );
|
||||
|
||||
/* Init TC channels to waveform mode - up mode clean on RC match. */
|
||||
tc_init( TC0, tmrTIMER_0_CHANNEL, TC_CMR_TCCLKS_TIMER_CLOCK4 | TC_CMR_WAVE | TC_CMR_ACPC_CLEAR | TC_CMR_CPCTRG );
|
||||
tc_init( TC0, tmrTIMER_1_CHANNEL, TC_CMR_TCCLKS_TIMER_CLOCK4 | TC_CMR_WAVE | TC_CMR_ACPC_CLEAR | TC_CMR_CPCTRG );
|
||||
tc_init( TC0, tmrTIMER_2_CHANNEL, TC_CMR_TCCLKS_TIMER_CLOCK4 | TC_CMR_WAVE | TC_CMR_ACPC_CLEAR | TC_CMR_CPCTRG );
|
||||
|
||||
tc_enable_interrupt( TC0, tmrTIMER_0_CHANNEL, tmrTRIGGER_ON_RC );
|
||||
tc_enable_interrupt( TC0, tmrTIMER_1_CHANNEL, tmrTRIGGER_ON_RC );
|
||||
tc_enable_interrupt( TC0, tmrTIMER_2_CHANNEL, tmrTRIGGER_ON_RC );
|
||||
|
||||
tc_write_rc( TC0, tmrTIMER_0_CHANNEL, ( ulInputFrequency / tmrTIMER_0_FREQUENCY ) );
|
||||
tc_write_rc( TC0, tmrTIMER_1_CHANNEL, ( ulInputFrequency / tmrTIMER_1_FREQUENCY ) );
|
||||
tc_write_rc( TC0, tmrTIMER_2_CHANNEL, ( ulInputFrequency / tmrTIMER_2_FREQUENCY ) );
|
||||
|
||||
NVIC_SetPriority( TC0_IRQn, tmrTIMER_0_PRIORITY );
|
||||
NVIC_SetPriority( TC1_IRQn, tmrTIMER_1_PRIORITY );
|
||||
NVIC_SetPriority( TC2_IRQn, tmrTIMER_2_PRIORITY );
|
||||
|
||||
NVIC_EnableIRQ( TC0_IRQn );
|
||||
NVIC_EnableIRQ( TC1_IRQn );
|
||||
NVIC_EnableIRQ( TC2_IRQn );
|
||||
|
||||
tc_start( TC0, tmrTIMER_0_CHANNEL );
|
||||
tc_start( TC0, tmrTIMER_1_CHANNEL );
|
||||
tc_start( TC0, tmrTIMER_2_CHANNEL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void TC0_Handler( void )
|
||||
{
|
||||
/* Handler for the first timer in the IntQueue test. Was the interrupt
|
||||
caused by a compare on RC? */
|
||||
if( ( tc_get_status( TC0, tmrTIMER_0_CHANNEL ) & ~TC_SR_CPCS ) != 0 )
|
||||
{
|
||||
portYIELD_FROM_ISR( xFirstTimerHandler() );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void TC1_Handler( void )
|
||||
{
|
||||
/* Handler for the second timer in the IntQueue test. Was the interrupt
|
||||
caused by a compare on RC? */
|
||||
if( ( tc_get_status( TC0, tmrTIMER_1_CHANNEL ) & ~TC_SR_CPCS ) != 0 )
|
||||
{
|
||||
portYIELD_FROM_ISR( xSecondTimerHandler() );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void TC2_Handler( void )
|
||||
{
|
||||
/* Handler for the high frequency timer that does nothing but increment a
|
||||
variable to give an indication that it is running. Was the interrupt caused
|
||||
by a compare on RC? */
|
||||
if( ( tc_get_status( TC0, tmrTIMER_2_CHANNEL ) & ~TC_SR_CPCS ) != 0 )
|
||||
{
|
||||
ulHighFrequencyTimerInterrupts++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
FreeRTOS V8.1.1 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
|
||||
FreeRTOS 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. Full license text is available from the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef INT_QUEUE_TIMER_H
|
||||
#define INT_QUEUE_TIMER_H
|
||||
|
||||
void vInitialiseTimerForIntQueueTest( void );
|
||||
BaseType_t xTimer0Handler( void );
|
||||
BaseType_t xTimer1Handler( void );
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,54 +1,56 @@
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Autogenerated API include file for the Atmel Software Framework (ASF)
|
||||
*
|
||||
* Copyright (c) 2012 Atmel Corporation. All rights reserved.
|
||||
*
|
||||
* \asf_license_start
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of Atmel may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software may only be redistributed and used in connection with an
|
||||
* Atmel microcontroller product.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* \asf_license_stop
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ASF_H
|
||||
#define ASF_H
|
||||
|
||||
/*
|
||||
* This file includes all API header files for the selected drivers from ASF.
|
||||
* Note: There might be duplicate includes required by more than one driver.
|
||||
*
|
||||
* The file is automatically generated and will be re-written when
|
||||
* running the ASF driver selector tool. Any changes will be discarded.
|
||||
*/
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Autogenerated API include file for the Atmel Software Framework (ASF)
|
||||
*
|
||||
* Copyright (c) 2012 Atmel Corporation. All rights reserved.
|
||||
*
|
||||
* \asf_license_start
|
||||
*
|
||||
* \page License
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of Atmel may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software may only be redistributed and used in connection with an
|
||||
* Atmel microcontroller product.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* \asf_license_stop
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ASF_H
|
||||
#define ASF_H
|
||||
|
||||
/*
|
||||
* This file includes all API header files for the selected drivers from ASF.
|
||||
* Note: There might be duplicate includes required by more than one driver.
|
||||
*
|
||||
* The file is automatically generated and will be re-written when
|
||||
* running the ASF driver selector tool. Any changes will be discarded.
|
||||
*/
|
||||
|
||||
// From module: Common SAM compiler driver
|
||||
#include <compiler.h>
|
||||
@@ -60,21 +62,32 @@
|
||||
// From module: Generic board support
|
||||
#include <board.h>
|
||||
|
||||
// From module: Interrupt management - SAM3 implementation
|
||||
// From module: Interrupt management - SAM implementation
|
||||
#include <interrupt.h>
|
||||
|
||||
// From module: PIO - Parallel Input/Output Controller
|
||||
#include <pio.h>
|
||||
#include <pio_handler.h>
|
||||
|
||||
// From module: PMC - Power Management Controller
|
||||
#include <pmc.h>
|
||||
#include <sleep.h>
|
||||
|
||||
// From module: Part identification macros
|
||||
#include <parts.h>
|
||||
|
||||
// From module: SAM4S startup code
|
||||
#include <exceptions.h>
|
||||
|
||||
// From module: System Clock Control - SAM4S implementation
|
||||
#include <sysclk.h>
|
||||
|
||||
// From module: TC - Timer Counter
|
||||
#include <tc.h>
|
||||
|
||||
// From module: USART - Univ. Syn Async Rec/Trans
|
||||
#include <usart.h>
|
||||
|
||||
#endif // ASF_H
|
||||
|
||||
// From module: pio_handler support enabled
|
||||
#include <pio_handler.h>
|
||||
|
||||
#endif // ASF_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,113 @@
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Timer Counter (TC) driver for SAM.
|
||||
*
|
||||
* Copyright (c) 2011-2012 Atmel Corporation. All rights reserved.
|
||||
*
|
||||
* \asf_license_start
|
||||
*
|
||||
* \page License
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of Atmel may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software may only be redistributed and used in connection with an
|
||||
* Atmel microcontroller product.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* \asf_license_stop
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TC_H_INCLUDED
|
||||
#define TC_H_INCLUDED
|
||||
|
||||
#include "compiler.h"
|
||||
|
||||
/// @cond 0
|
||||
/**INDENT-OFF**/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/**INDENT-ON**/
|
||||
/// @endcond
|
||||
|
||||
void tc_init(Tc *p_tc, uint32_t ul_Channel, uint32_t ul_Mode);
|
||||
void tc_sync_trigger(Tc *p_tc);
|
||||
void tc_set_block_mode(Tc *p_tc, uint32_t ul_blockmode);
|
||||
|
||||
#if (!SAM3U)
|
||||
uint32_t tc_init_2bit_gray(Tc *p_tc, uint32_t ul_channel,
|
||||
uint32_t ul_steppermode);
|
||||
#endif
|
||||
|
||||
void tc_start(Tc *p_tc, uint32_t ul_channel);
|
||||
void tc_stop(Tc *p_tc, uint32_t ul_channel);
|
||||
|
||||
int tc_read_ra(Tc *p_tc, uint32_t ul_channel);
|
||||
int tc_read_rb(Tc *p_tc, uint32_t ul_channel);
|
||||
int tc_read_rc(Tc *p_tc, uint32_t ul_channel);
|
||||
|
||||
void tc_write_ra(Tc *p_tc, uint32_t ul_channel,
|
||||
uint32_t ul_value);
|
||||
void tc_write_rb(Tc *p_tc, uint32_t ul_channel,
|
||||
uint32_t ul_value);
|
||||
void tc_write_rc(Tc *p_tc, uint32_t ul_channel,
|
||||
uint32_t ul_value);
|
||||
|
||||
uint32_t tc_find_mck_divisor(uint32_t ul_freq, uint32_t ul_mck,
|
||||
uint32_t *p_uldiv, uint32_t *ul_tcclks, uint32_t ul_boardmck);
|
||||
void tc_enable_interrupt(Tc *p_tc, uint32_t ul_channel,
|
||||
uint32_t ul_sources);
|
||||
void tc_disable_interrupt(Tc *p_tc, uint32_t ul_channel,
|
||||
uint32_t ul_sources);
|
||||
uint32_t tc_get_interrupt_mask(Tc *p_tc, uint32_t ul_channel);
|
||||
uint32_t tc_get_status(Tc *p_tc, uint32_t ul_channel);
|
||||
#if (!SAM4L)
|
||||
void tc_enable_qdec_interrupt(Tc *p_tc, uint32_t ul_sources);
|
||||
void tc_disable_qdec_interrupt(Tc *p_tc, uint32_t ul_sources);
|
||||
uint32_t tc_get_qdec_interrupt_mask(Tc *p_tc);
|
||||
uint32_t tc_get_qdec_interrupt_status(Tc *p_tc);
|
||||
#endif
|
||||
|
||||
#if (!SAM3U)
|
||||
void tc_set_writeprotect(Tc *p_tc, uint32_t ul_enable);
|
||||
#endif
|
||||
|
||||
#if SAM4L
|
||||
uint32_t tc_get_feature(Tc *p_tc);
|
||||
uint32_t tc_get_version(Tc *p_tc);
|
||||
|
||||
#endif
|
||||
|
||||
/// @cond 0
|
||||
/**INDENT-OFF**/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/**INDENT-ON**/
|
||||
/// @endcond
|
||||
|
||||
#endif /* TC_H_INCLUDED */
|
||||
@@ -123,6 +123,7 @@
|
||||
#include "partest.h"
|
||||
#include "comtest2.h"
|
||||
#include "QueueSet.h"
|
||||
#include "IntQueue.h"
|
||||
|
||||
/* Atmel library includes. */
|
||||
#include "asf.h"
|
||||
@@ -180,6 +181,7 @@ TimerHandle_t xCheckTimer = NULL;
|
||||
/* Start all the other standard demo/test tasks. The have not particular
|
||||
functionality, but do demonstrate how to use the FreeRTOS API and test the
|
||||
kernel port. */
|
||||
vStartInterruptQueueTasks();
|
||||
vStartIntegerMathTasks( tskIDLE_PRIORITY );
|
||||
vStartDynamicPriorityTasks();
|
||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||
@@ -232,6 +234,11 @@ unsigned long ulErrorFound = pdFALSE;
|
||||
/* Check all the demo tasks (other than the flash tasks) to ensure
|
||||
they are all still running, and that none have detected an error. */
|
||||
|
||||
if( xAreIntQueueTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorFound = pdTRUE;
|
||||
}
|
||||
|
||||
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorFound = pdTRUE;
|
||||
|
||||
Reference in New Issue
Block a user