mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-17 10:17:45 -04:00
ATmega328PB Xplained Mini -- demo project for ATmega port. (#70)
* Bootstrap a demo from START. No driver is added in this commit. * Add FreeRTOS source code to project. Remove unnecessary folder nesting. Heap_4 is used here. * Copy over main.c, FreeRTOSConfig.h, and regtest.{c, h}. This commit compiles, but will need some work on timer used. * This port has 2KB RAM. We are using 1KB for heap. Further decreasing minimum stack size, and also use stack overflow check 1 to save some stack space. * Preserve EEPROM set to false. * End of the line. * Reduce register test stack size. 32 8-bit register + 10 bytes for stack frame cost. Round up to 50. * Adding Queue test in Integer test. - g3 to easy debugging. - mainCHECK_PERIOD is set to 1000 ticks. Note that this port for now use WDT as tick timer, and period is set to 15ms. - vErrorChecks, is of highest priority. So if this task gets run before other tasks, the very first check will fail. * Avoid false alarm. Since we don't know in which order the tasks are scheduled, clearing any error for the first entry of vErrorChecks. Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> * ParTest.c to init, set, toggle onboard user LED at PB5. * Added a task to blink onboard user LED. Need a magic number for stack size. Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> * Explicitly setting timing slicing to 0. This is to avoid unecessary context switch when multiple tasks are of the same priority. Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> * Add taskYIELD() at the end of the loop in each register test task. This is to give other tasks of the same priority a chance to run, regardless of scheduling algorithm. Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> * minor, update comment in main.c.
This commit is contained in:
parent
95a3a02f95
commit
8b079bc394
37 changed files with 7079 additions and 0 deletions
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Atmel Studio Solution File, Format Version 11.00
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "RTOSDemo", "RTOSDemo\RTOSDemo.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|AVR = Debug|AVR
|
||||
Release|AVR = Release|AVR
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR
|
||||
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR
|
||||
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR
|
||||
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,35 @@
|
|||
<environment>
|
||||
<configurations>
|
||||
<configuration environment="Atmel Studio" name="Release" version="7.0.0">
|
||||
<linker-config>
|
||||
<option id="avrgcc_linker_miscellaneous_LinkerFlags" name="avrgcc-linker-miscellaneous-LinkerFlags">
|
||||
<value>
|
||||
</value>
|
||||
</option>
|
||||
</linker-config>
|
||||
<linker-script-config />
|
||||
<compiler-config>
|
||||
<option id="avrgcc_compiler_miscellaneous_OtherFlags" name="avrgcc-compiler-miscellaneous-OtherFlags">
|
||||
<value>-std=gnu99</value>
|
||||
</option>
|
||||
</compiler-config>
|
||||
</configuration>
|
||||
<configuration environment="Atmel Studio" name="Debug" version="7.0.0">
|
||||
<linker-config>
|
||||
<option id="avrgcc_linker_miscellaneous_LinkerFlags" name="avrgcc-linker-miscellaneous-LinkerFlags">
|
||||
<value>
|
||||
</value>
|
||||
</option>
|
||||
</linker-config>
|
||||
<linker-script-config />
|
||||
<compiler-config>
|
||||
<option id="avrgcc_compiler_miscellaneous_OtherFlags" name="avrgcc-compiler-miscellaneous-OtherFlags">
|
||||
<value>-std=gnu99</value>
|
||||
</option>
|
||||
</compiler-config>
|
||||
</configuration>
|
||||
</configurations>
|
||||
<device-packs>
|
||||
<device-pack device="ATmega328PB" name="ATmega_DFP" vendor="Atmel" version="1.4.331" />
|
||||
</device-packs>
|
||||
</environment>
|
|
@ -0,0 +1,73 @@
|
|||
<package xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.0" xs:noNamespaceSchemaLocation="PACK.xsd">
|
||||
<vendor>Atmel</vendor>
|
||||
<name>My Project</name>
|
||||
<description>Project generated by Atmel Start</description>
|
||||
<url>http://start.atmel.com/</url>
|
||||
<releases>
|
||||
<release version="1.0.1">Initial version</release>
|
||||
</releases>
|
||||
<taxonomy>
|
||||
<description Cclass="AtmelStart" generator="AtmelStart">Configuration Files generated by Atmel Start</description>
|
||||
</taxonomy>
|
||||
<generators>
|
||||
<generator id="AtmelStart">
|
||||
<description>Atmel Start</description>
|
||||
<select Dname="ATmega328PB" Dvendor="Atmel:3"/>
|
||||
<command>http://start.atmel.com/</command>
|
||||
<files>
|
||||
<file category="generator" name="atmel_start_config.atstart"/>
|
||||
<file attr="template" category="other" name="AtmelStart.env_conf" select="Environment configuration"/>
|
||||
</files>
|
||||
</generator>
|
||||
</generators>
|
||||
<conditions>
|
||||
<condition id="AVR Device Startup">
|
||||
<description>Dependency on Device Startup components</description>
|
||||
<require Cclass="Device" Cgroup="Startup" Cversion="1.4.0"/>
|
||||
</condition>
|
||||
<condition id="ARMCC, GCC, IAR">
|
||||
<require Dname="ATmega328PB"/>
|
||||
<accept Tcompiler="ARMCC"/>
|
||||
<accept Tcompiler="GCC"/>
|
||||
<accept Tcompiler="IAR"/>
|
||||
</condition>
|
||||
</conditions>
|
||||
<components generator="AtmelStart">
|
||||
<component Cclass="AtmelStart" Cgroup="Framework" Cversion="1.0.0" condition="AVR Device Startup">
|
||||
<description>Atmel Start Framework</description>
|
||||
<RTE_Components_h>#define ATMEL_START</RTE_Components_h>
|
||||
<files>
|
||||
<file category="source" condition="ARMCC, GCC, IAR" name="main.c"/>
|
||||
<file category="source" condition="ARMCC, GCC, IAR" name="src/driver_init.c"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="include/driver_init.h"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="include/atmel_start_pins.h"/>
|
||||
<file category="source" condition="ARMCC, GCC, IAR" name="driver_isr.c"/>
|
||||
<file category="other" condition="ARMCC, GCC, IAR" name="doxygen/mainpage.dox"/>
|
||||
<file category="other" condition="ARMCC, GCC, IAR" name="doxygen/generator/doxyfile.doxygen"/>
|
||||
<file category="other" condition="ARMCC, GCC, IAR" name="doxygen/generator/DoxygenLayout.xml"/>
|
||||
<file category="other" condition="ARMCC, GCC, IAR" name="doxygen/system.dox"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="include/port.h"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="include/protected_io.h"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="include/sysctrl.h"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="include/system.h"/>
|
||||
<file category="source" condition="ARMCC, GCC, IAR" name="src/protected_io.S"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="utils/assembler.h"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="utils/assembler/gas.h"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="utils/assembler/iar.h"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="utils/atomic.h"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="utils/compiler.h"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="utils/interrupt_avr8.h"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="utils/utils.h"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="utils/utils_assert.h"/>
|
||||
<file category="header" condition="ARMCC, GCC, IAR" name="atmel_start.h"/>
|
||||
<file category="source" condition="ARMCC, GCC, IAR" name="atmel_start.c"/>
|
||||
<file attr="config" category="header" condition="ARMCC, GCC, IAR" name="config/clock_config.h"/>
|
||||
<file category="include" condition="ARMCC, GCC, IAR" name="config"/>
|
||||
<file category="include" condition="ARMCC, GCC, IAR" name="include"/>
|
||||
<file category="include" condition="ARMCC, GCC, IAR" name="utils"/>
|
||||
<file category="include" condition="ARMCC, GCC, IAR" name="utils/assembler"/>
|
||||
<file category="include" condition="ARMCC, GCC, IAR" name=""/>
|
||||
</files>
|
||||
</component>
|
||||
</components>
|
||||
</package>
|
|
@ -0,0 +1,69 @@
|
|||
format_version: '2'
|
||||
name: My Project
|
||||
versions:
|
||||
api: '1.0'
|
||||
backend: 1.7.303
|
||||
commit: 1e07622763d149970fd8808a8f12ff3b1e84e0d7
|
||||
content: unknown
|
||||
content_pack_name: unknown
|
||||
format: '2'
|
||||
frontend: 1.7.303
|
||||
packs_version_avr8: 1.0.1410
|
||||
packs_version_qtouch: unknown
|
||||
packs_version_sam: 1.0.1554
|
||||
version_backend: 1.7.303
|
||||
version_frontend: ''
|
||||
board:
|
||||
identifier: ATmega328PBXplainedMini
|
||||
device: ATmega328PB-MU
|
||||
details: null
|
||||
application: null
|
||||
middlewares: {}
|
||||
drivers:
|
||||
CPU:
|
||||
user_label: CPU
|
||||
definition: 'Atmel:ATMega328PB_drivers:1.0.0::ATmega328PB-MU::CPU::driver_config_definition::SYSCTRL::Drivers:SYSCTRL:'
|
||||
functionality: System
|
||||
api: 'Drivers:SYSCTRL:'
|
||||
configuration:
|
||||
async_input_speed: 32768
|
||||
clkadc_oscillator: Input clock
|
||||
clkasy_oscillator: Async input clock
|
||||
clkcpu_oscillator: Input clock
|
||||
clkio_oscillator: Input clock
|
||||
clkptc_oscillator: Input clock
|
||||
cpu_clock_source: CLKcpu
|
||||
cpu_sreg_i: false
|
||||
enable_async_input: true
|
||||
enable_clkadc: true
|
||||
enable_clkasy: true
|
||||
enable_clkcpu: true
|
||||
enable_clkio: true
|
||||
enable_clkptc: true
|
||||
enable_core_clock: true
|
||||
enable_input: true
|
||||
input_speed: 8000000
|
||||
pm_ivsel: Interrupt vector placed at the beginning of main FLASH memory
|
||||
pm_pud: false
|
||||
pm_se: false
|
||||
pm_sm: Idle
|
||||
prescaler_divider: '1'
|
||||
optional_signals: []
|
||||
variant: null
|
||||
clocks:
|
||||
domain_group:
|
||||
nodes:
|
||||
- name: Core
|
||||
input: Core
|
||||
external: false
|
||||
external_frequency: 0
|
||||
configuration: {}
|
||||
pads: {}
|
||||
toolchain_options:
|
||||
- definition:
|
||||
identifier: Atmel:ATMega328PB_drivers:1.0.0::ATmega328PB-MU::environment_definition::All:Atmel.Studio:7.0.0
|
||||
configuration:
|
||||
compiler_config:
|
||||
avrgcc_compiler_miscellaneous_OtherFlags: -std=gnu99
|
||||
linker_config:
|
||||
avrgcc_linker_miscellaneous_LinkerFlags: ''
|
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Autogenerated API include file for the Atmel Configuration Management Engine (ACME)
|
||||
*
|
||||
* Copyright (c) 2012 Atmel Corporation. All rights reserved.
|
||||
*
|
||||
* \acme_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.
|
||||
*
|
||||
* \acme_license_stop
|
||||
*
|
||||
* Project: RTOSDemo
|
||||
* Target: ATmega328PB
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
#ifndef RTE_COMPONENTS_H
|
||||
#define RTE_COMPONENTS_H
|
||||
|
||||
|
||||
#define ATMEL_START
|
||||
|
||||
#endif /* RTE_COMPONENTS_H */
|
|
@ -0,0 +1,13 @@
|
|||
/* Auto-generated config file clock_config.h */
|
||||
#ifndef CLOCK_CONFIG_H
|
||||
#define CLOCK_CONFIG_H
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
|
||||
#ifndef F_CPU
|
||||
#define F_CPU 8000000
|
||||
#endif
|
||||
|
||||
// <<< end of configuration section >>>
|
||||
|
||||
#endif // CLOCK_CONFIG_H
|
|
@ -0,0 +1,435 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Configurations xmlns:i="http://www.w3.org/2001/XMLSchema-instance" z:Id="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" xmlns="DefaultValues">
|
||||
<Configurations>
|
||||
<Configuration z:Id="i2">
|
||||
<Compiler_dictionary xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>DebugLevel</d4p1:Key>
|
||||
<d4p1:Value>None</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>IncludePaths</d4p1:Key>
|
||||
<d4p1:Value>NDEBUG</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>MiscellaneousSettings</d4p1:Key>
|
||||
<d4p1:Value>-std=gnu99</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>OptimizationLevel</d4p1:Key>
|
||||
<d4p1:Value>Optimize for size (-Os)</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>SymbolDefines</d4p1:Key>
|
||||
<d4p1:Value>NDEBUG</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>SymbolUndefines</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>Verbose</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>WarningsAsErrors</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.general.CLanguageExp</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.general.SubroutinesFunctionPrologues</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.general.ChangeSPWithoutDisablingInterrupts</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.preprocessor.DoNotSearchSystemDirectories</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.preprocessor.PreprocessOnly</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.OtherFlags</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.PrepareFunctionsForGarbageCollection</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.PrepareDataForGarbageCollection</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.PackStructureMembers</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.AllocateBytesNeededForEnum</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.UseShortCalls</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.RelaxBranches</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.OtherDebuggingFlags</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.AllWarnings</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.ExtraWarnings</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.Undefined</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.CheckSyntaxOnly</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.Pedantic</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.PedanticWarningsAsErrors</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.InhibitAllWarnings</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.miscellaneous.Device</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.miscellaneous.CompileOnly</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.miscellaneous.SupportAnsiPrograms</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.miscellaneous.DoNotDeleteTemporaryFiles</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.miscellaneous.MakeFileDependent</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
</Compiler_dictionary>
|
||||
<Linker_dictionary xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>Libraries</d4p1:Key>
|
||||
<d4p1:Value>libm</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>LibrarySearchPath</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>MiscellaneousSettings</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.DoNotUseStandardStartFiles</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.DoNotUseDefaultLibraries</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.NoStartupOrDefaultLibs</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.OmitAllSymbolInformation</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.NoSharedLibraries</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.GenerateMAPFile</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.UseVprintfLibrary</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.optimization.GarbageCollectUnusedSections</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.optimization.PutReadOnlyDataInWritableDataSection</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.optimization.RelaxBranches</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.memorysettings.InitialStack</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.memorysettings.Flash</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.memorysettings.Sram</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.memorysettings.Eeprom</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
</Linker_dictionary>
|
||||
<Name>Release</Name>
|
||||
</Configuration>
|
||||
<Configuration z:Id="i3">
|
||||
<Compiler_dictionary xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>DebugLevel</d4p1:Key>
|
||||
<d4p1:Value>Default (-g2)</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>IncludePaths</d4p1:Key>
|
||||
<d4p1:Value>DEBUG</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>MiscellaneousSettings</d4p1:Key>
|
||||
<d4p1:Value>-std=gnu99</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>OptimizationLevel</d4p1:Key>
|
||||
<d4p1:Value>Optimize (-O1)</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>SymbolDefines</d4p1:Key>
|
||||
<d4p1:Value>DEBUG</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>SymbolUndefines</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>Verbose</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>WarningsAsErrors</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.general.CLanguageExp</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.general.SubroutinesFunctionPrologues</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.general.ChangeSPWithoutDisablingInterrupts</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.preprocessor.DoNotSearchSystemDirectories</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.preprocessor.PreprocessOnly</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.OtherFlags</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.PrepareFunctionsForGarbageCollection</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.PrepareDataForGarbageCollection</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.PackStructureMembers</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.AllocateBytesNeededForEnum</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.UseShortCalls</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.RelaxBranches</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.optimization.OtherDebuggingFlags</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.AllWarnings</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.ExtraWarnings</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.Undefined</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.CheckSyntaxOnly</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.Pedantic</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.PedanticWarningsAsErrors</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.warnings.InhibitAllWarnings</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.miscellaneous.Device</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.miscellaneous.CompileOnly</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.miscellaneous.SupportAnsiPrograms</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.miscellaneous.DoNotDeleteTemporaryFiles</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.compiler.miscellaneous.MakeFileDependent</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
</Compiler_dictionary>
|
||||
<Linker_dictionary xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>Libraries</d4p1:Key>
|
||||
<d4p1:Value>libm</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>LibrarySearchPath</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>MiscellaneousSettings</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.DoNotUseStandardStartFiles</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.DoNotUseDefaultLibraries</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.NoStartupOrDefaultLibs</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.OmitAllSymbolInformation</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.NoSharedLibraries</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.GenerateMAPFile</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.general.UseVprintfLibrary</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.optimization.GarbageCollectUnusedSections</d4p1:Key>
|
||||
<d4p1:Value>True</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.optimization.PutReadOnlyDataInWritableDataSection</d4p1:Key>
|
||||
<d4p1:Value>False</d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.optimization.RelaxBranches</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.memorysettings.InitialStack</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.memorysettings.Flash</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.memorysettings.Sram</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
<d4p1:KeyValueOfstringstring>
|
||||
<d4p1:Key>avrgcc.linker.memorysettings.Eeprom</d4p1:Key>
|
||||
<d4p1:Value></d4p1:Value>
|
||||
</d4p1:KeyValueOfstringstring>
|
||||
</Linker_dictionary>
|
||||
<Name>Debug</Name>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</Configurations>
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* FreeRTOS Kernel V10.3.0
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
/* Clock setting. */
|
||||
#define configCPU_CLOCK_HZ ( ( unsigned long ) 8000000 )
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
|
||||
/* FreeRTOS kernel tick data width. */
|
||||
#define configUSE_16_BIT_TICKS 1
|
||||
|
||||
/* FreeRTOS task configuration. */
|
||||
#define configMAX_PRIORITIES ( 4 )
|
||||
#define configMAX_TASK_NAME_LEN ( 8 )
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_TIME_SLICING 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
|
||||
/* FreeRTOS debugging and tracing. */
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
|
||||
/* FreeRTOS software timer. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY 2
|
||||
#define configTIMER_QUEUE_LENGTH 5
|
||||
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
|
||||
/* FreeRTOS memory allocation scheme. */
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
/* FreeRTOS memory management. */
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 90 )
|
||||
#define configTOTAL_HEAP_SIZE ( (size_t ) ( 1000 ) )
|
||||
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 1
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
|
||||
#define INCLUDE_vTaskPrioritySet 0
|
||||
#define INCLUDE_uxTaskPriorityGet 0
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 0
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* FreeRTOS Kernel V10.3.0
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "partest.h"
|
||||
|
||||
/*
|
||||
* ATmega328PB Xplained Mini board has a user LED at PB5.
|
||||
* Everything below is specific for this setup only.
|
||||
* LED is lit when PB5 is set to a high.
|
||||
*/
|
||||
#define partestLED_PORTB_DATA_REG_BIT ( (uint8_t) 0x01 << 5 )
|
||||
#define partestLED_PORTB_DIR_REG_BIT ( (uint8_t) 0x01 << 5 )
|
||||
#define partestLED_ON partestLED_PORTB_DIR_REG_BIT
|
||||
|
||||
static volatile uint8_t uCurrentLedOutputVal = ~partestLED_ON;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vParTestInitialise( void )
|
||||
{
|
||||
/* Turn on user LED. This function is not thread safe. */
|
||||
DDRB |= partestLED_PORTB_DIR_REG_BIT;
|
||||
PORTB |= partestLED_PORTB_DIR_REG_BIT;
|
||||
uCurrentLedOutputVal = ~partestLED_ON;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vParTestSetLED( UBaseType_t uxLED, BaseType_t xValue )
|
||||
{
|
||||
/* There's only one LED on this board. */
|
||||
( void ) uxLED;
|
||||
|
||||
/* Turn on user LED.
|
||||
The compound action is guaranteed to be not interrupted by other tasks. */
|
||||
vTaskSuspendAll();
|
||||
|
||||
if ( xValue == 0 )
|
||||
{
|
||||
/* Turn off, only when input value is zero. */
|
||||
DDRB |= partestLED_PORTB_DIR_REG_BIT;
|
||||
PORTB &= ~partestLED_PORTB_DIR_REG_BIT;
|
||||
uCurrentLedOutputVal = ~partestLED_ON;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Turn on, when input value is none zero. */
|
||||
DDRB |= partestLED_PORTB_DIR_REG_BIT;
|
||||
PORTB |= partestLED_PORTB_DIR_REG_BIT;
|
||||
uCurrentLedOutputVal = partestLED_ON;
|
||||
}
|
||||
|
||||
xTaskResumeAll();
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vParTestToggleLED( UBaseType_t uxLED )
|
||||
{
|
||||
/* There's only one LED on this board. */
|
||||
( void ) uxLED;
|
||||
|
||||
/* Toggle user LED.
|
||||
The compound action is guaranteed to be not interrupted by other tasks. */
|
||||
vTaskSuspendAll();
|
||||
|
||||
if ( uCurrentLedOutputVal == partestLED_ON )
|
||||
{
|
||||
/* Turn off. */
|
||||
DDRB |= partestLED_PORTB_DIR_REG_BIT;
|
||||
PORTB &= ~partestLED_PORTB_DIR_REG_BIT;
|
||||
uCurrentLedOutputVal = ~partestLED_ON;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Turn on. */
|
||||
DDRB |= partestLED_PORTB_DIR_REG_BIT;
|
||||
PORTB |= partestLED_PORTB_DIR_REG_BIT;
|
||||
uCurrentLedOutputVal = partestLED_ON;
|
||||
}
|
||||
|
||||
xTaskResumeAll();
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Store xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="AtmelPackComponentManagement">
|
||||
<ProjectComponents>
|
||||
<ProjectComponent z:Id="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
|
||||
<CApiVersion></CApiVersion>
|
||||
<CBundle></CBundle>
|
||||
<CClass>Device</CClass>
|
||||
<CGroup>Startup</CGroup>
|
||||
<CSub></CSub>
|
||||
<CVariant></CVariant>
|
||||
<CVendor>Atmel</CVendor>
|
||||
<CVersion>1.4.0</CVersion>
|
||||
<DefaultRepoPath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs</DefaultRepoPath>
|
||||
<DependentComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
|
||||
<Description></Description>
|
||||
<Files xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.4.351\include</AbsolutePath>
|
||||
<Attribute></Attribute>
|
||||
<Category>include</Category>
|
||||
<Condition>C</Condition>
|
||||
<FileContentHash i:nil="true" />
|
||||
<FileVersion></FileVersion>
|
||||
<Name>include</Name>
|
||||
<SelectString></SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.4.351\include\avr\iom328pb.h</AbsolutePath>
|
||||
<Attribute></Attribute>
|
||||
<Category>header</Category>
|
||||
<Condition>C</Condition>
|
||||
<FileContentHash>91/s55OOBrPcGEOb54C9cQ==</FileContentHash>
|
||||
<FileVersion></FileVersion>
|
||||
<Name>include/avr/iom328pb.h</Name>
|
||||
<SelectString></SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.4.351\templates\main.c</AbsolutePath>
|
||||
<Attribute>template</Attribute>
|
||||
<Category>source</Category>
|
||||
<Condition>C Exe</Condition>
|
||||
<FileContentHash>KjvOcFWd++tbnsEMfVPd/w==</FileContentHash>
|
||||
<FileVersion></FileVersion>
|
||||
<Name>templates/main.c</Name>
|
||||
<SelectString>Main file (.c)</SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.4.351\templates\main.cpp</AbsolutePath>
|
||||
<Attribute>template</Attribute>
|
||||
<Category>source</Category>
|
||||
<Condition>C Exe</Condition>
|
||||
<FileContentHash>mkKaE95TOoATsuBGv6jmxg==</FileContentHash>
|
||||
<FileVersion></FileVersion>
|
||||
<Name>templates/main.cpp</Name>
|
||||
<SelectString>Main file (.cpp)</SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.4.351\gcc\dev\atmega328pb</AbsolutePath>
|
||||
<Attribute></Attribute>
|
||||
<Category>libraryPrefix</Category>
|
||||
<Condition>GCC</Condition>
|
||||
<FileContentHash i:nil="true" />
|
||||
<FileVersion></FileVersion>
|
||||
<Name>gcc/dev/atmega328pb</Name>
|
||||
<SelectString></SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
</Files>
|
||||
<PackName>ATmega_DFP</PackName>
|
||||
<PackPath>C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.4.351/Atmel.ATmega_DFP.pdsc</PackPath>
|
||||
<PackVersion>1.4.351</PackVersion>
|
||||
<PresentInProject>true</PresentInProject>
|
||||
<ReferenceConditionId>ATmega328PB</ReferenceConditionId>
|
||||
<RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
|
||||
<d4p1:string></d4p1:string>
|
||||
</RteComponents>
|
||||
<Status>Resolved</Status>
|
||||
<VersionMode>Fixed</VersionMode>
|
||||
<IsComponentInAtProject>true</IsComponentInAtProject>
|
||||
</ProjectComponent>
|
||||
</ProjectComponents>
|
||||
</Store>
|
|
@ -0,0 +1,436 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>7.0</ProjectVersion>
|
||||
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
|
||||
<ProjectGuid>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid>
|
||||
<avrdevice>ATmega328PB</avrdevice>
|
||||
<avrdeviceseries>none</avrdeviceseries>
|
||||
<OutputType>Executable</OutputType>
|
||||
<Language>C</Language>
|
||||
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
||||
<OutputFileExtension>.elf</OutputFileExtension>
|
||||
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||
<AssemblyName>RTOSDemo</AssemblyName>
|
||||
<Name>RTOSDemo</Name>
|
||||
<RootNamespace>RTOSDemo</RootNamespace>
|
||||
<ToolchainFlavour>Native</ToolchainFlavour>
|
||||
<KeepTimersRunning>true</KeepTimersRunning>
|
||||
<OverrideVtor>false</OverrideVtor>
|
||||
<CacheFlash>true</CacheFlash>
|
||||
<ProgFlashFromRam>true</ProgFlashFromRam>
|
||||
<RamSnippetAddress>0x20000000</RamSnippetAddress>
|
||||
<UncachedRange />
|
||||
<preserveEEPROM>false</preserveEEPROM>
|
||||
<OverrideVtorValue>exception_table</OverrideVtorValue>
|
||||
<BootSegment>2</BootSegment>
|
||||
<ResetRule>0</ResetRule>
|
||||
<eraseonlaunchrule>1</eraseonlaunchrule>
|
||||
<EraseKey />
|
||||
<AsfFrameworkConfig>
|
||||
<framework-data xmlns="">
|
||||
<options />
|
||||
<configurations />
|
||||
<files />
|
||||
<documentation help="" />
|
||||
<offline-documentation help="" />
|
||||
<dependencies>
|
||||
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.48.0" />
|
||||
</dependencies>
|
||||
</framework-data>
|
||||
</AsfFrameworkConfig>
|
||||
<atStartFilePath>.atmelstart\atmel_start_config.atstart</atStartFilePath>
|
||||
<GpdscFilePath>.atmelstart\AtmelStart.gpdsc</GpdscFilePath>
|
||||
<AcmeProjectConfig>
|
||||
<AcmeProjectConfig xmlns="">
|
||||
<TopLevelComponents>
|
||||
<AcmeProjectComponent IsAutoGenerated="false" CClass="AtmelStart" Cgroup="Framework" CVersion="1.0.0" />
|
||||
<AcmeProjectComponent IsAutoGenerated="false" CClass="CMSIS" Cgroup="CORE" />
|
||||
<AcmeProjectComponent IsAutoGenerated="false" CClass="Device" Cgroup="Startup" CVersion="1.4.0" />
|
||||
</TopLevelComponents>
|
||||
<AcmeActionInfos>
|
||||
<AcmeProjectActionInfo Action="File" Source="main.c" IsConfig="false" Hash="k0AH7j+BrmdFhBPzCCMptA" />
|
||||
<AcmeProjectActionInfo Action="File" Source="src/driver_init.c" IsConfig="false" Hash="qeQ0WqMZjsnF6L9FCEvMww" />
|
||||
<AcmeProjectActionInfo Action="File" Source="include/driver_init.h" IsConfig="false" Hash="0xllaI+xStXB+dxt9wajlQ" />
|
||||
<AcmeProjectActionInfo Action="File" Source="include/atmel_start_pins.h" IsConfig="false" Hash="f3YIsjuEOTfZNtPCil6buA" />
|
||||
<AcmeProjectActionInfo Action="File" Source="driver_isr.c" IsConfig="false" Hash="RPVBKpBZfVQn6i4UEJhoAQ" />
|
||||
<AcmeProjectActionInfo Action="File" Source="include/port.h" IsConfig="false" Hash="bUvfk9QRsIq0MLJHYTT8OQ" />
|
||||
<AcmeProjectActionInfo Action="File" Source="include/protected_io.h" IsConfig="false" Hash="GtWCoxY2zHZ4GTLcem4qFg" />
|
||||
<AcmeProjectActionInfo Action="File" Source="include/sysctrl.h" IsConfig="false" Hash="IkUARTtq5CXjH/ULGaOphg" />
|
||||
<AcmeProjectActionInfo Action="File" Source="include/system.h" IsConfig="false" Hash="sWTcwXpHdzy4Y1ON/P1yWQ" />
|
||||
<AcmeProjectActionInfo Action="File" Source="src/protected_io.S" IsConfig="false" Hash="xMwVxkDny+gUjOkARvQSWA" />
|
||||
<AcmeProjectActionInfo Action="File" Source="utils/assembler.h" IsConfig="false" Hash="jaaWqpCXnRJMciuXpjSfgQ" />
|
||||
<AcmeProjectActionInfo Action="File" Source="utils/assembler/gas.h" IsConfig="false" Hash="wV+34zXWOOJ7jfwQibBgLQ" />
|
||||
<AcmeProjectActionInfo Action="File" Source="utils/assembler/iar.h" IsConfig="false" Hash="re7qP3QC0FK72z2UZ4UoFg" />
|
||||
<AcmeProjectActionInfo Action="File" Source="utils/atomic.h" IsConfig="false" Hash="f/dASgnDZRhtSN3raDvdUw" />
|
||||
<AcmeProjectActionInfo Action="File" Source="utils/compiler.h" IsConfig="false" Hash="0nu900aD8XpfP0ala86h3g" />
|
||||
<AcmeProjectActionInfo Action="File" Source="utils/interrupt_avr8.h" IsConfig="false" Hash="we4I4zgUjI72u99X4E868Q" />
|
||||
<AcmeProjectActionInfo Action="File" Source="utils/utils.h" IsConfig="false" Hash="GAJR4maoUA79075ETSBiAQ" />
|
||||
<AcmeProjectActionInfo Action="File" Source="utils/utils_assert.h" IsConfig="false" Hash="lJZG/QWOeOnUhe4wcXVztA" />
|
||||
<AcmeProjectActionInfo Action="File" Source="atmel_start.h" IsConfig="false" Hash="ZPe6iT3s4OihW8t8wDF53g" />
|
||||
<AcmeProjectActionInfo Action="File" Source="atmel_start.c" IsConfig="false" Hash="1RHIE7zTtYK4DURNPUqF9w" />
|
||||
<AcmeProjectActionInfo Action="File" Source="config/clock_config.h" IsConfig="true" Hash="8qEsKlGuttlBavFalcsPNA" />
|
||||
</AcmeActionInfos>
|
||||
<NonsecureFilesInfo />
|
||||
</AcmeProjectConfig>
|
||||
</AcmeProjectConfig>
|
||||
<avrtool>com.atmel.avrdbg.tool.medbg</avrtool>
|
||||
<avrtoolserialnumber>ATML2523052700004152</avrtoolserialnumber>
|
||||
<avrdeviceexpectedsignature>0x1E9516</avrdeviceexpectedsignature>
|
||||
<com_atmel_avrdbg_tool_medbg>
|
||||
<ToolOptions>
|
||||
<InterfaceProperties>
|
||||
</InterfaceProperties>
|
||||
<InterfaceName>debugWIRE</InterfaceName>
|
||||
</ToolOptions>
|
||||
<ToolType>com.atmel.avrdbg.tool.medbg</ToolType>
|
||||
<ToolNumber>ATML2523052700004152</ToolNumber>
|
||||
<ToolName>mEDBG</ToolName>
|
||||
</com_atmel_avrdbg_tool_medbg>
|
||||
<avrtoolinterface>debugWIRE</avrtoolinterface>
|
||||
<com_atmel_avrdbg_tool_simulator>
|
||||
<ToolOptions xmlns="">
|
||||
<InterfaceProperties>
|
||||
</InterfaceProperties>
|
||||
<InterfaceName>
|
||||
</InterfaceName>
|
||||
</ToolOptions>
|
||||
<ToolType xmlns="">com.atmel.avrdbg.tool.simulator</ToolType>
|
||||
<ToolNumber xmlns="">
|
||||
</ToolNumber>
|
||||
<ToolName xmlns="">Simulator</ToolName>
|
||||
</com_atmel_avrdbg_tool_simulator>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.Device>-mmcu=atmega328pb -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\gcc\dev\atmega328pb"</avrgcc.common.Device>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>NDEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../Config</Value>
|
||||
<Value>../include</Value>
|
||||
<Value>../utils</Value>
|
||||
<Value>../utils/assembler</Value>
|
||||
<Value>../</Value>
|
||||
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.directories.IncludePaths>
|
||||
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcc.linker.libraries.Libraries>
|
||||
<avrgcc.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../Config</Value>
|
||||
<Value>../include</Value>
|
||||
<Value>../utils</Value>
|
||||
<Value>../utils/assembler</Value>
|
||||
<Value>../</Value>
|
||||
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include</Value>
|
||||
</ListValues>
|
||||
</avrgcc.assembler.general.IncludePaths>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.Device>-mmcu=atmega328pb -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\gcc\dev\atmega328pb"</avrgcc.common.Device>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>DEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../Config</Value>
|
||||
<Value>../include</Value>
|
||||
<Value>../utils</Value>
|
||||
<Value>../utils/assembler</Value>
|
||||
<Value>../</Value>
|
||||
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include</Value>
|
||||
<Value>../../../../Source/include</Value>
|
||||
<Value>../../../../Source/portable/ThirdParty/GCC/ATmega</Value>
|
||||
<Value>../../../Common/include</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.directories.IncludePaths>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.optimization.DebugLevel>Maximum (-g3)</avrgcc.compiler.optimization.DebugLevel>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.compiler.miscellaneous.OtherFlags>-std=gnu99 -fstack-usage</avrgcc.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcc.linker.libraries.Libraries>
|
||||
<avrgcc.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../Config</Value>
|
||||
<Value>../include</Value>
|
||||
<Value>../utils</Value>
|
||||
<Value>../utils/assembler</Value>
|
||||
<Value>../</Value>
|
||||
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include</Value>
|
||||
</ListValues>
|
||||
</avrgcc.assembler.general.IncludePaths>
|
||||
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\..\Source\croutine.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\croutine.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\event_groups.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\event_groups.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\atomic.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\atomic.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\croutine.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\croutine.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\deprecated_definitions.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\deprecated_definitions.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\event_groups.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\event_groups.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\FreeRTOS.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\FreeRTOS.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\list.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\list.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\message_buffer.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\message_buffer.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\mpu_prototypes.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\mpu_prototypes.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\mpu_wrappers.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\mpu_wrappers.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\portable.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\portable.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\projdefs.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\projdefs.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\queue.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\queue.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\semphr.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\semphr.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\StackMacros.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\StackMacros.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\stack_macros.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\stack_macros.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\stream_buffer.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\stream_buffer.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\task.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\task.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\include\timers.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\include\timers.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\list.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\list.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\portable\MemMang\heap_4.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\portable\MemMang\heap_4.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\portable\ThirdParty\GCC\ATmega\port.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\portable\ATmega\port.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\portable\ThirdParty\GCC\ATmega\portmacro.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\portable\ATmega\portmacro.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\queue.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\queue.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\stream_buffer.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\stream_buffer.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\tasks.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\tasks.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\Source\timers.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>FreeRTOS\timers.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Common\Minimal\integer.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Minimal\integer.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Common\Minimal\PollQ.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Minimal\PollQ.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="atmel_start.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="atmel_start.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Config\clock_config.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Config\RTE_Components.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="driver_isr.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FreeRTOSConfig.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="include\atmel_start_pins.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="include\driver_init.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="include\port.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="include\protected_io.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="include\sysctrl.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="include\system.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="main.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ParTest.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="regtest.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="regtest.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\driver_init.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\protected_io.S">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="utils\assembler.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="utils\assembler\gas.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="utils\assembler\iar.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="utils\atomic.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="utils\compiler.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="utils\interrupt_avr8.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="utils\utils.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="utils\utils_assert.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Config\" />
|
||||
<Folder Include="doxygen\" />
|
||||
<Folder Include="doxygen\generator\" />
|
||||
<Folder Include="FreeRTOS\include" />
|
||||
<Folder Include="FreeRTOS\portable" />
|
||||
<Folder Include="FreeRTOS\portable\MemMang" />
|
||||
<Folder Include="FreeRTOS\portable\ATmega" />
|
||||
<Folder Include="include\" />
|
||||
<Folder Include="FreeRTOS" />
|
||||
<Folder Include="Minimal" />
|
||||
<Folder Include="src\" />
|
||||
<Folder Include="utils\" />
|
||||
<Folder Include="utils\assembler\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="doxygen\generator\doxyfile.doxygen">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<None Include="doxygen\generator\DoxygenLayout.xml">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<None Include="doxygen\mainpage.dox">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<None Include="doxygen\system.dox">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,9 @@
|
|||
#include <atmel_start.h>
|
||||
|
||||
/**
|
||||
* Initializes MCU, drivers and middleware in the project
|
||||
**/
|
||||
void atmel_start_init(void)
|
||||
{
|
||||
system_init();
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef ATMEL_START_H_INCLUDED
|
||||
#define ATMEL_START_H_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "include/driver_init.h"
|
||||
#include "include/atmel_start_pins.h"
|
||||
|
||||
/**
|
||||
* Initializes MCU, drivers and middleware in the project
|
||||
**/
|
||||
void atmel_start_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,188 @@
|
|||
<doxygenlayout version="1.0">
|
||||
<!-- Navigation index tabs for HTML output -->
|
||||
<navindex>
|
||||
<tab type="mainpage" visible="yes" title=""/>
|
||||
<tab type="pages" visible="yes" title="" intro=""/>
|
||||
<tab type="modules" visible="yes" title="" intro=""/>
|
||||
<tab type="namespaces" visible="yes" title="">
|
||||
<tab type="namespacelist" visible="yes" title="" intro=""/>
|
||||
<tab type="namespacemembers" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="classes" visible="no" title="">
|
||||
<tab type="classlist" visible="yes" title="" intro=""/>
|
||||
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
|
||||
<tab type="hierarchy" visible="yes" title="" intro=""/>
|
||||
<tab type="classmembers" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="files" visible="no" title="">
|
||||
<tab type="filelist" visible="yes" title="" intro=""/>
|
||||
<tab type="globals" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="dirs" visible="yes" title="" intro=""/>
|
||||
<tab type="examples" visible="yes" title="" intro=""/>
|
||||
</navindex>
|
||||
|
||||
<!-- Layout definition for a class page -->
|
||||
<class>
|
||||
<briefdescription visible="no"/>
|
||||
<detaileddescription title=""/>
|
||||
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||
<inheritancegraph visible="$CLASS_GRAPH"/>
|
||||
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
|
||||
<memberdecl>
|
||||
<nestedclasses visible="yes" title=""/>
|
||||
<publictypes title=""/>
|
||||
<publicslots title=""/>
|
||||
<signals title=""/>
|
||||
<publicmethods title=""/>
|
||||
<publicstaticmethods title=""/>
|
||||
<publicattributes title=""/>
|
||||
<publicstaticattributes title=""/>
|
||||
<protectedtypes title=""/>
|
||||
<protectedslots title=""/>
|
||||
<protectedmethods title=""/>
|
||||
<protectedstaticmethods title=""/>
|
||||
<protectedattributes title=""/>
|
||||
<protectedstaticattributes title=""/>
|
||||
<packagetypes title=""/>
|
||||
<packagemethods title=""/>
|
||||
<packagestaticmethods title=""/>
|
||||
<packageattributes title=""/>
|
||||
<packagestaticattributes title=""/>
|
||||
<properties title=""/>
|
||||
<events title=""/>
|
||||
<privatetypes title=""/>
|
||||
<privateslots title=""/>
|
||||
<privatemethods title=""/>
|
||||
<privatestaticmethods title=""/>
|
||||
<privateattributes title=""/>
|
||||
<privatestaticattributes title=""/>
|
||||
<friends title=""/>
|
||||
<related title="" subtitle=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<memberdef>
|
||||
<inlineclasses title="Data Structures"/>
|
||||
<functions title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title="" visible="no"/>
|
||||
<constructors title=""/>
|
||||
<related title=""/>
|
||||
<variables title=""/>
|
||||
<properties title=""/>
|
||||
<events title=""/>
|
||||
</memberdef>
|
||||
<allmemberslink visible="yes"/>
|
||||
<usedfiles visible="$SHOW_USED_FILES"/>
|
||||
<authorsection visible="yes"/>
|
||||
</class>
|
||||
|
||||
<!-- Layout definition for a namespace page -->
|
||||
<namespace>
|
||||
<briefdescription visible="yes"/>
|
||||
<memberdecl>
|
||||
<nestednamespaces visible="yes" title=""/>
|
||||
<functions title=""/>
|
||||
<classes visible="yes" title="Data structures"/>
|
||||
<typedefs title=""/>
|
||||
<enums title="" visible="no"/>
|
||||
<variables title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<inlineclasses title="Data Structures"/>
|
||||
<functions title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title="" visible="no"/>
|
||||
<variables title=""/>
|
||||
</memberdef>
|
||||
<authorsection visible="yes"/>
|
||||
</namespace>
|
||||
|
||||
<!-- Layout definition for a file page -->
|
||||
<file>
|
||||
<briefdescription visible="yes"/>
|
||||
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||
<includegraph visible="$INCLUDE_GRAPH"/>
|
||||
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
|
||||
<sourcelink visible="yes"/>
|
||||
<memberdecl>
|
||||
<classes visible="yes" title="Data structures"/>
|
||||
<namespaces visible="yes" title=""/>
|
||||
<functions title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title="" visible="no"/>
|
||||
<variables title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<inlineclasses title="Data Structures"/>
|
||||
<functions title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title="" visible="no"/>
|
||||
<variables title=""/>
|
||||
</memberdef>
|
||||
<authorsection/>
|
||||
</file>
|
||||
|
||||
<!-- Layout definition for a group page -->
|
||||
<group>
|
||||
<briefdescription visible="no"/>
|
||||
<detaileddescription title="Module description"/>
|
||||
<groupgraph visible="$GROUP_GRAPHS"/>
|
||||
<memberdecl>
|
||||
<nestedgroups visible="yes" title=""/>
|
||||
<dirs visible="no" title=""/>
|
||||
<files visible="no" title=""/>
|
||||
<namespaces visible="yes" title=""/>
|
||||
<classes visible="yes" title="Data structures"/>
|
||||
<typedefs title="Typedefs"/>
|
||||
<defines title="Definitions"/>
|
||||
<enums title="Enumerations"/>
|
||||
<enumvalues title=""/>
|
||||
<functions title="Functions"/>
|
||||
<variables title="" visible="no"/>
|
||||
<signals title=""/>
|
||||
<publicslots title=""/>
|
||||
<protectedslots title=""/>
|
||||
<privateslots title=""/>
|
||||
<events title=""/>
|
||||
<properties title=""/>
|
||||
<friends title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<memberdef>
|
||||
<pagedocs/>
|
||||
<inlineclasses title="Data structures"/>
|
||||
<defines title="Definition Documentation"/>
|
||||
<typedefs title="Typedef Documentation"/>
|
||||
<functions title="Function Documentation"/>
|
||||
<enums title="" visible="no"/>
|
||||
<enumvalues title="" visible="no"/>
|
||||
<variables title="" visible="no"/>
|
||||
<signals title=""/>
|
||||
<publicslots title=""/>
|
||||
<protectedslots title=""/>
|
||||
<privateslots title=""/>
|
||||
<events title=""/>
|
||||
<properties title=""/>
|
||||
<friends title=""/>
|
||||
</memberdef>
|
||||
<authorsection visible="no"/>
|
||||
</group>
|
||||
|
||||
<!-- Layout definition for a directory page -->
|
||||
<directory>
|
||||
<briefdescription visible="yes"/>
|
||||
<directorygraph visible="yes"/>
|
||||
<memberdecl>
|
||||
<dirs visible="yes"/>
|
||||
<files visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
</directory>
|
||||
</doxygenlayout>
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,197 @@
|
|||
/**
|
||||
\mainpage
|
||||
|
||||
\section doc_driver_mainpage_intro Introduction
|
||||
|
||||
AVR Code is a software library containing drivers, middleware and
|
||||
applications for AVR microcontrollers. START, a web-based
|
||||
GUI, is used to generate C-code according to the user's needs.
|
||||
|
||||
In START, the user selects the device for which to generate code.
|
||||
Thereafter, the user selects the driver and middleware components
|
||||
that he wants to include in the project. As an example, the user
|
||||
may choose the device Tiny817, and add the USART and SPI driver.
|
||||
The user can use START to configure the detailed behaviour of the
|
||||
drivers, and configure the device's clock system and I/O pins.
|
||||
Finally, the user exports the project as an atzip-file, which
|
||||
can be opened in Studio or IAR Embedded Workbench. The
|
||||
project contains:
|
||||
- C and assembly files that can be compiled using the GCC
|
||||
or IAR compilers.
|
||||
- A directory with doxygen-files documenting the drivers included in the project.
|
||||
The doxygen-files can be built into a HTML-document by executing the
|
||||
command *doxygen doxyfile.doxygen* on a computer where doxygen is installed.
|
||||
The file *doxyfile.doxygen* is found in the *doxygen/generator* directory in
|
||||
the atzip-file.
|
||||
- Example code documenting the usage of the configured drivers
|
||||
|
||||
\section doc_driver_mainpage_driver_overview Driver Overview
|
||||
|
||||
After the user has selected a device to configure, he will be able
|
||||
to add and configure drivers and middleware available for that
|
||||
device. In START, drivers are grouped by functionality, such as
|
||||
SPI, USART or Timer. After adding desired functionality, such as
|
||||
SPI, the user can configure the SPI function. This includes selecting:
|
||||
|
||||
- which hardware instance to use for implementing the functionality
|
||||
- which driver to use for implementing the functionality
|
||||
|
||||
The devices may have several SPI hardware modules,
|
||||
or may implement SPI functions through other hardware modules,
|
||||
such as USART.
|
||||
|
||||
The combination of hardware and driver is given by the notation
|
||||
|
||||
Drivers:*Hardware*:*Driver_name*
|
||||
|
||||
where *Hardware* identifies the hardware the driver uses, and *Driver_name*
|
||||
is the name of the driver. An example: *Drivers:TCB:Timeout* is the *Timeout*
|
||||
driver running on an instance of timer TCB.
|
||||
|
||||
|
||||
\section doc_driver_mainpage_configuring Configuring Drivers and Middleware
|
||||
|
||||
In general, functionality such as SPI is supported through multiple drivers.
|
||||
Providing multiple drivers allows the user to select the flavor best suited to
|
||||
his application: He may choose a simple but small SPI driver if this suits his
|
||||
application, or a more complex but larger SPI driver if advanced SPI
|
||||
functionality is needed.
|
||||
|
||||
In general, each peripheral has at least the following drivers:
|
||||
- Init: Performs device initialization only, based on the
|
||||
configuration the user selected in START. No API functions other
|
||||
than init() is provided
|
||||
- Basic : Basic functionality, provides an init-function and other
|
||||
functions allowing the user to use basic functionality of the peripheral.
|
||||
The Basic drivers are intended to cover functionality commonly found on
|
||||
all hardware implementations, and are therefore very portable across
|
||||
different devices. Typical examples of basic functions for an USART is to send
|
||||
and receive bytes, either in polled or interrupt driven mode.
|
||||
|
||||
|
||||
\section doc_driver_mainpage_usage Using the generated code
|
||||
|
||||
A project exported from START contains the drivers that the user
|
||||
configured, along with a main.c-file that only initializes the drivers and
|
||||
peripherals. The user will usually have to add code to main() in main.c
|
||||
in order for the code to do something useful.
|
||||
|
||||
The example code in the examples directory can be used as a starting point in
|
||||
order to learn how to use the drivers and their API. The examples are in the form
|
||||
of functions that can be called directly from main().
|
||||
|
||||
The generated drivers may use interrupt requests to communicate with hardware.
|
||||
The user code must normally enable global interrupts (using ENABLE_INTERRUPTS())
|
||||
in order for these interrupts to be serviced. The drivers usually do not
|
||||
enable global interrupts as part of their initialization.
|
||||
|
||||
|
||||
\section doc_driver_mainpage_documentation Documentation of Drivers and Middleware
|
||||
|
||||
Drivers and middlewares are documented using Doxygen. Doxygen comments are
|
||||
embedded into the exported C-code. In addition, exported projects have
|
||||
a *doxygen* folder containing doxygen files with additional documentation.
|
||||
|
||||
The user must generate the doxygen documentation himself after exporting the
|
||||
project. This is done by going to the *doxygen/generator* directory and
|
||||
issuing the command *doxygen doxyfile.doxygen*. The doxygen application may need
|
||||
to be installed on your computer, the installer can be found on the internet.
|
||||
|
||||
\subsection doc_driver_mainpage_documentation_user Documenting user code
|
||||
|
||||
The user can use doxygen to document his own code together with the code
|
||||
generated by START. The file *doxygen/generator/doxyfile.doxygen* can
|
||||
be modified to include the user's own code in the generated documentation.
|
||||
Modify the tags *INPUT* and *FILE_PATTERNS* in the doxyfile to do this.
|
||||
Refer to the doxygen manual for more information.
|
||||
|
||||
|
||||
|
||||
\section doc_driver_mainpage_output Generated Output
|
||||
|
||||
START exports projects as an <PROJECTNAME>.atzip file. This is a regular
|
||||
zip-file which can be unzipped using standard unzip-tools. The contents
|
||||
of the atzip-file is of course dependent on the configuration done in START.
|
||||
Assume a typical project configured with PWM, SPI, TIMEOUT, TIMER and USART
|
||||
drivers. Unzipping the atzip-file, or opening it in one of the supported
|
||||
IDEs will reveal the following directory structure:
|
||||
|
||||
\code
|
||||
MyProject/
|
||||
|-- atmel_start.c *Initializes MCU, drivers and middleware*
|
||||
|-- atmel_start_config.atstart *START-internal info on configuration of the project*
|
||||
|-- AtmelStart.env_conf *START-internal info on configuration of the project*
|
||||
|-- AtmelStart.gpdsc *START-internal info on configuration of the project*
|
||||
|-- atmel_start.h *Initializes MCU, drivers and middleware*
|
||||
|-- config
|
||||
| `-- clock_config.h *Definitions regarding the configured clock system*
|
||||
|-- doxygen *Doxygen-documentation of the project*
|
||||
| |-- generator
|
||||
| | |-- doxyfile.doxygen *Doxygen configuration information*
|
||||
| | `-- DoxygenLayout.xml *Doxygen layout information*
|
||||
| |-- mainpage.dox *Doxygen-documentation of the project*
|
||||
| |-- pwm.dox *Doxygen-documentation of the project*
|
||||
| |-- pwm_basic.dox *Doxygen-documentation of the project*
|
||||
| |-- spi_basic.dox *Doxygen-documentation of the project*
|
||||
| |-- spi.dox *Doxygen-documentation of the project*
|
||||
| |-- system.dox *Doxygen-documentation of the project*
|
||||
| |-- timeout.dox *Doxygen-documentation of the project*
|
||||
| |-- timer.dox *Doxygen-documentation of the project*
|
||||
| |-- usart_basic.dox *Doxygen-documentation of the project*
|
||||
| `-- usart.dox *Doxygen-documentation of the project*
|
||||
|-- driver_isr.c *Some drivers place their Interrupt Service Routines here*
|
||||
|-- examples *Code examples demonstrating using the drivers*
|
||||
| |-- include
|
||||
| | |-- adc_basic_example.h *Example using basic ADC driver*
|
||||
| | |-- pwm_basic_example.h *Example using basic PWM driver*
|
||||
| | |-- spi_basic_example.h *Example using basic SPI driver*
|
||||
| | |-- timeout_example.h *Example using timeout driver*
|
||||
| | `-- usart_basic_example.h *Example using basic USART driver*
|
||||
| |-- src
|
||||
| | |-- adc_basic_example.c *Example using basic ADC driver*
|
||||
| | |-- pwm_basic_example.c *Example using basic PWM driver*
|
||||
| | |-- spi_basic_example.c *Example using basic SPI driver*
|
||||
| | |-- timeout_example.c *Example using timeout driver*
|
||||
| | `-- usart_basic_example.c *Example using basic USART driver*
|
||||
|-- include
|
||||
| |-- atmel_start_pins.h *API for the I/O pins configured in START*
|
||||
| |-- bod.h *API for the BOD*
|
||||
| |-- ccp.h *API for the Configuration Change Protection*
|
||||
| |-- clkctrl.h *API for the Clock Controller*
|
||||
| |-- cpuint.h *API for the Interrupt Controller*
|
||||
| |-- driver_init.h *API for initialization of drivers and middleware*
|
||||
| |-- port.h *API for general use of I/O ports*
|
||||
| |-- pwm_basic.h *API for PWM driver*
|
||||
| |-- rstctrl.h *API for Reset Controller*
|
||||
| |-- slpctrl.h *API for Sleep Controller*
|
||||
| |-- spi_basic.h *API for basic SPI driver*
|
||||
| |-- system.h *API for general system control functions*
|
||||
| |-- timeout.h *API for Timeout driver*
|
||||
| `-- usart_basic.h *API for basic USART driver*
|
||||
|-- main.c *Main application. User adds his own code here*
|
||||
|-- src
|
||||
| |-- bod.c *API for the BOD*
|
||||
| |-- ccp.S *API for the Configuration Change Protection*
|
||||
| |-- clkctrl.c *API for the Clock Controller*
|
||||
| |-- cpuint.c *API for the Interrupt Controller*
|
||||
| |-- driver_init.c *API for initialization of drivers and middleware*
|
||||
| |-- pwm_basic.c *API for PWM driver*
|
||||
| |-- slpctrl.c *API for Sleep Controller*
|
||||
| |-- spi_basic.c *API for basic SPI driver*
|
||||
| |-- timeout.c *API for Timeout driver*
|
||||
| `-- usart_basic.c *API for basic USART driver*
|
||||
`-- utils
|
||||
|-- assembler
|
||||
| |-- gas.h *GNU Assembler specifics*
|
||||
| `-- iar.h *IAR Assembler specifics*
|
||||
|-- assembler.h *Assembler abstraction layer and utilities*
|
||||
|-- atomic.h *Macros used for atomic memory access*
|
||||
|-- compiler.h *Compiler abstraction layer and utilities*
|
||||
|-- interrupt_avr8.h *Interrupt abstraction layer and utilities*
|
||||
|-- utils_assert.h *Definitions for assert*
|
||||
`-- utils.h *Various macros of general use*
|
||||
|
||||
|
||||
\endcode
|
||||
*/
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
/*------------------------------------------------------------------------*/ /**
|
||||
\defgroup doc_driver_system System drivers
|
||||
|
||||
|
||||
|
||||
\section doc_driver_system_init_basic_and_practice System Drivers
|
||||
|
||||
The system drivers controls various peripherals and systems such as
|
||||
- BOD
|
||||
- Interrupt Controller
|
||||
- Clock Controller
|
||||
- Configuration Change Protection Controller
|
||||
- Reset Controller
|
||||
- Sleep Controller
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Driver ISR.
|
||||
*
|
||||
(c) 2018 Microchip Technology Inc. and its subsidiaries.
|
||||
|
||||
Subject to your compliance with these terms,you may use this software and
|
||||
any derivatives exclusively with Microchip products.It is your responsibility
|
||||
to comply with third party license terms applicable to your use of third party
|
||||
software (including open source software) that may accompany Microchip software.
|
||||
|
||||
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
|
||||
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
|
||||
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
|
||||
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
|
||||
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
|
||||
FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
|
||||
ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by START.
|
||||
*
|
||||
* This file will be overwritten when reconfiguring your START project.
|
||||
* Please copy examples or other code you want to keep to a separate file
|
||||
* to avoid losing it when reconfiguring.
|
||||
*/
|
||||
|
||||
#include <driver_init.h>
|
||||
#include <compiler.h>
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Code generated from Atmel Start.
|
||||
*
|
||||
* This file will be overwritten when reconfiguring your Atmel Start project.
|
||||
* Please copy examples or other code you want to keep to a separate file
|
||||
* to avoid losing it when reconfiguring.
|
||||
*/
|
||||
#ifndef ATMEL_START_PINS_H_INCLUDED
|
||||
#define ATMEL_START_PINS_H_INCLUDED
|
||||
|
||||
#include <port.h>
|
||||
|
||||
#endif /* ATMEL_START_PINS_H_INCLUDED */
|
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Driver initialization.
|
||||
*
|
||||
(c) 2018 Microchip Technology Inc. and its subsidiaries.
|
||||
|
||||
Subject to your compliance with these terms,you may use this software and
|
||||
any derivatives exclusively with Microchip products.It is your responsibility
|
||||
to comply with third party license terms applicable to your use of third party
|
||||
software (including open source software) that may accompany Microchip software.
|
||||
|
||||
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
|
||||
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
|
||||
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
|
||||
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
|
||||
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
|
||||
FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
|
||||
ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by START.
|
||||
*
|
||||
* This file will be overwritten when reconfiguring your START project.
|
||||
* Please copy examples or other code you want to keep to a separate file
|
||||
* to avoid losing it when reconfiguring.
|
||||
*/
|
||||
|
||||
#ifndef DRIVER_INIT_H_INCLUDED
|
||||
#define DRIVER_INIT_H_INCLUDED
|
||||
|
||||
#include <compiler.h>
|
||||
#include <clock_config.h>
|
||||
#include <port.h>
|
||||
#include <atmel_start_pins.h>
|
||||
|
||||
#include <sysctrl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void system_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DRIVER_INIT_H_INCLUDED */
|
|
@ -0,0 +1,805 @@
|
|||
|
||||
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Tinymega Port related support
|
||||
*
|
||||
(c) 2018 Microchip Technology Inc. and its subsidiaries.
|
||||
|
||||
Subject to your compliance with these terms,you may use this software and
|
||||
any derivatives exclusively with Microchip products.It is your responsibility
|
||||
to comply with third party license terms applicable to your use of third party
|
||||
software (including open source software) that may accompany Microchip software.
|
||||
|
||||
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
|
||||
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
|
||||
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
|
||||
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
|
||||
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
|
||||
FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
|
||||
ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PORT_INCLUDED
|
||||
#define PORT_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <compiler.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <compiler.h>
|
||||
|
||||
enum port_pull_mode {
|
||||
PORT_PULL_OFF,
|
||||
PORT_PULL_UP,
|
||||
};
|
||||
|
||||
enum port_dir {
|
||||
PORT_DIR_IN,
|
||||
PORT_DIR_OUT,
|
||||
PORT_DIR_OFF,
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Set PORTB pin pull mode
|
||||
*
|
||||
* Configure pin to pull up, down or disable pull mode, supported pull
|
||||
* modes are defined by device used
|
||||
*
|
||||
* \param[in] pin The pin number in PORTB
|
||||
* \param[in] pull_mode Pin pull mode
|
||||
*/
|
||||
static inline void PORTB_set_pin_pull_mode(const uint8_t pin, const enum port_pull_mode pull_mode)
|
||||
{
|
||||
|
||||
if (pull_mode == PORT_PULL_UP) {
|
||||
|
||||
DDRB &= ~(1 << pin);
|
||||
|
||||
PORTB |= 1 << pin;
|
||||
} else if (pull_mode == PORT_PULL_OFF) {
|
||||
|
||||
PORTB &= ~(1 << pin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTB data direction
|
||||
*
|
||||
* Select if the port pins selected by mask data direction is input, output
|
||||
* or disabled.
|
||||
*
|
||||
* \param[in] mask Bit mask where 1 means apply direction setting to the
|
||||
* corresponding pin
|
||||
* \param[in] direction PORT_DIR_IN = Data direction in
|
||||
* PORT_DIR_OUT = Data direction out
|
||||
* PORT_DIR_OFF = Disables the pin
|
||||
* (low power state)
|
||||
*/
|
||||
static inline void PORTB_set_port_dir(const uint8_t mask, const enum port_dir direction)
|
||||
{
|
||||
switch (direction) {
|
||||
case PORT_DIR_IN:
|
||||
DDRB &= ~mask;
|
||||
break;
|
||||
case PORT_DIR_OUT:
|
||||
DDRB |= mask;
|
||||
break;
|
||||
case PORT_DIR_OFF:
|
||||
DDRB &= ~mask;
|
||||
|
||||
PORTB |= mask;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTB single pin data direction
|
||||
*
|
||||
* Select if the pin data direction is input, output or disabled.
|
||||
* If disabled state is not possible, this function throws an assert.
|
||||
*
|
||||
* \param[in] pin The pin number within PORTB (0..7)
|
||||
* \param[in] direction PORT_DIR_IN = Data direction in
|
||||
* PORT_DIR_OUT = Data direction out
|
||||
* PORT_DIR_OFF = Disables the pin
|
||||
* (low power state)
|
||||
*/
|
||||
static inline void PORTB_set_pin_dir(const uint8_t pin, const enum port_dir direction)
|
||||
{
|
||||
switch (direction) {
|
||||
case PORT_DIR_IN:
|
||||
DDRB &= ~(1 << pin);
|
||||
break;
|
||||
case PORT_DIR_OUT:
|
||||
DDRB |= 1 << pin;
|
||||
break;
|
||||
case PORT_DIR_OFF:
|
||||
DDRB &= ~(1 << pin);
|
||||
|
||||
PORTB |= 1 << pin;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTB level
|
||||
*
|
||||
* Sets output level on the pins defined by the bit mask
|
||||
*
|
||||
* \param[in] mask Bit mask where 1 means apply port level to the corresponding
|
||||
* pin
|
||||
* \param[in] level true = Pin levels set to "high" state
|
||||
* false = Pin levels set to "low" state
|
||||
*/
|
||||
static inline void PORTB_set_port_level(const uint8_t mask, const bool level)
|
||||
{
|
||||
if (level) {
|
||||
PORTB |= mask;
|
||||
} else {
|
||||
PORTB &= ~mask;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTB level
|
||||
*
|
||||
* Sets output level on a pin
|
||||
*
|
||||
* \param[in] pin The pin number for device
|
||||
* \param[in] level true = Pin level set to "high" state
|
||||
* false = Pin level set to "low" state
|
||||
*/
|
||||
static inline void PORTB_set_pin_level(const uint8_t pin, const bool level)
|
||||
{
|
||||
if (level) {
|
||||
PORTB |= 1 << pin;
|
||||
} else {
|
||||
PORTB &= ~(1 << pin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Toggle out level on pins
|
||||
*
|
||||
* Toggle the pin levels on pins defined by bit mask
|
||||
*
|
||||
* \param[in] port Ports are grouped into groups of maximum 32 pins,
|
||||
* PORT_PORTA = group 0, PORT_PORTB = group 1, etc
|
||||
* \param[in] mask Bit mask where 1 means toggle pin level to the corresponding
|
||||
* pin
|
||||
*/
|
||||
static inline void PORTB_toggle_port_level(const uint8_t mask)
|
||||
{
|
||||
PINB = mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Toggle output level on pin
|
||||
*
|
||||
* Toggle the pin levels on pin
|
||||
*
|
||||
* \param[in] pin The pin number for device
|
||||
*/
|
||||
static inline void PORTB_toggle_pin_level(const uint8_t pin)
|
||||
{
|
||||
PINB = 1 << pin;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get input level on pins
|
||||
*
|
||||
* Read the input level on pins connected to a port
|
||||
*
|
||||
* \param[in] port Ports are grouped into groups of maximum 32 pins,
|
||||
* PORT_PORTA = group 0, PORT_PORTB = group 1, etc
|
||||
*/
|
||||
static inline uint8_t PORTB_get_port_level(volatile uint8_t *port)
|
||||
{
|
||||
return PINB;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get level on pin
|
||||
*
|
||||
* Reads the level on a pin connected to a port
|
||||
*
|
||||
* \param[in] pin The pin number for device
|
||||
*/
|
||||
static inline bool PORTB_get_pin_level(const uint8_t pin)
|
||||
{
|
||||
return PINB & (1 << pin);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Write value to PORTB
|
||||
*
|
||||
* Write directly to the entire port register.
|
||||
*
|
||||
* \param[in] value Value to write
|
||||
*/
|
||||
static inline void PORTB_write_port(const uint8_t value)
|
||||
{
|
||||
PORTB = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTC pin pull mode
|
||||
*
|
||||
* Configure pin to pull up, down or disable pull mode, supported pull
|
||||
* modes are defined by device used
|
||||
*
|
||||
* \param[in] pin The pin number in PORTC
|
||||
* \param[in] pull_mode Pin pull mode
|
||||
*/
|
||||
static inline void PORTC_set_pin_pull_mode(const uint8_t pin, const enum port_pull_mode pull_mode)
|
||||
{
|
||||
|
||||
if (pull_mode == PORT_PULL_UP) {
|
||||
|
||||
DDRC &= ~(1 << pin);
|
||||
|
||||
PORTC |= 1 << pin;
|
||||
} else if (pull_mode == PORT_PULL_OFF) {
|
||||
|
||||
PORTC &= ~(1 << pin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTC data direction
|
||||
*
|
||||
* Select if the port pins selected by mask data direction is input, output
|
||||
* or disabled.
|
||||
*
|
||||
* \param[in] mask Bit mask where 1 means apply direction setting to the
|
||||
* corresponding pin
|
||||
* \param[in] direction PORT_DIR_IN = Data direction in
|
||||
* PORT_DIR_OUT = Data direction out
|
||||
* PORT_DIR_OFF = Disables the pin
|
||||
* (low power state)
|
||||
*/
|
||||
static inline void PORTC_set_port_dir(const uint8_t mask, const enum port_dir direction)
|
||||
{
|
||||
switch (direction) {
|
||||
case PORT_DIR_IN:
|
||||
DDRC &= ~mask;
|
||||
break;
|
||||
case PORT_DIR_OUT:
|
||||
DDRC |= mask;
|
||||
break;
|
||||
case PORT_DIR_OFF:
|
||||
DDRC &= ~mask;
|
||||
|
||||
PORTC |= mask;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTC single pin data direction
|
||||
*
|
||||
* Select if the pin data direction is input, output or disabled.
|
||||
* If disabled state is not possible, this function throws an assert.
|
||||
*
|
||||
* \param[in] pin The pin number within PORTC (0..7)
|
||||
* \param[in] direction PORT_DIR_IN = Data direction in
|
||||
* PORT_DIR_OUT = Data direction out
|
||||
* PORT_DIR_OFF = Disables the pin
|
||||
* (low power state)
|
||||
*/
|
||||
static inline void PORTC_set_pin_dir(const uint8_t pin, const enum port_dir direction)
|
||||
{
|
||||
switch (direction) {
|
||||
case PORT_DIR_IN:
|
||||
DDRC &= ~(1 << pin);
|
||||
break;
|
||||
case PORT_DIR_OUT:
|
||||
DDRC |= 1 << pin;
|
||||
break;
|
||||
case PORT_DIR_OFF:
|
||||
DDRC &= ~(1 << pin);
|
||||
|
||||
PORTC |= 1 << pin;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTC level
|
||||
*
|
||||
* Sets output level on the pins defined by the bit mask
|
||||
*
|
||||
* \param[in] mask Bit mask where 1 means apply port level to the corresponding
|
||||
* pin
|
||||
* \param[in] level true = Pin levels set to "high" state
|
||||
* false = Pin levels set to "low" state
|
||||
*/
|
||||
static inline void PORTC_set_port_level(const uint8_t mask, const bool level)
|
||||
{
|
||||
if (level) {
|
||||
PORTC |= mask;
|
||||
} else {
|
||||
PORTC &= ~mask;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTC level
|
||||
*
|
||||
* Sets output level on a pin
|
||||
*
|
||||
* \param[in] pin The pin number for device
|
||||
* \param[in] level true = Pin level set to "high" state
|
||||
* false = Pin level set to "low" state
|
||||
*/
|
||||
static inline void PORTC_set_pin_level(const uint8_t pin, const bool level)
|
||||
{
|
||||
if (level) {
|
||||
PORTC |= 1 << pin;
|
||||
} else {
|
||||
PORTC &= ~(1 << pin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Toggle out level on pins
|
||||
*
|
||||
* Toggle the pin levels on pins defined by bit mask
|
||||
*
|
||||
* \param[in] port Ports are grouped into groups of maximum 32 pins,
|
||||
* PORT_PORTA = group 0, PORT_PORTB = group 1, etc
|
||||
* \param[in] mask Bit mask where 1 means toggle pin level to the corresponding
|
||||
* pin
|
||||
*/
|
||||
static inline void PORTC_toggle_port_level(const uint8_t mask)
|
||||
{
|
||||
PINC = mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Toggle output level on pin
|
||||
*
|
||||
* Toggle the pin levels on pin
|
||||
*
|
||||
* \param[in] pin The pin number for device
|
||||
*/
|
||||
static inline void PORTC_toggle_pin_level(const uint8_t pin)
|
||||
{
|
||||
PINC = 1 << pin;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get input level on pins
|
||||
*
|
||||
* Read the input level on pins connected to a port
|
||||
*
|
||||
* \param[in] port Ports are grouped into groups of maximum 32 pins,
|
||||
* PORT_PORTA = group 0, PORT_PORTB = group 1, etc
|
||||
*/
|
||||
static inline uint8_t PORTC_get_port_level(volatile uint8_t *port)
|
||||
{
|
||||
return PINC;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get level on pin
|
||||
*
|
||||
* Reads the level on a pin connected to a port
|
||||
*
|
||||
* \param[in] pin The pin number for device
|
||||
*/
|
||||
static inline bool PORTC_get_pin_level(const uint8_t pin)
|
||||
{
|
||||
return PINC & (1 << pin);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Write value to PORTC
|
||||
*
|
||||
* Write directly to the entire port register.
|
||||
*
|
||||
* \param[in] value Value to write
|
||||
*/
|
||||
static inline void PORTC_write_port(const uint8_t value)
|
||||
{
|
||||
PORTC = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTD pin pull mode
|
||||
*
|
||||
* Configure pin to pull up, down or disable pull mode, supported pull
|
||||
* modes are defined by device used
|
||||
*
|
||||
* \param[in] pin The pin number in PORTD
|
||||
* \param[in] pull_mode Pin pull mode
|
||||
*/
|
||||
static inline void PORTD_set_pin_pull_mode(const uint8_t pin, const enum port_pull_mode pull_mode)
|
||||
{
|
||||
|
||||
if (pull_mode == PORT_PULL_UP) {
|
||||
|
||||
DDRD &= ~(1 << pin);
|
||||
|
||||
PORTD |= 1 << pin;
|
||||
} else if (pull_mode == PORT_PULL_OFF) {
|
||||
|
||||
PORTD &= ~(1 << pin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTD data direction
|
||||
*
|
||||
* Select if the port pins selected by mask data direction is input, output
|
||||
* or disabled.
|
||||
*
|
||||
* \param[in] mask Bit mask where 1 means apply direction setting to the
|
||||
* corresponding pin
|
||||
* \param[in] direction PORT_DIR_IN = Data direction in
|
||||
* PORT_DIR_OUT = Data direction out
|
||||
* PORT_DIR_OFF = Disables the pin
|
||||
* (low power state)
|
||||
*/
|
||||
static inline void PORTD_set_port_dir(const uint8_t mask, const enum port_dir direction)
|
||||
{
|
||||
switch (direction) {
|
||||
case PORT_DIR_IN:
|
||||
DDRD &= ~mask;
|
||||
break;
|
||||
case PORT_DIR_OUT:
|
||||
DDRD |= mask;
|
||||
break;
|
||||
case PORT_DIR_OFF:
|
||||
DDRD &= ~mask;
|
||||
|
||||
PORTD |= mask;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTD single pin data direction
|
||||
*
|
||||
* Select if the pin data direction is input, output or disabled.
|
||||
* If disabled state is not possible, this function throws an assert.
|
||||
*
|
||||
* \param[in] pin The pin number within PORTD (0..7)
|
||||
* \param[in] direction PORT_DIR_IN = Data direction in
|
||||
* PORT_DIR_OUT = Data direction out
|
||||
* PORT_DIR_OFF = Disables the pin
|
||||
* (low power state)
|
||||
*/
|
||||
static inline void PORTD_set_pin_dir(const uint8_t pin, const enum port_dir direction)
|
||||
{
|
||||
switch (direction) {
|
||||
case PORT_DIR_IN:
|
||||
DDRD &= ~(1 << pin);
|
||||
break;
|
||||
case PORT_DIR_OUT:
|
||||
DDRD |= 1 << pin;
|
||||
break;
|
||||
case PORT_DIR_OFF:
|
||||
DDRD &= ~(1 << pin);
|
||||
|
||||
PORTD |= 1 << pin;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTD level
|
||||
*
|
||||
* Sets output level on the pins defined by the bit mask
|
||||
*
|
||||
* \param[in] mask Bit mask where 1 means apply port level to the corresponding
|
||||
* pin
|
||||
* \param[in] level true = Pin levels set to "high" state
|
||||
* false = Pin levels set to "low" state
|
||||
*/
|
||||
static inline void PORTD_set_port_level(const uint8_t mask, const bool level)
|
||||
{
|
||||
if (level) {
|
||||
PORTD |= mask;
|
||||
} else {
|
||||
PORTD &= ~mask;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTD level
|
||||
*
|
||||
* Sets output level on a pin
|
||||
*
|
||||
* \param[in] pin The pin number for device
|
||||
* \param[in] level true = Pin level set to "high" state
|
||||
* false = Pin level set to "low" state
|
||||
*/
|
||||
static inline void PORTD_set_pin_level(const uint8_t pin, const bool level)
|
||||
{
|
||||
if (level) {
|
||||
PORTD |= 1 << pin;
|
||||
} else {
|
||||
PORTD &= ~(1 << pin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Toggle out level on pins
|
||||
*
|
||||
* Toggle the pin levels on pins defined by bit mask
|
||||
*
|
||||
* \param[in] port Ports are grouped into groups of maximum 32 pins,
|
||||
* PORT_PORTA = group 0, PORT_PORTB = group 1, etc
|
||||
* \param[in] mask Bit mask where 1 means toggle pin level to the corresponding
|
||||
* pin
|
||||
*/
|
||||
static inline void PORTD_toggle_port_level(const uint8_t mask)
|
||||
{
|
||||
PIND = mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Toggle output level on pin
|
||||
*
|
||||
* Toggle the pin levels on pin
|
||||
*
|
||||
* \param[in] pin The pin number for device
|
||||
*/
|
||||
static inline void PORTD_toggle_pin_level(const uint8_t pin)
|
||||
{
|
||||
PIND = 1 << pin;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get input level on pins
|
||||
*
|
||||
* Read the input level on pins connected to a port
|
||||
*
|
||||
* \param[in] port Ports are grouped into groups of maximum 32 pins,
|
||||
* PORT_PORTA = group 0, PORT_PORTB = group 1, etc
|
||||
*/
|
||||
static inline uint8_t PORTD_get_port_level(volatile uint8_t *port)
|
||||
{
|
||||
return PIND;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get level on pin
|
||||
*
|
||||
* Reads the level on a pin connected to a port
|
||||
*
|
||||
* \param[in] pin The pin number for device
|
||||
*/
|
||||
static inline bool PORTD_get_pin_level(const uint8_t pin)
|
||||
{
|
||||
return PIND & (1 << pin);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Write value to PORTD
|
||||
*
|
||||
* Write directly to the entire port register.
|
||||
*
|
||||
* \param[in] value Value to write
|
||||
*/
|
||||
static inline void PORTD_write_port(const uint8_t value)
|
||||
{
|
||||
PORTD = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTE pin pull mode
|
||||
*
|
||||
* Configure pin to pull up, down or disable pull mode, supported pull
|
||||
* modes are defined by device used
|
||||
*
|
||||
* \param[in] pin The pin number in PORTE
|
||||
* \param[in] pull_mode Pin pull mode
|
||||
*/
|
||||
static inline void PORTE_set_pin_pull_mode(const uint8_t pin, const enum port_pull_mode pull_mode)
|
||||
{
|
||||
|
||||
if (pull_mode == PORT_PULL_UP) {
|
||||
|
||||
DDRE &= ~(1 << pin);
|
||||
|
||||
PORTE |= 1 << pin;
|
||||
} else if (pull_mode == PORT_PULL_OFF) {
|
||||
|
||||
PORTE &= ~(1 << pin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTE data direction
|
||||
*
|
||||
* Select if the port pins selected by mask data direction is input, output
|
||||
* or disabled.
|
||||
*
|
||||
* \param[in] mask Bit mask where 1 means apply direction setting to the
|
||||
* corresponding pin
|
||||
* \param[in] direction PORT_DIR_IN = Data direction in
|
||||
* PORT_DIR_OUT = Data direction out
|
||||
* PORT_DIR_OFF = Disables the pin
|
||||
* (low power state)
|
||||
*/
|
||||
static inline void PORTE_set_port_dir(const uint8_t mask, const enum port_dir direction)
|
||||
{
|
||||
switch (direction) {
|
||||
case PORT_DIR_IN:
|
||||
DDRE &= ~mask;
|
||||
break;
|
||||
case PORT_DIR_OUT:
|
||||
DDRE |= mask;
|
||||
break;
|
||||
case PORT_DIR_OFF:
|
||||
DDRE &= ~mask;
|
||||
|
||||
PORTE |= mask;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTE single pin data direction
|
||||
*
|
||||
* Select if the pin data direction is input, output or disabled.
|
||||
* If disabled state is not possible, this function throws an assert.
|
||||
*
|
||||
* \param[in] pin The pin number within PORTE (0..7)
|
||||
* \param[in] direction PORT_DIR_IN = Data direction in
|
||||
* PORT_DIR_OUT = Data direction out
|
||||
* PORT_DIR_OFF = Disables the pin
|
||||
* (low power state)
|
||||
*/
|
||||
static inline void PORTE_set_pin_dir(const uint8_t pin, const enum port_dir direction)
|
||||
{
|
||||
switch (direction) {
|
||||
case PORT_DIR_IN:
|
||||
DDRE &= ~(1 << pin);
|
||||
break;
|
||||
case PORT_DIR_OUT:
|
||||
DDRE |= 1 << pin;
|
||||
break;
|
||||
case PORT_DIR_OFF:
|
||||
DDRE &= ~(1 << pin);
|
||||
|
||||
PORTE |= 1 << pin;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTE level
|
||||
*
|
||||
* Sets output level on the pins defined by the bit mask
|
||||
*
|
||||
* \param[in] mask Bit mask where 1 means apply port level to the corresponding
|
||||
* pin
|
||||
* \param[in] level true = Pin levels set to "high" state
|
||||
* false = Pin levels set to "low" state
|
||||
*/
|
||||
static inline void PORTE_set_port_level(const uint8_t mask, const bool level)
|
||||
{
|
||||
if (level) {
|
||||
PORTE |= mask;
|
||||
} else {
|
||||
PORTE &= ~mask;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set PORTE level
|
||||
*
|
||||
* Sets output level on a pin
|
||||
*
|
||||
* \param[in] pin The pin number for device
|
||||
* \param[in] level true = Pin level set to "high" state
|
||||
* false = Pin level set to "low" state
|
||||
*/
|
||||
static inline void PORTE_set_pin_level(const uint8_t pin, const bool level)
|
||||
{
|
||||
if (level) {
|
||||
PORTE |= 1 << pin;
|
||||
} else {
|
||||
PORTE &= ~(1 << pin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Toggle out level on pins
|
||||
*
|
||||
* Toggle the pin levels on pins defined by bit mask
|
||||
*
|
||||
* \param[in] port Ports are grouped into groups of maximum 32 pins,
|
||||
* PORT_PORTA = group 0, PORT_PORTB = group 1, etc
|
||||
* \param[in] mask Bit mask where 1 means toggle pin level to the corresponding
|
||||
* pin
|
||||
*/
|
||||
static inline void PORTE_toggle_port_level(const uint8_t mask)
|
||||
{
|
||||
PINE = mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Toggle output level on pin
|
||||
*
|
||||
* Toggle the pin levels on pin
|
||||
*
|
||||
* \param[in] pin The pin number for device
|
||||
*/
|
||||
static inline void PORTE_toggle_pin_level(const uint8_t pin)
|
||||
{
|
||||
PINE = 1 << pin;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get input level on pins
|
||||
*
|
||||
* Read the input level on pins connected to a port
|
||||
*
|
||||
* \param[in] port Ports are grouped into groups of maximum 32 pins,
|
||||
* PORT_PORTA = group 0, PORT_PORTB = group 1, etc
|
||||
*/
|
||||
static inline uint8_t PORTE_get_port_level(volatile uint8_t *port)
|
||||
{
|
||||
return PINE;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get level on pin
|
||||
*
|
||||
* Reads the level on a pin connected to a port
|
||||
*
|
||||
* \param[in] pin The pin number for device
|
||||
*/
|
||||
static inline bool PORTE_get_pin_level(const uint8_t pin)
|
||||
{
|
||||
return PINE & (1 << pin);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Write value to PORTE
|
||||
*
|
||||
* Write directly to the entire port register.
|
||||
*
|
||||
* \param[in] value Value to write
|
||||
*/
|
||||
static inline void PORTE_write_port(const uint8_t value)
|
||||
{
|
||||
PORTE = value;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PORT_INCLUDED */
|
|
@ -0,0 +1,83 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Configuration Change Protection write functions
|
||||
*
|
||||
(c) 2018 Microchip Technology Inc. and its subsidiaries.
|
||||
|
||||
Subject to your compliance with these terms,you may use this software and
|
||||
any derivatives exclusively with Microchip products.It is your responsibility
|
||||
to comply with third party license terms applicable to your use of third party
|
||||
software (including open source software) that may accompany Microchip software.
|
||||
|
||||
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
|
||||
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
|
||||
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
|
||||
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
|
||||
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
|
||||
FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
|
||||
ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PROTECTED_IO_H
|
||||
#define PROTECTED_IO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__DOXYGEN__)
|
||||
//! \name IAR Memory Model defines.
|
||||
//@{
|
||||
|
||||
/**
|
||||
* \def CONFIG_MEMORY_MODEL_TINY
|
||||
* \brief Configuration symbol to enable 8 bit pointers.
|
||||
*
|
||||
*/
|
||||
#define CONFIG_MEMORY_MODEL_TINY
|
||||
|
||||
/**
|
||||
* \def CONFIG_MEMORY_MODEL_SMALL
|
||||
* \brief Configuration symbol to enable 16 bit pointers.
|
||||
* \note If no memory model is defined, SMALL is default.
|
||||
*
|
||||
*/
|
||||
#define CONFIG_MEMORY_MODEL_SMALL
|
||||
|
||||
/**
|
||||
* \def CONFIG_MEMORY_MODEL_LARGE
|
||||
* \brief Configuration symbol to enable 24 bit pointers.
|
||||
*
|
||||
*/
|
||||
#define CONFIG_MEMORY_MODEL_LARGE
|
||||
|
||||
//@}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Write to am 8-bit I/O register protected by CCP or a protection bit
|
||||
*
|
||||
* \param addr Address of the I/O register
|
||||
* \param magic CCP magic value or Mask for protection bit
|
||||
* \param value Value to be written
|
||||
*
|
||||
* \note Using IAR Embedded workbench, the choice of memory model has an impact
|
||||
* on calling convention. The memory model is not visible to the
|
||||
* preprocessor, so it must be defined in the Assembler preprocessor directives.
|
||||
*/
|
||||
extern void protected_write_io(void *addr, uint8_t magic, uint8_t value);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PROTECTED_IO_H */
|
|
@ -0,0 +1,111 @@
|
|||
|
||||
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Sysctrl covers power management (PM), system clock (SYSCLK) and system reset functionality
|
||||
*
|
||||
(c) 2018 Microchip Technology Inc. and its subsidiaries.
|
||||
|
||||
Subject to your compliance with these terms,you may use this software and
|
||||
any derivatives exclusively with Microchip products.It is your responsibility
|
||||
to comply with third party license terms applicable to your use of third party
|
||||
software (including open source software) that may accompany Microchip software.
|
||||
|
||||
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
|
||||
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
|
||||
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
|
||||
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
|
||||
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
|
||||
FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
|
||||
ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup doc_driver_system_sysctrl System Control (PM, SYSCLK, SYSRST)
|
||||
* \ingroup doc_driver_system
|
||||
*
|
||||
* \section doc_driver_sysctrl_rev Revision History
|
||||
* - v0.0.0.1 Initial Commit
|
||||
*
|
||||
*@{
|
||||
*/
|
||||
|
||||
#ifndef SYSCTRL_H_INCLUDED
|
||||
#define SYSCTRL_H_INCLUDED
|
||||
|
||||
#include <compiler.h>
|
||||
#include <atomic.h>
|
||||
#include <protected_io.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__ICCAVR__) || defined(__DOXYGEN__)
|
||||
#include <intrinsics.h>
|
||||
//! Macro for issuing the sleep instruction.
|
||||
#define sleep_enter() __sleep()
|
||||
|
||||
/**
|
||||
* \brief Enable sleep
|
||||
*/
|
||||
static inline void sleep_enable(void)
|
||||
{
|
||||
SMCR |= (1 << SE);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Disable sleep
|
||||
*/
|
||||
static inline void sleep_disable(void)
|
||||
{
|
||||
SMCR &= ~(1 << SE);
|
||||
}
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
#include <avr/sleep.h>
|
||||
#define sleep_enter() sleep_cpu()
|
||||
|
||||
#else
|
||||
#error Unsupported compiler.
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Set sleep mode to use when entering sleep state
|
||||
*
|
||||
* \param mode Sleep mode
|
||||
*/
|
||||
static inline void sleep_set_mode(uint8_t mode)
|
||||
{
|
||||
SMCR = mode | (SMCR & ~((1 << SM0) | (1 << SM1) | (1 << SM2)));
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Initialize sysctrl interface
|
||||
*
|
||||
* \param[in] hw The pointer to hardware instance
|
||||
*
|
||||
* \return Initialization status.
|
||||
*/
|
||||
static inline int8_t sysctrl_init()
|
||||
{
|
||||
/* Set up system clock prescaler according to configuration */
|
||||
protected_write_io((void *)&CLKPR, 1 << CLKPCE, (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0));
|
||||
|
||||
SMCR = (0 << SM2) | (0 << SM1) | (0 << SM0) | // Idle
|
||||
(0 << SE);
|
||||
|
||||
MCUCR = (0 << PUD);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* SYSCTRL_H_INCLUDED */
|
|
@ -0,0 +1,74 @@
|
|||
|
||||
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Tinymega System related support
|
||||
*
|
||||
(c) 2018 Microchip Technology Inc. and its subsidiaries.
|
||||
|
||||
Subject to your compliance with these terms,you may use this software and
|
||||
any derivatives exclusively with Microchip products.It is your responsibility
|
||||
to comply with third party license terms applicable to your use of third party
|
||||
software (including open source software) that may accompany Microchip software.
|
||||
|
||||
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
|
||||
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
|
||||
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
|
||||
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
|
||||
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
|
||||
FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
|
||||
ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \addtogroup doc_driver_system
|
||||
*
|
||||
* \section doc_driver_system_rev Revision History
|
||||
* - v0.0.0.1 Initial Commit
|
||||
*
|
||||
*@{
|
||||
*/
|
||||
|
||||
#ifndef SYSTEM_INCLUDED
|
||||
#define SYSTEM_INCLUDED
|
||||
|
||||
#include "port.h"
|
||||
#include <protected_io.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MCU_RESET_CAUSE_POR (1 << PORF)
|
||||
#define MCU_RESET_CAUSE_EXT (1 << EXTRF)
|
||||
#define MCU_RESET_CAUSE_BOR (1 << BORF)
|
||||
#define MCU_RESET_CAUSE_WDT (1 << WDRF)
|
||||
|
||||
static inline void mcu_init(void)
|
||||
{
|
||||
/* On AVR devices all peripherals are enabled from power on reset, this
|
||||
* disables all peripherals to save power. Driver shall enable
|
||||
* peripheral if used */
|
||||
|
||||
PRR1 = (1 << PRTWI1) | (1 << PRTIM4) | (1 << PRSPI1) | (1 << PRPTC) | (1 << PRTIM3);
|
||||
|
||||
PRR0 = (1 << PRTIM2) | (1 << PRTIM0) | (1 << PRTIM1) | (1 << PRTWI0) | (1 << PRUSART1) | (1 << PRUSART0)
|
||||
| (1 << PRADC) | (1 << PRSPI0);
|
||||
|
||||
/* Set all pins to low power mode */
|
||||
PORTB_set_port_dir(0xff, PORT_DIR_OFF);
|
||||
PORTC_set_port_dir(0x7f, PORT_DIR_OFF);
|
||||
PORTD_set_port_dir(0xff, PORT_DIR_OFF);
|
||||
PORTE_set_port_dir(0x0f, PORT_DIR_OFF);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSTEM_INCLUDED */
|
208
FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/main.c
Normal file
208
FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/main.c
Normal file
|
@ -0,0 +1,208 @@
|
|||
/*
|
||||
* FreeRTOS Kernel V10.3.0
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#include <atmel_start.h>
|
||||
|
||||
/* Scheduler include files. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* Tests. */
|
||||
#include "regtest.h"
|
||||
#include "integer.h"
|
||||
#include "PollQ.h"
|
||||
#include "partest.h"
|
||||
|
||||
/* Priority definitions for most of the tasks in the demo application. */
|
||||
#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
||||
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainLED_BLINK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
|
||||
/* The period between executions of the check task. */
|
||||
#define mainCHECK_PERIOD ( ( TickType_t ) 1000 )
|
||||
|
||||
/* The period to toggle LED. */
|
||||
#define mainBLINK_LED_OK_HALF_PERIOD ( ( TickType_t ) 100 )
|
||||
|
||||
/* The task function for the "Check" task. */
|
||||
static void vErrorChecks( void *pvParameters );
|
||||
|
||||
/* The task function for blinking LED at a certain frequency. */
|
||||
static void vBlinkOnboardUserLED( void *pvParameters );
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* Initializes MCU, drivers and middleware.
|
||||
This is generated from Atmel START project. */
|
||||
atmel_start_init();
|
||||
|
||||
/* Standard register test. */
|
||||
vStartRegTestTasks();
|
||||
|
||||
/* Optionally enable below tests. This port only has 2KB RAM. */
|
||||
vStartIntegerMathTasks( tskIDLE_PRIORITY );
|
||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||
xTaskCreate( vBlinkOnboardUserLED, "LED", 50, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Create the tasks defined within this file. */
|
||||
xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainLED_BLINK_PRIORITY, NULL );
|
||||
|
||||
/* In this port, to use preemptive scheduler define configUSE_PREEMPTION
|
||||
as 1 in portmacro.h. To use the cooperative scheduler define
|
||||
configUSE_PREEMPTION as 0. */
|
||||
vTaskStartScheduler();
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
static void vErrorChecks( void *pvParameters )
|
||||
{
|
||||
static UBaseType_t uxErrorHasOccurred = 0;
|
||||
BaseType_t xFirstTimeCheck = pdTRUE;
|
||||
|
||||
/* The parameters are not used. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Cycle for ever, delaying then checking all the other tasks are still
|
||||
operating without error. */
|
||||
for( ;; )
|
||||
{
|
||||
if( xAreRegTestTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
uxErrorHasOccurred |= 0x01U ;
|
||||
}
|
||||
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
||||
{
|
||||
uxErrorHasOccurred |= ( 0x01U << 1);
|
||||
}
|
||||
if( xArePollingQueuesStillRunning() != pdTRUE )
|
||||
{
|
||||
uxErrorHasOccurred |= ( 0x01U << 2);
|
||||
}
|
||||
|
||||
/* When check task runs before any other tasks, all above checks shall fail.
|
||||
To avoid false alarm, clear errors upon first entry. */
|
||||
if ( xFirstTimeCheck == pdTRUE )
|
||||
{
|
||||
uxErrorHasOccurred = 0;
|
||||
xFirstTimeCheck = pdFALSE;
|
||||
}
|
||||
|
||||
/* Could set break point at below line to verify uxErrorHasOccurred. */
|
||||
vTaskDelay( mainCHECK_PERIOD );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
static void vBlinkOnboardUserLED( void *pvParameters )
|
||||
{
|
||||
/* The parameters are not used. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Cycle forever, blink onboard user LED at a certain frequency. */
|
||||
for( ;; )
|
||||
{
|
||||
vParTestToggleLED( 0 );
|
||||
|
||||
vTaskDelay( mainBLINK_LED_OK_HALF_PERIOD );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationIdleHook( void )
|
||||
{
|
||||
/* Doesn't do anything yet. */
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationStackOverflowHook( TaskHandle_t xTask, signed char *pcTaskName )
|
||||
{
|
||||
/* When stack overflow happens, trap instead of attempting to recover.
|
||||
Read input arguments to learn about the offending task. */
|
||||
for( ;; )
|
||||
{
|
||||
/* Doesn't do anything yet. */
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configSUPPORT_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
|
||||
StackType_t **ppxIdleTaskStackBuffer,
|
||||
uint32_t *pulIdleTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Idle task are declared inside this
|
||||
function then they must be declared static -- otherwise they will be allocated on
|
||||
the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
|
||||
state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
Note that, as the array is necessarily of type StackType_t,
|
||||
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer,
|
||||
StackType_t **ppxTimerTaskStackBuffer,
|
||||
uint32_t *pulTimerTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Timer task are declared inside this
|
||||
function then they must be declared static -- otherwise they will be allocated on
|
||||
the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||
task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
Note that, as the array is necessarily of type StackType_t,
|
||||
configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
|
@ -0,0 +1,421 @@
|
|||
/*
|
||||
* FreeRTOS Kernel V10.3.0
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/* Scheduler include files. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* Demo file headers. */
|
||||
#include "regtest.h"
|
||||
|
||||
/* The minimum stack size required by a register test task.
|
||||
*
|
||||
* The value should be at least the sum of:
|
||||
* - Number of bytes used to save register context.
|
||||
* Refer to port.c, r0-r31 and/or RAMPZ and/or EIND.
|
||||
* - Number of bytes used in nested function call.
|
||||
* Refer to GCC Developer Option -fstack-usage.
|
||||
*/
|
||||
#define REGTEST_MIN_STACK_SIZE ( ( unsigned short ) 50 )
|
||||
|
||||
/*
|
||||
* Test tasks that sets registers to known values, then checks to ensure the
|
||||
* values remain as expected. Test 1 and test 2 use different values.
|
||||
*/
|
||||
static void prvRegisterCheck1( void *pvParameters );
|
||||
static void prvRegisterCheck2( void *pvParameters );
|
||||
|
||||
/* Set to a none zero value should an error be found.
|
||||
* Using two variables to identify offending task and register combination.
|
||||
*/
|
||||
UBaseType_t uxRegTestError1 = 0;
|
||||
UBaseType_t uxRegTestError2 = 0;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartRegTestTasks( void )
|
||||
{
|
||||
/* Create register check tasks with lowest priority. These tasks will be
|
||||
* interrupted as much as possible by higher priority tasks. Thus if task
|
||||
* context is not restored correctly, error is more likely to be caught.
|
||||
*/
|
||||
xTaskCreate( prvRegisterCheck1, "Reg1", REGTEST_MIN_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||
xTaskCreate( prvRegisterCheck2, "Reg2", REGTEST_MIN_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
BaseType_t xAreRegTestTasksStillRunning( void )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* If a register was found to contain an unexpected value then the
|
||||
* uxRegTestError variable would have been set to a none zero value.
|
||||
*
|
||||
* This check guarantees no false positive, but does not guarantee test
|
||||
* has actually run. Could have a counter to track how many times the loop
|
||||
* has been entered and ensure that the number is monotonically incrementing.
|
||||
* And then it'll subject to integer overflow issue. To make things simple
|
||||
* straight forward, set a breakpoint at the end of the loop in prvRegisterCheck1()
|
||||
* and prvRegisterCheck2(). Make sure both can be hit.
|
||||
*/
|
||||
if( uxRegTestError1 == 0 && uxRegTestError2 == 0 )
|
||||
{
|
||||
xReturn = pdTRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvRegisterCheck1( void *pvParameters )
|
||||
{
|
||||
( void ) pvParameters;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Load register r0-r30 with known value.
|
||||
* r31 is used to first load immediate value then copy into r0-15.
|
||||
*
|
||||
* LDI Rd,K
|
||||
* Rd<--K (16 <= d <= 31, 0 <= K <= 255)
|
||||
*/
|
||||
asm( "LDI r31, 0x80" );
|
||||
asm( "MOV r0, r31" );
|
||||
asm( "LDI r31, 0x81" );
|
||||
asm( "MOV r1, r31" );
|
||||
asm( "LDI r31, 0x82" );
|
||||
asm( "MOV r2, r31" );
|
||||
asm( "LDI r31, 0x83" );
|
||||
asm( "MOV r3, r31" );
|
||||
asm( "LDI r31, 0x84" );
|
||||
asm( "MOV r4, r31" );
|
||||
asm( "LDI r31, 0x85" );
|
||||
asm( "MOV r5, r31" );
|
||||
asm( "LDI r31, 0x86" );
|
||||
asm( "MOV r6, r31" );
|
||||
asm( "LDI r31, 0x87" );
|
||||
asm( "MOV r7, r31" );
|
||||
asm( "LDI r31, 0x88" );
|
||||
asm( "MOV r8, r31" );
|
||||
asm( "LDI r31, 0x89" );
|
||||
asm( "MOV r9, r31" );
|
||||
asm( "LDI r31, 0x8A" );
|
||||
asm( "MOV r10, r31" );
|
||||
asm( "LDI r31, 0x8B" );
|
||||
asm( "MOV r11, r31" );
|
||||
asm( "LDI r31, 0x8C" );
|
||||
asm( "MOV r12, r31" );
|
||||
asm( "LDI r31, 0x8D" );
|
||||
asm( "MOV r13, r31" );
|
||||
asm( "LDI r31, 0x8E" );
|
||||
asm( "MOV r14, r31" );
|
||||
asm( "LDI r31, 0x8F" );
|
||||
asm( "MOV r15, r31" );
|
||||
asm( "LDI r16, 0x90" );
|
||||
asm( "LDI r17, 0x91" );
|
||||
asm( "LDI r18, 0x92" );
|
||||
asm( "LDI r19, 0x93" );
|
||||
asm( "LDI r20, 0x94" );
|
||||
asm( "LDI r21, 0x95" );
|
||||
asm( "LDI r22, 0x96" );
|
||||
asm( "LDI r23, 0x97" );
|
||||
asm( "LDI r24, 0x98" );
|
||||
asm( "LDI r25, 0x99" );
|
||||
asm( "LDI r26, 0x9A" );
|
||||
asm( "LDI r27, 0x9B" );
|
||||
asm( "LDI r28, 0x9C" );
|
||||
asm( "LDI r29, 0x9D" );
|
||||
asm( "LDI r30, 0x9E" );
|
||||
|
||||
/* Check whether register r0-30 still contain known good values.
|
||||
* If not, update uxRegTestError1 with the unique value.
|
||||
*/
|
||||
asm( "LDI r31, 0x80" );
|
||||
asm( "CPSE r31, r0" );
|
||||
asm( "STS uxRegTestError1, r0" );
|
||||
asm( "LDI r31, 0x81" );
|
||||
asm( "CPSE r31, r1" );
|
||||
asm( "STS uxRegTestError1, r1" );
|
||||
asm( "LDI r31, 0x82" );
|
||||
asm( "CPSE r31, r2" );
|
||||
asm( "STS uxRegTestError1, r2" );
|
||||
asm( "LDI r31, 0x83" );
|
||||
asm( "CPSE r31, r3" );
|
||||
asm( "STS uxRegTestError1, r3" );
|
||||
asm( "LDI r31, 0x84" );
|
||||
asm( "CPSE r31, r4" );
|
||||
asm( "STS uxRegTestError1, r4" );
|
||||
asm( "LDI r31, 0x85" );
|
||||
asm( "CPSE r31, r5" );
|
||||
asm( "STS uxRegTestError1, r5" );
|
||||
asm( "LDI r31, 0x86" );
|
||||
asm( "CPSE r31, r6" );
|
||||
asm( "STS uxRegTestError1, r6" );
|
||||
asm( "LDI r31, 0x87" );
|
||||
asm( "CPSE r31, r7" );
|
||||
asm( "STS uxRegTestError1, r7" );
|
||||
asm( "LDI r31, 0x88" );
|
||||
asm( "CPSE r31, r8" );
|
||||
asm( "STS uxRegTestError1, r8" );
|
||||
asm( "LDI r31, 0x89" );
|
||||
asm( "CPSE r31, r9" );
|
||||
asm( "STS uxRegTestError1, r9" );
|
||||
asm( "LDI r31, 0x8A" );
|
||||
asm( "CPSE r31, r10" );
|
||||
asm( "STS uxRegTestError1, r10" );
|
||||
asm( "LDI r31, 0x8B" );
|
||||
asm( "CPSE r31, r11" );
|
||||
asm( "STS uxRegTestError1, r11" );
|
||||
asm( "LDI r31, 0x8C" );
|
||||
asm( "CPSE r31, r12" );
|
||||
asm( "STS uxRegTestError1, r12" );
|
||||
asm( "LDI r31, 0x8D" );
|
||||
asm( "CPSE r31, r13" );
|
||||
asm( "STS uxRegTestError1, r13" );
|
||||
asm( "LDI r31, 0x8E" );
|
||||
asm( "CPSE r31, r14" );
|
||||
asm( "STS uxRegTestError1, r14" );
|
||||
asm( "LDI r31, 0x8F" );
|
||||
asm( "CPSE r31, r15" );
|
||||
asm( "STS uxRegTestError1, r15" );
|
||||
asm( "LDI r31, 0x90" );
|
||||
asm( "CPSE r31, r16" );
|
||||
asm( "STS uxRegTestError1, r16" );
|
||||
asm( "LDI r31, 0x91" );
|
||||
asm( "CPSE r31, r17" );
|
||||
asm( "STS uxRegTestError1, r17" );
|
||||
asm( "LDI r31, 0x92" );
|
||||
asm( "CPSE r31, r18" );
|
||||
asm( "STS uxRegTestError1, r18" );
|
||||
asm( "LDI r31, 0x93" );
|
||||
asm( "CPSE r31, r19" );
|
||||
asm( "STS uxRegTestError1, r19" );
|
||||
asm( "LDI r31, 0x94" );
|
||||
asm( "CPSE r31, r20" );
|
||||
asm( "STS uxRegTestError1, r20" );
|
||||
asm( "LDI r31, 0x95" );
|
||||
asm( "CPSE r31, r21" );
|
||||
asm( "STS uxRegTestError1, r21" );
|
||||
asm( "LDI r31, 0x96" );
|
||||
asm( "CPSE r31, r22" );
|
||||
asm( "STS uxRegTestError1, r22" );
|
||||
asm( "LDI r31, 0x97" );
|
||||
asm( "CPSE r31, r23" );
|
||||
asm( "STS uxRegTestError1, r23" );
|
||||
asm( "LDI r31, 0x98" );
|
||||
asm( "CPSE r31, r24" );
|
||||
asm( "STS uxRegTestError1, r24" );
|
||||
asm( "LDI r31, 0x99" );
|
||||
asm( "CPSE r31, r25" );
|
||||
asm( "STS uxRegTestError1, r25" );
|
||||
asm( "LDI r31, 0x9A" );
|
||||
asm( "CPSE r31, r26" );
|
||||
asm( "STS uxRegTestError1, r26" );
|
||||
asm( "LDI r31, 0x9B" );
|
||||
asm( "CPSE r31, r27" );
|
||||
asm( "STS uxRegTestError1, r27" );
|
||||
asm( "LDI r31, 0x9C" );
|
||||
asm( "CPSE r31, r28" );
|
||||
asm( "STS uxRegTestError1, r28" );
|
||||
asm( "LDI r31, 0x9D" );
|
||||
asm( "CPSE r31, r29" );
|
||||
asm( "STS uxRegTestError1, r29" );
|
||||
asm( "LDI r31, 0x9E" );
|
||||
asm( "CPSE r31, r30" );
|
||||
asm( "STS uxRegTestError1, r30" );
|
||||
|
||||
/* Give other tasks of the same priority a chance to run. */
|
||||
taskYIELD();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvRegisterCheck2( void *pvParameters )
|
||||
{
|
||||
( void ) pvParameters;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Load register r0-r30 with known value.
|
||||
* r31 is used to first load immediate value then copy into r0-15.
|
||||
*
|
||||
* LDI Rd,K
|
||||
* Rd<--K (16 <= d <= 31, 0 <= K <= 255)
|
||||
*/
|
||||
asm( "LDI r31, 0" );
|
||||
asm( "MOV r0, r31" );
|
||||
asm( "LDI r31, 1" );
|
||||
asm( "MOV r1, r31" );
|
||||
asm( "LDI r31, 2" );
|
||||
asm( "MOV r2, r31" );
|
||||
asm( "LDI r31, 3" );
|
||||
asm( "MOV r3, r31" );
|
||||
asm( "LDI r31, 4" );
|
||||
asm( "MOV r4, r31" );
|
||||
asm( "LDI r31, 5" );
|
||||
asm( "MOV r5, r31" );
|
||||
asm( "LDI r31, 6" );
|
||||
asm( "MOV r6, r31" );
|
||||
asm( "LDI r31, 7" );
|
||||
asm( "MOV r7, r31" );
|
||||
asm( "LDI r31, 8" );
|
||||
asm( "MOV r8, r31" );
|
||||
asm( "LDI r31, 9" );
|
||||
asm( "MOV r9, r31" );
|
||||
asm( "LDI r31, 10" );
|
||||
asm( "MOV r10, r31" );
|
||||
asm( "LDI r31, 11" );
|
||||
asm( "MOV r11, r31" );
|
||||
asm( "LDI r31, 12" );
|
||||
asm( "MOV r12, r31" );
|
||||
asm( "LDI r31, 13" );
|
||||
asm( "MOV r13, r31" );
|
||||
asm( "LDI r31, 14" );
|
||||
asm( "MOV r14, r31" );
|
||||
asm( "LDI r31, 15" );
|
||||
asm( "MOV r15, r31" );
|
||||
asm( "LDI r16, 16" );
|
||||
asm( "LDI r17, 17" );
|
||||
asm( "LDI r18, 18" );
|
||||
asm( "LDI r19, 19" );
|
||||
asm( "LDI r20, 20" );
|
||||
asm( "LDI r21, 21" );
|
||||
asm( "LDI r22, 22" );
|
||||
asm( "LDI r23, 23" );
|
||||
asm( "LDI r24, 24" );
|
||||
asm( "LDI r25, 25" );
|
||||
asm( "LDI r26, 26" );
|
||||
asm( "LDI r27, 27" );
|
||||
asm( "LDI r28, 28" );
|
||||
asm( "LDI r29, 29" );
|
||||
asm( "LDI r30, 30" );
|
||||
|
||||
/* Check whether register r0-30 still contain known good values.
|
||||
* If not, update uxRegTestError2 with the unique value.
|
||||
*/
|
||||
asm( "LDI r31, 0" );
|
||||
asm( "CPSE r31, r0" );
|
||||
asm( "STS uxRegTestError2, r0" );
|
||||
asm( "LDI r31, 1" );
|
||||
asm( "CPSE r31, r1" );
|
||||
asm( "STS uxRegTestError2, r1" );
|
||||
asm( "LDI r31, 2" );
|
||||
asm( "CPSE r31, r2" );
|
||||
asm( "STS uxRegTestError2, r2" );
|
||||
asm( "LDI r31, 3" );
|
||||
asm( "CPSE r31, r3" );
|
||||
asm( "STS uxRegTestError2, r3" );
|
||||
asm( "LDI r31, 4" );
|
||||
asm( "CPSE r31, r4" );
|
||||
asm( "STS uxRegTestError2, r4" );
|
||||
asm( "LDI r31, 5" );
|
||||
asm( "CPSE r31, r5" );
|
||||
asm( "STS uxRegTestError2, r5" );
|
||||
asm( "LDI r31, 6" );
|
||||
asm( "CPSE r31, r6" );
|
||||
asm( "STS uxRegTestError2, r6" );
|
||||
asm( "LDI r31, 7" );
|
||||
asm( "CPSE r31, r7" );
|
||||
asm( "STS uxRegTestError2, r7" );
|
||||
asm( "LDI r31, 8" );
|
||||
asm( "CPSE r31, r8" );
|
||||
asm( "STS uxRegTestError2, r8" );
|
||||
asm( "LDI r31, 9" );
|
||||
asm( "CPSE r31, r9" );
|
||||
asm( "STS uxRegTestError2, r9" );
|
||||
asm( "LDI r31, 10" );
|
||||
asm( "CPSE r31, r10" );
|
||||
asm( "STS uxRegTestError2, r10" );
|
||||
asm( "LDI r31, 11" );
|
||||
asm( "CPSE r31, r11" );
|
||||
asm( "STS uxRegTestError2, r11" );
|
||||
asm( "LDI r31, 12" );
|
||||
asm( "CPSE r31, r12" );
|
||||
asm( "STS uxRegTestError2, r12" );
|
||||
asm( "LDI r31, 13" );
|
||||
asm( "CPSE r31, r13" );
|
||||
asm( "STS uxRegTestError2, r13" );
|
||||
asm( "LDI r31, 14" );
|
||||
asm( "CPSE r31, r14" );
|
||||
asm( "STS uxRegTestError2, r14" );
|
||||
asm( "LDI r31, 15" );
|
||||
asm( "CPSE r31, r15" );
|
||||
asm( "STS uxRegTestError2, r15" );
|
||||
asm( "LDI r31, 16" );
|
||||
asm( "CPSE r31, r16" );
|
||||
asm( "STS uxRegTestError2, r16" );
|
||||
asm( "LDI r31, 17" );
|
||||
asm( "CPSE r31, r17" );
|
||||
asm( "STS uxRegTestError2, r17" );
|
||||
asm( "LDI r31, 18" );
|
||||
asm( "CPSE r31, r18" );
|
||||
asm( "STS uxRegTestError2, r18" );
|
||||
asm( "LDI r31, 19" );
|
||||
asm( "CPSE r31, r19" );
|
||||
asm( "STS uxRegTestError2, r19" );
|
||||
asm( "LDI r31, 20" );
|
||||
asm( "CPSE r31, r20" );
|
||||
asm( "STS uxRegTestError2, r20" );
|
||||
asm( "LDI r31, 21" );
|
||||
asm( "CPSE r31, r21" );
|
||||
asm( "STS uxRegTestError2, r21" );
|
||||
asm( "LDI r31, 22" );
|
||||
asm( "CPSE r31, r22" );
|
||||
asm( "STS uxRegTestError2, r22" );
|
||||
asm( "LDI r31, 23" );
|
||||
asm( "CPSE r31, r23" );
|
||||
asm( "STS uxRegTestError2, r23" );
|
||||
asm( "LDI r31, 24" );
|
||||
asm( "CPSE r31, r24" );
|
||||
asm( "STS uxRegTestError2, r24" );
|
||||
asm( "LDI r31, 25" );
|
||||
asm( "CPSE r31, r25" );
|
||||
asm( "STS uxRegTestError2, r25" );
|
||||
asm( "LDI r31, 26" );
|
||||
asm( "CPSE r31, r26" );
|
||||
asm( "STS uxRegTestError2, r26" );
|
||||
asm( "LDI r31, 27" );
|
||||
asm( "CPSE r31, r27" );
|
||||
asm( "STS uxRegTestError2, r27" );
|
||||
asm( "LDI r31, 28" );
|
||||
asm( "CPSE r31, r28" );
|
||||
asm( "STS uxRegTestError2, r28" );
|
||||
asm( "LDI r31, 29" );
|
||||
asm( "CPSE r31, r29" );
|
||||
asm( "STS uxRegTestError2, r29" );
|
||||
asm( "LDI r31, 30" );
|
||||
asm( "CPSE r31, r30" );
|
||||
asm( "STS uxRegTestError2, r30" );
|
||||
|
||||
/* Give other tasks of the same priority a chance to run. */
|
||||
taskYIELD();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* FreeRTOS Kernel V10.3.0
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef REG_TEST_H
|
||||
#define REG_TEST_H
|
||||
|
||||
void vStartRegTestTasks( void );
|
||||
BaseType_t xAreRegTestTasksStillRunning( void );
|
||||
|
||||
#endif
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Driver initialization.
|
||||
*
|
||||
(c) 2018 Microchip Technology Inc. and its subsidiaries.
|
||||
|
||||
Subject to your compliance with these terms,you may use this software and
|
||||
any derivatives exclusively with Microchip products.It is your responsibility
|
||||
to comply with third party license terms applicable to your use of third party
|
||||
software (including open source software) that may accompany Microchip software.
|
||||
|
||||
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
|
||||
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
|
||||
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
|
||||
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
|
||||
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
|
||||
FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
|
||||
ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by START.
|
||||
*
|
||||
* This file will be overwritten when reconfiguring your START project.
|
||||
* Please copy examples or other code you want to keep to a separate file
|
||||
* to avoid losing it when reconfiguring.
|
||||
*/
|
||||
|
||||
#include "driver_init.h"
|
||||
#include <system.h>
|
||||
|
||||
/**
|
||||
* \brief System initialization
|
||||
*/
|
||||
void system_init()
|
||||
{
|
||||
mcu_init();
|
||||
|
||||
sysctrl_init();
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Configuration Change Protection
|
||||
*
|
||||
(c) 2018 Microchip Technology Inc. and its subsidiaries.
|
||||
|
||||
Subject to your compliance with these terms,you may use this software and
|
||||
any derivatives exclusively with Microchip products.It is your responsibility
|
||||
to comply with third party license terms applicable to your use of third party
|
||||
software (including open source software) that may accompany Microchip software.
|
||||
|
||||
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
|
||||
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
|
||||
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
|
||||
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
|
||||
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
|
||||
FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
|
||||
ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup doc_driver_system_protected_io Protected IO
|
||||
* \ingroup doc_driver_system
|
||||
*
|
||||
* \section doc_driver_protected_io_rev Revision History
|
||||
* - v0.0.0.1 Initial Commit
|
||||
*
|
||||
*@{
|
||||
*/
|
||||
|
||||
#include <assembler.h>
|
||||
|
||||
/*
|
||||
* GNU and IAR use different calling conventions. Since this is
|
||||
* a very small and simple function to begin with, it's easier
|
||||
* to implement it twice than to deal with the differences
|
||||
* within a single implementation.
|
||||
*/
|
||||
|
||||
PUBLIC_FUNCTION(protected_write_io)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
/*
|
||||
* We need to disable interrupts globally before the protected
|
||||
* sequence. In order to do that we must save SREG first.
|
||||
*/
|
||||
in r18, _SFR_IO_ADDR(SREG)
|
||||
cli
|
||||
|
||||
#ifdef RAMPZ
|
||||
out _SFR_IO_ADDR(RAMPZ), r1 // Clear bits 23:16 of Z
|
||||
#endif
|
||||
movw r30, r24 // Load addr into Z
|
||||
st Z, r22 // Write protection bit to I/O register
|
||||
st Z, r20 // Write value to I/O register
|
||||
out _SFR_IO_ADDR(SREG), r18
|
||||
|
||||
ret // Return to caller
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ASM__)
|
||||
|
||||
# if !defined(CONFIG_MEMORY_MODEL_TINY) && !defined(CONFIG_MEMORY_MODEL_SMALL) \
|
||||
&& !defined(CONFIG_MEMORY_MODEL_LARGE)
|
||||
# define CONFIG_MEMORY_MODEL_SMALL
|
||||
# endif
|
||||
/*
|
||||
* We need to disable interrupts globally before the protected
|
||||
* sequence. In order to do that we must save SREG first.
|
||||
*/
|
||||
in r21, SREG
|
||||
cli
|
||||
# if defined(CONFIG_MEMORY_MODEL_LARGE)
|
||||
ldi r20, 0
|
||||
out RAMPZ, r20 // Reset bits 23:16 of Z
|
||||
movw r30, r16 // Load addr into Z
|
||||
# elif defined(CONFIG_MEMORY_MODEL_TINY)
|
||||
ldi r31, 0 // Reset bits 8:15 of Z
|
||||
mov r30, r16 // Load addr into Z
|
||||
# else
|
||||
movw r30, r16 // Load addr into Z
|
||||
# endif
|
||||
# if defined(CONFIG_MEMORY_MODEL_TINY)
|
||||
st Z, r17 // Write protection bit to I/O register
|
||||
st Z, r18 // Write value to I/O register
|
||||
# elif defined(CONFIG_MEMORY_MODEL_SMALL)
|
||||
st Z, r18 // Write protection bit to I/O register
|
||||
st Z, r19 // Write value to I/O register
|
||||
# elif defined(CONFIG_MEMORY_MODEL_LARGE)
|
||||
st Z, r19 // Write protection bit to I/O register
|
||||
st Z, r20 // Write value to I/O register
|
||||
# else
|
||||
# error Unknown memory model in use, no idea how registers should be accessed
|
||||
# endif
|
||||
out SREG, r21
|
||||
|
||||
ret
|
||||
#else
|
||||
# error Unknown assembler
|
||||
#endif
|
||||
|
||||
END_FUNC(protected_write_io)
|
||||
END_FILE()
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* \file assembler.h
|
||||
*
|
||||
* \brief Assembler abstraction layer and utilities
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2016 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 ASSEMBLER_H_INCLUDED
|
||||
#define ASSEMBLER_H_INCLUDED
|
||||
|
||||
#if !defined(__ASSEMBLER__) && !defined(__IAR_SYSTEMS_ASM__) && !defined(__DOXYGEN__)
|
||||
#error This file may only be included from assembly files
|
||||
#endif
|
||||
|
||||
#if defined(__ASSEMBLER__)
|
||||
#include "assembler/gas.h"
|
||||
#include <avr/io.h>
|
||||
#elif defined(__IAR_SYSTEMS_ASM__)
|
||||
#include "assembler/iar.h"
|
||||
#include <ioavr.h>
|
||||
#endif
|
||||
|
||||
#endif /* ASSEMBLER_H_INCLUDED */
|
|
@ -0,0 +1,127 @@
|
|||
/**
|
||||
* \file gas.h
|
||||
*
|
||||
* \brief Assembler abstraction layer: GNU Assembler specifics
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2016 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 ASSEMBLER_GAS_H_INCLUDED
|
||||
#define ASSEMBLER_GAS_H_INCLUDED
|
||||
|
||||
#ifndef __DOXYGEN__
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
/* IAR doesn't accept dots in macro names */
|
||||
.macro ld_addr, reg, sym
|
||||
lda.w \reg, \sym
|
||||
.endm
|
||||
|
||||
/* Define a function \a name that is either globally visible or only
|
||||
* file-local.
|
||||
*/
|
||||
.macro gas_begin_func name, is_public
|
||||
.if \is_public
|
||||
.global \name
|
||||
.endif
|
||||
.section .text.\name, "ax", @progbits
|
||||
.type \name, @function
|
||||
\name :
|
||||
.endm
|
||||
|
||||
/* Define a function \a name that is either globally visible or only
|
||||
* file-local in a given segment.
|
||||
*/
|
||||
.macro gas_begin_func_segm name, is_public, segment
|
||||
.if \is_public
|
||||
.global \name
|
||||
.endif
|
||||
.section .\segment, "ax", @progbits
|
||||
.type \name, @function
|
||||
\name :
|
||||
.endm
|
||||
|
||||
/* Define \a name as a weak alias for the function \a strong_name */
|
||||
.macro gas_weak_function_alias name, strong_name
|
||||
.global \name
|
||||
.weak \name
|
||||
.type \name, @function
|
||||
.set \name, \strong_name
|
||||
.endm
|
||||
|
||||
/* Define a weak function called \a name */
|
||||
.macro gas_weak_function name
|
||||
.weak \name
|
||||
gas_begin_func \name 1
|
||||
.endm
|
||||
|
||||
#define REPEAT(count) .rept count
|
||||
#define END_REPEAT() .endr
|
||||
#define FILL_BYTES(count) .fill count
|
||||
#define SET_LOC(offset) .org offset
|
||||
#define L(name) .L##name
|
||||
#define EXTERN_SYMBOL(name)
|
||||
|
||||
#define TEXT_SECTION(name) \
|
||||
.section name, "ax", @progbits
|
||||
#define RODATA_SECTION(name) \
|
||||
.section name, "a", @progbits
|
||||
#define DATA_SECTION(name) \
|
||||
.section name, "aw", @progbits
|
||||
#define BSS_SECTION(name) \
|
||||
.section name, "aw", @nobits
|
||||
|
||||
#define FUNCTION(name) gas_begin_func name 0
|
||||
#define PUBLIC_FUNCTION(name) gas_begin_func name 1
|
||||
#define PUBLIC_FUNCTION_SEGMENT(name, segment) \
|
||||
gas_begin_func_segm name 1 segment
|
||||
#define WEAK_FUNCTION(name) gas_weak_function name
|
||||
#define WEAK_FUNCTION_ALIAS(name, strong_name) \
|
||||
gas_weak_function_alias name strong_name
|
||||
#define END_FUNC(name) \
|
||||
.size name, . - name
|
||||
|
||||
#define END_FILE()
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
#endif /* __DOXYGEN__ */
|
||||
|
||||
#endif /* ASSEMBLER_GAS_H_INCLUDED */
|
|
@ -0,0 +1,116 @@
|
|||
/**
|
||||
* \file iar.h
|
||||
*
|
||||
* \brief Assembler abstraction layer: IAR Assembler specifics
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2016 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 ASSEMBLER_IAR_H_INCLUDED
|
||||
#define ASSEMBLER_IAR_H_INCLUDED
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
ld_addr MACRO reg, sym
|
||||
mov reg, LWRD sym
|
||||
orh reg, HWRD sym
|
||||
ENDM
|
||||
|
||||
call MACRO sym
|
||||
rcall sym
|
||||
ENDM
|
||||
|
||||
iar_begin_func MACRO name, sect, is_public, is_weak
|
||||
MODULE name
|
||||
RSEG CODE:CODE:NOROOT(1)
|
||||
IF is_weak == 1
|
||||
PUBWEAK name
|
||||
ELSEIF is_public
|
||||
PUBLIC name
|
||||
ENDIF
|
||||
name:
|
||||
ENDM
|
||||
|
||||
iar_begin_func_segm MACRO name, sect, is_public, is_weak, segment
|
||||
MODULE name
|
||||
RSEG segment:CODE:NOROOT(1)
|
||||
IF is_weak == 1
|
||||
PUBWEAK name
|
||||
ELSEIF is_public
|
||||
PUBLIC name
|
||||
ENDIF
|
||||
name:
|
||||
ENDM
|
||||
|
||||
iar_weak_alias MACRO name, strong_name
|
||||
PUBWEAK name
|
||||
name:
|
||||
rjmp strong_name
|
||||
ENDM
|
||||
|
||||
#define lo(x) LWRD x
|
||||
#define hi(x) HWRD x
|
||||
|
||||
#define REPEAT(count) REPT count
|
||||
#define END_REPEAT() ENDR
|
||||
#define SET_LOC(offset) ORG offset
|
||||
#define END_FILE() END
|
||||
|
||||
#define FILL_BYTES(count) DS8 count
|
||||
|
||||
#define L(name) name
|
||||
#define EXTERN_SYMBOL(name) EXTERN name
|
||||
#define FUNCTION(name) iar_begin_func name, text_##name, 0, 0
|
||||
#define PUBLIC_FUNCTION(name) iar_begin_func name, text_##name, 1, 0
|
||||
#define PUBLIC_FUNCTION_SEGMENT(name, segment) \
|
||||
iar_begin_func_segm name, text_##name, 1, 0, segment
|
||||
#define WEAK_FUNCTION(name) iar_begin_func name, text_##name, 1, 1
|
||||
#define WEAK_FUNCTION_ALIAS(name, strong_name) \
|
||||
iar_weak_alias name, strong_name
|
||||
#define END_FUNC(name) ENDMOD
|
||||
|
||||
#define TEXT_SECTION(name) RSEG name:CODE:NOROOT
|
||||
#define RODATA_SECTION(name) RSEG name:CONST:NOROOT
|
||||
#define DATA_SECTION(name) RSEG name:DATA:NOROOT
|
||||
#define BSS_SECTION(name) RSEG name:DATA:NOROOT
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
#endif /* ASSEMBLER_IAR_H_INCLUDED */
|
|
@ -0,0 +1,125 @@
|
|||
/**
|
||||
* \file atomic.h
|
||||
*
|
||||
* \brief Macros used for atomic memory access.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2016 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 ATOMIC_H
|
||||
#define ATOMIC_H
|
||||
|
||||
/**
|
||||
* \defgroup doc_driver_utils_atomic Atomic memory access and critical sections
|
||||
* \ingroup doc_driver_utils
|
||||
*
|
||||
* Atomic memory access and critical sections
|
||||
*
|
||||
* \{
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#if defined(__GNUC__) || defined (__DOXYGEN__)
|
||||
|
||||
/**
|
||||
* \brief Enter a critical region
|
||||
*
|
||||
* Saves the contents of the status register, including the Global
|
||||
* Interrupt Enable bit, so that it can be restored upon leaving the
|
||||
* critical region. Thereafter, clears the Global Interrupt Enable Bit.
|
||||
* This macro takes a parameter P that is unused for the GCC compiler,
|
||||
* but necessary for code compatibility with the IAR compiler. The IAR
|
||||
* compiler declares a variable with the name of the parameter for
|
||||
* holding the SREG value. Since a variable is declared in the macro,
|
||||
* this variable must have a name that is unique within the scope
|
||||
* that the critical region is declared within, otherwise compilation
|
||||
* will fail.
|
||||
*
|
||||
* \param[in] UNUSED(GCC)/P(IAR) Name of variable storing SREG
|
||||
*
|
||||
*/
|
||||
|
||||
#define ENTER_CRITICAL(UNUSED) __asm__ __volatile__ ( \
|
||||
"in __tmp_reg__, __SREG__" "\n\t" \
|
||||
"cli" "\n\t" \
|
||||
"push __tmp_reg__" "\n\t" \
|
||||
::: "memory" \
|
||||
)
|
||||
|
||||
/**
|
||||
* \brief Exit a critical region
|
||||
*
|
||||
* Restores the contents of the status register, including the Global
|
||||
* Interrupt Enable bit, as it was when entering the critical region.
|
||||
* This macro takes a parameter P that is unused for the GCC compiler,
|
||||
* but necessary for code compatibility with the IAR compiler. The IAR
|
||||
* compiler uses this parameter as the name of a variable that holds
|
||||
* the SREG value. The parameter must be identical to the parameter
|
||||
* used in the corresponding ENTER_CRITICAL().
|
||||
*
|
||||
* \param[in] UNUSED(GCC)/P(IAR) Name of variable storing SREG
|
||||
*
|
||||
*/
|
||||
|
||||
#define EXIT_CRITICAL(UNUSED) __asm__ __volatile__ ( \
|
||||
"pop __tmp_reg__" "\n\t" \
|
||||
"out __SREG__, __tmp_reg__" "\n\t" \
|
||||
::: "memory" \
|
||||
)
|
||||
|
||||
#define DISABLE_INTERRUPTS() __asm__ __volatile__ ( "cli" ::: "memory")
|
||||
#define ENABLE_INTERRUPTS() __asm__ __volatile__ ( "sei" ::: "memory")
|
||||
|
||||
#elif defined(__ICCAVR__)
|
||||
|
||||
#define ENTER_CRITICAL(P) unsigned char P = __save_interrupt();__disable_interrupt();
|
||||
#define EXIT_CRITICAL(P) __restore_interrupt(P);
|
||||
|
||||
#define DISABLE_INTERRUPTS() __disable_interrupt();
|
||||
#define ENABLE_INTERRUPTS() __enable_interrupt();
|
||||
|
||||
#else
|
||||
# error Unsupported compiler.
|
||||
#endif
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
#endif /* ATOMIC_H */
|
|
@ -0,0 +1,85 @@
|
|||
/**
|
||||
* \file compiler.h
|
||||
*
|
||||
* \brief Commonly used includes, types and macros.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2016 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 UTILS_COMPILER_H
|
||||
#define UTILS_COMPILER_H
|
||||
|
||||
/**
|
||||
* \defgroup doc_driver_utils_compiler Compiler abstraction
|
||||
* \ingroup doc_driver_utils
|
||||
*
|
||||
* Compiler abstraction layer and code utilities for 8-bit AVR.
|
||||
* This module provides various abstraction layers and utilities
|
||||
* to make code compatible between different compilers.
|
||||
*
|
||||
* \{
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#include <avr/io.h>
|
||||
#include <avr/builtins.h>
|
||||
#elif defined(__ICCAVR__)
|
||||
#define ENABLE_BIT_DEFINITIONS 1
|
||||
#include <ioavr.h>
|
||||
#include <intrinsics.h>
|
||||
|
||||
#else
|
||||
#error Unsupported compiler.
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <interrupt_avr8.h>
|
||||
|
||||
/**
|
||||
* \def UNUSED
|
||||
* \brief Marking \a v as a unused parameter or value.
|
||||
*/
|
||||
#define UNUSED(v) (void)(v)
|
||||
|
||||
#endif /* UTILS_COMPILER_H */
|
|
@ -0,0 +1,111 @@
|
|||
/**
|
||||
* \file interrupt_avr8.h
|
||||
*
|
||||
* \brief Global interrupt management for 8-bit AVR
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2016 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
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup doc_driver_utils_interrupts ISR abstraction
|
||||
* \ingroup doc_driver_utils
|
||||
*
|
||||
* Interrupt-related functionality.
|
||||
*
|
||||
* \{
|
||||
*/
|
||||
|
||||
#ifndef UTILS_INTERRUPT_AVR8_H
|
||||
#define UTILS_INTERRUPT_AVR8_H
|
||||
|
||||
/**
|
||||
* \weakgroup interrupt_group
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef ISR_CUSTOM_H
|
||||
#include ISR_CUSTOM_H
|
||||
#else
|
||||
|
||||
/**
|
||||
* \def ISR
|
||||
* \brief Define service routine for specified interrupt vector
|
||||
*
|
||||
* Usage:
|
||||
* \code
|
||||
ISR(FOO_vect)
|
||||
{
|
||||
...
|
||||
}
|
||||
\endcode
|
||||
*
|
||||
* \param vect Interrupt vector name as found in the device header files.
|
||||
*/
|
||||
#if defined(__DOXYGEN__)
|
||||
#define ISR(vect)
|
||||
#elif defined(__GNUC__)
|
||||
#include <avr/interrupt.h>
|
||||
#elif defined(__ICCAVR__)
|
||||
#define __ISR(x) _Pragma(#x)
|
||||
#define ISR(vect) __ISR(vector = vect) __interrupt void handler_##vect(void)
|
||||
#endif
|
||||
#endif // ISR_CUSTOM_H
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define cpu_irq_enable() sei()
|
||||
#define cpu_irq_disable() cli()
|
||||
#else
|
||||
#define cpu_irq_enable() __enable_interrupt()
|
||||
#define cpu_irq_disable() __disable_interrupt()
|
||||
#endif
|
||||
|
||||
//! @}
|
||||
|
||||
/**
|
||||
* \weakgroup interrupt_deprecated_group
|
||||
* @{
|
||||
*/
|
||||
// Deprecated definitions.
|
||||
#define Enable_global_interrupt() cpu_irq_enable()
|
||||
#define Disable_global_interrupt() cpu_irq_disable()
|
||||
#define Is_global_interrupt_enabled() cpu_irq_is_enabled()
|
||||
//! @}
|
||||
|
||||
#endif /* UTILS_INTERRUPT_AVR8_H */
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* \file utils.h
|
||||
*
|
||||
* \brief Different macros.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2016 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
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup doc_driver_utils AVR Code utility functions
|
||||
*
|
||||
* Compiler abstraction layer and code utilities for AVR.
|
||||
* This module provides various abstraction layers and utilities
|
||||
* to make code compatible between different compilers.
|
||||
*
|
||||
* \{
|
||||
*/
|
||||
|
||||
#ifndef UTILS_H_INCLUDED
|
||||
#define UTILS_H_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Retrieve array size
|
||||
*/
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* UTILS_H_INCLUDED */
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
* \file utils_assert.h
|
||||
*
|
||||
* \brief Asserts related functionality.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2016 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
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup doc_driver_utils_assert Functionality for assert.
|
||||
* \ingroup doc_driver_utils
|
||||
*
|
||||
* \{
|
||||
*/
|
||||
|
||||
#ifndef _ASSERT_H_INCLUDED
|
||||
#define _ASSERT_H_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* \brief Assert macro
|
||||
*
|
||||
* This macro is used to throw asserts. It can be mapped to different function
|
||||
* based on debug level.
|
||||
*
|
||||
* \param[in] condition A condition to be checked;
|
||||
* assert is thrown if the given condition is false
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ASSERT(condition) \
|
||||
if (!(condition)) \
|
||||
while (true) \
|
||||
;
|
||||
#else
|
||||
#define ASSERT(condition) ((void)0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _ASSERT_H_INCLUDED */
|
Loading…
Add table
Add a link
Reference in a new issue