diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 000000000..0e447d44b
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,18 @@
+version: 2.1
+
+jobs:
+ latest-clang-autotools:
+ docker:
+ - image: silkeh/clang:latest
+ environment:
+ BUILD: autotools
+ CXX: clang
+ CPPUTEST_BUILD_DIR: ./cpputest_build
+ steps:
+ - checkout
+# - run: mkdir -p $CPPUTEST_BUILD_DIR && cd $CPPUTEST_BUILD_DIR && ../scripts/travis_ci_build.sh
+
+workflows:
+ basic-build-and-test:
+ jobs:
+ - latest-clang-autotools
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 000000000..a586a94d3
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,41 @@
+---
+Language: Cpp
+Standard: Cpp03
+AccessModifierOffset: -4
+AlignAfterOpenBracket: BlockIndent
+AllowShortBlocksOnASingleLine: Empty
+AllowShortEnumsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: Empty
+AlwaysBreakBeforeMultilineStrings: true
+BinPackParameters: false
+BreakBeforeBraces: Custom
+BraceWrapping:
+ AfterClass: true
+ AfterControlStatement: Never
+ AfterEnum: true
+ AfterFunction: true
+ AfterNamespace: true
+ AfterStruct: true
+ AfterUnion: true
+ AfterExternBlock: false
+ BeforeCatch: true
+ BeforeElse: false
+ BeforeWhile: false
+ SplitEmptyFunction: true
+ SplitEmptyRecord: true
+ SplitEmptyNamespace: true
+BreakConstructorInitializers: AfterColon
+ColumnLimit: 120
+NamespaceIndentation: All
+NamespaceMacros:
+ - TEST_GROUP
+FixNamespaceComments: false
+IndentPPDirectives: BeforeHash
+IndentWidth: 4
+IndentExternBlock: NoIndent
+PackConstructorInitializers: CurrentLine
+PointerAlignment: Left
+SortIncludes: Never
+SpaceBeforeParens: Custom
+SpaceBeforeParensOptions:
+ AfterForeachMacros: false
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 000000000..6a48af4f9
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,11 @@
+---
+Checks:
+ - clang-diagnostic-*
+ - clang-analyzer-*
+ - bugprone-*
+ - -bugprone-easily-swappable-parameters
+ - -bugprone-casting-through-void # No C++ casts allowed
+WarningsAsErrors: "*"
+FormatStyle: file
+UseColor: true
+HeaderFilterRegex: .*
diff --git a/.cproject b/.cproject
deleted file mode 100644
index 1249a9da3..000000000
--- a/.cproject
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- make
- extensions
- true
- true
- true
-
-
- make
-
- examples
- true
- true
- true
-
-
- make
-
- cleanExamples
- true
- true
- true
-
-
-
-
-
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
new file mode 100644
index 000000000..30c51b94f
--- /dev/null
+++ b/.git-blame-ignore-revs
@@ -0,0 +1,7 @@
+# Enable via `git config blame.ignoreRevsFile .git-blame-ignore-revs`
+
+# Fix line endings
+e674cfe759b20c6b78becbc50d8f9f644d32ea8a
+
+# clang-format
+2a4942eb93b823c9723d4797222d6d3315f3bef2
diff --git a/.gitattributes b/.gitattributes
index e4019972e..2bdb94418 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -7,6 +7,14 @@
# Windows files
*.sln text eol=crlf
*.bat text eol=crlf
+*.dsp text eol=crlf
*.dsw text eol=crlf
+*.dep text eol=crlf
+*.mak text eol=crlf
*.vcproj text eol=crlf
*.vcxproj text eol=crlf
+
+
+*.sh text
+*.ac text
+*.am text
diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml
new file mode 100644
index 000000000..47c3161ab
--- /dev/null
+++ b/.github/workflows/basic.yml
@@ -0,0 +1,445 @@
+---
+name: Basic builds
+
+"on":
+ push:
+ pull_request:
+
+jobs:
+ clang-format:
+ name: Clang Format
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@main
+ - uses: DoozyX/clang-format-lint-action@v0.14
+ with:
+ clangFormatVersion: 14
+ source: examples
+
+ codeql:
+ runs-on: ubuntu-latest
+ name: "CodeQL"
+ steps:
+ - name: Checkout
+ uses: actions/checkout@main
+ - name: CodeQL Initialization
+ uses: github/codeql-action/init@v2
+ with:
+ languages: cpp
+ queries: +security-and-quality
+ - name: Build
+ run: |
+ mkdir _build && cd _build
+ cmake -DCMAKE_CXX_STANDARD=17 ..
+ make -j2
+ - name: CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
+
+ autotools:
+ strategy:
+ matrix:
+ include:
+ - name: Mac GNU
+ os: macos-latest
+ cc: gcc
+ cxx: g++
+ make_args: tdd
+ - name: Mac Clang
+ os: macos-latest
+ cc: clang
+ cxx: clang++
+ make_args: tdd
+ - name: Linux GNU
+ os: ubuntu-latest
+ cc: gcc
+ cxx: g++
+ make_args: tdd
+ - name: Linux Clang
+ os: ubuntu-latest
+ cc: clang
+ cxx: clang++
+ make_args: tdd
+ - name: Disable long long
+ os: ubuntu-latest
+ configure_args: --disable-longlong
+ make_args: tdd
+ - name: Distribution
+ os: ubuntu-latest
+ make_args: dist dist-zip VERSION=latest
+ - name: Install
+ os: ubuntu-latest
+ make_args: DESTDIR=install_autotools install
+ runs-on: ${{ matrix.os }}
+ name: Autotools ${{ matrix.name }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@main
+ - run: brew install automake libtool
+ if: ${{ startswith(matrix.os, 'macos') }}
+ - if: ${{ matrix.cxx }}
+ run: echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
+ - if: ${{ matrix.cc }}
+ run: echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV
+ - name: Configure
+ run: |
+ autoreconf -i .
+ ./configure ${{ matrix.configure_args }}
+ - name: Build and test
+ run: make ${{ matrix.make_args }}
+
+ cmake:
+ strategy:
+ matrix:
+ include:
+ - name: MSVC install
+ os: windows-latest
+ preset: MSVC
+ install: true
+ ctest_args: -C Debug
+ - name: MSVC 20
+ os: windows-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=20
+ preset: MSVC
+ ctest_args: -C Debug
+ - name: ClangCL
+ os: windows-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=17
+ preset: ClangCL
+ ctest_args: -C Debug
+ - name: Clang-Tidy
+ os: ubuntu-latest
+ preset: clang-tidy
+ - name: Linux Clang 98
+ os: ubuntu-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=98
+ preset: Clang
+ - name: Linux Clang 11
+ os: ubuntu-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=11
+ preset: Clang
+ - name: Linux Clang 14
+ os: ubuntu-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=14
+ preset: Clang
+ - name: Linux Clang 17
+ os: ubuntu-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=17
+ preset: Clang
+ - name: Linux Clang 20
+ os: ubuntu-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=20
+ preset: Clang
+ - name: Linux GNU 98
+ os: ubuntu-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=98
+ preset: GNU
+ - name: No long long
+ os: ubuntu-latest
+ preset: no-long-long
+ - name: Detailed
+ os: ubuntu-latest
+ preset: detailed
+ - name: Linux GNU Install
+ os: ubuntu-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=11
+ preset: GNU
+ install: true
+ - name: Linux GNU 14
+ os: ubuntu-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=14
+ preset: GNU
+ - name: Linux GNU 17
+ os: ubuntu-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=17
+ preset: GNU
+ - name: Linux GNU 20
+ os: ubuntu-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=20
+ preset: GNU
+ - name: MinGW
+ os: ubuntu-latest
+ preset: MinGW
+ apt_packages: mingw-w64 wine64
+ - name: No C++ Standard Library
+ os: ubuntu-latest
+ preset: no-std-cpp
+ - name: No RTTI
+ os: ubuntu-latest
+ preset: no-rtti
+ - name: No Exceptions
+ os: ubuntu-latest
+ preset: no-exceptions
+ - name: No C Standard Library
+ os: ubuntu-latest
+ preset: no-std-c
+ - name: Coverage
+ os: ubuntu-latest
+ preset: coverage
+ apt_packages: lcov
+ - name: Address Sanitizer
+ os: ubuntu-latest
+ preset: asan
+ - name: GCC ARM embedded
+ os: ubuntu-latest
+ preset: arm-embedded
+ - name: Mac install
+ os: macos-latest
+ preset: defaults
+ install: true
+ - name: Apple Clang 14
+ os: macos-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=14
+ preset: Clang
+ - name: Apple Clang 17
+ os: macos-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=17
+ preset: Clang
+ - name: Apple Clang 20
+ os: macos-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=20
+ preset: Clang
+ - name: Mac GNU 14
+ os: macos-latest
+ cmake_args: -DCMAKE_CXX_STANDARD=14
+ preset: GNU
+ - name: OpenWatcom DOS
+ os: ubuntu-latest
+ preset: DOS
+ apt_packages: dosbox
+ - name: Cygwin
+ os: windows-latest
+ preset: GNU
+ name: CMake ${{ matrix.name }}
+ runs-on: ${{ matrix.os }}
+ steps:
+ ### SETUP
+
+ - name: Install packages
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y ${{ matrix.apt_packages }}
+ if: ${{ matrix.apt_packages }}
+
+ - uses: carlosperate/arm-none-eabi-gcc-action@v1
+ if: ${{ matrix.name == 'GCC ARM embedded' }}
+
+ - name: Install OpenWatcom
+ uses: open-watcom/setup-watcom@v0
+ with:
+ version: "2.0"
+ if: ${{ matrix.name == 'OpenWatcom DOS' }}
+
+ - run: git config --global core.autocrlf input
+ if: ${{ matrix.name == 'Cygwin' }}
+ - name: Checkout
+ uses: actions/checkout@main
+
+ - name: Install Cygwin
+ uses: cygwin/cygwin-install-action@master
+ with:
+ platform: x86
+ packages: >
+ cmake
+ gcc-core
+ gcc-g++
+ make
+ if: ${{ matrix.name == 'Cygwin' }}
+
+ ## BUILD AND TEST
+
+ - name: Configure
+ run: cmake --preset ${{ matrix.preset }} ${{ matrix.cmake_args }}
+ - name: Build
+ run: cmake --build cpputest_build --verbose -j
+ - name: Save map files
+ uses: actions/upload-artifact@v4
+ with:
+ name: "${{ matrix.name }} map files"
+ path: cpputest_build/**/*.map
+ - name: Test
+ run: >
+ ctest
+ --test-dir cpputest_build
+ ${{ matrix.ctest_args }}
+ --output-on-failure
+
+ # POST PROCESSING
+
+ - name: Install (*nix)
+ run: |
+ sudo cmake --install cpputest_build/
+ pkg-config --print-provides cpputest
+ if: ${{ matrix.install && !startswith(matrix.os, 'windows')}}
+ - name: Install (Windows)
+ run: cmake --install cpputest_build/ --config=Debug
+ if: ${{ matrix.install && startswith(matrix.os, 'windows')}}
+ - name: Use install
+ run: |
+ cmake -B build -S examples
+ cmake --build build -j
+ ctest --test-dir build
+ if: ${{ matrix.install }}
+
+ - name: Coverage
+ run: |
+ lcov --ignore-errors mismatch --capture --directory . --no-external --output-file lcov.info
+ lcov --remove lcov.info --output-file lcov.info '*/tests/*'
+ if: ${{ matrix.name == 'Coverage' }}
+ - name: Coveralls
+ uses: coverallsapp/github-action@master
+ with:
+ path-to-lcov: lcov.info
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ if: ${{ matrix.name == 'Coverage' }}
+
+ test_report:
+ name: JUnit Test Report
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@main
+ - run: cmake --preset=defaults -DCPPUTEST_JUNIT_REPORT=TRUE
+ - run: cmake --build cpputest_build -j
+ - run: ctest --test-dir cpputest_build
+ - uses: actions/upload-artifact@v4
+ if: success() || failure()
+ with:
+ name: test-results
+ path: "cpputest_build/**/cpputest_*.xml"
+
+ make:
+ strategy:
+ matrix:
+ include:
+ - name: Defaults
+ make_target: test_defaults
+ - name: STDC++ disabled
+ make_target: test_disable_std_cpp
+ - name: Memory Leak Detection disabled
+ make_target: test_disable_memory_leak_detection
+ - name: Disable Leak Detection and STD C++
+ make_target: test_disable_std_cpp_and_leak_detection
+ - name: debug disabled
+ make_target: test_disable_debug
+ - name: overridden CXXFLAGS and CFLAGS and CPPFLAGS
+ make_target: test_override_flags
+ - name: without Standard C library includes
+ make_target: test_disable_std_c
+ - name: different TARGET_PLATFORM
+ make_target: test_target_platform
+ - name: override flags and disable memory leak and STDC++
+ make_target: test_override_and_disable
+ - name: Examples
+ make_target: test_examples
+ - name: JUnit Output
+ make_target: test_junit_output
+ # - name: gcov
+ # make_target: test_gcov
+ - name: VPATH usage
+ make_target: test_vpath
+ - name: VPATH Install
+ make_target: test_vpath_install
+ name: Make ${{ matrix.name }}
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@main
+ - name: Build
+ run: make -f Makefile_using_MakefileWorker ${{ matrix.make_target }}
+
+ make_dos:
+ name: Make OpenWatcom DOS
+ runs-on: ubuntu-latest
+ env:
+ WATCOM: "./watcom"
+ TERM: linux
+ steps:
+ - name: Checkout
+ uses: actions/checkout@main
+ - name: Install tools
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y dosbox
+ git clone https://github.com/cpputest/watcom-compiler.git $WATCOM
+ echo "$WATCOM/binl" >> $GITHUB_PATH
+ - name: Build
+ run: make -f platforms/Dos/Makefile
+ - name: Test
+ run: make -f platforms/Dos/Makefile test
+
+ cmake_msys:
+ name: CMake MSYS
+ runs-on: windows-latest
+ defaults:
+ run:
+ shell: msys2 {0}
+ env:
+ LDFLAGS: -static
+ steps:
+ - name: Checkout
+ uses: actions/checkout@main
+ - uses: msys2/setup-msys2@v2
+ with:
+ msystem: MINGW64
+ update: true
+ install: >
+ git
+ mingw-w64-x86_64-cc
+ mingw-w64-x86_64-cmake
+ mingw-w64-x86_64-make
+ - name: Configure
+ run: cmake --preset=GNU
+ - name: Build
+ run: cmake --build cpputest_build -j
+ - name: Test
+ run: ctest --test-dir cpputest_build --output-on-failure
+
+ autotools_msys:
+ name: Autotools MSYS
+ runs-on: windows-latest
+ defaults:
+ run:
+ shell: msys2 {0}
+ env:
+ LDFLAGS: -static
+ steps:
+ - uses: actions/checkout@v3
+ - uses: msys2/setup-msys2@v2
+ with:
+ msystem: MINGW64
+ update: true
+ install: >
+ git
+ mingw-w64-x86_64-autotools
+ mingw-w64-x86_64-cc
+ mingw-w64-x86_64-make
+ - name: Configure
+ run: |
+ autoreconf -i .
+ ./configure
+ - name: Build and test
+ run: make tdd
+
+ Docker:
+ strategy:
+ matrix:
+ image: ["ubuntu", "dos"]
+ runs-on: ubuntu-latest
+ name: Docker ${{ matrix.image }}
+ steps:
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v2
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v2
+ - name: Login to Docker Hub
+ uses: docker/login-action@v2
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+ env:
+ TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
+ if: ${{ env.TOKEN != '' }}
+ - name: Build
+ uses: docker/build-push-action@v3
+ with:
+ file: docker/Dockerfile.${{ matrix.image }}
+ tags: cpputest/${{ matrix.image }}
diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml
new file mode 100644
index 000000000..d44746601
--- /dev/null
+++ b/.github/workflows/test-report.yml
@@ -0,0 +1,17 @@
+---
+name: 'Test Report'
+"on":
+ workflow_run:
+ workflows: ['Basic builds']
+ types:
+ - completed
+jobs:
+ report:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: dorny/test-reporter@v1
+ with:
+ artifact: test-results
+ name: JUnit Tests
+ path: "**/cpputest_*.xml"
+ reporter: java-junit
diff --git a/.gitignore b/.gitignore
index 7d897b9b3..fa41116a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,8 +25,11 @@ gcov*.html
ErrorLogs
testResults
.metadata
+/ipch
Debug
+Release
*/Debug/*
+*/Release/*
*.exe
*.obj
*.ncb
@@ -42,13 +45,19 @@ Debug
*.tlog
*.cache
*.user
+*.VC.db
+*.VC.opendb
_build_
_build
builds/*gcc*
+cpputest_build/Makefile
+cpputest_build/generated
+cpputest_build/src
+cpputest_build/tests
/.deps
CppUTestExtTests
CppUTestTests
-Makefile
+/Makefile
config.h
config.h.in
config.status
@@ -73,3 +82,25 @@ m4/ltversion.m4
m4/lt~obsolete.m4
missing
test-driver
+platforms/iar/settings
+cpputest_*.xml
+generated/
+*.deps/
+*.dirstamp
+*.trs
+lcov.info
+
+#IAR automatically generated files
+*.dep
+*.ewt
+
+# Watcom
+*.LIB
+*.LST
+*.EXE
+*.LOG
+/console_output
+/exit
+
+# Builds
+/cpputest_build/
diff --git a/.project b/.project
deleted file mode 100644
index 978d661d1..000000000
--- a/.project
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
- CppUTest
-
-
-
-
-
- org.eclipse.cdt.managedbuilder.core.genmakebuilder
-
-
- ?name?
-
-
-
- org.eclipse.cdt.make.core.append_environment
- true
-
-
- org.eclipse.cdt.make.core.autoBuildTarget
- all
-
-
- org.eclipse.cdt.make.core.buildArguments
-
-
-
- org.eclipse.cdt.make.core.buildCommand
- make
-
-
- org.eclipse.cdt.make.core.cleanBuildTarget
- clean
-
-
- org.eclipse.cdt.make.core.contents
- org.eclipse.cdt.make.core.activeConfigSettings
-
-
- org.eclipse.cdt.make.core.enableAutoBuild
- true
-
-
- org.eclipse.cdt.make.core.enableCleanBuild
- true
-
-
- org.eclipse.cdt.make.core.enableFullBuild
- true
-
-
- org.eclipse.cdt.make.core.fullBuildTarget
- all
-
-
- org.eclipse.cdt.make.core.stopOnError
- true
-
-
- org.eclipse.cdt.make.core.useDefaultBuildCmd
- true
-
-
-
-
- org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
- full,incremental,
-
-
-
-
-
- org.eclipse.cdt.core.cnature
- org.eclipse.cdt.core.ccnature
- org.eclipse.cdt.managedbuilder.core.managedBuildNature
- org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
-
-
diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs
deleted file mode 100644
index 7bc75596d..000000000
--- a/.settings/org.eclipse.cdt.core.prefs
+++ /dev/null
@@ -1,152 +0,0 @@
-#Mon Jun 07 17:30:05 SGT 2010
-eclipse.preferences.version=1
-org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
-org.eclipse.cdt.core.formatter.alignment_for_compact_if=0
-org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
-org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
-org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
-org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=next_line
-org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=next_line
-org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=next_line
-org.eclipse.cdt.core.formatter.compact_else_if=true
-org.eclipse.cdt.core.formatter.continuation_indentation=2
-org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
-org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
-org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
-org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
-org.eclipse.cdt.core.formatter.indent_empty_lines=false
-org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.cdt.core.formatter.indentation.size=4
-org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
-org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
-org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
-org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
-org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
-org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
-org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
-org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
-org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
-org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
-org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
-org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
-org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
-org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=true
-org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=true
-org.eclipse.cdt.core.formatter.lineSplit=200
-org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.cdt.core.formatter.tabulation.char=tab
-org.eclipse.cdt.core.formatter.tabulation.size=4
-org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/.settings/org.eclipse.cdt.ui.prefs b/.settings/org.eclipse.cdt.ui.prefs
deleted file mode 100644
index b684b38df..000000000
--- a/.settings/org.eclipse.cdt.ui.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Tue Dec 29 09:23:19 SGT 2009
-eclipse.preferences.version=1
-formatter_profile=_CppUTest Coding Style
-formatter_settings_version=1
diff --git a/.travis.yml b/.travis.yml
index 1b9e809d8..1ce211e3e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,26 +1,196 @@
+
+# Global environment
language: cpp
-compiler:
-- clang
-- gcc
-rvm:
-- 1.9.3
-env:
- matrix:
- - BUILDTOOL=autotools
- - BUILDTOOL=cmake
- - BUILDTOOL=autotools_old_compilers
- global:
- - secure: |-
- P05xUfJVw5YM4hF7hzQLjyMzDD4Q1/fyWP9Uk5aK5VrSWNY99EuxldXI5QK/
- vA1NkcW49tQW1wQvBlRtdlLNOmUfDP/oiJFXPwNn4dqwOIOEet2P7JO/5hnH
- MNHlZmGu2WpoZREhOFBfsIhK0IP8mloqLDq2XemBdga/LWygrLU=
- - secure: Y/8iNkf6uEbE3qltnM+7mGlCvFWzyttwwRGgVGw1m9xOiUJcobvOImQRU8XZ91dgO+Fz0A3mljqs1sK1OPjpXmFGE1jP/NlotMw0WlDOuSIDjQ4ubwdTNGAwNY53R9ygbIjEmqxHAJm9mOZqxW2hNaoI7TcX6oX248/hLibyx8M=
-install:
-- gem install travis_github_deployer
-- sudo apt-get update --fix-missing
-- sudo apt-get install valgrind
+os: linux
+dist: bionic
+
+# Avoid double build because of the tagging in the build.
+branches:
+ except:
+ - latest-passing-build
+
+# Build stages and the conditionals for the stages
+stages:
+ - name: extensive daily tests
+ if: type = cron
+ - name: basic build & test
+ if: type != cron
+ - name: extended build & test
+ if: type != cron
+ - name: deploy latest
+ if: "(NOT type IN (pull_request)) AND (branch = master) AND (type != cron)"
+
+jobs:
+ include:
+
+# Basic builds
+
+# Mac OSX
+ - stage: basic build & test
+ compiler: gcc
+ os: osx
+ env: BUILD=autotools
+ - compiler: clang
+ env: BUILD=autotools
+ os: osx
+
+# Windows
+ - compiler: msbuild
+ os: windows
+ env: BUILD=vc_windows CPP_STD=17
+ - MSBUILD_PATH="c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
+ - VCTargetsPath="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets"
+
+# Linux
+ - compiler: gcc
+ env: BUILD=cmake CPP_STD=17
+ - compiler: gcc
+ env: BUILD=autotools
+ - compiler: clang
+ env: BUILD=autotools
+
+# Extended builds, different C++ version and build tools
+ - stage: extended build & test
+
+# Mac OSX
+ compiler: clang
+ os: osx
+ env: BUILD=cmake CPP_STD=17
+ - compiler: gcc
+ os: osx
+ env: BUILD=cmake CPP_STD=14
+
+# Linux
+# CMake different C++ versions with clang
+ - compiler: clang
+ env: BUILD=cmake CPP_STD=98
+ - compiler: clang
+ env: BUILD=cmake CPP_STD=11
+ - compiler: clang
+ env: BUILD=cmake CPP_STD=14
+ - compiler: clang
+ env: BUILD=cmake CPP_STD=17
+
+# CMake different C++ versions with gcc
+ - compiler: gcc
+ env: BUILD=cmake CPP_STD=98
+ - compiler: gcc
+ env: BUILD=cmake CPP_STD=11
+ - compiler: gcc
+ env: BUILD=cmake CPP_STD=14
+ - compiler: gcc
+ env: BUILD=cmake CPP_STD=17
+
+# New compilers can be added here. Need to be cleared when compiler becomes standard
+ - compiler: gcc
+ env: BUILD=cmake CPP_STD=17
+ - CC=gcc-10
+ - CXX=g++-10
+ addons:
+ apt:
+ packages: ['g++-10']
+ sources:
+ - sourceline: 'ppa:ubuntu-toolchain-r/test'
+ - compiler: clang
+ env: BUILD=cmake CPP_STD=17
+ - CC=clang-11
+ - CXX=clang++-11
+ addons:
+ apt:
+ sources:
+ - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main'
+ key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
+ packages: ['clang-11', 'libc++-11-dev', 'libc++abi-11-dev']
+
+# Specific other tests
+ - compiler: gcc
+ env: BUILD=test_report
+ addons:
+ apt:
+ packages:
+ - ant-optional
+ - compiler: gcc
+ env: BUILD=cmake_coverage
+ - compiler: gcc
+ env: BUILD=cmake_gtest
+ - compiler: clang
+ env: BUILD=autotools_gtest
+ - compiler: gcc
+ env: BUILD=autotools_cmake_install_test
+
+# MS DOS Build
+ - env: BUILD=make_dos
+ addons:
+ apt:
+ packages:
+ - dosbox
+
+# Docker images. Need to be cleared at times
+ - env: BUILD=docker_ubuntu_autotools
+ - env: BUILD=docker_ubuntu_dos
+ - env: BUILD=autotools_dist
+
+ - stage: extensive daily tests
+ compiler: gcc
+ env: BUILD=extensive_check
+ - compiler: clang
+ env: BUILD=extensive_check
+ - arch: ppc64le
+ compiler: gcc
+ env: BUILD=autotools
+ - arch: s390x
+ compiler: gcc
+ env: BUILD=autotools
+ - arch: arm64
+ compiler: gcc
+ env: BUILD=autotools
+ - compiler: gcc
+ env: BUILD=makefileworker
+ - compiler: clang
+ env: BUILD=autotools_install_and_test_examples
+
+# Deploy to github releases
+ - stage: deploy latest
+ env: BUILD=autotools_dist
+ script:
+ - export DATE=`date`
+ - git tag -f latest-passing-build -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER at $DATE"
+ - git push -f https://cpputest-travis:$GH_TOKEN@github.com/cpputest/cpputest.git --tags
+ - ../scripts/travis_ci_build.sh
+ - pwd
+ - ls
+ deploy:
+ provider: releases
+ #:
+ edge: true
+ token: $GH_TOKEN
+ tag_name: latest-passing-build
+ name: Latest passing build
+ release_notes: "This is the automatic release from Travis CI.\n\nWhenever a build passes, it gets released as Latest Passing Build.\n\nBuild number: $TRAVIS_BUILD_NUMBER\nDate: $DATE\nLog: $TRAVIS_BUILD_WEB_URL"
+ file:
+ - cpputest-latest.tar.gz
+ - cpputest-latest.zip
+ overwrite: true
+ on:
+ tags: false
+
before_script:
- export CPPUTEST_BUILD_DIR=$TRAVIS_BUILD_DIR/cpputest_build
- mkdir -p $CPPUTEST_BUILD_DIR && cd $CPPUTEST_BUILD_DIR
+
script:
- "../scripts/travis_ci_build.sh"
+
+after_failure:
+- "../scripts/travis_ci_after.sh"
+
+after_success:
+- "../scripts/travis_ci_after.sh"
+
+notifications:
+ slack:
+ secure: oOx4AGIiJB+j1pkIxlLeQh5qp7TF89Sj+3RzJRQuo6z0HocTz9yJgXPlDh1H9rLj5SxK/UKsk+WFafVuPdWakQ40LeYO49C/+e+mCDcS0ujLka6dvIE8v0SEb1PuaAGjJWdhiviAhSqu9YOKPYZs37lD3oqepuEpxeiXwsur9QU=
+
+env:
+ global:
+ secure: H6djbn5YP1P62n//ergaRZ4lIkneCzWp1Ok4F71kvvNiwlRzYDGll4kJT6MhVq6bBHeR81W/lwUd+RdjyqsJpVhj7DHXC/0k0h0xpAAm7LUhOl+6mIII1uhcMFqbeHvilwvDCzTQ6qv8Mzd1g0QfUECrmti9/U+/TTFJG0r0Zuc=
diff --git a/.travis_github_deployer.yml b/.travis_github_deployer.yml
deleted file mode 100644
index 08e782d2f..000000000
--- a/.travis_github_deployer.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-destination_repository: https://github.com/cpputest/cpputest.github.io.git
-
-files_to_deploy:
- cpputest_build/unit_test_report/*: unit_test_report
- cpputest_build/cpputest-3.7dev.tar.gz:
- destination: releases
- purge: yes
- cpputest_build/cpputest-3.7dev.zip:
- destination: releases
- purge: yes
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d0f53f22..0b6a4eeaf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,91 +1,154 @@
-project(CppUTest)
-
-set(CppUTest_version_major 3)
-set(CppUTest_version_minor 7dev)
-
# 2.6.3 is needed for ctest support
-cmake_minimum_required(VERSION 2.6.3)
-
-option(STD_C "Use the standard C library" ON)
-option(STD_CPP "Use the standard C++ library" ON)
-option(CPPUTEST_FLAGS "Use the CFLAGS/CXXFLAGS/LDFLAGS set by CppUTest" ON)
-option(MEMORY_LEAK_DETECTION "Enable memory leak detection" ON)
-option(EXTENSIONS "Use the CppUTest extenstion library" ON)
-option(MAP_FILE "Enable the creation of a map file" OFF)
-option(COVERAGE "Enable running with coverage" OFF)
-option(C++11 "Compile with C++11 support" OFF)
-
-option(TESTS "Compile and make tests for the code?" ON)
-
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "What kind of build this is" FORCE)
-endif(NOT CMAKE_BUILD_TYPE)
+# 3.1 is needed for target_sources
+# 3.8 is needed for try_compile improvements (CMP0067)
+cmake_minimum_required(VERSION 3.8...3.31)
+
+project(CppUTest
+ VERSION 4.0
+)
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.21")
+ # PROJECT_IS_TOP_LEVEL is defined automatically
+elseif (CMAKE_CURRENT_BINARY_DIR STREQUAL CMAKE_BINARY_DIR)
+ set(PROJECT_IS_TOP_LEVEL TRUE)
+else()
+ set(PROJECT_IS_TOP_LEVEL FALSE)
+endif()
+
+###############
+# Conan support
+###############
+if (EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
+ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+ message(STATUS "conan_basic_setup()")
+ conan_basic_setup()
+endif()
-# Pkg-config file
-include(FindPkgConfig)
-set(CppUTest_PKGCONFIG_FILE cpputest.pc)
-
-set(CppUTestRootDirectory ${PROJECT_SOURCE_DIR})
-
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CppUTestRootDirectory}/cmake/Modules)
-
-include("${CppUTestRootDirectory}/cmake/Modules/CppUTestConfigurationOptions.cmake")
include(CTest)
+include(CMakeDependentOption)
+option(CPPUTEST_STD_C_LIB_DISABLED "Disable the standard C library")
+
+cmake_dependent_option(CPPUTEST_STD_CPP_LIB_DISABLED "Use the standard C++ library"
+ OFF "NOT CPPUTEST_STD_C_LIB_DISABLED" ON)
+cmake_dependent_option(CPPUTEST_MEM_LEAK_DETECTION_DISABLED "Enable memory leak detection"
+ OFF "NOT BORLAND;NOT CPPUTEST_STD_C_LIB_DISABLED" ON)
+option(CPPUTEST_EXTENSIONS "Use the CppUTest extension library" ON)
+include(CheckTypeSize)
+check_type_size("long long" SIZEOF_LONGLONG)
+cmake_dependent_option(CPPUTEST_USE_LONG_LONG "Support long long"
+ YES "HAVE_SIZEOF_LONGLONG" OFF)
+
+cmake_dependent_option(CPPUTEST_BUILD_TESTING "Compile and make tests for CppUTest"
+ ${PROJECT_IS_TOP_LEVEL} "BUILD_TESTING" OFF)
+cmake_dependent_option(CPPUTEST_SPLIT_TESTS "Split tests into small executables"
+ OFF "CPPUTEST_BUILD_TESTING" OFF)
+cmake_dependent_option(CPPUTEST_TEST_GTEST "Test GoogleTest integration"
+ OFF "CPPUTEST_BUILD_TESTING" OFF)
+cmake_dependent_option(CPPUTEST_EXAMPLES "Compile and make examples?"
+ ${PROJECT_IS_TOP_LEVEL} "CPPUTEST_EXTENSIONS;NOT CPPUTEST_STD_CPP_LIB_DISABLED" OFF)
+
+if(NOT DEFINED CPPUTEST_PLATFORM)
+ if(DEFINED CPP_PLATFORM)
+ message(DEPRECATION
+ "The CPP_PLATFORM variable has been deprecated. "
+ "Use CPPUTEST_PLATFORM instead."
+ )
+ set(CPPUTEST_PLATFORM ${CPP_PLATFORM})
+ else()
+ if(CPPUTEST_STD_C_LIB_DISABLED)
+ set(CPPUTEST_PLATFORM OFF)
+ elseif(MSVC)
+ set(CPPUTEST_PLATFORM VisualCpp)
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "IAR")
+ set(CPPUTEST_PLATFORM Iar)
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "ARMCC")
+ set(CPPUTEST_PLATFORM armcc)
+ elseif(DOS)
+ set(CPPUTEST_PLATFORM Dos)
+ elseif(BORLAND)
+ set(CPPUTEST_PLATFORM Borland)
+ else()
+ set(CPPUTEST_PLATFORM Gcc)
+ endif()
+ endif()
+ message(STATUS "Setting CPPUTEST_PLATFORM: ${CPPUTEST_PLATFORM}")
+endif()
+set(CPPUTEST_PLATFORM "${CPPUTEST_PLATFORM}" CACHE STRING "Platform implementation")
+set_property(
+ CACHE CPPUTEST_PLATFORM
+ PROPERTY STRINGS
+ armcc Borland C2000 Dos Gcc Iar Keil Symbian VisualCpp OFF
+)
+
+include(CheckCXXSymbolExists)
+check_cxx_symbol_exists(fopen_s "stdio.h" CPPUTEST_HAVE_SECURE_STDLIB)
+cmake_dependent_option(CPPUTEST_USE_SECURE_STDLIB "Use MSVC safe functions"
+ ON "WIN32;CPPUTEST_HAVE_SECURE_STDLIB" OFF)
+
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
+if(NOT PROJECT_IS_TOP_LEVEL)
+ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
+endif()
+
+
+if(
+ (NOT CPPUTEST_MEM_LEAK_DETECTION_DISABLED)
+ AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.1")
+)
+ # Leak detection macros are not sane.
+ message(NOTICE "Disabling -fassume-sane-operators-new-delete which breaks leak detection")
+ add_compile_options($<$:-fno-assume-sane-operators-new-delete>)
+endif()
+
+if(PROJECT_IS_TOP_LEVEL)
+ include(cmake/warnings.cmake)
+endif()
+include(GNUInstallDirs)
+
+# Check for symbols before setting a lot of stuff
+include(CheckTypeSize)
+include(CheckStructHasMember)
+set(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX_FLAGS})
+check_cxx_symbol_exists(kill "signal.h" CPPUTEST_HAVE_KILL)
+check_cxx_symbol_exists(fork "unistd.h" CPPUTEST_HAVE_FORK)
+check_cxx_symbol_exists(waitpid "sys/wait.h" CPPUTEST_HAVE_WAITPID)
+check_cxx_symbol_exists(gettimeofday "sys/time.h" CPPUTEST_HAVE_GETTIMEOFDAY)
+check_cxx_symbol_exists(pthread_mutex_lock "pthread.h" CPPUTEST_HAVE_PTHREAD_MUTEX_LOCK)
+
+if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "IAR")
+ check_cxx_symbol_exists(strdup "string.h" CPPUTEST_HAVE_STRDUP)
+endif()
+check_type_size("long long" SIZEOF_LONGLONG LANGUAGE CXX)
+if(HAVE_SIZEOF_LONGLONG)
+ set(CPPUTEST_HAVE_LONG_LONG_INT ON)
+endif()
+
configure_file (
"${PROJECT_SOURCE_DIR}/config.h.cmake"
- "${PROJECT_BINARY_DIR}/config.h"
- )
-include_directories(${PROJECT_BINARY_DIR})
-add_definitions(-DHAVE_CONFIG_H)
+ "${PROJECT_BINARY_DIR}/generated/CppUTestGeneratedConfig.h"
+)
-include_directories(${CppUTestRootDirectory}/include)
-add_subdirectory(src/CppUTest)
+add_subdirectory(src)
-if (EXTENSIONS)
- add_subdirectory(src/CppUTestExt)
-endif (EXTENSIONS)
+target_include_directories(CppUTest
+ PUBLIC
+ $
+)
+target_compile_definitions(CppUTest
+ PUBLIC
+ HAVE_CONFIG_H
+)
-if (TESTS)
+if (CPPUTEST_BUILD_TESTING)
add_subdirectory(tests)
-endif (TESTS)
-
-# Pkg-config file.
-set (prefix "${CMAKE_INSTALL_PREFIX}")
-set (exec_prefix "${CMAKE_INSTALL_PREFIX}")
-set (libdir "${LIB_INSTALL_DIR}")
-set (includedir "${INCLUDE_INSTALL_DIR}")
-set (PACKAGE_VERSION "${CppUTest_version_major}.${CppUTest_version_minor}")
-
-configure_file (cpputest.pc.in
- ${CMAKE_CURRENT_SOURCE_DIR}/${CppUTest_PKGCONFIG_FILE} @ONLY)
-
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${CppUTest_PKGCONFIG_FILE}
- DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
- )
-
-message("
--------------------------------------------------------
-CppUTest Version ${CppUTest_version_major}.${CppUTest_version_minor}
-
-Current compiler options:
- CC: ${CMAKE_C_COMPILER}
- CXX: ${CMAKE_CXX_COMPILER}
- CppUTest CFLAGS: ${CPPUTEST_C_FLAGS}
- CppUTest CXXFLAGS: ${CPPUTEST_CXX_FLAGS}
- CppUTest LDFLAGS: ${CPPUTEST_LD_FLAGS}
-
-Features configure in CppUTest:
- Memory Leak Detection: ${MEMORY_LEAK_DETECTION}
- Compiling Extensions: ${EXTENSIONS}
- Use CppUTest flags: ${CPPUTEST_FLAGS}
-
- Using Standard C library: ${STD_C}
- Using Standard C++ library: ${STD_CPP}
- Using C++11 library: ${C++11}
+endif ()
- Generating map file: ${MAP_FILE}
- Compiling with coverage: ${COVERAGE}
+if (CPPUTEST_EXAMPLES)
+ add_subdirectory(examples)
+endif()
--------------------------------------------------------
-")
+if(PROJECT_IS_TOP_LEVEL)
+ include(cmake/install.cmake)
+endif()
diff --git a/CMakePresets.json b/CMakePresets.json
new file mode 100644
index 000000000..a4a3f8327
--- /dev/null
+++ b/CMakePresets.json
@@ -0,0 +1,183 @@
+{
+ "version": 3,
+ "configurePresets": [
+ {
+ "name": "defaults",
+ "binaryDir": "cpputest_build",
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "RelWithDebInfo",
+ "CMAKE_CXX_EXTENSIONS": false
+ }
+ },
+ {
+ "name": "GNU",
+ "inherits": ["defaults"],
+ "environment": {
+ "CFLAGS": "-Werror",
+ "CXXFLAGS": "-Werror"
+ },
+ "cacheVariables": {
+ "CMAKE_C_COMPILER": "gcc",
+ "CMAKE_CXX_COMPILER": "g++"
+ }
+ },
+ {
+ "name": "Clang",
+ "inherits": ["GNU"],
+ "cacheVariables": {
+ "CMAKE_C_COMPILER": "clang",
+ "CMAKE_CXX_COMPILER": "clang++"
+ }
+ },
+ {
+ "name": "clang-tidy",
+ "inherits": ["Clang"],
+ "cacheVariables": {
+ "CMAKE_CXX_CLANG_TIDY": "clang-tidy;-header-filter=.*",
+ "CMAKE_C_CLANG_TIDY": "clang-tidy;-header-filter=.*"
+ }
+ },
+ {
+ "name": "MSVC",
+ "inherits": ["defaults"],
+ "environment": {
+ "CFLAGS": "/WX",
+ "CXXFLAGS": "/WX"
+ }
+ },
+ {
+ "name": "ClangCL",
+ "inherits": ["MSVC"],
+ "generator": "Visual Studio 17 2022",
+ "toolset": "ClangCL"
+ },
+ {
+ "name": "MinGW",
+ "inherits": ["GNU"],
+ "environment": {
+ "LDFLAGS": "-static"
+ },
+ "cacheVariables": {
+ "CMAKE_C_COMPILER": "x86_64-w64-mingw32-gcc",
+ "CMAKE_CXX_COMPILER": "x86_64-w64-mingw32-g++",
+ "CMAKE_SYSTEM_NAME": "Windows",
+ "CMAKE_CROSSCOMPILING_EMULATOR": "wine"
+ }
+ },
+ {
+ "name": "arm-embedded",
+ "inherits": ["defaults"],
+ "toolchainFile": "${sourceDir}/cmake/Toolchains/arm-none-eabi-gcc.toolchain.cmake",
+ "cacheVariables": {
+ "CMAKE_CROSSCOMPILING_EMULATOR": "docker;run;--rm;-v=${sourceDir}:${sourceDir};multiarch/qemu-user-static:arm-7.1.0-2;qemu-arm-static;-cpu;cortex-m4"
+ }
+ },
+ {
+ "name": "coverage",
+ "inherits": ["GNU"],
+ "environment": {
+ "CFLAGS": "--coverage",
+ "CXXFLAGS": "--coverage"
+ },
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "Debug",
+ "CMAKE_CXX_STANDARD": "11",
+ "CPPUTEST_EXAMPLES": false
+ }
+ },
+ {
+ "name": "no-std-cpp",
+ "inherits": ["GNU"],
+ "environment": {
+ "CXXFLAGS": "-Werror -nostdinc++"
+ },
+ "cacheVariables": {
+ "CPPUTEST_STD_CPP_LIB_DISABLED": true
+ }
+ },
+ {
+ "name": "no-rtti",
+ "inherits": ["GNU"],
+ "environment": {
+ "CXXFLAGS": "-Werror -fno-rtti"
+ }
+ },
+ {
+ "name": "no-exceptions",
+ "inherits": ["GNU"],
+ "environment": {
+ "CXXFLAGS": "-Werror -fno-exceptions"
+ }
+ },
+ {
+ "name": "no-std-c",
+ "inherits": ["GNU"],
+ "environment": {
+ "CXXFLAGS": "-DCPPUTEST_CHAR_BIT=8 -Werror -nostdinc",
+ "CFLAGS": "-DCPPUTEST_CHAR_BIT=8 -Werror -nostdinc"
+ },
+ "cacheVariables": {
+ "CPPUTEST_STD_C_LIB_DISABLED": true
+ }
+ },
+ {
+ "name": "no-long-long",
+ "inherits": ["GNU"],
+ "cacheVariables": {
+ "CPPUTEST_USE_LONG_LONG": false
+ }
+ },
+ {
+ "name": "asan",
+ "inherits": ["Clang"],
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "Debug"
+ },
+ "environment": {
+ "CFLAGS": "-fsanitize=address -fno-omit-frame-pointer",
+ "CXXFLAGS": "-fsanitize=address -fno-omit-frame-pointer",
+ "LDFLAGS": "-fsanitize=address"
+ }
+ },
+ {
+ "name": "detailed",
+ "inherits": ["defaults"],
+ "cacheVariables": {
+ "CPPUTEST_TESTS_DETAILED": true
+ }
+ },
+ {
+ "name": "gtest",
+ "inherits": ["defaults"],
+ "generator": "Ninja Multi-Config",
+ "cacheVariables": {
+ "CPPUTEST_TEST_GTEST": true,
+ "gtest_build_tests": true
+ }
+ },
+ {
+ "name": "IAR",
+ "inherits": ["defaults"],
+ "cacheVariables": {
+ "CMAKE_SYSTEM_NAME": "Generic",
+ "CMAKE_C_COMPILER": "iccarm",
+ "CMAKE_C_FLAGS_INIT": "--cpu Cortex-M4F --dlib_config normal",
+ "CMAKE_CXX_COMPILER": "iccarm",
+ "CMAKE_CXX_FLAGS_INIT": "--cpu Cortex-M4F --dlib_config normal",
+ "CMAKE_EXE_LINKER_FLAGS": "--semihosting --config ${sourceDir}/platforms/iar/CppUTestTest.icf"
+ }
+ },
+ {
+ "name": "DOS",
+ "inherits": ["defaults"],
+ "generator": "Watcom WMake",
+ "cacheVariables": {
+ "CMAKE_SYSTEM_NAME": "DOS",
+ "CMAKE_BUILD_TYPE": "MinRelSize",
+ "CMAKE_CXX_STANDARD": "98",
+ "CPPUTEST_MEM_LEAK_DETECTION_DISABLED": true,
+ "CPPUTEST_STD_CPP_LIB_DISABLED": true
+ }
+ }
+ ]
+}
diff --git a/ChangeLog b/ChangeLog
index 2ab4e1466..399179154 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
-We don't keep a ChangeLog. Instead, check the revision on Github:
-https://github.com/cpputest/cpputest
\ No newline at end of file
+For changelog check the github page:
+https://github.com/cpputest/cpputest
+
diff --git a/CppUTest.dsw b/CppUTest.dsw
deleted file mode 100644
index cab2e26f9..000000000
--- a/CppUTest.dsw
+++ /dev/null
@@ -1,44 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "AllTests"=.\tests\AllTests.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name CppUTest
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "CppUTest"=.\CppUTest.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/CppUTest.sln b/CppUTest.sln
new file mode 100644
index 000000000..dfae564c3
--- /dev/null
+++ b/CppUTest.sln
@@ -0,0 +1,29 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AllTests", "tests\AllTests.vcproj", "{E66A12BB-1E17-4CFE-A358-9E0FA85E0F15}"
+ ProjectSection(ProjectDependencies) = postProject
+ {EC28C821-4AB8-458F-A821-C6E65607B781} = {EC28C821-4AB8-458F-A821-C6E65607B781}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppUTest", "CppUTest.vcproj", "{EC28C821-4AB8-458F-A821-C6E65607B781}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {E66A12BB-1E17-4CFE-A358-9E0FA85E0F15}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E66A12BB-1E17-4CFE-A358-9E0FA85E0F15}.Debug|Win32.Build.0 = Debug|Win32
+ {E66A12BB-1E17-4CFE-A358-9E0FA85E0F15}.Release|Win32.ActiveCfg = Release|Win32
+ {E66A12BB-1E17-4CFE-A358-9E0FA85E0F15}.Release|Win32.Build.0 = Release|Win32
+ {EC28C821-4AB8-458F-A821-C6E65607B781}.Debug|Win32.ActiveCfg = Debug|Win32
+ {EC28C821-4AB8-458F-A821-C6E65607B781}.Debug|Win32.Build.0 = Debug|Win32
+ {EC28C821-4AB8-458F-A821-C6E65607B781}.Release|Win32.ActiveCfg = Release|Win32
+ {EC28C821-4AB8-458F-A821-C6E65607B781}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/CppUTest.vcproj b/CppUTest.vcproj
index 77f215e51..9a8bfdcc2 100644
--- a/CppUTest.vcproj
+++ b/CppUTest.vcproj
@@ -1,10 +1,9 @@
@@ -147,9 +133,6 @@
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ RelativePath="src\CppUTestExt\CodeMemoryReportFormatter.cpp"
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CppUTest.vcxproj b/CppUTest.vcxproj
index 388ddd718..4a2f18e61 100644
--- a/CppUTest.vcxproj
+++ b/CppUTest.vcxproj
@@ -5,10 +5,18 @@
Debug
Win32
+
+ Debug
+ x64
+
Release
Win32
+
+ Release
+ x64
+
{F468F539-27BD-468E-BE64-DDE641400B51}
@@ -19,53 +27,66 @@
false
MultiByte
+
+ StaticLibrary
+ false
+ MultiByte
+
StaticLibrary
false
MultiByte
+
+ StaticLibrary
+ false
+ MultiByte
+
-
+
+
+
-
+
+
+
<_ProjectFileVersion>10.0.30319.1
- .\Debug\
- .\Debug\
- .\Release\
- .\Release\
+ lib\x86\
+ lib\x64\
+ cpputest_build\Debug\x86\$(ProjectName)\
+ cpputest_build\Debug\x64\$(ProjectName)\
+ lib\x86\
+ lib\x64\
+ cpputest_build\Release\x86\$(ProjectName)\
+ cpputest_build\Release\x64\$(ProjectName)\
$(ProjectName)d
+ $(ProjectName)d
Disabled
- .\include;.\include\Platforms\VisualCpp;%(AdditionalIncludeDirectories)
- _LIB;WIN32;_DEBUG;%(PreprocessorDefinitions)
+ .\include;%(AdditionalIncludeDirectories)
+ _LIB;WIN32;_DEBUG;STDC_WANT_SECURE_LIB;CPPUTEST_USE_LONG_LONG;%(PreprocessorDefinitions)
EnableFastChecks
MultiThreadedDebugDLL
- .\Debug/CppUTestd.pch
- .\Debug/
- .\Debug/
- .\Debug/
Level3
true
EditAndContinue
- ..\include\Platforms\VisualCpp\Platform.h;..\include\CppUTest\MemoryLeakDetectorMallocMacros.h;%(ForcedIncludeFiles)
_DEBUG;%(PreprocessorDefinitions)
0x0409
- $(OutDir)CppUTestd.lib
true
winmm.lib;%(AdditionalDependencies)
@@ -77,39 +98,97 @@
-
- copy $(OutDir)CppUTestd.lib lib\vs2010
-copy $(OutDir)CppUTestd.lib lib\CppUTestd.lib
-copy $(OutDir)vc100.pdb lib\vs2010
-
-
+
+
+ true
+
+
+
+
+ Disabled
+ .\include;%(AdditionalIncludeDirectories)
+ _LIB;WIN32;_DEBUG;STDC_WANT_SECURE_LIB;CPPUTEST_USE_LONG_LONG;%(PreprocessorDefinitions)
+ EnableFastChecks
+ MultiThreadedDebugDLL
+ Level3
+ true
+ ProgramDatabase
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ 0x0409
+
+
+ true
+ winmm.lib;%(AdditionalDependencies)
+
+
+ true
+ .\Debug/CppUTestd.bsc
+
+
+
+
+
+
true
- MaxSpeed
- .\include;.\include\Platforms\VisualCpp;%(AdditionalIncludeDirectories)
+ Disabled
+ .\include;%(AdditionalIncludeDirectories)
+ OnlyExplicitInline
+ WIN32;NDEBUG;_LIB;STDC_WANT_SECURE_LIB;CPPUTEST_USE_LONG_LONG;%(PreprocessorDefinitions)
+ true
+ MultiThreadedDLL
+ true
+ Level3
+ true
+ OldStyle
+ true
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ 0x0409
+
+
+ true
+ winmm.lib;%(AdditionalDependencies)
+
+
+ true
+ .\Release/CppUTest.bsc
+
+
+
+
+
+
+
+ true
+
+
+
+
+ Disabled
+ .\include;%(AdditionalIncludeDirectories)
OnlyExplicitInline
- WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+ WIN32;NDEBUG;_LIB;STDC_WANT_SECURE_LIB;CPPUTEST_USE_LONG_LONG;%(PreprocessorDefinitions)
true
- MultiThreaded
+ MultiThreadedDLL
true
- .\Release/CppUTest.pch
- .\Release/
- .\Release/
- .\Release/
Level3
true
- ..\include\Platforms\VisualCpp\Platform.h;..\include\CppUTest\MemoryLeakDetectorMallocMacros.h;%(ForcedIncludeFiles)
+ OldStyle
+ true
NDEBUG;%(PreprocessorDefinitions)
0x0409
- $(OutDir)CppUTest.lib
true
winmm.lib;%(AdditionalDependencies)
@@ -121,17 +200,15 @@ copy $(OutDir)vc100.pdb lib\vs2010
-
- copy $(OutDir)CppUTest.lib lib\vs2010
-copy $(OutDir)CppUTest.lib lib\CppUTest.lib
-
-
+
true
+
+
@@ -147,10 +224,12 @@ copy $(OutDir)CppUTest.lib lib\CppUTest.lib
+
+
@@ -159,22 +238,24 @@ copy $(OutDir)CppUTest.lib lib\CppUTest.lib
+
-
- %(AdditionalIncludeDirectories)
- %(PreprocessorDefinitions)
- %(PreprocessorDefinitions)
-
+
+
+
+
+
+
@@ -184,14 +265,20 @@ copy $(OutDir)CppUTest.lib lib\CppUTest.lib
+
+
+
+
+
+
diff --git a/CppUTestConfig.cmake.build.in b/CppUTestConfig.cmake.build.in
new file mode 100644
index 000000000..f8931224a
--- /dev/null
+++ b/CppUTestConfig.cmake.build.in
@@ -0,0 +1,9 @@
+@PACKAGE_INIT@
+
+set_and_check(CppUTest_INCLUDE_DIRS "@PACKAGE_INCLUDE_DIR@")
+if(NOT TARGET CppUTest)
+ include("${CMAKE_CURRENT_LIST_DIR}/CppUTestTargets.cmake")
+endif()
+set(CppUTest_LIBRARIES CppUTest CppUTestExt)
+
+check_required_components(CppUTest)
diff --git a/CppUTestConfig.cmake.install.in b/CppUTestConfig.cmake.install.in
new file mode 100644
index 000000000..3c79ea3aa
--- /dev/null
+++ b/CppUTestConfig.cmake.install.in
@@ -0,0 +1,9 @@
+@PACKAGE_INIT@
+
+set_and_check(CppUTest_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Modules")
+include("${CMAKE_CURRENT_LIST_DIR}/CppUTestTargets.cmake")
+set(CppUTest_LIBRARIES CppUTest CppUTestExt)
+include("${CMAKE_CURRENT_LIST_DIR}/Modules/CppUTestBuildTimeDiscoverTests.cmake")
+
+check_required_components(CppUTest)
diff --git a/CppUTest_VS2008.sln b/CppUTest_VS2008.sln
deleted file mode 100644
index f4589297d..000000000
--- a/CppUTest_VS2008.sln
+++ /dev/null
@@ -1,29 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual C++ Express 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AllTests", "tests\AllTests.vcproj", "{913088F6-37C0-4195-80E9-548C7C5303CB}"
- ProjectSection(ProjectDependencies) = postProject
- {F468F539-27BD-468E-BE64-DDE641400B51} = {F468F539-27BD-468E-BE64-DDE641400B51}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppUTest", "CppUTest.vcproj", "{F468F539-27BD-468E-BE64-DDE641400B51}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {913088F6-37C0-4195-80E9-548C7C5303CB}.Debug|Win32.ActiveCfg = Debug|Win32
- {913088F6-37C0-4195-80E9-548C7C5303CB}.Debug|Win32.Build.0 = Debug|Win32
- {913088F6-37C0-4195-80E9-548C7C5303CB}.Release|Win32.ActiveCfg = Release|Win32
- {913088F6-37C0-4195-80E9-548C7C5303CB}.Release|Win32.Build.0 = Release|Win32
- {F468F539-27BD-468E-BE64-DDE641400B51}.Debug|Win32.ActiveCfg = Debug|Win32
- {F468F539-27BD-468E-BE64-DDE641400B51}.Debug|Win32.Build.0 = Debug|Win32
- {F468F539-27BD-468E-BE64-DDE641400B51}.Release|Win32.ActiveCfg = Release|Win32
- {F468F539-27BD-468E-BE64-DDE641400B51}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/CppUTest_VS2010.sln b/CppUTest_VS201x.sln
similarity index 67%
rename from CppUTest_VS2010.sln
rename to CppUTest_VS201x.sln
index 12db37f5f..d794568ba 100644
--- a/CppUTest_VS2010.sln
+++ b/CppUTest_VS201x.sln
@@ -8,17 +8,27 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{913088F6-37C0-4195-80E9-548C7C5303CB}.Debug|Win32.ActiveCfg = Debug|Win32
{913088F6-37C0-4195-80E9-548C7C5303CB}.Debug|Win32.Build.0 = Debug|Win32
+ {913088F6-37C0-4195-80E9-548C7C5303CB}.Debug|x64.ActiveCfg = Debug|x64
+ {913088F6-37C0-4195-80E9-548C7C5303CB}.Debug|x64.Build.0 = Debug|x64
{913088F6-37C0-4195-80E9-548C7C5303CB}.Release|Win32.ActiveCfg = Release|Win32
{913088F6-37C0-4195-80E9-548C7C5303CB}.Release|Win32.Build.0 = Release|Win32
+ {913088F6-37C0-4195-80E9-548C7C5303CB}.Release|x64.ActiveCfg = Release|x64
+ {913088F6-37C0-4195-80E9-548C7C5303CB}.Release|x64.Build.0 = Release|x64
{F468F539-27BD-468E-BE64-DDE641400B51}.Debug|Win32.ActiveCfg = Debug|Win32
{F468F539-27BD-468E-BE64-DDE641400B51}.Debug|Win32.Build.0 = Debug|Win32
+ {F468F539-27BD-468E-BE64-DDE641400B51}.Debug|x64.ActiveCfg = Debug|x64
+ {F468F539-27BD-468E-BE64-DDE641400B51}.Debug|x64.Build.0 = Debug|x64
{F468F539-27BD-468E-BE64-DDE641400B51}.Release|Win32.ActiveCfg = Release|Win32
{F468F539-27BD-468E-BE64-DDE641400B51}.Release|Win32.Build.0 = Release|Win32
+ {F468F539-27BD-468E-BE64-DDE641400B51}.Release|x64.ActiveCfg = Release|x64
+ {F468F539-27BD-468E-BE64-DDE641400B51}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Makefile.am b/Makefile.am
index 3e9c25c74..3406079c7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,6 +24,21 @@ TESTS = $(check_PROGRAMS)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = cpputest.pc
+cmakemodulesdir = $(libdir)/CppUTest/cmake/Modules
+cmakemodules_DATA = \
+ cmake/Modules/CppUTestBuildTimeDiscoverTests.cmake
+
+cmakescriptsdir = $(libdir)/CppUTest/cmake/Scripts
+cmakescripts_DATA = \
+ cmake/Scripts/CppUTestBuildTimeDiscoverTests.cmake
+
+cmakedir = $(libdir)/CppUTest/cmake
+cmake_DATA = \
+ build/cmake_package_files/CppUTestConfig.cmake \
+ build/cmake_package_files/CppUTestConfigVersion.cmake \
+ build/cmake_package_files/CppUTestTargets-relwithdebinfo.cmake \
+ build/cmake_package_files/CppUTestTargets.cmake
+
EXTRA_DIST = \
cpputest.pc.in \
$(ALL_FILES_IN_GIT)
@@ -39,7 +54,9 @@ lib_libCppUTest_a_SOURCES = \
src/CppUTest/MemoryLeakDetector.cpp \
src/CppUTest/MemoryLeakWarningPlugin.cpp \
src/CppUTest/SimpleString.cpp \
+ src/CppUTest/SimpleStringInternalCache.cpp \
src/CppUTest/SimpleMutex.cpp \
+ src/CppUTest/TeamCityTestOutput.cpp \
src/CppUTest/TestFailure.cpp \
src/CppUTest/TestFilter.cpp \
src/CppUTest/TestHarness_c.cpp \
@@ -48,8 +65,9 @@ lib_libCppUTest_a_SOURCES = \
src/CppUTest/TestPlugin.cpp \
src/CppUTest/TestRegistry.cpp \
src/CppUTest/TestResult.cpp \
+ src/CppUTest/TestTestingFixture.cpp \
src/CppUTest/Utest.cpp \
- src/Platforms/$(CPP_PLATFORM)/UtestPlatform.cpp
+ src/Platforms/@CPP_PLATFORM@/UtestPlatform.cpp
include_cpputestdir = $(includedir)/CppUTest
@@ -59,14 +77,17 @@ include_cpputest_HEADERS = \
include/CppUTest/CppUTestConfig.h \
include/CppUTest/JUnitTestOutput.h \
include/CppUTest/MemoryLeakDetector.h \
+ include/CppUTest/MemoryLeakDetectorForceInclude.h \
include/CppUTest/MemoryLeakDetectorMallocMacros.h \
include/CppUTest/MemoryLeakDetectorNewMacros.h \
include/CppUTest/MemoryLeakWarningPlugin.h \
include/CppUTest/PlatformSpecificFunctions.h \
include/CppUTest/PlatformSpecificFunctions_c.h \
include/CppUTest/SimpleString.h \
+ include/CppUTest/SimpleStringInternalCache.h \
include/CppUTest/SimpleMutex.h \
include/CppUTest/StandardCLibrary.h \
+ include/CppUTest/TeamCityTestOutput.h \
include/CppUTest/TestFailure.h \
include/CppUTest/TestFilter.h \
include/CppUTest/TestHarness.h \
@@ -78,7 +99,8 @@ include_cpputest_HEADERS = \
include/CppUTest/TestResult.h \
include/CppUTest/TestTestingFixture.h \
include/CppUTest/Utest.h \
- include/CppUTest/UtestMacros.h
+ include/CppUTest/UtestMacros.h \
+ generated/CppUTestGeneratedConfig.h
lib_libCppUTestExt_a_CPPFLAGS = $(lib_libCppUTest_a_CPPFLAGS)
lib_libCppUTestExt_a_CFLAGS = $(lib_libCppUTest_a_CFLAGS)
@@ -86,6 +108,8 @@ lib_libCppUTestExt_a_CXXFLAGS = $(lib_libCppUTest_a_CXXFLAGS)
lib_libCppUTestExt_a_SOURCES = \
src/CppUTestExt/CodeMemoryReportFormatter.cpp \
+ src/CppUTestExt/GTest.cpp \
+ src/CppUTestExt/IEEE754ExceptionsPlugin.cpp \
src/CppUTestExt/MemoryReportAllocator.cpp \
src/CppUTestExt/MemoryReporterPlugin.cpp \
src/CppUTestExt/MemoryReportFormatter.cpp \
@@ -103,9 +127,12 @@ if INCLUDE_CPPUTEST_EXT
include_cpputestextdir = $(includedir)/CppUTestExt
include_cpputestext_HEADERS = \
+ include/CppUTestExt/CodeMemoryReportFormatter.h \
include/CppUTestExt/GMock.h \
include/CppUTestExt/GTest.h \
+ include/CppUTestExt/GTestSupport.h \
include/CppUTestExt/GTestConvertor.h \
+ include/CppUTestExt/IEEE754ExceptionsPlugin.h \
include/CppUTestExt/MemoryReportAllocator.h \
include/CppUTestExt/MemoryReporterPlugin.h \
include/CppUTestExt/MemoryReportFormatter.h \
@@ -119,72 +146,94 @@ include_cpputestext_HEADERS = \
include/CppUTestExt/MockSupport.h \
include/CppUTestExt/MockSupportPlugin.h \
include/CppUTestExt/MockSupport_c.h \
- include/CppUTestExt/OrderedTest.h
-
+ include/CppUTestExt/OrderedTest.h
+
endif
CppUTestTests_CPPFLAGS = $(lib_libCppUTest_a_CPPFLAGS)
CppUTestTests_CFLAGS = $(lib_libCppUTest_a_CFLAGS)
-CppUTestTests_CXXFLAGS = $(lib_libCppUTest_a_CXXFLAGS)
+CppUTestTests_CXXFLAGS = $(lib_libCppUTest_a_CXXFLAGS)
CppUTestTests_LDADD = lib/libCppUTest.a $(CPPUTEST_LDADD)
CppUTestTests_LDFLAGS = $(AM_LDFLAGS) $(CPPUTEST_LDFLAGS) $(CPPUTEST_ADDITIONAL_LDFLAGS)
CppUTestTests_SOURCES = \
- tests/AllocationInCFile.c \
- tests/AllocationInCppFile.cpp \
- tests/AllocLetTestFree.c \
- tests/AllocLetTestFreeTest.cpp \
- tests/AllTests.cpp \
- tests/CheatSheetTest.cpp \
- tests/CommandLineArgumentsTest.cpp \
- tests/CommandLineTestRunnerTest.cpp \
- tests/JUnitOutputTest.cpp \
- tests/MemoryLeakDetectorTest.cpp \
- tests/MemoryLeakOperatorOverloadsTest.cpp \
- tests/MemoryLeakWarningTest.cpp \
- tests/PluginTest.cpp \
- tests/PreprocessorTest.cpp \
- tests/SetPluginTest.cpp \
- tests/SimpleStringTest.cpp \
- tests/SimpleMutexTest.cpp \
- tests/TestFailureNaNTest.cpp \
- tests/TestFailureTest.cpp \
- tests/TestFilterTest.cpp \
- tests/TestHarness_cTest.cpp \
- tests/TestHarness_cTestCFile.c \
- tests/TestInstallerTest.cpp \
- tests/TestMemoryAllocatorTest.cpp \
- tests/TestOutputTest.cpp \
- tests/TestRegistryTest.cpp \
- tests/TestResultTest.cpp \
- tests/TestUTestMacro.cpp \
- tests/UtestTest.cpp
+ tests/CppUTest/AllocationInCFile.c \
+ tests/CppUTest/AllocationInCppFile.cpp \
+ tests/CppUTest/AllocLetTestFree.c \
+ tests/CppUTest/AllocLetTestFreeTest.cpp \
+ tests/CppUTest/AllTests.cpp \
+ tests/CppUTest/CheatSheetTest.cpp \
+ tests/CppUTest/CompatabilityTests.cpp \
+ tests/CppUTest/CommandLineArgumentsTest.cpp \
+ tests/CppUTest/CommandLineTestRunnerTest.cpp \
+ tests/CppUTest/DummyMemoryLeakDetector.cpp \
+ tests/CppUTest/JUnitOutputTest.cpp \
+ tests/CppUTest/MemoryLeakDetectorTest.cpp \
+ tests/CppUTest/MemoryOperatorOverloadTest.cpp \
+ tests/CppUTest/MemoryLeakWarningTest.cpp \
+ tests/CppUTest/PluginTest.cpp \
+ tests/CppUTest/PreprocessorTest.cpp \
+ tests/CppUTest/SetPluginTest.cpp \
+ tests/CppUTest/SimpleStringTest.cpp \
+ tests/CppUTest/SimpleStringCacheTest.cpp \
+ tests/CppUTest/SimpleMutexTest.cpp \
+ tests/CppUTest/TeamCityOutputTest.cpp \
+ tests/CppUTest/TestFailureNaNTest.cpp \
+ tests/CppUTest/TestFailureTest.cpp \
+ tests/CppUTest/TestFilterTest.cpp \
+ tests/CppUTest/TestHarness_cTest.cpp \
+ tests/CppUTest/TestHarness_cTestCFile.c \
+ tests/CppUTest/TestInstallerTest.cpp \
+ tests/CppUTest/TestMemoryAllocatorTest.cpp \
+ tests/CppUTest/TestOutputTest.cpp \
+ tests/CppUTest/TestRegistryTest.cpp \
+ tests/CppUTest/TestResultTest.cpp \
+ tests/CppUTest/TestUTestMacro.cpp \
+ tests/CppUTest/TestUTestStringMacro.cpp \
+ tests/CppUTest/UtestTest.cpp \
+ tests/CppUTest/UtestPlatformTest.cpp
CppUTestExtTests_CPPFLAGS = $(lib_libCppUTestExt_a_CPPFLAGS)
CppUTestExtTests_CFLAGS = $(lib_libCppUTestExt_a_CFLAGS)
-CppUTestExtTests_CXXFLAGS = $(lib_libCppUTestExt_a_CXXFLAGS)
+CppUTestExtTests_CXXFLAGS = $(lib_libCppUTestExt_a_CXXFLAGS)
CppUTestExtTests_LDADD = lib/libCppUTestExt.a lib/libCppUTest.a $(CPPUTEST_LDADD)
CppUTestExtTests_LDFLAGS = $(CppUTestTests_LDFLAGS)
CppUTestExtTests_SOURCES = \
tests/CppUTestExt/AllTests.cpp \
- tests/CppUTestExt/CodeMemoryReportFormatterTest.cpp \
+ tests/CppUTestExt/CodeMemoryReporterTest.cpp \
tests/CppUTestExt/GMockTest.cpp \
tests/CppUTestExt/GTest1Test.cpp \
tests/CppUTestExt/GTest2ConvertorTest.cpp \
+ tests/CppUTestExt/IEEE754PluginTest.cpp \
+ tests/CppUTestExt/IEEE754PluginTest_c.c \
tests/CppUTestExt/MemoryReportAllocatorTest.cpp \
tests/CppUTestExt/MemoryReporterPluginTest.cpp \
tests/CppUTestExt/MemoryReportFormatterTest.cpp \
tests/CppUTestExt/MockActualCallTest.cpp \
tests/CppUTestExt/MockCheatSheetTest.cpp \
+ tests/CppUTestExt/MockCallTest.cpp \
+ tests/CppUTestExt/MockComparatorCopierTest.cpp \
tests/CppUTestExt/MockExpectedCallTest.cpp \
- tests/CppUTestExt/MockExpectedFunctionsListTest.cpp \
+ tests/CppUTestExt/ExpectedFunctionsListTest.cpp \
+ tests/CppUTestExt/MockFailureReporterForTest.cpp \
tests/CppUTestExt/MockFailureTest.cpp \
+ tests/CppUTestExt/MockHierarchyTest.cpp \
+ tests/CppUTestExt/MockNamedValueTest.cpp \
+ tests/CppUTestExt/MockParameterTest.cpp \
tests/CppUTestExt/MockPluginTest.cpp \
tests/CppUTestExt/MockSupportTest.cpp \
tests/CppUTestExt/MockSupport_cTest.cpp \
tests/CppUTestExt/MockSupport_cTestCFile.c \
- tests/CppUTestExt/OrderedTestTest.cpp
+ tests/CppUTestExt/MockStrictOrderTest.cpp \
+ tests/CppUTestExt/MockReturnValueTest.cpp \
+ tests/CppUTestExt/OrderedTestTest.cpp \
+ tests/CppUTestExt/OrderedTestTest_c.c \
+ tests/CppUTestExt/MockFakeLongLong.cpp
+
+DISTCLEANFILES = \
+ filename.map.txt \
+ generated/CppUTestGeneratedConfig.h
if INCLUDE_GMOCKTESTS
@@ -196,11 +245,11 @@ if INCLUDE_GMOCKTESTS
#GTestTests_SOURCES = \
$(GMOCK_HOME)/test/gmock-spec-builders_test.cc \
- tests/CppUTestExt/AllTests.cpp
+ tests/CppUTestExt/AllTests.cpp
endif
-RUN_CPPUTEST_TESTS = ./$(CPPUTEST_TESTS) -r
-RUN_CPPUTESTEXT_TESTS = ./$(CPPUTESTEXT_TESTS) -r
+RUN_CPPUTEST_TESTS = ./$(CPPUTEST_TESTS)
+RUN_CPPUTESTEXT_TESTS = ./$(CPPUTESTEXT_TESTS)
valgrind: check
@if test "x$(CPPUTEST_HAS_VALGRIND)" = xno; then echo "Running the valgrind target without having valgrind. Perhaps install it first?"; exit 1; fi
@@ -212,70 +261,144 @@ if INCLUDE_CPPUTEST_EXT
./$(CPPUTESTEXT_TESTS)
endif
+
+cpputest_build_gtest112:
+ mkdir -p cpputest_build_gtest112
+ cd cpputest_build_gtest112; \
+ wget https://github.com/google/googletest/archive/refs/tags/release-1.12.1.zip -O gtest-1.12.1.zip && unzip gtest-1.12.1.zip; \
+ cd googletest-release-1.12.1; cmake .; make
+
+cpputest_build_gtest111:
+ mkdir -p cpputest_build_gtest111
+ cd cpputest_build_gtest111; \
+ wget https://github.com/google/googletest/archive/refs/tags/release-1.11.0.zip -O gtest-1.11.0.zip && unzip gtest-1.11.0.zip; \
+ cd googletest-release-1.11.0; cmake .; make
+
+cpputest_build_gtest110:
+ mkdir -p cpputest_build_gtest110
+ cd cpputest_build_gtest110; \
+ wget https://github.com/google/googletest/archive/refs/tags/release-1.10.0.zip -O gtest-1.10.0.zip && unzip gtest-1.10.0.zip; \
+ cd googletest-release-1.10.0; cmake .; make
+
+cpputest_build_gtest18:
+ mkdir -p cpputest_build_gtest18
+ cd cpputest_build_gtest18; \
+ wget https://github.com/google/googletest/archive/release-1.8.0.zip -O gtest-1.8.0.zip && unzip gtest-1.8.0.zip; \
+ cd googletest-release-1.8.0; cmake .; make
+
cpputest_build_gtest17:
mkdir -p cpputest_build_gtest17
cd cpputest_build_gtest17; \
- wget https://googlemock.googlecode.com/files/gmock-1.7.0.zip && unzip gmock-1.7.0.zip
- cd cpputest_build_gtest17/gmock-1.7.0; ./configure && make check
+ wget https://github.com/google/googletest/archive/release-1.7.0.zip -O gtest-1.7.0.zip && unzip gtest-1.7.0.zip; \
+ wget https://github.com/google/googlemock/archive/release-1.7.0.zip -O gmock-1.7.0.zip && unzip gmock-1.7.0.zip; \
+ mv googletest-release-1.7.0 googlemock-release-1.7.0/gtest; \
+ cd googlemock-release-1.7.0; autoreconf -i; ./configure && make
cpputest_build_gtest16:
mkdir -p cpputest_build_gtest16
cd cpputest_build_gtest16; \
- wget https://googlemock.googlecode.com/files/gmock-1.6.0.zip && unzip gmock-1.6.0.zip
- cd cpputest_build_gtest16/gmock-1.6.0; ./configure CXXFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1 && make check
+ wget https://github.com/google/googletest/archive/release-1.6.0.zip -O gtest-1.6.0.zip && unzip gtest-1.6.0.zip; \
+ wget https://github.com/google/googlemock/archive/release-1.6.0.zip -O gmock-1.6.0.zip && unzip gmock-1.6.0.zip; \
+ mv googletest-release-1.6.0 googlemock-release-1.6.0/gtest; \
+ cd googlemock-release-1.6.0; autoreconf -i; ./configure CXXFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1 && make
cpputest_build_gtest15:
mkdir -p cpputest_build_gtest15
cd cpputest_build_gtest15; \
- wget https://googlemock.googlecode.com/files/gmock-1.5.0.zip && unzip gmock-1.5.0.zip
- cd cpputest_build_gtest15/gmock-1.5.0; ./configure CXXFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1 && make
+ wget https://github.com/google/googletest/archive/release-1.5.0.zip -O gtest-1.5.0.zip && unzip gtest-1.5.0.zip; \
+ wget https://github.com/google/googlemock/archive/release-1.5.0.zip -O gmock-1.5.0.zip && unzip gmock-1.5.0.zip; \
+ mv googletest-release-1.5.0 googlemock-release-1.5.0/gtest; \
+ cd googlemock-release-1.5.0; autoreconf -i; ./configure CXXFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1 && make
check_gtest15: cpputest_build_gtest15
@echo "Build using gmock 1.5";
- export GMOCK_HOME=`pwd`/cpputest_build_gtest15/gmock-1.5.0; \
- make distclean; $(srcdir)/configure; make check
+ export GMOCK_HOME=`pwd`/cpputest_build_gtest15/googlemock-release-1.5.0; \
+ make distclean; $(srcdir)/configure --enable-std-cpp98; make check
check_gtest16: cpputest_build_gtest16
@echo "Build using gmock 1.6";
- export GMOCK_HOME=`pwd`/cpputest_build_gtest16/gmock-1.6.0; \
- make distclean; $(srcdir)/configure; make check
+ export GMOCK_HOME=`pwd`/cpputest_build_gtest16/googlemock-release-1.6.0; \
+ make distclean; $(srcdir)/configure --enable-std-cpp98; make check
check_gtest17: cpputest_build_gtest17
@echo "Build using gmock 1.7"
- export GMOCK_HOME=`pwd`/cpputest_build_gtest17/gmock-1.7.0; \
- make distclean; $(srcdir)/configure; make check
-
+ export GMOCK_HOME=`pwd`/cpputest_build_gtest17/googlemock-release-1.7.0; \
+ make distclean; $(srcdir)/configure --enable-std-cpp98; make check
+
+check_gtest18: cpputest_build_gtest18
+ @echo "Build using gmock 1.8"
+ export GMOCK_HOME=`pwd`/cpputest_build_gtest18/googletest-release-1.8.0/googlemock; \
+ export GTEST_HOME=`pwd`/cpputest_build_gtest18/googletest-release-1.8.0/googletest; \
+ make distclean; $(srcdir)/configure --enable-std-cpp98; make check
+
+check_gtest110: cpputest_build_gtest110
+ @echo "Build using gmock 1.10"
+ export GMOCK_MOCK=`pwd`/cpputest_build_gtest110/googletest-release-1.10.0; \
+ export GTEST_HOME=`pwd`/cpputest_build_gtest110/googletest-release-1.10.0; \
+ make distclean; $(srcdir)/configure --enable-std-cpp11; make check
+
+check_gtest111: cpputest_build_gtest111
+ @echo "Build using gmock 1.11"
+ export GMOCK_MOCK=`pwd`/cpputest_build_gtest111/googletest-release-1.11.0; \
+ export GTEST_HOME=`pwd`/cpputest_build_gtest111/googletest-release-1.11.0; \
+ make distclean; $(srcdir)/configure --enable-std-cpp11; make check
+
+check_gtest112: cpputest_build_gtest112
+ @echo "Build using gmock 1.12"
+ export GMOCK_MOCK=`pwd`/cpputest_build_gtest121/googletest-release-1.12.1; \
+ export GTEST_HOME=`pwd`/cpputest_build_gtest121/googletest-release-1.12.1; \
+ make distclean; $(srcdir)/configure --enable-std-cpp11; make check
+
remove_gtest_directories:
rm -rf cpputest_build_gtest15
rm -rf cpputest_build_gtest16
rm -rf cpputest_build_gtest17
+ rm -rf cpputest_build_gtest18
+ rm -rf cpputest_build_gtest110
+ rm -rf cpputest_build_gtest111
+ rm -rf cpputest_build_gtest112
-check_gtest: remove_gtest_directories check_gtest15 check_gtest16 check_gtest17
+check_gtest: remove_gtest_directories check_gtest15 check_gtest16 check_gtest17 check_gtest18 check_gtest110 check_gtest111 check_gtest112
check_basic:
@echo "If dash is available, run the configure with dash to find bash-isms and increase portability"
- make distclean; if test "x$(CPPUTEST_HAS_DASH)" = xyes; then CONFIG_SHELL=dash $(srcdir)/configure; fi
+ make distclean; if test "x$(CPPUTEST_HAS_DASH)" = xyes; then CONFIG_SHELL=dash $(srcdir)/configure; fi
@echo "Building and valgrinding (skipping this on MacOS due to buggy Valgrind"
if test "x$(CPPUTEST_ON_MACOSX)" = xno; then \
make distclean; $(srcdir)/configure; make valgrind; \
fi
-
+
@echo "Building without extensions"
make distclean; $(srcdir)/configure --disable-extensions; make check
+ @echo "Building with the Std C++ 98 turned on. Compiler acts differently then."
+ make distclean; $(srcdir)/configure --enable-std-cpp98; make
+
@echo "Building with the Std C++ 11 turned on. Compiler acts differently then."
make distclean; $(srcdir)/configure --enable-std-cpp11; make
+ @echo "Building with the Std C++ 14 turned on. Compiler acts differently then."
+ make distclean; $(srcdir)/configure --enable-std-cpp14; make
+
+ @echo "Building with the Std C++ 17 turned on. Compiler acts differently then."
+ make distclean; $(srcdir)/configure --enable-std-cpp17; make
+
+ @echo "Building with the Std C++ 20 turned on. Compiler acts differently then."
+ make distclean; $(srcdir)/configure --enable-std-cpp20; make
+
@echo "Building without the Standard C library"
make distclean; $(srcdir)/configure --disable-std-c; make
- @echo "Building without the Standard C++ library"
- make distclean; $(srcdir)/configure --disable-std-cpp; make check
+ @echo "Building without the Standard C++ library and without long long"
+ make distclean; $(srcdir)/configure --disable-std-cpp --disable-long-long; make check
@echo "Building without memory leak detection"
make distclean; $(srcdir)/configure --disable-memory-leak-detection; make check
+ @echo "Building with address sanitizer"
+ make distclean; $(srcdir)/configure --enable-sanitize-address; make check
+
@echo "Building without memory leak detection and without Standard C++"
make distclean; $(srcdir)/configure --disable-memory-leak-detection --disable-std-cpp; make check
@@ -304,35 +427,56 @@ check_special_situations:
check_coverage:
@echo "Compile with coverage (switch to clang for Mac OSX)"
if test "x$(CPPUTEST_HAS_CLANG)" = xyes && test "x$(CPPUTEST_ON_MACOSX)" = xyes; then \
- echo "Compiling with clang"; make distclean; $(srcdir)/configure CC="clang" CXX="clang++" --enable-coverage; \
+ echo "Compiling with clang"; make distclean; $(srcdir)/configure CC="clang" CXX="clang++" --enable-coverage CFLAGS="-O0" CXXFLAGS="-O0"; \
else \
- make distclean; $(srcdir)/configure -enable-coverage; \
+ make distclean; $(srcdir)/configure -enable-coverage CFLAGS="-O0" CXXFLAGS="-O0"; \
fi
-
+
make check
- ./$(CPPUTEST_TESTS) >> test_output.txt; ./$(CPPUTESTEXT_TESTS) >> test_output.txt
+ ./$(CPPUTEST_TESTS) >> test_output.txt; ./$(CPPUTESTEXT_TESTS) >> test_output.txt
$(SILENCE)for f in `ls *.gcno` ; do \
gcov $(CppUTestExtTests_SOURCES) $(CppUTestTests_SOURCES) $(lib_libCppUTest_a_SOURCES) $(lib_libCppUTestExt_a_SOURCES) -o $$f 1>>gcov_output.txt 2>>gcov_error.txt; \
done
$(srcdir)/scripts/filterGcov.sh gcov_output.txt gcov_error.txt gcov_report.txt test_output.txt
cat gcov_report.txt
- if test "x$(CPPUTEST_HAS_LCOV)" = xyes; then lcov -c -d . -o coverage.info; genhtml -o test_coverage coverage.info; fi
- rm -f gcov_output.txt gcov_error.txt gcov_report.txt test_output.txt gcov_report.txt.html coverage.info
+ if test "x$(CPPUTEST_HAS_LCOV)" = xyes; then lcov -c -d . -o temp.info; lcov -r temp.info /usr\* -o coverage.info; genhtml -o test_coverage coverage.info; fi
+
+remove_coverage_output:
+ rm -f gcov_output.txt gcov_error.txt gcov_report.txt test_output.txt gcov_report.txt.html temp.info coverage.info
rm -rf test_coverage
check_examples:
@echo "Using the old Makefile and examples"
make distclean
- $(MAKE) -C $(srcdir) -f Makefile_using_MakefileWorker extensions
+ $(MAKE) -C $(srcdir) -f Makefile_using_MakefileWorker extensions
$(MAKE) -C $(srcdir)/examples all clean
-
+
@echo "Compiling and running the examples. This will use the old Makefile"
make distclean; $(srcdir)/configure; make; $(MAKE) -C $(srcdir)/examples all clean CPPUTEST_LIB_LINK_DIR="`pwd`/lib"
-check_all: check_basic check_special_situations check_coverage check_examples check_gtest
+check_all: check_basic check_special_situations check_coverage remove_coverage_output check_examples check_gtest
@echo "Last... one normal build and test"
- make distclean; $(srcdir)/configure; make check; $(RUN_CPPUTEST_TESTS); $(RUN_CPPUTESTEXT_TESTS)
-
-
+ make distclean; $(srcdir)/configure; make check;
+ @echo "Check running tests repeatedly"
+ $(RUN_CPPUTEST_TESTS) - r; $(RUN_CPPUTESTEXT_TESTS) -r
+ @echo "Check running tests in separate process (CppUTestExtTests TEST_GROUP(TestOrderedTestMacro) would have to fail)"
+ $(RUN_CPPUTEST_TESTS) -p;
+
+# Mac OSX adds an annoying directory when packaging. This can be prevented by setting COPYFILE_DISABLE=1
+# However, I've not figured out how to set it automatically and neither google nor stackoverflow knew the answer.
+# The automake mailing list is still thinking about it, and thus, I've added this check so that I don't forget to do it :)
+# More info: http://superuser.com/questions/61185/why-do-i-get-files-like-foo-in-my-tarball-on-os-x
+dist-hook:
+ if test "x$(CPPUTEST_ON_MACOSX)" = "xyes"; then \
+ if test ! "x$(COPYFILE_DISABLE)" = "x1"; then \
+ echo ""; \
+ echo 'ERROR: When packaging on MacOSX, please run "COPYFILE_DISABLE=1 make dist"'; \
+ echo ""; \
+ exit 1; \
+ fi \
+ fi
+
+distclean-local:
+ test -z "generated" || rmdir generated
diff --git a/Makefile_using_MakefileWorker b/Makefile_using_MakefileWorker
index a4b0a12b2..66ec53932 100644
--- a/Makefile_using_MakefileWorker
+++ b/Makefile_using_MakefileWorker
@@ -11,14 +11,15 @@ endif
CPPUTEST_HOME = .
OLD_MAKE = oldmake
+MAKE_CMD = make -f $(CPPUTEST_HOME)/Makefile_using_MakefileWorker
CPPUTEST_ENABLE_DEBUG = Y
SRC_DIRS = \
src/CppUTest \
src/Platforms/$(CPP_PLATFORM)
-
+
TEST_SRC_DIRS = \
- tests
+ tests/CppUTest
INCLUDE_DIRS =\
include
@@ -27,75 +28,119 @@ include $(CPPUTEST_HOME)/build/MakefileWorker.mk
#these are a sample of the other alternative flag settings
.PHONY: test_all
-test_all: start test_old_make
+test_all: start
+ $(MAKE_CMD) test_defaults
+ $(MAKE_CMD) test_disable_std_cpp
+ $(MAKE_CMD) test_disable_memory_leak_detection
+ $(MAKE_CMD) test_disable_std_cpp_and_leak_detection
+ $(MAKE_CMD) test_disable_debug
+ $(MAKE_CMD) test_override_flags
+ $(MAKE_CMD) test_disable_std_c
+ $(MAKE_CMD) test_target_platform
+ $(MAKE_CMD) test_override_and_disable
+ $(MAKE_CMD) test_examples
+ $(MAKE_CMD) test_junit_output
+ $(MAKE_CMD) test_gcov
+ $(MAKE_CMD) test_vpath
+ $(MAKE_CMD) test_vpath_install
+
+.PHONY: test_defaults
+test_defaults: start
@echo Building with the default flags.
- make clean
- $(TIME) make
+ $(MAKE_CMD) clean
+ $(TIME) $(MAKE_CMD)
./$(TEST_TARGET) -r
- make clean
- @echo Building with the STDC++ new disabled.
- $(TIME) make CPPUTEST_USE_STD_CPP_LIB=Y extensions
- make CPPUTEST_USE_STD_CPP_LIB=Y cleanExtensions
+ $(MAKE_CMD) clean
+
+.PHONY: test_disable_std_cpp
+test_disable_std_cpp: start
+ @echo Building with the STDC++ new disabled.
+ $(TIME) $(MAKE_CMD) CPPUTEST_USE_STD_CPP_LIB=N extensions
+ $(MAKE_CMD) CPPUTEST_USE_STD_CPP_LIB=N cleanExtensions
+
+.PHONY: test_disable_memory_leak_detection
+test_disable_memory_leak_detection: start
@echo Building with Memory Leak Detection disabled
- $(TIME) make CPPUTEST_USE_MEM_LEAK_DETECTION=N extensions
- make CPPUTEST_USE_MEM_LEAK_DETECTION=N cleanExtensions
+ $(TIME) $(MAKE_CMD) CPPUTEST_USE_MEM_LEAK_DETECTION=N extensions
+ $(MAKE_CMD) CPPUTEST_USE_MEM_LEAK_DETECTION=N cleanExtensions
+
+.PHONY: test_disable_std_cpp_and_leak_detection
+test_disable_std_cpp_and_leak_detection: start
@echo Building with Memory Leak Detection disabled and STD C++ disabled
- $(TIME) make CPPUTEST_USE_MEM_LEAK_DETECTION=N CPPUTEST_USE_STD_CPP_LIB=Y extensions
- make CPPUTEST_USE_MEM_LEAK_DETECTION=N CPPUTEST_USE_STD_CPP_LIB=Y cleanExtensions
+ $(TIME) $(MAKE_CMD) CPPUTEST_USE_MEM_LEAK_DETECTION=N CPPUTEST_USE_STD_CPP_LIB=Y extensions
+ $(MAKE_CMD) CPPUTEST_USE_MEM_LEAK_DETECTION=N CPPUTEST_USE_STD_CPP_LIB=Y cleanExtensions
+
+.PHONY: test_disable_debug
+test_disable_debug: start
@echo Building with debug disabled
- $(TIME) make CPPUTEST_ENABLE_DEBUG=N extensions
- make CPPUTEST_ENABLE_DEBUG=N cleanExtensions
+ $(TIME) $(MAKE_CMD) CPPUTEST_ENABLE_DEBUG=N extensions
+ $(MAKE_CMD) CPPUTEST_ENABLE_DEBUG=N cleanExtensions
+
+.PHONY: test_override_flags
+test_override_flags: start
@echo Building with overridden CXXFLAGS and CFLAGS and CPPFLAGS
- $(TIME) make CLFAGS="" CXXFLAGS="" CPPFLAGS="-Iinclude"
- make CFLAGS="" CXXFLAGS="" clean
+ $(TIME) $(MAKE_CMD) CFLAGS="" CXXFLAGS="" CPPFLAGS="-Iinclude"
+ $(MAKE_CMD) CFLAGS="" CXXFLAGS="" clean
+
+.PHONY: test_disable_std_c
+test_disable_std_c: start
@echo Building without Standard C library includes
- $(TIME) make CPPUTEST_USE_STD_C_LIB=N all_no_tests
- make CPPUTEST_USE_STD_C_LIB=N clean
+ $(TIME) $(MAKE_CMD) CPPUTEST_USE_STD_C_LIB=N CPPUTEST_ADDITIONAL_CPPFLAGS="-DCPPUTEST_CHAR_BIT=8" all_no_tests
+ $(MAKE_CMD) CPPUTEST_USE_STD_C_LIB=N clean
+
+.PHONY: test_target_platform
+test_target_platform: start
@echo Building with a different TARGET_PLATFORM
- make TARGET_PLATFORM=real_platform
+ $(MAKE_CMD) TARGET_PLATFORM=real_platform
+
+.PHONY: test_override_and_disable
+test_override_and_disable: start
@echo Building with overridden CXXFLAGS and CFLAGS and memory leak and STDC++ disabled
- $(TIME) make CLFAGS="" CXXFLAGS="" CPPFLAGS="-Iinclude -DCPPUTEST_STD_CPP_LIB_DISABLED -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED"
- make CFLAGS="" CXXFLAGS="" CPPFLAGS="-DCPPUTEST_STD_CPP_LIB_DISABLED -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED" clean
- @echo Building examples
- make cleanExamples
- $(TIME) make examples
- make cleanExamples
+ $(TIME) $(MAKE_CMD) CFLAGS="" CXXFLAGS="" CPPFLAGS="-Iinclude -DCPPUTEST_STD_CPP_LIB_DISABLED -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED"
+ $(MAKE_CMD) CFLAGS="" CXXFLAGS="" CPPFLAGS="-DCPPUTEST_STD_CPP_LIB_DISABLED -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED" clean
+
+.PHONY: test_examples
+test_examples: start
+ @echo Building examples
+ $(MAKE_CMD) cleanExamples
+ $(TIME) $(MAKE_CMD) examples
+ $(MAKE_CMD) cleanExamples
+
+.PHONY: test_junit_output
+test_junit_output: start
@echo Testing JUnit output
- $(TIME) make
+ $(TIME) $(MAKE_CMD)
$(SILENCE)./$(TEST_TARGET) -ojunit > junit_run_output
$(SILENCE)if [ -s junit_run_output ]; then echo "JUnit run has output. Build failed!"; exit 1; fi
- make clean
- make CPPUTEST_MAP_FILE=map.txt
- make clean
+ $(MAKE_CMD) clean
+ $(MAKE_CMD) CPPUTEST_MAP_FILE=map.txt
+ $(MAKE_CMD) clean
+
+.PHONY: test_gcov
+test_gcov: start
@echo Testing GCOV usage
- $(TIME) make CPPUTEST_USE_GCOV=Y everythingInstall
- make gcov
- make -f Makefile_CppUTestExt gcov
- make -C examples gcov
- make cleanEverythingInstall
+ $(TIME) $(MAKE_CMD) CPPUTEST_USE_GCOV=Y everythingInstall
+ $(MAKE_CMD) gcov
+ $(MAKE) -f Makefile_CppUTestExt gcov
+ $(MAKE) -C examples gcov
+ $(MAKE_CMD) cleanEverythingInstall
+
+.PHONY: test_vpath
+test_vpath: start
@echo Testing VPATH usage
- $(TIME) make CPPUTEST_USE_GCOV=Y CPPUTEST_USE_VPATH=Y everythingInstall
- make CPPUTEST_USE_VPATH=Y gcov
- make CPPUTEST_USE_VPATH=Y -f Makefile_CppUTestExt gcov
- make CPPUTEST_USE_VPATH=Y -C examples gcov
- make clean cleanExamples
+ $(TIME) $(MAKE_CMD) CPPUTEST_USE_GCOV=Y CPPUTEST_USE_VPATH=Y everythingInstall
+ $(MAKE_CMD) CPPUTEST_USE_VPATH=Y gcov
+ $(MAKE) CPPUTEST_USE_VPATH=Y -f Makefile_CppUTestExt gcov
+ $(MAKE) CPPUTEST_USE_VPATH=Y -C examples gcov
+ $(MAKE_CMD) clean cleanExamples
+
+.PHONY: test_vpath_install
+test_vpath_install: start
@echo Testing VPATH usage
- $(TIME) make CPPUTEST_USE_VPATH=Y everythingInstall
- make CPPUTEST_USE_VPATH=Y cleanEverythingInstall
- make flags
- make debug
-
-HAS_OLD_MAKE = $(shell $(OLD_MAKE) -v 2>/dev/null)
-
-test_old_make:
- $(SILENCE)if [ "$(HAS_OLD_MAKE)" = "" ]; then \
- echo "Old make with the name $(OLD_MAKE) not found. Skipping testing with old make version"; \
- else \
- $(OLD_MAKE) -f Makefile_for_old_make clean && \
- $(OLD_MAKE) -f Makefile_for_old_make && \
- $(OLD_MAKE) -f Makefile_for_old_make extensions && \
- $(OLD_MAKE) -f Makefile_for_old_make clean; \
- fi
+ $(TIME) $(MAKE_CMD) CPPUTEST_USE_VPATH=Y everythingInstall
+ $(MAKE_CMD) CPPUTEST_USE_VPATH=Y cleanEverythingInstall
+ $(MAKE_CMD) flags
+ $(MAKE_CMD) debug
.PHONY: examples
examples: $(TEST_TARGET) extensions
diff --git a/README b/README
index 3415f3bec..3b3d0089e 100644
--- a/README
+++ b/README
@@ -1,3 +1,3 @@
Please see the README.md. This file exists to be compliant to GNU coding standards.
-
+
diff --git a/README.md b/README.md
index 211060148..8d6ae3727 100644
--- a/README.md
+++ b/README.md
@@ -1,43 +1,58 @@
-CppUTest
-========
+# CppUTest
-CppUTest unit testing and mocking framework for C/C++
+[](https://github.com/cpputest/cpputest/actions/workflows/basic.yml)
+[](https://ci.appveyor.com/project/basvodde/cpputest)
+[](https://coveralls.io/github/cpputest/cpputest?branch=master)
+[](https://conan.io/center/cpputest)
-[More information on the project page](http://cpputest.github.com)
+CppUTest unit testing and mocking framework for C/C++
-[](https://travis-ci.org/cpputest/cpputest)
+[More information on the project page](https://cpputest.github.io)
+Slack channel:
+[Join if link not expired](https://join.slack.com/t/cpputest/shared_invite/zt-epq97u9h-6yBQHHl2cvUADjEENtdASw)
## Getting Started
You'll need to do the following to get started:
-Building from source (unix-based, cygwin, MacOSX):
+Building from source (Unix-based, Cygwin, MacOS):
+
+```bash
+git clone https://github.com/cpputest/cpputest.git
+cd cpputest
+mkdir cpputest_build
+cd cpputest_build
+autoreconf .. -i
+../configure
+make
+```
-* Download latest version
-* configure
-* make
-* make check
-* You can use "make install" if you want to install CppUTest system-wide
+You can use `make install` if you want to install CppUTest system-wide.
You can also use CMake, which also works for Windows Visual Studio.
-* Download latest version
-* cmake CMakeList.txt
-* make
+```bash
+git clone https://github.com/cpputest/cpputest.git
+cd cpputest
+mkdir cpputest_build
+cmake -B cpputest_build
+cmake --build cpputest_build
+```
Then to get started, you'll need to do the following:
-* Add the include path to the Makefile. Something like:
- * CPPFLAGS += -I(CPPUTEST_HOME)/include
-* Add the memory leak macros to you Makefile (needed for additional debug info!). Something like:
- * CXXFLAGS += -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorNewMacros.h
- * CFLAGS += -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorMallocMacros.h
+
+* Add the include path to the Makefile. Something like:
+ * `CPPFLAGS += -I$(CPPUTEST_HOME)/include`
+* Add the memory leak macros to your Makefile (needed for additional debug info!). Something like:
+ * `CXXFLAGS += -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorNewMacros.h`
+ * `CFLAGS += -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorMallocMacros.h`
* Add the library linking to your Makefile. Something like:
- * LD_LIBRARIES = -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
+ * `LD_LIBRARIES = -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt`
After this, you can write your first test:
-```C++
+```cpp
TEST_GROUP(FirstTestGroup)
{
};
@@ -48,62 +63,71 @@ TEST(FirstTestGroup, FirstTest)
}
```
+You can build and install cpputest using [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
+
+```console
+$ vcpkg install cpputest (More information: https://github.com/microsoft/vcpkg)
+```
+
## Command line switches
-* -v verbose, print each test name as it runs
-* -r# repeat the tests some number of times, default is one, default is # is not specified is 2. This is handy if you are experiencing memory leaks. A second run that has no leaks indicates that someone
-* -g group only run test whose group contains the substring group
-* -n name only run test whose name contains the substring name
+* `-h` help, shows the latest help, including the parameters we've implemented after updating this README page.
+* `-v` verbose, print each test name as it runs
+* `-r#` repeat the tests some number of times, default is one, default if # is not specified is 2. This is handy if you are experiencing memory leaks related to statics and caches.
+* `-s#` random shuffle the test execution order. # is an integer used for seeding the random number generator. # is optional, and if omitted, the seed value is chosen automatically, which results in a different order every time. The seed value is printed to console to make it possible to reproduce a previously generated execution order. Handy for detecting problems related to dependencies between tests.
+* `-g` group only run test whose group contains the substring group
+* `-n` name only run test whose name contains the substring name
+* `-f` crash on fail, run the tests as normal but, when a test fails, crash rather than report the failure in the normal way
## Test Macros
-* TEST(group, name) - define a test
-* IGNORE_TEST(group, name) - turn off the execution of a test
-* TEST_GROUP(group) - Declare a test group to which certain tests belong. This will also create thelink needed from another library.
-* TEST_GROUP_BASE(group, base) - Same as TEST_GROUP, just use a different base class than Utest
-* TEST_SETUP() - Declare a void setup method in a TEST_GROUP - this is the same as declaring void setup()
-* TEST_TEARDOWN() - Declare a void setup method in a TEST_GROUP
-* IMPORT_TEST_GROUP(group) - Export the name of a test group so it can be linked in from a library. Needs to be done in main.
+* `TEST(group, name)` - define a test
+* `IGNORE_TEST(group, name)` - turn off the execution of a test
+* `TEST_GROUP(group)` - Declare a test group to which certain tests belong. This will also create the link needed from another library.
+* `TEST_GROUP_BASE(group, base)` - Same as `TEST_GROUP`, just use a different base class than Utest
+* `TEST_SETUP()` - Declare a void setup method in a `TEST_GROUP` - this is the same as declaring void `setup()`
+* `TEST_TEARDOWN()` - Declare a void setup method in a `TEST_GROUP`
+* `IMPORT_TEST_GROUP(group)` - Export the name of a test group so it can be linked in from a library. Needs to be done in `main`.
## Set up and tear down support
-* Each TEST_GROUP may contain a setup and/or a teardown method.
-* setup() is called prior to each TEST body and teardown() is called after the test body.
+* Each `TEST_GROUP` may contain a `setup` and/or a `teardown` method.
+* `setup()` is called prior to each `TEST` body and `teardown()` is called after the test body.
## Assertion Macros
The failure of one of these macros causes the current test to immediately exit
-* CHECK(boolean condition) - checks any boolean result
-* CHECK_TRUE(boolean condition) - checks for true
-* CHECK_FALSE(boolean condition) - checks for false
-* CHECK_EQUAL(expected, actual) - checks for equality between entities using ==. So if you have a class that supports operator==() you can use this macro to compare two instances.
-* STRCMP_EQUAL(expected, actual) - check const char* strings for equality using strcmp
-* LONGS_EQUAL(expected, actual) - Compares two numbers
-* BYTES_EQUAL(expected, actual) - Compares two numbers, eight bits wide
-* POINTERS_EQUAL(expected, actual) - Compares two const void *
-* DOUBLES_EQUAL(expected, actual, tolerance) - Compares two doubles within some tolerance
-* FAIL(text) - always fails
+* `CHECK(boolean condition)` - checks any boolean result
+* `CHECK_TRUE(boolean condition)` - checks for true
+* `CHECK_FALSE(boolean condition)` - checks for false
+* `CHECK_EQUAL(expected, actual)` - checks for equality between entities using `==`. So if you have a class that supports `operator==()` you can use this macro to compare two instances.
+* `STRCMP_EQUAL(expected, actual)` - check const `char*` strings for equality using `strcmp`
+* `LONGS_EQUAL(expected, actual)` - Compares two numbers
+* `BYTES_EQUAL(expected, actual)` - Compares two numbers, eight bits wide
+* `POINTERS_EQUAL(expected, actual)` - Compares two `const void *`
+* `DOUBLES_EQUAL(expected, actual, tolerance)` - Compares two doubles within some tolerance
+* `ENUMS_EQUAL_INT(excepted, actual)` - Compares two enums which their underlying type is `int`
+* `ENUMS_EQUAL_TYPE(underlying_type, excepted, actual)` - Compares two enums which they have the same underlying type
+* `FAIL(text)` - always fails
+* `TEST_EXIT` - Exit the test without failure - useful for contract testing (implementing an assert fake)
+Customize `CHECK_EQUAL` to work with your types that support `operator==()`
-Customize CHECK_EQUAL to work with your types that support operator==()
+- Create the function: `SimpleString StringFrom(const yourType&)`
-* Create the function:
-** SimpleString StringFrom (const yourType&)
-
The Extensions directory has a few of these.
## Building default checks with TestPlugin
* CppUTest can support extra checking functionality by inserting TestPlugins
* TestPlugin is derived from the TestPlugin class and can be inserted in the TestRegistry via the installPlugin method.
-* All TestPlugins are called before and after running all tests and before and after running a single test (like Setup and Teardown). TestPlugins are typically inserted in the main.
* TestPlugins can be used for, for example, system stability and resource handling like files, memory or network connection clean-up.
* In CppUTest, the memory leak detection is done via a default enabled TestPlugin
Example of a main with a TestPlugin:
-```C++
+```cpp
int main(int ac, char** av)
{
LogPlugin logPlugin;
@@ -117,21 +141,21 @@ int main(int ac, char** av)
Memory leak detection
* A platform specific memory leak detection mechanism is provided.
-* If a test fails and has allocated memory prior to the fail and that memory is not cleaned up by TearDown, a memory leak is reported.
+* If a test fails and has allocated memory prior to the fail and that memory is not cleaned up by TearDown, a memory leak is reported.
It is best to only chase memory leaks when other errors have been eliminated.
-* Some code uses lazy initialization and appears to leak when it really does not (for example: gcc stringstream used to in an earlier release). One cause is that some standard library calls allocate something and do not free it until after main (or never).
- To find out if a memory leak is due to lazy initialization set the -r switch to run tests twice. The signature of this situation is that the first run shows leaks and the second run shows no leaks. When both runs show leaks, you have a leak to find.
+* Some code uses lazy initialization and appears to leak when it really does not (for example: gcc stringstream used to in an earlier release). One cause is that some standard library calls allocate something and do not free it until after `main` (or never).
+ To find out if a memory leak is due to lazy initialization set the `-r` switch to run tests twice. The signature of this situation is that the first run shows leaks and the second run shows no leaks. When both runs show leaks, you have a leak to find.
## How is memory leak detection implemented?
-* Before setup() a memory usage checkpoint is recorded
-* After teardown() another checkpoint is taken and compared to the original checkpoint
+* Before `setup()` a memory usage checkpoint is recorded
+* After `teardown()` another checkpoint is taken and compared to the original checkpoint
* In Visual Studio the MS debug heap capabilities are used
-* For GCC a simple new/delete count is used in overridden operators new, new[], delete and delete[]
+* For GCC a simple new/delete count is used in overridden operators `new`, `new[]`, `delete` and `delete[]`
If you use some leaky code that you can't or won't fix you can tell a TEST to ignore a certain number of leaks as in this example:
-```C++
+```cpp
TEST(MemoryLeakWarningTest, Ignore1)
{
EXPECT_N_LEAKS(1);
@@ -141,21 +165,19 @@ TEST(MemoryLeakWarningTest, Ignore1)
## Example Main
-```C++
-#include "UnitTestHarness/CommandLineTestRunner.h"
+```cpp
+#include "CppUTest/CommandLineTestRunner.h"
int main(int ac, char** av)
{
- return CommandLineTestRunner::RunAllTests(ac, av);
+ return RUN_ALL_TESTS(ac, av);
}
-
-IMPORT_TEST_GROUP(ClassName)
```
## Example Test
-```C++
-#include "UnitTestHarness/TestHarness.h"
+```cpp
+#include "CppUTest/TestHarness.h"
#include "ClassName.h"
TEST_GROUP(ClassName)
@@ -170,7 +192,7 @@ TEST_GROUP(ClassName)
{
delete className;
}
-}
+};
TEST(ClassName, Create)
{
@@ -184,9 +206,59 @@ TEST(ClassName, Create)
}
```
-There are some scripts that are helpful in creating your initial h, cpp, and
-Test files. See scripts/README.TXT
+There are some scripts that are helpful in creating your initial h, cpp, and
+Test files. See scripts/README.TXT
+
+## Conan
+
+CppUTest is available through [conan-center][conan-center].
+
+##### conanfile.txt
+
+```ini
+[requires]
+cpputest/4.0
+
+[generators]
+cmake_find_package
+cmake_paths
+```
+
+##### CMake
+
+```cmake
+find_package(CppUTest REQUIRED)
+
+add_executable(example_test ExampleTest.cpp)
+
+target_link_libraries(example_test PRIVATE
+ CppUTest::CppUTest
+ CppUTest::CppUTestExt)
+```
+
+## Integration as external CMake project
+Sometimes you want to use CppUTest in your project without installing it to your system or for having control over the version you are using. This little snippet get the wanted version from GitHub and builds it as a library.
+```cmake
+# CppUTest
+include(FetchContent)
+FetchContent_Declare(
+ CppUTest
+ GIT_REPOSITORY https://github.com/cpputest/cpputest.git
+ GIT_TAG master # or use release tag, eg. v4.0
+)
+FetchContent_MakeAvailable(CppUTest)
+```
+It can be used then like so:
+
+```cmake
+add_executable(run_tests UnitTest1.cpp UnitTest2.cpp)
+
+target_link_libraries(example_test PRIVATE
+ CppUTest::CppUTest
+ CppUTest::CppUTestExt)
+```
+[conan-center]: https://conan.io/center/cpputest
diff --git a/README_CppUTest_for_C.txt b/README_CppUTest_for_C.txt
index a873876f7..8674364ce 100644
--- a/README_CppUTest_for_C.txt
+++ b/README_CppUTest_for_C.txt
@@ -7,10 +7,9 @@ common problems to solve.
---++ Using extern "C"
When including C-header files or when declaring C-variables and routines
-in a .cpp file, you'll have to surround them with an extern "C". This is
-because the C++ linker works different than the C linker and you need to
-instruct the compiler about this. If you do NOT do this, you will probably
-get a linker error, like unresolved symbols, for a routine that you did
+in a .cpp file, you'll need to enclose them within an extern "C". This is
+because the C++ linker works differently than the C linker and you need to
+instruct the compiler about this else you may encounter a linker error. Like unresolved symbols for a routine that you did
implement.
An example:
@@ -24,11 +23,11 @@ extern "C" {
---++ CppUTest support for C
CppUTest comes with a file called TestHarness_c.h which contains a couple
-of routines that can be used in C code, like C-versions of the CHECK-MARCO's.
-The file also contains malloc and free routines that can be used for using
+of routines that can be used in C code, like C-versions of the CHECK-macro's.
+The file also contains malloc and free routines that can be used for accessing
the CppUTest memory leak detector. These routines should be used instead of
the normal malloc/free. This can be achieved by #defining them somewhere, for
-examples as a compiler option: -Dmalloc=cpputest_malloc.
+example as a compiler option: -Dmalloc=cpputest_malloc.
It's important to remember that TestHarness_c.h is a C-header file. It can be
used in C code, but when using in C++ code, you need to use extern "C" before
@@ -56,7 +55,7 @@ key-words
* In C, sometimes people use empty structs. The sizeof(empty struct) would be
0. In C++, the sizeof(empty struct) would be something. The best way to fix
this is to not use empty structs in C.
- According to http://www.glenmccl.com/bett.htm an empty stuct in C is illegal
+ According to http://www.glenmccl.com/bett.htm an empty struct in C is illegal
anyway.
---++ References
@@ -65,4 +64,3 @@ key-words
Describes some differences between C and C++
* http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B
Wikipedia entry on the compatibility between C and C++
-
\ No newline at end of file
diff --git a/README_InstallCppUTest.txt b/README_InstallCppUTest.txt
index 36dca879a..bb67cc2a8 100644
--- a/README_InstallCppUTest.txt
+++ b/README_InstallCppUTest.txt
@@ -1,10 +1,10 @@
1. Unzip into , resulting in
- /CppUTest/
+ /CppUTest/
+
+ MAKE SURE DOES NOT HAVE SPACES IN IT
+ MAKE SURE DOES NOT HAVE SPACES IN IT
+ MAKE SURE DOES NOT HAVE SPACES IN IT
- MAKE SURE DOES NOT HAVE SPACES IN IT
- MAKE SURE DOES NOT HAVE SPACES IN IT
- MAKE SURE DOES NOT HAVE SPACES IN IT
-
2. Build CppUTest and examples
2a. For unix/gcc (including cygwin)
@@ -12,59 +12,49 @@
> ../configure
> make
> make tdd # This is to run the CppUTest unit tests
-
+
2b. For Microsoft Visual C++ V6
- Double click /CppUTest/CppUTest.dsw
- Run without debugging, see the test results in the command window
- Exit MS Visual C++
-
- To run the examples:
- Double click /CppUTest/example/CppUTestExample.dsw
- Run without debugging, see the test results in the command window
- You should define the environment variable CPP_U_TEST to point to CppUTest
- to run these.
-
- NOTE: To create your own project, you need to have CppUTest and your project
- compiled with the same compile and link settings
+ We couldn't install the compiler anymore. We removed the project files.
+ You will need to make your own
2c. For ARMCC from Keil MDK-ARM (building CppUTest library only)
> make all -C platforms/armcc
Please see README and Makefile in platforms/armcc to adjust options, default
CPU architecture is ARM7TDMI and default CPU execution mode is THUMB.
-
+
3c. For Microsoft Visual Studio 2008
Double click /CppUTest/CppUTest.sln
-
+
If Visual studio reports that the solution file was created with a
newer version of Visual Studio, then try 3d
-
+
Then press control-F5 to "Start without debugging"
-
+
See CppUTest build and run its tests.
-
+
3d. For Older Microsoft Visual Studio .NET
Double click /CppUTest/CppUTest.dsw
Allow VS.NET to convert the files by clicking "yes to all"
Run without debugging, see the test results in the command window
Exit MS VS.NET
-
+
Allow VS.NET to convert the files by clicking "yes to all"
Run without debugging, see the test results in the command window
-
- NOTE: To create your own project, you need to have CppUTest and your project
+
+ NOTE: To create your own project, you need to have CppUTest and your project
compiled with the same compile and link settings
-
-4. to setup the support scripts. These scripts work in various unix systems
+
+4. to setup the support scripts. These scripts work in various unix systems
and cygwin. (these are quite handy) If you are using windows
install some tool like cygwin, msys or MKSToolkit to run these scripts.
- > cd /CppUTest/CppSourceTemplates
- > ./InstallScripts.sh
+ > cd /CppUTest
+ > ./scripts/InstallScripts.sh
-This command adds some symbolic links to /usr/local/bin, so you have
+This command adds some symbolic links to /usr/local/bin, so you have
to run it as root.
sudo ./InstallScripts.sh
-
+
MSYS - http://www.mingw.org/msys.shtml
CYGWIN - http://www.cygwin.com/
MKSToolkit - http://mkstoolkit.com/
diff --git a/README_UsersOfPriorVersions.txt b/README_UsersOfPriorVersions.txt
deleted file mode 100644
index 8fbb2ba7e..000000000
--- a/README_UsersOfPriorVersions.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-If you were a user of CppTestTools you will have a few changes to make.
-
-CppUTest is the unit test harness from CppTestTools
-CppFit is the FIT implementaions from CppTestTools
- (CppFit is a separate download)
-
-Sorry, this is not a complete set of instructions for converting, but
-here are some suggestions.
-
-In each test file
- change namespace for SetUp and TearDown to TEST_GROUP(GroupName)
- (GroupName is the class name by convention)
- delete IMPORT_TEST_GROUP
- (TEST_GROUP has this built in now)
- #include "UnitTestHarness/somefile.h" should be
- #include "CppUTest/somefile.h"
-
-Your Makefiles have to change:
- Change DOTO to OBJS
- Replace CPP_TEST_TOOLS with CPP_U_TEST
- Replace MakefileHelpers with build
- Change -I$(CPP_TEST_TOOLS) to -I$(CPP_U_TEST)/include\
- For libraries using fixtures add -I$(CPP_FIT)/include
- Add the RunAllTests.sh script to your AllTests directory
-
-
-
\ No newline at end of file
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 000000000..6ed3b31b8
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,51 @@
+version: 3.7.0-ci{build}
+
+image: Visual Studio 2015
+
+cache:
+ - C:\ProgramData\chocolatey\bin -> appveyor.yml
+ - C:\ProgramData\chocolatey\lib -> appveyor.yml
+ - C:\Tools\MinGW32 -> appveyor.yml
+ - C:\Tools\MinGW64 -> appveyor.yml
+
+environment:
+ Configuration: Release
+ matrix:
+ - Platform: Cygwin32
+ - Platform: MinGW32
+ PlatformToolset: 4.8.5
+ - Platform: MinGW64
+ PlatformToolset: 4.8.5
+ - Platform: MinGW32
+ PlatformToolset: 5.3.0
+ - Platform: MinGW64
+ PlatformToolset: 5.3.0
+ - Platform: MinGWClang64
+ PlatformToolset: 5.3.0
+ - Platform: MinGWClang32
+ PlatformToolset: 5.3.0
+ - Platform: Win32
+ PlatformToolset: v90
+ - Platform: Win32
+ PlatformToolset: v100
+ - Platform: Win32
+ PlatformToolset: v110
+ - Platform: Win32
+ PlatformToolset: v120
+ - Platform: Win32
+ PlatformToolset: v140
+ - Platform: x64
+ PlatformToolset: v140
+
+install:
+- ps: if ($env:Platform -like 'MinGW*') { choco install mingw --version $env:PlatformToolset $( if ($env:Platform -like '*32') { Write-Output --forcex86 --params /exception:dwarf } ) }
+
+build_script:
+- ps: scripts\appveyor_ci_build.ps1
+
+test_script:
+- ps: scripts\appveyor_ci_test.ps1
+
+artifacts:
+- path: lib\CppUTest.lib
+ name: CppUTest
diff --git a/build/ComponentMakefile b/build/ComponentMakefile
index 4b1c42593..37e7807f2 100644
--- a/build/ComponentMakefile
+++ b/build/ComponentMakefile
@@ -11,10 +11,10 @@
# ComponentMakefileExampleParameters
#
# Inputs
-# SRC_FILES - Specific source files to build into library
-# SRC_DIRS - Directories od source file to built into the library
+# SRC_FILES - Specific source files to build into library
+# SRC_DIRS - Directories of source files to build into the library
# TEST_SRC - unit test code build into the unit test runner
-# MOCKS_SRC - mock objects build into the test runner
+# MOCKS_SRC - mock objects built into the test runner
# INCLUDES - List of -I files
# CPPUTEST_CXXFLAGS - flags for the C++ compiler
# CPPUTEST_CPPFLAGS - flags for the C++ AND C compiler
@@ -210,7 +210,7 @@ gcov: test
$(CPPUTEST_HOME)/scripts/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT)
cat $(GCOV_REPORT)
-.PHONEY: format
+.PHONY: format
format:
$(CPPUTEST_HOME)/scripts/reformat.sh $(PROJECT_HOME_DIR)
diff --git a/build/MakefileWorker.mk b/build/MakefileWorker.mk
index 814179f6d..46852df8d 100644
--- a/build/MakefileWorker.mk
+++ b/build/MakefileWorker.mk
@@ -13,10 +13,10 @@
#----------
# Inputs - these variables describe what to build
#
-# INCLUDE_DIRS - Directories used to search for include files.
+# INCLUDE_DIRS - Directories used to search for include files.
# This generates a -I for each directory
-# SRC_DIRS - Directories containing source file to built into the library
-# SRC_FILES - Specific source files to build into library. Helpful when not all code
+# SRC_DIRS - Directories containing source files to build into the library
+# SRC_FILES - Specific source files to build into library. Helpful when not all code
# in a directory can be built for test (hopefully a temporary situation)
# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner
# These do not go in a library. They are explicitly included in the test runner
@@ -24,12 +24,14 @@
# These do not go in a library. They are explicitly included in the test runner
# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner
# These do not go in a library. They are explicitly included in the test runner
+# MOCKS_SRC_FILES - Specific mock source files to build into the unit test runner
+# These do not go in a library. They are explicitly included in the test runner
#----------
# You can adjust these variables to influence how to build the test target
# and where to put and name outputs
# See below to determine defaults
# COMPONENT_NAME - the name of the thing being built
-# TEST_TARGET - name the test executable. By default it is
+# TEST_TARGET - name of the test executable. By default it is
# $(COMPONENT_NAME)_tests
# Helpful if you want 1 > make files in the same directory with different
# executables as output.
@@ -46,11 +48,12 @@
# of the test harness
# CPPUTEST_USE_GCOV - Turn on coverage analysis
# Clean then build with this flag set to Y, then 'make gcov'
+# CPPUTEST_USE_GCOV_NO_GCNO_FILES - Disable gcov's .gcno files from being generated
# CPPUTEST_MAPFILE - generate a map file
# CPPUTEST_WARNINGFLAGS - overly picky by default
-# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make
+# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make
# other targets. Like CSlim, which is part of fitnesse
-# CPPUTEST_USE_VPATH - Use Make's VPATH functionality to support user
+# CPPUTEST_USE_VPATH - Use Make's VPATH functionality to support user
# specification of source files and directories that aren't below
# the user's Makefile in the directory tree, like:
# SRC_DIRS += ../../lib/foo
@@ -62,6 +65,8 @@
# CPPUTEST_CPPFLAGS - flags for the C++ AND C preprocessor
# CPPUTEST_CFLAGS - flags for the C complier
# CPPUTEST_LDFLAGS - Linker flags
+# CPPUTEST_CXX_PREFIX - prefix for the C++ compiler
+# CPPUTEST_CC_PREFIX - prefix for the C compiler
#----------
# Some behavior is weird on some platforms. Need to discover the platform.
@@ -73,14 +78,14 @@ MINGW_STR = MINGW
CYGWIN_STR = CYGWIN
LINUX_STR = Linux
SUNOS_STR = SunOS
-UNKNWOWN_OS_STR = Unknown
+UNKNOWN_OS_STR = Unknown
# Compilers
CC_VERSION_OUTPUT ="$(shell $(CXX) -v 2>&1)"
CLANG_STR = clang
SUNSTUDIO_CXX_STR = SunStudio
-UNAME_OS = $(UNKNWOWN_OS_STR)
+UNAME_OS = $(UNKNOWN_OS_STR)
ifeq ($(findstring $(MINGW_STR),$(UNAME_OUTPUT)),$(MINGW_STR))
UNAME_OS = $(MINGW_STR)
@@ -160,18 +165,28 @@ ifndef CPPUTEST_USE_STD_CPP_LIB
CPPUTEST_USE_STD_CPP_LIB = Y
endif
+# Use long long, off by default
+ifndef CPPUTEST_USE_LONG_LONG
+ CPPUTEST_USE_LONG_LONG = N
+endif
+
# Use gcov, off by default
ifndef CPPUTEST_USE_GCOV
CPPUTEST_USE_GCOV = N
endif
+# Skip generating gcov's .gcno files, off by default
+ifndef CPPUTEST_USE_GCOV_NO_GCNO_FILES
+ CPPUTEST_USE_GCOV_NO_GCNO_FILES = N
+endif
+
ifndef CPPUTEST_PEDANTIC_ERRORS
CPPUTEST_PEDANTIC_ERRORS = Y
endif
# Default warnings
ifndef CPPUTEST_WARNINGFLAGS
- CPPUTEST_WARNINGFLAGS = -Wall -Wextra -Werror -Wshadow -Wswitch-default -Wswitch-enum -Wconversion
+ CPPUTEST_WARNINGFLAGS = -Wall -Wextra -Werror -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wno-long-long
ifeq ($(CPPUTEST_PEDANTIC_ERRORS), Y)
CPPUTEST_WARNINGFLAGS += -pedantic-errors
endif
@@ -187,9 +202,39 @@ ifeq ($(COMPILER_NAME),$(CLANG_STR))
# -Wno-disabled-macro-expansion -> Have to disable the macro expansion warning as the operator new overload warns on that.
# -Wno-padded -> I sort-of like this warning but if there is a bool at the end of the class, it seems impossible to remove it! (except by making padding explicit)
# -Wno-global-constructors Wno-exit-time-destructors -> Great warnings, but in CppUTest it is impossible to avoid as the automatic test registration depends on the global ctor and dtor
-# -Wno-weak-vtables -> The TEST_GROUP macro declares a class and will automatically inline its methods. Thats ok as they are only in one translation unit. Unfortunately, the warning can't detect that, so it must be disabled.
- CPPUTEST_CXX_WARNINGFLAGS += -Weverything -Wno-disabled-macro-expansion -Wno-padded -Wno-global-constructors -Wno-exit-time-destructors -Wno-weak-vtables
- CPPUTEST_C_WARNINGFLAGS += -Weverything -Wno-padded
+# -Wno-weak-vtables -> The TEST_GROUP macro declares a class and will automatically inline its methods. That's ok as they are only in one translation unit. Unfortunately, the warning can't detect that, so it must be disabled.
+# -Wno-old-style-casts -> We only use old style casts by decision
+# -Wno-c++11-long-long -> When it detects long long, then we can use it and no need for a warning about that
+# -Wno-c++98-compat-pedantic -> Incompatibilities with C++98, these are happening through #define.
+ CPPUTEST_CXX_WARNINGFLAGS += -Wno-disabled-macro-expansion -Wno-padded -Wno-global-constructors -Wno-exit-time-destructors -Wno-weak-vtables -Wno-old-style-cast -Wno-c++11-long-long -Wno-c++98-compat-pedantic -Wreserved-id-macro
+ CPPUTEST_C_WARNINGFLAGS += -Wno-padded -Wreserved-id-macro
+
+# Clang 7 and 12 introduced new warnings by default that don't exist on previous versions of clang and cause errors when present.
+CLANG_VERSION := $(shell echo $(CC_VERSION_OUTPUT) | sed -n 's/.* \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p')
+CLANG_VERSION_NUM := $(subst .,,$(CLANG_VERSION))
+CLANG_VERSION_NUM_GT_700 := $(shell [ "$(CLANG_VERSION_NUM)" -ge 700 ] && echo Y || echo N)
+CLANG_VERSION_NUM_GT_1200 := $(shell [ "$(CLANG_VERSION_NUM)" -ge 1200 ] && echo Y || echo N)
+CLANG_VERSION_NUM_GT_1205 := $(shell [ "$(CLANG_VERSION_NUM)" -ge 1205 ] && echo Y || echo N)
+
+ifeq ($(CLANG_VERSION_NUM_GT_700), Y)
+ CPPUTEST_CXX_WARNINGFLAGS += -Wkeyword-macro
+ CPPUTEST_C_WARNINGFLAGS += -Wkeyword-macro
+endif
+
+ifeq ($(UNAME_OS),$(MACOSX_STR))
+#apple clang has some special behavior
+ifeq ($(CLANG_VERSION_NUM_GT_1200), Y)
+# -Wno-poison-system-directories -> Apparently apple clang thinks everything is a cross compile, making this useless
+ CPPUTEST_CXX_WARNINGFLAGS += -Wno-poison-system-directories
+ CPPUTEST_C_WARNINGFLAGS += -Wno-poison-system-directories
+endif # clang 1200
+
+ifeq ($(CLANG_VERSION_NUM_GT_1205), Y)
+# Not sure why apple clang throws these warnings on cpputest code when clang doesn't
+ CPPUTEST_CXX_WARNINGFLAGS += -Wno-suggest-override -Wno-suggest-destructor-override
+ CPPUTEST_C_WARNINGFLAGS += -Wno-suggest-override -Wno-suggest-destructor-override
+endif
+endif
endif
# Uhm. Maybe put some warning flags for SunStudio here?
@@ -207,7 +252,7 @@ else
endif
endif
-# Default dir for the outout library
+# Default dir for the output library
ifndef CPPUTEST_LIB_DIR
ifndef TARGET_PLATFORM
CPPUTEST_LIB_DIR = lib
@@ -221,7 +266,7 @@ ifndef CPPUTEST_MAP_FILE
CPPUTEST_MAP_FILE = N
endif
-# No extentions is default
+# No extensions is default
ifndef CPPUTEST_USE_EXTENSIONS
CPPUTEST_USE_EXTENSIONS = N
endif
@@ -253,8 +298,6 @@ ifeq ($(CPPUTEST_USE_STD_C_LIB), N)
CPPUTEST_CPPFLAGS += -nostdinc
endif
-CPPUTEST_CPPFLAGS += -DCPPUTEST_COMPILATION
-
ifeq ($(CPPUTEST_USE_MEM_LEAK_DETECTION), N)
CPPUTEST_CPPFLAGS += -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED
else
@@ -266,6 +309,10 @@ else
endif
endif
+ifeq ($(CPPUTEST_USE_LONG_LONG), Y)
+ CPPUTEST_CPPFLAGS += -DCPPUTEST_USE_LONG_LONG
+endif
+
ifeq ($(CPPUTEST_ENABLE_DEBUG), Y)
CPPUTEST_CXXFLAGS += -g
CPPUTEST_CFLAGS += -g
@@ -284,7 +331,7 @@ ifdef $(GMOCK_HOME)
CPPUTEST_CPPFLAGS += -I$(GMOCK_HOME)/include
GMOCK_LIBRARY = $(GMOCK_HOME)/lib/.libs/libgmock.a
LD_LIBRARIES += $(GMOCK_LIBRARY)
- CPPUTEST_CPPFLAGS += -DINCLUDE_GTEST_TESTS
+ CPPUTEST_CPPFLAGS += -DCPPUTEST_INCLUDE_GTEST_TESTS
CPPUTEST_WARNINGFLAGS =
CPPUTEST_CPPFLAGS += -I$(GTEST_HOME)/include -I$(GTEST_HOME)
GTEST_LIBRARY = $(GTEST_HOME)/lib/.libs/libgtest.a
@@ -293,8 +340,12 @@ endif
ifeq ($(CPPUTEST_USE_GCOV), Y)
- CPPUTEST_CXXFLAGS += -fprofile-arcs -ftest-coverage
- CPPUTEST_CFLAGS += -fprofile-arcs -ftest-coverage
+ CPPUTEST_CXXFLAGS += -fprofile-arcs
+ CPPUTEST_CFLAGS += -fprofile-arcs
+ ifneq ($(CPPUTEST_USE_GCOV_NO_GCNO_FILES), Y)
+ CPPUTEST_CXXFLAGS += -ftest-coverage
+ CPPUTEST_CFLAGS += -ftest-coverage
+ endif
endif
CPPUTEST_CXXFLAGS += $(CPPUTEST_WARNINGFLAGS) $(CPPUTEST_CXX_WARNINGFLAGS)
@@ -357,7 +408,7 @@ TEST_OBJS = $(call src_to_o,$(TEST_SRC))
STUFF_TO_CLEAN += $(TEST_OBJS)
-MOCKS_SRC += $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS))
+MOCKS_SRC += $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) $(MOCKS_SRC_FILES)
MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC))
STUFF_TO_CLEAN += $(MOCKS_OBJS)
@@ -461,35 +512,53 @@ TEST_DEPS = $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(
test-deps: $(TEST_DEPS)
$(TEST_TARGET): $(TEST_DEPS)
+ifndef MORE_SILENCE
@echo Linking $@
+endif
$(SILENCE)$(CXX) -o $@ $^ $(LD_LIBRARIES) $(LDFLAGS)
$(TARGET_LIB): $(OBJ)
+ifndef MORE_SILENCE
@echo Building archive $@
+endif
$(SILENCE)mkdir -p $(dir $@)
+ifndef MORE_SILENCE
$(SILENCE)$(AR) $(ARFLAGS) $@ $^
+else
+ $(SILENCE)$(AR) $(ARFLAGS) $@ $^ >/dev/null
+endif
$(SILENCE)$(RANLIB) $@
test: $(TEST_TARGET)
- $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT)
+ @$(eval TEST_RUN_RETURN_CODE_FILE=$(shell mktemp /tmp/cpputestResult.XXX))
+ @($(RUN_TEST_TARGET); echo $$? > $(TEST_RUN_RETURN_CODE_FILE)) | tee $(TEST_OUTPUT)
+ @ret=$$(cat $(TEST_RUN_RETURN_CODE_FILE)); rm $(TEST_RUN_RETURN_CODE_FILE); if [ "$$ret" -ne 0 ]; then echo "$$(tput setaf 1)$(TEST_TARGET) returned $${ret}$$(tput sgr0)"; fi; exit $$ret
vtest: $(TEST_TARGET)
- $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT)
+ @$(eval TEST_RUN_RETURN_CODE_FILE=$(shell mktemp /tmp/cpputestResult.XXX))
+ @($(RUN_TEST_TARGET) -v; echo $$? > $(TEST_RUN_RETURN_CODE_FILE)) | tee $(TEST_OUTPUT)
+ @ret=$$(cat $(TEST_RUN_RETURN_CODE_FILE)); rm $(TEST_RUN_RETURN_CODE_FILE); if [ "$$ret" -ne 0 ]; then echo "$$(tput setaf 1)$(TEST_TARGET) returned $${ret}$$(tput sgr0)"; fi; exit $$ret
$(CPPUTEST_OBJS_DIR)/%.o: %.cc
+ifndef MORE_SILENCE
@echo compiling $(notdir $<)
+endif
$(SILENCE)mkdir -p $(dir $@)
- $(SILENCE)$(COMPILE.cpp) $(DEP_FLAGS) $(OUTPUT_OPTION) $<
+ $(SILENCE)$(CPPUTEST_CXX_PREFIX)$(COMPILE.cpp) $(DEP_FLAGS) $(OUTPUT_OPTION) $<
$(CPPUTEST_OBJS_DIR)/%.o: %.cpp
+ifndef MORE_SILENCE
@echo compiling $(notdir $<)
+endif
$(SILENCE)mkdir -p $(dir $@)
- $(SILENCE)$(COMPILE.cpp) $(DEP_FLAGS) $(OUTPUT_OPTION) $<
+ $(SILENCE)$(CPPUTEST_CXX_PREFIX)$(COMPILE.cpp) $(DEP_FLAGS) $(OUTPUT_OPTION) $<
$(CPPUTEST_OBJS_DIR)/%.o: %.c
+ifndef MORE_SILENCE
@echo compiling $(notdir $<)
+endif
$(SILENCE)mkdir -p $(dir $@)
- $(SILENCE)$(COMPILE.c) $(DEP_FLAGS) $(OUTPUT_OPTION) $<
+ $(SILENCE)$(CPPUTEST_CC_PREFIX)$(COMPILE.c) $(DEP_FLAGS) $(OUTPUT_OPTION) $<
ifneq "$(MAKECMDGOALS)" "clean"
-include $(DEP_FILES)
@@ -497,9 +566,11 @@ endif
.PHONY: clean
clean:
+ifndef MORE_SILENCE
@echo Making clean
+endif
$(SILENCE)$(RM) $(STUFF_TO_CLEAN)
- $(SILENCE)rm -rf gcov $(CPPUTEST_OBJS_DIR)
+ $(SILENCE)rm -rf gcov $(CPPUTEST_OBJS_DIR) $(CPPUTEST_LIB_DIR)
$(SILENCE)find . -name "*.gcno" | xargs rm -f
$(SILENCE)find . -name "*.gcda" | xargs rm -f
@@ -513,13 +584,14 @@ realclean: clean
gcov: test
ifeq ($(CPPUTEST_USE_VPATH), Y)
- $(SILENCE)gcov --object-directory $(CPPUTEST_OBJS_DIR) $(SRC) >> $(GCOV_OUTPUT) 2>> $(GCOV_ERROR)
+ $(SILENCE)gcov $(GCOV_ARGS) --object-directory $(CPPUTEST_OBJS_DIR) $(SRC) >> $(GCOV_OUTPUT) 2>> $(GCOV_ERROR)
else
$(SILENCE)for d in $(SRC_DIRS) ; do \
- gcov --object-directory $(CPPUTEST_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \
+ FILES=`ls $$d/*.c $$d/*.cc $$d/*.cpp 2> /dev/null` ; \
+ gcov $(GCOV_ARGS) --object-directory $(CPPUTEST_OBJS_DIR)/$$d $$FILES >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \
done
$(SILENCE)for f in $(SRC_FILES) ; do \
- gcov --object-directory $(CPPUTEST_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \
+ gcov $(GCOV_ARGS) --object-directory $(CPPUTEST_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \
done
endif
$(CPPUTEST_HOME)/scripts/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT)
@@ -529,11 +601,11 @@ endif
$(SILENCE)mv gcov_* gcov
@echo "See gcov directory for details"
-.PHONEY: format
+.PHONY: format
format:
$(CPPUTEST_HOME)/scripts/reformat.sh $(PROJECT_HOME_DIR)
-.PHONEY: debug
+.PHONY: debug
debug:
@echo
@echo "Target Source files:"
diff --git a/build/alltests.mmp b/build/alltests.mmp
index 3f13ea08a..40c1dc86a 100644
--- a/build/alltests.mmp
+++ b/build/alltests.mmp
@@ -29,7 +29,7 @@ TARGET cpputest.exe
TARGETTYPE exe
UID 0x00000000 0x03A6305A
-USERINCLUDE ..\include ..\include\CppUTest ..\include\Platforms\Symbian ..\tests
+USERINCLUDE ..\include ..\include\CppUTest ..\tests
SYSTEMINCLUDE \epoc32\include \epoc32\include\stdapis
STATICLIBRARY libcrt0.lib
@@ -41,7 +41,7 @@ LIBRARY euser.lib libc.lib libm.lib libpthread.lib
SOURCEPATH ..\tests
SOURCE FailureTest.cpp MemoryLeakWarningTest.cpp NullTestTest.cpp
SOURCE SimpleStringTest.cpp TestInstallerTest.cpp
-SOURCE TestOutputTest.cpp TestRegistryTest.cpp UtestTest.cpp CommandLineTestRunnerTest.cpp JUnitOutputTest.cpp
+SOURCE TestOutputTest.cpp TestRegistryTest.cpp UtestTest.cpp CommandLineTestRunnerTest.cpp JUnitOutputTest.cpp TeamCityOutputTest.cpp
SOURCE TestHarness_cTest.cpp
SOURCEPATH ..\tests
diff --git a/build/bld.inf b/build/bld.inf
index 7894587e7..c2305acfe 100644
--- a/build/bld.inf
+++ b/build/bld.inf
@@ -36,6 +36,7 @@ PRJ_EXPORTS
..\include\CppUTest\Failure.h \epoc32\include\CppUTest\Failure.h
..\include\CppUTest\TestRegistry.h \epoc32\include\CppUTest\TestRegistry.h
..\include\CppUTest\SimpleString.h \epoc32\include\CppUTest\SimpleString.h
+..\include\CppUTest\SimpleStringInternalCache.h \epoc32\include\CppUTest\SimpleStringInternalCache.h
..\include\CppUTest\MemoryLeakWarning.h \epoc32\include\CppUTest\MemoryLeakWarning.h
..\include\CppUTest\CommandLineTestRunner.h \epoc32\include\CppuTest\CommandLineTestRunner.h
..\include\CppUTest\TestOutput.h \epoc32\include\CppuTest\TestOutput.h
diff --git a/build/cmake_package_files/CppUTestConfig.cmake b/build/cmake_package_files/CppUTestConfig.cmake
new file mode 100644
index 000000000..cce1985ae
--- /dev/null
+++ b/build/cmake_package_files/CppUTestConfig.cmake
@@ -0,0 +1,32 @@
+
+####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
+####### Any changes to this file will be overwritten by the next CMake run ####
+####### The input file was CppUTestConfig.cmake.install.in ########
+
+get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
+
+macro(set_and_check _var _file)
+ set(${_var} "${_file}")
+ if(NOT EXISTS "${_file}")
+ message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
+ endif()
+endmacro()
+
+macro(check_required_components _NAME)
+ foreach(comp ${${_NAME}_FIND_COMPONENTS})
+ if(NOT ${_NAME}_${comp}_FOUND)
+ if(${_NAME}_FIND_REQUIRED_${comp})
+ set(${_NAME}_FOUND FALSE)
+ endif()
+ endif()
+ endforeach()
+endmacro()
+
+####################################################################################
+
+set_and_check(CppUTest_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/include")
+include("${CMAKE_CURRENT_LIST_DIR}/CppUTestTargets.cmake")
+set(CppUTest_LIBRARIES CppUTest CppUTestExt)
+include("${CMAKE_CURRENT_LIST_DIR}/Modules/CppUTestBuildTimeDiscoverTests.cmake")
+
+check_required_components(CppUTest)
diff --git a/build/cmake_package_files/CppUTestConfigVersion.cmake b/build/cmake_package_files/CppUTestConfigVersion.cmake
new file mode 100644
index 000000000..69a28a705
--- /dev/null
+++ b/build/cmake_package_files/CppUTestConfigVersion.cmake
@@ -0,0 +1,37 @@
+# This is a basic version file for the Config-mode of find_package().
+# It is used by write_basic_package_version_file() as input file for configure_file()
+# to create a version-file which can be installed along a config.cmake file.
+#
+# The created file sets PACKAGE_VERSION_EXACT if the current version string and
+# the requested version string are exactly the same and it sets
+# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
+# but only if the requested major version is the same as the current one.
+# The variable CVF_VERSION must be set before calling configure_file().
+set(PACKAGE_VERSION "4.0")
+if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+ if("4.0" MATCHES "^([0-9]+)\\.")
+ set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
+ else()
+ set(CVF_VERSION_MAJOR "4.0")
+ endif()
+ if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ else()
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+ endif()
+ if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif()
+endif()
+# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
+ return()
+endif()
+# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
+if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
+ math(EXPR installedBits "8 * 8")
+ set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
+ set(PACKAGE_VERSION_UNSUITABLE TRUE)
+endif()
diff --git a/build/cmake_package_files/CppUTestTargets-relwithdebinfo.cmake b/build/cmake_package_files/CppUTestTargets-relwithdebinfo.cmake
new file mode 100644
index 000000000..31ffbf4ba
--- /dev/null
+++ b/build/cmake_package_files/CppUTestTargets-relwithdebinfo.cmake
@@ -0,0 +1,29 @@
+#----------------------------------------------------------------
+# Generated CMake target import file for configuration "RelWithDebInfo".
+#----------------------------------------------------------------
+
+# Commands may need to know the format version.
+set(CMAKE_IMPORT_FILE_VERSION 1)
+
+# Import target "CppUTest" for configuration "RelWithDebInfo"
+set_property(TARGET CppUTest APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
+set_target_properties(CppUTest PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELWITHDEBINFO "CXX"
+ IMPORTED_LOCATION_RELWITHDEBINFO "${_IMPORT_PREFIX}/lib/libCppUTest.a"
+ )
+
+list(APPEND _IMPORT_CHECK_TARGETS CppUTest )
+list(APPEND _IMPORT_CHECK_FILES_FOR_CppUTest "${_IMPORT_PREFIX}/lib/libCppUTest.a" )
+
+# Import target "CppUTestExt" for configuration "RelWithDebInfo"
+set_property(TARGET CppUTestExt APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
+set_target_properties(CppUTestExt PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELWITHDEBINFO "CXX"
+ IMPORTED_LOCATION_RELWITHDEBINFO "${_IMPORT_PREFIX}/lib/libCppUTestExt.a"
+ )
+
+list(APPEND _IMPORT_CHECK_TARGETS CppUTestExt )
+list(APPEND _IMPORT_CHECK_FILES_FOR_CppUTestExt "${_IMPORT_PREFIX}/lib/libCppUTestExt.a" )
+
+# Commands beyond this point should not need to know the version.
+set(CMAKE_IMPORT_FILE_VERSION)
diff --git a/build/cmake_package_files/CppUTestTargets.cmake b/build/cmake_package_files/CppUTestTargets.cmake
new file mode 100644
index 000000000..e1d587696
--- /dev/null
+++ b/build/cmake_package_files/CppUTestTargets.cmake
@@ -0,0 +1,101 @@
+# Generated by CMake
+
+if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
+ message(FATAL_ERROR "CMake >= 2.6.0 required")
+endif()
+cmake_policy(PUSH)
+cmake_policy(VERSION 2.6)
+#----------------------------------------------------------------
+# Generated CMake target import file.
+#----------------------------------------------------------------
+
+# Commands may need to know the format version.
+set(CMAKE_IMPORT_FILE_VERSION 1)
+
+# Protect against multiple inclusion, which would fail when already imported targets are added once more.
+set(_targetsDefined)
+set(_targetsNotDefined)
+set(_expectedTargets)
+foreach(_expectedTarget CppUTest CppUTestExt)
+ list(APPEND _expectedTargets ${_expectedTarget})
+ if(NOT TARGET ${_expectedTarget})
+ list(APPEND _targetsNotDefined ${_expectedTarget})
+ endif()
+ if(TARGET ${_expectedTarget})
+ list(APPEND _targetsDefined ${_expectedTarget})
+ endif()
+endforeach()
+if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
+ unset(_targetsDefined)
+ unset(_targetsNotDefined)
+ unset(_expectedTargets)
+ set(CMAKE_IMPORT_FILE_VERSION)
+ cmake_policy(POP)
+ return()
+endif()
+if(NOT "${_targetsDefined}" STREQUAL "")
+ message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
+endif()
+unset(_targetsDefined)
+unset(_targetsNotDefined)
+unset(_expectedTargets)
+
+
+# Compute the installation prefix relative to this file.
+get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+if(_IMPORT_PREFIX STREQUAL "/")
+ set(_IMPORT_PREFIX "")
+endif()
+
+# Create imported target CppUTest
+add_library(CppUTest STATIC IMPORTED)
+
+set_target_properties(CppUTest PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/CppUTest"
+)
+
+# Create imported target CppUTestExt
+add_library(CppUTestExt STATIC IMPORTED)
+
+set_target_properties(CppUTestExt PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/CppUTestExt"
+)
+
+# Load information for each installed configuration.
+get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+file(GLOB CONFIG_FILES "${_DIR}/CppUTestTargets-*.cmake")
+foreach(f ${CONFIG_FILES})
+ include(${f})
+endforeach()
+
+# Cleanup temporary variables.
+set(_IMPORT_PREFIX)
+
+# Loop over all imported files and verify that they actually exist
+foreach(target ${_IMPORT_CHECK_TARGETS} )
+ foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
+ if(NOT EXISTS "${file}" )
+ message(FATAL_ERROR "The imported target \"${target}\" references the file
+ \"${file}\"
+but this file does not exist. Possible reasons include:
+* The file was deleted, renamed, or moved to another location.
+* An install or uninstall procedure did not complete successfully.
+* The installation package was faulty and contained
+ \"${CMAKE_CURRENT_LIST_FILE}\"
+but not all the files it references.
+")
+ endif()
+ endforeach()
+ unset(_IMPORT_CHECK_FILES_FOR_${target})
+endforeach()
+unset(_IMPORT_CHECK_TARGETS)
+
+# This file does not depend on other imported targets which have
+# been exported from the same project but in a separate export set.
+
+# Commands beyond this point should not need to know the version.
+set(CMAKE_IMPORT_FILE_VERSION)
+cmake_policy(POP)
diff --git a/build/cpputest.mmp b/build/cpputest.mmp
index 8093f8c59..103063507 100644
--- a/build/cpputest.mmp
+++ b/build/cpputest.mmp
@@ -29,7 +29,7 @@ TARGET cpputest.lib
TARGETTYPE LIB
UID 0x00000000 0x03A6305A
-USERINCLUDE ..\include ..\include\CppUTest ..\include\Platforms\Symbian
+USERINCLUDE ..\include ..\include\CppUTest
SYSTEMINCLUDE \epoc32\include \epoc32\include\stdapis
SOURCEPATH ..\src\CppUTest
diff --git a/cmake/Modules/CppUTest.cmake b/cmake/Modules/CppUTest.cmake
new file mode 100644
index 000000000..160959a5e
--- /dev/null
+++ b/cmake/Modules/CppUTest.cmake
@@ -0,0 +1,117 @@
+set(_CPPUTEST_DISCOVERY_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/_CppUTestDiscovery.cmake
+ CACHE INTERNAL "CppUTest discovery scripts"
+)
+
+option(CPPUTEST_TESTS_DETAILED "Run discovered tests individually")
+option(CPPUTEST_JUNIT_REPORT "Output JUnit test reports")
+
+function(cpputest_discover_tests target)
+ set(options JUNIT)
+ set(oneValueArgs DETAILED)
+ set(multiValueArgs EXTRA_ARGS)
+ cmake_parse_arguments(
+ ""
+ "${options}"
+ "${oneValueArgs}"
+ "${multiValueArgs}"
+ ${ARGN}
+ )
+
+ # Validate arguments.
+ if(NOT TARGET ${target})
+ message(FATAL_ERROR
+ "Cannot discover tests for target \"${target}\" "
+ "which is not built by this project."
+ )
+ endif()
+
+ get_property(target_type
+ TARGET ${target}
+ PROPERTY TYPE
+ )
+ if(NOT target_type STREQUAL "EXECUTABLE")
+ message(FATAL_ERROR
+ "Cannot discover tests for target \"${target}\" "
+ "which is not an executable."
+ )
+ endif()
+
+ get_property(emulator
+ TARGET ${target}
+ PROPERTY CROSSCOMPILING_EMULATOR
+ )
+ if(CMAKE_CROSSCOMPILING)
+ if(NOT emulator)
+ message(WARNING "Cannot discover cross compiled tests without an emulator")
+ return()
+ endif()
+ endif()
+
+ if(NOT DEFINED _EXTRA_ARGS)
+ set(_EXTRA_ARGS -v)
+ endif()
+
+ if(NOT DEFINED _DETAILED)
+ set(_DETAILED ${CPPUTEST_TESTS_DETAILED})
+ endif()
+
+ if(_JUNIT OR CPPUTEST_JUNIT_REPORT)
+ list(APPEND _EXTRA_ARGS -ojunit)
+ endif()
+
+ set(CTEST_INCLUDE_FILE "${CMAKE_CURRENT_BINARY_DIR}/${target}_include.cmake")
+ if(CMAKE_CONFIGURATION_TYPES)
+ set(CTEST_GENERATED_FILE "${CMAKE_CURRENT_BINARY_DIR}/${target}.$.cmake")
+ file(WRITE "${CTEST_INCLUDE_FILE}"
+ "if(EXISTS \"${CMAKE_CURRENT_BINARY_DIR}/${target}.\${CTEST_CONFIGURATION_TYPE}.cmake\")\n"
+ " include(\"${CMAKE_CURRENT_BINARY_DIR}/${target}.\${CTEST_CONFIGURATION_TYPE}.cmake\")\n"
+ "endif()\n"
+ )
+ else()
+ set(CTEST_GENERATED_FILE "${CMAKE_CURRENT_BINARY_DIR}/${target}.cmake")
+ file(WRITE "${CTEST_INCLUDE_FILE}"
+ "if(EXISTS \"${CTEST_GENERATED_FILE}\")\n"
+ " include(\"${CTEST_GENERATED_FILE}\")\n"
+ "endif()\n"
+ )
+ endif()
+
+ add_custom_command(
+ TARGET ${target} POST_BUILD
+ BYPRODUCTS "${CTEST_GENERATED_FILE}"
+ COMMAND
+ "${CMAKE_COMMAND}"
+ -D "TESTS_DETAILED:BOOL=${_DETAILED}"
+ -D "EXECUTABLE=$"
+ -D "EMULATOR=${emulator}"
+ -D "ARGS=${_EXTRA_ARGS}"
+ -D "CTEST_FILE=${CTEST_GENERATED_FILE}"
+ -P "${_CPPUTEST_DISCOVERY_SCRIPT}"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ VERBATIM
+ )
+
+ if(${CMAKE_VERSION} VERSION_LESS "3.10")
+ # We can only set one.
+ get_property(already_set
+ DIRECTORY
+ PROPERTY TEST_INCLUDE_FILE
+ SET
+ )
+ if(${already_set})
+ message(FATAL_ERROR
+ "Cannot discovery multiple tests from the same file"
+ )
+ endif()
+ set_property(
+ DIRECTORY
+ PROPERTY TEST_INCLUDE_FILE "${CTEST_INCLUDE_FILE}"
+ )
+ else()
+ set_property(
+ DIRECTORY APPEND
+ PROPERTY TEST_INCLUDE_FILES "${CTEST_INCLUDE_FILE}"
+ )
+ endif()
+
+endfunction()
diff --git a/cmake/Modules/CppUTestBuildTimeDiscoverTests.cmake b/cmake/Modules/CppUTestBuildTimeDiscoverTests.cmake
new file mode 100644
index 000000000..cfffad56c
--- /dev/null
+++ b/cmake/Modules/CppUTestBuildTimeDiscoverTests.cmake
@@ -0,0 +1,55 @@
+option(CPPUTEST_TESTS_DETAILED "Run discovered tests individually")
+
+set(_DISCOVER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/../Scripts/CppUTestBuildTimeDiscoverTests.cmake")
+
+# Create target to discover tests
+function (cpputest_buildtime_discover_tests tgt)
+ message(DEPRECATION
+ "Use cpputest_discover_tests from the CppUTest module instead"
+ )
+
+ set(options)
+ set(oneValueArgs DETAILED)
+ set(multiValueArgs)
+ cmake_parse_arguments(
+ ""
+ "${options}"
+ "${oneValueArgs}"
+ "${multiValueArgs}"
+ ${ARGN}
+ )
+ if(NOT DEFINED _DETAILED)
+ set(_DETAILED ${CPPUTEST_TESTS_DETAILED})
+ endif()
+
+ if(NOT TARGET ${tgt})
+ message(FATAL_ERROR
+ "Cannot discover tests for target \"${tgt}\" "
+ "which is not built by this project."
+ )
+ endif()
+
+ get_property(target_type
+ TARGET ${tgt}
+ PROPERTY TYPE
+ )
+ if(NOT target_type STREQUAL "EXECUTABLE")
+ message(FATAL_ERROR
+ "Cannot discover tests for target \"${tgt}\" "
+ "which is not an executable."
+ )
+ endif()
+
+ add_custom_command(
+ TARGET ${tgt} POST_BUILD
+ COMMAND
+ ${CMAKE_COMMAND}
+ -D "TESTS_DETAILED:BOOL=${_DETAILED}"
+ -D "EXECUTABLE=$"
+ -D "EMULATOR=$"
+ -P "${_DISCOVER_SCRIPT}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Discovering Tests in ${tgt}"
+ VERBATIM
+ )
+endfunction ()
diff --git a/cmake/Modules/CppUTestConfigurationOptions.cmake b/cmake/Modules/CppUTestConfigurationOptions.cmake
deleted file mode 100644
index fd785e3aa..000000000
--- a/cmake/Modules/CppUTestConfigurationOptions.cmake
+++ /dev/null
@@ -1,74 +0,0 @@
-if (MSVC)
- set(CPP_PLATFORM VisualCpp)
- include_directories(${CppUTestRootDirectory}/include/Platforms/${CPP_PLATFORM})
-elseif (STD_C)
- set(CPP_PLATFORM Gcc)
-else (MSVC)
- set(STD_CPP False)
- set(MEMORY_LEAK_DETECTION False)
- set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} -nostdinc")
- set(CPPUTEST_LD_FLAGS "${CPPUTEST_LD_FLAGS} -nostdinc")
- set(CPPUTEST_STD_C_LIB_DISABLED 1)
- set(CPP_PLATFORM GccNoStdC)
-endif (MSVC)
-
-include("${CppUTestRootDirectory}/cmake/Modules/CppUTestWarningFlags.cmake")
-
-if (NOT STD_CPP)
- set(CPPUTEST_STD_CPP_LIB_DISABLED 1)
- if (STD_C AND NOT MSVC)
- set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} -nostdinc++")
- endif (STD_C AND NOT MSVC)
-endif (NOT STD_CPP)
-
-if (MEMORY_LEAK_DETECTION)
- if (MSVC)
- set(CPPUTEST_C_FLAGS "${CPPUTEST_C_FLAGS} /FI ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h")
- set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} /FI ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h")
- else (MSVC)
- set(CPPUTEST_C_FLAGS "${CPPUTEST_C_FLAGS} -include ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h")
- set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} -include ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorNewMacros.h")
- set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} -include ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h")
- endif (MSVC)
-else (MEMORY_LEAK_DETECTION)
- set(CPPUTEST_MEM_LEAK_DETECTION_DISABLED 1)
-endif (MEMORY_LEAK_DETECTION)
-
-if (MAP_FILE AND NOT MSVC)
- set(CPPUTEST_LD_FLAGS "${CPPUTEST_LD_FLAGS} -Wl,-map,$<.map.txt")
-endif (MAP_FILE AND NOT MSVC)
-
-if (COVERAGE AND NOT MSVC)
- set(CPPUTEST_C_FLAGS "${CPPUTEST_C_FLAGS} --coverage")
- set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} --coverage")
- set(CMAKE_BUILD_TYPE "Debug")
-endif (COVERAGE AND NOT MSVC)
-
-if (C++11)
- find_package(CXX11 REQUIRED)
- set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} ${CXX11_FLAGS}")
-endif (C++11)
-
-set(GMOCK_HOME $ENV{GMOCK_HOME})
-if (DEFINED ENV{GMOCK_HOME})
- # GMock pulls in gtest.
- set(INCLUDE_GTEST_TESTS 1)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1")
- include_directories(${GMOCK_HOME}/include ${GMOCK_HOME}/gtest ${GMOCK_HOME}/gtest/include)
- add_subdirectory(${GMOCK_HOME} "${CMAKE_CURRENT_BINARY_DIR}/gmock")
- set(CPPUNIT_EXTERNAL_LIBRARIES ${CPPUNIT_EXTERNAL_LIBARIES} gmock gtest)
-
- set(CPPUTEST_C_WARNING_FLAGS "")
- set(CPPUTEST_CXX_WARNING_FLAGS "")
-endif (DEFINED ENV{GMOCK_HOME})
-
-set(CPPUTEST_C_FLAGS "${CPPUTEST_C_FLAGS} ${CPPUTEST_C_WARNING_FLAGS}")
-set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} ${CPPUTEST_CXX_WARNING_FLAGS}")
-
-if (CPPUTEST_FLAGS)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CPPUTEST_C_FLAGS}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPPUTEST_CXX_FLAGS}")
- set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} ${CPPUTEST_LD_FLAGS}")
-endif (CPPUTEST_FLAGS)
-
-set(CPPUTEST_COMPILATION 1)
diff --git a/cmake/Modules/CppUTestWarningFlags.cmake b/cmake/Modules/CppUTestWarningFlags.cmake
deleted file mode 100644
index dd2ed9464..000000000
--- a/cmake/Modules/CppUTestWarningFlags.cmake
+++ /dev/null
@@ -1,65 +0,0 @@
-if (MSVC)
- set(CPPUTEST_C_WARNING_FLAGS "/WX")
- set(CPPUTEST_CXX_WARNING_FLAGS "/WX /wd4290")
-else (MSVC)
- include(CheckCCompilerFlag)
- include(CheckCXXCompilerFlag)
-
- macro(check_and_append_c_warning_flags)
- foreach (flag ${ARGN})
- check_c_compiler_flag("-${flag}" WARNING_C_FLAG_${flag})
- if (WARNING_C_FLAG_${flag})
- set(CPPUTEST_C_WARNING_FLAGS "${CPPUTEST_C_WARNING_FLAGS} -${flag}")
- endif (WARNING_C_FLAG_${flag})
- endforeach (flag)
- endmacro(check_and_append_c_warning_flags)
-
- macro(check_and_append_cxx_warning_flags)
- foreach (flag ${ARGN})
- check_cxx_compiler_flag("-${flag}" WARNING_CXX_FLAG_${flag})
- if (WARNING_CXX_FLAG_${flag})
- set(CPPUTEST_CXX_WARNING_FLAGS "${CPPUTEST_CXX_WARNING_FLAGS} -${flag}")
- endif (WARNING_CXX_FLAG_${flag})
- endforeach (flag)
- endmacro(check_and_append_cxx_warning_flags)
-
- set(WARNING_C_FLAGS
- Weverything
- Wall
- Wextra
- Wshadow
- Wswitch-default
- Wswitch-enum
- Wconversion
- Wsign-conversion
- Wno-padded
- Wno-disabled-macro-expansion
- )
-
- if (NOT GMOCK AND NOT REAL_GTEST)
- list(APPEND WARNING_C_FLAGS Werror pedantic-errors)
- endif (NOT GMOCK AND NOT REAL_GTEST)
-
- set(WARNING_C_ONLY_FLAGS
- Wstrict-prototypes
- )
-
- set(WARNING_CXX_FLAGS
- ${WARNING_C_FLAGS}
- Woverloaded-virtual
- Wno-global-constructors
- Wno-exit-time-destructors
- Wno-weak-vtables
- )
-
- check_and_append_c_warning_flags(${WARNING_C_FLAGS})
- check_and_append_c_warning_flags(${WARNING_C_ONLY_FLAGS})
- check_and_append_cxx_warning_flags(${WARNING_CXX_FLAGS})
-
- if (C++11)
- check_cxx_compiler_flag("-Wno-c++98-compat" NO_WARNING_CXX_98_COMPAT_FLAG)
- if (NO_WARNING_CXX_98_COMPAT_FLAG)
- set(CPPUTEST_CXX_WARNING_FLAGS "${CPPUTEST_CXX_WARNING_FLAGS} -Wno-c++98-compat")
- endif (NO_WARNING_CXX_98_COMPAT_FLAG)
- endif (C++11)
-endif (MSVC)
diff --git a/cmake/Modules/FindCXX11.cmake b/cmake/Modules/FindCXX11.cmake
deleted file mode 100644
index 989a99b86..000000000
--- a/cmake/Modules/FindCXX11.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-# - Finds if the compiler has C++11 support
-# This module can be used to detect compiler flags for using C++11, and checks
-# a small subset of the language.
-#
-# The following variables are set:
-# CXX11_FLAGS - flags to add to the CXX compiler for C++11 support
-# CXX11_FOUND - true if the compiler supports C++11
-#
-# TODO: When compilers starts implementing the whole C++11, check the full set
-
-include(CheckCXXSourceCompiles)
-include(FindPackageHandleStandardArgs)
-
-set(CXX11_FLAG_CANDIDATES
- # Eveerything that automatically accepts C++11
- " "
- # gcc, clang and Intel Linux
- "-std=c++11"
- # Intel windows
- "/Qstd=c++0x"
- )
-
-set(CXX11_TEST_SOURCE
-"
-#if __cplusplus < 201103L
-#error \"Can not compile with C++11\"
-#endif
-
-int main()
-{}
-")
-
-foreach(FLAG ${CXX11_FLAG_CANDIDATES})
- set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
- set(CMAKE_REQUIRED_FLAGS "${FLAG}")
- unset(CXX11_FLAG_DETECTED CACHE)
- message(STATUS "Try C++11 flag = [${FLAG}]")
- check_cxx_source_compiles("${CXX11_TEST_SOURCE}" CXX11_FLAG_DETECTED)
- set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
- if(CXX11_FLAG_DETECTED)
- set(CXX11_FLAGS_INTERNAL "${FLAG}")
- break()
- endif(CXX11_FLAG_DETECTED)
-endforeach(FLAG ${CXX11_FLAG_CANDIDATES})
-
-set(CXX11_FLAGS "${CXX11_FLAGS_INTERNAL}")
-
-find_package_handle_standard_args(CXX11 DEFAULT_MSG CXX11_FLAGS)
-mark_as_advanced(CXX11_FLAGS)
diff --git a/cmake/Modules/_CppUTestDiscovery.cmake b/cmake/Modules/_CppUTestDiscovery.cmake
new file mode 100644
index 000000000..a970fbc37
--- /dev/null
+++ b/cmake/Modules/_CppUTestDiscovery.cmake
@@ -0,0 +1,98 @@
+set(script)
+
+function(add_command NAME)
+ set(_args "")
+ # use ARGV* instead of ARGN, because ARGN splits arrays into multiple arguments
+ math(EXPR _last_arg ${ARGC}-1)
+ foreach(_n RANGE 1 ${_last_arg})
+ set(_arg "${ARGV${_n}}")
+ if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
+ set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument
+ else()
+ set(_args "${_args} ${_arg}")
+ endif()
+ endforeach()
+ set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE)
+endfunction()
+
+if(NOT EXISTS "${EXECUTABLE}")
+ message(FATAL_ERROR
+ "Executable \"${EXECUTABLE}\" does not exist"
+ )
+endif()
+
+macro(add_test_to_script TEST_NAME TEST_LOCATION SELECT_ARG)
+ add_command(
+ add_test
+ "${TEST_NAME}"
+ ${EMULATOR}
+ "${EXECUTABLE}"
+ ${ARGS}
+ ${SELECT_ARG}
+ ${TEST_NAME}
+ )
+ add_command(
+ set_tests_properties
+ "${TEST_NAME}"
+ PROPERTIES
+ DEF_SOURCE_LINE
+ "${TEST_LOCATION}"
+ )
+endmacro()
+
+execute_process(
+ COMMAND ${EMULATOR} "${EXECUTABLE}" -ll
+ OUTPUT_VARIABLE discovered_tests
+ RESULT_VARIABLE result
+ ERROR_VARIABLE error
+)
+if(NOT ${result} EQUAL 0)
+ message(FATAL_ERROR
+ "Error executing ${EXECUTABLE}:\n"
+ "${error}"
+ )
+endif()
+
+string(CONCAT LL_LINE_REGEX
+ "^([^.]*)" # test group
+ "\\."
+ "([^.]*)" # test name
+ "\\."
+ "(.*)" # file name (only this field is allowed to contain dots)
+ "\\."
+ "([^.]*)" # line number
+ "\n"
+)
+string(REGEX MATCHALL "[^\n]+\n" discovered_test_lines "${discovered_tests}")
+if(TESTS_DETAILED)
+ foreach(line IN LISTS discovered_test_lines)
+ string(REGEX MATCH "${LL_LINE_REGEX}" __unused "${line}")
+ set(test_name "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}")
+ file(TO_CMAKE_PATH "${CMAKE_MATCH_3}" test_file)
+ set(test_location "${test_file}:${CMAKE_MATCH_4}")
+ add_test_to_script("${test_name}" "${test_location}" -st)
+ endforeach()
+else()
+ foreach(line IN LISTS discovered_test_lines)
+ string(REGEX MATCH "${LL_LINE_REGEX}" __unused "${line}")
+ set(test_name "${CMAKE_MATCH_1}")
+ file(TO_CMAKE_PATH "${CMAKE_MATCH_3}" test_file)
+ set(test_line "${CMAKE_MATCH_4}")
+ if (NOT _${test_name}_file)
+ # if the group spans two files, arbitrarily choose the first one encountered
+ set(_${test_name}_file "${test_file}")
+ set(_${test_name}_line "${test_line}")
+ elseif(test_file STREQUAL _${test_name}_file AND test_line LESS _${test_name}_line)
+ # line number will eventually be the first line of the first test in the group's file
+ set(_${test_name}_line ${test_line})
+ endif()
+ list(APPEND groups_seen ${test_name})
+ endforeach()
+ list(REMOVE_DUPLICATES groups_seen)
+ foreach(test_name IN LISTS groups_seen)
+ set(test_location "${_${test_name}_file}:${_${test_name}_line}")
+ add_test_to_script("${test_name}" "${test_location}" -sg)
+ endforeach()
+endif()
+
+file(WRITE "${CTEST_FILE}" "${script}")
diff --git a/cmake/Scripts/CppUTestBuildTimeDiscoverTests.cmake b/cmake/Scripts/CppUTestBuildTimeDiscoverTests.cmake
new file mode 100644
index 000000000..c5d96c031
--- /dev/null
+++ b/cmake/Scripts/CppUTestBuildTimeDiscoverTests.cmake
@@ -0,0 +1,94 @@
+# Create CTest entries for EXECUTABLE in CTestTestfile.cmake
+# Overwrite CTestTestfile.cmake with update version.
+
+# Usage:
+#
+# This script is to be called from ../Modules/CppUTestBuildTimeDiscoverTests.cmake
+#
+# Notes on invocation and used variables:
+# ${CMAKE_COMMAND} -DTESTS_DETAILED:BOOL= -DEXECUTABLE= -P
+#
+# TESTS_DETAILED c.f. top-level CMakeLists.txt
+# FULLPATH-TO-EXECUTABLE - use $ or explicit
+# The overwritten CTestTestfile.cmake is located in ${CMAKE_CURRENT_BINARY_DIR}
+#
+# Steps to generate ADD_TEST() commands build time
+# - Read CTestTestfile.cmake
+# - Create update entries
+# - Remove duplicate entries
+# - Write new CTestTestfile.cmake
+
+######################################################################
+# helpers
+######################################################################
+function (buildtime_add_test)
+ # Create ADD_TEST() command string
+ # - Extract and remove testname from ARGV
+ # - Add inner quotes to test arguments
+ # - Add "ADD_TEST()", and first and last quote
+ # Append result to CTESTTESTS
+ list(GET ARGV 0 testname)
+ list(REMOVE_AT ARGV 0)
+ string (REPLACE ";" "\" \"" TEST_ARGS "${ARGV}")
+ set(test_to_add "ADD_TEST(${testname} \"${TEST_ARGS}\")")
+ list(APPEND CTESTTESTS ${test_to_add})
+ SET(CTESTTESTS ${CTESTTESTS} PARENT_SCOPE)
+endfunction()
+
+function (JOIN VALUES GLUE OUTPUT)
+ string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
+ set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
+endfunction()
+
+function (buildtime_discover_tests EXECUTABLE DISCOVER_ARG OUTPUT)
+ execute_process(COMMAND ${EMULATOR} ${EXECUTABLE} ${DISCOVER_ARG}
+ OUTPUT_VARIABLE _TMP_OUTPUT
+ ERROR_VARIABLE DISCOVER_ERR
+ RESULT_VARIABLE DISCOVER_ERR)
+ if(NOT ${DISCOVER_ERR} EQUAL 0)
+ message(SEND_ERROR "Executable \"${EXECUTABLE} ${DISCOVER_ARG}\" failed with output:\n"
+ "${DISCOVER_ERR}\n"
+ "Please check that the excutable was added.")
+ endif(NOT ${DISCOVER_ERR} EQUAL 0)
+ separate_arguments(_TMP_OUTPUT)
+ set(${OUTPUT} "${_TMP_OUTPUT}" PARENT_SCOPE)
+endfunction()
+
+
+######################################################################
+# Implementation
+######################################################################
+
+set(CTESTFNAME "${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile.cmake")
+file(STRINGS ${CTESTFNAME} CTESTTESTS)
+get_filename_component(EXECUTABLE_SHORT_NAME ${EXECUTABLE} NAME_WE)
+
+if (TESTS_DETAILED)
+ set(DISCOVER_ARG "-ln")
+ buildtime_discover_tests("${EXECUTABLE}" "${DISCOVER_ARG}" TestList_GroupsAndNames)
+ set(lastgroup "")
+ foreach(testfullname ${TestList_GroupsAndNames})
+ string(REGEX MATCH "^([^/.]+)" groupname ${testfullname})
+ string(REGEX MATCH "([^/.]+)$" testname ${testfullname})
+ if (NOT ("${groupname}" STREQUAL "${lastgroup}"))
+ message("TestGroup: ${groupname}:")
+ set(lastgroup "${groupname}")
+ endif (NOT ("${groupname}" STREQUAL "${lastgroup}"))
+ message("... ${testname}")
+ buildtime_add_test(${EXECUTABLE_SHORT_NAME}.${testfullname} ${EMULATOR} ${EXECUTABLE} -sg ${groupname} -sn ${testname})
+ endforeach()
+else (TESTS_DETAILED)
+ set(DISCOVER_ARG "-lg")
+ buildtime_discover_tests("${EXECUTABLE}" "${DISCOVER_ARG}" TestList_Groups)
+ foreach(group ${TestList_Groups})
+ message("TestGroup: ${group}")
+ buildtime_add_test(${EXECUTABLE_SHORT_NAME}.${group} ${EMULATOR} "${EXECUTABLE}" -sg ${group})
+ endforeach()
+endif (TESTS_DETAILED)
+
+
+# create separate CTest test for each CppUTestTests test
+
+list(REMOVE_DUPLICATES CTESTTESTS)
+JOIN("${CTESTTESTS}" "\n" CTESTTESTS)
+file(WRITE ${CTESTFNAME} "${CTESTTESTS}\n")
diff --git a/cmake/Toolchains/arm-none-eabi-gcc.toolchain.cmake b/cmake/Toolchains/arm-none-eabi-gcc.toolchain.cmake
new file mode 100644
index 000000000..b9ab5030e
--- /dev/null
+++ b/cmake/Toolchains/arm-none-eabi-gcc.toolchain.cmake
@@ -0,0 +1,8 @@
+set(CMAKE_SYSTEM_NAME Generic)
+set(CMAKE_SYSTEM_PROCESSOR cortex-m4)
+
+set(CMAKE_C_COMPILER arm-none-eabi-gcc)
+
+set(CMAKE_C_FLAGS_INIT "-mcpu=cortex-m4")
+set(CMAKE_CXX_FLAGS_INIT "-mcpu=cortex-m4")
+set(CMAKE_EXE_LINKER_FLAGS_INIT "-specs=rdimon.specs")
diff --git a/cmake/Toolchains/clang+mingw-win32.toolchain.cmake b/cmake/Toolchains/clang+mingw-win32.toolchain.cmake
new file mode 100644
index 000000000..53711d5a8
--- /dev/null
+++ b/cmake/Toolchains/clang+mingw-win32.toolchain.cmake
@@ -0,0 +1,6 @@
+# Toolchain to use Clang compiler with MinGW binutils (e.g. linker) in Windows to generate 32-bits executables
+
+set(CMAKE_C_COMPILER clang)
+set(CMAKE_C_FLAGS "-target i686-w64-mingw32 -m32" CACHE STRING "" FORCE)
+set(CMAKE_CXX_COMPILER clang++)
+set(CMAKE_CXX_FLAGS "-target i686-w64-mingw32 -m32" CACHE STRING "" FORCE)
\ No newline at end of file
diff --git a/cmake/Toolchains/clang+mingw-win64.toolchain.cmake b/cmake/Toolchains/clang+mingw-win64.toolchain.cmake
new file mode 100644
index 000000000..8a2d26501
--- /dev/null
+++ b/cmake/Toolchains/clang+mingw-win64.toolchain.cmake
@@ -0,0 +1,6 @@
+# Toolchain to use Clang compiler with MinGW binutils (e.g. linker) in Windows to generate 64-bits executables
+
+set(CMAKE_C_COMPILER clang)
+set(CMAKE_C_FLAGS "-target x86_64-w64-mingw32" CACHE STRING "" FORCE)
+set(CMAKE_CXX_COMPILER clang++)
+set(CMAKE_CXX_FLAGS "-target x86_64-w64-mingw32" CACHE STRING "" FORCE)
\ No newline at end of file
diff --git a/cmake/Toolchains/ewarm-linux.toolchain.cmake b/cmake/Toolchains/ewarm-linux.toolchain.cmake
new file mode 100644
index 000000000..e0053a7bf
--- /dev/null
+++ b/cmake/Toolchains/ewarm-linux.toolchain.cmake
@@ -0,0 +1,21 @@
+### BEGIN CMAKE_TOOLCHAIN_FILE
+# "Generic" is used when compiling for bare-metal
+set(CMAKE_SYSTEM_NAME Generic)
+
+# Set the EW installation root directory
+#(Avoid spaces in the path or you need to escape them)
+set(EW_ROOT_DIR "/opt/iarsystems/bxarm/arm/")
+
+# Compiler flags needed to compile for this CPU
+set(CPU_FLAGS "--cpu Cortex-M4F")
+
+# Set up the CMake variables for compiler and assembler
+# (The reason for both C and CXX variables is that CMake
+# treats C and C++ tools individually)
+set(CMAKE_C_COMPILER "${EW_ROOT_DIR}/bin/iccarm" "${CPU_FLAGS} --dlib_config normal")
+set(CMAKE_CXX_COMPILER "${EW_ROOT_DIR}/bin/iccarm" "${CPU_FLAGS} --dlib_config normal")
+set(CMAKE_ASM_COMPILER "${EW_ROOT_DIR}/bin/iasmarm" "${CPU_FLAGS}")
+
+# Build with cmake -S. -Bbuild -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/ewarm-linux.toolchain.cmake
+
+### END CMAKE_TOOLCHAIN_FILE
diff --git a/cmake/Toolchains/ewarm-win.toolchain.cmake b/cmake/Toolchains/ewarm-win.toolchain.cmake
new file mode 100644
index 000000000..ab28b445f
--- /dev/null
+++ b/cmake/Toolchains/ewarm-win.toolchain.cmake
@@ -0,0 +1,21 @@
+### BEGIN CMAKE_TOOLCHAIN_FILE
+# "Generic" is used when compiling for bare-metal
+set(CMAKE_SYSTEM_NAME Generic)
+
+# Set the EW installation root directory
+#(Avoid spaces in the path or you need to escape them)
+set(EW_ROOT_DIR "E:/Program Files\ (x86)/IAR\ Systems/Embedded\ Workbench\ Arm 8.50.6/arm")
+
+# Compiler flags needed to compile for this CPU
+set(CPU_FLAGS "--cpu Cortex-M4F")
+
+# Set up the CMake variables for compiler and assembler
+# (The reason for both C and CXX variables is that CMake
+# treats C and C++ tools individually)
+set(CMAKE_C_COMPILER "${EW_ROOT_DIR}/bin/iccarm.exe" "${CPU_FLAGS} --dlib_config normal")
+set(CMAKE_CXX_COMPILER "${EW_ROOT_DIR}/bin/iccarm.exe" "${CPU_FLAGS} --dlib_config normal")
+set(CMAKE_ASM_COMPILER "${EW_ROOT_DIR}/bin/iasmarm.exe" "${CPU_FLAGS}")
+
+# Build with cmake -S. -Bbuild -G "NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/ewarm-win.toolchain.cmake
+
+### END CMAKE_TOOLCHAIN_FILE
diff --git a/cmake/install.cmake b/cmake/install.cmake
new file mode 100644
index 000000000..f58ba31b9
--- /dev/null
+++ b/cmake/install.cmake
@@ -0,0 +1,65 @@
+set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
+set(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
+set(INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
+
+# Pkg-config file.
+set(prefix "${CMAKE_INSTALL_PREFIX}")
+set(exec_prefix "\${prefix}")
+set(libdir "\${exec_prefix}/${LIB_INSTALL_DIR}")
+set(includedir "\${prefix}/${INCLUDE_INSTALL_DIR}")
+set(PACKAGE_VERSION "${PROJECT_VERSION}")
+
+configure_file(cpputest.pc.in cpputest.pc @ONLY)
+install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/cpputest.pc"
+ DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
+)
+
+install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/generated/CppUTestGeneratedConfig.h"
+ DESTINATION "${INCLUDE_INSTALL_DIR}/generated"
+)
+
+include(CMakePackageConfigHelpers)
+
+set(CPPUTEST_CONFIG_DEST "${LIB_INSTALL_DIR}/CppUTest/cmake")
+
+configure_package_config_file(CppUTestConfig.cmake.install.in
+ ${CMAKE_CURRENT_BINARY_DIR}/install/CppUTestConfig.cmake
+ INSTALL_DESTINATION "${CPPUTEST_CONFIG_DEST}"
+ PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR)
+write_basic_package_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/install/CppUTestConfigVersion.cmake
+ COMPATIBILITY SameMajorVersion
+)
+install(
+ FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/install/CppUTestConfig.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/install/CppUTestConfigVersion.cmake
+ DESTINATION "${CPPUTEST_CONFIG_DEST}"
+)
+install(
+ EXPORT CppUTestTargets
+ NAMESPACE CppUTest::
+ DESTINATION "${CPPUTEST_CONFIG_DEST}"
+)
+install(
+ FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Scripts/CppUTestBuildTimeDiscoverTests.cmake
+ DESTINATION "${CPPUTEST_CONFIG_DEST}/Scripts"
+)
+install(
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/CppUTestBuildTimeDiscoverTests.cmake
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/CppUTest.cmake
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/_CppUTestDiscovery.cmake
+ DESTINATION "${CPPUTEST_CONFIG_DEST}/Modules"
+)
+configure_package_config_file(CppUTestConfig.cmake.build.in
+ ${CMAKE_CURRENT_BINARY_DIR}/CppUTestConfig.cmake
+ INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
+ PATH_VARS INCLUDE_DIR CMAKE_CURRENT_BINARY_DIR
+)
+write_basic_package_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/CppUTestConfigVersion.cmake
+ COMPATIBILITY SameMajorVersion
+)
diff --git a/cmake/warnings.cmake b/cmake/warnings.cmake
new file mode 100644
index 000000000..4b763f684
--- /dev/null
+++ b/cmake/warnings.cmake
@@ -0,0 +1,68 @@
+unset(WARNING_COMMON_FLAGS)
+unset(WARNING_C_FLAGS)
+unset(WARNING_CXX_FLAGS)
+
+if(
+ (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
+ (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR
+ (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+)
+ set(WARNING_COMMON_FLAGS
+ -Wall
+ -Wextra
+ -pedantic
+ -Wshadow
+ -Wswitch-default
+ -Wswitch-enum
+ -Wconversion
+ -Wsign-conversion
+ -Wmissing-include-dirs
+ -Wno-padded
+ -Wno-disabled-macro-expansion
+ -Wreserved-id-macro
+ -Wreserved-identifier
+ -Wno-long-long
+ -Wno-unsafe-buffer-usage
+ )
+
+ set(WARNING_C_FLAGS
+ -Wstrict-prototypes
+ )
+
+ set(WARNING_CXX_FLAGS
+ -Woverloaded-virtual
+ -Wno-global-constructors
+ -Wno-exit-time-destructors
+ -Wno-weak-vtables
+ -Wno-old-style-cast
+ )
+
+ if(DEFINED CMAKE_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD EQUAL 98)
+ list(APPEND WARNING_CXX_FLAGS
+ -Wno-c++98-compat
+ -Wno-c++98-compat-pedantic
+ -Wno-c++14-compat
+ -Wno-inconsistent-missing-destructor-override
+ -Wsuggest-override
+ )
+ endif()
+
+ set(CMAKE_REQUIRED_FLAGS "-Wno-error")
+endif()
+
+include(CheckCCompilerFlag)
+foreach(flag IN LISTS WARNING_COMMON_FLAGS WARNING_C_FLAGS)
+ check_c_compiler_flag("${flag}" WARNING_C_FLAG_${flag})
+ if(WARNING_C_FLAG_${flag})
+ add_compile_options("$<$:${flag}>")
+ endif()
+endforeach()
+
+include(CheckCXXCompilerFlag)
+foreach(flag IN LISTS WARNING_COMMON_FLAGS WARNING_CXX_FLAGS)
+ string(REPLACE "++" "xx" WARNING_CXX_FLAG_VAR "WARNING_CXX_FLAG_${flag}")
+ check_cxx_compiler_flag("${flag}" ${WARNING_CXX_FLAG_VAR})
+ if(${WARNING_CXX_FLAG_VAR})
+ add_compile_options("$<$:${flag}>")
+ endif()
+endforeach()
diff --git a/config.h.cmake b/config.h.cmake
index 06b369062..037a695fb 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -1,13 +1,18 @@
#ifndef CONFIG_H_
#define CONFIG_H_
-#cmakedefine CPPUTEST_COMPILATION @CPPUTEST_COMPILATION@
-
#cmakedefine CPPUTEST_MEM_LEAK_DETECTION_DISABLED
+#cmakedefine01 CPPUTEST_USE_LONG_LONG
+#cmakedefine CPPUTEST_HAVE_STRDUP
+
+#cmakedefine CPPUTEST_HAVE_FORK
+#cmakedefine CPPUTEST_HAVE_WAITPID
+#cmakedefine CPPUTEST_HAVE_KILL
+#cmakedefine CPPUTEST_HAVE_PTHREAD_MUTEX_LOCK
+
+#cmakedefine CPPUTEST_HAVE_GETTIMEOFDAY
#cmakedefine CPPUTEST_STD_C_LIB_DISABLED
#cmakedefine CPPUTEST_STD_CPP_LIB_DISABLED
-#cmakedefine INCLUDE_GTEST_TESTS
-
#endif
diff --git a/configure.ac b/configure.ac
index 18f8cf4d5..3120f9571 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,9 +1,11 @@
AC_PREREQ([2.68])
-AC_INIT([CppUTest], [3.7dev], [https://github.com/cpputest/cpputest])
-AM_INIT_AUTOMAKE
+AC_INIT([CppUTest], [4.0], [https://github.com/cpputest/cpputest])
+AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_SRCDIR([src/CppUTest/Utest.cpp])
AC_CONFIG_HEADERS([config.h])
+AX_PREFIX_CONFIG_H(generated/CppUTestGeneratedConfig.h)
AC_CONFIG_FILES([cpputest.pc])
AC_CONFIG_MACRO_DIR([m4])
AC_LIBTOOL_DLOPEN
@@ -22,7 +24,6 @@ case "x$build_os" in
;;
esac
-
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
@@ -33,7 +34,7 @@ AM_SILENT_RULES
ACX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS"])
-
+AX_COMPILER_VERSION
# This additional -lpthread was added due to a bug on gcc for MacOSX: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42159
# According to the bug report, a workaround is to link -lpthread. Even the ACX_PTHREAD doesn't do that, so we add an
# additional check if that it possible, and if it is, then we link pthread
@@ -57,10 +58,11 @@ AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
+AC_TYPE_LONG_LONG_INT
# Checks for library functions.
AC_FUNC_FORK
-AC_CHECK_FUNCS([gettimeofday memset strstr])
+AC_CHECK_FUNCS([waitpid gettimeofday memset strstr strdup pthread_mutex_lock kill])
AC_CHECK_PROG([CPPUTEST_HAS_GCC], [gcc], [yes], [no])
AC_CHECK_PROG([CPPUTEST_HAS_CLANG], [clang], [yes], [no])
@@ -74,163 +76,259 @@ saved_cxxflags="$CXXFLAGS"
saved_ldflags="$LDFLAGS"
if test "x$USE_MAINTAINER_MODE" = "xyes"; then
-# FLag -Werror.
+# Flag -Werror.
CFLAGS=-Werror
AC_MSG_CHECKING([whether CC and CXX supports -Werror])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS_STRICT="${CPPUTEST_CWARNINGFLAGS} -Werror"; CPPUTEST_CXXWARNINGFLAGS_STRICT="${CPPUTEST_CXXWARNINGFLAGS} -Werror" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
fi
-# FLag -Weverything.
-CFLAGS="-Werror -Weverything -Wno-unused-macros"
-AC_MSG_CHECKING([whether CC and CXX supports -Weverything])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Weverything"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Weverything" ], [AC_MSG_RESULT([no])])
-CFLAGS="$saved_cflags"
+AC_LANG_PUSH([C++])
+#####################################################################################
+##### C++ checks
+
+# Flag -std=c++1y
+CXXFLAGS="-Werror -std=c++1y"
+AC_MSG_CHECKING([whether CXX supports -std=c++1y])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP14FLAG="-std=c++1y" ], [AC_MSG_RESULT([no])])
+CXXFLAGS="$saved_cxxflags"
+
+# Flag std=c++14
+CXXFLAGS="-Werror -std=c++14"
+AC_MSG_CHECKING([whether CXX supports -std=c++14])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP14FLAG="-std=c++14" ], [AC_MSG_RESULT([no])])
+CXXFLAGS="$saved_cxxflags"
+
+# Flag std=c++17
+CXXFLAGS="-Werror -std=c++17"
+AC_MSG_CHECKING([whether CXX supports -std=c++17])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP17FLAG="-std=c++17" ], [AC_MSG_RESULT([no])])
+CXXFLAGS="$saved_cxxflags"
+
+# Flag std=c++20
+CXXFLAGS="-Werror -std=c++2a"
+AC_MSG_CHECKING([whether CXX supports -std=c++2a])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP20FLAG="-std=c++2a" ], [AC_MSG_RESULT([no])])
+CXXFLAGS="$saved_cxxflags"
+
+# Flag std=c++20
+CXXFLAGS="-Werror -std=c++20"
+AC_MSG_CHECKING([whether CXX supports -std=c++20])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP20FLAG="-std=c++20" ], [AC_MSG_RESULT([no])])
+CXXFLAGS="$saved_cxxflags"
+
+#####################################################################################
+##### C++ version checks
+
+### Checking for C++ version compiler flags
+
+# Flag -std=c++98
+CXXFLAGS="-Werror -std=c++98"
+AC_MSG_CHECKING([whether CXX supports -std=c++98])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP98FLAG="-std=c++98" ], [AC_MSG_RESULT([no])])
+CXXFLAGS="$saved_cxxflags"
+
+# Flag -std=c++0x
+CXXFLAGS="-Werror -std=c++0x"
+AC_MSG_CHECKING([whether CXX supports -std=c++0x])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP11FLAG="-std=c++0x" ], [AC_MSG_RESULT([no])])
+CXXFLAGS="$saved_cxxflags"
+
+CXXFLAGS="-Werror -std=c++11"
+AC_MSG_CHECKING([whether CXX supports -std=c++11])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP11FLAG="-std=c++11" ], [AC_MSG_RESULT([no])])
+CXXFLAGS="$saved_cxxflags"
+
+CXXFLAGS="-Werror -stdlib=libc++"
+AC_MSG_CHECKING([whether CXX supports -stdlib=libc++])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP11FLAG="${CPPUTEST_CPP11FLAG} -stdlib=libc++" ], [AC_MSG_RESULT([no])])
+CXXFLAGS="$saved_cxxflags"
# Flag -Wno-c++98-compat
-CXXFLAGS="-Wno-c++98-compat"
+CXXFLAGS="-Werror -Wno-c++98-compat"
AC_MSG_CHECKING([whether CXX supports -Wno-c++98-compat])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP11BLACKLIST=" -Wno-c++98-compat" ], [AC_MSG_RESULT([no])])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-c++98-compat" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
-# FLag -Wall.
+# Flag -Wno-c++98-compat-pedantic
+CXXFLAGS="-Werror -Wno-c++98-compat-pedantic"
+AC_MSG_CHECKING([whether CXX supports -Wno-c++98-compat-pedantic])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-c++98-compat-pedantic" ], [AC_MSG_RESULT([no])])
+CXXFLAGS="$saved_cxxflags"
+
+# Flag -Wno-c++14-compat
+CXXFLAGS="-Werror -Wno-c++14-compat"
+AC_MSG_CHECKING([whether CXX supports -Wno-c++14-compat])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-c++14-compat" ], [AC_MSG_RESULT([no])])
+CXXFLAGS="$saved_cxxflags"
+
+AC_LANG_POP
+
+# Flag -Wno-c++11-long-long. This must be on if it is available as otherwise long long is supported but causes a warning.
+CFLAGS="-Werror -Wno-c++11-long-long"
+AC_MSG_CHECKING([whether CC and CXX supports -Wno-c++11-long-long])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wno-c++11-long-long" CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-c++11-long-long" ], [AC_MSG_RESULT([no])])
+CFLAGS="$saved_cflags"
+
+# Flag -Wno-long-long must be on for C.
+CFLAGS="-Werror -Wno-long-long"
+AC_MSG_CHECKING([whether CC and CXX supports -Wno-long-long])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wno-long-long" CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-long-long"], [AC_MSG_RESULT([no])])
+CFLAGS="$saved_cflags"
+
+
+#####################################################################################
+# Flag -Wall.
CFLAGS="-Werror -Wall"
AC_MSG_CHECKING([whether CC and CXX supports -Wall])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wall"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wall" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
-# FLag -Wextra.
+# Flag -Wextra.
CFLAGS="-Werror -Wextra"
AC_MSG_CHECKING([whether CC and CXX supports -Wextra])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wextra"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wextra" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
-# FLag -Wshadow.
+# Flag -Wshadow.
CFLAGS="-Werror -Wshadow"
AC_MSG_CHECKING([whether CC and CXX supports -Wshadow])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wshadow"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wshadow" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
-# FLag -Wswitch-default
+# Flag -Wswitch-default
CFLAGS="-Werror -Wswitch-default"
AC_MSG_CHECKING([whether CC and CXX supports -Wswitch-default])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wswitch-default"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wswitch-default" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
-# FLag -Wswitch-enum
+# Flag -Wswitch-enum
CFLAGS="-Werror -Wswitch-enum"
AC_MSG_CHECKING([whether CC and CXX supports -Wswitch-enum])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wswitch-enum"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wswitch-enum" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
-# FLag -Wconversion
+# Flag -Wconversion
CFLAGS="-Werror -Wconversion"
AC_MSG_CHECKING([whether CC and CXX supports -Wconversion])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wconversion"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wconversion" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
-# FLag -pedantic
+# Flag -pedantic
CFLAGS="-Werror -pedantic"
AC_MSG_CHECKING([whether CC and CXX supports -pedantic])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -pedantic"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -pedantic" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
-# FLag -Wsign-conversion
+# Flag -Wsign-conversion
CFLAGS="-Werror -Wsign-conversion"
AC_MSG_CHECKING([whether CC supports -Wsign-conversion])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wsign-conversion"], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
-# FLag -Wsign-conversion (for CXX)
+# Flag -Wreserved-id-macro
+CFLAGS="-Werror -Wreserved-id-macro"
+AC_MSG_CHECKING([whether CC support -Wreserved-id-macro])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wreserved-id-macro"], [AC_MSG_RESULT([no])])
+CFLAGS="$saved_cflags"
+
+# Flag -Wreserved-identifier
+CFLAGS="-Werror -Wreserved-identifier"
+AC_MSG_CHECKING([whether CC supports -Wreserved-identifier])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wreserved-identifier"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wreserved-identifier" ], [AC_MSG_RESULT([no])])
+CFLAGS="$saved_cflags"
+
+##### C++ Warnings
+# Flag -Wsign-conversion (for CXX)
AC_LANG_PUSH([C++])
+
CXXFLAGS="-Werror -Wsign-conversion"
AC_MSG_CHECKING([whether CXX supports -Wsign-conversion])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wsign-conversion"], [AC_MSG_RESULT([no])])
-CFLAGS="$saved_cxxflags"
-AC_LANG_POP
+CXXFLAGS="$saved_cxxflags"
-# FLag -Woverloaded-virtual
-AC_LANG_PUSH([C++])
+# Flag -Woverloaded-virtual
CXXFLAGS="-Werror -Woverloaded-virtual"
AC_MSG_CHECKING([whether CXX supports -Woverloaded-virtual])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Woverloaded-virtual" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
+
AC_LANG_POP
-# FLag -Wstrict-prototypes
+# Flag -Wstrict-prototypes
CFLAGS="-Werror -Wstrict-prototypes"
AC_MSG_CHECKING([whether CC supports -Wstrict-prototypes])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wstrict-prototypes" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
+
+#####################################################################################
+##### Less of these warnings
+#
# Disable some warnings as CppUTest has this and can't be prevented at the moment.
-# FLag -Wno-disabled-macro-expansion.
+# Flag -Wno-disabled-macro-expansion.
CFLAGS="-Werror -Wno-disabled-macro-expansion"
AC_MSG_CHECKING([whether CC and CXX supports -Wno-disabled-macro-expansion])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wno-disabled-macro-expansion"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-disabled-macro-expansion" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
-# FLag -Wno-padded.
+# Flag -Wno-padded.
CFLAGS="-Werror -Wno-padded"
AC_MSG_CHECKING([whether CC and CXX supports -Wno-padded])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CWARNINGFLAGS="${CPPUTEST_CWARNINGFLAGS} -Wno-padded"; CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-padded" ], [AC_MSG_RESULT([no])])
CFLAGS="$saved_cflags"
-# FLag -Wno-global-constructors.
AC_LANG_PUSH([C++])
+# Flag -Wno-global-constructors.
CXXFLAGS="-Werror -Wno-global-constructors"
AC_MSG_CHECKING([whether CXX supports -Wno-global-constructors])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-global-constructors" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
-AC_LANG_POP
-# FLag -Wno-exit-time-destructors.
-AC_LANG_PUSH([C++])
+# Flag -Wno-exit-time-destructors.
CXXFLAGS="-Werror -Wno-exit-time-destructors"
AC_MSG_CHECKING([whether CXX supports -Wno-exit-time-destructors])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-exit-time-destructors" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
-AC_LANG_POP
-# FLag -Wno-weak-vtables.
-AC_LANG_PUSH([C++])
+# Flag -Wno-weak-vtables.
CXXFLAGS="-Werror -Wno-weak-vtables"
AC_MSG_CHECKING([whether CXX supports -Wno-weak-vtables])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-weak-vtables" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
-AC_LANG_POP
-# FLag --coverage
-AC_LANG_PUSH([C++])
-CXXFLAGS="-Werror --coverage"
-AC_MSG_CHECKING([whether CXX and the linker supports --coverage (broken in clang 3.3)])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); coverage_flag_supported="yes" ], [AC_MSG_RESULT([no])])
+# Flag -Wno-old-style-cast.
+CXXFLAGS="-Werror -Wno-old-style-cast"
+AC_MSG_CHECKING([whether CXX supports -Wno-old-style-cast])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -Wno-old-style-cast" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
-AC_LANG_POP
-### Checking for Standard C++ 11 compiler flags
-AC_LANG_PUSH([C++])
+if test "x${memory_leak_detection}" = xyes; then
+ # GCC's default optimization breaks leak detection:
+ # https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-fassume-sane-operators-new-delete
+ CXXFLAGS="-Werror -fno-assume-sane-operators-new-delete"
+ AC_MSG_CHECKING([whether CXX supports -fno-assume-sane-operators-new-delete])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXXWARNINGFLAGS="${CPPUTEST_CXXWARNINGFLAGS} -fno-assume-sane-operators-new-delete" ], [AC_MSG_RESULT([no])])
+ CXXFLAGS="$saved_cxxflags"
+fi
-# FLag -std=c++0x
-CXXFLAGS="-std=c++0x"
-AC_MSG_CHECKING([whether CXX supports -std=c++0x])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP11FLAG="-std=c++0x" ], [AC_MSG_RESULT([no])])
-CXXFLAGS="$saved_cxxflags"
+AC_LANG_POP
-CXXFLAGS="-std=c++11"
-AC_MSG_CHECKING([whether CXX supports -std=c++11])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP11FLAG="-std=c++11" ], [AC_MSG_RESULT([no])])
-CXXFLAGS="$saved_cxxflags"
+#####################################################
+######## End warning section
-CXXFLAGS="-stdlib=libc++"
-AC_MSG_CHECKING([whether CXX supports -stdlib=libc++])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]])], [AC_MSG_RESULT([yes]); CPPUTEST_CPP11FLAG="${CPPUTEST_CPP11FLAG} -stdlib=libc++" ], [AC_MSG_RESULT([no])])
+# Flag --coverage
+AC_LANG_PUSH([C++])
+CXXFLAGS="-Werror --coverage"
+AC_MSG_CHECKING([whether CXX and the linker supports --coverage (broken in clang 3.3)])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); coverage_flag_supported="yes" ], [AC_MSG_RESULT([no])])
CXXFLAGS="$saved_cxxflags"
-
AC_LANG_POP
-### Checking for strange exception handling behavior, related to bugs in compilers...
-### TODO: This part isn't finished yet. It will need to generate different CppUTestConfig.h files based on the result of these checks.
+######################################################
+# Exception Handling
+#
+# Checking for strange exception handling behavior, related to bugs in compilers...
AC_LANG_PUSH([C++])
# Can we use operator delete without exception handling specifier? (clang warns on this!)
@@ -245,6 +343,12 @@ AC_MSG_CHECKING([whether CXX supports operator new with exception handling speci
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include \nvoid* operator new(size_t size) throw(std::bad_alloc);;])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); UT_NEW_CANT_HAVE_EXCEPTION_SPECIFIER="yes"])
CXXFLAGS="$saved_cxxflags"
+# Flag -Wno-missing-exception-spec
+CXXFLAGS="-Werror -Wno-missing-exception-spec"
+AC_MSG_CHECKING([whether CXX supports -Wno-missing-exception-spec])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]); CPPUTEST_CXX_NO_INC_WARNINGFLAGS="${CPPUTEST_CXX_NO_INC_WARNINGFLAGS} -Wno-missing-exception-spec" ], [AC_MSG_RESULT([no])])
+CXXFLAGS="$saved_cxxflags"
+
AC_LANG_POP
##### Linker checking.
@@ -280,9 +384,21 @@ AC_ARG_ENABLE([std-c], [AC_HELP_STRING([--disable-std-c], [disable the use of St
AC_ARG_ENABLE([std-cpp], [AC_HELP_STRING([--disable-std-cpp], [disable the use of Standard C++ Library])],
[use_std_cpp=${enableval}], [use_std_cpp=${default_use_std_cpp}])
+AC_ARG_ENABLE([std-cpp98], [AC_HELP_STRING([--enable-std-cpp98], [enable the use of Standard C++ 98 (if the compiler supports that)])],
+ [use_std_cpp98=${enableval}], [use_std_cpp98=no])
+
AC_ARG_ENABLE([std-cpp11], [AC_HELP_STRING([--enable-std-cpp11], [enable the use of Standard C++ 11 (if the compiler supports that)])],
[use_std_cpp11=${enableval}], [use_std_cpp11=no])
+AC_ARG_ENABLE([std-cpp14], [AC_HELP_STRING([--enable-std-cpp14], [enable the use of Standard C++ 14 (if the compiler supports that)])],
+ [use_std_cpp14=${enableval}], [use_std_cpp14=no])
+
+AC_ARG_ENABLE([std-cpp17], [AC_HELP_STRING([--enable-std-cpp17], [enable the use of Standard C++ 17 (if the compiler supports that)])],
+ [use_std_cpp17=${enableval}], [use_std_cpp17=no])
+
+AC_ARG_ENABLE([std-cpp20], [AC_HELP_STRING([--enable-std-cpp20], [enable the use of Standard C++ 20 (if the compiler supports that)])],
+ [use_std_cpp20=${enableval}], [use_std_cpp20=no])
+
AC_ARG_ENABLE([cpputest-flags], [AC_HELP_STRING([--disable-cpputest-flags], [disable CFLAGS/CPPFLAGS/CXXFLAGS set by CppUTest])],
[cpputest_flags=${enableval}], [cpputest_flags=yes])
@@ -292,12 +408,18 @@ AC_ARG_ENABLE([memory-leak-detection], [AC_HELP_STRING([--disable-memory-leak-de
AC_ARG_ENABLE([extensions], [AC_HELP_STRING([--disable-extensions], [disable CppUTest extension library])],
[cpputest_ext=${enableval}], [cpputest_ext=yes])
+AC_ARG_ENABLE([longlong], [AC_HELP_STRING([--disable-longlong], [disable support for long long type])],
+ [use_longlong=${enableval}], [use_longlong=yes])
+
AC_ARG_ENABLE([generate-map-file], [AC_HELP_STRING([--enable-generate-map-file], [enable the creation of a map file])],
[generate_map_file=${enableval}], [generate_map_file=no])
AC_ARG_ENABLE([coverage], [AC_HELP_STRING([--enable-coverage], [enable running with coverage])],
[coverage=${enableval}], [coverage=no])
+AC_ARG_ENABLE([sanitize-address], [AC_HELP_STRING([--enable-sanitize-address], [enable running with address sanitizer])],
+ [sanitize_address=${enableval}], [sanitize_address=no])
+
############################## Setting options ###############################
AM_CONDITIONAL([INCLUDE_CPPUTEST_EXT], [test "x${cpputest_ext}" = xyes])
@@ -308,7 +430,7 @@ if test "x${use_std_c}" = xno; then
memory_leak_detection=no
CPPUTEST_CPPFLAGS="${CPPUTEST_CPPFLAGS} -nostdinc"
CPPUTEST_LDFLAGS="${CPPUTEST_LDFLAGS} -nostdlib"
- AC_DEFINE([CPPUTEST_STD_C_LIB_DISABLED], [1], [Standard C library disabled])
+ AC_DEFINE([STD_C_LIB_DISABLED], [1], [Standard C library disabled])
CPP_PLATFORM="GccNoStdC"
else
CPP_PLATFORM="Gcc"
@@ -316,30 +438,67 @@ fi
# Using standard C++
if test "x${use_std_cpp}" = xno; then
- AC_DEFINE([CPPUTEST_STD_CPP_LIB_DISABLED], 1, [Standard C++ library disabled])
+ AC_DEFINE([STD_CPP_LIB_DISABLED], 1, [Standard C++ library disabled])
if test "x${use_std_c}" = xyes; then
- CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} -nostdinc++"
+ CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} -nostdinc++ ${CPPUTEST_CXX_NO_INC_WARNINGFLAGS}"
# Since automake passes the CXXFLAGS to the linker, this will cause warnings with clang 3.2 (which become errors)
CPPUTEST_LDFLAGS="${CPPUTEST_LDFLAGS} ${CPPUTEST_NO_UNUSED_ARGUMENT_WARNING}"
fi
fi
+cpp_standard_used="default"
+
+# Using the C++98 standard?
+if test "x${use_std_cpp98}" = xyes; then
+ CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP98FLAG}"
+ cpp_standard_used="C++98"
+fi
# Using the C++11 standard?
if test "x${use_std_cpp11}" = xyes; then
- CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP11FLAG} ${CPPUTEST_CPP11BLACKLIST}"
+ CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP11FLAG}"
+ cpp_standard_used="C++11"
fi
+# Using the C++14 standard?
+if test "x${use_std_cpp14}" = xyes; then
+ CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP14FLAG}"
+ cpp_standard_used="C++14"
+fi
+
+# Using the C++17 standard?
+if test "x${use_std_cpp17}" = xyes; then
+ CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP17FLAG}"
+ cpp_standard_used="C++17"
+fi
+
+# Using the C++20 standard?
+if test "x${use_std_cpp20}" = xyes; then
+ CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} ${CPPUTEST_CPP20FLAG}"
+ cpp_standard_used="C++20"
+fi
# Dealing with memory leak detection
if test "x${memory_leak_detection}" = xno; then
- AC_DEFINE([CPPUTEST_MEM_LEAK_DETECTION_DISABLED], 1, [memory leak detection disabled])
+ AC_DEFINE([MEM_LEAK_DETECTION_DISABLED], 1, [memory leak detection disabled])
else
CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} -include ${srcdir}/include/CppUTest/MemoryLeakDetectorNewMacros.h"
CPPUTEST_CPPFLAGS="${CPPUTEST_CPPFLAGS} -include ${srcdir}/include/CppUTest/MemoryLeakDetectorMallocMacros.h"
fi
+# Disabling long long support
+if test "x${use_longlong}" = xno; then
+ AC_DEFINE([LONG_LONG_DISABLED], 1, [disable long long])
+fi
+
+# Dealing with address sanitizer
+if test "x${sanitize_address}" = xyes; then
+ CPPUTEST_CFLAGS="${CPPUTEST_CFLAGS} -fsanitize=address -fno-omit-frame-pointer"
+ CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} -fsanitize=address -fno-omit-frame-pointer"
+ CPPUTEST_LDFLAGS="${CPPUTEST_CXXFLAGS} -fsanitize=address -fno-omit-frame-pointer"
+fi
+
# Generating map files.
if test "x${generate_map_file}" = xyes; then
CPPUTEST_LDFLAGS="${CPPUTEST_LDFLAGS} ${CPPUTEST_LD_MAP_GENERATION}"
@@ -364,14 +523,19 @@ if test -n "${GMOCK_HOME}"; then
AC_DEFINE([INCLUDE_GTEST_TESTS], 1, [Include the GTest-related tests in the build])
AC_ARG_VAR([GMOCK_HOME], [Location of the GMock])
- GTEST_HOME=${GMOCK_HOME}/gtest
+
+ if test -z "${GTEST_HOME}"; then
+ GTEST_HOME=${GMOCK_HOME}/gtest
+ fi
CPPUTEST_CPPFLAGS="${CPPUTEST_CPPFLAGS} -I${GMOCK_HOME}/include -I${GTEST_HOME}/include -I${GTEST_HOME}"
- CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1"
+ CPPUTEST_CXXFLAGS="${CPPUTEST_CXXFLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1 -DGMOCK_RENAME_MAIN=1"
if test -e ${GMOCK_HOME}/lib/libgmock.la && test -e ${GTEST_HOME}/lib/libgtest.la; then \
CPPUTEST_LDADD="${CPPUTEST_LDADD} ${GMOCK_HOME}/lib/libgmock.la ${GTEST_HOME}/lib/libgtest.la"; \
elif test -e ${GMOCK_HOME}/libgmock.a && test -e ${GTEST_HOME}/libgtest.a; then \
CPPUTEST_LDADD="${CPPUTEST_LDADD} ${GMOCK_HOME}/libgmock.a ${GTEST_HOME}/libgtest.a"; \
+ elif test -e ${GMOCK_HOME}/libgmock.a && test -e ${GMOCK_HOME}/gtest/libgtest.a; then \
+ CPPUTEST_LDADD="${CPPUTEST_LDADD} ${GMOCK_HOME}/libgmock.a ${GMOCK_HOME}/gtest/libgtest.a"; \
else \
AC_MSG_ERROR([
-------------------------------------
@@ -433,12 +597,11 @@ AC_SUBST([CPPUTEST_HAS_GCC])
AC_SUBST([CPPUTEST_HAS_CLANG])
AC_SUBST([ALL_FILES_IN_GIT])
-AC_DEFINE([CPPUTEST_COMPILATION], [1], [Compiling CppUTest itself])
-
LT_INIT
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
+
echo \
"----------------------------------------------------------------
@@ -447,6 +610,8 @@ ${PACKAGE_NAME} Version ${PACKAGE_VERSION}
Current compiler options:
CC: ${CC}
CXX: ${CXX}
+ CC version: ${ax_cv_c_compiler_version}
+ CXX version: ${ax_cv_cxx_compiler_version}
LD: ${LD}
Default CFLAGS: ${CFLAGS}
Default CXXFLAGS: ${CXXFLAGS}
@@ -457,9 +622,12 @@ Current compiler options:
CppUTest LIB: ${LIBS}
Features configured in ${PACKAGE_NAME}:
+ C++ standard used: ${cpp_standard_used}
Memory Leak Detection: ${memory_leak_detection}
Compiling extensions: ${cpputest_ext}
+ Use Long Long (if available): ${use_longlong}
Disable CppUTest compile/link flags: ${cpputest_flags}
+ Address sanitizer: ${sanitize_address}
Using Standard C++ Library: ${use_std_cpp}
Using Standard C Library: ${use_std_c}
diff --git a/cpputest-hist.txt b/cpputest-hist.txt
deleted file mode 100644
index 27fdacdef..000000000
--- a/cpputest-hist.txt
+++ /dev/null
@@ -1,1626 +0,0 @@
-------------------------------------------------------------------------
-r337 | basvodde | 2009-05-17 02:43:25 -0500 (Sun, 17 May 2009) | 1 line
-
-Fixed the MemoryLeakDetector again.
-------------------------------------------------------------------------
-r336 | basvodde | 2009-05-17 02:05:32 -0500 (Sun, 17 May 2009) | 1 line
-
-Removed the PlatformSpecificSPrintf. No need anymore
-------------------------------------------------------------------------
-r335 | basvodde | 2009-05-17 01:52:38 -0500 (Sun, 17 May 2009) | 1 line
-
-Added some String function and removed static buffers. Also removed an #undef which let to problems...
-------------------------------------------------------------------------
-r334 | jamesgrenning | 2009-05-15 23:46:33 -0500 (Fri, 15 May 2009) | 2 lines
-
-c leak detection is default on.
-
-------------------------------------------------------------------------
-r333 | jamesgrenning | 2009-05-07 18:09:55 -0500 (Thu, 07 May 2009) | 1 line
-
-using ranlib due to cygwin problem. it does not support libtool -static
-------------------------------------------------------------------------
-r332 | jamesgrenning | 2009-05-07 18:01:04 -0500 (Thu, 07 May 2009) | 1 line
-
-Using libtool instead of $(AR) for library creation. Needed for Mac OSX.
-------------------------------------------------------------------------
-r331 | tpuronen | 2009-05-06 07:50:37 -0500 (Wed, 06 May 2009) | 1 line
-
-Clean up
-------------------------------------------------------------------------
-r330 | tpuronen | 2009-05-06 07:39:46 -0500 (Wed, 06 May 2009) | 1 line
-
-Symbian compilation fixes.
-------------------------------------------------------------------------
-r329 | tpuronen | 2009-05-06 06:50:36 -0500 (Wed, 06 May 2009) | 1 line
-
-The first batch of Symbian fixes, do not use new overloads as Symbian has built-in memory leak detection, remove obsolete stuff.
-------------------------------------------------------------------------
-r328 | tpuronen | 2009-05-06 03:21:45 -0500 (Wed, 06 May 2009) | 1 line
-
-64-bit compiler fixes. Examples still need fixes.
-------------------------------------------------------------------------
-r327 | jamesgrenning | 2009-04-23 21:43:25 -0500 (Thu, 23 Apr 2009) | 1 line
-
-
-------------------------------------------------------------------------
-r326 | jamesgrenning | 2009-04-23 08:28:44 -0500 (Thu, 23 Apr 2009) | 1 line
-
-
-------------------------------------------------------------------------
-r325 | jamesgrenning | 2009-04-23 07:50:16 -0500 (Thu, 23 Apr 2009) | 2 lines
-
-Adding IAR-STR912 ARM9 eval board support
-
-------------------------------------------------------------------------
-r324 | jamesgrenning | 2009-04-22 19:15:21 -0500 (Wed, 22 Apr 2009) | 2 lines
-
-added enable() during setup.
-
-------------------------------------------------------------------------
-r323 | jamesgrenning | 2009-04-22 18:57:38 -0500 (Wed, 22 Apr 2009) | 26 lines
-
-Changes to allow Memory Leak Detection to be turned off for an embedded platform
-
-MemoryLeakDetector.h:
-Added #include so that size_t works.
-
-MemoryLeakWarningPlugin.h: Modified:
-extern "C" { /* include for size_t definition */
- #undef __cplusplus
- #define _WCHART
- #include "TestHarness_c.h"
-}
-
-MemoryLeakWarningPlugin.cpp:
-Removed the remaining operator new stuff
-added disable() to constructor
-added isEnabled() guard clauses to public methods that do something
-
-modified and do not like:
-void MemoryLeakWarningPlugin::Enable()
-{
-#if UT_NEW_OVERRIDES_ENABLED
- memLeakDetector->enable();
-#endif
-}
-I would prefer a NullMemoryLeakWarningPlugin over all this conditional compilation, but can live with it.
-
-------------------------------------------------------------------------
-r322 | jamesgrenning | 2009-04-14 07:37:06 -0500 (Tue, 14 Apr 2009) | 1 line
-
-Adding IAR work in progress
-------------------------------------------------------------------------
-r321 | basvodde | 2009-04-10 03:28:35 -0500 (Fri, 10 Apr 2009) | 4 lines
-
-
-Changed back to use size_t :(
-
-
-------------------------------------------------------------------------
-r320 | jamesgrenning | 2009-04-06 06:14:51 -0500 (Mon, 06 Apr 2009) | 5 lines
-
-changed int to long
-
- void* operator new(unsigned long size, const char* file, int line);
- void* operator new[](unsigned long size, const char* file, int line);
-
-------------------------------------------------------------------------
-r319 | basvodde | 2009-04-05 23:55:09 -0500 (Sun, 05 Apr 2009) | 3 lines
-
-
-Removed dependencies to Std Lib C in order to increase portability.
-
-------------------------------------------------------------------------
-r318 | basvodde | 2009-04-05 02:26:26 -0500 (Sun, 05 Apr 2009) | 6 lines
-
-- Fixed memory leak detector stack usage.
-- Added UT_PRINT
-- Added STRCMP_CONTAINS
-- Added StringFromFormat
-- Added simple and inefficient string buffering
-- Added new target to Makefile
-------------------------------------------------------------------------
-r317 | jamesgrenning | 2009-03-30 23:49:30 -0500 (Mon, 30 Mar 2009) | 20 lines
-
-CommandLineTestRunner supports JUNitOutput from command line. Using pimpl pattern. No longer a header file dependency on stdio.
-
-NullJUnitTestOutput file added that can be included in builds that will not use JUnit output
-
-Removed OutputType from public interface of
-CommandLineArguments
-now using
- bool isJUnitOutput() const;
- bool isEclipseOutput() const;
-also added -o eclipse
--o normal still works
-
-(we'll want a -o vs some day)
-
-
-removed
-CommandLineTestRunner ::getOutputType
-
-
-
-------------------------------------------------------------------------
-r316 | jamesgrenning | 2009-03-30 09:51:10 -0500 (Mon, 30 Mar 2009) | 1 line
-
-Added conditional compile that allows swapping between no-placement new and yes-placement new
-------------------------------------------------------------------------
-r315 | basvodde | 2009-03-29 05:47:26 -0500 (Sun, 29 Mar 2009) | 2 lines
-
-Some tweaks to improve memory leak detector performance
-
-------------------------------------------------------------------------
-r314 | jamesgrenning | 2009-03-28 15:03:51 -0500 (Sat, 28 Mar 2009) | 33 lines
-
-TestHarness.h
----------------
-Added PlatformSpecificPutchat
-Added PlatformSpecificFlush
-
-CommandLIneTestRunner.cpp
--------------------------
-Needed to edit out JUnitOutput.h
-
-
-MemoryLeakDetector.cpp
-----------------------
-added #undef malloc and free
-added checkedMalloc that FAILs when malloc returns 0;
-called checkedMalloc instead of malloc
-
-MemoryLeakWarningPlugin.cpp
----------------------------
-Added a malloc failure check and FAIL
-
-
-TestOutput.cpp
---------------
-Extraced PlatformSpecificPutchat
-and PlatformSpecificFlush
-
-Platformws
-----------
-Added IarPlatform
-Gcc/UtestPlatform.cpp - added new mehtods
-VisualCpp/UtestPlatform.cpp - added new methods
-Symbian/UtestPlatform.cpp - added new methods
-
-------------------------------------------------------------------------
-r313 | jamesgrenning | 2009-03-11 09:19:15 -0500 (Wed, 11 Mar 2009) | 1 line
-
-Removed static from operator new
-------------------------------------------------------------------------
-r312 | basvodde | 2009-03-11 01:50:46 -0500 (Wed, 11 Mar 2009) | 2 lines
-
-
-Nasty little cast caused a negative array index.
-------------------------------------------------------------------------
-r311 | basvodde | 2009-03-10 23:21:10 -0500 (Tue, 10 Mar 2009) | 1 line
-
-Fixed some bugs related to static initialization.
-------------------------------------------------------------------------
-r310 | jamesgrenning | 2009-03-10 12:43:24 -0500 (Tue, 10 Mar 2009) | 9 lines
-
-Added to #include to TestHarness.h.
-Why is va_lst being passed as void*
-left old until we can discuss.
-
-MemoryLeakDetector.cpp using changed PlatformSpecificVSNprintf2
-
-Added #undef __cplusplus to TestHarness_c.cpp
-
-Added PlatformSpecificVSNprintf2 to UTestPlatform.
-------------------------------------------------------------------------
-r309 | basvodde | 2009-03-10 02:24:35 -0500 (Tue, 10 Mar 2009) | 1 line
-
-Added realloc support
-------------------------------------------------------------------------
-r308 | basvodde | 2009-03-10 00:28:38 -0500 (Tue, 10 Mar 2009) | 1 line
-
-Fixed a / in the Makefile
-------------------------------------------------------------------------
-r307 | jamesgrenning | 2009-03-08 17:02:31 -0500 (Sun, 08 Mar 2009) | 1 line
-
-poking around SetPointerPlugin.
-------------------------------------------------------------------------
-r306 | jamesgrenning | 2009-03-08 16:26:22 -0500 (Sun, 08 Mar 2009) | 1 line
-
-VC projects OK after Mac change including CommandLineArguments fix.
-------------------------------------------------------------------------
-r305 | jamesgrenning | 2009-03-08 15:52:56 -0500 (Sun, 08 Mar 2009) | 14 lines
-
-
-Added CommandLineArguments class.
-
-Got rid of the statics that were causing the original trouble. There still a some leak as part of CommandLineTestRunner::runAllTestsMain(). Silenced with FinalReport(3).
-
-CommandLineTestRunner has no tests now. The prior tests were only about parameters anyway.
-
-I added gone and isGone to MemoryLeakDetector. This is preventing the detector from crashing during exit. You should look this over. Its kind of a kludge, but it works.
-
-I put thin into ignore. Have not had a chance to check why it is broken.
-IGNORE_TEST(SetPointerPluginTest, installTooMuchFunctionPointer)
-
-Added a test to check the order of the pre and post test actions. last plugin is run first, post runs in opposite order.
-
-------------------------------------------------------------------------
-r304 | jamesgrenning | 2009-02-23 19:10:13 -0600 (Mon, 23 Feb 2009) | 1 line
-
-kludge fix for groupFilter and nameFilter in test regixtry.u
-------------------------------------------------------------------------
-r303 | jamesgrenning | 2009-02-23 14:36:47 -0600 (Mon, 23 Feb 2009) | 1 line
-
-turned on full parse indexing
-------------------------------------------------------------------------
-r302 | jamesgrenning | 2009-02-23 14:29:07 -0600 (Mon, 23 Feb 2009) | 38 lines
-
-I made this compile with ubuntu Linux gcc 4.3.2
-
-Many char*s and char**s had to be changed to const char* and const char**.
-
-For backwards compatibility there are two of these
- static int RunAllTests(int ac, const char** av);
- static int RunAllTests(int ac, char** av);
-
-one to work with each possible main
- main(int argc, const char** argv).
- main(int argc, char** argv)
-
-I did not want to break existing tests.
-
-
-There are also two of thes in TestPlugin for the same reason.
- virtual bool parseAllArguments(int ac, const char** av, int index);
- virtual bool parseAllArguments(int ac, char** av, int index);
-
-I did not modify the PluginTest file because parseArguments is not tested there.
-
-I took out CHECK_EQUAL("THIS", "THIS") from places like
-TEST(Utest, allMacros)
-{
- CHECK(0 == 0);
- LONGS_EQUAL(1,1);
- BYTES_EQUAL(0xab,0xab);
- CHECK_EQUAL(100,100);
- STRCMP_EQUAL("THIS", "THIS");
- DOUBLES_EQUAL(1.0, 1.0, .01);
- POINTERS_EQUAL(this, this);
-}
-
-It was generating a warning. For good reasons. The use probably really wants STRCMP_EQUAL.
-
-Changed Makefile CPPFLAGS += -Wall
-
-
-------------------------------------------------------------------------
-r301 | basvodde | 2009-01-10 03:29:18 -0600 (Sat, 10 Jan 2009) | 4 lines
-
-1. New memory leak detector
-2. CHECKs can be used for functions that return a value
-3. Teardown is always called
-4. Failed cases don't report memory leaks
-------------------------------------------------------------------------
-r300 | jamesgrenning | 2008-12-10 08:40:26 -0600 (Wed, 10 Dec 2008) | 1 line
-
-fixed alternative TEST_FAIL alternative to FAIL
-------------------------------------------------------------------------
-r299 | jamesgrenning | 2008-12-08 20:43:40 -0600 (Mon, 08 Dec 2008) | 2 lines
-
-Updated scripts for generating C starting point for multi instance classes
-
-------------------------------------------------------------------------
-r298 | basvodde | 2008-12-02 04:56:01 -0600 (Tue, 02 Dec 2008) | 1 line
-
-OrderedTest
-------------------------------------------------------------------------
-r297 | basvodde | 2008-12-02 04:39:38 -0600 (Tue, 02 Dec 2008) | 2 lines
-
-Added another search function...
-
-------------------------------------------------------------------------
-r296 | basvodde | 2008-11-30 20:48:31 -0600 (Sun, 30 Nov 2008) | 1 line
-
-Minor changes to support ordered tests
-------------------------------------------------------------------------
-r295 | jamesgrenning | 2008-11-10 10:48:40 -0600 (Mon, 10 Nov 2008) | 1 line
-
-Changed how pointers are printed so that it is compatible with MS VC6/Mac/Cygwin
-------------------------------------------------------------------------
-r294 | jamesgrenning | 2008-11-10 09:20:50 -0600 (Mon, 10 Nov 2008) | 1 line
-
-
-------------------------------------------------------------------------
-r293 | jamesgrenning | 2008-11-04 17:46:46 -0600 (Tue, 04 Nov 2008) | 1 line
-
-Fixed signature of PlatformSpecificSprintf
-------------------------------------------------------------------------
-r292 | jamesgrenning | 2008-11-04 06:43:18 -0600 (Tue, 04 Nov 2008) | 1 line
-
-delete q
-------------------------------------------------------------------------
-r291 | basvodde | 2008-11-04 00:32:13 -0600 (Tue, 04 Nov 2008) | 3 lines
-
-Removed the dependency on stdio.h in the TestHarness.h.
-
-It killed the usage of CppUTest on not so standard C platforms.
-------------------------------------------------------------------------
-r290 | jamesgrenning | 2008-11-03 06:11:34 -0600 (Mon, 03 Nov 2008) | 3 lines
-
-added CppUnit templates
-
-
-------------------------------------------------------------------------
-r289 | jamesgrenning | 2008-10-30 14:39:29 -0500 (Thu, 30 Oct 2008) | 1 line
-
-
-------------------------------------------------------------------------
-r288 | jamesgrenning | 2008-10-30 14:35:22 -0500 (Thu, 30 Oct 2008) | 2 lines
-
-improving new project script
-
-------------------------------------------------------------------------
-r287 | jamesgrenning | 2008-10-03 06:52:37 -0500 (Fri, 03 Oct 2008) | 2 lines
-
-added POINTERS_EQUAL support
-Updated code templates
-------------------------------------------------------------------------
-r286 | jamesgrenning | 2008-09-04 14:10:15 -0500 (Thu, 04 Sep 2008) | 2 lines
-
-Added support scripts to build dir structure and other flavor of C modules
-
-------------------------------------------------------------------------
-r285 | jamesgrenning | 2008-08-02 16:14:51 -0500 (Sat, 02 Aug 2008) | 1 line
-
-initialized a pointer that made a failure in VS.NET 2003
-------------------------------------------------------------------------
-r284 | jamesgrenning | 2008-08-01 17:51:23 -0500 (Fri, 01 Aug 2008) | 1 line
-
-I changed cpputest_sprintf's name
-------------------------------------------------------------------------
-r283 | basvodde | 2008-08-01 04:03:46 -0500 (Fri, 01 Aug 2008) | 1 line
-
-Path fixed.
-------------------------------------------------------------------------
-r282 | jamesgrenning | 2008-07-15 20:35:04 -0500 (Tue, 15 Jul 2008) | 1 line
-
-removed platform include path
-------------------------------------------------------------------------
-r281 | jamesgrenning | 2008-07-15 15:41:15 -0500 (Tue, 15 Jul 2008) | 1 line
-
-
-------------------------------------------------------------------------
-r280 | jamesgrenning | 2008-07-15 11:53:22 -0500 (Tue, 15 Jul 2008) | 6 lines
-
-Created cpputest_snprintf to get isolate the platform dependencies around snprintf.
-Updated MS VC6 workspaces and projects
-Got rid of cygwin warnings
-
-This needs to be checked on symbian. vsnprintf is not supported on symbian, but it does translate the call to vsprintf.
-this might cause a test to fail.
-------------------------------------------------------------------------
-r279 | jamesgrenning | 2008-07-12 12:07:02 -0500 (Sat, 12 Jul 2008) | 20 lines
-
-I just got CppUTest to work with VC6 AGAIN!
-
-Here are some of the changes.
-
-JUnit... files
-add #include "Platform.h"
-the MS platform file defines snprintf
-
-Makefile:
-add the platform directory on the include search path.
-added condition build for the "Extensions"
-
-Testharness_c.cpp
-got rid of a warning here by using the ?: operator
- void CHECK_C_LOCATION(int condition, const char* conditionString, const char* fileName, int lineNumber)
- {
- CHECK_LOCATION(((condition) == 0 ? false : true), conditionString, fileName, lineNumber);
- }
-
-
-------------------------------------------------------------------------
-r278 | tpuronen | 2008-06-27 02:09:10 -0500 (Fri, 27 Jun 2008) | 1 line
-
-Added NULL checking to overloaded delete operators
-------------------------------------------------------------------------
-r277 | tpuronen | 2008-06-26 08:14:25 -0500 (Thu, 26 Jun 2008) | 1 line
-
-Rewrote README_Symbian.txt, added missing tests to alltests.mmp.
-------------------------------------------------------------------------
-r276 | tpuronen | 2008-06-26 07:23:54 -0500 (Thu, 26 Jun 2008) | 1 line
-
-Symbian build file fixes
-------------------------------------------------------------------------
-r275 | tpuronen | 2008-06-26 05:21:13 -0500 (Thu, 26 Jun 2008) | 1 line
-
-Symbian build file fixes
-------------------------------------------------------------------------
-r274 | jamesgrenning | 2008-06-25 17:03:07 -0500 (Wed, 25 Jun 2008) | 2 lines
-
-added BYTES_EQUAL
-
-------------------------------------------------------------------------
-r273 | jamesgrenning | 2008-06-25 17:01:21 -0500 (Wed, 25 Jun 2008) | 1 line
-
-added BYTES_EQUAL
-------------------------------------------------------------------------
-r272 | basvodde | 2008-06-23 21:51:41 -0500 (Mon, 23 Jun 2008) | 1 line
-
-Fixed the output to console related to flushing.
-------------------------------------------------------------------------
-r271 | basvodde | 2008-06-23 21:42:13 -0500 (Mon, 23 Jun 2008) | 1 line
-
-Renamed the RealTestOutput and the MockTestOutput
-------------------------------------------------------------------------
-r270 | basvodde | 2008-06-23 03:22:57 -0500 (Mon, 23 Jun 2008) | 4 lines
-
-
-Renamed GenericTest to ExecFunctionTest and moved it to UTest.h Also renamed GenericFixture to TestTestingFixture and moved it to the include since this is useful when writing plugins or extensions.
-
-Fixed all the tests.
-------------------------------------------------------------------------
-r269 | jamesgrenning | 2008-05-20 10:41:08 -0500 (Tue, 20 May 2008) | 1 line
-
-report that tests are being run, before running them
-------------------------------------------------------------------------
-r268 | jamesgrenning | 2008-05-20 10:37:50 -0500 (Tue, 20 May 2008) | 2 lines
-
-flush buffer so that if a test crashes, the test name is printed.
-Ignore tests are indicated with a bang!
-------------------------------------------------------------------------
-r267 | basvodde | 2008-04-16 03:54:43 -0500 (Wed, 16 Apr 2008) | 1 line
-
-Use more gcc defaults
-------------------------------------------------------------------------
-r266 | tpuronen | 2008-04-06 05:42:39 -0500 (Sun, 06 Apr 2008) | 1 line
-
-Symbian build file fixes
-------------------------------------------------------------------------
-r265 | tpuronen | 2008-04-06 01:07:35 -0500 (Sun, 06 Apr 2008) | 1 line
-
-Updated Symbian README
-------------------------------------------------------------------------
-r264 | basvodde | 2008-04-03 23:06:08 -0500 (Thu, 03 Apr 2008) | 1 line
-
-Plugin changes
-------------------------------------------------------------------------
-r263 | basvodde | 2008-04-03 23:02:40 -0500 (Thu, 03 Apr 2008) | 2 lines
-
-
-Added a CHECK_C macro for C usage
-------------------------------------------------------------------------
-r262 | basvodde | 2008-04-03 22:59:43 -0500 (Thu, 03 Apr 2008) | 1 line
-
-Moved SimpleString earlier
-------------------------------------------------------------------------
-r261 | basvodde | 2008-04-02 02:19:02 -0500 (Wed, 02 Apr 2008) | 1 line
-
-Doing reverse resetting for SetPointerPlugin
-------------------------------------------------------------------------
-r260 | basvodde | 2008-04-02 02:18:32 -0500 (Wed, 02 Apr 2008) | 1 line
-
-Added test for setting the same pointer twice
-------------------------------------------------------------------------
-r259 | basvodde | 2008-04-01 00:36:10 -0500 (Tue, 01 Apr 2008) | 1 line
-
-Removed platform dependency
-------------------------------------------------------------------------
-r258 | basvodde | 2008-04-01 00:34:56 -0500 (Tue, 01 Apr 2008) | 1 line
-
-Removed Platform.h
-------------------------------------------------------------------------
-r257 | basvodde | 2008-04-01 00:25:30 -0500 (Tue, 01 Apr 2008) | 1 line
-
-t -> T
-------------------------------------------------------------------------
-r256 | basvodde | 2008-04-01 00:14:41 -0500 (Tue, 01 Apr 2008) | 1 line
-
-I -> i
-------------------------------------------------------------------------
-r255 | basvodde | 2008-04-01 00:10:30 -0500 (Tue, 01 Apr 2008) | 1 line
-
-HRM!
-------------------------------------------------------------------------
-r254 | basvodde | 2008-03-31 23:59:40 -0500 (Mon, 31 Mar 2008) | 1 line
-
-Always install the SetPointerPlugin
-------------------------------------------------------------------------
-r253 | basvodde | 2008-03-31 23:48:08 -0500 (Mon, 31 Mar 2008) | 3 lines
-
-Changed the UT_FPSET to UT_PTR_SET
-
-Now works generic with all pointers
-------------------------------------------------------------------------
-r252 | basvodde | 2008-03-31 23:45:29 -0500 (Mon, 31 Mar 2008) | 1 line
-
-JUnit output fix
-------------------------------------------------------------------------
-r251 | basvodde | 2008-03-31 23:45:01 -0500 (Mon, 31 Mar 2008) | 1 line
-
-JUnit output fix
-------------------------------------------------------------------------
-r250 | tpuronen | 2008-03-26 15:37:49 -0500 (Wed, 26 Mar 2008) | 1 line
-
-Symbian build fixes.
-------------------------------------------------------------------------
-r249 | jamesgrenning | 2008-03-26 14:33:17 -0500 (Wed, 26 Mar 2008) | 1 line
-
-Added setjmp/longjmp for symbian. not sure if it is right
-------------------------------------------------------------------------
-r248 | jamesgrenning | 2008-03-24 23:28:31 -0500 (Mon, 24 Mar 2008) | 1 line
-
-
-------------------------------------------------------------------------
-r247 | jamesgrenning | 2008-03-24 23:28:02 -0500 (Mon, 24 Mar 2008) | 2 lines
-
-made NewProject compatible with makefile changes
-
-------------------------------------------------------------------------
-r246 | jamesgrenning | 2008-03-24 23:27:15 -0500 (Mon, 24 Mar 2008) | 1 line
-
-MS Project dsp files up to date
-------------------------------------------------------------------------
-r245 | jamesgrenning | 2008-03-24 23:26:27 -0500 (Mon, 24 Mar 2008) | 2 lines
-
-update how throw/catch is done to get rid of warning
-
-------------------------------------------------------------------------
-r244 | jamesgrenning | 2008-03-24 23:25:25 -0500 (Mon, 24 Mar 2008) | 2 lines
-
-
-
-------------------------------------------------------------------------
-r243 | jamesgrenning | 2008-03-24 23:24:41 -0500 (Mon, 24 Mar 2008) | 1 line
-
-
-------------------------------------------------------------------------
-r242 | jamesgrenning | 2008-03-24 09:00:18 -0500 (Mon, 24 Mar 2008) | 6 lines
-
-Refactored early test exit so that macros are not needed for exiting tests early.
-gcc version and VC++ versions use exceptions
-symbian version is untested, but i put a setjmp/longjmp implementation in there that works on gcc.
-I added a StarterKit platform that has setjmp/longjmp implementations for early test exit
- and null implementations for the time stuff.
-
-------------------------------------------------------------------------
-r241 | jamesgrenning | 2008-03-22 14:18:09 -0500 (Sat, 22 Mar 2008) | 4 lines
-
-Made changes so that a test will exist on its first failure using setjmp/longjmp. it works for gcc. it is a NOP for VC++ and Symbian.
-
-Updated and tested VC++ project files
-
-------------------------------------------------------------------------
-r240 | jamesgrenning | 2008-03-22 14:15:30 -0500 (Sat, 22 Mar 2008) | 1 line
-
-experimental version of malloc/free that will record line of malloc
-------------------------------------------------------------------------
-r239 | jamesgrenning | 2008-03-22 14:13:14 -0500 (Sat, 22 Mar 2008) | 1 line
-
-Commented out experiment with preprocessor stubs
-------------------------------------------------------------------------
-r238 | jamesgrenning | 2008-03-22 14:09:35 -0500 (Sat, 22 Mar 2008) | 4 lines
-
-refactor
-
-make clean deletion of gcov files works on cygwin
-
-------------------------------------------------------------------------
-r237 | jamesgrenning | 2008-03-22 06:04:17 -0500 (Sat, 22 Mar 2008) | 5 lines
-
-Updated scripts
-NewCModule - simpler template
-NewCmiModule - multiple instance C module
-NewProject supported
-
-------------------------------------------------------------------------
-r236 | jamesgrenning | 2008-03-05 04:37:55 -0600 (Wed, 05 Mar 2008) | 2 lines
-
-test results captured in a file, and other gcov changes
-
-------------------------------------------------------------------------
-r235 | jamesgrenning | 2008-01-30 23:38:07 -0600 (Wed, 30 Jan 2008) | 1 line
-
-Added format target to reformat code using astyle.
-------------------------------------------------------------------------
-r234 | jamesgrenning | 2008-01-30 22:25:24 -0600 (Wed, 30 Jan 2008) | 1 line
-
-Added ability to cause cpputest_malloc to return a NULL pointer.
-------------------------------------------------------------------------
-r233 | jamesgrenning | 2008-01-28 01:21:44 -0600 (Mon, 28 Jan 2008) | 2 lines
-
-Deleted some unused templates
-
-------------------------------------------------------------------------
-r232 | jamesgrenning | 2008-01-28 01:15:20 -0600 (Mon, 28 Jan 2008) | 2 lines
-
-clean up temp files
-
-------------------------------------------------------------------------
-r231 | jamesgrenning | 2008-01-27 19:45:44 -0600 (Sun, 27 Jan 2008) | 1 line
-
-ignore gcov output
-------------------------------------------------------------------------
-r230 | jamesgrenning | 2008-01-27 19:42:41 -0600 (Sun, 27 Jan 2008) | 1 line
-
-ignore gcov files
-------------------------------------------------------------------------
-r229 | jamesgrenning | 2008-01-27 18:56:42 -0600 (Sun, 27 Jan 2008) | 5 lines
-
-Update makefile and makefile support
-Added test coverage to makefile
-updated templates for initial C modules
-
-
-------------------------------------------------------------------------
-r228 | jamesgrenning | 2007-12-27 18:19:34 -0600 (Thu, 27 Dec 2007) | 1 line
-
-Added -I for platform include
-------------------------------------------------------------------------
-r227 | jamesgrenning | 2007-12-27 18:16:54 -0600 (Thu, 27 Dec 2007) | 2 lines
-
-Added support for uint8_t uint16_t uint32_t.
-
-------------------------------------------------------------------------
-r226 | jamesgrenning | 2007-12-27 15:41:48 -0600 (Thu, 27 Dec 2007) | 1 line
-
-Reversed the slashes in the includes
-------------------------------------------------------------------------
-r225 | basvodde | 2007-12-27 03:27:29 -0600 (Thu, 27 Dec 2007) | 1 line
-
-Added a very simple function pointer resetter plugin
-------------------------------------------------------------------------
-r224 | basvodde | 2007-12-26 02:15:55 -0600 (Wed, 26 Dec 2007) | 1 line
-
-Changed char* to SimpleString. To remove dependencies with StdC
-------------------------------------------------------------------------
-r223 | basvodde | 2007-12-26 02:15:29 -0600 (Wed, 26 Dec 2007) | 1 line
-
-Changed char* to SimpleString. To remove dependencies with StdC
-------------------------------------------------------------------------
-r222 | basvodde | 2007-12-26 02:15:03 -0600 (Wed, 26 Dec 2007) | 1 line
-
-Changed char* to SimpleString. To remove dependencies with StdC
-------------------------------------------------------------------------
-r221 | basvodde | 2007-12-26 01:48:33 -0600 (Wed, 26 Dec 2007) | 1 line
-
-Print out options and removed include dependencies
-------------------------------------------------------------------------
-r220 | basvodde | 2007-12-26 01:47:08 -0600 (Wed, 26 Dec 2007) | 1 line
-
-Changed #include dependency
-------------------------------------------------------------------------
-r219 | basvodde | 2007-12-26 01:46:41 -0600 (Wed, 26 Dec 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r218 | basvodde | 2007-12-26 01:46:23 -0600 (Wed, 26 Dec 2007) | 1 line
-
-Changed #include dependency
-------------------------------------------------------------------------
-r217 | basvodde | 2007-12-26 01:44:39 -0600 (Wed, 26 Dec 2007) | 1 line
-
-Removed Platform.h
-------------------------------------------------------------------------
-r216 | basvodde | 2007-12-24 03:41:43 -0600 (Mon, 24 Dec 2007) | 1 line
-
-Need both sys time and time. Windows/unix difference.
-------------------------------------------------------------------------
-r215 | basvodde | 2007-12-24 03:12:16 -0600 (Mon, 24 Dec 2007) | 3 lines
-
-
-Code for per test time checks both in -v mode and -ojunit mode.
-
-------------------------------------------------------------------------
-r214 | basvodde | 2007-12-24 03:11:30 -0600 (Mon, 24 Dec 2007) | 1 line
-
-Used the new macro
-------------------------------------------------------------------------
-r213 | basvodde | 2007-12-24 03:10:03 -0600 (Mon, 24 Dec 2007) | 1 line
-
-Added new macro for creating test base classes.
-------------------------------------------------------------------------
-r212 | basvodde | 2007-12-24 03:08:45 -0600 (Mon, 24 Dec 2007) | 4 lines
-
-
-Added some platform specific functions to TestHarness. Might need to find a better way to do this.
-
-Though... not today.
-------------------------------------------------------------------------
-r211 | basvodde | 2007-12-24 03:06:43 -0600 (Mon, 24 Dec 2007) | 1 line
-
-Removed extenstions since could not compile without it.
-------------------------------------------------------------------------
-r210 | basvodde | 2007-12-24 03:06:14 -0600 (Mon, 24 Dec 2007) | 1 line
-
-Updated the makefile and fixed some issues with the extentions
-------------------------------------------------------------------------
-r209 | jamesgrenning | 2007-12-17 20:39:37 -0600 (Mon, 17 Dec 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r208 | jamesgrenning | 2007-12-17 20:36:17 -0600 (Mon, 17 Dec 2007) | 1 line
-
-Refactored the makefile to add conditional inclusion of an extensions directory
-------------------------------------------------------------------------
-r207 | jamesgrenning | 2007-12-17 15:41:52 -0600 (Mon, 17 Dec 2007) | 1 line
-
-changed include to -include to get rid of the error messages when creating the.d files
-------------------------------------------------------------------------
-r206 | jamesgrenning | 2007-12-17 15:30:12 -0600 (Mon, 17 Dec 2007) | 10 lines
-
-To solve this error on a mac:
- /usr/bin/ld: Undefined symbols:
- __Unwind_Resume
- collect2: ld returned 1 exit status
- make: *** [CppUTest_tests] Error 1
-
-Changes $(CC) to $(CXX) everywhere but in the .o.c rule.
-
-Change running the target from @ to ./@ to be unix compatible.
-
-------------------------------------------------------------------------
-r205 | jamesgrenning | 2007-12-03 10:20:40 -0600 (Mon, 03 Dec 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r204 | jamesgrenning | 2007-12-03 10:19:21 -0600 (Mon, 03 Dec 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r203 | basvodde | 2007-11-30 00:12:54 -0600 (Fri, 30 Nov 2007) | 1 line
-
-Removed stdint.h dependency
-------------------------------------------------------------------------
-r202 | basvodde | 2007-11-29 20:10:45 -0600 (Thu, 29 Nov 2007) | 1 line
-
-Fixed a bug that was only visible on Linux
-------------------------------------------------------------------------
-r201 | basvodde | 2007-11-29 19:41:00 -0600 (Thu, 29 Nov 2007) | 1 line
-
-Deleted old makefiles
-------------------------------------------------------------------------
-r200 | basvodde | 2007-11-29 19:38:49 -0600 (Thu, 29 Nov 2007) | 1 line
-
-New makefile
-------------------------------------------------------------------------
-r199 | basvodde | 2007-11-29 19:38:24 -0600 (Thu, 29 Nov 2007) | 1 line
-
-Changed the timeing output
-------------------------------------------------------------------------
-r198 | jamesgrenning | 2007-11-28 17:11:01 -0600 (Wed, 28 Nov 2007) | 1 line
-
-Made a new StringFrom method so that pointers don't print as , but rather in hex
-------------------------------------------------------------------------
-r197 | jamesgrenning | 2007-11-28 17:08:18 -0600 (Wed, 28 Nov 2007) | 1 line
-
-make depend now checks *.c* for dependencies, rather than just *.cpp
-------------------------------------------------------------------------
-r196 | basvodde | 2007-11-21 03:53:59 -0600 (Wed, 21 Nov 2007) | 2 lines
-
-
-Added time measurements
-------------------------------------------------------------------------
-r195 | basvodde | 2007-11-21 03:29:00 -0600 (Wed, 21 Nov 2007) | 1 line
-
-Added SimpleStringExtensions
-------------------------------------------------------------------------
-r194 | basvodde | 2007-11-21 00:09:11 -0600 (Wed, 21 Nov 2007) | 2 lines
-
-Changed the name of TARGET since it conflicted with an environment variable
-called TARGET and therefore let to very strange error messages.
-------------------------------------------------------------------------
-r193 | basvodde | 2007-11-20 20:48:58 -0600 (Tue, 20 Nov 2007) | 1 line
-
-Moved SimpleStringExtensions.cpp to the examples
-------------------------------------------------------------------------
-r192 | basvodde | 2007-11-20 20:30:08 -0600 (Tue, 20 Nov 2007) | 1 line
-
-Removed TestInstaller
-------------------------------------------------------------------------
-r191 | basvodde | 2007-11-20 20:29:48 -0600 (Tue, 20 Nov 2007) | 1 line
-
-Removed TestInstaller
-------------------------------------------------------------------------
-r190 | basvodde | 2007-11-20 20:29:20 -0600 (Tue, 20 Nov 2007) | 1 line
-
-Removed TestInstaller
-------------------------------------------------------------------------
-r189 | basvodde | 2007-11-20 20:23:14 -0600 (Tue, 20 Nov 2007) | 1 line
-
-Removed NullTest
-------------------------------------------------------------------------
-r188 | basvodde | 2007-11-20 20:22:53 -0600 (Tue, 20 Nov 2007) | 1 line
-
-Removed NullTest
-------------------------------------------------------------------------
-r187 | basvodde | 2007-11-20 20:22:27 -0600 (Tue, 20 Nov 2007) | 1 line
-
-Added UtestMacros.h
-------------------------------------------------------------------------
-r186 | basvodde | 2007-11-20 20:21:58 -0600 (Tue, 20 Nov 2007) | 1 line
-
-Removed NullTest
-------------------------------------------------------------------------
-r185 | basvodde | 2007-11-20 20:14:39 -0600 (Tue, 20 Nov 2007) | 1 line
-
-Removed EqualsFailure
-------------------------------------------------------------------------
-r184 | basvodde | 2007-11-20 20:14:14 -0600 (Tue, 20 Nov 2007) | 1 line
-
-Removed EqualsFailure
-------------------------------------------------------------------------
-r183 | jamesgrenning | 2007-11-20 00:59:21 -0600 (Tue, 20 Nov 2007) | 2 lines
-
-Added scripts and templates for NewProject and NewLibrary
-
-------------------------------------------------------------------------
-r182 | jamesgrenning | 2007-11-19 20:51:13 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r181 | jamesgrenning | 2007-11-19 18:44:02 -0600 (Mon, 19 Nov 2007) | 2 lines
-
-
-
-------------------------------------------------------------------------
-r180 | jamesgrenning | 2007-11-19 18:43:32 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r179 | jamesgrenning | 2007-11-19 18:43:06 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r178 | jamesgrenning | 2007-11-19 18:42:30 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r177 | jamesgrenning | 2007-11-19 18:41:50 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r176 | jamesgrenning | 2007-11-19 18:39:36 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r175 | jamesgrenning | 2007-11-19 18:38:48 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r174 | jamesgrenning | 2007-11-19 18:36:25 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r173 | jamesgrenning | 2007-11-19 17:48:13 -0600 (Mon, 19 Nov 2007) | 2 lines
-
-
-
-------------------------------------------------------------------------
-r172 | jamesgrenning | 2007-11-19 17:46:52 -0600 (Mon, 19 Nov 2007) | 2 lines
-
-
-
-------------------------------------------------------------------------
-r171 | jamesgrenning | 2007-11-19 17:44:53 -0600 (Mon, 19 Nov 2007) | 2 lines
-
-
-
-------------------------------------------------------------------------
-r170 | jamesgrenning | 2007-11-19 17:43:49 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r169 | jamesgrenning | 2007-11-19 17:42:31 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r168 | jamesgrenning | 2007-11-19 17:38:25 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r167 | jamesgrenning | 2007-11-19 17:37:48 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r166 | jamesgrenning | 2007-11-19 17:35:58 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r165 | jamesgrenning | 2007-11-19 17:29:35 -0600 (Mon, 19 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r164 | jamesgrenning | 2007-11-19 17:27:00 -0600 (Mon, 19 Nov 2007) | 3 lines
-
-Adding support for NewProject.sh and NewLibrary.sh
-This is an experiment right now
-
-------------------------------------------------------------------------
-r163 | jamesgrenning | 2007-11-06 13:12:20 -0600 (Tue, 06 Nov 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r162 | jamesgrenning | 2007-11-06 12:24:15 -0600 (Tue, 06 Nov 2007) | 1 line
-
-Added Hex printing and support for uint32_t
-------------------------------------------------------------------------
-r161 | jamesgrenning | 2007-11-06 12:19:43 -0600 (Tue, 06 Nov 2007) | 2 lines
-
-added conditional logic around copying hte created library
-
-------------------------------------------------------------------------
-r160 | basvodde | 2007-11-06 02:22:45 -0600 (Tue, 06 Nov 2007) | 1 line
-
-Removed the mmp file
-------------------------------------------------------------------------
-r159 | basvodde | 2007-10-07 04:53:58 -0500 (Sun, 07 Oct 2007) | 1 line
-
-Symbian build files
-------------------------------------------------------------------------
-r158 | basvodde | 2007-10-07 04:53:10 -0500 (Sun, 07 Oct 2007) | 1 line
-
-Symbian build file
-------------------------------------------------------------------------
-r157 | basvodde | 2007-10-07 04:52:37 -0500 (Sun, 07 Oct 2007) | 1 line
-
-Minor changes
-------------------------------------------------------------------------
-r156 | basvodde | 2007-10-07 04:51:55 -0500 (Sun, 07 Oct 2007) | 1 line
-
-Symbian files
-------------------------------------------------------------------------
-r155 | basvodde | 2007-10-07 04:47:36 -0500 (Sun, 07 Oct 2007) | 1 line
-
-Moved
-------------------------------------------------------------------------
-r154 | jamesgrenning | 2007-10-01 17:04:01 -0500 (Mon, 01 Oct 2007) | 1 line
-
-Deleted SymbianAllTests.cpp, it was breaking the make depend.
-------------------------------------------------------------------------
-r153 | jamesgrenning | 2007-09-29 12:04:00 -0500 (Sat, 29 Sep 2007) | 1 line
-
-LONGS_EQUAL outputs expected/but was numbers in both decimal and hex
-------------------------------------------------------------------------
-r152 | jamesgrenning | 2007-09-12 19:30:55 -0500 (Wed, 12 Sep 2007) | 2 lines
-
-got rid of printf infavor of putchar and a loop
-
-------------------------------------------------------------------------
-r151 | jamesgrenning | 2007-09-12 19:29:39 -0500 (Wed, 12 Sep 2007) | 2 lines
-
-added files for creating a new project
-changed the code templates so that they only use setup and teardown
-------------------------------------------------------------------------
-r150 | jamesgrenning | 2007-09-12 19:20:30 -0500 (Wed, 12 Sep 2007) | 2 lines
-
-New project template
-
-------------------------------------------------------------------------
-r149 | jamesgrenning | 2007-09-12 19:14:10 -0500 (Wed, 12 Sep 2007) | 1 line
-
-Move symbian stuff to one directory
-------------------------------------------------------------------------
-r148 | basvodde | 2007-08-30 07:38:22 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Symbian test files
-------------------------------------------------------------------------
-r147 | basvodde | 2007-08-30 07:37:32 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Patched the wrong patch
-------------------------------------------------------------------------
-r146 | basvodde | 2007-08-30 07:36:19 -0500 (Thu, 30 Aug 2007) | 2 lines
-
-Symbian build files
-
-------------------------------------------------------------------------
-r145 | basvodde | 2007-08-30 03:52:40 -0500 (Thu, 30 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r144 | basvodde | 2007-08-30 03:46:05 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Added some methods because of symbian port
-------------------------------------------------------------------------
-r143 | basvodde | 2007-08-30 03:42:19 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Slightly different interface
-------------------------------------------------------------------------
-r142 | basvodde | 2007-08-30 03:41:14 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Added methods due to symbian
-------------------------------------------------------------------------
-r141 | basvodde | 2007-08-30 03:40:38 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Removed inline methods due to symbian
-------------------------------------------------------------------------
-r140 | basvodde | 2007-08-30 03:28:18 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Symbian test files.
-------------------------------------------------------------------------
-r139 | basvodde | 2007-08-30 03:27:30 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Platform specific test execution
-------------------------------------------------------------------------
-r138 | basvodde | 2007-08-30 03:26:34 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Symbian platform specifics
-------------------------------------------------------------------------
-r137 | basvodde | 2007-08-30 03:25:16 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Fixed a small memory leak
-------------------------------------------------------------------------
-r136 | basvodde | 2007-08-30 03:24:39 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Symbian support
-------------------------------------------------------------------------
-r135 | basvodde | 2007-08-30 03:21:36 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Symbian build file
-------------------------------------------------------------------------
-r134 | basvodde | 2007-08-30 03:20:34 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Added platform specific indirection
-------------------------------------------------------------------------
-r133 | basvodde | 2007-08-30 03:17:07 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Fixed a funny bug
-------------------------------------------------------------------------
-r132 | basvodde | 2007-08-30 03:16:08 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Added platform specific UTest execution method
-------------------------------------------------------------------------
-r131 | basvodde | 2007-08-30 03:15:46 -0500 (Thu, 30 Aug 2007) | 1 line
-
-Test executions platform specific method
-------------------------------------------------------------------------
-r130 | basvodde | 2007-08-30 03:06:13 -0500 (Thu, 30 Aug 2007) | 1 line
-
-New method for platform specific execution
-------------------------------------------------------------------------
-r129 | basvodde | 2007-08-29 04:30:54 -0500 (Wed, 29 Aug 2007) | 1 line
-
-Moved static method to not be inline anymore
-------------------------------------------------------------------------
-r128 | basvodde | 2007-08-29 04:30:14 -0500 (Wed, 29 Aug 2007) | 1 line
-
-Moved static method to not be inline anymore
-------------------------------------------------------------------------
-r127 | basvodde | 2007-08-28 05:02:32 -0500 (Tue, 28 Aug 2007) | 1 line
-
-Minor changes
-------------------------------------------------------------------------
-r126 | jamesgrenning | 2007-08-22 19:27:21 -0500 (Wed, 22 Aug 2007) | 1 line
-
-added extern "C" to get rid of compiler warning
-------------------------------------------------------------------------
-r125 | jamesgrenning | 2007-08-22 19:26:09 -0500 (Wed, 22 Aug 2007) | 2 lines
-
-removed unused parameter names to get rid of compiler warnings
-
-------------------------------------------------------------------------
-r124 | jamesgrenning | 2007-08-22 19:24:35 -0500 (Wed, 22 Aug 2007) | 1 line
-
-replaced printf with a loop and putchar
-------------------------------------------------------------------------
-r123 | jamesgrenning | 2007-08-22 19:23:46 -0500 (Wed, 22 Aug 2007) | 2 lines
-
-reformat
-
-------------------------------------------------------------------------
-r122 | basvodde | 2007-08-10 02:30:51 -0500 (Fri, 10 Aug 2007) | 1 line
-
-Fixed a bug which happened when using -r2
-------------------------------------------------------------------------
-r121 | basvodde | 2007-08-10 02:27:18 -0500 (Fri, 10 Aug 2007) | 1 line
-
-Changed the Test output
-------------------------------------------------------------------------
-r120 | basvodde | 2007-08-10 02:26:47 -0500 (Fri, 10 Aug 2007) | 1 line
-
-Changed the test output
-------------------------------------------------------------------------
-r119 | jamesgrenning | 2007-08-10 01:04:22 -0500 (Fri, 10 Aug 2007) | 1 line
-
-improved make and instructions
-------------------------------------------------------------------------
-r118 | jamesgrenning | 2007-08-09 23:19:30 -0500 (Thu, 09 Aug 2007) | 1 line
-
-I redid the VC6 project files.
-------------------------------------------------------------------------
-r117 | jamesgrenning | 2007-08-09 23:18:13 -0500 (Thu, 09 Aug 2007) | 1 line
-
-VC6 project files added
-------------------------------------------------------------------------
-r116 | jamesgrenning | 2007-08-09 23:16:54 -0500 (Thu, 09 Aug 2007) | 1 line
-
-Got Win32MemoryLeakWarning working and added VC6 projects
-------------------------------------------------------------------------
-r115 | jamesgrenning | 2007-08-08 23:30:54 -0500 (Wed, 08 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r114 | jamesgrenning | 2007-08-08 23:29:56 -0500 (Wed, 08 Aug 2007) | 5 lines
-
-Removed the NewVCModule.sh file - it needs to be rethought, so i killed it
-Moved VirtualCall
-
-Updated template files and New* scripts
-
-------------------------------------------------------------------------
-r113 | jamesgrenning | 2007-08-08 23:27:51 -0500 (Wed, 08 Aug 2007) | 2 lines
-
-moved to an accessible place
-
-------------------------------------------------------------------------
-r112 | jamesgrenning | 2007-08-08 23:26:42 -0500 (Wed, 08 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r111 | jamesgrenning | 2007-08-08 20:23:31 -0500 (Wed, 08 Aug 2007) | 2 lines
-
-Added README for prior users
-
-------------------------------------------------------------------------
-r110 | jamesgrenning | 2007-08-07 23:43:46 -0500 (Tue, 07 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r109 | jamesgrenning | 2007-08-07 23:29:07 -0500 (Tue, 07 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r108 | jamesgrenning | 2007-08-07 23:28:13 -0500 (Tue, 07 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r107 | jamesgrenning | 2007-08-07 23:26:52 -0500 (Tue, 07 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r106 | jamesgrenning | 2007-08-07 23:26:30 -0500 (Tue, 07 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r105 | jamesgrenning | 2007-08-07 23:22:10 -0500 (Tue, 07 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r104 | jamesgrenning | 2007-08-07 23:19:11 -0500 (Tue, 07 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r103 | jamesgrenning | 2007-08-07 23:18:34 -0500 (Tue, 07 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r102 | jamesgrenning | 2007-08-07 23:03:37 -0500 (Tue, 07 Aug 2007) | 2 lines
-
-updated/added README files
-
-------------------------------------------------------------------------
-r101 | jamesgrenning | 2007-08-07 23:02:16 -0500 (Tue, 07 Aug 2007) | 1 line
-
-fixed make depend
-------------------------------------------------------------------------
-r100 | jamesgrenning | 2007-08-07 22:41:14 -0500 (Tue, 07 Aug 2007) | 2 lines
-
-removed exercise comments
-
-------------------------------------------------------------------------
-r99 | jamesgrenning | 2007-08-07 21:58:47 -0500 (Tue, 07 Aug 2007) | 2 lines
-
-Added instrutions for the NewClass... scripts
-
-------------------------------------------------------------------------
-r98 | jamesgrenning | 2007-08-07 21:34:56 -0500 (Tue, 07 Aug 2007) | 1 line
-
-Updated test template files to use the TEST_GROUP macro instead of namespace
-------------------------------------------------------------------------
-r97 | jamesgrenning | 2007-08-07 21:16:58 -0500 (Tue, 07 Aug 2007) | 3 lines
-
-Added vc6 workspace and project files
-added svn:ignore
-
-------------------------------------------------------------------------
-r96 | jamesgrenning | 2007-08-07 21:12:43 -0500 (Tue, 07 Aug 2007) | 1 line
-
-added svn:ignore
-------------------------------------------------------------------------
-r95 | jamesgrenning | 2007-08-07 21:12:17 -0500 (Tue, 07 Aug 2007) | 1 line
-
-added svn:ignore
-------------------------------------------------------------------------
-r94 | jamesgrenning | 2007-08-07 21:11:47 -0500 (Tue, 07 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r93 | jamesgrenning | 2007-08-07 21:11:10 -0500 (Tue, 07 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r92 | jamesgrenning | 2007-08-07 21:10:49 -0500 (Tue, 07 Aug 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r91 | jamesgrenning | 2007-08-07 21:08:58 -0500 (Tue, 07 Aug 2007) | 2 lines
-
-Added vc6 project
-
-------------------------------------------------------------------------
-r90 | jamesgrenning | 2007-08-07 21:08:28 -0500 (Tue, 07 Aug 2007) | 2 lines
-
-Added vc60 project
-
-------------------------------------------------------------------------
-r89 | jamesgrenning | 2007-08-07 20:44:44 -0500 (Tue, 07 Aug 2007) | 2 lines
-
-Compiles under vc6
-
-------------------------------------------------------------------------
-r88 | jamesgrenning | 2007-08-07 20:44:04 -0500 (Tue, 07 Aug 2007) | 2 lines
-
-Deleted src/Platforms/VisualCpp/Platform.h
-
-------------------------------------------------------------------------
-r87 | jamesgrenning | 2007-08-07 20:42:39 -0500 (Tue, 07 Aug 2007) | 1 line
-
-made compatible with bas changes
-------------------------------------------------------------------------
-r86 | jamesgrenning | 2007-08-07 20:40:43 -0500 (Tue, 07 Aug 2007) | 3 lines
-
-- Removed duplicate scope resoultion operator from
-void TestRegistry::TestRegistry::setCurrentRegistry(TestRegistry* registry)
-Odd this compiles under gcc in the first place
-------------------------------------------------------------------------
-r85 | jamesgrenning | 2007-08-07 20:37:23 -0500 (Tue, 07 Aug 2007) | 2 lines
-
-- Added #include "Platform.h" so snprintf can compile under vc6
-
-------------------------------------------------------------------------
-r84 | jamesgrenning | 2007-08-07 20:35:05 -0500 (Tue, 07 Aug 2007) | 3 lines
-
-added #define snprintf _snprintf
-so that snprintf can compile under VC6
-
-------------------------------------------------------------------------
-r83 | jamesgrenning | 2007-08-07 20:31:58 -0500 (Tue, 07 Aug 2007) | 2 lines
-
-made include guard match classname
-
-------------------------------------------------------------------------
-r82 | jamesgrenning | 2007-08-07 19:18:34 -0500 (Tue, 07 Aug 2007) | 1 line
-
-Fixed a warning in the if statement in count()
-------------------------------------------------------------------------
-r81 | basvodde | 2007-07-29 21:34:22 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Changed the dependency on TestOutput
-------------------------------------------------------------------------
-r80 | basvodde | 2007-07-29 21:34:07 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added tests for output formatting
-------------------------------------------------------------------------
-r79 | basvodde | 2007-07-29 21:33:53 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added tests for new String functions. Need more tests though.
-------------------------------------------------------------------------
-r78 | basvodde | 2007-07-29 21:33:35 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added tests to makefile
-------------------------------------------------------------------------
-r77 | basvodde | 2007-07-29 21:33:25 -0500 (Sun, 29 Jul 2007) | 1 line
-
-JUnitOutput tests
-------------------------------------------------------------------------
-r76 | basvodde | 2007-07-29 21:32:59 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Removed output from registry
-------------------------------------------------------------------------
-r75 | basvodde | 2007-07-29 21:32:38 -0500 (Sun, 29 Jul 2007) | 1 line
-
-CommandRunner test
-------------------------------------------------------------------------
-r74 | basvodde | 2007-07-29 21:32:16 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added new tests
-------------------------------------------------------------------------
-r73 | basvodde | 2007-07-29 21:31:50 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Moved formatting away
-------------------------------------------------------------------------
-r72 | basvodde | 2007-07-29 21:31:40 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added JUnitTestOutput
-------------------------------------------------------------------------
-r71 | basvodde | 2007-07-29 21:31:26 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Moved formatting away
-------------------------------------------------------------------------
-r70 | basvodde | 2007-07-29 21:31:14 -0500 (Sun, 29 Jul 2007) | 1 line
-
-JUnitTestOutput for integration with CruiseControl
-------------------------------------------------------------------------
-r69 | basvodde | 2007-07-29 21:30:58 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Moved all formatting here.
-------------------------------------------------------------------------
-r68 | basvodde | 2007-07-29 21:30:38 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Moved formatting to TestOutput
-------------------------------------------------------------------------
-r67 | basvodde | 2007-07-29 21:30:05 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Fixed a small bug
-------------------------------------------------------------------------
-r66 | basvodde | 2007-07-29 21:29:37 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added a whole bunch of small methods
-------------------------------------------------------------------------
-r65 | basvodde | 2007-07-29 21:29:25 -0500 (Sun, 29 Jul 2007) | 1 line
-
-JUnitTestOutput for integration with CruiseControl
-------------------------------------------------------------------------
-r64 | basvodde | 2007-07-29 21:28:30 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Moved formatting away
-------------------------------------------------------------------------
-r63 | basvodde | 2007-07-29 21:28:21 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Moved formatting away
-------------------------------------------------------------------------
-r62 | basvodde | 2007-07-29 21:28:10 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Removed dependency to TestOutput for now.
-------------------------------------------------------------------------
-r61 | basvodde | 2007-07-29 21:27:58 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Moved all the formatting to here, for now.
-------------------------------------------------------------------------
-r60 | basvodde | 2007-07-29 21:27:35 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added a bunch of useful methods
-------------------------------------------------------------------------
-r59 | basvodde | 2007-07-29 21:27:13 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added a flush method
-------------------------------------------------------------------------
-r58 | basvodde | 2007-07-29 21:26:56 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added copy constructor and getters
-------------------------------------------------------------------------
-r57 | basvodde | 2007-07-29 21:25:33 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added stuff about leaks to be expected. Not nice, but needed.
-------------------------------------------------------------------------
-r56 | basvodde | 2007-07-29 21:25:28 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added stuff about leaks to be expected. Not nice, but needed.
-------------------------------------------------------------------------
-r55 | basvodde | 2007-07-29 21:25:23 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added stuff about leaks to be expected. Not nice, but needed.
-------------------------------------------------------------------------
-r54 | basvodde | 2007-07-29 21:25:16 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Added stuff about leaks to be expected. Not nice, but needed.
-------------------------------------------------------------------------
-r53 | basvodde | 2007-07-29 21:24:43 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Non-static class and refactored and added junit output support
-------------------------------------------------------------------------
-r52 | basvodde | 2007-07-29 21:24:37 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Non-static class and refactored and added junit output support
-------------------------------------------------------------------------
-r51 | basvodde | 2007-07-29 21:24:03 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Removed PrintSpecifics
-------------------------------------------------------------------------
-r50 | basvodde | 2007-07-29 21:24:00 -0500 (Sun, 29 Jul 2007) | 1 line
-
-Removed PrintSpecifics
-------------------------------------------------------------------------
-r49 | basvodde | 2007-07-26 01:53:52 -0500 (Thu, 26 Jul 2007) | 1 line
-
-Test for string with 0 pointer.
-------------------------------------------------------------------------
-r48 | basvodde | 2007-07-26 01:53:38 -0500 (Thu, 26 Jul 2007) | 1 line
-
-Added tests for bugs
-------------------------------------------------------------------------
-r47 | basvodde | 2007-07-26 01:53:07 -0500 (Thu, 26 Jul 2007) | 1 line
-
-Added getters for groupFilter and nameFilter
-------------------------------------------------------------------------
-r46 | basvodde | 2007-07-26 01:52:32 -0500 (Thu, 26 Jul 2007) | 1 line
-
-Changed size_t to unsigned int
-------------------------------------------------------------------------
-r45 | basvodde | 2007-07-26 01:51:54 -0500 (Thu, 26 Jul 2007) | 1 line
-
-Fixed a small bug for when passing a 0 pointer to SimpleString
-------------------------------------------------------------------------
-r44 | basvodde | 2007-07-26 01:51:30 -0500 (Thu, 26 Jul 2007) | 1 line
-
-Removed IgnoredTest
-------------------------------------------------------------------------
-r43 | basvodde | 2007-07-26 01:50:41 -0500 (Thu, 26 Jul 2007) | 1 line
-
-Removed IgnoredTest and changed the IGNORE_TEST macro. This enables fixture access from ignored test cases.
-------------------------------------------------------------------------
-r42 | basvodde | 2007-07-26 01:49:49 -0500 (Thu, 26 Jul 2007) | 1 line
-
-Added some getters and "fixed" the layout
-------------------------------------------------------------------------
-r41 | basvodde | 2007-07-26 01:49:05 -0500 (Thu, 26 Jul 2007) | 1 line
-
-Changed size_t to unsigned int. Led to problems with pure C prepocessor
-------------------------------------------------------------------------
-r40 | basvodde | 2007-07-26 01:48:14 -0500 (Thu, 26 Jul 2007) | 1 line
-
-Removed default constructor and used constructor with default value
-------------------------------------------------------------------------
-r39 | basvodde | 2007-07-25 22:15:16 -0500 (Wed, 25 Jul 2007) | 1 line
-
-Fixed the C style comments
-------------------------------------------------------------------------
-r38 | basvodde | 2007-07-25 22:04:07 -0500 (Wed, 25 Jul 2007) | 1 line
-
-Removed CPP commands
-------------------------------------------------------------------------
-r37 | basvodde | 2007-07-23 02:13:09 -0500 (Mon, 23 Jul 2007) | 1 line
-
-Fixed the fixture setup and teardown
-------------------------------------------------------------------------
-r36 | basvodde | 2007-07-23 02:12:34 -0500 (Mon, 23 Jul 2007) | 1 line
-
-Updated based on new setup
-------------------------------------------------------------------------
-r35 | basvodde | 2007-07-23 02:12:22 -0500 (Mon, 23 Jul 2007) | 1 line
-
-Added cleaning the examples to make clean
-------------------------------------------------------------------------
-r34 | basvodde | 2007-07-23 01:49:13 -0500 (Mon, 23 Jul 2007) | 1 line
-
-Use the new setup and teardown methods!
-------------------------------------------------------------------------
-r33 | basvodde | 2007-07-17 04:38:07 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Added FileName
-------------------------------------------------------------------------
-r32 | basvodde | 2007-07-17 04:37:51 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Added checks for FileName
-------------------------------------------------------------------------
-r31 | basvodde | 2007-07-17 04:37:39 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Added the char
-------------------------------------------------------------------------
-r30 | basvodde | 2007-07-17 04:37:17 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Added the fileName
-------------------------------------------------------------------------
-r29 | basvodde | 2007-07-17 04:36:50 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Use LOCATION macros
-------------------------------------------------------------------------
-r28 | basvodde | 2007-07-17 04:36:27 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Added FromString with char
-------------------------------------------------------------------------
-r27 | basvodde | 2007-07-17 04:36:03 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Added FileName parameter
-------------------------------------------------------------------------
-r26 | basvodde | 2007-07-17 04:35:36 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Changed to use LOCATION so the C location is real.
-------------------------------------------------------------------------
-r25 | basvodde | 2007-07-17 04:35:17 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Changed all the test macros to be able to specify the location!
-------------------------------------------------------------------------
-r24 | basvodde | 2007-07-17 04:34:56 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Added FromString with char
-------------------------------------------------------------------------
-r23 | basvodde | 2007-07-17 04:34:40 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Added fileName parameter to get the real filename
-------------------------------------------------------------------------
-r22 | basvodde | 2007-07-17 00:45:52 -0500 (Tue, 17 Jul 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r21 | basvodde | 2007-07-17 00:45:02 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Fixed the CHECK_REAL
-------------------------------------------------------------------------
-r20 | basvodde | 2007-07-17 00:44:31 -0500 (Tue, 17 Jul 2007) | 1 line
-
-Fixed the CHECK_REAL
-------------------------------------------------------------------------
-r19 | basvodde | 2007-07-15 21:30:02 -0500 (Sun, 15 Jul 2007) | 4 lines
-
-
-Added TestPlugin description to the README_CppUTest.txt.
-
-Wrote a new ReadMe for working with CppUTest in C.
-------------------------------------------------------------------------
-r18 | basvodde | 2007-07-10 00:32:28 -0500 (Tue, 10 Jul 2007) | 1 line
-
-A simple HelloWorld example
-------------------------------------------------------------------------
-r17 | basvodde | 2007-07-03 03:08:29 -0500 (Tue, 03 Jul 2007) | 1 line
-
-Refactored tests completely to use own registry.
-------------------------------------------------------------------------
-r16 | basvodde | 2007-07-03 03:06:37 -0500 (Tue, 03 Jul 2007) | 1 line
-
-This file is probably broken.
-------------------------------------------------------------------------
-r15 | basvodde | 2007-07-03 03:06:12 -0500 (Tue, 03 Jul 2007) | 1 line
-
-Changed to not use the static member functions anymore
-------------------------------------------------------------------------
-r14 | basvodde | 2007-07-03 03:05:25 -0500 (Tue, 03 Jul 2007) | 1 line
-
-Added C malloc methods that use the memory leak detector
-------------------------------------------------------------------------
-r13 | basvodde | 2007-07-03 03:04:58 -0500 (Tue, 03 Jul 2007) | 1 line
-
-Not using static member functions anymore
-------------------------------------------------------------------------
-r12 | basvodde | 2007-07-03 03:04:19 -0500 (Tue, 03 Jul 2007) | 1 line
-
-Removed all the static member functions
-------------------------------------------------------------------------
-r11 | basvodde | 2007-07-03 00:55:44 -0500 (Tue, 03 Jul 2007) | 1 line
-
-Header for C include files
-------------------------------------------------------------------------
-r10 | basvodde | 2007-06-24 03:43:42 -0500 (Sun, 24 Jun 2007) | 1 line
-
-Build files and readme
-------------------------------------------------------------------------
-r9 | basvodde | 2007-06-24 03:33:05 -0500 (Sun, 24 Jun 2007) | 1 line
-
-New scripts
-------------------------------------------------------------------------
-r8 | basvodde | 2007-06-24 03:15:04 -0500 (Sun, 24 Jun 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r7 | basvodde | 2007-06-24 03:12:04 -0500 (Sun, 24 Jun 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r6 | basvodde | 2007-06-24 03:09:34 -0500 (Sun, 24 Jun 2007) | 1 line
-
-Examples for TDD
-------------------------------------------------------------------------
-r5 | basvodde | 2007-06-24 02:37:59 -0500 (Sun, 24 Jun 2007) | 1 line
-
-Added extra .exe removal for Windows systems
-------------------------------------------------------------------------
-r4 | basvodde | 2007-06-24 02:33:02 -0500 (Sun, 24 Jun 2007) | 1 line
-
-Added the build files
-------------------------------------------------------------------------
-r3 | basvodde | 2007-06-24 00:58:58 -0500 (Sun, 24 Jun 2007) | 1 line
-
-Added source files
-------------------------------------------------------------------------
-r2 | basvodde | 2007-06-24 00:49:01 -0500 (Sun, 24 Jun 2007) | 1 line
-
-
-------------------------------------------------------------------------
-r1 | basvodde | 2007-06-24 00:37:56 -0500 (Sun, 24 Jun 2007) | 1 line
-
-Added trunk
-------------------------------------------------------------------------
diff --git a/cpputest_build/.gitignore b/cpputest_build/.gitignore
deleted file mode 100644
index d6b7ef32c..000000000
--- a/cpputest_build/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
diff --git a/docker/Dockerfile.dos b/docker/Dockerfile.dos
new file mode 100644
index 000000000..cff3d4f72
--- /dev/null
+++ b/docker/Dockerfile.dos
@@ -0,0 +1,7 @@
+FROM ubuntu
+
+RUN apt-get -qq update && apt-get -qq install -y --no-install-recommends dosbox make openssl ca-certificates git
+
+WORKDIR /cpputest_build
+
+CMD BUILD=make_dos /cpputest/scripts/travis_ci_build.sh
diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu
new file mode 100644
index 000000000..7a660ed28
--- /dev/null
+++ b/docker/Dockerfile.ubuntu
@@ -0,0 +1,8 @@
+FROM ubuntu
+
+RUN apt-get update && \
+ apt-get install -y -q --no-install-recommends file git gcc g++ make automake autoconf libtool
+
+WORKDIR /cpputest_build
+
+CMD autoreconf -i ../cpputest && ../cpputest/configure && make tdd
diff --git a/docs/WalkThrough_VS21010.docx b/docs/WalkThrough_VS21010.docx
deleted file mode 100644
index 1927edb26..000000000
Binary files a/docs/WalkThrough_VS21010.docx and /dev/null differ
diff --git a/examples/AllTests/AllTests.cpp b/examples/AllTests/AllTests.cpp
index 06a9e0324..7d17d6f3d 100644
--- a/examples/AllTests/AllTests.cpp
+++ b/examples/AllTests/AllTests.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -28,17 +28,18 @@
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTest/TestPlugin.h"
#include "CppUTest/TestRegistry.h"
+#include "CppUTestExt/IEEE754ExceptionsPlugin.h"
#include "CppUTestExt/MockSupportPlugin.h"
class MyDummyComparator : public MockNamedValueComparator
{
public:
- virtual bool isEqual(const void* object1, const void* object2)
+ virtual bool isEqual(const void* object1, const void* object2) CPPUTEST_OVERRIDE
{
return object1 == object2;
}
- virtual SimpleString valueToString(const void* object)
+ virtual SimpleString valueToString(const void* object) CPPUTEST_OVERRIDE
{
return StringFrom(object);
}
@@ -48,9 +49,11 @@ int main(int ac, char** av)
{
MyDummyComparator dummyComparator;
MockSupportPlugin mockPlugin;
+ IEEE754ExceptionsPlugin ieee754Plugin;
mockPlugin.installComparator("MyDummyType", dummyComparator);
TestRegistry::getCurrentRegistry()->installPlugin(&mockPlugin);
+ TestRegistry::getCurrentRegistry()->installPlugin(&ieee754Plugin);
return CommandLineTestRunner::RunAllTests(ac, av);
}
diff --git a/include/Platforms/c2000/Platform.h b/examples/AllTests/AllTests.h
similarity index 86%
rename from include/Platforms/c2000/Platform.h
rename to examples/AllTests/AllTests.h
index 6e65ae1a0..9902c6f17 100644
--- a/include/Platforms/c2000/Platform.h
+++ b/examples/AllTests/AllTests.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -25,7 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef D_c2000_Platform_H
-#define D_c2000_Platform_H
-
-#endif
+IMPORT_TEST_GROUP(Printer);
+IMPORT_TEST_GROUP(CircularBuffer);
+IMPORT_TEST_GROUP(HelloWorld);
+IMPORT_TEST_GROUP(EventDispatcher);
+IMPORT_TEST_GROUP(MockDocumentation);
diff --git a/examples/AllTests/AllTests.vcproj b/examples/AllTests/AllTests.vcproj
new file mode 100644
index 000000000..ad9ab2b72
--- /dev/null
+++ b/examples/AllTests/AllTests.vcproj
@@ -0,0 +1,252 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/AllTests/AllTests.vcxproj b/examples/AllTests/AllTests.vcxproj
new file mode 100644
index 000000000..dc4b9b814
--- /dev/null
+++ b/examples/AllTests/AllTests.vcxproj
@@ -0,0 +1,168 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ {95A5F8D0-12C0-4AC1-B46B-292DD3886108}
+
+
+
+ Application
+ false
+ MultiByte
+
+
+ Application
+ false
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.30319.1
+ ./$(Configuration)/\
+ ./$(Configuration)/\
+ true
+ .\Debug\
+ .\Debug\
+ true
+
+
+
+ $(IntDir)BuildLog.htm
+
+
+ .\Debug/AllTests.tlb
+
+
+
+
+ MaxSpeed
+ ../../include;../ApplicationLib;%(AdditionalIncludeDirectories)
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ Default
+ MultiThreadedDLL
+ ./$(Configuration)/AllTests.pch
+ ./$(Configuration)/
+ ./$(Configuration)/
+ ./$(Configuration)/
+ ./$(Configuration)/
+ Level3
+ true
+
+
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ 0x0409
+
+
+ /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD %(AdditionalOptions)
+ ../../lib/CppUTest.lib;../ApplicationLib/$(Configuration)/ApplicationLib.lib;odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies)
+ ./$(Configuration)/AllTests.exe
+ true
+ ./$(Configuration)/$(TargetFileName).intermediate.manifest
+ false
+ false
+
+
+ Console
+ false
+
+
+ MachineX86
+
+
+ true
+ .\$(Configuration)/AllTests.bsc
+
+
+ "$(TargetPath)"
+
+
+
+
+ .\Debug/AllTests.tlb
+
+
+
+
+ Disabled
+ ../../include;../ApplicationLib;%(AdditionalIncludeDirectories)
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ EnableFastChecks
+ MultiThreadedDebugDLL
+ ./$(Configuration)/AllTests.pch
+ ./$(Configuration)/
+ ./$(Configuration)/
+ ./$(Configuration)/
+ $(Configuration)/
+ Level3
+ true
+ EditAndContinue
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ 0x0409
+
+
+ ../../lib/CppUTestd.lib;../ApplicationLib/$(Configuration)/ApplicationLib.lib;odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies)
+ ./$(Configuration)/AllTests.exe
+ true
+ ./$(Configuration)/$(TargetFileName).intermediate.manifest
+ true
+ ./$(Configuration)/AllTests.pdb
+ Console
+ false
+
+
+ MachineX86
+
+
+ true
+ .\Debug/AllTests.bsc
+
+
+ "$(TargetPath)"
+
+
+
+
+
+
+
+
+
+
+
+
+ {348076b9-303c-4fe0-9380-17cdf11134a9}
+ false
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/AllTests/CMakeLists.txt b/examples/AllTests/CMakeLists.txt
new file mode 100644
index 000000000..403718bb4
--- /dev/null
+++ b/examples/AllTests/CMakeLists.txt
@@ -0,0 +1,27 @@
+add_executable(ExampleTests
+ AllTests.cpp
+ CircularBufferTest.cpp
+ EventDispatcherTest.cpp
+ FEDemoTest.cpp
+ HelloTest.cpp
+ MockDocumentationTest.cpp
+ PrinterTest.cpp
+)
+
+target_include_directories(ExampleTests
+ PRIVATE
+ .
+)
+
+target_compile_options(ExampleTests
+ PRIVATE $<$:/wd4723>
+)
+
+target_link_libraries(ExampleTests
+ PRIVATE
+ ApplicationLib
+ CppUTest::CppUTestExt
+)
+
+include(CppUTest)
+cpputest_discover_tests(ExampleTests)
diff --git a/examples/AllTests/CircularBufferTest.cpp b/examples/AllTests/CircularBufferTest.cpp
index 7554385ce..4602e5ab9 100644
--- a/examples/AllTests/CircularBufferTest.cpp
+++ b/examples/AllTests/CircularBufferTest.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -30,27 +30,28 @@
#include "CircularBuffer.h"
TEST_GROUP(CircularBuffer)
-{ CircularBuffer* buffer;
-
-void setup()
-{
- buffer = new CircularBuffer();
-}
-void teardown()
-{
- delete buffer;
-}
-
-void fillTheQueue(int seed, int howMany)
{
- for (int i = 0; i < howMany; i++)
- buffer->Put(seed + i);
-}
-void removeFromQueue(int howMany)
-{
- for (int i = 0; i < howMany; i++)
- buffer->Get();
-}
+ CircularBuffer* buffer;
+
+ void setup() CPPUTEST_OVERRIDE
+ {
+ buffer = new CircularBuffer();
+ }
+ void teardown() CPPUTEST_OVERRIDE
+ {
+ delete buffer;
+ }
+
+ void fillTheQueue(int seed, int howMany)
+ {
+ for (int i = 0; i < howMany; i++)
+ buffer->Put(seed + i);
+ }
+ void removeFromQueue(int howMany)
+ {
+ for (int i = 0; i < howMany; i++)
+ buffer->Get();
+ }
};
TEST(CircularBuffer, EmptyAfterCreation)
@@ -134,15 +135,14 @@ TEST(CircularBuffer, PutToFull)
buffer->Put(9999);
for (int i = 0; i < buffer->Capacity() - 1; i++)
- LONGS_EQUAL(i+900+1, buffer->Get());
+ LONGS_EQUAL(i + 900 + 1, buffer->Get());
LONGS_EQUAL(9999, buffer->Get());
CHECK(buffer->IsEmpty());
}
-//Sometime people ask what tests the tests.
-//Do you know the answer
-
+// Sometime people ask what tests the tests.
+// Do you know the answer
TEST(CircularBuffer, GetFromEmpty)
{
@@ -162,8 +162,7 @@ TEST(CircularBuffer, PrintEmpty)
Printer* p = &mock;
buffer->Print(p);
- STRCMP_EQUAL("Circular buffer content:\n<>\n",
- mock.getOutput().c_str());
+ STRCMP_EQUAL("Circular buffer content:\n<>\n", mock.getOutput().c_str());
}
TEST(CircularBuffer, PrintAfterOnePut)
@@ -172,8 +171,7 @@ TEST(CircularBuffer, PrintAfterOnePut)
buffer->Put(1);
buffer->Print(&mock);
- STRCMP_EQUAL("Circular buffer content:\n<1>\n",
- mock.getOutput().c_str());
+ STRCMP_EQUAL("Circular buffer content:\n<1>\n", mock.getOutput().c_str());
}
TEST(CircularBuffer, PrintNotYetWrappedOrFull)
@@ -184,8 +182,7 @@ TEST(CircularBuffer, PrintNotYetWrappedOrFull)
buffer->Put(2);
buffer->Put(3);
buffer->Print(&mock);
- STRCMP_EQUAL("Circular buffer content:\n<1, 2, 3>\n",
- mock.getOutput().c_str());
+ STRCMP_EQUAL("Circular buffer content:\n<1, 2, 3>\n", mock.getOutput().c_str());
}
TEST(CircularBuffer, PrintNotYetWrappedAndIsFull)
@@ -195,7 +192,8 @@ TEST(CircularBuffer, PrintNotYetWrappedAndIsFull)
fillTheQueue(200, buffer->Capacity());
buffer->Print(&mock);
- const char* expected = "Circular buffer content:\n"
+ const char* expected =
+ "Circular buffer content:\n"
"<200, 201, 202, 203, 204>\n";
STRCMP_EQUAL(expected, mock.getOutput().c_str());
@@ -210,7 +208,8 @@ TEST(CircularBuffer, PrintWrappedAndIsFullOldestToNewest)
buffer->Put(999);
buffer->Print(&mock);
- const char* expected = "Circular buffer content:\n"
+ const char* expected =
+ "Circular buffer content:\n"
"<201, 202, 203, 204, 999>\n";
STRCMP_EQUAL(expected, mock.getOutput().c_str());
@@ -224,7 +223,8 @@ TEST(CircularBuffer, PrintWrappedAndFullOverwriteOldest)
buffer->Put(9999);
buffer->Print(&mock);
- const char* expected = "Circular buffer content:\n"
+ const char* expected =
+ "Circular buffer content:\n"
"<201, 202, 203, 204, 9999>\n";
STRCMP_EQUAL(expected, mock.getOutput().c_str());
@@ -240,7 +240,8 @@ TEST(CircularBuffer, PrintBoundary)
fillTheQueue(300, buffer->Capacity() - 1);
buffer->Print(&mock);
- const char* expected = "Circular buffer content:\n"
+ const char* expected =
+ "Circular buffer content:\n"
"<888, 300, 301, 302, 303>\n";
STRCMP_EQUAL(expected, mock.getOutput().c_str());
@@ -253,7 +254,8 @@ TEST(CircularBuffer, FillEmptyThenPrint)
fillTheQueue(200, buffer->Capacity());
removeFromQueue(buffer->Capacity());
buffer->Print(&mock);
- const char* expected = "Circular buffer content:\n"
+ const char* expected =
+ "Circular buffer content:\n"
"<>\n";
STRCMP_EQUAL(expected, mock.getOutput().c_str());
diff --git a/examples/AllTests/EventDispatcherTest.cpp b/examples/AllTests/EventDispatcherTest.cpp
index 82390bc30..7ea4b52a4 100644
--- a/examples/AllTests/EventDispatcherTest.cpp
+++ b/examples/AllTests/EventDispatcherTest.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -25,18 +25,32 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#if CPPUTEST_USE_NEW_MACROS
+ #undef realloc
+ #undef new
+#endif
+
+#include "EventDispatcher.h"
+
+#if CPPUTEST_USE_NEW_MACROS
+ #include "CppUTest/MemoryLeakDetectorNewMacros.h"
+#endif
+
#include "CppUTest/TestHarness.h"
#include "CppUTestExt/MockSupport.h"
-#include "EventDispatcher.h"
class ObserverMock : public EventObserver
{
public:
- virtual void notify(const Event& event, int timeOutInSeconds)
+ virtual void notify(const Event& event, int timeOutInSeconds) CPPUTEST_OVERRIDE
{
- mock().actualCall("notify").onObject(this).withParameterOfType("Event", "event", (void*) &event).withParameter("timeOutInSeconds", timeOutInSeconds);
+ mock()
+ .actualCall("notify")
+ .onObject(this)
+ .withParameterOfType("Event", "event", (void*)&event)
+ .withParameter("timeOutInSeconds", timeOutInSeconds);
}
- virtual void notifyRegistration(EventObserver* newObserver)
+ virtual void notifyRegistration(EventObserver* newObserver) CPPUTEST_OVERRIDE
{
mock().actualCall("notifyRegistration").onObject(this).withParameter("newObserver", newObserver);
}
@@ -45,17 +59,16 @@ class ObserverMock : public EventObserver
class EventComparator : public MockNamedValueComparator
{
public:
- virtual bool isEqual(const void* object1, const void* object2)
+ virtual bool isEqual(const void* object1, const void* object2) CPPUTEST_OVERRIDE
{
- return ((Event*)object1)->type == ((Event*)object2)->type;
+ return ((const Event*)object1)->type == ((const Event*)object2)->type;
}
- virtual SimpleString valueToString(const void* object)
+ virtual SimpleString valueToString(const void* object) CPPUTEST_OVERRIDE
{
- return StringFrom(((Event*)object)->type);
+ return StringFrom(((const Event*)object)->type);
}
};
-
TEST_GROUP(EventDispatcher)
{
Event event;
@@ -64,19 +77,18 @@ TEST_GROUP(EventDispatcher)
ObserverMock observer2;
EventComparator eventComparator;
- void setup()
+ void setup() CPPUTEST_OVERRIDE
{
dispatcher = new EventDispatcher;
mock().installComparator("Event", eventComparator);
}
- void teardown()
+ void teardown() CPPUTEST_OVERRIDE
{
delete dispatcher;
- mock().removeAllComparators();
+ mock().removeAllComparatorsAndCopiers();
}
};
-
TEST(EventDispatcher, EventWithoutRegistrationsResultsIntoNoCalls)
{
dispatcher->dispatchEvent(event, 10);
@@ -84,7 +96,11 @@ TEST(EventDispatcher, EventWithoutRegistrationsResultsIntoNoCalls)
TEST(EventDispatcher, EventWithRegistrationForEventResultsIntoCallback)
{
- mock().expectOneCall("notify").onObject(&observer).withParameterOfType("Event", "event", &event).withParameter("timeOutInSeconds", 10);
+ mock()
+ .expectOneCall("notify")
+ .onObject(&observer)
+ .withParameterOfType("Event", "event", &event)
+ .withParameter("timeOutInSeconds", 10);
event.type = IMPORTANT_EVENT;
dispatcher->registerObserver(IMPORTANT_EVENT, &observer);
@@ -100,8 +116,16 @@ TEST(EventDispatcher, DifferentEventWithRegistrationDoesNotResultIntoCallback)
TEST(EventDispatcher, RegisterTwoObserversResultIntoTwoCallsAndARegistrationNotification)
{
- mock().expectOneCall("notify").onObject(&observer).withParameterOfType("Event", "event", &event).withParameter("timeOutInSeconds", 10);
- mock().expectOneCall("notify").onObject(&observer2).withParameterOfType("Event", "event", &event).withParameter("timeOutInSeconds", 10);
+ mock()
+ .expectOneCall("notify")
+ .onObject(&observer)
+ .withParameterOfType("Event", "event", &event)
+ .withParameter("timeOutInSeconds", 10);
+ mock()
+ .expectOneCall("notify")
+ .onObject(&observer2)
+ .withParameterOfType("Event", "event", &event)
+ .withParameter("timeOutInSeconds", 10);
mock().expectOneCall("notifyRegistration").onObject(&observer).withParameter("newObserver", &observer2);
event.type = IMPORTANT_EVENT;
diff --git a/examples/AllTests/FEDemoTest.cpp b/examples/AllTests/FEDemoTest.cpp
new file mode 100644
index 000000000..c2f6c17f2
--- /dev/null
+++ b/examples/AllTests/FEDemoTest.cpp
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2016, Michael Feathers, James Grenning, Bas Vodde
+ * and Arnd Strube. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of the nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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.
+ */
+
+#include "CppUTest/CommandLineTestRunner.h"
+#include "CppUTest/TestHarness.h"
+#include "CppUTest/TestRegistry.h"
+
+#if CPPUTEST_HAVE_FENV
+ #include "CppUTestExt/IEEE754ExceptionsPlugin.h"
+
+/*
+ * To see a demonstration of tests failing as a result of IEEE754ExceptionsPlugin
+ * picking up floating point errors, run the test executable with the -ri option.
+ *
+ */
+
+extern "C" {
+ #include
+}
+
+ #include
+
+TEST_GROUP(FE_Demo)
+{
+ void setup() CPPUTEST_OVERRIDE
+ {
+ IEEE754ExceptionsPlugin::disableInexact();
+ }
+};
+
+IGNORE_TEST(FE_Demo, should_fail_when_FE_DIVBYZERO_is_set)
+{
+ float f = 1.0f;
+ CHECK((f /= 0.0f) >= std::numeric_limits::infinity());
+}
+
+IGNORE_TEST(FE_Demo, should_fail_when_FE_UNDERFLOW_is_set)
+{
+ volatile float f = 0.01f;
+ while (f > 0.0f)
+ f = f * f;
+ CHECK(f == 0.0f);
+}
+
+IGNORE_TEST(FE_Demo, should_fail_when_FE_OVERFLOW_is_set)
+{
+ volatile float f = 1000.0f;
+ while (f < std::numeric_limits::infinity())
+ f = f * f;
+ CHECK(f >= std::numeric_limits::infinity());
+}
+
+IGNORE_TEST(FE_Demo, should_fail_when_FE_INEXACT_is_set)
+{
+ IEEE754ExceptionsPlugin::enableInexact();
+ float f = 10.0f;
+ DOUBLES_EQUAL((double)(f / 3.0f), (double)3.333f, (double)0.001f);
+}
+
+TEST(FE_Demo, should_succeed_when_no_flags_are_set)
+{
+ CHECK(5.0f == 15.0f / 3.0f);
+}
+
+#endif
diff --git a/examples/AllTests/HelloTest.cpp b/examples/AllTests/HelloTest.cpp
index 84407906d..7bc644e0e 100644
--- a/examples/AllTests/HelloTest.cpp
+++ b/examples/AllTests/HelloTest.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -34,23 +34,24 @@
static SimpleString* buffer;
TEST_GROUP(HelloWorld)
-{ static int output_method(const char* output, ...)
{
- va_list arguments;
- va_start(arguments, output);
- *buffer = VStringFromFormat(output, arguments);
- va_end(arguments);
- return 1;
-}
-void setup()
-{
- buffer = new SimpleString();
- UT_PTR_SET(PrintFormated, &output_method);
-}
-void teardown()
-{
- delete buffer;
-}
+ static int output_method(const char* output, ...)
+ {
+ va_list arguments;
+ va_start(arguments, output);
+ *buffer = VStringFromFormat(output, arguments);
+ va_end(arguments);
+ return 1;
+ }
+ void setup() CPPUTEST_OVERRIDE
+ {
+ buffer = new SimpleString();
+ UT_PTR_SET(PrintFormated, &output_method);
+ }
+ void teardown() CPPUTEST_OVERRIDE
+ {
+ delete buffer;
+ }
};
TEST(HelloWorld, PrintOk)
diff --git a/examples/AllTests/MockDocumentationTest.cpp b/examples/AllTests/MockDocumentationTest.cpp
index c8f6f9c24..0bd578ea8 100644
--- a/examples/AllTests/MockDocumentationTest.cpp
+++ b/examples/AllTests/MockDocumentationTest.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -25,7 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#include "CppUTest/TestHarness.h"
#include "CppUTestExt/MockSupport.h"
#include "CppUTestExt/MockSupport_c.h"
@@ -36,15 +35,14 @@ TEST_GROUP(FirstTestGroup)
TEST(FirstTestGroup, FirsTest)
{
-// FAIL("Fail me!");
+ // FAIL("Fail me!");
}
TEST(FirstTestGroup, SecondTest)
{
-// STRCMP_EQUAL("hello", "world");
+ // STRCMP_EQUAL("hello", "world");
}
-
TEST_GROUP(MockDocumentation)
{
};
@@ -64,14 +62,14 @@ TEST(MockDocumentation, SimpleScenario)
class ClassFromProductionCode
{
public:
- virtual void importantFunction(){}
+ virtual void importantFunction() {}
virtual ~ClassFromProductionCode() {}
};
class ClassFromProductionCodeMock : public ClassFromProductionCode
{
public:
- virtual void importantFunction()
+ virtual void importantFunction() CPPUTEST_OVERRIDE
{
mock().actualCall("importantFunction").onObject(this);
}
@@ -90,13 +88,13 @@ TEST(MockDocumentation, SimpleScenarioObject)
static void parameters_function(int p1, const char* p2)
{
- void* object = (void*) 1;
+ void* object = (void*)1;
mock().actualCall("function").onObject(object).withParameter("p1", p1).withParameter("p2", p2);
}
TEST(MockDocumentation, parameters)
{
- void* object = (void*) 1;
+ void* object = (void*)1;
mock().expectOneCall("function").onObject(object).withParameter("p1", 2).withParameter("p2", "hah");
parameters_function(2, "hah");
}
@@ -104,11 +102,11 @@ TEST(MockDocumentation, parameters)
class MyTypeComparator : public MockNamedValueComparator
{
public:
- virtual bool isEqual(const void* object1, const void* object2)
+ virtual bool isEqual(const void* object1, const void* object2) CPPUTEST_OVERRIDE
{
return object1 == object2;
}
- virtual SimpleString valueToString(const void* object)
+ virtual SimpleString valueToString(const void* object) CPPUTEST_OVERRIDE
{
return StringFrom(object);
}
@@ -116,19 +114,19 @@ class MyTypeComparator : public MockNamedValueComparator
TEST(MockDocumentation, ObjectParameters)
{
- void* object = (void*) 1;
+ void* object = (void*)1;
MyTypeComparator comparator;
mock().installComparator("myType", comparator);
mock().expectOneCall("function").withParameterOfType("myType", "parameterName", object);
mock().clear();
- mock().removeAllComparators();
+ mock().removeAllComparatorsAndCopiers();
}
TEST(MockDocumentation, returnValue)
{
mock().expectOneCall("function").andReturnValue(10);
- int value = mock().actualCall("function").returnValue().getIntValue();
- value = mock().returnValue().getIntValue();
+ mock().actualCall("function").returnValue().getIntValue();
+ int value = mock().returnValue().getIntValue();
LONGS_EQUAL(10, value);
}
@@ -138,22 +136,20 @@ TEST(MockDocumentation, setData)
mock().setData("importantValue", 10);
mock().setDataObject("importantObject", "ClassFromProductionCode", &object);
- ClassFromProductionCode * pobject;
+ ClassFromProductionCode* pobject;
int value = mock().getData("importantValue").getIntValue();
- pobject = (ClassFromProductionCode*) mock().getData("importantObject").getObjectPointer();
+ pobject = (ClassFromProductionCode*)mock().getData("importantObject").getObjectPointer();
LONGS_EQUAL(10, value);
POINTERS_EQUAL(pobject, &object);
}
-static void doSomethingThatWouldOtherwiseBlowUpTheMockingFramework()
-{
-}
+static void doSomethingThatWouldOtherwiseBlowUpTheMockingFramework() {}
TEST(MockDocumentation, otherMockSupport)
{
mock().crashOnFailure();
-// mock().actualCall("unex");
+ // mock().actualCall("unex");
mock().expectOneCall("foo");
mock().ignoreOtherCalls();
@@ -163,7 +159,6 @@ TEST(MockDocumentation, otherMockSupport)
mock().enable();
mock().clear();
-
}
TEST(MockDocumentation, scope)
@@ -174,29 +169,28 @@ TEST(MockDocumentation, scope)
mock("xmlparser").actualCall("open");
}
-static int equalMethod(const void* object1, const void* object2)
+static int equalMethod(const void* object1, const void* object2)
{
return object1 == object2;
}
-static char* toStringMethod(const void*)
+static const char* toStringMethod(const void*)
{
- return (char*) "string";
+ return "string";
}
TEST(MockDocumentation, CInterface)
{
- void* object = (void*) 0x1;
+ void* object = (void*)0x1;
mock_c()->expectOneCall("foo")->withIntParameters("integer", 10)->andReturnDoubleValue(1.11);
double d = mock_c()->actualCall("foo")->withIntParameters("integer", 10)->returnValue().value.doubleValue;
DOUBLES_EQUAL(1.11, d, 0.00001);
-
mock_c()->installComparator("type", equalMethod, toStringMethod);
mock_scope_c("scope")->expectOneCall("bar")->withParameterOfType("type", "name", object);
mock_scope_c("scope")->actualCall("bar")->withParameterOfType("type", "name", object);
- mock_c()->removeAllComparators();
+ mock_c()->removeAllComparatorsAndCopiers();
mock_c()->setIntData("important", 10);
mock_c()->checkExpectations();
@@ -205,12 +199,12 @@ TEST(MockDocumentation, CInterface)
TEST_GROUP(FooTestGroup)
{
- void setup()
+ void setup() CPPUTEST_OVERRIDE
{
// Init stuff
}
- void teardown()
+ void teardown() CPPUTEST_OVERRIDE
{
// Uninit stuff
}
@@ -228,7 +222,7 @@ TEST(FooTestGroup, MoreFoo)
TEST_GROUP(BarTestGroup)
{
- void setup()
+ void setup() CPPUTEST_OVERRIDE
{
// Init Bar
}
diff --git a/examples/ApplicationLib/MockPrinter.h b/examples/AllTests/MockPrinter.h
similarity index 87%
rename from examples/ApplicationLib/MockPrinter.h
rename to examples/AllTests/MockPrinter.h
index 90dd435d5..1df48962f 100644
--- a/examples/ApplicationLib/MockPrinter.h
+++ b/examples/AllTests/MockPrinter.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -40,22 +40,18 @@
#include
#include
-class MockPrinter: public Printer
+class MockPrinter : public Printer
{
public:
- explicit MockPrinter()
- {
- }
- virtual ~MockPrinter()
- {
- }
+ explicit MockPrinter() {}
+ virtual ~MockPrinter() CPPUTEST_DESTRUCTOR_OVERRIDE {}
- virtual void Print(const char* s)
+ virtual void Print(const char* s) CPPUTEST_OVERRIDE
{
savedOutput.append(s);
}
- virtual void Print(long int value)
+ virtual void Print(long int value) CPPUTEST_OVERRIDE
{
SimpleString buffer;
buffer = StringFromFormat("%ld", value);
@@ -68,12 +64,10 @@ class MockPrinter: public Printer
}
private:
-
std::string savedOutput;
MockPrinter(const MockPrinter&);
MockPrinter& operator=(const MockPrinter&);
-
};
-#endif // D_MockPrinter_H
+#endif // D_MockPrinter_H
diff --git a/examples/AllTests/PrinterTest.cpp b/examples/AllTests/PrinterTest.cpp
index 1f872597a..88a5d1ca3 100644
--- a/examples/AllTests/PrinterTest.cpp
+++ b/examples/AllTests/PrinterTest.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -30,18 +30,19 @@
#include "MockPrinter.h"
TEST_GROUP(Printer)
-{ Printer* printer;
-MockPrinter* mockPrinter;
-
-void setup()
-{
- mockPrinter = new MockPrinter();
- printer = mockPrinter;
-}
-void teardown()
{
- delete printer;
-}
+ Printer* printer;
+ MockPrinter* mockPrinter;
+
+ void setup() CPPUTEST_OVERRIDE
+ {
+ mockPrinter = new MockPrinter();
+ printer = mockPrinter;
+ }
+ void teardown() CPPUTEST_OVERRIDE
+ {
+ delete printer;
+ }
};
TEST(Printer, PrintConstCharStar)
@@ -65,4 +66,3 @@ TEST(Printer, StreamOperators)
const char* expected = "n=1234";
CHECK_EQUAL(expected, mockPrinter->getOutput());
}
-
diff --git a/examples/ApplicationLib/ApplicationLib.vcproj b/examples/ApplicationLib/ApplicationLib.vcproj
new file mode 100644
index 000000000..f7b054bbe
--- /dev/null
+++ b/examples/ApplicationLib/ApplicationLib.vcproj
@@ -0,0 +1,276 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/ApplicationLib/ApplicationLib.vcxproj b/examples/ApplicationLib/ApplicationLib.vcxproj
new file mode 100644
index 000000000..dfa1dbcd5
--- /dev/null
+++ b/examples/ApplicationLib/ApplicationLib.vcxproj
@@ -0,0 +1,133 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ {348076B9-303C-4FE0-9380-17CDF11134A9}
+
+
+
+ StaticLibrary
+ false
+ MultiByte
+
+
+ StaticLibrary
+ false
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.30319.1
+ .\Debug\
+ .\Debug\
+ $(Configuration)\
+ $(Configuration)\
+
+
+
+ Disabled
+ ../../include;%(AdditionalIncludeDirectories)
+ WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
+ EnableFastChecks
+ MultiThreadedDebugDLL
+ .\Debug/ApplicationLib.pch
+ .\Debug/
+ .\Debug/
+ .\Debug/
+ Level3
+ true
+ EditAndContinue
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ 0x0409
+
+
+ .\Debug\ApplicationLib.lib
+ true
+
+
+ true
+ ./$(Configuration)/ApplicationLib.bsc
+
+
+
+
+ MaxSpeed
+ ../../include;%(AdditionalIncludeDirectories)
+ WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+ Default
+ MultiThreadedDLL
+ ./$(Configuration)/ApplicationLib.pch
+ ./$(Configuration)/
+ ./$(Configuration)/
+ ./$(Configuration)/
+ Level3
+ true
+
+
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ 0x0409
+
+
+ ./$(Configuration)/ApplicationLib.lib
+ true
+
+
+ true
+ ./$(Configuration)/ApplicationLib.bsc
+
+
+
+
+ %(AdditionalIncludeDirectories)
+ %(PreprocessorDefinitions)
+ %(AdditionalIncludeDirectories)
+ %(PreprocessorDefinitions)
+
+
+
+ %(AdditionalIncludeDirectories)
+ %(PreprocessorDefinitions)
+ %(AdditionalIncludeDirectories)
+ %(PreprocessorDefinitions)
+
+
+ %(AdditionalIncludeDirectories)
+ %(PreprocessorDefinitions)
+ %(AdditionalIncludeDirectories)
+ %(PreprocessorDefinitions)
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/ApplicationLib/CMakeLists.txt b/examples/ApplicationLib/CMakeLists.txt
new file mode 100644
index 000000000..564e1201f
--- /dev/null
+++ b/examples/ApplicationLib/CMakeLists.txt
@@ -0,0 +1,11 @@
+add_library(ApplicationLib
+ CircularBuffer.cpp
+ EventDispatcher.cpp
+ hello.c
+ Printer.cpp
+)
+target_include_directories(ExampleTests
+ PUBLIC
+ .
+)
+
diff --git a/examples/ApplicationLib/CircularBuffer.cpp b/examples/ApplicationLib/CircularBuffer.cpp
index 06018af20..a2d839be5 100644
--- a/examples/ApplicationLib/CircularBuffer.cpp
+++ b/examples/ApplicationLib/CircularBuffer.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -27,11 +27,11 @@
#include "CircularBuffer.h"
#include "Printer.h"
+#include
-CircularBuffer::CircularBuffer(int _capacity) :
- index(0), outdex(0), capacity(_capacity), empty(true), full(false)
+CircularBuffer::CircularBuffer(int _capacity) : index(0), outdex(0), capacity(_capacity), empty(true), full(false)
{
- buffer = new int[this->capacity];
+ buffer = new int[(size_t)this->capacity];
}
CircularBuffer::~CircularBuffer()
@@ -54,8 +54,10 @@ void CircularBuffer::Put(int i)
empty = false;
buffer[index] = i;
index = Next(index);
- if (full) outdex = Next(outdex);
- else if (index == outdex) full = true;
+ if (full)
+ outdex = Next(outdex);
+ else if (index == outdex)
+ full = true;
}
int CircularBuffer::Get()
@@ -66,7 +68,8 @@ int CircularBuffer::Get()
if (!empty) {
result = buffer[outdex];
outdex = Next(outdex);
- if (outdex == index) empty = true;
+ if (outdex == index)
+ empty = true;
}
return result;
}
@@ -78,7 +81,8 @@ int CircularBuffer::Capacity()
int CircularBuffer::Next(int i)
{
- if (++i >= capacity) i = 0;
+ if (++i >= capacity)
+ i = 0;
return i;
}
@@ -89,12 +93,14 @@ void CircularBuffer::Print(Printer* p)
int printIndex = outdex;
int count = index - outdex;
- if (!empty && (index <= outdex)) count = capacity - (outdex - index);
+ if (!empty && (index <= outdex))
+ count = capacity - (outdex - index);
for (int i = 0; i < count; i++) {
p->Print(buffer[printIndex]);
printIndex = Next(printIndex);
- if (i + 1 != count) p->Print(", ");
+ if (i + 1 != count)
+ p->Print(", ");
}
p->Print(">\n");
}
diff --git a/examples/ApplicationLib/CircularBuffer.h b/examples/ApplicationLib/CircularBuffer.h
index e804c29ba..e9634f10a 100644
--- a/examples/ApplicationLib/CircularBuffer.h
+++ b/examples/ApplicationLib/CircularBuffer.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -52,7 +52,6 @@ class CircularBuffer
void Print(Printer*);
private:
-
int index;
int outdex;
int* buffer;
@@ -66,7 +65,6 @@ class CircularBuffer
CircularBuffer(const CircularBuffer&);
CircularBuffer& operator=(const CircularBuffer&);
-
};
-#endif // D_CircularBuffer_H
+#endif // D_CircularBuffer_H
diff --git a/examples/ApplicationLib/EventDispatcher.cpp b/examples/ApplicationLib/EventDispatcher.cpp
index ef5ebbcba..140be3547 100644
--- a/examples/ApplicationLib/EventDispatcher.cpp
+++ b/examples/ApplicationLib/EventDispatcher.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -28,9 +28,7 @@
#include "EventDispatcher.h"
using namespace std;
-EventDispatcher::EventDispatcher()
-{
-}
+EventDispatcher::EventDispatcher() {}
void EventDispatcher::registerObserver(EventType type, EventObserver* observer)
{
@@ -42,8 +40,7 @@ void EventDispatcher::registerObserver(EventType type, EventObserver* observer)
void EventDispatcher::dispatchEvent(const Event& event, int timeoutSeconds)
{
- for (list >::iterator i = observerList_.begin(); i != observerList_.end(); i++)
- {
+ for (list >::iterator i = observerList_.begin(); i != observerList_.end(); i++) {
if (i->first == event.type)
i->second->notify(event, timeoutSeconds);
}
diff --git a/examples/ApplicationLib/EventDispatcher.h b/examples/ApplicationLib/EventDispatcher.h
index 06e2c687c..a27eb056f 100644
--- a/examples/ApplicationLib/EventDispatcher.h
+++ b/examples/ApplicationLib/EventDispatcher.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -25,8 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef EVENTDISPATCHER__H
-#define EVENTDISPATCHER__H
+#ifndef EVENTDISPATCHER_H
+#define EVENTDISPATCHER_H
#include
@@ -45,14 +45,15 @@ class Event
class EventObserver
{
public:
- virtual void notify(const Event& event, int timeOutInSeconds)=0;
- virtual void notifyRegistration(EventObserver* newObserver)=0;
+ virtual void notify(const Event& event, int timeOutInSeconds) = 0;
+ virtual void notifyRegistration(EventObserver* newObserver) = 0;
virtual ~EventObserver() {}
};
class EventDispatcher
{
std::list > observerList_;
+
public:
EventDispatcher();
diff --git a/examples/ApplicationLib/ExamplesNewOverrides.h b/examples/ApplicationLib/ExamplesNewOverrides.h
index ad108fc7a..86cb0219b 100644
--- a/examples/ApplicationLib/ExamplesNewOverrides.h
+++ b/examples/ApplicationLib/ExamplesNewOverrides.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
diff --git a/examples/ApplicationLib/Printer.cpp b/examples/ApplicationLib/Printer.cpp
index 1a548c899..893ae1a40 100644
--- a/examples/ApplicationLib/Printer.cpp
+++ b/examples/ApplicationLib/Printer.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -26,17 +26,11 @@
*/
#include "Printer.h"
-#include "CppUTest/TestHarness.h"
-#include "CppUTest/SimpleString.h"
#include
-Printer::Printer()
-{
-}
+Printer::Printer() {}
-Printer::~Printer()
-{
-}
+Printer::~Printer() {}
void Printer::Print(const char* s)
{
@@ -44,9 +38,9 @@ void Printer::Print(const char* s)
putchar(*p);
}
-void Printer::Print(long n)
+void Printer::Print(long int n)
{
- Print(StringFrom(n).asCharString());
+ printf("%ld", n);
}
Printer& operator<<(Printer& p, const char* s)
@@ -60,4 +54,3 @@ Printer& operator<<(Printer& p, long int i)
p.Print(i);
return p;
}
-
diff --git a/examples/ApplicationLib/Printer.h b/examples/ApplicationLib/Printer.h
index dcfc59ccd..51aa63313 100644
--- a/examples/ApplicationLib/Printer.h
+++ b/examples/ApplicationLib/Printer.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -44,13 +44,11 @@ class Printer
virtual void Print(long int);
private:
-
Printer(const Printer&);
Printer& operator=(const Printer&);
-
};
Printer& operator<<(Printer&, const char*);
Printer& operator<<(Printer&, long int);
-#endif // D_Printer_H
+#endif // D_Printer_H
diff --git a/examples/ApplicationLib/hello.c b/examples/ApplicationLib/hello.c
index 6cbe03f44..2ab67a69c 100644
--- a/examples/ApplicationLib/hello.c
+++ b/examples/ApplicationLib/hello.c
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -28,7 +28,7 @@
#include
#include "hello.h"
-void printHelloWorld()
+void printHelloWorld(void)
{
PrintFormated("Hello World!\n");
}
diff --git a/examples/ApplicationLib/hello.h b/examples/ApplicationLib/hello.h
index 5154b3cf1..83524a5c0 100644
--- a/examples/ApplicationLib/hello.h
+++ b/examples/ApplicationLib/hello.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 000000000..98244cee6
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 3.8...3.31)
+
+project(CppUTestExample)
+
+if (CMAKE_VERSION GREATER_EQUAL "3.21")
+ # PROJECT_IS_TOP_LEVEL is defined automatically
+elseif(CMAKE_CURRENT_BINARY_DIR STREQUAL CMAKE_BINARY_DIR)
+ set(PROJECT_IS_TOP_LEVEL TRUE)
+else()
+ set(PROJECT_IS_TOP_LEVEL FALSE)
+endif()
+
+if(PROJECT_IS_TOP_LEVEL)
+ find_package(CppUTest 4.0 REQUIRED)
+endif()
+
+include(CTest)
+
+add_subdirectory(AllTests)
+add_subdirectory(ApplicationLib)
diff --git a/examples/CppUTestExample.dsw b/examples/CppUTestExample.dsw
deleted file mode 100644
index 98f732660..000000000
--- a/examples/CppUTestExample.dsw
+++ /dev/null
@@ -1,44 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "AllTests"=.\AllTests\AllTests.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ApplicationLib
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "ApplicationLib"=.\ApplicationLib\ApplicationLib.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/examples/CppUTestExample_VS2008.sln b/examples/CppUTestExample_VS2008.sln
new file mode 100644
index 000000000..d3bcb4198
--- /dev/null
+++ b/examples/CppUTestExample_VS2008.sln
@@ -0,0 +1,29 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C++ Express 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AllTests", "AllTests\AllTests.vcproj", "{95A5F8D0-12C0-4AC1-B46B-292DD3886108}"
+ ProjectSection(ProjectDependencies) = postProject
+ {348076B9-303C-4FE0-9380-17CDF11134A9} = {348076B9-303C-4FE0-9380-17CDF11134A9}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ApplicationLib", "ApplicationLib\ApplicationLib.vcproj", "{348076B9-303C-4FE0-9380-17CDF11134A9}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Debug|Win32.ActiveCfg = Debug|Win32
+ {95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Debug|Win32.Build.0 = Debug|Win32
+ {95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Release|Win32.ActiveCfg = Release|Win32
+ {95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Release|Win32.Build.0 = Release|Win32
+ {348076B9-303C-4FE0-9380-17CDF11134A9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {348076B9-303C-4FE0-9380-17CDF11134A9}.Debug|Win32.Build.0 = Debug|Win32
+ {348076B9-303C-4FE0-9380-17CDF11134A9}.Release|Win32.ActiveCfg = Release|Win32
+ {348076B9-303C-4FE0-9380-17CDF11134A9}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/examples/CppUTestExample_VS201x.sln b/examples/CppUTestExample_VS201x.sln
new file mode 100644
index 000000000..2ea7d4a31
--- /dev/null
+++ b/examples/CppUTestExample_VS201x.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AllTests", "AllTests\AllTests.vcxproj", "{95A5F8D0-12C0-4AC1-B46B-292DD3886108}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ApplicationLib", "ApplicationLib\ApplicationLib.vcxproj", "{348076B9-303C-4FE0-9380-17CDF11134A9}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Debug|Win32.ActiveCfg = Debug|Win32
+ {95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Debug|Win32.Build.0 = Debug|Win32
+ {95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Release|Win32.ActiveCfg = Release|Win32
+ {95A5F8D0-12C0-4AC1-B46B-292DD3886108}.Release|Win32.Build.0 = Release|Win32
+ {348076B9-303C-4FE0-9380-17CDF11134A9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {348076B9-303C-4FE0-9380-17CDF11134A9}.Debug|Win32.Build.0 = Debug|Win32
+ {348076B9-303C-4FE0-9380-17CDF11134A9}.Release|Win32.ActiveCfg = Release|Win32
+ {348076B9-303C-4FE0-9380-17CDF11134A9}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/examples/Makefile_ExamplesWithCppUTestInstalled.mk b/examples/Makefile_ExamplesWithCppUTestInstalled.mk
new file mode 100644
index 000000000..e42992fb9
--- /dev/null
+++ b/examples/Makefile_ExamplesWithCppUTestInstalled.mk
@@ -0,0 +1,26 @@
+
+CPPFLAGS += -I /usr/local/include
+LD_LIBRARIES = -L/usr/local/lib -lCppUTest -lCppUTestExt
+
+VPATH = ApplicationLib AllTests
+
+APPLIB_OBJECTS = CircularBuffer.o EventDispatcher.o hello.o Printer.o
+TEST_OBJECTS = AllTests.o CircularBufferTest.o EventDispatcherTest.o FEDemoTest.o HelloTest.o MockDocumentationTest.o PrinterTest.o
+
+CPPFLAGS += -I ApplicationLib
+
+TEST_TARGET = CppUTestExamples
+APPLIB = applicationLib.a
+
+$(TEST_TARGET): $(TEST_OBJECTS) applicationLib.a
+ $(CXX) -o $@ $^ $(LD_LIBRARIES) $(LDFLAGS)
+ ./$(TEST_TARGET)
+
+$(APPLIB): $(APPLIB_OBJECTS)
+ $(AR) $(ARFLAGS) $@ $^
+
+clean:
+ rm -f -rf *.o
+ rm -f $(TEST_TARGET)
+ rm -f $(APPLIB)
+
diff --git a/gcovr.cfg b/gcovr.cfg
new file mode 100644
index 000000000..1f027724a
--- /dev/null
+++ b/gcovr.cfg
@@ -0,0 +1,6 @@
+filter = src/
+filter = include/
+html = yes
+html-details = yes
+output = coverage.html
+print-summary = yes
diff --git a/include/CppUTest/CommandLineArguments.h b/include/CppUTest/CommandLineArguments.h
index ba71a937f..d162a5e2f 100644
--- a/include/CppUTest/CommandLineArguments.h
+++ b/include/CppUTest/CommandLineArguments.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -37,48 +37,80 @@ class TestPlugin;
class CommandLineArguments
{
public:
- explicit CommandLineArguments(int ac, const char** av);
+ explicit CommandLineArguments(int ac, const char *const *av);
virtual ~CommandLineArguments();
bool parse(TestPlugin* plugin);
+ bool needHelp() const;
bool isVerbose() const;
+ bool isVeryVerbose() const;
bool isColor() const;
- int getRepeatCount() const;
+ bool isListingTestGroupNames() const;
+ bool isListingTestGroupAndCaseNames() const;
+ bool isListingTestLocations() const;
+ bool isRunIgnored() const;
+ size_t getRepeatCount() const;
+ bool isShuffling() const;
+ bool isReversing() const;
+ bool isCrashingOnFail() const;
+ bool isRethrowingExceptions() const;
+ size_t getShuffleSeed() const;
const TestFilter* getGroupFilters() const;
const TestFilter* getNameFilters() const;
bool isJUnitOutput() const;
bool isEclipseOutput() const;
+ bool isTeamCityOutput() const;
bool runTestsInSeperateProcess() const;
const SimpleString& getPackageName() const;
const char* usage() const;
+ const char* help() const;
private:
enum OutputType
{
- OUTPUT_ECLIPSE, OUTPUT_JUNIT
+ OUTPUT_ECLIPSE, OUTPUT_JUNIT, OUTPUT_TEAMCITY
};
+
int ac_;
- const char** av_;
+ const char *const *av_;
+ bool needHelp_;
bool verbose_;
+ bool veryVerbose_;
bool color_;
bool runTestsAsSeperateProcess_;
- int repeat_;
+ bool listTestGroupNames_;
+ bool listTestGroupAndCaseNames_;
+ bool listTestLocations_;
+ bool runIgnored_;
+ bool reversing_;
+ bool crashOnFail_;
+ bool rethrowExceptions_;
+ bool shuffling_;
+ bool shufflingPreSeeded_;
+ size_t repeat_;
+ size_t shuffleSeed_;
TestFilter* groupFilters_;
TestFilter* nameFilters_;
OutputType outputType_;
SimpleString packageName_;
- SimpleString getParameterField(int ac, const char** av, int& i, const SimpleString& parameterName);
- void SetRepeatCount(int ac, const char** av, int& index);
- void AddGroupFilter(int ac, const char** av, int& index);
- void AddStrictGroupFilter(int ac, const char** av, int& index);
- void AddNameFilter(int ac, const char** av, int& index);
- void AddStrictNameFilter(int ac, const char** av, int& index);
- void AddTestToRunBasedOnVerboseOutput(int ac, const char** av, int& index, const char* parameterName);
- bool SetOutputType(int ac, const char** av, int& index);
- void SetPackageName(int ac, const char** av, int& index);
+ SimpleString getParameterField(int ac, const char *const *av, int& i, const SimpleString& parameterName);
+ void setRepeatCount(int ac, const char *const *av, int& index);
+ bool setShuffle(int ac, const char *const *av, int& index);
+ void addGroupFilter(int ac, const char *const *av, int& index);
+ bool addGroupDotNameFilter(int ac, const char *const *av, int& index, const SimpleString& parameterName, bool strict, bool exclude);
+ void addStrictGroupFilter(int ac, const char *const *av, int& index);
+ void addExcludeGroupFilter(int ac, const char *const *av, int& index);
+ void addExcludeStrictGroupFilter(int ac, const char *const *av, int& index);
+ void addNameFilter(int ac, const char *const *av, int& index);
+ void addStrictNameFilter(int ac, const char *const *av, int& index);
+ void addExcludeNameFilter(int ac, const char *const *av, int& index);
+ void addExcludeStrictNameFilter(int ac, const char *const *av, int& index);
+ void addTestToRunBasedOnVerboseOutput(int ac, const char *const *av, int& index, const char* parameterName);
+ bool setOutputType(int ac, const char *const *av, int& index);
+ void setPackageName(int ac, const char *const *av, int& index);
CommandLineArguments(const CommandLineArguments&);
CommandLineArguments& operator=(const CommandLineArguments&);
diff --git a/include/CppUTest/CommandLineTestRunner.h b/include/CppUTest/CommandLineTestRunner.h
index d6c6a38ff..91c52d177 100644
--- a/include/CppUTest/CommandLineTestRunner.h
+++ b/include/CppUTest/CommandLineTestRunner.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -33,7 +33,6 @@
#include "CommandLineArguments.h"
#include "TestFilter.h"
-class JUnitTestOutput;
class TestRegistry;
#define DEF_PLUGIN_MEM_LEAK "MemoryLeakPlugin"
@@ -42,30 +41,28 @@ class TestRegistry;
class CommandLineTestRunner
{
public:
- enum OutputType
- {
- OUTPUT_NORMAL, OUTPUT_JUNIT
- };
-
- static int RunAllTests(int ac, const char** av);
+ static int RunAllTests(int ac, const char *const *av);
static int RunAllTests(int ac, char** av);
- CommandLineTestRunner(int ac, const char** av, TestOutput*, TestRegistry* registry);
+ CommandLineTestRunner(int ac, const char *const *av, TestRegistry* registry);
virtual ~CommandLineTestRunner();
+
int runAllTestsMain();
-private:
+protected:
+ virtual TestOutput* createTeamCityOutput();
+ virtual TestOutput* createJUnitOutput(const SimpleString& packageName);
+ virtual TestOutput* createConsoleOutput();
+ virtual TestOutput* createCompositeOutput(TestOutput* outputOne, TestOutput* outputTwo);
+
TestOutput* output_;
- JUnitTestOutput* jUnitOutput_;
+private:
CommandLineArguments* arguments_;
TestRegistry* registry_;
bool parseArguments(TestPlugin*);
int runAllTests();
void initializeTestRun();
- bool isVerbose();
- bool isColor();
- int getRepeatCount();
};
#endif
diff --git a/include/CppUTest/CppUTestConfig.h b/include/CppUTest/CppUTestConfig.h
index f87403a3b..435ea74d2 100644
--- a/include/CppUTest/CppUTestConfig.h
+++ b/include/CppUTest/CppUTestConfig.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -25,12 +25,21 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#ifndef CPPUTESTCONFIG_H_
#define CPPUTESTCONFIG_H_
-#ifdef HAVE_CONFIG_H
-#include "config.h"
+#ifndef CPPUTEST_USE_OWN_CONFIGURATION
+ // The autotools generated header uses reserved names in macros
+ #ifdef __clang__
+ #pragma clang diagnostic push
+ #if __clang_major__ >= 13
+ #pragma clang diagnostic ignored "-Wreserved-identifier"
+ #endif
+ #endif
+ #include "CppUTestGeneratedConfig.h"
+ #ifdef __clang__
+ #pragma clang diagnostic pop
+ #endif
#endif
/*
@@ -85,77 +94,164 @@
#endif
#endif
-/* Create a __no_return__ macro, which is used to flag a function as not returning.
+/* Should be the only #include here. Standard C library wrappers */
+#include "StandardCLibrary.h"
+
+/* Create a CPPUTEST_NORETURN macro, which is used to flag a function as not returning.
* Used for functions that always throws for instance.
*
* This is needed for compiling with clang, without breaking other compilers.
*/
#ifndef __has_attribute
- #define __has_attribute(x) 0
+ #define CPPUTEST_HAS_ATTRIBUTE(x) 0
+#else
+ #define CPPUTEST_HAS_ATTRIBUTE(x) __has_attribute(x)
#endif
-#if __has_attribute(noreturn)
- #define __no_return__ __attribute__((noreturn))
+#if defined (__cplusplus) && __cplusplus >= 201103L
+ #define CPPUTEST_NORETURN [[noreturn]]
+#elif CPPUTEST_HAS_ATTRIBUTE(noreturn)
+ #define CPPUTEST_NORETURN __attribute__((noreturn))
#else
- #define __no_return__
+ #define CPPUTEST_NORETURN
#endif
-#if __has_attribute(format)
- #define __check_format__(type, format_parameter, other_parameters) __attribute__ ((format (type, format_parameter, other_parameters)))
+#if defined(__MINGW32__)
+#define CPPUTEST_CHECK_FORMAT_TYPE __MINGW_PRINTF_FORMAT
#else
- #define __check_format__(type, format_parameter, other_parameters) /* type, format_parameter, other_parameters */
+#define CPPUTEST_CHECK_FORMAT_TYPE printf
#endif
-/*
- * When we don't link Standard C++, then we won't throw exceptions as we assume the compiler might not support that!
- */
+#if CPPUTEST_HAS_ATTRIBUTE(format)
+ #define CPPUTEST_CHECK_FORMAT(type, format_parameter, other_parameters) __attribute__ ((format (type, format_parameter, other_parameters)))
+#else
+ #define CPPUTEST_CHECK_FORMAT(type, format_parameter, other_parameters) /* type, format_parameter, other_parameters */
+#endif
-#if CPPUTEST_USE_STD_CPP_LIB
- #if defined(__cplusplus) && __cplusplus >= 201103L
- #define UT_THROW(exception)
- #define UT_NOTHROW noexcept
- #else
- #define UT_THROW(exception) throw (exception)
- #define UT_NOTHROW throw()
- #endif
+#if defined(__cplusplus) && __cplusplus >= 201103L
+ #define DEFAULT_COPY_CONSTRUCTOR(classname) classname(const classname &) = default;
#else
- #define UT_THROW(exception)
- #ifdef __clang__
- #define UT_NOTHROW throw()
- #else
- #define UT_NOTHROW
- #endif
+ #define DEFAULT_COPY_CONSTRUCTOR(classname)
#endif
/*
- * Visual C++ doesn't define __cplusplus as C++11 yet (201103), however it doesn't want the throw(exception) either, but
- * it does want throw().
- */
+ * Address sanitizer is a good thing... and it causes some conflicts with the CppUTest tests
+ * To check whether it is on or off, we create a CppUTest define here.
+*/
+#if defined(__has_feature)
+ #if __has_feature(address_sanitizer)
+ #define CPPUTEST_SANITIZE_ADDRESS 1
+ #endif
+#elif defined(__SANITIZE_ADDRESS__)
+ #define CPPUTEST_SANITIZE_ADDRESS 1
+#endif
-#ifdef _MSC_VER
- #undef UT_THROW
- #define UT_THROW(exception)
+#ifndef CPPUTEST_SANITIZE_ADDRESS
+ #define CPPUTEST_SANITIZE_ADDRESS 0
#endif
-#if defined(__cplusplus) && __cplusplus >= 201103L
- #define DEFAULT_COPY_CONSTRUCTOR(classname) classname(const classname &) = default;
+#if CPPUTEST_SANITIZE_ADDRESS
+ #if defined(__linux__) && defined(__clang__) && CPPUTEST_USE_STD_CPP_LIB && CPPUTEST_USE_MEM_LEAK_DETECTION
+ #warning Compiling with Address Sanitizer with clang on linux may cause duplicate symbols for operator new. Turning off memory leak detection. Compile with -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED to get rid of this warning.
+ #endif
+ #define CPPUTEST_DO_NOT_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
#else
- #define DEFAULT_COPY_CONSTRUCTOR(classname)
+ #define CPPUTEST_DO_NOT_SANITIZE_ADDRESS
#endif
/*
- * g++-4.7 with stdc++11 enabled On MacOSX! will have a different exception specifier for operator new (and thank you!)
- * I assume they'll fix this in the future, but for now, we'll change that here.
- * (This should perhaps also be done in the configure.ac)
+ * Handling of IEEE754 (IEC559) floating point exceptions via fenv.h
+ * Predominantly works on non-Visual C++ compilers and Visual C++ 2008 and newer
*/
-
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#ifdef __APPLE__
-#ifdef _GLIBCXX_THROW
-#undef UT_THROW
-#define UT_THROW(exception) _GLIBCXX_THROW(exception)
-#endif
+#ifndef CPPUTEST_HAVE_FENV
+ #if (defined(__STDC_IEC_559__) && __STDC_IEC_559__) && CPPUTEST_USE_STD_C_LIB
+ #define CPPUTEST_HAVE_FENV 1
+ #else
+ #define CPPUTEST_HAVE_FENV 0
+ #endif
#endif
+
+#ifdef __cplusplus
+ /*
+ * Detection of run-time type information (RTTI) presence. Since it's a
+ * standard language feature, assume it is enabled unless we see otherwise.
+ */
+ #ifndef CPPUTEST_HAVE_RTTI
+ #if ((__cplusplus >= 202002L) && !__cpp_rtti) || \
+ (defined(_MSC_VER) && !_CPPRTTI) || \
+ (defined(__GNUC__) && !__GXX_RTTI) || \
+ (defined(__ghs__) && !__RTTI) || \
+ (defined(__WATCOMC__) && !_CPPRTTI)
+ #define CPPUTEST_HAVE_RTTI 0
+ #else
+ #define CPPUTEST_HAVE_RTTI 1
+ #endif
+ #endif
+
+ /*
+ * Detection of exception support. Since it's a standard language feature,
+ * assume it is enabled unless we see otherwise.
+ */
+ #ifndef CPPUTEST_HAVE_EXCEPTIONS
+ #if ((__cplusplus >= 202002L) && !__cpp_exceptions) || \
+ (defined(_MSC_VER) && !_CPPUNWIND) || \
+ (defined(__GNUC__) && !__EXCEPTIONS) || \
+ (defined(__ghs__) && !__EXCEPTION_HANDLING) || \
+ (defined(__WATCOMC__) && !_CPPUNWIND)
+ #define CPPUTEST_HAVE_EXCEPTIONS 0
+ #else
+ #define CPPUTEST_HAVE_EXCEPTIONS 1
+ #endif
+ #endif
+
+ #if CPPUTEST_HAVE_EXCEPTIONS
+ #if defined(__cplusplus) && __cplusplus >= 201103L
+ #define UT_THROW(exception)
+ #define UT_NOTHROW noexcept
+ #else
+ #define UT_THROW(exception) throw (exception)
+ #define UT_NOTHROW throw()
+ #endif
+ #else
+ #define UT_THROW(exception)
+ #if defined(__clang__) || defined(__GNUC__)
+ #if defined(__cplusplus) && __cplusplus >= 201103L
+ #define UT_NOTHROW noexcept
+ #else
+ #define UT_NOTHROW throw()
+ #endif
+ #else
+ #define UT_NOTHROW
+ #endif
+ #endif
+
+ /*
+ * Visual C++ doesn't define __cplusplus as C++11 yet (201103), however it doesn't want the throw(exception) either, but
+ * it does want throw().
+ */
+ #ifdef _MSC_VER
+ #undef UT_THROW
+ #define UT_THROW(exception)
+ #endif
+
+ /*
+ * g++-4.7 with stdc++11 enabled On MacOSX! will have a different exception specifier for operator new (and thank you!)
+ * I assume they'll fix this in the future, but for now, we'll change that here.
+ * (This should perhaps also be done in the configure.ac)
+ */
+ #if defined(__GXX_EXPERIMENTAL_CXX0X__) && \
+ defined(__APPLE__) && \
+ defined(_GLIBCXX_THROW)
+ #undef UT_THROW
+ #define UT_THROW(exception) _GLIBCXX_THROW(exception)
+ #endif
+
+ #if CPPUTEST_USE_STD_CPP_LIB
+ #define CPPUTEST_BAD_ALLOC std::bad_alloc
+ #else
+ class CppUTestBadAlloc {};
+ #define CPPUTEST_BAD_ALLOC CppUTestBadAlloc
+ #endif
#endif
/*
@@ -169,17 +265,94 @@
#endif
#endif
-/* Visual C++ 10.0+ (2010+) supports the override keyword, but doesn't define the C++ version as C++11 */
-#if defined(__cplusplus) && ((__cplusplus >= 201103L) || (defined(_MSC_VER) && (_MSC_VER >= 1600)))
-#define _override override
+/* Handling of systems with a different byte-width (e.g. 16 bit). Since
+ * CHAR_BIT is defined in limits.h (ANSI C), the user must provide a definition
+ * when building without Std C library.
+ */
+#ifndef CPPUTEST_CHAR_BIT
+ #if defined(CHAR_BIT)
+ #define CPPUTEST_CHAR_BIT CHAR_BIT
+ #else
+ #error "Provide a definition for CPPUTEST_CHAR_BIT"
+ #endif
+#endif
+
+/* Handling of systems with a different int-width (e.g. 16 bit).
+ */
+#if CPPUTEST_USE_STD_C_LIB && (INT_MAX == 0x7fff)
+#define CPPUTEST_16BIT_INTS
+#endif
+
+/*
+ * Support for "long long" type.
+ *
+ * Not supported when CPPUTEST_LONG_LONG_DISABLED is set.
+ * Can be overridden by using CPPUTEST_USE_LONG_LONG
+ *
+ * CPPUTEST_HAVE_LONG_LONG_INT is set by configure or CMake.
+ * LLONG_MAX is set in limits.h. This is a crude attempt to detect long long support when no configure is used
+ *
+ */
+#ifndef CPPUTEST_USE_LONG_LONG
+#if !defined(CPPUTEST_LONG_LONG_DISABLED) && (defined(CPPUTEST_HAVE_LONG_LONG_INT) || defined(LLONG_MAX))
+#define CPPUTEST_USE_LONG_LONG 1
+#else
+#define CPPUTEST_USE_LONG_LONG 0
+#endif
+#endif
+
+#if CPPUTEST_USE_LONG_LONG
+typedef long long cpputest_longlong;
+typedef unsigned long long cpputest_ulonglong;
#else
-#define _override
+/* Define some placeholders to disable the overloaded methods.
+ * It's not required to have these match the size of the "real" type, but it's occasionally convenient.
+ */
+
+#if defined(CPPUTEST_64BIT) && !defined(CPPUTEST_64BIT_32BIT_LONGS)
+#define CPPUTEST_SIZE_OF_FAKE_LONG_LONG_TYPE 16
+#else
+#define CPPUTEST_SIZE_OF_FAKE_LONG_LONG_TYPE 8
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
#endif
-/* MinGW-w64 prefers to act like Visual C++, but we want the ANSI behaviors instead */
-#define __USE_MINGW_ANSI_STDIO 1
+typedef struct
+{
+ char dummy[CPPUTEST_SIZE_OF_FAKE_LONG_LONG_TYPE];
+} cpputest_longlong;
-/* Should be the only #include here. Standard C library wrappers */
-#include "StandardCLibrary.h"
+typedef struct
+{
+ char dummy[CPPUTEST_SIZE_OF_FAKE_LONG_LONG_TYPE];
+} cpputest_ulonglong;
+
+#if defined(__cplusplus)
+} /* extern "C" */
+#endif
+
+#endif
+
+#ifdef __cplusplus
+ /* Visual C++ 10.0+ (2010+) supports the override keyword, but doesn't define the C++ version as C++11 */
+ #if (__cplusplus >= 201103L) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
+ #define CPPUTEST_OVERRIDE override
+ #define NULLPTR nullptr
+ #else
+ #define CPPUTEST_OVERRIDE
+ #define NULLPTR NULL
+ #endif
+#endif
+
+#ifdef __cplusplus
+ /* Visual C++ 11.0+ (2012+) supports the override keyword on destructors */
+ #if (__cplusplus >= 201103L) || (defined(_MSC_VER) && (_MSC_VER >= 1700))
+ #define CPPUTEST_DESTRUCTOR_OVERRIDE override
+ #else
+ #define CPPUTEST_DESTRUCTOR_OVERRIDE
+ #endif
+#endif
#endif
diff --git a/include/CppUTest/CppUTestGeneratedConfig.h b/include/CppUTest/CppUTestGeneratedConfig.h
new file mode 100644
index 000000000..5bcd53768
--- /dev/null
+++ b/include/CppUTest/CppUTestGeneratedConfig.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of the nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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.
+ */
+
+/*
+ * This file is confusing, sorry for that :) Please never edit this file.
+ *
+ * It serves 3 purposes
+ *
+ * 1) When you installed CppUTest on your system (make install), then this file should be overwritten by one that
+ * actually contains some configuration of your system. Mostly info such as availability of types, headers, etc.
+ * 2) When you build CppUTest using autotools, this file will be included and it will include the generated file.
+ * That should be the same file as will be installed if you run make install
+ * 3) When you use CppUTest on another platform that doesn't require configuration, then this file does nothing and
+ * should be harmless.
+ *
+ * If you have done make install and you still found this text, then please report a bug :)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "generated/CppUTestGeneratedConfig.h"
+#endif
+
diff --git a/include/CppUTest/JUnitTestOutput.h b/include/CppUTest/JUnitTestOutput.h
index ae0037130..5e5746f56 100644
--- a/include/CppUTest/JUnitTestOutput.h
+++ b/include/CppUTest/JUnitTestOutput.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -38,23 +38,22 @@ class JUnitTestOutput: public TestOutput
{
public:
JUnitTestOutput();
- virtual ~JUnitTestOutput();
+ virtual ~JUnitTestOutput() CPPUTEST_DESTRUCTOR_OVERRIDE;
- virtual void printTestsStarted() _override;
- virtual void printTestsEnded(const TestResult& result) _override;
- virtual void printCurrentTestStarted(const UtestShell& test) _override;
- virtual void printCurrentTestEnded(const TestResult& res) _override;
- virtual void printCurrentGroupStarted(const UtestShell& test) _override;
- virtual void printCurrentGroupEnded(const TestResult& res) _override;
+ virtual void printTestsStarted() CPPUTEST_OVERRIDE;
+ virtual void printTestsEnded(const TestResult& result) CPPUTEST_OVERRIDE;
+ virtual void printCurrentTestStarted(const UtestShell& test) CPPUTEST_OVERRIDE;
+ virtual void printCurrentTestEnded(const TestResult& res) CPPUTEST_OVERRIDE;
+ virtual void printCurrentGroupStarted(const UtestShell& test) CPPUTEST_OVERRIDE;
+ virtual void printCurrentGroupEnded(const TestResult& res) CPPUTEST_OVERRIDE;
- virtual void verbose() _override;
- virtual void printBuffer(const char*) _override;
- virtual void print(const char*) _override;
- virtual void print(long) _override;
- virtual void print(const TestFailure& failure) _override;
- virtual void printTestRun(int number, int total) _override;
+ virtual void printBuffer(const char*) CPPUTEST_OVERRIDE;
+ virtual void print(const char*) CPPUTEST_OVERRIDE;
+ virtual void print(long) CPPUTEST_OVERRIDE;
+ virtual void print(size_t) CPPUTEST_OVERRIDE;
+ virtual void printFailure(const TestFailure& failure) CPPUTEST_OVERRIDE;
- virtual void flush() _override;
+ virtual void flush() CPPUTEST_OVERRIDE;
virtual SimpleString createFileName(const SimpleString& group);
void setPackageName(const SimpleString &package);
@@ -70,12 +69,13 @@ class JUnitTestOutput: public TestOutput
virtual void closeFile();
virtual void writeXmlHeader();
- virtual void writeTestSuiteSummery();
+ virtual void writeTestSuiteSummary();
virtual void writeProperties();
virtual void writeTestCases();
+ virtual SimpleString encodeXmlText(const SimpleString& textbody);
+ virtual SimpleString encodeFileName(const SimpleString& fileName);
virtual void writeFailure(JUnitTestCaseResultNode* node);
virtual void writeFileEnding();
-
};
#endif
diff --git a/include/CppUTest/MemoryLeakDetector.h b/include/CppUTest/MemoryLeakDetector.h
index cc21fbcfd..195a3384a 100644
--- a/include/CppUTest/MemoryLeakDetector.h
+++ b/include/CppUTest/MemoryLeakDetector.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -37,6 +37,7 @@ enum MemLeakPeriod
};
class TestMemoryAllocator;
+class SimpleMutex;
class MemoryLeakFailure
{
@@ -57,7 +58,7 @@ struct SimpleStringBuffer
SimpleStringBuffer();
void clear();
- void add(const char* format, ...) __check_format__(printf, 2, 3);
+ void add(const char* format, ...) CPPUTEST_CHECK_FORMAT(CPPUTEST_CHECK_FORMAT_TYPE, 2, 3);
void addMemoryDump(const void* memory, size_t memorySize);
char* toString();
@@ -85,30 +86,30 @@ class MemoryLeakOutputStringBuffer
void reportMemoryLeak(MemoryLeakDetectorNode* leak);
- void reportDeallocateNonAllocatedMemoryFailure(const char* freeFile, int freeLine, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter);
- void reportMemoryCorruptionFailure(MemoryLeakDetectorNode* node, const char* freeFile, int freeLineNumber, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter);
- void reportAllocationDeallocationMismatchFailure(MemoryLeakDetectorNode* node, const char* freeFile, int freeLineNumber, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter);
+ void reportDeallocateNonAllocatedMemoryFailure(const char* freeFile, size_t freeLine, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter);
+ void reportMemoryCorruptionFailure(MemoryLeakDetectorNode* node, const char* freeFile, size_t freeLineNumber, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter);
+ void reportAllocationDeallocationMismatchFailure(MemoryLeakDetectorNode* node, const char* freeFile, size_t freeLineNumber, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter);
char* toString();
private:
- void addAllocationLocation(const char* allocationFile, int allocationLineNumber, size_t allocationSize, TestMemoryAllocator* allocator);
- void addDeallocationLocation(const char* freeFile, int freeLineNumber, TestMemoryAllocator* allocator);
+ void addAllocationLocation(const char* allocationFile, size_t allocationLineNumber, size_t allocationSize, TestMemoryAllocator* allocator);
+ void addDeallocationLocation(const char* freeFile, size_t freeLineNumber, TestMemoryAllocator* allocator);
void addMemoryLeakHeader();
- void addMemoryLeakFooter(int totalAmountOfLeaks);
+ void addMemoryLeakFooter(size_t totalAmountOfLeaks);
void addWarningForUsingMalloc();
void addNoMemoryLeaksMessage();
void addErrorMessageForTooMuchLeaks();
private:
- int total_leaks_;
+ size_t total_leaks_;
bool giveWarningOnUsingMalloc_;
void reportFailure(const char* message, const char* allocFile,
- int allocLine, size_t allocSize,
+ size_t allocLine, size_t allocSize,
TestMemoryAllocator* allocAllocator, const char* freeFile,
- int freeLine, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter);
+ size_t freeLine, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter);
SimpleStringBuffer outputBuffer_;
};
@@ -116,19 +117,20 @@ class MemoryLeakOutputStringBuffer
struct MemoryLeakDetectorNode
{
MemoryLeakDetectorNode() :
- size_(0), number_(0), memory_(0), file_(0), line_(0), allocator_(0), period_(mem_leak_period_enabled), next_(0)
+ size_(0), number_(0), memory_(NULLPTR), file_(NULLPTR), line_(0), allocator_(NULLPTR), period_(mem_leak_period_enabled), allocation_stage_(0), next_(NULLPTR)
{
}
- void init(char* memory, unsigned number, size_t size, TestMemoryAllocator* allocator, MemLeakPeriod period, const char* file, int line);
+ void init(char* memory, unsigned number, size_t size, TestMemoryAllocator* allocator, MemLeakPeriod period, unsigned char allocation_stage, const char* file, size_t line);
size_t size_;
unsigned number_;
char* memory_;
const char* file_;
- int line_;
+ size_t line_;
TestMemoryAllocator* allocator_;
MemLeakPeriod period_;
+ unsigned char allocation_stage_;
private:
friend struct MemoryLeakDetectorList;
@@ -138,7 +140,7 @@ struct MemoryLeakDetectorNode
struct MemoryLeakDetectorList
{
MemoryLeakDetectorList() :
- head_(0)
+ head_(NULLPTR)
{}
void addNewNode(MemoryLeakDetectorNode* node);
@@ -146,16 +148,19 @@ struct MemoryLeakDetectorList
MemoryLeakDetectorNode* removeNode(char* memory);
MemoryLeakDetectorNode* getFirstLeak(MemLeakPeriod period);
- MemoryLeakDetectorNode* getNextLeak(MemoryLeakDetectorNode* node,
- MemLeakPeriod period);
- MemoryLeakDetectorNode* getLeakFrom(MemoryLeakDetectorNode* node,
- MemLeakPeriod period);
+ MemoryLeakDetectorNode* getFirstLeakForAllocationStage(unsigned char allocation_stage);
- int getTotalLeaks(MemLeakPeriod period);
- bool hasLeaks(MemLeakPeriod period);
+ MemoryLeakDetectorNode* getNextLeak(MemoryLeakDetectorNode* node, MemLeakPeriod period);
+ MemoryLeakDetectorNode* getNextLeakForAllocationStage(MemoryLeakDetectorNode* node, unsigned char allocation_stage);
+
+ MemoryLeakDetectorNode* getLeakFrom(MemoryLeakDetectorNode* node, MemLeakPeriod period);
+ MemoryLeakDetectorNode* getLeakForAllocationStageFrom(MemoryLeakDetectorNode* node, unsigned char allocation_stage);
+
+ size_t getTotalLeaks(MemLeakPeriod period);
void clearAllAccounting(MemLeakPeriod period);
bool isInPeriod(MemoryLeakDetectorNode* node, MemLeakPeriod period);
+ bool isInAllocationStage(MemoryLeakDetectorNode* node, unsigned char allocation_stage);
private:
MemoryLeakDetectorNode* head_;
@@ -169,12 +174,12 @@ struct MemoryLeakDetectorTable
MemoryLeakDetectorNode* retrieveNode(char* memory);
MemoryLeakDetectorNode* removeNode(char* memory);
- bool hasLeaks(MemLeakPeriod period);
- int getTotalLeaks(MemLeakPeriod period);
+ size_t getTotalLeaks(MemLeakPeriod period);
MemoryLeakDetectorNode* getFirstLeak(MemLeakPeriod period);
- MemoryLeakDetectorNode* getNextLeak(MemoryLeakDetectorNode* leak,
- MemLeakPeriod period);
+ MemoryLeakDetectorNode* getFirstLeakForAllocationStage(unsigned char allocation_stage);
+ MemoryLeakDetectorNode* getNextLeak(MemoryLeakDetectorNode* leak, MemLeakPeriod period);
+ MemoryLeakDetectorNode* getNextLeakForAllocationStage(MemoryLeakDetectorNode* leak, unsigned char allocation_stage);
private:
unsigned long hash(char* memory);
@@ -190,9 +195,7 @@ class MemoryLeakDetector
{
public:
MemoryLeakDetector(MemoryLeakFailure* reporter);
- virtual ~MemoryLeakDetector()
- {
- }
+ virtual ~MemoryLeakDetector();
void enable();
void disable();
@@ -203,26 +206,37 @@ class MemoryLeakDetector
void startChecking();
void stopChecking();
+ unsigned char getCurrentAllocationStage() const;
+ void increaseAllocationStage();
+ void decreaseAllocationStage();
+
const char* report(MemLeakPeriod period);
void markCheckingPeriodLeaksAsNonCheckingPeriod();
- int totalMemoryLeaks(MemLeakPeriod period);
+ size_t totalMemoryLeaks(MemLeakPeriod period);
void clearAllAccounting(MemLeakPeriod period);
char* allocMemory(TestMemoryAllocator* allocator, size_t size, bool allocatNodesSeperately = false);
char* allocMemory(TestMemoryAllocator* allocator, size_t size,
- const char* file, int line, bool allocatNodesSeperately = false);
+ const char* file, size_t line, bool allocatNodesSeperately = false);
void deallocMemory(TestMemoryAllocator* allocator, void* memory, bool allocatNodesSeperately = false);
- void deallocMemory(TestMemoryAllocator* allocator, void* memory, const char* file, int line, bool allocatNodesSeperately = false);
- char* reallocMemory(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, bool allocatNodesSeperately = false);
+ void deallocMemory(TestMemoryAllocator* allocator, void* memory, const char* file, size_t line, bool allocatNodesSeperately = false);
+ void deallocAllMemoryInCurrentAllocationStage();
+ char* reallocMemory(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, size_t line, bool allocatNodesSeperately = false);
void invalidateMemory(char* memory);
void removeMemoryLeakInformationWithoutCheckingOrDeallocatingTheMemoryButDeallocatingTheAccountInformation(TestMemoryAllocator* allocator, void* memory, bool allocatNodesSeperately);
enum
{
+#ifdef CPPUTEST_DISABLE_MEM_CORRUPTION_CHECK
+ memory_corruption_buffer_size = 0
+#else
memory_corruption_buffer_size = 3
+#endif
};
unsigned getCurrentAllocationNumber();
+
+ SimpleMutex* getMutex(void);
private:
MemoryLeakFailure* reporter_;
MemLeakPeriod current_period_;
@@ -230,25 +244,27 @@ class MemoryLeakDetector
MemoryLeakDetectorTable memoryTable_;
bool doAllocationTypeChecking_;
unsigned allocationSequenceNumber_;
+ unsigned char current_allocation_stage_;
+ SimpleMutex* mutex_;
- char* allocateMemoryWithAccountingInformation(TestMemoryAllocator* allocator, size_t size, const char* file, int line, bool allocatNodesSeperately);
- char* reallocateMemoryWithAccountingInformation(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, bool allocatNodesSeperately);
+ char* allocateMemoryWithAccountingInformation(TestMemoryAllocator* allocator, size_t size, const char* file, size_t line, bool allocatNodesSeperately);
+ char* reallocateMemoryWithAccountingInformation(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, size_t line, bool allocatNodesSeperately);
MemoryLeakDetectorNode* createMemoryLeakAccountingInformation(TestMemoryAllocator* allocator, size_t size, char* memory, bool allocatNodesSeperately);
bool validMemoryCorruptionInformation(char* memory);
bool matchingAllocation(TestMemoryAllocator *alloc_allocator, TestMemoryAllocator *free_allocator);
- void storeLeakInformation(MemoryLeakDetectorNode * node, char *new_memory, size_t size, TestMemoryAllocator *allocator, const char *file, int line);
+ void storeLeakInformation(MemoryLeakDetectorNode * node, char *new_memory, size_t size, TestMemoryAllocator *allocator, const char *file, size_t line);
void ConstructMemoryLeakReport(MemLeakPeriod period);
size_t sizeOfMemoryWithCorruptionInfo(size_t size);
MemoryLeakDetectorNode* getNodeFromMemoryPointer(char* memory, size_t size);
- char* reallocateMemoryAndLeakInformation(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, bool allocatNodesSeperately);
+ char* reallocateMemoryAndLeakInformation(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, size_t line, bool allocatNodesSeperately);
void addMemoryCorruptionInformation(char* memory);
- void checkForCorruption(MemoryLeakDetectorNode* node, const char* file, int line, TestMemoryAllocator* allocator, bool allocateNodesSeperately);
+ void checkForCorruption(MemoryLeakDetectorNode* node, const char* file, size_t line, TestMemoryAllocator* allocator, bool allocateNodesSeperately);
};
#endif
diff --git a/include/CppUTest/MemoryLeakDetectorForceInclude.h b/include/CppUTest/MemoryLeakDetectorForceInclude.h
new file mode 100644
index 000000000..6de90e177
--- /dev/null
+++ b/include/CppUTest/MemoryLeakDetectorForceInclude.h
@@ -0,0 +1,4 @@
+// Not all toolchains support multiple force includes (namely IAR),
+// so we wrap the two in a single header.
+#include "MemoryLeakDetectorMallocMacros.h"
+#include "MemoryLeakDetectorNewMacros.h"
diff --git a/include/CppUTest/MemoryLeakDetectorMallocMacros.h b/include/CppUTest/MemoryLeakDetectorMallocMacros.h
index c858fa8ea..42c324796 100644
--- a/include/CppUTest/MemoryLeakDetectorMallocMacros.h
+++ b/include/CppUTest/MemoryLeakDetectorMallocMacros.h
@@ -21,10 +21,10 @@ extern "C"
{
#endif
-extern void* cpputest_malloc_location(size_t size, const char* file, int line);
-extern void* cpputest_calloc_location(size_t count, size_t size, const char* file, int line);
-extern void* cpputest_realloc_location(void *, size_t, const char* file, int line);
-extern void cpputest_free_location(void* buffer, const char* file, int line);
+extern void* cpputest_malloc_location(size_t size, const char* file, size_t line);
+extern void* cpputest_calloc_location(size_t count, size_t size, const char* file, size_t line);
+extern void* cpputest_realloc_location(void *, size_t, const char* file, size_t line);
+extern void cpputest_free_location(void* buffer, const char* file, size_t line);
#ifdef __cplusplus
}
@@ -32,20 +32,6 @@ extern void cpputest_free_location(void* buffer, const char* file, int line);
extern void crash_on_allocation_number(unsigned number);
-#endif
-
-/* NOTE on strdup!
- *
- * strdup was implemented earlier, however it is *not* an Standard C function but a POSIX function.
- * Because of that, it can lead to portability issues by providing more than is available on the local platform.
- * For that reason, strdup is *not* implemented as a macro. If you still want to use it, an easy implementation would be:
- *
- * size_t length = 1 + strlen(str);
- * char* result = (char*) cpputest_malloc_location(length, file, line);
- * memcpy(result, str, length);
- * return result;
- *
- */
#define malloc(a) cpputest_malloc_location(a, __FILE__, __LINE__)
#define calloc(a, b) cpputest_calloc_location(a, b, __FILE__, __LINE__)
@@ -53,4 +39,30 @@ extern void crash_on_allocation_number(unsigned number);
#define free(a) cpputest_free_location(a, __FILE__, __LINE__)
#define CPPUTEST_USE_MALLOC_MACROS 1
+#endif /* CPPUTEST_USE_MALLOC_MACROS */
+
+/* This prevents strdup macros to get defined, unless it has been enabled by the user or generated config */
+#ifdef CPPUTEST_HAVE_STRDUP
+
+/* This prevents the declaration from done twice and makes sure the file only #defines strdup, so it can be included anywhere */
+#ifndef CPPUTEST_USE_STRDUP_MACROS
+
+#ifdef __cplusplus
+extern "C"
+{
#endif
+
+extern char* cpputest_strdup_location(const char* str, const char* file, size_t line);
+extern char* cpputest_strndup_location(const char* str, size_t n, const char* file, size_t line);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define strdup(str) cpputest_strdup_location(str, __FILE__, __LINE__)
+#define strndup(str, n) cpputest_strndup_location(str, n, __FILE__, __LINE__)
+
+#define CPPUTEST_USE_STRDUP_MACROS 1
+#endif /* CPPUTEST_USE_STRDUP_MACROS */
+#endif /* CPPUTEST_HAVE_STRDUP */
+#endif /* CPPUTEST_USE_MEM_LEAK_DETECTION */
diff --git a/include/CppUTest/MemoryLeakDetectorNewMacros.h b/include/CppUTest/MemoryLeakDetectorNewMacros.h
index ccdf2dc03..880b89560 100644
--- a/include/CppUTest/MemoryLeakDetectorNewMacros.h
+++ b/include/CppUTest/MemoryLeakDetectorNewMacros.h
@@ -28,25 +28,68 @@
#ifndef CPPUTEST_USE_NEW_MACROS
#if CPPUTEST_USE_STD_CPP_LIB
+ #ifdef CPPUTEST_USE_STRDUP_MACROS
+ #if CPPUTEST_USE_STRDUP_MACROS == 1
+ /*
+ * Some platforms (OSx, i.e.) will get or included when using header,
+ * in order to avoid conflicts with strdup and strndup macros defined by MemoryLeakDetectorMallocMacros.h
+ * we will undefined those macros, include the C++ headers and then reinclude MemoryLeakDetectorMallocMacros.h.
+ * The check '#if CPPUTEST_USE_STRDUP_MACROS' will ensure we only include MemoryLeakDetectorMallocMacros.h if
+ * it has already been includeded earlier.
+ */
+ #undef strdup
+ #undef strndup
+ #undef CPPUTEST_USE_STRDUP_MACROS
+ #define CPPUTEST_REINCLUDE_MALLOC_MEMORY_LEAK_DETECTOR
+ #endif
+ #endif
#include
#include
#include
+ #ifdef CPPUTEST_REINCLUDE_MALLOC_MEMORY_LEAK_DETECTOR
+ #include "MemoryLeakDetectorMallocMacros.h"
+ #endif
#endif
- void* operator new(size_t size, const char* file, int line) UT_THROW (std::bad_alloc);
- void* operator new[](size_t size, const char* file, int line) UT_THROW (std::bad_alloc);
- void* operator new(size_t size) UT_THROW(std::bad_alloc);
- void* operator new[](size_t size) UT_THROW(std::bad_alloc);
+ /* Some toolkits, e.g. MFC, provide their own new overloads with signature (size_t, const char *, int).
+ * If we don't provide them, in addition to the (size_t, const char *, size_t) version, we don't get to
+ * know about all allocations and report freeing of unallocated blocks. Hence, provide both overloads.
+ */
+
+ void* operator new(size_t size, const char* file, int line) UT_THROW (CPPUTEST_BAD_ALLOC);
+ void* operator new(size_t size, const char* file, size_t line) UT_THROW (CPPUTEST_BAD_ALLOC);
+ void* operator new[](size_t size, const char* file, int line) UT_THROW (CPPUTEST_BAD_ALLOC);
+ void* operator new[](size_t size, const char* file, size_t line) UT_THROW (CPPUTEST_BAD_ALLOC);
+ void* operator new(size_t size) UT_THROW(CPPUTEST_BAD_ALLOC);
+ void* operator new[](size_t size) UT_THROW(CPPUTEST_BAD_ALLOC);
- void operator delete(void* mem) UT_NOTHROW;
- void operator delete[](void* mem) UT_NOTHROW;
void operator delete(void* mem, const char* file, int line) UT_NOTHROW;
+ void operator delete(void* mem, const char* file, size_t line) UT_NOTHROW;
void operator delete[](void* mem, const char* file, int line) UT_NOTHROW;
+ void operator delete[](void* mem, const char* file, size_t line) UT_NOTHROW;
+ void operator delete(void* mem) UT_NOTHROW;
+ void operator delete[](void* mem) UT_NOTHROW;
+#if __cplusplus >= 201402L
+ void operator delete (void* mem, size_t size) UT_NOTHROW;
+ void operator delete[] (void* mem, size_t size) UT_NOTHROW;
+#endif
#endif
+
+#ifdef __clang__
+ #pragma clang diagnostic push
+ #if (__clang_major__ == 3 && __clang_minor__ >= 6) || __clang_major__ >= 4
+ #pragma clang diagnostic ignored "-Wkeyword-macro"
+ #endif
+#endif
+
#define new new(__FILE__, __LINE__)
+#ifdef __clang__
+ #pragma clang diagnostic pop
+#endif
+
#define CPPUTEST_USE_NEW_MACROS 1
#endif
diff --git a/include/CppUTest/MemoryLeakWarningPlugin.h b/include/CppUTest/MemoryLeakWarningPlugin.h
index 701039a31..01ae95be7 100644
--- a/include/CppUTest/MemoryLeakWarningPlugin.h
+++ b/include/CppUTest/MemoryLeakWarningPlugin.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -31,8 +31,8 @@
#include "TestPlugin.h"
#include "MemoryLeakDetectorNewMacros.h"
-#define IGNORE_ALL_LEAKS_IN_TEST() MemoryLeakWarningPlugin::getFirstPlugin()->ignoreAllLeaksInTest();
-#define EXPECT_N_LEAKS(n) MemoryLeakWarningPlugin::getFirstPlugin()->expectLeaksInTest(n);
+#define IGNORE_ALL_LEAKS_IN_TEST() if (MemoryLeakWarningPlugin::getFirstPlugin()) MemoryLeakWarningPlugin::getFirstPlugin()->ignoreAllLeaksInTest()
+#define EXPECT_N_LEAKS(n) if (MemoryLeakWarningPlugin::getFirstPlugin()) MemoryLeakWarningPlugin::getFirstPlugin()->expectLeaksInTest(n)
extern void crash_on_allocation_number(unsigned alloc_number);
@@ -42,16 +42,16 @@ class MemoryLeakFailure;
class MemoryLeakWarningPlugin: public TestPlugin
{
public:
- MemoryLeakWarningPlugin(const SimpleString& name, MemoryLeakDetector* localDetector = 0);
- virtual ~MemoryLeakWarningPlugin();
+ MemoryLeakWarningPlugin(const SimpleString& name, MemoryLeakDetector* localDetector = NULLPTR);
+ virtual ~MemoryLeakWarningPlugin() CPPUTEST_DESTRUCTOR_OVERRIDE;
- virtual void preTestAction(UtestShell& test, TestResult& result) _override;
- virtual void postTestAction(UtestShell& test, TestResult& result) _override;
+ virtual void preTestAction(UtestShell& test, TestResult& result) CPPUTEST_OVERRIDE;
+ virtual void postTestAction(UtestShell& test, TestResult& result) CPPUTEST_OVERRIDE;
- virtual const char* FinalReport(int toBeDeletedLeaks = 0);
+ virtual const char* FinalReport(size_t toBeDeletedLeaks = 0);
void ignoreAllLeaksInTest();
- void expectLeaksInTest(int n);
+ void expectLeaksInTest(size_t n);
void destroyGlobalDetectorAndTurnOffMemoryLeakDetectionInDestructor(bool des);
@@ -65,20 +65,25 @@ class MemoryLeakWarningPlugin: public TestPlugin
static void destroyGlobalDetector();
static void turnOffNewDeleteOverloads();
- static void turnOnNewDeleteOverloads();
+ static void turnOnDefaultNotThreadSafeNewDeleteOverloads();
+ static void turnOnThreadSafeNewDeleteOverloads();
static bool areNewDeleteOverloaded();
+
+ static void saveAndDisableNewDeleteOverloads();
+ static void restoreNewDeleteOverloads();
+
private:
MemoryLeakDetector* memLeakDetector_;
bool ignoreAllWarnings_;
bool destroyGlobalDetectorAndTurnOfMemoryLeakDetectionInDestructor_;
- int expectedLeaks_;
- int failureCount_;
+ size_t expectedLeaks_;
+ size_t failureCount_;
static MemoryLeakWarningPlugin* firstPlugin_;
};
-extern void* cpputest_malloc_location_with_leak_detection(size_t size, const char* file, int line);
-extern void* cpputest_realloc_location_with_leak_detection(void* memory, size_t size, const char* file, int line);
-extern void cpputest_free_location_with_leak_detection(void* buffer, const char* file, int line);
+extern void* cpputest_malloc_location_with_leak_detection(size_t size, const char* file, size_t line);
+extern void* cpputest_realloc_location_with_leak_detection(void* memory, size_t size, const char* file, size_t line);
+extern void cpputest_free_location_with_leak_detection(void* buffer, const char* file, size_t line);
#endif
diff --git a/include/CppUTest/PlatformSpecificFunctions.h b/include/CppUTest/PlatformSpecificFunctions.h
index 6769677a1..3b2f983cc 100644
--- a/include/CppUTest/PlatformSpecificFunctions.h
+++ b/include/CppUTest/PlatformSpecificFunctions.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -32,7 +32,9 @@
TestOutput::WorkingEnvironment PlatformSpecificGetWorkingEnvironment();
class TestPlugin;
-void PlatformSpecificRunTestInASeperateProcess(UtestShell* shell, TestPlugin* plugin, TestResult* result);
+extern void (*PlatformSpecificRunTestInASeperateProcess)(UtestShell* shell, TestPlugin* plugin, TestResult* result);
+extern int (*PlatformSpecificFork)(void);
+extern int (*PlatformSpecificWaitPid)(int pid, int* status, int options);
/* Platform specific interface we use in order to minimize dependencies with LibC.
* This enables porting to different embedded platforms.
diff --git a/include/CppUTest/PlatformSpecificFunctions_c.h b/include/CppUTest/PlatformSpecificFunctions_c.h
index a2d04ff6c..36700818b 100644
--- a/include/CppUTest/PlatformSpecificFunctions_c.h
+++ b/include/CppUTest/PlatformSpecificFunctions_c.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -42,44 +42,53 @@ extern "C" {
#endif
/* Jumping operations. They manage their own jump buffers */
-int PlatformSpecificSetJmp(void (*function) (void*), void* data);
-void PlatformSpecificLongJmp(void);
-void PlatformSpecificRestoreJumpBuffer(void);
+extern int (*PlatformSpecificSetJmp)(void (*function) (void*), void* data);
+extern void (*PlatformSpecificLongJmp)(void);
+extern void (*PlatformSpecificRestoreJumpBuffer)(void);
/* Time operations */
-extern long (*GetPlatformSpecificTimeInMillis)(void);
+extern unsigned long (*GetPlatformSpecificTimeInMillis)(void);
extern const char* (*GetPlatformSpecificTimeString)(void);
/* String operations */
-int PlatformSpecificVSNprintf(char *str, size_t size, const char* format, va_list va_args_list);
+extern int (*PlatformSpecificVSNprintf)(char *str, size_t size, const char* format, va_list va_args_list);
/* Misc */
-double PlatformSpecificFabs(double d);
+extern double (*PlatformSpecificFabs)(double d);
extern int (*PlatformSpecificIsNan)(double d);
-int PlatformSpecificAtExit(void(*func)(void));
+extern int (*PlatformSpecificIsInf)(double d);
+extern int (*PlatformSpecificAtExit)(void(*func)(void));
/* IO operations */
typedef void* PlatformSpecificFile;
-PlatformSpecificFile PlatformSpecificFOpen(const char* filename, const char* flag);
-void PlatformSpecificFPuts(const char* str, PlatformSpecificFile file);
-void PlatformSpecificFClose(PlatformSpecificFile file);
+extern PlatformSpecificFile PlatformSpecificStdOut;
-int PlatformSpecificPutchar(int c);
-void PlatformSpecificFlush(void);
+extern PlatformSpecificFile (*PlatformSpecificFOpen)(const char* filename, const char* flag);
+extern void (*PlatformSpecificFPuts)(const char* str, PlatformSpecificFile file);
+extern void (*PlatformSpecificFClose)(PlatformSpecificFile file);
+
+extern void (*PlatformSpecificFlush)(void);
+
+/* Random operations */
+extern void (*PlatformSpecificSrand)(unsigned int);
+extern int (*PlatformSpecificRand)(void);
/* Dynamic Memory operations */
-void* PlatformSpecificMalloc(size_t size);
-void* PlatformSpecificRealloc(void* memory, size_t size);
-void PlatformSpecificFree(void* memory);
-void* PlatformSpecificMemCpy(void* s1, const void* s2, size_t size);
-void* PlatformSpecificMemset(void* mem, int c, size_t size);
+extern void* (*PlatformSpecificMalloc)(size_t size);
+extern void* (*PlatformSpecificRealloc)(void* memory, size_t size);
+extern void (*PlatformSpecificFree)(void* memory);
+extern void* (*PlatformSpecificMemCpy)(void* s1, const void* s2, size_t size);
+extern void* (*PlatformSpecificMemset)(void* mem, int c, size_t size);
typedef void* PlatformSpecificMutex;
extern PlatformSpecificMutex (*PlatformSpecificMutexCreate)(void);
+extern void (*PlatformSpecificSrand)(unsigned int);
+extern int (*PlatformSpecificRand)(void);
extern void (*PlatformSpecificMutexLock)(PlatformSpecificMutex mtx);
extern void (*PlatformSpecificMutexUnlock)(PlatformSpecificMutex mtx);
extern void (*PlatformSpecificMutexDestroy)(PlatformSpecificMutex mtx);
+extern void (*PlatformSpecificAbort)(void);
#ifdef __cplusplus
}
diff --git a/include/CppUTest/SimpleMutex.h b/include/CppUTest/SimpleMutex.h
index 554ba7a9f..8bb59fb69 100644
--- a/include/CppUTest/SimpleMutex.h
+++ b/include/CppUTest/SimpleMutex.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -42,5 +42,13 @@ class SimpleMutex
};
+class ScopedMutexLock
+{
+public:
+ ScopedMutexLock(SimpleMutex *);
+ ~ScopedMutexLock(void);
+private:
+ SimpleMutex * mutex;
+};
#endif
diff --git a/include/CppUTest/SimpleString.h b/include/CppUTest/SimpleString.h
index 9ad532723..63e7684d0 100644
--- a/include/CppUTest/SimpleString.h
+++ b/include/CppUTest/SimpleString.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -55,13 +55,15 @@ class SimpleString
~SimpleString();
SimpleString& operator=(const SimpleString& other);
- SimpleString operator+(const SimpleString&);
+ SimpleString operator+(const SimpleString&) const;
SimpleString& operator+=(const SimpleString&);
SimpleString& operator+=(const char*);
- char at(int pos) const;
- int find(char ch) const;
- int findFrom(size_t starting_position, char ch) const;
+ static const size_t npos = (size_t) -1;
+
+ char at(size_t pos) const;
+ size_t find(char ch) const;
+ size_t findFrom(size_t starting_position, char ch) const;
bool contains(const SimpleString& other) const;
bool containsNoCase(const SimpleString& other) const;
bool startsWith(const SimpleString& other) const;
@@ -76,10 +78,13 @@ class SimpleString
void replace(const char* to, const char* with);
SimpleString lowerCase() const;
+ SimpleString subString(size_t beginPos) const;
SimpleString subString(size_t beginPos, size_t amount) const;
SimpleString subStringFromTill(char startChar, char lastExcludedChar) const;
void copyToBuffer(char* buffer, size_t bufferSize) const;
+ SimpleString printable() const;
+
const char *asCharString() const;
size_t size() const;
bool isEmpty() const;
@@ -89,25 +94,43 @@ class SimpleString
static TestMemoryAllocator* getStringAllocator();
static void setStringAllocator(TestMemoryAllocator* allocator);
- static char* allocStringBuffer(size_t size);
static int AtoI(const char*str);
+ static unsigned AtoU(const char*str);
static int StrCmp(const char* s1, const char* s2);
static size_t StrLen(const char*);
static int StrNCmp(const char* s1, const char* s2, size_t n);
static char* StrNCpy(char* s1, const char* s2, size_t n);
- static char* StrStr(const char* s1, const char* s2);
+ static const char* StrStr(const char* s1, const char* s2);
static char ToLower(char ch);
- static void deallocStringBuffer(char* str);
+ static int MemCmp(const void* s1, const void *s2, size_t n);
+ static char* allocStringBuffer(size_t size, const char* file, size_t line);
+ static void deallocStringBuffer(char* str, size_t size, const char* file, size_t line);
private:
+
+ const char* getBuffer() const;
+
+ void deallocateInternalBuffer();
+ void setInternalBufferAsEmptyString();
+ void setInternalBufferToNewBuffer(size_t bufferSize);
+ void setInternalBufferTo(char* buffer, size_t bufferSize);
+ void copyBufferToNewInternalBuffer(const char* otherBuffer);
+ void copyBufferToNewInternalBuffer(const char* otherBuffer, size_t bufferSize);
+ void copyBufferToNewInternalBuffer(const SimpleString& otherBuffer);
+
char *buffer_;
+ size_t bufferSize_;
static TestMemoryAllocator* stringAllocator_;
char* getEmptyString() const;
- static char* copyToNewBuffer(const char* bufferToCopy, size_t bufferSize=0);
+ static char* copyToNewBuffer(const char* bufferToCopy, size_t bufferSize);
static bool isDigit(char ch);
static bool isSpace(char ch);
static bool isUpper(char ch);
+ static bool isControl(char ch);
+ static bool isControlWithShortEscapeSequence(char ch);
+
+ size_t getPrintableSize() const;
};
class SimpleStringCollection
@@ -130,8 +153,42 @@ class SimpleStringCollection
SimpleStringCollection(SimpleStringCollection&);
};
+class GlobalSimpleStringAllocatorStash
+{
+public:
+ GlobalSimpleStringAllocatorStash();
+ void save();
+ void restore();
+private:
+ TestMemoryAllocator* originalAllocator_;
+};
+
+class MemoryAccountant;
+class AccountingTestMemoryAllocator;
+
+class GlobalSimpleStringMemoryAccountant
+{
+public:
+ GlobalSimpleStringMemoryAccountant();
+ ~GlobalSimpleStringMemoryAccountant();
+
+ void useCacheSizes(size_t cacheSizes[], size_t length);
+
+ void start();
+ void stop();
+ SimpleString report();
+
+ AccountingTestMemoryAllocator* getAllocator();
+private:
+ void restoreAllocator();
+
+ AccountingTestMemoryAllocator* allocator_;
+ MemoryAccountant* accountant_;
+};
+
SimpleString StringFrom(bool value);
SimpleString StringFrom(const void* value);
+SimpleString StringFrom(void (*value)());
SimpleString StringFrom(char value);
SimpleString StringFrom(const char *value);
SimpleString StringFromOrNull(const char * value);
@@ -139,18 +196,46 @@ SimpleString StringFrom(int value);
SimpleString StringFrom(unsigned int value);
SimpleString StringFrom(long value);
SimpleString StringFrom(unsigned long value);
+SimpleString StringFrom(cpputest_longlong value);
+SimpleString StringFrom(cpputest_ulonglong value);
+SimpleString HexStringFrom(unsigned int value);
+SimpleString HexStringFrom(int value);
+SimpleString HexStringFrom(signed char value);
SimpleString HexStringFrom(long value);
SimpleString HexStringFrom(unsigned long value);
+SimpleString HexStringFrom(cpputest_longlong value);
+SimpleString HexStringFrom(cpputest_ulonglong value);
SimpleString HexStringFrom(const void* value);
+SimpleString HexStringFrom(void (*value)());
SimpleString StringFrom(double value, int precision = 6);
SimpleString StringFrom(const SimpleString& other);
-SimpleString StringFromFormat(const char* format, ...) __check_format__(printf, 1, 2);
+SimpleString StringFromFormat(const char* format, ...) CPPUTEST_CHECK_FORMAT(CPPUTEST_CHECK_FORMAT_TYPE, 1, 2);
SimpleString VStringFromFormat(const char* format, va_list args);
+SimpleString StringFromBinary(const unsigned char* value, size_t size);
+SimpleString StringFromBinaryOrNull(const unsigned char* value, size_t size);
+SimpleString StringFromBinaryWithSize(const unsigned char* value, size_t size);
+SimpleString StringFromBinaryWithSizeOrNull(const unsigned char* value, size_t size);
+SimpleString StringFromMaskedBits(unsigned long value, unsigned long mask, size_t byteCount);
+SimpleString StringFromOrdinalNumber(unsigned int number);
+SimpleString BracketsFormattedHexStringFrom(int value);
+SimpleString BracketsFormattedHexStringFrom(unsigned int value);
+SimpleString BracketsFormattedHexStringFrom(long value);
+SimpleString BracketsFormattedHexStringFrom(unsigned long value);
+SimpleString BracketsFormattedHexStringFrom(cpputest_longlong value);
+SimpleString BracketsFormattedHexStringFrom(cpputest_ulonglong value);
+SimpleString BracketsFormattedHexStringFrom(signed char value);
+SimpleString BracketsFormattedHexString(SimpleString hexString);
+SimpleString PrintableStringFromOrNull(const char * expected);
-#if CPPUTEST_USE_STD_CPP_LIB
+/*
+ * ARM compiler has only partial support for C++11.
+ * Specifically nullptr_t is not officially supported
+ */
+#if __cplusplus > 199711L && !defined __arm__ && CPPUTEST_USE_STD_CPP_LIB
+SimpleString StringFrom(const std::nullptr_t value);
+#endif
-#include
-#include
+#if CPPUTEST_USE_STD_CPP_LIB
SimpleString StringFrom(const std::string& other);
diff --git a/include/CppUTest/SimpleStringInternalCache.h b/include/CppUTest/SimpleStringInternalCache.h
new file mode 100644
index 000000000..ebbd30f6b
--- /dev/null
+++ b/include/CppUTest/SimpleStringInternalCache.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of the nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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.
+ */
+
+#ifndef D_SimpleStringInternalCache_h
+#define D_SimpleStringInternalCache_h
+
+#include "CppUTest/TestMemoryAllocator.h"
+
+struct SimpleStringMemoryBlock;
+struct SimpleStringInternalCacheNode;
+
+class SimpleStringInternalCache
+{
+public:
+ SimpleStringInternalCache();
+ ~SimpleStringInternalCache();
+
+ void setAllocator(TestMemoryAllocator* allocator);
+
+ char* alloc(size_t size);
+ void dealloc(char* memory, size_t size);
+
+ bool hasFreeBlocksOfSize(size_t size);
+
+ void clearCache();
+ void clearAllIncludingCurrentlyUsedMemory();
+private:
+ void printDeallocatingUnknownMemory(char* memory);
+
+ enum { amountOfInternalCacheNodes = 5};
+ bool isCached(size_t size);
+ size_t getIndexForCache(size_t size);
+ SimpleStringInternalCacheNode* getCacheNodeFromSize(size_t size);
+
+ SimpleStringInternalCacheNode* createInternalCacheNodes();
+ void destroyInternalCacheNode(SimpleStringInternalCacheNode * node);
+ SimpleStringMemoryBlock* createSimpleStringMemoryBlock(size_t sizeOfString, SimpleStringMemoryBlock* next);
+ void destroySimpleStringMemoryBlock(SimpleStringMemoryBlock * block, size_t size);
+ void destroySimpleStringMemoryBlockList(SimpleStringMemoryBlock * block, size_t size);
+
+ SimpleStringMemoryBlock* reserveCachedBlockFrom(SimpleStringInternalCacheNode* node);
+ void releaseCachedBlockFrom(char* memory, SimpleStringInternalCacheNode* node);
+ void releaseNonCachedMemory(char* memory, size_t size);
+
+ SimpleStringMemoryBlock* allocateNewCacheBlockFrom(SimpleStringInternalCacheNode* node);
+ SimpleStringMemoryBlock* addToSimpleStringMemoryBlockList(SimpleStringMemoryBlock* newBlock, SimpleStringMemoryBlock* previousHead);
+
+ TestMemoryAllocator* allocator_;
+ SimpleStringInternalCacheNode* cache_;
+ SimpleStringMemoryBlock* nonCachedAllocations_;
+ bool hasWarnedAboutDeallocations;
+};
+
+class SimpleStringCacheAllocator : public TestMemoryAllocator
+{
+public:
+ SimpleStringCacheAllocator(SimpleStringInternalCache& cache, TestMemoryAllocator* previousAllocator);
+ virtual ~SimpleStringCacheAllocator() CPPUTEST_DESTRUCTOR_OVERRIDE;
+
+ virtual char* alloc_memory(size_t size, const char* file, size_t line) CPPUTEST_OVERRIDE;
+ virtual void free_memory(char* memory, size_t size, const char* file, size_t line) CPPUTEST_OVERRIDE;
+
+ virtual const char* name() const CPPUTEST_OVERRIDE;
+ virtual const char* alloc_name() const CPPUTEST_OVERRIDE;
+ virtual const char* free_name() const CPPUTEST_OVERRIDE;
+
+ virtual TestMemoryAllocator* actualAllocator() CPPUTEST_OVERRIDE;
+ TestMemoryAllocator* originalAllocator();
+private:
+ SimpleStringInternalCache& cache_;
+ TestMemoryAllocator* originalAllocator_;
+};
+
+class GlobalSimpleStringCache
+{
+ SimpleStringCacheAllocator* allocator_;
+ SimpleStringInternalCache cache_;
+
+public:
+ GlobalSimpleStringCache();
+ ~GlobalSimpleStringCache();
+
+ TestMemoryAllocator* getAllocator();
+};
+
+#endif
diff --git a/include/CppUTest/StandardCLibrary.h b/include/CppUTest/StandardCLibrary.h
index 6e352fb5d..d518236ca 100644
--- a/include/CppUTest/StandardCLibrary.h
+++ b/include/CppUTest/StandardCLibrary.h
@@ -1,9 +1,10 @@
+/* Must include this first to ensure the StandardC include in CppUTestConfig still happens at the right moment */
+#include "CppUTestConfig.h"
+
#ifndef STANDARDCLIBRARY_H_
#define STANDARDCLIBRARY_H_
-#include "CppUTestConfig.h"
-
#if CPPUTEST_USE_STD_C_LIB
/* Needed for size_t */
@@ -13,15 +14,41 @@
#ifdef __cplusplus
#if CPPUTEST_USE_STD_CPP_LIB
#include
+ #include
+ #include
#endif
#endif
/* Needed for malloc */
#include
+/* Needed for std::nullptr */
+#ifdef __cplusplus
+ #if CPPUTEST_USE_STD_CPP_LIB
+ #include
+ #endif
+#endif
+
/* Needed for ... */
#include
+/* Kludge to get a va_copy in VC++ V6 and in GCC 98 */
+#ifndef va_copy
+#ifdef __GNUC__
+#define va_copy __va_copy
+#else
+#define va_copy(copy, original) copy = original;
+#endif
+#endif
+
+/* Needed for some detection of long long and 64 bit */
+#include
+
+/* Needed to ensure that string.h is included prior to strdup redefinition */
+#ifdef CPPUTEST_HAVE_STRDUP
+#include
+#endif
+
#else
#ifdef __KERNEL__
@@ -52,14 +79,23 @@ typedef __SIZE_TYPE__ size_t;
typedef long unsigned int size_t;
#endif
-typedef char* va_list;
#define NULL (0)
+#ifdef __cplusplus
+extern "C" {
+#endif
extern void* malloc(size_t);
extern void free(void *);
+#ifdef __cplusplus
+}
+#endif
+
#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
-#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,sizeof(int)-1))))
-#define va_end(ap) (void) 0
+
+#define va_list __builtin_va_list
+#define va_copy __builtin_va_copy
+#define va_start __builtin_va_start
+#define va_end __builtin_va_end
#endif
diff --git a/include/CppUTest/TeamCityTestOutput.h b/include/CppUTest/TeamCityTestOutput.h
new file mode 100644
index 000000000..caf67d586
--- /dev/null
+++ b/include/CppUTest/TeamCityTestOutput.h
@@ -0,0 +1,28 @@
+#ifndef D_TeamCityTestOutput_h
+#define D_TeamCityTestOutput_h
+
+#include "TestOutput.h"
+#include "SimpleString.h"
+
+class TeamCityTestOutput: public ConsoleTestOutput
+{
+public:
+ TeamCityTestOutput(void);
+ virtual ~TeamCityTestOutput(void) CPPUTEST_DESTRUCTOR_OVERRIDE;
+
+ virtual void printCurrentTestStarted(const UtestShell& test) CPPUTEST_OVERRIDE;
+ virtual void printCurrentTestEnded(const TestResult& res) CPPUTEST_OVERRIDE;
+ virtual void printCurrentGroupStarted(const UtestShell& test) CPPUTEST_OVERRIDE;
+ virtual void printCurrentGroupEnded(const TestResult& res) CPPUTEST_OVERRIDE;
+
+ virtual void printFailure(const TestFailure& failure) CPPUTEST_OVERRIDE;
+
+protected:
+
+private:
+ void printEscaped(const char* s);
+ const UtestShell *currtest_;
+ SimpleString currGroup_;
+};
+
+#endif
diff --git a/include/CppUTest/TestFailure.h b/include/CppUTest/TestFailure.h
index a7df2c269..7dc816f2c 100644
--- a/include/CppUTest/TestFailure.h
+++ b/include/CppUTest/TestFailure.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -38,6 +38,10 @@
#include "SimpleString.h"
+#if CPPUTEST_USE_STD_CPP_LIB
+#include
+#endif
+
class UtestShell;
class TestOutput;
@@ -45,33 +49,34 @@ class TestFailure
{
public:
- TestFailure(UtestShell*, const char* fileName, int lineNumber,
- const SimpleString& theMessage);
+ TestFailure(UtestShell*, const char* fileName, size_t lineNumber, const SimpleString& theMessage);
TestFailure(UtestShell*, const SimpleString& theMessage);
- TestFailure(UtestShell*, const char* fileName, int lineNumber);
+ TestFailure(UtestShell*, const char* fileName, size_t lineNumber);
TestFailure(const TestFailure&);
virtual ~TestFailure();
virtual SimpleString getFileName() const;
virtual SimpleString getTestName() const;
- virtual int getFailureLineNumber() const;
+ virtual SimpleString getTestNameOnly() const;
+ virtual size_t getFailureLineNumber() const;
virtual SimpleString getMessage() const;
virtual SimpleString getTestFileName() const;
- virtual int getTestLineNumber() const;
+ virtual size_t getTestLineNumber() const;
bool isOutsideTestFile() const;
bool isInHelperFunction() const;
protected:
-
SimpleString createButWasString(const SimpleString& expected, const SimpleString& actual);
- SimpleString createDifferenceAtPosString(const SimpleString& actual, size_t position);
+ SimpleString createDifferenceAtPosString(const SimpleString& actual, size_t offset, size_t reportedPosition);
+ SimpleString createUserText(const SimpleString& text);
SimpleString testName_;
+ SimpleString testNameOnly_;
SimpleString fileName_;
- int lineNumber_;
+ size_t lineNumber_;
SimpleString testFileName_;
- int testLineNumber_;
+ size_t testLineNumber_;
SimpleString message_;
TestFailure& operator=(const TestFailure&);
@@ -81,63 +86,115 @@ class TestFailure
class EqualsFailure: public TestFailure
{
public:
- EqualsFailure(UtestShell*, const char* fileName, int lineNumber, const char* expected, const char* actual);
- EqualsFailure(UtestShell*, const char* fileName, int lineNumber, const SimpleString& expected, const SimpleString& actual);
+ EqualsFailure(UtestShell*, const char* fileName, size_t lineNumber, const char* expected, const char* actual, const SimpleString& text);
+ EqualsFailure(UtestShell*, const char* fileName, size_t lineNumber, const SimpleString& expected, const SimpleString& actual, const SimpleString& text);
};
class DoublesEqualFailure: public TestFailure
{
public:
- DoublesEqualFailure(UtestShell*, const char* fileName, int lineNumber, double expected, double actual, double threshold);
+ DoublesEqualFailure(UtestShell*, const char* fileName, size_t lineNumber, double expected, double actual, double threshold, const SimpleString& text);
};
class CheckEqualFailure : public TestFailure
{
public:
- CheckEqualFailure(UtestShell* test, const char* fileName, int lineNumber, const SimpleString& expected, const SimpleString& actual);
+ CheckEqualFailure(UtestShell* test, const char* fileName, size_t lineNumber, const SimpleString& expected, const SimpleString& actual, const SimpleString& text);
};
-class ContainsFailure: public TestFailure
+class ComparisonFailure : public TestFailure
{
public:
- ContainsFailure(UtestShell*, const char* fileName, int lineNumber, const SimpleString& expected, const SimpleString& actual);
+ ComparisonFailure(UtestShell* test, const char *fileName, size_t lineNumber, const SimpleString& checkString, const SimpleString& comparisonString, const SimpleString& text);
+};
+class ContainsFailure: public TestFailure
+{
+public:
+ ContainsFailure(UtestShell*, const char* fileName, size_t lineNumber, const SimpleString& expected, const SimpleString& actual, const SimpleString& text);
};
class CheckFailure : public TestFailure
{
public:
- CheckFailure(UtestShell* test, const char* fileName, int lineNumber, const SimpleString& checkString, const SimpleString& conditionString, const SimpleString& textString = "");
+ CheckFailure(UtestShell* test, const char* fileName, size_t lineNumber, const SimpleString& checkString, const SimpleString& conditionString, const SimpleString& textString = "");
};
class FailFailure : public TestFailure
{
public:
- FailFailure(UtestShell* test, const char* fileName, int lineNumber, const SimpleString& message);
+ FailFailure(UtestShell* test, const char* fileName, size_t lineNumber, const SimpleString& message);
};
class LongsEqualFailure : public TestFailure
{
public:
- LongsEqualFailure(UtestShell* test, const char* fileName, int lineNumber, long expected, long actual);
+ LongsEqualFailure(UtestShell* test, const char* fileName, size_t lineNumber, long expected, long actual, const SimpleString& text);
};
class UnsignedLongsEqualFailure : public TestFailure
{
public:
- UnsignedLongsEqualFailure(UtestShell* test, const char* fileName, int lineNumber, unsigned long expected, unsigned long actual);
+ UnsignedLongsEqualFailure(UtestShell* test, const char* fileName, size_t lineNumber, unsigned long expected, unsigned long actual, const SimpleString& text);
+};
+
+class LongLongsEqualFailure : public TestFailure
+{
+public:
+ LongLongsEqualFailure(UtestShell* test, const char* fileName, size_t lineNumber, cpputest_longlong expected, cpputest_longlong actual, const SimpleString& text);
+};
+
+class UnsignedLongLongsEqualFailure : public TestFailure
+{
+public:
+ UnsignedLongLongsEqualFailure(UtestShell* test, const char* fileName, size_t lineNumber, cpputest_ulonglong expected, cpputest_ulonglong actual, const SimpleString& text);
+};
+
+class SignedBytesEqualFailure : public TestFailure
+{
+public:
+ SignedBytesEqualFailure (UtestShell* test, const char* fileName, size_t lineNumber, signed char expected, signed char actual, const SimpleString& text);
};
class StringEqualFailure : public TestFailure
{
public:
- StringEqualFailure(UtestShell* test, const char* fileName, int lineNumber, const char* expected, const char* actual);
+ StringEqualFailure(UtestShell* test, const char* fileName, size_t lineNumber, const char* expected, const char* actual, const SimpleString& text);
};
class StringEqualNoCaseFailure : public TestFailure
{
public:
- StringEqualNoCaseFailure(UtestShell* test, const char* fileName, int lineNumber, const char* expected, const char* actual);
+ StringEqualNoCaseFailure(UtestShell* test, const char* fileName, size_t lineNumber, const char* expected, const char* actual, const SimpleString& text);
+};
+
+class BinaryEqualFailure : public TestFailure
+{
+public:
+ BinaryEqualFailure(UtestShell* test, const char* fileName, size_t lineNumber, const unsigned char* expected, const unsigned char* actual, size_t size, const SimpleString& text);
};
+class BitsEqualFailure : public TestFailure
+{
+public:
+ BitsEqualFailure(UtestShell* test, const char* fileName, size_t lineNumber, unsigned long expected, unsigned long actual, unsigned long mask, size_t byteCount, const SimpleString& text);
+};
+
+class FeatureUnsupportedFailure : public TestFailure
+{
+public:
+ FeatureUnsupportedFailure(UtestShell* test, const char* fileName, size_t lineNumber, const SimpleString& featureName, const SimpleString& text);
+};
+
+#if CPPUTEST_HAVE_EXCEPTIONS
+class UnexpectedExceptionFailure : public TestFailure
+{
+public:
+ UnexpectedExceptionFailure(UtestShell* test);
+#if CPPUTEST_USE_STD_CPP_LIB
+ UnexpectedExceptionFailure(UtestShell* test, const std::exception &e);
+#endif
+};
+#endif
+
#endif
diff --git a/include/CppUTest/TestFilter.h b/include/CppUTest/TestFilter.h
index fcaea29b3..730f52e14 100644
--- a/include/CppUTest/TestFilter.h
+++ b/include/CppUTest/TestFilter.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -37,13 +37,14 @@ class TestFilter
TestFilter();
TestFilter(const char* filter);
TestFilter(const SimpleString& filter);
-
+
TestFilter* add(TestFilter* filter);
TestFilter* getNext() const;
bool match(const SimpleString& name) const;
void strictMatching();
+ void invertMatching();
bool operator==(const TestFilter& filter) const;
bool operator!=(const TestFilter& filter) const;
@@ -52,6 +53,7 @@ class TestFilter
private:
SimpleString filter_;
bool strictMatching_;
+ bool invertMatching_;
TestFilter* next_;
};
diff --git a/include/CppUTest/TestHarness.h b/include/CppUTest/TestHarness.h
index 8eb5b29bf..a4f1a8f71 100644
--- a/include/CppUTest/TestHarness.h
+++ b/include/CppUTest/TestHarness.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
diff --git a/include/CppUTest/TestHarness_c.h b/include/CppUTest/TestHarness_c.h
index 519a9d53c..f3a64cf83 100644
--- a/include/CppUTest/TestHarness_c.h
+++ b/include/CppUTest/TestHarness_c.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -36,17 +36,95 @@
#include "CppUTestConfig.h"
+#define CHECK_EQUAL_C_BOOL(expected,actual) \
+ CHECK_EQUAL_C_BOOL_LOCATION(expected,actual,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_BOOL_TEXT(expected,actual,text) \
+ CHECK_EQUAL_C_BOOL_LOCATION(expected,actual,text,__FILE__,__LINE__)
+
#define CHECK_EQUAL_C_INT(expected,actual) \
- CHECK_EQUAL_C_INT_LOCATION(expected,actual,__FILE__,__LINE__)
+ CHECK_EQUAL_C_INT_LOCATION(expected,actual,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_INT_TEXT(expected,actual,text) \
+ CHECK_EQUAL_C_INT_LOCATION(expected,actual,text,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_UINT(expected,actual) \
+ CHECK_EQUAL_C_UINT_LOCATION(expected,actual,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_UINT_TEXT(expected,actual,text) \
+ CHECK_EQUAL_C_UINT_LOCATION(expected,actual,text,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_LONG(expected,actual) \
+ CHECK_EQUAL_C_LONG_LOCATION(expected,actual,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_LONG_TEXT(expected,actual,text) \
+ CHECK_EQUAL_C_LONG_LOCATION(expected,actual,text,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_ULONG(expected,actual) \
+ CHECK_EQUAL_C_ULONG_LOCATION(expected,actual,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_ULONG_TEXT(expected,actual,text) \
+ CHECK_EQUAL_C_ULONG_LOCATION(expected,actual,text,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_LONGLONG(expected,actual) \
+ CHECK_EQUAL_C_LONGLONG_LOCATION(expected,actual,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_LONGLONG_TEXT(expected,actual,text) \
+ CHECK_EQUAL_C_LONGLONG_LOCATION(expected,actual,text,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_ULONGLONG(expected,actual) \
+ CHECK_EQUAL_C_ULONGLONG_LOCATION(expected,actual,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_ULONGLONG_TEXT(expected,actual,text) \
+ CHECK_EQUAL_C_ULONGLONG_LOCATION(expected,actual,text,__FILE__,__LINE__)
#define CHECK_EQUAL_C_REAL(expected,actual,threshold) \
- CHECK_EQUAL_C_REAL_LOCATION(expected,actual,threshold,__FILE__,__LINE__)
+ CHECK_EQUAL_C_REAL_LOCATION(expected,actual,threshold,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_REAL_TEXT(expected,actual,threshold,text) \
+ CHECK_EQUAL_C_REAL_LOCATION(expected,actual,threshold,text,__FILE__,__LINE__)
#define CHECK_EQUAL_C_CHAR(expected,actual) \
- CHECK_EQUAL_C_CHAR_LOCATION(expected,actual,__FILE__,__LINE__)
+ CHECK_EQUAL_C_CHAR_LOCATION(expected,actual,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_CHAR_TEXT(expected,actual,text) \
+ CHECK_EQUAL_C_CHAR_LOCATION(expected,actual,text,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_UBYTE(expected,actual) \
+ CHECK_EQUAL_C_UBYTE_LOCATION(expected,actual,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_UBYTE_TEXT(expected,actual,text) \
+ CHECK_EQUAL_C_UBYTE_LOCATION(expected,actual,text,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_SBYTE(expected,actual) \
+ CHECK_EQUAL_C_SBYTE_LOCATION(expected,actual,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_SBYTE_TEXT(expected,actual,text) \
+ CHECK_EQUAL_C_SBYTE_LOCATION(expected,actual,text,__FILE__,__LINE__)
#define CHECK_EQUAL_C_STRING(expected,actual) \
- CHECK_EQUAL_C_STRING_LOCATION(expected,actual,__FILE__,__LINE__)
+ CHECK_EQUAL_C_STRING_LOCATION(expected,actual,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_STRING_TEXT(expected,actual,text) \
+ CHECK_EQUAL_C_STRING_LOCATION(expected,actual,text,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_POINTER(expected,actual) \
+ CHECK_EQUAL_C_POINTER_LOCATION(expected,actual,NULL,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_POINTER_TEXT(expected,actual,text) \
+ CHECK_EQUAL_C_POINTER_LOCATION(expected,actual,text,__FILE__,__LINE__)
+
+#define CHECK_EQUAL_C_MEMCMP(expected, actual, size) \
+ CHECK_EQUAL_C_MEMCMP_LOCATION(expected, actual, size, NULL, __FILE__, __LINE__)
+
+#define CHECK_EQUAL_C_MEMCMP_TEXT(expected, actual, size, text) \
+ CHECK_EQUAL_C_MEMCMP_LOCATION(expected, actual, size, text, __FILE__, __LINE__)
+
+#define CHECK_EQUAL_C_BITS(expected, actual, mask) \
+ CHECK_EQUAL_C_BITS_LOCATION(expected, actual, mask, sizeof(actual), NULL, __FILE__, __LINE__)
+
+#define CHECK_EQUAL_C_BITS_TEXT(expected, actual, mask, text) \
+ CHECK_EQUAL_C_BITS_LOCATION(expected, actual, mask, sizeof(actual), text, __FILE__, __LINE__)
#define FAIL_TEXT_C(text) \
FAIL_TEXT_C_LOCATION(text,__FILE__,__LINE__)
@@ -55,8 +133,10 @@
FAIL_C_LOCATION(__FILE__,__LINE__)
#define CHECK_C(condition) \
- CHECK_C_LOCATION(condition, #condition, __FILE__,__LINE__)
+ CHECK_C_LOCATION(condition, #condition, NULL, __FILE__,__LINE__)
+#define CHECK_C_TEXT(condition, text) \
+ CHECK_C_LOCATION(condition, #condition, text, __FILE__, __LINE__)
/******************************************************************************
*
@@ -67,15 +147,19 @@
/* For use in C file */
#define TEST_GROUP_C_SETUP(group_name) \
extern void group_##group_name##_setup_wrapper_c(void); \
- void group_##group_name##_setup_wrapper_c()
+ void group_##group_name##_setup_wrapper_c(void)
#define TEST_GROUP_C_TEARDOWN(group_name) \
extern void group_##group_name##_teardown_wrapper_c(void); \
- void group_##group_name##_teardown_wrapper_c()
+ void group_##group_name##_teardown_wrapper_c(void)
#define TEST_C(group_name, test_name) \
extern void test_##group_name##_##test_name##_wrapper_c(void);\
- void test_##group_name##_##test_name##_wrapper_c()
+ void test_##group_name##_##test_name##_wrapper_c(void)
+
+#define IGNORE_TEST_C(group_name, test_name) \
+ extern void ignore_##group_name##_##test_name##_wrapper_c(void);\
+ void ignore_##group_name##_##test_name##_wrapper_c(void)
/* For use in C++ file */
@@ -86,12 +170,12 @@
TEST_GROUP(group_name)
#define TEST_GROUP_C_SETUP_WRAPPER(group_name) \
- void setup() { \
+ void setup() CPPUTEST_OVERRIDE { \
group_##group_name##_setup_wrapper_c(); \
}
#define TEST_GROUP_C_TEARDOWN_WRAPPER(group_name) \
- void teardown() { \
+ void teardown() CPPUTEST_OVERRIDE { \
group_##group_name##_teardown_wrapper_c(); \
}
@@ -101,6 +185,12 @@
test_##group_name##_##test_name##_wrapper_c(); \
}
+#define IGNORE_TEST_C_WRAPPER(group_name, test_name) \
+ extern "C" void ignore_##group_name##_##test_name##_wrapper_c(); \
+ IGNORE_TEST(group_name, test_name) { \
+ ignore_##group_name##_##test_name##_wrapper_c(); \
+ }
+
#ifdef __cplusplus
extern "C"
{
@@ -108,31 +198,38 @@ extern "C"
/* CHECKS that can be used from C code */
-extern void CHECK_EQUAL_C_INT_LOCATION(int expected, int actual,
- const char* fileName, int lineNumber);
-extern void CHECK_EQUAL_C_REAL_LOCATION(double expected, double actual,
- double threshold, const char* fileName, int lineNumber);
-extern void CHECK_EQUAL_C_CHAR_LOCATION(char expected, char actual,
- const char* fileName, int lineNumber);
-extern void CHECK_EQUAL_C_STRING_LOCATION(const char* expected,
- const char* actual, const char* fileName, int lineNumber);
-extern void FAIL_TEXT_C_LOCATION(const char* text, const char* fileName,
- int lineNumber);
-extern void FAIL_C_LOCATION(const char* fileName, int lineNumber);
-extern void CHECK_C_LOCATION(int condition, const char* conditionString,
- const char* fileName, int lineNumber);
+extern void CHECK_EQUAL_C_BOOL_LOCATION(int expected, int actual, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_INT_LOCATION(int expected, int actual, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_UINT_LOCATION(unsigned int expected, unsigned int actual, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_LONG_LOCATION(long expected, long actual, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_ULONG_LOCATION(unsigned long expected, unsigned long actual, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_LONGLONG_LOCATION(cpputest_longlong expected, cpputest_longlong actual, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_ULONGLONG_LOCATION(cpputest_ulonglong expected, cpputest_ulonglong actual, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_REAL_LOCATION(double expected, double actual, double threshold, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_CHAR_LOCATION(char expected, char actual, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_UBYTE_LOCATION(unsigned char expected, unsigned char actual, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_SBYTE_LOCATION(signed char expected, signed char actual, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_STRING_LOCATION(const char* expected, const char* actual, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_POINTER_LOCATION(const void* expected, const void* actual, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_MEMCMP_LOCATION(const void* expected, const void* actual, size_t size, const char* text, const char* fileName, size_t lineNumber);
+extern void CHECK_EQUAL_C_BITS_LOCATION(unsigned int expected, unsigned int actual, unsigned int mask, size_t size, const char* text, const char* fileName, size_t lineNumber);
+extern void FAIL_TEXT_C_LOCATION(const char* text, const char* fileName, size_t lineNumber);
+extern void FAIL_C_LOCATION(const char* fileName, size_t lineNumber);
+extern void CHECK_C_LOCATION(int condition, const char* conditionString, const char* text, const char* fileName, size_t lineNumber);
extern void* cpputest_malloc(size_t size);
+extern char* cpputest_strdup(const char* str);
+extern char* cpputest_strndup(const char* str, size_t n);
extern void* cpputest_calloc(size_t num, size_t size);
extern void* cpputest_realloc(void* ptr, size_t size);
extern void cpputest_free(void* buffer);
-extern void* cpputest_malloc_location(size_t size, const char* file, int line);
-extern void* cpputest_calloc_location(size_t num, size_t size,
- const char* file, int line);
-extern void* cpputest_realloc_location(void* memory, size_t size,
- const char* file, int line);
-extern void cpputest_free_location(void* buffer, const char* file, int line);
+extern void* cpputest_malloc_location(size_t size, const char* file, size_t line);
+extern char* cpputest_strdup_location(const char* str, const char* file, size_t line);
+extern char* cpputest_strndup_location(const char* str, size_t n, const char* file, size_t line);
+extern void* cpputest_calloc_location(size_t num, size_t size, const char* file, size_t line);
+extern void* cpputest_realloc_location(void* memory, size_t size, const char* file, size_t line);
+extern void cpputest_free_location(void* buffer, const char* file, size_t line);
void cpputest_malloc_set_out_of_memory(void);
void cpputest_malloc_set_not_out_of_memory(void);
@@ -151,7 +248,7 @@ int cpputest_malloc_get_count(void);
*/
#ifndef PUNUSED
-#if defined(__GNUC__)
+#if defined(__GNUC__) || defined(__clang__)
# define PUNUSED(x) PUNUSED_ ##x __attribute__((unused))
#else
# define PUNUSED(x) x
diff --git a/include/CppUTest/TestMemoryAllocator.h b/include/CppUTest/TestMemoryAllocator.h
index 4c7f45820..8f65bf508 100644
--- a/include/CppUTest/TestMemoryAllocator.h
+++ b/include/CppUTest/TestMemoryAllocator.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -46,6 +46,19 @@ extern TestMemoryAllocator* getCurrentMallocAllocator();
extern void setCurrentMallocAllocatorToDefault();
extern TestMemoryAllocator* defaultMallocAllocator();
+class GlobalMemoryAllocatorStash
+{
+public:
+ GlobalMemoryAllocatorStash();
+ void save();
+ void restore();
+
+private:
+ TestMemoryAllocator* originalMallocAllocator;
+ TestMemoryAllocator* originalNewAllocator;
+ TestMemoryAllocator* originalNewArrayAllocator;
+};
+
class TestMemoryAllocator
{
public:
@@ -53,18 +66,20 @@ class TestMemoryAllocator
virtual ~TestMemoryAllocator();
bool hasBeenDestroyed();
- virtual char* alloc_memory(size_t size, const char* file, int line);
- virtual void free_memory(char* memory, const char* file, int line);
+ virtual char* alloc_memory(size_t size, const char* file, size_t line);
+ virtual void free_memory(char* memory, size_t size, const char* file, size_t line);
- virtual const char* name();
- virtual const char* alloc_name();
- virtual const char* free_name();
+ virtual const char* name() const;
+ virtual const char* alloc_name() const;
+ virtual const char* free_name() const;
virtual bool isOfEqualType(TestMemoryAllocator* allocator);
virtual char* allocMemoryLeakNode(size_t size);
virtual void freeMemoryLeakNode(char* memory);
+ virtual TestMemoryAllocator* actualAllocator();
+
protected:
const char* name_;
@@ -74,15 +89,34 @@ class TestMemoryAllocator
bool hasBeenDestroyed_;
};
+class MemoryLeakAllocator : public TestMemoryAllocator
+{
+public:
+ MemoryLeakAllocator(TestMemoryAllocator* originalAllocator);
+ virtual ~MemoryLeakAllocator() CPPUTEST_DESTRUCTOR_OVERRIDE;
+
+ virtual char* alloc_memory(size_t size, const char* file, size_t line) CPPUTEST_OVERRIDE;
+ virtual void free_memory(char* memory, size_t size, const char* file, size_t line) CPPUTEST_OVERRIDE;
+
+ virtual const char* name() const CPPUTEST_OVERRIDE;
+ virtual const char* alloc_name() const CPPUTEST_OVERRIDE;
+ virtual const char* free_name() const CPPUTEST_OVERRIDE;
+
+ virtual TestMemoryAllocator* actualAllocator() CPPUTEST_OVERRIDE;
+private:
+ TestMemoryAllocator* originalAllocator_;
+};
+
class CrashOnAllocationAllocator : public TestMemoryAllocator
{
unsigned allocationToCrashOn_;
public:
CrashOnAllocationAllocator();
+ virtual ~CrashOnAllocationAllocator() CPPUTEST_DESTRUCTOR_OVERRIDE;
virtual void setNumberToCrashOn(unsigned allocationToCrashOn);
- virtual char* alloc_memory(size_t size, const char* file, int line) _override;
+ virtual char* alloc_memory(size_t size, const char* file, size_t line) CPPUTEST_OVERRIDE;
};
@@ -90,11 +124,138 @@ class NullUnknownAllocator: public TestMemoryAllocator
{
public:
NullUnknownAllocator();
- virtual char* alloc_memory(size_t size, const char* file, int line) _override;
- virtual void free_memory(char* memory, const char* file, int line) _override;
+ virtual ~NullUnknownAllocator() CPPUTEST_DESTRUCTOR_OVERRIDE;
+
+ virtual char* alloc_memory(size_t size, const char* file, size_t line) CPPUTEST_OVERRIDE;
+ virtual void free_memory(char* memory, size_t size, const char* file, size_t line) CPPUTEST_OVERRIDE;
static TestMemoryAllocator* defaultAllocator();
};
+class LocationToFailAllocNode;
+
+class FailableMemoryAllocator: public TestMemoryAllocator
+{
+public:
+ FailableMemoryAllocator(const char* name_str = "failable alloc", const char* alloc_name_str = "alloc", const char* free_name_str = "free");
+ virtual ~FailableMemoryAllocator() CPPUTEST_DESTRUCTOR_OVERRIDE;
+
+ virtual char* alloc_memory(size_t size, const char* file, size_t line) CPPUTEST_OVERRIDE;
+ virtual char* allocMemoryLeakNode(size_t size) CPPUTEST_OVERRIDE;
+
+ virtual void failAllocNumber(int number);
+ virtual void failNthAllocAt(int allocationNumber, const char* file, size_t line);
+
+ virtual void checkAllFailedAllocsWereDone();
+ virtual void clearFailedAllocs();
+
+protected:
+
+ LocationToFailAllocNode* head_;
+ int currentAllocNumber_;
+};
+
+struct MemoryAccountantAllocationNode;
+
+class MemoryAccountant
+{
+public:
+ MemoryAccountant();
+ ~MemoryAccountant();
+
+ void useCacheSizes(size_t sizes[], size_t length);
+
+ void clear();
+
+ void alloc(size_t size);
+ void dealloc(size_t size);
+
+ size_t totalAllocationsOfSize(size_t size) const;
+ size_t totalDeallocationsOfSize(size_t size) const;
+ size_t maximumAllocationAtATimeOfSize(size_t size) const;
+
+ size_t totalAllocations() const;
+ size_t totalDeallocations() const;
+
+ SimpleString report() const;
+
+ void setAllocator(TestMemoryAllocator* allocator);
+private:
+ MemoryAccountantAllocationNode* findOrCreateNodeOfSize(size_t size);
+ MemoryAccountantAllocationNode* findNodeOfSize(size_t size) const;
+
+ MemoryAccountantAllocationNode* createNewAccountantAllocationNode(size_t size, MemoryAccountantAllocationNode* next) const;
+ void destroyAccountantAllocationNode(MemoryAccountantAllocationNode* node) const;
+
+ void createCacheSizeNodes(size_t sizes[], size_t length);
+
+ MemoryAccountantAllocationNode* head_;
+ TestMemoryAllocator* allocator_;
+ bool useCacheSizes_;
+
+ SimpleString reportNoAllocations() const;
+ SimpleString reportTitle() const;
+ SimpleString reportHeader() const;
+ SimpleString reportFooter() const;
+ SimpleString stringSize(size_t size) const;
+
+};
+
+struct AccountingTestMemoryAllocatorMemoryNode;
+
+class AccountingTestMemoryAllocator : public TestMemoryAllocator
+{
+public:
+ AccountingTestMemoryAllocator(MemoryAccountant& accountant, TestMemoryAllocator* originalAllocator);
+ virtual ~AccountingTestMemoryAllocator() CPPUTEST_DESTRUCTOR_OVERRIDE;
+
+ virtual char* alloc_memory(size_t size, const char* file, size_t line) CPPUTEST_OVERRIDE;
+ virtual void free_memory(char* memory, size_t size, const char* file, size_t line) CPPUTEST_OVERRIDE;
+
+ virtual TestMemoryAllocator* actualAllocator() CPPUTEST_OVERRIDE;
+ TestMemoryAllocator* originalAllocator();
+
+ virtual const char* alloc_name() const CPPUTEST_OVERRIDE;
+ virtual const char* free_name() const CPPUTEST_OVERRIDE;
+private:
+
+ void addMemoryToMemoryTrackingToKeepTrackOfSize(char* memory, size_t size);
+ size_t removeMemoryFromTrackingAndReturnAllocatedSize(char* memory);
+
+ size_t removeNextNodeAndReturnSize(AccountingTestMemoryAllocatorMemoryNode* node);
+ size_t removeHeadAndReturnSize();
+
+ MemoryAccountant& accountant_;
+ TestMemoryAllocator* originalAllocator_;
+ AccountingTestMemoryAllocatorMemoryNode* head_;
+};
+
+class GlobalMemoryAccountant
+{
+public:
+ GlobalMemoryAccountant();
+ ~GlobalMemoryAccountant();
+
+ void useCacheSizes(size_t sizes[], size_t length);
+
+ void start();
+ void stop();
+ SimpleString report();
+ SimpleString reportWithCacheSizes(size_t sizes[], size_t length);
+
+ TestMemoryAllocator* getMallocAllocator();
+ TestMemoryAllocator* getNewAllocator();
+ TestMemoryAllocator* getNewArrayAllocator();
+
+private:
+
+ void restoreMemoryAllocators();
+
+ MemoryAccountant accountant_;
+ AccountingTestMemoryAllocator* mallocAllocator_;
+ AccountingTestMemoryAllocator* newAllocator_;
+ AccountingTestMemoryAllocator* newArrayAllocator_;
+};
+
#endif
diff --git a/include/CppUTest/TestOutput.h b/include/CppUTest/TestOutput.h
index a90aaf7f1..47fbe02ea 100644
--- a/include/CppUTest/TestOutput.h
+++ b/include/CppUTest/TestOutput.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -30,13 +30,15 @@
///////////////////////////////////////////////////////////////////////////////
//
-// This is a minimal printer inteface.
-// We kept streams out too keep footprint small, and so the test
+// This is a minimal printer interface.
+// We kept streams out to keep footprint small, and so the test
// harness could be used with less capable compilers so more
// platforms could use this test harness
//
///////////////////////////////////////////////////////////////////////////////
+#include "SimpleString.h"
+
class UtestShell;
class TestFailure;
class TestResult;
@@ -44,6 +46,9 @@ class TestResult;
class TestOutput
{
public:
+ enum WorkingEnvironment {visualStudio, eclipse, detectEnvironment};
+ enum VerbosityLevel {level_quiet, level_verbose, level_veryVerbose};
+
explicit TestOutput();
virtual ~TestOutput();
@@ -54,41 +59,41 @@ class TestOutput
virtual void printCurrentGroupStarted(const UtestShell& test);
virtual void printCurrentGroupEnded(const TestResult& res);
- virtual void verbose();
+ virtual void verbose(VerbosityLevel level);
virtual void color();
virtual void printBuffer(const char*)=0;
virtual void print(const char*);
virtual void print(long);
+ virtual void print(size_t);
virtual void printDouble(double);
- virtual void printHex(long);
- virtual void print(const TestFailure& failure);
- virtual void printTestRun(int number, int total);
+ virtual void printFailure(const TestFailure& failure);
+ virtual void printTestRun(size_t number, size_t total);
virtual void setProgressIndicator(const char*);
- virtual void flush();
+ virtual void printVeryVerbose(const char*);
- enum WorkingEnvironment {vistualStudio, eclipse, detectEnvironment};
+ virtual void flush()=0;
static void setWorkingEnvironment(WorkingEnvironment workEnvironment);
static WorkingEnvironment getWorkingEnvironment();
protected:
- virtual void printEclipseErrorInFileOnLine(SimpleString file, int lineNumber);
- virtual void printVistualStudioErrorInFileOnLine(SimpleString file, int lineNumber);
+ virtual void printEclipseErrorInFileOnLine(SimpleString file, size_t lineNumber);
+ virtual void printVisualStudioErrorInFileOnLine(SimpleString file, size_t lineNumber);
virtual void printProgressIndicator();
void printFileAndLineForTestAndFailure(const TestFailure& failure);
void printFileAndLineForFailure(const TestFailure& failure);
void printFailureInTest(SimpleString testName);
void printFailureMessage(SimpleString reason);
- void printErrorInFileOnLineFormattedForWorkingEnvironment(SimpleString testFile, int lineNumber);
+ void printErrorInFileOnLineFormattedForWorkingEnvironment(SimpleString testFile, size_t lineNumber);
TestOutput(const TestOutput&);
TestOutput& operator=(const TestOutput&);
int dotCount_;
- bool verbose_;
+ VerbosityLevel verbose_;
bool color_;
const char* progressIndication_;
@@ -112,12 +117,12 @@ class ConsoleTestOutput: public TestOutput
explicit ConsoleTestOutput()
{
}
- virtual ~ConsoleTestOutput()
+ virtual ~ConsoleTestOutput() CPPUTEST_DESTRUCTOR_OVERRIDE
{
}
- virtual void printBuffer(const char* s) _override;
- virtual void flush() _override;
+ virtual void printBuffer(const char* s) CPPUTEST_OVERRIDE;
+ virtual void flush() CPPUTEST_OVERRIDE;
private:
ConsoleTestOutput(const ConsoleTestOutput&);
@@ -140,14 +145,14 @@ class StringBufferTestOutput: public TestOutput
{
}
- virtual ~StringBufferTestOutput();
+ virtual ~StringBufferTestOutput() CPPUTEST_DESTRUCTOR_OVERRIDE;
- void printBuffer(const char* s) _override
+ void printBuffer(const char* s) CPPUTEST_OVERRIDE
{
output += s;
}
- void flush() _override
+ void flush() CPPUTEST_OVERRIDE
{
output = "";
}
@@ -157,12 +162,53 @@ class StringBufferTestOutput: public TestOutput
return output;
}
-private:
+protected:
SimpleString output;
+private:
StringBufferTestOutput(const StringBufferTestOutput&);
StringBufferTestOutput& operator=(const StringBufferTestOutput&);
};
+class CompositeTestOutput : public TestOutput
+{
+public:
+ virtual void setOutputOne(TestOutput* output);
+ virtual void setOutputTwo(TestOutput* output);
+
+ CompositeTestOutput();
+ virtual ~CompositeTestOutput() CPPUTEST_DESTRUCTOR_OVERRIDE;
+
+ virtual void printTestsStarted() CPPUTEST_OVERRIDE;
+ virtual void printTestsEnded(const TestResult& result) CPPUTEST_OVERRIDE;
+
+ virtual void printCurrentTestStarted(const UtestShell& test) CPPUTEST_OVERRIDE;
+ virtual void printCurrentTestEnded(const TestResult& res) CPPUTEST_OVERRIDE;
+ virtual void printCurrentGroupStarted(const UtestShell& test) CPPUTEST_OVERRIDE;
+ virtual void printCurrentGroupEnded(const TestResult& res) CPPUTEST_OVERRIDE;
+
+ virtual void verbose(VerbosityLevel level) CPPUTEST_OVERRIDE;
+ virtual void color() CPPUTEST_OVERRIDE;
+ virtual void printBuffer(const char*) CPPUTEST_OVERRIDE;
+ virtual void print(const char*) CPPUTEST_OVERRIDE;
+ virtual void print(long) CPPUTEST_OVERRIDE;
+ virtual void print(size_t) CPPUTEST_OVERRIDE;
+ virtual void printDouble(double) CPPUTEST_OVERRIDE;
+ virtual void printFailure(const TestFailure& failure) CPPUTEST_OVERRIDE;
+ virtual void setProgressIndicator(const char*) CPPUTEST_OVERRIDE;
+
+ virtual void printVeryVerbose(const char*) CPPUTEST_OVERRIDE;
+
+ virtual void flush() CPPUTEST_OVERRIDE;
+
+protected:
+ CompositeTestOutput(const TestOutput&);
+ CompositeTestOutput& operator=(const TestOutput&);
+
+private:
+ TestOutput* outputOne_;
+ TestOutput* outputTwo_;
+};
+
#endif
diff --git a/include/CppUTest/TestPlugin.h b/include/CppUTest/TestPlugin.h
index 64a9a2df1..d0b3c41b3 100644
--- a/include/CppUTest/TestPlugin.h
+++ b/include/CppUTest/TestPlugin.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -28,6 +28,8 @@
#ifndef D_TestPlugin_h
#define D_TestPlugin_h
+#include "SimpleString.h"
+
class UtestShell;
class TestResult;
@@ -46,14 +48,14 @@ class TestPlugin
{
}
- virtual bool parseArguments(int /* ac */, const char** /* av */, int /* index */ )
+ virtual bool parseArguments(int /* ac */, const char *const * /* av */, int /* index */ )
{
return false;
}
virtual void runAllPreTestAction(UtestShell&, TestResult&);
virtual void runAllPostTestAction(UtestShell&, TestResult&);
- virtual bool parseAllArguments(int ac, const char** av, int index);
+ virtual bool parseAllArguments(int ac, const char *const *av, int index);
virtual bool parseAllArguments(int ac, char** av, int index);
virtual TestPlugin* addPlugin(TestPlugin*);
@@ -90,8 +92,7 @@ class SetPointerPlugin: public TestPlugin
{
public:
SetPointerPlugin(const SimpleString& name);
- virtual ~SetPointerPlugin();
- virtual void postTestAction(UtestShell&, TestResult&) _override;
+ virtual void postTestAction(UtestShell&, TestResult&) CPPUTEST_OVERRIDE;
enum
{
@@ -99,7 +100,11 @@ class SetPointerPlugin: public TestPlugin
};
};
-#define UT_PTR_SET(a, b) { CppUTestStore( (void**)&a ); a = b; }
+#define UT_PTR_SET(a, b) \
+ do { \
+ CppUTestStore((void**)&(a)); \
+ (a) = b; \
+ } while (0)
///////////// Null Plugin
@@ -108,12 +113,9 @@ class NullTestPlugin: public TestPlugin
public:
NullTestPlugin();
- virtual ~NullTestPlugin()
- {
- }
- virtual void runAllPreTestAction(UtestShell& test, TestResult& result) _override;
- virtual void runAllPostTestAction(UtestShell& test, TestResult& result) _override;
+ virtual void runAllPreTestAction(UtestShell& test, TestResult& result) CPPUTEST_OVERRIDE;
+ virtual void runAllPostTestAction(UtestShell& test, TestResult& result) CPPUTEST_OVERRIDE;
static NullTestPlugin* instance();
};
diff --git a/include/CppUTest/TestRegistry.h b/include/CppUTest/TestRegistry.h
index 9ceb922f4..20575dd5a 100644
--- a/include/CppUTest/TestRegistry.h
+++ b/include/CppUTest/TestRegistry.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -33,6 +33,7 @@
#ifndef D_TestRegistry_h
#define D_TestRegistry_h
+#include "StandardCLibrary.h"
#include "SimpleString.h"
#include "TestFilter.h"
@@ -48,11 +49,15 @@ class TestRegistry
virtual void addTest(UtestShell *test);
virtual void unDoLastAddTest();
- virtual int countTests();
+ virtual size_t countTests();
virtual void runAllTests(TestResult& result);
+ virtual void shuffleTests(size_t seed);
+ virtual void reverseTests();
+ virtual void listTestGroupNames(TestResult& result);
+ virtual void listTestGroupAndCaseNames(TestResult& result);
+ virtual void listTestLocations(TestResult& result);
virtual void setNameFilters(const TestFilter* filters);
virtual void setGroupFilters(const TestFilter* filters);
-
virtual void installPlugin(TestPlugin* plugin);
virtual void resetPlugins();
virtual TestPlugin* getFirstPlugin();
@@ -61,7 +66,6 @@ class TestRegistry
virtual int countPlugins();
virtual UtestShell* getFirstTest();
- virtual UtestShell* getLastTest();
virtual UtestShell* getTestWithNext(UtestShell* test);
virtual UtestShell* findTestWithName(const SimpleString& name);
@@ -72,6 +76,7 @@ class TestRegistry
virtual void setRunTestsInSeperateProcess();
int getCurrentRepetition();
+ void setRunIgnored();
private:
@@ -85,7 +90,7 @@ class TestRegistry
static TestRegistry* currentRegistry_;
bool runInSeperateProcess_;
int currentRepetition_;
-
+ bool runIgnored_;
};
#endif
diff --git a/include/CppUTest/TestResult.h b/include/CppUTest/TestResult.h
index 7985efef4..fc6e63fd6 100644
--- a/include/CppUTest/TestResult.h
+++ b/include/CppUTest/TestResult.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -59,53 +59,58 @@ class TestResult
virtual void countIgnored();
virtual void addFailure(const TestFailure& failure);
virtual void print(const char* text);
- virtual void setProgressIndicator(const char*);
+ virtual void printVeryVerbose(const char* text);
- int getTestCount() const
+ size_t getTestCount() const
{
return testCount_;
}
- int getRunCount() const
+ size_t getRunCount() const
{
return runCount_;
}
- int getCheckCount() const
+ size_t getCheckCount() const
{
return checkCount_;
}
- int getFilteredOutCount() const
+ size_t getFilteredOutCount() const
{
return filteredOutCount_;
}
- int getIgnoredCount() const
+ size_t getIgnoredCount() const
{
return ignoredCount_;
}
- int getFailureCount() const
+ size_t getFailureCount() const
{
return failureCount_;
}
- long getTotalExecutionTime() const;
- void setTotalExecutionTime(long exTime);
+ bool isFailure() const
+ {
+ return (getFailureCount() != 0) || (getRunCount() + getIgnoredCount() == 0);
+ }
+
+ size_t getTotalExecutionTime() const;
+ void setTotalExecutionTime(size_t exTime);
- long getCurrentTestTotalExecutionTime() const;
- long getCurrentGroupTotalExecutionTime() const;
+ size_t getCurrentTestTotalExecutionTime() const;
+ size_t getCurrentGroupTotalExecutionTime() const;
private:
TestOutput& output_;
- int testCount_;
- int runCount_;
- int checkCount_;
- int failureCount_;
- int filteredOutCount_;
- int ignoredCount_;
- long totalExecutionTime_;
- long timeStarted_;
- long currentTestTimeStarted_;
- long currentTestTotalExecutionTime_;
- long currentGroupTimeStarted_;
- long currentGroupTotalExecutionTime_;
+ size_t testCount_;
+ size_t runCount_;
+ size_t checkCount_;
+ size_t failureCount_;
+ size_t filteredOutCount_;
+ size_t ignoredCount_;
+ size_t totalExecutionTime_;
+ size_t timeStarted_;
+ size_t currentTestTimeStarted_;
+ size_t currentTestTotalExecutionTime_;
+ size_t currentGroupTimeStarted_;
+ size_t currentGroupTotalExecutionTime_;
};
#endif
diff --git a/include/CppUTest/TestTestingFixture.h b/include/CppUTest/TestTestingFixture.h
index 735219e89..2c7cdd5ba 100644
--- a/include/CppUTest/TestTestingFixture.h
+++ b/include/CppUTest/TestTestingFixture.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -35,86 +35,47 @@ class TestTestingFixture
{
public:
- TestTestingFixture()
- {
- output_ = new StringBufferTestOutput();
- result_ = new TestResult(*output_);
- genTest_ = new ExecFunctionTestShell();
- registry_ = new TestRegistry();
-
- registry_->setCurrentRegistry(registry_);
- registry_->addTest(genTest_);
- }
-
- virtual ~TestTestingFixture()
- {
- registry_->setCurrentRegistry(0);
- delete registry_;
- delete result_;
- delete output_;
- delete genTest_;
- }
-
- void addTest(UtestShell * test)
- {
- registry_->addTest(test);
- }
-
- void setTestFunction(void(*testFunction)())
- {
- genTest_->testFunction_ = testFunction;
- }
-
- void setSetup(void(*setupFunction)())
- {
- genTest_->setup_ = setupFunction;
- }
-
- void setTeardown(void(*teardownFunction)())
- {
- genTest_->teardown_ = teardownFunction;
- }
+ TestTestingFixture();
+ virtual ~TestTestingFixture();
+ void flushOutputAndResetResult();
- void runAllTests()
- {
- registry_->runAllTests(*result_);
- }
+ void addTest(UtestShell * test);
+ void installPlugin(TestPlugin* plugin);
- int getFailureCount()
- {
- return result_->getFailureCount();
- }
+ void setTestFunction(void(*testFunction)());
+ void setTestFunction(ExecFunction* testFunction);
+ void setSetup(void(*setupFunction)());
+ void setTeardown(void(*teardownFunction)());
- int getCheckCount()
- {
- return result_->getCheckCount();
- }
+ void setOutputVerbose();
+ void setRunTestsInSeperateProcess();
- int getIgnoreCount()
- {
- return result_->getIgnoredCount();
- }
+ void runTestWithMethod(void(*method)());
+ void runAllTests();
- bool hasTestFailed()
- {
- return genTest_->hasFailed();
- }
+ size_t getFailureCount();
+ size_t getCheckCount();
+ size_t getIgnoreCount();
+ size_t getRunCount();
+ size_t getTestCount();
+ const SimpleString& getOutput();
+ TestRegistry* getRegistry();
+ bool hasTestFailed();
+ void assertPrintContains(const SimpleString& contains);
+ void assertPrintContainsNot(const SimpleString& contains);
+ void checkTestFailsWithProperTestLocation(const char* text, const char* file, size_t line);
- void assertPrintContains(const SimpleString& contains)
- {
- assertPrintContains(output_, contains);
- }
+ static void lineExecutedAfterCheck();
- static void assertPrintContains(StringBufferTestOutput* output,
- const SimpleString& contains)
- {
- STRCMP_CONTAINS(contains.asCharString(), output->getOutput().asCharString());
+private:
+ void clearExecFunction();
- }
+ static bool lineOfCodeExecutedAfterCheck;
TestRegistry* registry_;
ExecFunctionTestShell* genTest_;
+ bool ownsExecFunction_;
StringBufferTestOutput* output_;
TestResult * result_;
};
diff --git a/include/CppUTest/Utest.h b/include/CppUTest/Utest.h
index 774ddcdfc..02e865b76 100644
--- a/include/CppUTest/Utest.h
+++ b/include/CppUTest/Utest.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -69,15 +69,29 @@ class TestTerminator
class NormalTestTerminator : public TestTerminator
{
public:
- virtual void exitCurrentTest() const _override;
- virtual ~NormalTestTerminator();
+ virtual void exitCurrentTest() const CPPUTEST_OVERRIDE;
+ virtual ~NormalTestTerminator() CPPUTEST_DESTRUCTOR_OVERRIDE;
};
class TestTerminatorWithoutExceptions : public TestTerminator
{
public:
- virtual void exitCurrentTest() const _override;
- virtual ~TestTerminatorWithoutExceptions();
+ virtual void exitCurrentTest() const CPPUTEST_OVERRIDE;
+ virtual ~TestTerminatorWithoutExceptions() CPPUTEST_DESTRUCTOR_OVERRIDE;
+};
+
+class CrashingTestTerminator : public NormalTestTerminator
+{
+public:
+ virtual void exitCurrentTest() const CPPUTEST_OVERRIDE;
+ virtual ~CrashingTestTerminator() CPPUTEST_DESTRUCTOR_OVERRIDE;
+};
+
+class CrashingTestTerminatorWithoutExceptions : public TestTerminatorWithoutExceptions
+{
+public:
+ virtual void exitCurrentTest() const CPPUTEST_OVERRIDE;
+ virtual ~CrashingTestTerminatorWithoutExceptions() CPPUTEST_DESTRUCTOR_OVERRIDE;
};
//////////////////// UtestShell
@@ -87,42 +101,60 @@ class UtestShell
public:
static UtestShell *getCurrent();
+ static const TestTerminator &getCurrentTestTerminator();
+ static const TestTerminator &getCurrentTestTerminatorWithoutExceptions();
+
+ static void setCrashOnFail();
+ static void restoreDefaultTestTerminator();
+
+ static void setRethrowExceptions(bool rethrowExceptions);
+ static bool isRethrowingExceptions();
+
public:
- UtestShell(const char* groupName, const char* testName, const char* fileName, int lineNumber);
+ UtestShell(const char* groupName, const char* testName, const char* fileName, size_t lineNumber);
virtual ~UtestShell();
virtual UtestShell* addTest(UtestShell* test);
virtual UtestShell *getNext() const;
- virtual int countTests();
+ virtual size_t countTests();
bool shouldRun(const TestFilter* groupFilters, const TestFilter* nameFilters) const;
const SimpleString getName() const;
const SimpleString getGroup() const;
virtual SimpleString getFormattedName() const;
const SimpleString getFile() const;
- int getLineNumber() const;
- virtual const char *getProgressIndicator() const;
+ size_t getLineNumber() const;
+ virtual bool willRun() const;
virtual bool hasFailed() const;
-
- virtual void assertTrue(bool condition, const char *checkString, const char *conditionString, const char *fileName, int lineNumber, const TestTerminator& testTerminator = NormalTestTerminator());
- virtual void assertTrueText(bool condition, const char *checkString, const char *conditionString, const char* text, const char *fileName, int lineNumber, const TestTerminator& testTerminator = NormalTestTerminator());
- virtual void assertCstrEqual(const char *expected, const char *actual, const char *fileName, int lineNumber, const TestTerminator& testTerminator = NormalTestTerminator());
- virtual void assertCstrNEqual(const char *expected, const char *actual, size_t length, const char *fileName, int lineNumber, const TestTerminator& testTerminator = NormalTestTerminator());
- virtual void assertCstrNoCaseEqual(const char *expected, const char *actual, const char *fileName, int lineNumber);
- virtual void assertCstrContains(const char *expected, const char *actual, const char *fileName, int lineNumber);
- virtual void assertCstrNoCaseContains(const char *expected, const char *actual, const char *fileName, int lineNumber);
- virtual void assertLongsEqual(long expected, long actual, const char *fileName, int lineNumber, const TestTerminator& testTerminator = NormalTestTerminator());
- virtual void assertUnsignedLongsEqual(unsigned long expected, unsigned long actual, const char *fileName, int lineNumber, const TestTerminator& testTerminator = NormalTestTerminator());
- virtual void assertPointersEqual(const void *expected, const void *actual, const char *fileName, int lineNumber);
- virtual void assertDoublesEqual(double expected, double actual, double threshold, const char *fileName, int lineNumber, const TestTerminator& testTerminator = NormalTestTerminator());
- virtual void assertEquals(bool failed, const char* expected, const char* actual, const char* file, int line, const TestTerminator& testTerminator = NormalTestTerminator());
- virtual void fail(const char *text, const char *fileName, int lineNumber, const TestTerminator& testTerminator = NormalTestTerminator());
-
- virtual void print(const char *text, const char *fileName, int lineNumber);
- virtual void print(const SimpleString & text, const char *fileName, int lineNumber);
+ void countCheck();
+
+ virtual void assertTrue(bool condition, const char *checkString, const char *conditionString, const char* text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertCstrEqual(const char *expected, const char *actual, const char* text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertCstrNEqual(const char *expected, const char *actual, size_t length, const char* text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertCstrNoCaseEqual(const char *expected, const char *actual, const char* text, const char *fileName, size_t lineNumber);
+ virtual void assertCstrContains(const char *expected, const char *actual, const char* text, const char *fileName, size_t lineNumber);
+ virtual void assertCstrNoCaseContains(const char *expected, const char *actual, const char* text, const char *fileName, size_t lineNumber);
+ virtual void assertLongsEqual(long expected, long actual, const char* text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertUnsignedLongsEqual(unsigned long expected, unsigned long actual, const char* text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertLongLongsEqual(cpputest_longlong expected, cpputest_longlong actual, const char* text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertUnsignedLongLongsEqual(cpputest_ulonglong expected, cpputest_ulonglong actual, const char* text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertSignedBytesEqual(signed char expected, signed char actual, const char* text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertPointersEqual(const void *expected, const void *actual, const char* text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertFunctionPointersEqual(void (*expected)(), void (*actual)(), const char* text, const char* fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertDoublesEqual(double expected, double actual, double threshold, const char* text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertEquals(bool failed, const char* expected, const char* actual, const char* text, const char* file, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertBinaryEqual(const void *expected, const void *actual, size_t length, const char* text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertBitsEqual(unsigned long expected, unsigned long actual, unsigned long mask, size_t byteCount, const char* text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void assertCompare(bool comparison, const char *checkString, const char *comparisonString, const char *text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void fail(const char *text, const char *fileName, size_t lineNumber, const TestTerminator& testTerminator = getCurrentTestTerminator());
+ virtual void exitTest(const TestTerminator& testTerminator = getCurrentTestTerminator());
+
+ virtual void print(const char *text, const char *fileName, size_t lineNumber);
+ virtual void print(const SimpleString & text, const char *fileName, size_t lineNumber);
+ virtual void printVeryVerbose(const char* text);
void setFileName(const char *fileName);
- void setLineNumber(int lineNumber);
+ void setLineNumber(size_t lineNumber);
void setGroupName(const char *groupName);
void setTestName(const char *testName);
@@ -133,6 +165,8 @@ class UtestShell
virtual bool isRunInSeperateProcess() const;
virtual void setRunInSeperateProcess();
+ virtual void setRunIgnored();
+
virtual Utest* createTest();
virtual void destroyTest(Utest* test);
@@ -142,9 +176,11 @@ class UtestShell
virtual void failWith(const TestFailure& failure);
virtual void failWith(const TestFailure& failure, const TestTerminator& terminator);
+ virtual void addFailure(const TestFailure& failure);
+
protected:
UtestShell();
- UtestShell(const char *groupName, const char *testName, const char *fileName, int lineNumber, UtestShell *nextTest);
+ UtestShell(const char *groupName, const char *testName, const char *fileName, size_t lineNumber, UtestShell *nextTest);
virtual SimpleString getMacroName() const;
TestResult *getTestResult();
@@ -152,7 +188,7 @@ class UtestShell
const char *group_;
const char *name_;
const char *file_;
- int lineNumber_;
+ size_t lineNumber_;
UtestShell *next_;
bool isRunAsSeperateProcess_;
bool hasFailed_;
@@ -164,8 +200,13 @@ class UtestShell
static UtestShell* currentTest_;
static TestResult* testResult_;
+ static const TestTerminator *currentTestTerminator_;
+ static const TestTerminator *currentTestTerminatorWithoutExceptions_;
+ static bool rethrowExceptions_;
};
+
+
//////////////////// ExecFunctionTest
class ExecFunctionTestShell;
@@ -174,29 +215,51 @@ class ExecFunctionTest : public Utest
{
public:
ExecFunctionTest(ExecFunctionTestShell* shell);
- void testBody();
- virtual void setup() _override;
- virtual void teardown() _override;
+ void testBody() CPPUTEST_OVERRIDE;
+ virtual void setup() CPPUTEST_OVERRIDE;
+ virtual void teardown() CPPUTEST_OVERRIDE;
private:
ExecFunctionTestShell* shell_;
};
+//////////////////// ExecFunction
+
+class ExecFunction
+{
+public:
+ ExecFunction();
+ virtual ~ExecFunction();
+
+ virtual void exec()=0;
+};
+
+class ExecFunctionWithoutParameters : public ExecFunction
+{
+public:
+ void (*testFunction_)();
+
+ ExecFunctionWithoutParameters(void(*testFunction)());
+ virtual ~ExecFunctionWithoutParameters() CPPUTEST_DESTRUCTOR_OVERRIDE;
+
+ virtual void exec() CPPUTEST_OVERRIDE;
+};
+
//////////////////// ExecFunctionTestShell
-class ExecFunctionTestShell: public UtestShell
+class ExecFunctionTestShell : public UtestShell
{
public:
void (*setup_)();
void (*teardown_)();
- void (*testFunction_)();
+ ExecFunction* testFunction_;
- ExecFunctionTestShell(void(*set)() = 0, void(*tear)() = 0) :
- UtestShell("Generic", "Generic", "Generic", 1), setup_(set), teardown_(
- tear), testFunction_(0)
+ ExecFunctionTestShell(void(*set)() = NULLPTR, void(*tear)() = NULLPTR) :
+ UtestShell("ExecFunction", "ExecFunction", "ExecFunction", 1), setup_(set), teardown_(tear), testFunction_(NULLPTR)
{
}
- Utest* createTest() { return new ExecFunctionTest(this); }
- virtual ~ExecFunctionTestShell();
+
+ Utest* createTest() CPPUTEST_OVERRIDE { return new ExecFunctionTest(this); }
+ virtual ~ExecFunctionTestShell() CPPUTEST_DESTRUCTOR_OVERRIDE;
};
//////////////////// CppUTestFailedException
@@ -213,27 +276,53 @@ class IgnoredUtestShell : public UtestShell
{
public:
IgnoredUtestShell();
- virtual ~IgnoredUtestShell();
+ virtual ~IgnoredUtestShell() CPPUTEST_DESTRUCTOR_OVERRIDE;
explicit IgnoredUtestShell(const char* groupName, const char* testName,
- const char* fileName, int lineNumber);
- virtual const char* getProgressIndicator() const;
- protected: virtual SimpleString getMacroName() const _override;
- virtual void runOneTest(TestPlugin* plugin, TestResult& result) _override;
-
+ const char* fileName, size_t lineNumber);
+ virtual bool willRun() const CPPUTEST_OVERRIDE;
+ virtual void setRunIgnored() CPPUTEST_OVERRIDE;
+protected:
+ virtual SimpleString getMacroName() const CPPUTEST_OVERRIDE;
+ virtual void runOneTest(TestPlugin* plugin, TestResult& result) CPPUTEST_OVERRIDE;
private:
IgnoredUtestShell(const IgnoredUtestShell&);
IgnoredUtestShell& operator=(const IgnoredUtestShell&);
+ bool runIgnored_;
+
};
+//////////////////// UtestShellPointerArray
+
+class UtestShellPointerArray
+{
+public:
+ UtestShellPointerArray(UtestShell* firstTest);
+ ~UtestShellPointerArray();
+
+ void shuffle(size_t seed);
+ void reverse();
+ void relinkTestsInOrder();
+ UtestShell* getFirstTest() const;
+ UtestShell* get(size_t index) const;
+
+private:
+
+ void swap(size_t index1, size_t index2);
+
+ UtestShell** arrayOfTests_;
+ size_t count_;
+};
+
+
//////////////////// TestInstaller
class TestInstaller
{
public:
explicit TestInstaller(UtestShell& shell, const char* groupName, const char* testName,
- const char* fileName, int lineNumber);
+ const char* fileName, size_t lineNumber);
virtual ~TestInstaller();
void unDo();
diff --git a/include/CppUTest/UtestMacros.h b/include/CppUTest/UtestMacros.h
index 25c7b14cf..743bf069e 100644
--- a/include/CppUTest/UtestMacros.h
+++ b/include/CppUTest/UtestMacros.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -50,10 +50,10 @@
TEST_GROUP_BASE(testGroup, Utest)
#define TEST_SETUP() \
- virtual void setup()
+ virtual void setup() CPPUTEST_OVERRIDE
#define TEST_TEARDOWN() \
- virtual void teardown()
+ virtual void teardown() CPPUTEST_OVERRIDE
#define TEST(testGroup, testName) \
/* External declarations for strict compilers */ \
@@ -62,9 +62,9 @@
\
class TEST_##testGroup##_##testName##_Test : public TEST_GROUP_##CppUTestGroup##testGroup \
{ public: TEST_##testGroup##_##testName##_Test () : TEST_GROUP_##CppUTestGroup##testGroup () {} \
- void testBody(); }; \
+ void testBody() CPPUTEST_OVERRIDE; }; \
class TEST_##testGroup##_##testName##_TestShell : public UtestShell { \
- virtual Utest* createTest() _override { return new TEST_##testGroup##_##testName##_Test; } \
+ virtual Utest* createTest() CPPUTEST_OVERRIDE { return new TEST_##testGroup##_##testName##_Test; } \
} TEST_##testGroup##_##testName##_TestShell_instance; \
static TestInstaller TEST_##testGroup##_##testName##_Installer(TEST_##testGroup##_##testName##_TestShell_instance, #testGroup, #testName, __FILE__,__LINE__); \
void TEST_##testGroup##_##testName##_Test::testBody()
@@ -76,118 +76,267 @@
\
class IGNORE##testGroup##_##testName##_Test : public TEST_GROUP_##CppUTestGroup##testGroup \
{ public: IGNORE##testGroup##_##testName##_Test () : TEST_GROUP_##CppUTestGroup##testGroup () {} \
- public: void testBodyThatNeverRuns (); }; \
+ public: void testBody() CPPUTEST_OVERRIDE; }; \
class IGNORE##testGroup##_##testName##_TestShell : public IgnoredUtestShell { \
- virtual Utest* createTest() _override { return new IGNORE##testGroup##_##testName##_Test; } \
+ virtual Utest* createTest() CPPUTEST_OVERRIDE { return new IGNORE##testGroup##_##testName##_Test; } \
} IGNORE##testGroup##_##testName##_TestShell_instance; \
static TestInstaller TEST_##testGroup##testName##_Installer(IGNORE##testGroup##_##testName##_TestShell_instance, #testGroup, #testName, __FILE__,__LINE__); \
- void IGNORE##testGroup##_##testName##_Test::testBodyThatNeverRuns ()
+ void IGNORE##testGroup##_##testName##_Test::testBody ()
#define IMPORT_TEST_GROUP(testGroup) \
extern int externTestGroup##testGroup;\
extern int* p##testGroup; \
int* p##testGroup = &externTestGroup##testGroup
+#define CPPUTEST_DEFAULT_MAIN \
+ /*#include */ \
+ int main(int argc, char** argv) \
+ { \
+ return CommandLineTestRunner::RunAllTests(argc, argv); \
+ }
+
+
// Different checking macros
#define CHECK(condition)\
- CHECK_LOCATION_TRUE(condition, "CHECK", #condition, __FILE__, __LINE__)
+ CHECK_TRUE_LOCATION(condition, "CHECK", #condition, NULLPTR, __FILE__, __LINE__)
#define CHECK_TEXT(condition, text) \
- CHECK_LOCATION_TEXT(condition, "CHECK", #condition, text, __FILE__, __LINE__)
+ CHECK_TRUE_LOCATION((bool)(condition), "CHECK", #condition, text, __FILE__, __LINE__)
#define CHECK_TRUE(condition)\
- CHECK_LOCATION_TRUE(condition, "CHECK_TRUE", #condition, __FILE__, __LINE__)
+ CHECK_TRUE_LOCATION((bool) (condition), "CHECK_TRUE", #condition, NULLPTR, __FILE__, __LINE__)
+
+#define CHECK_TRUE_TEXT(condition, text)\
+ CHECK_TRUE_LOCATION(condition, "CHECK_TRUE", #condition, text, __FILE__, __LINE__)
#define CHECK_FALSE(condition)\
- CHECK_LOCATION_FALSE(condition, "CHECK_FALSE", #condition, __FILE__, __LINE__)
+ CHECK_FALSE_LOCATION(condition, "CHECK_FALSE", #condition, NULLPTR, __FILE__, __LINE__)
-#define CHECK_LOCATION_TEXT(condition, checkString, conditionString, text, file, line) \
- { UtestShell::getCurrent()->assertTrueText((condition) != 0, checkString, conditionString, text, file, line); }
+#define CHECK_FALSE_TEXT(condition, text)\
+ CHECK_FALSE_LOCATION(condition, "CHECK_FALSE", #condition, text, __FILE__, __LINE__)
-#define CHECK_LOCATION_TRUE(condition, checkString, conditionString, file, line)\
- { UtestShell::getCurrent()->assertTrue((condition) != 0, checkString, conditionString, file, line); }
+#define CHECK_TRUE_LOCATION(condition, checkString, conditionString, text, file, line)\
+ do { UtestShell::getCurrent()->assertTrue((condition), checkString, conditionString, text, file, line); } while(0)
-#define CHECK_LOCATION_FALSE(condition, checkString, conditionString, file, line)\
- { UtestShell::getCurrent()->assertTrue((condition) == 0, checkString, conditionString, file, line); }
+#define CHECK_FALSE_LOCATION(condition, checkString, conditionString, text, file, line)\
+ do { UtestShell::getCurrent()->assertTrue(!(condition), checkString, conditionString, text, file, line); } while(0)
//This check needs the operator!=(), and a StringFrom(YourType) function
-#define CHECK_EQUAL(expected,actual)\
- CHECK_EQUAL_LOCATION(expected, actual, __FILE__, __LINE__)
+#define CHECK_EQUAL(expected, actual)\
+ CHECK_EQUAL_LOCATION(expected, actual, NULLPTR, __FILE__, __LINE__)
-#define CHECK_EQUAL_LOCATION(expected,actual, file, line)\
- { if ((expected) != (actual)) { \
+#define CHECK_EQUAL_TEXT(expected, actual, text)\
+ CHECK_EQUAL_LOCATION(expected, actual, text, __FILE__, __LINE__)
+
+#define CHECK_EQUAL_LOCATION(expected, actual, text, file, line)\
+ do { if ((expected) != (actual)) { \
if ((actual) != (actual)) \
UtestShell::getCurrent()->print("WARNING:\n\tThe \"Actual Parameter\" parameter is evaluated multiple times resulting in different values.\n\tThus the value in the error message is probably incorrect.", file, line); \
if ((expected) != (expected)) \
UtestShell::getCurrent()->print("WARNING:\n\tThe \"Expected Parameter\" parameter is evaluated multiple times resulting in different values.\n\tThus the value in the error message is probably incorrect.", file, line); \
- UtestShell::getCurrent()->assertEquals(true, StringFrom(expected).asCharString(), StringFrom(actual).asCharString(), file, line); \
+ UtestShell::getCurrent()->assertEquals(true, StringFrom(expected).asCharString(), StringFrom(actual).asCharString(), text, file, line); \
} \
else \
{ \
- UtestShell::getCurrent()->assertLongsEqual((long)0, (long)0, file, line); \
- } }
+ UtestShell::getCurrent()->assertLongsEqual((long)0, (long)0, NULLPTR, file, line); \
+ } } while(0)
+
+#define CHECK_EQUAL_ZERO(actual) CHECK_EQUAL(0, (actual))
+
+#define CHECK_EQUAL_ZERO_TEXT(actual, text) CHECK_EQUAL_TEXT(0, (actual), (text))
+
+#define CHECK_COMPARE(first, relop, second)\
+ CHECK_COMPARE_TEXT(first, relop, second, NULLPTR)
+
+#define CHECK_COMPARE_TEXT(first, relop, second, text)\
+ CHECK_COMPARE_LOCATION(first, relop, second, text, __FILE__, __LINE__)
+
+#define CHECK_COMPARE_LOCATION(first, relop, second, text, file, line)\
+ do {\
+ bool success = (first) relop (second);\
+ if (!success) {\
+ SimpleString conditionString;\
+ conditionString += StringFrom(first); conditionString += " ";\
+ conditionString += #relop; conditionString += " ";\
+ conditionString += StringFrom(second);\
+ UtestShell::getCurrent()->assertCompare(false, "CHECK_COMPARE", conditionString.asCharString(), text, __FILE__, __LINE__);\
+ }\
+ } while(0)
//This check checks for char* string equality using strcmp.
//This makes up for the fact that CHECK_EQUAL only compares the pointers to char*'s
-#define STRCMP_EQUAL(expected,actual)\
- STRCMP_EQUAL_LOCATION(expected, actual, __FILE__, __LINE__)
+#define STRCMP_EQUAL(expected, actual)\
+ STRCMP_EQUAL_LOCATION(expected, actual, NULLPTR, __FILE__, __LINE__)
-#define STRCMP_EQUAL_LOCATION(expected,actual, file, line)\
- { UtestShell::getCurrent()->assertCstrEqual(expected, actual, file, line); }
+#define STRCMP_EQUAL_TEXT(expected, actual, text)\
+ STRCMP_EQUAL_LOCATION(expected, actual, text, __FILE__, __LINE__)
+
+#define STRCMP_EQUAL_LOCATION(expected, actual, text, file, line)\
+ do { UtestShell::getCurrent()->assertCstrEqual(expected, actual, text, file, line); } while(0)
#define STRNCMP_EQUAL(expected, actual, length)\
- STRNCMP_EQUAL_LOCATION(expected, actual, length, __FILE__, __LINE__)
+ STRNCMP_EQUAL_LOCATION(expected, actual, length, NULLPTR, __FILE__, __LINE__)
+
+#define STRNCMP_EQUAL_TEXT(expected, actual, length, text)\
+ STRNCMP_EQUAL_LOCATION(expected, actual, length, text, __FILE__, __LINE__)
+
+#define STRNCMP_EQUAL_LOCATION(expected, actual, length, text, file, line)\
+ do { UtestShell::getCurrent()->assertCstrNEqual(expected, actual, length, text, file, line); } while(0)
-#define STRNCMP_EQUAL_LOCATION(expected, actual, length, file, line)\
- { UtestShell::getCurrent()->assertCstrNEqual(expected, actual, length, file, line); }
+#define STRCMP_NOCASE_EQUAL(expected, actual)\
+ STRCMP_NOCASE_EQUAL_LOCATION(expected, actual, NULLPTR, __FILE__, __LINE__)
-#define STRCMP_NOCASE_EQUAL(expected,actual)\
- STRCMP_NOCASE_EQUAL_LOCATION(expected, actual, __FILE__, __LINE__)
+#define STRCMP_NOCASE_EQUAL_TEXT(expected, actual, text)\
+ STRCMP_NOCASE_EQUAL_LOCATION(expected, actual, text, __FILE__, __LINE__)
-#define STRCMP_NOCASE_EQUAL_LOCATION(expected,actual, file, line)\
- { UtestShell::getCurrent()->assertCstrNoCaseEqual(expected, actual, file, line); }
+#define STRCMP_NOCASE_EQUAL_LOCATION(expected, actual, text, file, line)\
+ do { UtestShell::getCurrent()->assertCstrNoCaseEqual(expected, actual, text, file, line); } while(0)
-#define STRCMP_CONTAINS(expected,actual)\
- STRCMP_CONTAINS_LOCATION(expected, actual, __FILE__, __LINE__)
+#define STRCMP_CONTAINS(expected, actual)\
+ STRCMP_CONTAINS_LOCATION(expected, actual, NULLPTR, __FILE__, __LINE__)
-#define STRCMP_CONTAINS_LOCATION(expected,actual, file, line)\
- { UtestShell::getCurrent()->assertCstrContains(expected, actual, file, line); }
+#define STRCMP_CONTAINS_TEXT(expected, actual, text)\
+ STRCMP_CONTAINS_LOCATION(expected, actual, text, __FILE__, __LINE__)
-#define STRCMP_NOCASE_CONTAINS(expected,actual)\
- STRCMP_NOCASE_CONTAINS_LOCATION(expected, actual, __FILE__, __LINE__)
+#define STRCMP_CONTAINS_LOCATION(expected, actual, text, file, line)\
+ do { UtestShell::getCurrent()->assertCstrContains(expected, actual, text, file, line); } while(0)
-#define STRCMP_NOCASE_CONTAINS_LOCATION(expected,actual, file, line)\
- { UtestShell::getCurrent()->assertCstrNoCaseContains(expected, actual, file, line); }
+#define STRCMP_NOCASE_CONTAINS(expected, actual)\
+ STRCMP_NOCASE_CONTAINS_LOCATION(expected, actual, NULLPTR, __FILE__, __LINE__)
+
+#define STRCMP_NOCASE_CONTAINS_TEXT(expected, actual, text)\
+ STRCMP_NOCASE_CONTAINS_LOCATION(expected, actual, text, __FILE__, __LINE__)
+
+#define STRCMP_NOCASE_CONTAINS_LOCATION(expected, actual, text, file, line)\
+ do { UtestShell::getCurrent()->assertCstrNoCaseContains(expected, actual, text, file, line); } while(0)
//Check two long integers for equality
-#define LONGS_EQUAL(expected,actual)\
- LONGS_EQUAL_LOCATION(expected,actual,__FILE__, __LINE__)
+#define LONGS_EQUAL(expected, actual)\
+ LONGS_EQUAL_LOCATION((expected), (actual), "LONGS_EQUAL(" #expected ", " #actual ") failed", __FILE__, __LINE__)
+
+#define LONGS_EQUAL_TEXT(expected, actual, text)\
+ LONGS_EQUAL_LOCATION((expected), (actual), text, __FILE__, __LINE__)
+
+#define UNSIGNED_LONGS_EQUAL(expected, actual)\
+ UNSIGNED_LONGS_EQUAL_LOCATION((expected), (actual), NULLPTR, __FILE__, __LINE__)
+
+#define UNSIGNED_LONGS_EQUAL_TEXT(expected, actual, text)\
+ UNSIGNED_LONGS_EQUAL_LOCATION((expected), (actual), text, __FILE__, __LINE__)
+
+#define LONGS_EQUAL_LOCATION(expected, actual, text, file, line)\
+ do { UtestShell::getCurrent()->assertLongsEqual((long)(expected), (long)(actual), text, file, line); } while(0)
-#define UNSIGNED_LONGS_EQUAL(expected,actual)\
- UNSIGNED_LONGS_EQUAL_LOCATION(expected,actual,__FILE__, __LINE__)
+#define UNSIGNED_LONGS_EQUAL_LOCATION(expected, actual, text, file, line)\
+ do { UtestShell::getCurrent()->assertUnsignedLongsEqual((unsigned long)(expected), (unsigned long)(actual), text, file, line); } while(0)
-#define LONGS_EQUAL_LOCATION(expected,actual,file,line)\
- { UtestShell::getCurrent()->assertLongsEqual((long)expected, (long)actual, file, line); }
+#if CPPUTEST_USE_LONG_LONG
+#define LONGLONGS_EQUAL(expected, actual)\
+ LONGLONGS_EQUAL_LOCATION(expected, actual, NULLPTR, __FILE__, __LINE__)
-#define UNSIGNED_LONGS_EQUAL_LOCATION(expected,actual,file,line)\
- { UtestShell::getCurrent()->assertUnsignedLongsEqual((unsigned long)expected, (unsigned long)actual, file, line); }
+#define LONGLONGS_EQUAL_TEXT(expected, actual, text)\
+ LONGLONGS_EQUAL_LOCATION(expected, actual, text, __FILE__, __LINE__)
+
+#define UNSIGNED_LONGLONGS_EQUAL(expected, actual)\
+ UNSIGNED_LONGLONGS_EQUAL_LOCATION(expected, actual, NULLPTR, __FILE__, __LINE__)
+
+#define UNSIGNED_LONGLONGS_EQUAL_TEXT(expected, actual, text)\
+ UNSIGNED_LONGLONGS_EQUAL_LOCATION(expected, actual, text, __FILE__, __LINE__)
+
+#define LONGLONGS_EQUAL_LOCATION(expected, actual, text, file, line)\
+ do { UtestShell::getCurrent()->assertLongLongsEqual((cpputest_longlong)(expected), (cpputest_longlong)(actual), text, file, line); } while(0)
+
+#define UNSIGNED_LONGLONGS_EQUAL_LOCATION(expected, actual, text, file, line)\
+ do { UtestShell::getCurrent()->assertUnsignedLongLongsEqual((cpputest_ulonglong)(expected), (cpputest_ulonglong)(actual), text, file, line); } while(0)
+#endif // CPPUTEST_USE_LONG_LONG
#define BYTES_EQUAL(expected, actual)\
LONGS_EQUAL((expected) & 0xff,(actual) & 0xff)
+#define BYTES_EQUAL_TEXT(expected, actual, text)\
+ LONGS_EQUAL_TEXT((expected) & 0xff, (actual) & 0xff, text)
+
+#define SIGNED_BYTES_EQUAL(expected, actual)\
+ SIGNED_BYTES_EQUAL_LOCATION(expected, actual, __FILE__, __LINE__)
+
+#define SIGNED_BYTES_EQUAL_LOCATION(expected, actual, file, line) \
+ do { UtestShell::getCurrent()->assertSignedBytesEqual(expected, actual, NULLPTR, file, line); } while(0)
+
+#define SIGNED_BYTES_EQUAL_TEXT(expected, actual, text)\
+ SIGNED_BYTES_EQUAL_TEXT_LOCATION(expected, actual, text, __FILE__, __LINE__)
+
+#define SIGNED_BYTES_EQUAL_TEXT_LOCATION(expected, actual, text, file, line) \
+ do { UtestShell::getCurrent()->assertSignedBytesEqual(expected, actual, text, file, line); } while(0)
+
#define POINTERS_EQUAL(expected, actual)\
- POINTERS_EQUAL_LOCATION((expected),(actual), __FILE__, __LINE__)
+ POINTERS_EQUAL_LOCATION((expected), (actual), NULLPTR, __FILE__, __LINE__)
+
+#define POINTERS_EQUAL_TEXT(expected, actual, text)\
+ POINTERS_EQUAL_LOCATION((expected), (actual), text, __FILE__, __LINE__)
+
+#define POINTERS_EQUAL_LOCATION(expected, actual, text, file, line)\
+ do { UtestShell::getCurrent()->assertPointersEqual((const void *)(expected), (const void *)(actual), text, file, line); } while(0)
+
+#define FUNCTIONPOINTERS_EQUAL(expected, actual)\
+ FUNCTIONPOINTERS_EQUAL_LOCATION((expected), (actual), NULLPTR, __FILE__, __LINE__)
+
+#define FUNCTIONPOINTERS_EQUAL_TEXT(expected, actual, text)\
+ FUNCTIONPOINTERS_EQUAL_LOCATION((expected), (actual), text, __FILE__, __LINE__)
-#define POINTERS_EQUAL_LOCATION(expected,actual,file,line)\
- { UtestShell::getCurrent()->assertPointersEqual((void *)expected, (void *)actual, file, line); }
+#define FUNCTIONPOINTERS_EQUAL_LOCATION(expected, actual, text, file, line)\
+ do { UtestShell::getCurrent()->assertFunctionPointersEqual((void (*)())(expected), (void (*)())(actual), text, file, line); } while(0)
//Check two doubles for equality within a tolerance threshold
-#define DOUBLES_EQUAL(expected,actual,threshold)\
- DOUBLES_EQUAL_LOCATION(expected,actual,threshold,__FILE__,__LINE__)
+#define DOUBLES_EQUAL(expected, actual, threshold)\
+ DOUBLES_EQUAL_LOCATION(expected, actual, threshold, NULLPTR, __FILE__, __LINE__)
+
+#define DOUBLES_EQUAL_TEXT(expected, actual, threshold, text)\
+ DOUBLES_EQUAL_LOCATION(expected, actual, threshold, text, __FILE__, __LINE__)
+
+#define DOUBLES_EQUAL_LOCATION(expected, actual, threshold, text, file, line)\
+ do { UtestShell::getCurrent()->assertDoublesEqual(expected, actual, threshold, text, file, line); } while(0)
+
+#define MEMCMP_EQUAL(expected, actual, size)\
+ MEMCMP_EQUAL_LOCATION(expected, actual, size, NULLPTR, __FILE__, __LINE__)
+
+#define MEMCMP_EQUAL_TEXT(expected, actual, size, text)\
+ MEMCMP_EQUAL_LOCATION(expected, actual, size, text, __FILE__, __LINE__)
+
+#define MEMCMP_EQUAL_LOCATION(expected, actual, size, text, file, line)\
+ do { UtestShell::getCurrent()->assertBinaryEqual(expected, actual, size, text, file, line); } while(0)
+
+#define BITS_EQUAL(expected, actual, mask)\
+ BITS_LOCATION(expected, actual, mask, NULLPTR, __FILE__, __LINE__)
-#define DOUBLES_EQUAL_LOCATION(expected,actual,threshold,file,line)\
- { UtestShell::getCurrent()->assertDoublesEqual(expected, actual, threshold, file, line); }
+#define BITS_EQUAL_TEXT(expected, actual, mask, text)\
+ BITS_LOCATION(expected, actual, mask, text, __FILE__, __LINE__)
+
+#define BITS_LOCATION(expected, actual, mask, text, file, line)\
+ do { UtestShell::getCurrent()->assertBitsEqual(expected, actual, mask, sizeof(actual), text, file, line); } while(0) // NOLINT(bugprone-sizeof-expression)
+
+#define ENUMS_EQUAL_INT(expected, actual)\
+ ENUMS_EQUAL_TYPE(int, expected, actual)
+
+#define ENUMS_EQUAL_INT_TEXT(expected, actual, text)\
+ ENUMS_EQUAL_TYPE_TEXT(int, expected, actual, text)
+
+#define ENUMS_EQUAL_TYPE(underlying_type, expected, actual)\
+ ENUMS_EQUAL_TYPE_LOCATION(underlying_type, expected, actual, NULLPTR, __FILE__, __LINE__)
+
+#define ENUMS_EQUAL_TYPE_TEXT(underlying_type, expected, actual, text)\
+ ENUMS_EQUAL_TYPE_LOCATION(underlying_type, expected, actual, text, __FILE__, __LINE__)
+
+#define ENUMS_EQUAL_TYPE_LOCATION(underlying_type, expected, actual, text, file, line)\
+ do { underlying_type expected_underlying_value = (underlying_type)(expected); \
+ underlying_type actual_underlying_value = (underlying_type)(actual); \
+ if (expected_underlying_value != actual_underlying_value) { \
+ UtestShell::getCurrent()->assertEquals(true, StringFrom(expected_underlying_value).asCharString(), StringFrom(actual_underlying_value).asCharString(), text, file, line); \
+ } \
+ else \
+ { \
+ UtestShell::getCurrent()->assertLongsEqual((long)0, long(0), NULLPTR, file, line); \
+ } \
+ } while(0)
//Fail if you get to this macro
//The macro FAIL may already be taken, so allow FAIL_TEST too
@@ -196,40 +345,46 @@
FAIL_LOCATION(text, __FILE__,__LINE__)
#define FAIL_LOCATION(text, file, line)\
- { UtestShell::getCurrent()->fail(text, file, line); }
+ do { UtestShell::getCurrent()->fail(text, file, line); } while(0)
#endif
#define FAIL_TEST(text)\
FAIL_TEST_LOCATION(text, __FILE__,__LINE__)
#define FAIL_TEST_LOCATION(text, file,line)\
- { UtestShell::getCurrent()->fail(text, file, line); }
+ do { UtestShell::getCurrent()->fail(text, file, line); } while(0)
+
+#define TEST_EXIT\
+ do { UtestShell::getCurrent()->exitTest(); } while(0)
#define UT_PRINT_LOCATION(text, file, line) \
- { UtestShell::getCurrent()->print(text, file, line); }
+ do { UtestShell::getCurrent()->print(text, file, line); } while(0)
#define UT_PRINT(text) \
UT_PRINT_LOCATION(text, __FILE__, __LINE__)
-#if CPPUTEST_USE_STD_CPP_LIB
+#if CPPUTEST_HAVE_EXCEPTIONS
#define CHECK_THROWS(expected, expression) \
- { \
- SimpleString msg("expected to throw "#expected "\nbut threw nothing"); \
+ do { \
+ SimpleString failure_msg("expected to throw "#expected "\nbut threw nothing"); \
bool caught_expected = false; \
try { \
(expression); \
} catch(const expected &) { \
caught_expected = true; \
} catch(...) { \
- msg = "expected to throw " #expected "\nbut threw a different type"; \
+ failure_msg = "expected to throw " #expected "\nbut threw a different type"; \
} \
if (!caught_expected) { \
- UtestShell::getCurrent()->fail(msg.asCharString(), __FILE__, __LINE__); \
+ UtestShell::getCurrent()->fail(failure_msg.asCharString(), __FILE__, __LINE__); \
+ } \
+ else { \
+ UtestShell::getCurrent()->countCheck(); \
} \
- }
-#endif /* CPPUTEST_USE_STD_CPP_LIB */
+ } while(0)
+#endif /* CPPUTEST_HAVE_EXCEPTIONS */
-#define UT_CRASH() { UtestShell::crash(); }
+#define UT_CRASH() do { UtestShell::crash(); } while(0)
#define RUN_ALL_TESTS(ac, av) CommandLineTestRunner::RunAllTests(ac, av)
#endif /*D_UTestMacros_h*/
diff --git a/include/CppUTestExt/CodeMemoryReportFormatter.h b/include/CppUTestExt/CodeMemoryReportFormatter.h
index b52ec3429..6e87fe302 100644
--- a/include/CppUTestExt/CodeMemoryReportFormatter.h
+++ b/include/CppUTestExt/CodeMemoryReportFormatter.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -39,16 +39,16 @@ class CodeMemoryReportFormatter : public MemoryReportFormatter
public:
CodeMemoryReportFormatter(TestMemoryAllocator* internalAllocator);
- virtual ~CodeMemoryReportFormatter();
+ virtual ~CodeMemoryReportFormatter() CPPUTEST_DESTRUCTOR_OVERRIDE;
- virtual void report_testgroup_start(TestResult* result, UtestShell& test) _override;
- virtual void report_testgroup_end(TestResult* /*result*/, UtestShell& /*test*/) _override {}
+ virtual void report_testgroup_start(TestResult* result, UtestShell& test) CPPUTEST_OVERRIDE;
+ virtual void report_testgroup_end(TestResult* /*result*/, UtestShell& /*test*/) CPPUTEST_OVERRIDE {} // LCOV_EXCL_LINE
- virtual void report_test_start(TestResult* result, UtestShell& test) _override;
- virtual void report_test_end(TestResult* result, UtestShell& test) _override;
+ virtual void report_test_start(TestResult* result, UtestShell& test) CPPUTEST_OVERRIDE;
+ virtual void report_test_end(TestResult* result, UtestShell& test) CPPUTEST_OVERRIDE;
- virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator, size_t size, char* memory, const char* file, int line) _override;
- virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator, char* memory, const char* file, int line) _override;
+ virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator, size_t size, char* memory, const char* file, size_t line) CPPUTEST_OVERRIDE;
+ virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator, char* memory, const char* file, size_t line) CPPUTEST_OVERRIDE;
private:
@@ -58,10 +58,10 @@ class CodeMemoryReportFormatter : public MemoryReportFormatter
void clearReporting();
bool isNewAllocator(TestMemoryAllocator* allocator);
- SimpleString createVariableNameFromFileLineInfo(const char *file, int line);
+ SimpleString createVariableNameFromFileLineInfo(const char *file, size_t line);
SimpleString getAllocationString(TestMemoryAllocator* allocator, const SimpleString& variableName, size_t size);
- SimpleString getDeallocationString(TestMemoryAllocator* allocator, const SimpleString& variableName, const char* file, int line);
+ SimpleString getDeallocationString(TestMemoryAllocator* allocator, const SimpleString& variableName, const char* file, size_t line);
};
#endif
diff --git a/include/CppUTestExt/GMock.h b/include/CppUTestExt/GMock.h
index 61b59afd6..131597371 100644
--- a/include/CppUTestExt/GMock.h
+++ b/include/CppUTestExt/GMock.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -29,6 +29,8 @@
#define GMOCK_H_
#undef new
+#undef strdup
+#undef strndup
#undef RUN_ALL_TESTS
@@ -45,4 +47,8 @@ using testing::NiceMock;
#include "CppUTest/MemoryLeakDetectorNewMacros.h"
#endif
+#ifdef CPPUTEST_USE_MALLOC_MACROS
+#include "CppUTest/MemoryLeakDetectorMallocMacros.h"
+#endif
+
#endif
diff --git a/include/CppUTestExt/GTest.h b/include/CppUTestExt/GTest.h
index 73da89d08..a2472d3c7 100644
--- a/include/CppUTestExt/GTest.h
+++ b/include/CppUTestExt/GTest.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -25,10 +25,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef GTEST__H_
-#define GTEST__H_
+#ifndef GTEST_H_
+#define GTEST_H_
#undef new
+#undef strdup
+#undef strndup
#undef RUN_ALL_TESTS
@@ -38,6 +40,12 @@
#include "CppUTest/MemoryLeakDetectorNewMacros.h"
#endif
+#ifdef CPPUTEST_USE_MALLOC_MACROS
+#include "CppUTest/MemoryLeakDetectorMallocMacros.h"
+#endif
+
+#include "CppUTestExt/GTestSupport.h"
+
#ifndef RUN_ALL_TESTS
#define GTEST_VERSION_GTEST_1_7
#else
diff --git a/include/CppUTestExt/GTestConvertor.h b/include/CppUTestExt/GTestConvertor.h
index d7853ff1a..c606d6c18 100644
--- a/include/CppUTestExt/GTestConvertor.h
+++ b/include/CppUTestExt/GTestConvertor.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -30,8 +30,8 @@
#include "CppUTest/Utest.h"
-#ifdef GTEST__H_
-#error "Please include this file before you include any other GTest files"
+#ifdef GTEST_H_
+ #error "Please include this file before you include any other GTest files"
#endif
/*
@@ -63,10 +63,11 @@ class GTestShell : public UtestShell
::testing::TestInfo* testinfo_;
GTestShell* next_;
GTestFlagsThatAllocateMemory* flags_;
+
public:
GTestShell(::testing::TestInfo* testinfo, GTestShell* next, GTestFlagsThatAllocateMemory* flags);
- virtual Utest* createTest() _override;
+ virtual Utest* createTest() CPPUTEST_OVERRIDE;
GTestShell* nextGTest()
{
@@ -101,7 +102,7 @@ class GTestShell : public UtestShell
*
*/
#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
+#include "../src/gtest-internal-inl.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTest/TestFailure.h"
@@ -121,7 +122,7 @@ class GTestShell : public UtestShell
class GTestFlagsThatAllocateMemory
{
public:
- void storeValuesOfGTestFLags()
+ void storeValuesOfGTestFlags()
{
GTestFlagcolor = ::testing::GTEST_FLAG(color);
GTestFlagfilter = ::testing::GTEST_FLAG(filter);
@@ -145,7 +146,7 @@ class GTestFlagsThatAllocateMemory
#endif
}
- void setGTestFLagValuesToNULLToAvoidMemoryLeaks()
+ void setGTestFlagValuesToNULLToAvoidMemoryLeaks()
{
#ifndef GTEST_VERSION_GTEST_1_7
::testing::GTEST_FLAG(color) = GTEST_NO_STRING_VALUE;
@@ -207,7 +208,7 @@ class GMockTestTerminator : public TestTerminator
virtual void exitCurrentTest() const
{
/*
- * When using GMock, it throws an exception fromt he destructor leaving
+ * When using GMock, it throws an exception from the destructor leaving
* the system in an unstable state.
* Therefore, when the test fails because of failed gmock expectation
* then don't throw the exception, but let it return. Usually this should
@@ -300,7 +301,7 @@ class GTestUTest: public Utest {
::testing::UnitTest::GetInstance()->impl()->set_current_test_info(NULL);
delete test_;
- flags_->setGTestFLagValuesToNULLToAvoidMemoryLeaks();
+ flags_->setGTestFlagValuesToNULLToAvoidMemoryLeaks();
::testing::internal::DeathTest::set_last_death_test_message(GTEST_NO_STRING_VALUE);
}
@@ -366,7 +367,7 @@ inline void GTestConvertor::createDummyInSequenceToAndFailureReporterAvoidMemory
inline void GTestConvertor::addAllGTestToTestRegistry()
{
createDummyInSequenceToAndFailureReporterAvoidMemoryLeakInGMock();
- flags_.storeValuesOfGTestFLags();
+ flags_.storeValuesOfGTestFlags();
int argc = 2;
const char * argv[] = {"NameOfTheProgram", "--gmock_catch_leaked_mocks=0"};
diff --git a/include/Platforms/Gcc/Platform.h b/include/CppUTestExt/GTestSupport.h
similarity index 86%
rename from include/Platforms/Gcc/Platform.h
rename to include/CppUTestExt/GTestSupport.h
index 6dc0dc285..80892a0fa 100644
--- a/include/Platforms/Gcc/Platform.h
+++ b/include/CppUTestExt/GTestSupport.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
+ * Copyright (c) 2011, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -25,7 +25,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef D_Gcc_Platform_H
-#define D_Gcc_Platform_H
+#ifndef GTESTSUPPORT_H_
+#define GTESTSUPPORT_H_
+
+extern void CppuTestGTestIgnoreLeaksInTest();
#endif
diff --git a/include/CppUTestExt/IEEE754ExceptionsPlugin.h b/include/CppUTestExt/IEEE754ExceptionsPlugin.h
new file mode 100644
index 000000000..35a18181f
--- /dev/null
+++ b/include/CppUTestExt/IEEE754ExceptionsPlugin.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Michael Feathers, James Grenning, Bas Vodde
+ * and Arnd Strube. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of the nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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.
+ */
+
+#ifndef D_IEEE754ExceptionsPlugin_h
+#define D_IEEE754ExceptionsPlugin_h
+
+#include "CppUTest/TestPlugin.h"
+
+class IEEE754ExceptionsPlugin: public TestPlugin
+{
+public:
+ IEEE754ExceptionsPlugin(const SimpleString& name = "IEEE754ExceptionsPlugin");
+
+ virtual void preTestAction(UtestShell& test, TestResult& result) CPPUTEST_OVERRIDE;
+ virtual void postTestAction(UtestShell& test, TestResult& result) CPPUTEST_OVERRIDE;
+
+ static void disableInexact(void);
+ static void enableInexact(void);
+ static bool checkIeee754OverflowExceptionFlag();
+ static bool checkIeee754UnderflowExceptionFlag();
+ static bool checkIeee754InexactExceptionFlag();
+ static bool checkIeee754DivByZeroExceptionFlag();
+
+private:
+ void ieee754Check(UtestShell& test, TestResult& result, int flag, const char* text);
+ static bool inexactDisabled_;
+};
+
+#endif
diff --git a/include/CppUTestExt/MemoryReportAllocator.h b/include/CppUTestExt/MemoryReportAllocator.h
index 064c83514..2cca67e25 100644
--- a/include/CppUTestExt/MemoryReportAllocator.h
+++ b/include/CppUTestExt/MemoryReportAllocator.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -40,7 +40,7 @@ class MemoryReportAllocator : public TestMemoryAllocator
MemoryReportFormatter* formatter_;
public:
MemoryReportAllocator();
- virtual ~MemoryReportAllocator();
+ virtual ~MemoryReportAllocator() CPPUTEST_DESTRUCTOR_OVERRIDE;
virtual void setFormatter(MemoryReportFormatter* formatter);
virtual void setTestResult(TestResult* result);
@@ -48,12 +48,14 @@ class MemoryReportAllocator : public TestMemoryAllocator
virtual TestMemoryAllocator* getRealAllocator();
- virtual char* alloc_memory(size_t size, const char* file, int line) _override;
- virtual void free_memory(char* memory, const char* file, int line) _override;
+ virtual char* alloc_memory(size_t size, const char* file, size_t line) CPPUTEST_OVERRIDE;
+ virtual void free_memory(char* memory, size_t size, const char* file, size_t line) CPPUTEST_OVERRIDE;
- virtual const char* name() _override;
- virtual const char* alloc_name() _override;
- virtual const char* free_name() _override;
+ virtual const char* name() const CPPUTEST_OVERRIDE;
+ virtual const char* alloc_name() const CPPUTEST_OVERRIDE;
+ virtual const char* free_name() const CPPUTEST_OVERRIDE;
+
+ virtual TestMemoryAllocator* actualAllocator() CPPUTEST_OVERRIDE;
};
#endif
diff --git a/include/CppUTestExt/MemoryReportFormatter.h b/include/CppUTestExt/MemoryReportFormatter.h
index cde76e876..2c7af57aa 100644
--- a/include/CppUTestExt/MemoryReportFormatter.h
+++ b/include/CppUTestExt/MemoryReportFormatter.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -42,24 +42,24 @@ class MemoryReportFormatter
virtual void report_test_start(TestResult* result, UtestShell& test)=0;
virtual void report_test_end(TestResult* result, UtestShell& test)=0;
- virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator, size_t size, char* memory, const char* file, int line)=0;
- virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator, char* memory, const char* file, int line)=0;
+ virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator, size_t size, char* memory, const char* file, size_t line)=0;
+ virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator, char* memory, const char* file, size_t line)=0;
};
class NormalMemoryReportFormatter : public MemoryReportFormatter
{
public:
NormalMemoryReportFormatter();
- virtual ~NormalMemoryReportFormatter();
+ virtual ~NormalMemoryReportFormatter() CPPUTEST_DESTRUCTOR_OVERRIDE;
- virtual void report_testgroup_start(TestResult* /*result*/, UtestShell& /*test*/) _override;
- virtual void report_testgroup_end(TestResult* /*result*/, UtestShell& /*test*/) _override {}
+ virtual void report_testgroup_start(TestResult* /*result*/, UtestShell& /*test*/) CPPUTEST_OVERRIDE;
+ virtual void report_testgroup_end(TestResult* /*result*/, UtestShell& /*test*/) CPPUTEST_OVERRIDE {} // LCOV_EXCL_LINE
- virtual void report_test_start(TestResult* result, UtestShell& test) _override;
- virtual void report_test_end(TestResult* result, UtestShell& test) _override;
+ virtual void report_test_start(TestResult* result, UtestShell& test) CPPUTEST_OVERRIDE;
+ virtual void report_test_end(TestResult* result, UtestShell& test) CPPUTEST_OVERRIDE;
- virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator, size_t size, char* memory, const char* file, int line) _override;
- virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator, char* memory, const char* file, int line) _override;
+ virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator, size_t size, char* memory, const char* file, size_t line) CPPUTEST_OVERRIDE;
+ virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator, char* memory, const char* file, size_t line) CPPUTEST_OVERRIDE;
};
#endif
diff --git a/include/CppUTestExt/MemoryReporterPlugin.h b/include/CppUTestExt/MemoryReporterPlugin.h
index 57733558c..5b1816f9b 100644
--- a/include/CppUTestExt/MemoryReporterPlugin.h
+++ b/include/CppUTestExt/MemoryReporterPlugin.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -44,12 +44,15 @@ class MemoryReporterPlugin : public TestPlugin
SimpleString currentTestGroup_;
public:
MemoryReporterPlugin();
- virtual ~MemoryReporterPlugin();
+ virtual ~MemoryReporterPlugin() CPPUTEST_DESTRUCTOR_OVERRIDE;
- virtual void preTestAction(UtestShell & test, TestResult & result) _override;
- virtual void postTestAction(UtestShell & test, TestResult & result) _override;
- virtual bool parseArguments(int, const char**, int) _override;
+ virtual void preTestAction(UtestShell & test, TestResult & result) CPPUTEST_OVERRIDE;
+ virtual void postTestAction(UtestShell & test, TestResult & result) CPPUTEST_OVERRIDE;
+ virtual bool parseArguments(int, const char *const *, int) CPPUTEST_OVERRIDE;
+ MemoryReportAllocator* getMallocAllocator();
+ MemoryReportAllocator* getNewAllocator();
+ MemoryReportAllocator* getNewArrayAllocator();
protected:
virtual MemoryReportFormatter* createMemoryFormatter(const SimpleString& type);
diff --git a/include/CppUTestExt/MockActualCall.h b/include/CppUTestExt/MockActualCall.h
index 970a1cbb2..51f2fa7e5 100644
--- a/include/CppUTestExt/MockActualCall.h
+++ b/include/CppUTestExt/MockActualCall.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -28,6 +28,7 @@
#ifndef D_MockActualCall_h
#define D_MockActualCall_h
+#include "CppUTest/CppUTestConfig.h"
#include "CppUTest/TestHarness.h"
#include "CppUTestExt/MockNamedValue.h"
#include "CppUTestExt/MockExpectedCallsList.h"
@@ -42,30 +43,44 @@ class MockActualCall
virtual ~MockActualCall();
virtual MockActualCall& withName(const SimpleString& name)=0;
- virtual MockActualCall& withCallOrder(int callOrder)=0;
+ virtual MockActualCall& withCallOrder(unsigned int callOrder)=0;
+ MockActualCall& withParameter(const SimpleString& name, bool value) { return withBoolParameter(name, value); }
MockActualCall& withParameter(const SimpleString& name, int value) { return withIntParameter(name, value); }
MockActualCall& withParameter(const SimpleString& name, unsigned int value) { return withUnsignedIntParameter(name, value); }
MockActualCall& withParameter(const SimpleString& name, long int value) { return withLongIntParameter(name, value); }
MockActualCall& withParameter(const SimpleString& name, unsigned long int value) { return withUnsignedLongIntParameter(name, value); }
+ MockActualCall& withParameter(const SimpleString& name, cpputest_longlong value) { return withLongLongIntParameter(name, value); }
+ MockActualCall& withParameter(const SimpleString& name, cpputest_ulonglong value) { return withUnsignedLongLongIntParameter(name, value); }
MockActualCall& withParameter(const SimpleString& name, double value) { return withDoubleParameter(name, value); }
MockActualCall& withParameter(const SimpleString& name, const char* value) { return withStringParameter(name, value); }
MockActualCall& withParameter(const SimpleString& name, void* value) { return withPointerParameter(name, value); }
+ MockActualCall& withParameter(const SimpleString& name, void (*value)()) { return withFunctionPointerParameter(name, value); }
MockActualCall& withParameter(const SimpleString& name, const void* value) { return withConstPointerParameter(name, value); }
+ MockActualCall& withParameter(const SimpleString& name, const unsigned char* value, size_t size) { return withMemoryBufferParameter(name, value, size); }
virtual MockActualCall& withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value)=0;
virtual MockActualCall& withOutputParameter(const SimpleString& name, void* output)=0;
+ virtual MockActualCall& withOutputParameterOfType(const SimpleString& typeName, const SimpleString& name, void* output)=0;
+ virtual MockActualCall& withBoolParameter(const SimpleString& name, bool value)=0;
virtual MockActualCall& withIntParameter(const SimpleString& name, int value)=0;
virtual MockActualCall& withUnsignedIntParameter(const SimpleString& name, unsigned int value)=0;
virtual MockActualCall& withLongIntParameter(const SimpleString& name, long int value)=0;
virtual MockActualCall& withUnsignedLongIntParameter(const SimpleString& name, unsigned long int value)=0;
+ virtual MockActualCall& withLongLongIntParameter(const SimpleString& name, cpputest_longlong value)=0;
+ virtual MockActualCall& withUnsignedLongLongIntParameter(const SimpleString& name, cpputest_ulonglong value)=0;
virtual MockActualCall& withDoubleParameter(const SimpleString& name, double value)=0;
virtual MockActualCall& withStringParameter(const SimpleString& name, const char* value)=0;
virtual MockActualCall& withPointerParameter(const SimpleString& name, void* value)=0;
+ virtual MockActualCall& withFunctionPointerParameter(const SimpleString& name, void (*value)())=0;
virtual MockActualCall& withConstPointerParameter(const SimpleString& name, const void* value)=0;
+ virtual MockActualCall& withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size)=0;
virtual bool hasReturnValue()=0;
virtual MockNamedValue returnValue()=0;
+ virtual bool returnBoolValueOrDefault(bool default_value)=0;
+ virtual bool returnBoolValue()=0;
+
virtual int returnIntValueOrDefault(int default_value)=0;
virtual int returnIntValue()=0;
@@ -75,6 +90,12 @@ class MockActualCall
virtual long int returnLongIntValue()=0;
virtual long int returnLongIntValueOrDefault(long int default_value)=0;
+ virtual cpputest_ulonglong returnUnsignedLongLongIntValue()=0;
+ virtual cpputest_ulonglong returnUnsignedLongLongIntValueOrDefault(cpputest_ulonglong default_value)=0;
+
+ virtual cpputest_longlong returnLongLongIntValue()=0;
+ virtual cpputest_longlong returnLongLongIntValueOrDefault(cpputest_longlong default_value)=0;
+
virtual unsigned int returnUnsignedIntValue()=0;
virtual unsigned int returnUnsignedIntValueOrDefault(unsigned int default_value)=0;
@@ -90,7 +111,10 @@ class MockActualCall
virtual const void * returnConstPointerValue()=0;
virtual const void * returnConstPointerValueOrDefault(const void * default_value)=0;
- virtual MockActualCall& onObject(void* objectPtr)=0;
+ virtual void (*returnFunctionPointerValue())()=0;
+ virtual void (*returnFunctionPointerValueOrDefault(void (*default_value)()))()=0;
+
+ virtual MockActualCall& onObject(const void* objectPtr)=0;
};
#endif
diff --git a/include/CppUTestExt/MockCheckedActualCall.h b/include/CppUTestExt/MockCheckedActualCall.h
index 529edb6f4..51b12e405 100644
--- a/include/CppUTestExt/MockCheckedActualCall.h
+++ b/include/CppUTestExt/MockCheckedActualCall.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -34,50 +34,69 @@
class MockCheckedActualCall : public MockActualCall
{
public:
- MockCheckedActualCall(int callOrder, MockFailureReporter* reporter, const MockExpectedCallsList& expectations);
- virtual ~MockCheckedActualCall();
+ MockCheckedActualCall(unsigned int callOrder, MockFailureReporter* reporter, const MockExpectedCallsList& expectations);
+ virtual ~MockCheckedActualCall() CPPUTEST_DESTRUCTOR_OVERRIDE;
- virtual MockActualCall& withName(const SimpleString& name) _override;
- virtual MockActualCall& withCallOrder(int) _override;
- virtual MockActualCall& withIntParameter(const SimpleString& name, int value) _override;
- virtual MockActualCall& withUnsignedIntParameter(const SimpleString& name, unsigned int value) _override;
- virtual MockActualCall& withLongIntParameter(const SimpleString& name, long int value) _override;
- virtual MockActualCall& withUnsignedLongIntParameter(const SimpleString& name, unsigned long int value) _override;
- virtual MockActualCall& withDoubleParameter(const SimpleString& name, double value) _override;
- virtual MockActualCall& withStringParameter(const SimpleString& name, const char* value) _override;
- virtual MockActualCall& withPointerParameter(const SimpleString& name, void* value) _override;
- virtual MockActualCall& withConstPointerParameter(const SimpleString& name, const void* value) _override;
- virtual MockActualCall& withParameterOfType(const SimpleString& type, const SimpleString& name, const void* value) _override;
- virtual MockActualCall& withOutputParameter(const SimpleString& name, void* output) _override;
+ virtual MockActualCall& withName(const SimpleString& name) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withCallOrder(unsigned int) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withBoolParameter(const SimpleString& name, bool value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withIntParameter(const SimpleString& name, int value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withUnsignedIntParameter(const SimpleString& name, unsigned int value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withLongIntParameter(const SimpleString& name, long int value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withUnsignedLongIntParameter(const SimpleString& name, unsigned long int value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withLongLongIntParameter(const SimpleString& name, cpputest_longlong value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withUnsignedLongLongIntParameter(const SimpleString& name, cpputest_ulonglong value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withDoubleParameter(const SimpleString& name, double value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withStringParameter(const SimpleString& name, const char* value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withPointerParameter(const SimpleString& name, void* value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withConstPointerParameter(const SimpleString& name, const void* value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withFunctionPointerParameter(const SimpleString& name, void (*value)()) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withParameterOfType(const SimpleString& type, const SimpleString& name, const void* value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withOutputParameter(const SimpleString& name, void* output) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withOutputParameterOfType(const SimpleString& type, const SimpleString& name, void* output) CPPUTEST_OVERRIDE;
- virtual bool hasReturnValue() _override;
- virtual MockNamedValue returnValue() _override;
+ virtual bool hasReturnValue() CPPUTEST_OVERRIDE;
+ virtual MockNamedValue returnValue() CPPUTEST_OVERRIDE;
- virtual int returnIntValueOrDefault(int default_value) _override;
- virtual int returnIntValue() _override;
+ virtual bool returnBoolValueOrDefault(bool default_value) CPPUTEST_OVERRIDE;
+ virtual bool returnBoolValue() CPPUTEST_OVERRIDE;
- virtual unsigned long int returnUnsignedLongIntValue() _override;
- virtual unsigned long int returnUnsignedLongIntValueOrDefault(unsigned long int) _override;
+ virtual int returnIntValueOrDefault(int default_value) CPPUTEST_OVERRIDE;
+ virtual int returnIntValue() CPPUTEST_OVERRIDE;
- virtual long int returnLongIntValue() _override;
- virtual long int returnLongIntValueOrDefault(long int default_value) _override;
+ virtual unsigned long int returnUnsignedLongIntValue() CPPUTEST_OVERRIDE;
+ virtual unsigned long int returnUnsignedLongIntValueOrDefault(unsigned long int) CPPUTEST_OVERRIDE;
- virtual unsigned int returnUnsignedIntValue() _override;
- virtual unsigned int returnUnsignedIntValueOrDefault(unsigned int default_value) _override;
+ virtual long int returnLongIntValue() CPPUTEST_OVERRIDE;
+ virtual long int returnLongIntValueOrDefault(long int default_value) CPPUTEST_OVERRIDE;
- virtual const char * returnStringValueOrDefault(const char * default_value) _override;
- virtual const char * returnStringValue() _override;
+ virtual cpputest_ulonglong returnUnsignedLongLongIntValue() CPPUTEST_OVERRIDE;
+ virtual cpputest_ulonglong returnUnsignedLongLongIntValueOrDefault(cpputest_ulonglong default_value) CPPUTEST_OVERRIDE;
- virtual double returnDoubleValue() _override;
- virtual double returnDoubleValueOrDefault(double default_value) _override;
+ virtual cpputest_longlong returnLongLongIntValue() CPPUTEST_OVERRIDE;
+ virtual cpputest_longlong returnLongLongIntValueOrDefault(cpputest_longlong default_value) CPPUTEST_OVERRIDE;
- virtual const void * returnConstPointerValue() _override;
- virtual const void * returnConstPointerValueOrDefault(const void * default_value) _override;
+ virtual unsigned int returnUnsignedIntValue() CPPUTEST_OVERRIDE;
+ virtual unsigned int returnUnsignedIntValueOrDefault(unsigned int default_value) CPPUTEST_OVERRIDE;
- virtual void * returnPointerValue() _override;
- virtual void * returnPointerValueOrDefault(void *) _override;
+ virtual const char * returnStringValueOrDefault(const char * default_value) CPPUTEST_OVERRIDE;
+ virtual const char * returnStringValue() CPPUTEST_OVERRIDE;
- virtual MockActualCall& onObject(void* objectPtr) _override;
+ virtual double returnDoubleValue() CPPUTEST_OVERRIDE;
+ virtual double returnDoubleValueOrDefault(double default_value) CPPUTEST_OVERRIDE;
+
+ virtual const void * returnConstPointerValue() CPPUTEST_OVERRIDE;
+ virtual const void * returnConstPointerValueOrDefault(const void * default_value) CPPUTEST_OVERRIDE;
+
+ virtual void * returnPointerValue() CPPUTEST_OVERRIDE;
+ virtual void * returnPointerValueOrDefault(void *) CPPUTEST_OVERRIDE;
+
+ typedef void (*FunctionPointerReturnValue)();
+ virtual FunctionPointerReturnValue returnFunctionPointerValue() CPPUTEST_OVERRIDE;
+ virtual FunctionPointerReturnValue returnFunctionPointerValueOrDefault(void (*)()) CPPUTEST_OVERRIDE;
+
+ virtual MockActualCall& onObject(const void* objectPtr) CPPUTEST_OVERRIDE;
virtual bool isFulfilled() const;
virtual bool hasFailed() const;
@@ -90,150 +109,209 @@ class MockCheckedActualCall : public MockActualCall
SimpleString getName() const;
virtual UtestShell* getTest() const;
virtual void callHasSucceeded();
- virtual void finalizeOutputParameters(MockCheckedExpectedCall* call);
- virtual void finalizeCallWhenFulfilled();
+ virtual void copyOutputParameters(MockCheckedExpectedCall* call);
+ virtual void completeCallWhenMatchIsFound();
virtual void failTest(const MockFailure& failure);
virtual void checkInputParameter(const MockNamedValue& actualParameter);
virtual void checkOutputParameter(const MockNamedValue& outputParameter);
+ virtual void discardCurrentlyMatchingExpectations();
enum ActualCallState {
- CALL_IN_PROGESS,
+ CALL_IN_PROGRESS,
CALL_FAILED,
CALL_SUCCEED
};
- virtual const char* stringFromState(ActualCallState state);
virtual void setState(ActualCallState state);
private:
SimpleString functionName_;
- int callOrder_;
+ unsigned int callOrder_;
MockFailureReporter* reporter_;
ActualCallState state_;
- MockCheckedExpectedCall* fulfilledExpectation_;
+ bool expectationsChecked_;
+ MockCheckedExpectedCall* matchingExpectation_;
- MockExpectedCallsList unfulfilledExpectations_;
+ MockExpectedCallsList potentiallyMatchingExpectations_;
const MockExpectedCallsList& allExpectations_;
class MockOutputParametersListNode
{
public:
- SimpleString* name_;
+ SimpleString name_;
+ SimpleString type_;
void* ptr_;
MockOutputParametersListNode* next_;
- MockOutputParametersListNode(SimpleString* name, void* ptr)
- : name_(name), ptr_(ptr), next_(NULL) {}
+ MockOutputParametersListNode(const SimpleString& name, const SimpleString& type, void* ptr)
+ : name_(name), type_(type), ptr_(ptr), next_(NULLPTR) {}
};
MockOutputParametersListNode* outputParameterExpectations_;
- virtual void addOutputParameter(const SimpleString& name, void* ptr);
- virtual void cleanUpOutputParameterList();
+ virtual void addOutputParameter(const SimpleString& name, const SimpleString& type, void* ptr);
+ void cleanUpOutputParameterList();
};
class MockActualCallTrace : public MockActualCall
{
public:
MockActualCallTrace();
- virtual ~MockActualCallTrace();
+ virtual ~MockActualCallTrace() CPPUTEST_DESTRUCTOR_OVERRIDE;
+
+ virtual MockActualCall& withName(const SimpleString& name) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withCallOrder(unsigned int) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withBoolParameter(const SimpleString& name, bool value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withIntParameter(const SimpleString& name, int value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withUnsignedIntParameter(const SimpleString& name, unsigned int value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withLongIntParameter(const SimpleString& name, long int value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withUnsignedLongIntParameter(const SimpleString& name, unsigned long int value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withLongLongIntParameter(const SimpleString& name, cpputest_longlong value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withUnsignedLongLongIntParameter(const SimpleString& name, cpputest_ulonglong value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withDoubleParameter(const SimpleString& name, double value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withStringParameter(const SimpleString& name, const char* value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withPointerParameter(const SimpleString& name, void* value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withConstPointerParameter(const SimpleString& name, const void* value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withFunctionPointerParameter(const SimpleString& name, void (*value)()) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withOutputParameter(const SimpleString& name, void* output) CPPUTEST_OVERRIDE;
+ virtual MockActualCall& withOutputParameterOfType(const SimpleString& typeName, const SimpleString& name, void* output) CPPUTEST_OVERRIDE;
+
+ virtual bool hasReturnValue() CPPUTEST_OVERRIDE;
+ virtual MockNamedValue returnValue() CPPUTEST_OVERRIDE;
+
+ virtual bool returnBoolValueOrDefault(bool default_value) CPPUTEST_OVERRIDE;
+ virtual bool returnBoolValue() CPPUTEST_OVERRIDE;
- virtual MockActualCall& withName(const SimpleString& name) _override;
- virtual MockActualCall& withCallOrder(int) _override;
- virtual MockActualCall& withIntParameter(const SimpleString& name, int value) _override;
- virtual MockActualCall& withUnsignedIntParameter(const SimpleString& name, unsigned int value) _override;
- virtual MockActualCall& withLongIntParameter(const SimpleString& name, long int value) _override;
- virtual MockActualCall& withUnsignedLongIntParameter(const SimpleString& name, unsigned long int value) _override;
- virtual MockActualCall& withDoubleParameter(const SimpleString& name, double value) _override;
- virtual MockActualCall& withStringParameter(const SimpleString& name, const char* value) _override;
- virtual MockActualCall& withPointerParameter(const SimpleString& name, void* value) _override;
- virtual MockActualCall& withConstPointerParameter(const SimpleString& name, const void* value) _override;
- virtual MockActualCall& withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value) _override;
- virtual MockActualCall& withOutputParameter(const SimpleString& name, void* output) _override;
+ virtual int returnIntValueOrDefault(int default_value) CPPUTEST_OVERRIDE;
+ virtual int returnIntValue() CPPUTEST_OVERRIDE;
- virtual bool hasReturnValue() _override;
- virtual MockNamedValue returnValue() _override;
+ virtual unsigned long int returnUnsignedLongIntValue() CPPUTEST_OVERRIDE;
+ virtual unsigned long int returnUnsignedLongIntValueOrDefault(unsigned long int) CPPUTEST_OVERRIDE;
- virtual int returnIntValueOrDefault(int default_value) _override;
- virtual int returnIntValue() _override;
+ virtual long int returnLongIntValue() CPPUTEST_OVERRIDE;
+ virtual long int returnLongIntValueOrDefault(long int default_value) CPPUTEST_OVERRIDE;
- virtual unsigned long int returnUnsignedLongIntValue() _override;
- virtual unsigned long int returnUnsignedLongIntValueOrDefault(unsigned long int) _override;
+ virtual cpputest_ulonglong returnUnsignedLongLongIntValue() CPPUTEST_OVERRIDE;
+ virtual cpputest_ulonglong returnUnsignedLongLongIntValueOrDefault(cpputest_ulonglong default_value) CPPUTEST_OVERRIDE;
- virtual long int returnLongIntValue() _override;
- virtual long int returnLongIntValueOrDefault(long int default_value) _override;
+ virtual cpputest_longlong returnLongLongIntValue() CPPUTEST_OVERRIDE;
+ virtual cpputest_longlong returnLongLongIntValueOrDefault(cpputest_longlong default_value) CPPUTEST_OVERRIDE;
- virtual unsigned int returnUnsignedIntValue() _override;
- virtual unsigned int returnUnsignedIntValueOrDefault(unsigned int default_value) _override;
+ virtual unsigned int returnUnsignedIntValue() CPPUTEST_OVERRIDE;
+ virtual unsigned int returnUnsignedIntValueOrDefault(unsigned int default_value) CPPUTEST_OVERRIDE;
- virtual const char * returnStringValueOrDefault(const char * default_value) _override;
- virtual const char * returnStringValue() _override;
+ virtual const char * returnStringValueOrDefault(const char * default_value) CPPUTEST_OVERRIDE;
+ virtual const char * returnStringValue() CPPUTEST_OVERRIDE;
- virtual double returnDoubleValue() _override;
- virtual double returnDoubleValueOrDefault(double default_value) _override;
+ virtual double returnDoubleValue() CPPUTEST_OVERRIDE;
+ virtual double returnDoubleValueOrDefault(double default_value) CPPUTEST_OVERRIDE;
- virtual void * returnPointerValue() _override;
- virtual void * returnPointerValueOrDefault(void *) _override;
+ virtual void * returnPointerValue() CPPUTEST_OVERRIDE;
+ virtual void * returnPointerValueOrDefault(void *) CPPUTEST_OVERRIDE;
- virtual const void * returnConstPointerValue() _override;
- virtual const void * returnConstPointerValueOrDefault(const void * default_value) _override;
+ virtual const void * returnConstPointerValue() CPPUTEST_OVERRIDE;
+ virtual const void * returnConstPointerValueOrDefault(const void * default_value) CPPUTEST_OVERRIDE;
- virtual MockActualCall& onObject(void* objectPtr) _override;
+ virtual MockCheckedActualCall::FunctionPointerReturnValue returnFunctionPointerValue() CPPUTEST_OVERRIDE;
+ virtual MockCheckedActualCall::FunctionPointerReturnValue returnFunctionPointerValueOrDefault(void (*)()) CPPUTEST_OVERRIDE;
+
+ virtual MockActualCall& onObject(const void* objectPtr) CPPUTEST_OVERRIDE;
const char* getTraceOutput();
void clear();
static MockActualCallTrace& instance();
+ static void clearInstance();
private:
SimpleString traceBuffer_;
+ static MockActualCallTrace* instance_;
+
void addParameterName(const SimpleString& name);
};
class MockIgnoredActualCall: public MockActualCall
{
public:
- virtual MockActualCall& withName(const SimpleString&) _override { return *this;}
- virtual MockActualCall& withCallOrder(int) _override { return *this; }
- virtual MockActualCall& withIntParameter(const SimpleString&, int) _override { return *this; }
- virtual MockActualCall& withUnsignedIntParameter(const SimpleString&, unsigned int) _override { return *this; }
- virtual MockActualCall& withLongIntParameter(const SimpleString&, long int) _override { return *this; }
- virtual MockActualCall& withUnsignedLongIntParameter(const SimpleString&, unsigned long int) _override { return *this; }
- virtual MockActualCall& withDoubleParameter(const SimpleString&, double) _override { return *this; }
- virtual MockActualCall& withStringParameter(const SimpleString&, const char*) _override { return *this; }
- virtual MockActualCall& withPointerParameter(const SimpleString& , void*) _override { return *this; }
- virtual MockActualCall& withConstPointerParameter(const SimpleString& , const void*) _override { return *this; }
- virtual MockActualCall& withParameterOfType(const SimpleString&, const SimpleString&, const void*) _override { return *this; }
- virtual MockActualCall& withOutputParameter(const SimpleString&, void*) _override { return *this; }
+ virtual MockActualCall& withName(const SimpleString&) CPPUTEST_OVERRIDE { return *this;}
+ virtual MockActualCall& withCallOrder(unsigned int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withBoolParameter(const SimpleString&, bool) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withIntParameter(const SimpleString&, int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withUnsignedIntParameter(const SimpleString&, unsigned int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withLongIntParameter(const SimpleString&, long int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withUnsignedLongIntParameter(const SimpleString&, unsigned long int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withLongLongIntParameter(const SimpleString&, cpputest_longlong) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withUnsignedLongLongIntParameter(const SimpleString&, cpputest_ulonglong) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withDoubleParameter(const SimpleString&, double) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withStringParameter(const SimpleString&, const char*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withPointerParameter(const SimpleString& , void*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withConstPointerParameter(const SimpleString& , const void*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withFunctionPointerParameter(const SimpleString& , void (*)()) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withMemoryBufferParameter(const SimpleString&, const unsigned char*, size_t) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withParameterOfType(const SimpleString&, const SimpleString&, const void*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withOutputParameter(const SimpleString&, void*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockActualCall& withOutputParameterOfType(const SimpleString&, const SimpleString&, void*) CPPUTEST_OVERRIDE { return *this; }
+
+ virtual bool hasReturnValue() CPPUTEST_OVERRIDE { return false; }
+ virtual MockNamedValue returnValue() CPPUTEST_OVERRIDE { return MockNamedValue(""); }
+
+ virtual bool returnBoolValueOrDefault(bool value) CPPUTEST_OVERRIDE { return value; }
+ virtual bool returnBoolValue() CPPUTEST_OVERRIDE { return false; }
+
+ virtual int returnIntValue() CPPUTEST_OVERRIDE { return 0; }
+ virtual int returnIntValueOrDefault(int value) CPPUTEST_OVERRIDE { return value; }
+
+ virtual unsigned long int returnUnsignedLongIntValue() CPPUTEST_OVERRIDE { return 0; }
+ virtual unsigned long int returnUnsignedLongIntValueOrDefault(unsigned long int value) CPPUTEST_OVERRIDE { return value; }
+
+ virtual long int returnLongIntValue() CPPUTEST_OVERRIDE { return 0; }
+ virtual long int returnLongIntValueOrDefault(long int value) CPPUTEST_OVERRIDE { return value; }
+
+ virtual cpputest_ulonglong returnUnsignedLongLongIntValue() CPPUTEST_OVERRIDE
+ {
+#if CPPUTEST_USE_LONG_LONG
+ return 0;
+#else
+ cpputest_ulonglong ret = {};
+ return ret;
+#endif
+ }
- virtual bool hasReturnValue() _override { return false; }
- virtual MockNamedValue returnValue() _override { return MockNamedValue(""); }
+ virtual cpputest_ulonglong returnUnsignedLongLongIntValueOrDefault(cpputest_ulonglong value) CPPUTEST_OVERRIDE { return value; }
- virtual int returnIntValueOrDefault(int) _override { return 0; }
- virtual int returnIntValue() _override { return 0; }
+ virtual cpputest_longlong returnLongLongIntValue() CPPUTEST_OVERRIDE
+ {
+#if CPPUTEST_USE_LONG_LONG
+ return 0;
+#else
+ cpputest_longlong ret = {};
+ return ret;
+#endif
+ }
- virtual unsigned long int returnUnsignedLongIntValue() _override { return 0; }
- virtual unsigned long int returnUnsignedLongIntValueOrDefault(unsigned long int) _override { return 0; }
+ virtual cpputest_longlong returnLongLongIntValueOrDefault(cpputest_longlong value) CPPUTEST_OVERRIDE { return value; }
- virtual long int returnLongIntValue() _override { return 0; }
- virtual long int returnLongIntValueOrDefault(long int) _override { return returnLongIntValue(); }
+ virtual unsigned int returnUnsignedIntValue() CPPUTEST_OVERRIDE { return 0; }
+ virtual unsigned int returnUnsignedIntValueOrDefault(unsigned int value) CPPUTEST_OVERRIDE { return value; }
- virtual unsigned int returnUnsignedIntValue() _override { return 0; }
- virtual unsigned int returnUnsignedIntValueOrDefault(unsigned int) _override { return returnUnsignedIntValue(); }
+ virtual double returnDoubleValue() CPPUTEST_OVERRIDE { return 0.0; }
+ virtual double returnDoubleValueOrDefault(double value) CPPUTEST_OVERRIDE { return value; }
- virtual double returnDoubleValue() _override { return 0.0; }
- virtual double returnDoubleValueOrDefault(double) _override { return returnDoubleValue(); }
+ virtual const char * returnStringValue() CPPUTEST_OVERRIDE { return ""; }
+ virtual const char * returnStringValueOrDefault(const char * value) CPPUTEST_OVERRIDE { return value; }
- virtual const char * returnStringValueOrDefault(const char *) _override { return returnStringValue(); }
- virtual const char * returnStringValue() _override { return ""; }
+ virtual void * returnPointerValue() CPPUTEST_OVERRIDE { return NULLPTR; }
+ virtual void * returnPointerValueOrDefault(void * value) CPPUTEST_OVERRIDE { return value; }
- virtual void * returnPointerValue() _override { return NULL; }
- virtual void * returnPointerValueOrDefault(void * ) _override { return returnPointerValue(); }
+ virtual const void * returnConstPointerValue() CPPUTEST_OVERRIDE { return NULLPTR; }
+ virtual const void * returnConstPointerValueOrDefault(const void * value) CPPUTEST_OVERRIDE { return value; }
- virtual const void * returnConstPointerValue() _override { return NULL; }
- virtual const void * returnConstPointerValueOrDefault(const void *) _override { return returnConstPointerValue(); }
+ virtual MockCheckedActualCall::FunctionPointerReturnValue returnFunctionPointerValue() CPPUTEST_OVERRIDE { return NULLPTR; }
+ virtual MockCheckedActualCall::FunctionPointerReturnValue returnFunctionPointerValueOrDefault(void (*value)()) CPPUTEST_OVERRIDE { return value; }
- virtual MockActualCall& onObject(void* ) _override { return *this; }
+ virtual MockActualCall& onObject(const void* ) CPPUTEST_OVERRIDE { return *this; }
static MockIgnoredActualCall& instance();
};
diff --git a/include/CppUTestExt/MockCheckedExpectedCall.h b/include/CppUTestExt/MockCheckedExpectedCall.h
index b6bb02837..a1a87fd6e 100644
--- a/include/CppUTestExt/MockCheckedExpectedCall.h
+++ b/include/CppUTestExt/MockCheckedExpectedCall.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -36,35 +36,48 @@ class MockCheckedExpectedCall : public MockExpectedCall
public:
MockCheckedExpectedCall();
- virtual ~MockCheckedExpectedCall();
-
- virtual MockExpectedCall& withName(const SimpleString& name) _override;
- virtual MockExpectedCall& withCallOrder(int callOrder) _override;
- virtual MockExpectedCall& withIntParameter(const SimpleString& name, int value) _override;
- virtual MockExpectedCall& withUnsignedIntParameter(const SimpleString& name, unsigned int value) _override;
- virtual MockExpectedCall& withLongIntParameter(const SimpleString& name, long int value) _override;
- virtual MockExpectedCall& withUnsignedLongIntParameter(const SimpleString& name, unsigned long int value) _override;
- virtual MockExpectedCall& withDoubleParameter(const SimpleString& name, double value) _override;
- virtual MockExpectedCall& withStringParameter(const SimpleString& name, const char* value) _override;
- virtual MockExpectedCall& withPointerParameter(const SimpleString& name, void* value) _override;
- virtual MockExpectedCall& withConstPointerParameter(const SimpleString& name, const void* value) _override;
- virtual MockExpectedCall& withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value) _override;
- virtual MockExpectedCall& ignoreOtherParameters() _override;
- virtual MockExpectedCall& withOutputParameterReturning(const SimpleString& name, const void* value, size_t size) _override;
-
- virtual MockExpectedCall& andReturnValue(int value) _override;
- virtual MockExpectedCall& andReturnValue(unsigned int value) _override;
- virtual MockExpectedCall& andReturnValue(long int value) _override;
- virtual MockExpectedCall& andReturnValue(unsigned long int value) _override;
- virtual MockExpectedCall& andReturnValue(double value) _override;
- virtual MockExpectedCall& andReturnValue(const char* value) _override;
- virtual MockExpectedCall& andReturnValue(void* value) _override;
- virtual MockExpectedCall& andReturnValue(const void* value) _override;
-
- virtual bool hasReturnValue() _override;
+ MockCheckedExpectedCall(unsigned int numCalls);
+ virtual ~MockCheckedExpectedCall() CPPUTEST_DESTRUCTOR_OVERRIDE;
+
+ virtual MockExpectedCall& withName(const SimpleString& name) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withCallOrder(unsigned int callOrder) CPPUTEST_OVERRIDE { return withCallOrder(callOrder, callOrder); }
+ virtual MockExpectedCall& withCallOrder(unsigned int initialCallOrder, unsigned int finalCallOrder) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withBoolParameter(const SimpleString& name, bool value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withIntParameter(const SimpleString& name, int value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withUnsignedIntParameter(const SimpleString& name, unsigned int value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withLongIntParameter(const SimpleString& name, long int value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withUnsignedLongIntParameter(const SimpleString& name, unsigned long int value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withLongLongIntParameter(const SimpleString& name, cpputest_longlong value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withUnsignedLongLongIntParameter(const SimpleString& name, cpputest_ulonglong value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withDoubleParameter(const SimpleString& name, double value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withDoubleParameter(const SimpleString& name, double value, double tolerance) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withStringParameter(const SimpleString& name, const char* value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withPointerParameter(const SimpleString& name, void* value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withConstPointerParameter(const SimpleString& name, const void* value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withFunctionPointerParameter(const SimpleString& name, void (*value)()) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withOutputParameterReturning(const SimpleString& name, const void* value, size_t size) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withOutputParameterOfTypeReturning(const SimpleString& typeName, const SimpleString& name, const void* value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& withUnmodifiedOutputParameter(const SimpleString& name) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& ignoreOtherParameters() CPPUTEST_OVERRIDE;
+
+ virtual MockExpectedCall& andReturnValue(bool value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& andReturnValue(int value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& andReturnValue(unsigned int value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& andReturnValue(long int value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& andReturnValue(unsigned long int value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& andReturnValue(cpputest_longlong value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& andReturnValue(cpputest_ulonglong value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& andReturnValue(double value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& andReturnValue(const char* value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& andReturnValue(void* value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& andReturnValue(const void* value) CPPUTEST_OVERRIDE;
+ virtual MockExpectedCall& andReturnValue(void (*value)()) CPPUTEST_OVERRIDE;
+
virtual MockNamedValue returnValue();
- virtual MockExpectedCall& onObject(void* objectPtr) _override;
+ virtual MockExpectedCall& onObject(void* objectPtr) CPPUTEST_OVERRIDE;
virtual MockNamedValue getInputParameter(const SimpleString& name);
virtual MockNamedValue getOutputParameter(const SimpleString& name);
@@ -73,28 +86,31 @@ class MockCheckedExpectedCall : public MockExpectedCall
virtual bool hasInputParameterWithName(const SimpleString& name);
virtual bool hasInputParameter(const MockNamedValue& parameter);
+ virtual bool hasOutputParameterWithName(const SimpleString& name);
virtual bool hasOutputParameter(const MockNamedValue& parameter);
virtual bool relatesTo(const SimpleString& functionName);
- virtual bool relatesToObject(void*objectPtr) const;
+ virtual bool relatesToObject(const void* objectPtr) const;
virtual bool isFulfilled();
- virtual bool isFulfilledWithoutIgnoredParameters();
- virtual bool areParametersFulfilled();
- virtual bool areIgnoredParametersFulfilled();
+ virtual bool canMatchActualCalls();
+ virtual bool isMatchingActualCallAndFinalized();
+ virtual bool isMatchingActualCall();
+ virtual bool areParametersMatchingActualCall();
virtual bool isOutOfOrder() const;
- virtual void callWasMade(int callOrder);
+ virtual void callWasMade(unsigned int callOrder);
virtual void inputParameterWasPassed(const SimpleString& name);
virtual void outputParameterWasPassed(const SimpleString& name);
- virtual void parametersWereIgnored();
+ virtual void finalizeActualCallMatch();
virtual void wasPassedToObject();
- virtual void resetExpectation();
+ virtual void resetActualCallMatchingState();
virtual SimpleString callToString();
virtual SimpleString missingParametersToString();
- enum { NOT_CALLED_YET = -1, NO_EXPECTED_CALL_ORDER = -1};
- virtual int getCallOrder() const;
+ enum { NO_EXPECTED_CALL_ORDER = 0 };
+
+ virtual unsigned int getActualCallsFulfilled() const;
protected:
void setName(const SimpleString& name);
@@ -107,96 +123,71 @@ class MockCheckedExpectedCall : public MockExpectedCall
{
public:
MockExpectedFunctionParameter(const SimpleString& name);
- void setFulfilled(bool b);
- bool isFulfilled() const;
+ void setMatchesActualCall(bool b);
+ bool isMatchingActualCall() const;
private:
- bool fulfilled_;
+ bool matchesActualCall_;
};
MockExpectedFunctionParameter* item(MockNamedValueListNode* node);
bool ignoreOtherParameters_;
- bool parametersWereIgnored_;
- int callOrder_;
- int expectedCallOrder_;
+ bool isActualCallMatchFinalized_;
+ unsigned int initialExpectedCallOrder_;
+ unsigned int finalExpectedCallOrder_;
bool outOfOrder_;
MockNamedValueList* inputParameters_;
MockNamedValueList* outputParameters_;
MockNamedValue returnValue_;
void* objectPtr_;
+ bool isSpecificObjectExpected_;
bool wasPassedToObject_;
-};
-
-struct MockExpectedCallCompositeNode;
-class MockExpectedCallComposite : public MockExpectedCall
-{
-public:
- MockExpectedCallComposite();
- virtual ~MockExpectedCallComposite();
-
- virtual MockExpectedCall& withName(const SimpleString& name) _override;
- virtual MockExpectedCall& withCallOrder(int callOrder) _override;
- virtual MockExpectedCall& withIntParameter(const SimpleString& name, int value) _override;
- virtual MockExpectedCall& withUnsignedIntParameter(const SimpleString& name, unsigned int value) _override;
- virtual MockExpectedCall& withLongIntParameter(const SimpleString& name, long int value) _override;
- virtual MockExpectedCall& withUnsignedLongIntParameter(const SimpleString& name, unsigned long int value) _override;
- virtual MockExpectedCall& withDoubleParameter(const SimpleString& name, double value) _override;
- virtual MockExpectedCall& withStringParameter(const SimpleString& name, const char* value) _override;
- virtual MockExpectedCall& withConstPointerParameter(const SimpleString& name, const void* value) _override;
- virtual MockExpectedCall& withPointerParameter(const SimpleString& name, void* value) _override;
- virtual MockExpectedCall& withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value) _override;
- virtual MockExpectedCall& withOutputParameterReturning(const SimpleString& name, const void* value, size_t size) _override;
- virtual MockExpectedCall& ignoreOtherParameters() _override;
-
- virtual MockExpectedCall& andReturnValue(int value) _override;
- virtual MockExpectedCall& andReturnValue(unsigned int value) _override;
- virtual MockExpectedCall& andReturnValue(long int value) _override;
- virtual MockExpectedCall& andReturnValue(unsigned long int value) _override;
- virtual MockExpectedCall& andReturnValue(double value) _override;
- virtual MockExpectedCall& andReturnValue(const char* value) _override;
- virtual MockExpectedCall& andReturnValue(void* value) _override;
- virtual MockExpectedCall& andReturnValue(const void* value) _override;
-
- virtual bool hasReturnValue() _override;
-
- virtual MockExpectedCall& onObject(void* objectPtr) _override;
-
- virtual void add(MockExpectedCall& call);
- virtual void clear();
-private:
- MockExpectedCallCompositeNode* head_;
+ unsigned int actualCalls_;
+ unsigned int expectedCalls_;
};
class MockIgnoredExpectedCall: public MockExpectedCall
{
public:
- virtual MockExpectedCall& withName(const SimpleString&) _override { return *this;}
- virtual MockExpectedCall& withCallOrder(int) _override { return *this; }
- virtual MockExpectedCall& withIntParameter(const SimpleString&, int) _override { return *this; }
- virtual MockExpectedCall& withUnsignedIntParameter(const SimpleString&, unsigned int) _override{ return *this; }
- virtual MockExpectedCall& withLongIntParameter(const SimpleString&, long int) _override { return *this; }
- virtual MockExpectedCall& withUnsignedLongIntParameter(const SimpleString&, unsigned long int) _override { return *this; }
- virtual MockExpectedCall& withDoubleParameter(const SimpleString&, double) _override { return *this; }
- virtual MockExpectedCall& withStringParameter(const SimpleString&, const char*) _override { return *this; }
- virtual MockExpectedCall& withPointerParameter(const SimpleString& , void*) _override { return *this; }
- virtual MockExpectedCall& withConstPointerParameter(const SimpleString& , const void*) _override { return *this; }
- virtual MockExpectedCall& withParameterOfType(const SimpleString&, const SimpleString&, const void*) _override { return *this; }
- virtual MockExpectedCall& withOutputParameterReturning(const SimpleString&, const void*, size_t) { return *this; }
-
- virtual MockExpectedCall& andReturnValue(int) _override { return *this; }
- virtual MockExpectedCall& andReturnValue(unsigned int) _override { return *this; }
- virtual MockExpectedCall& andReturnValue(long int) _override { return *this; }
- virtual MockExpectedCall& andReturnValue(unsigned long int) _override { return *this; }
- virtual MockExpectedCall& andReturnValue(double) _override { return *this;}
- virtual MockExpectedCall& andReturnValue(const char*) _override { return *this; }
- virtual MockExpectedCall& andReturnValue(void*) _override { return *this; }
- virtual MockExpectedCall& andReturnValue(const void*) _override { return *this; }
-
- virtual bool hasReturnValue() _override { return false; }
-
- virtual MockExpectedCall& onObject(void*) _override { return *this; }
+ virtual MockExpectedCall& withName(const SimpleString&) CPPUTEST_OVERRIDE { return *this;}
+ virtual MockExpectedCall& withCallOrder(unsigned int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withCallOrder(unsigned int, unsigned int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withBoolParameter(const SimpleString&, bool) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withIntParameter(const SimpleString&, int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withUnsignedIntParameter(const SimpleString&, unsigned int) CPPUTEST_OVERRIDE{ return *this; }
+ virtual MockExpectedCall& withLongIntParameter(const SimpleString&, long int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withUnsignedLongIntParameter(const SimpleString&, unsigned long int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withLongLongIntParameter(const SimpleString&, cpputest_longlong) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withUnsignedLongLongIntParameter(const SimpleString&, cpputest_ulonglong) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withDoubleParameter(const SimpleString&, double) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withDoubleParameter(const SimpleString&, double, double) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withStringParameter(const SimpleString&, const char*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withPointerParameter(const SimpleString& , void*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withConstPointerParameter(const SimpleString& , const void*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withFunctionPointerParameter(const SimpleString& , void(*)()) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withMemoryBufferParameter(const SimpleString&, const unsigned char*, size_t) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withParameterOfType(const SimpleString&, const SimpleString&, const void*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withOutputParameterReturning(const SimpleString&, const void*, size_t) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withOutputParameterOfTypeReturning(const SimpleString&, const SimpleString&, const void*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& withUnmodifiedOutputParameter(const SimpleString&) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& ignoreOtherParameters() CPPUTEST_OVERRIDE { return *this;}
+
+ virtual MockExpectedCall& andReturnValue(bool) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& andReturnValue(int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& andReturnValue(unsigned int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& andReturnValue(long int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& andReturnValue(unsigned long int) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& andReturnValue(cpputest_longlong) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& andReturnValue(cpputest_ulonglong) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& andReturnValue(double) CPPUTEST_OVERRIDE { return *this;}
+ virtual MockExpectedCall& andReturnValue(const char*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& andReturnValue(void*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& andReturnValue(const void*) CPPUTEST_OVERRIDE { return *this; }
+ virtual MockExpectedCall& andReturnValue(void (*)()) CPPUTEST_OVERRIDE { return *this; }
+
+ virtual MockExpectedCall& onObject(void*) CPPUTEST_OVERRIDE { return *this; }
static MockExpectedCall& instance();
};
diff --git a/include/CppUTestExt/MockExpectedCall.h b/include/CppUTestExt/MockExpectedCall.h
index bc2758ff5..e043de886 100644
--- a/include/CppUTestExt/MockExpectedCall.h
+++ b/include/CppUTestExt/MockExpectedCall.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -28,6 +28,8 @@
#ifndef D_MockExpectedCall_h
#define D_MockExpectedCall_h
+#include "CppUTest/CppUTestConfig.h"
+
class MockNamedValue;
extern SimpleString StringFrom(const MockNamedValue& parameter);
@@ -39,36 +41,54 @@ class MockExpectedCall
virtual ~MockExpectedCall();
virtual MockExpectedCall& withName(const SimpleString& name)=0;
- virtual MockExpectedCall& withCallOrder(int)=0;
+ virtual MockExpectedCall& withCallOrder(unsigned int)=0;
+ virtual MockExpectedCall& withCallOrder(unsigned int, unsigned int)=0;
+ MockExpectedCall& withParameter(const SimpleString& name, bool value) { return withBoolParameter(name, value); }
MockExpectedCall& withParameter(const SimpleString& name, int value) { return withIntParameter(name, value); }
MockExpectedCall& withParameter(const SimpleString& name, unsigned int value) { return withUnsignedIntParameter(name, value); }
MockExpectedCall& withParameter(const SimpleString& name, long int value) { return withLongIntParameter(name, value); }
MockExpectedCall& withParameter(const SimpleString& name, unsigned long int value) { return withUnsignedLongIntParameter(name, value); }
+ MockExpectedCall& withParameter(const SimpleString& name, cpputest_longlong value) { return withLongLongIntParameter(name, value); }
+ MockExpectedCall& withParameter(const SimpleString& name, cpputest_ulonglong value) { return withUnsignedLongLongIntParameter(name, value); }
MockExpectedCall& withParameter(const SimpleString& name, double value) { return withDoubleParameter(name, value); }
+ MockExpectedCall& withParameter(const SimpleString& name, double value, double tolerance) { return withDoubleParameter(name, value, tolerance); }
MockExpectedCall& withParameter(const SimpleString& name, const char* value) { return withStringParameter(name, value); }
MockExpectedCall& withParameter(const SimpleString& name, void* value) { return withPointerParameter(name, value); }
MockExpectedCall& withParameter(const SimpleString& name, const void* value) { return withConstPointerParameter(name, value); }
+ MockExpectedCall& withParameter(const SimpleString& name, void (*value)()) { return withFunctionPointerParameter(name, value); }
+ MockExpectedCall& withParameter(const SimpleString& name, const unsigned char* value, size_t size) { return withMemoryBufferParameter(name, value, size); }
virtual MockExpectedCall& withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value)=0;
virtual MockExpectedCall& withOutputParameterReturning(const SimpleString& name, const void* value, size_t size)=0;
- virtual MockExpectedCall& ignoreOtherParameters() { return *this;}
+ virtual MockExpectedCall& withOutputParameterOfTypeReturning(const SimpleString& typeName, const SimpleString& name, const void* value)=0;
+ virtual MockExpectedCall& withUnmodifiedOutputParameter(const SimpleString& name)=0;
+ virtual MockExpectedCall& ignoreOtherParameters()=0;
+ virtual MockExpectedCall& withBoolParameter(const SimpleString& name, bool value)=0;
virtual MockExpectedCall& withIntParameter(const SimpleString& name, int value)=0;
virtual MockExpectedCall& withUnsignedIntParameter(const SimpleString& name, unsigned int value)=0;
virtual MockExpectedCall& withLongIntParameter(const SimpleString& name, long int value)=0;
virtual MockExpectedCall& withUnsignedLongIntParameter(const SimpleString& name, unsigned long int value)=0;
+ virtual MockExpectedCall& withLongLongIntParameter(const SimpleString& name, cpputest_longlong value)=0;
+ virtual MockExpectedCall& withUnsignedLongLongIntParameter(const SimpleString& name, cpputest_ulonglong value)=0;
virtual MockExpectedCall& withDoubleParameter(const SimpleString& name, double value)=0;
+ virtual MockExpectedCall& withDoubleParameter(const SimpleString& name, double value, double tolerance)=0;
virtual MockExpectedCall& withStringParameter(const SimpleString& name, const char* value)=0;
virtual MockExpectedCall& withPointerParameter(const SimpleString& name, void* value)=0;
+ virtual MockExpectedCall& withFunctionPointerParameter(const SimpleString& name, void (*value)())=0;
virtual MockExpectedCall& withConstPointerParameter(const SimpleString& name, const void* value)=0;
+ virtual MockExpectedCall& withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size)=0;
+ virtual MockExpectedCall& andReturnValue(bool value)=0;
virtual MockExpectedCall& andReturnValue(int value)=0;
virtual MockExpectedCall& andReturnValue(unsigned int value)=0;
virtual MockExpectedCall& andReturnValue(long int value)=0;
virtual MockExpectedCall& andReturnValue(unsigned long int value)=0;
+ virtual MockExpectedCall& andReturnValue(cpputest_longlong value)=0;
+ virtual MockExpectedCall& andReturnValue(cpputest_ulonglong value)=0;
virtual MockExpectedCall& andReturnValue(double value)=0;
virtual MockExpectedCall& andReturnValue(const char* value)=0;
virtual MockExpectedCall& andReturnValue(void* value)=0;
virtual MockExpectedCall& andReturnValue(const void* value)=0;
- virtual bool hasReturnValue()=0;
+ virtual MockExpectedCall& andReturnValue(void (*value)())=0;
virtual MockExpectedCall& onObject(void* objectPtr)=0;
};
diff --git a/include/CppUTestExt/MockExpectedCallsList.h b/include/CppUTestExt/MockExpectedCallsList.h
index 2865ef4ad..3cb2e651d 100644
--- a/include/CppUTestExt/MockExpectedCallsList.h
+++ b/include/CppUTestExt/MockExpectedCallsList.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -39,13 +39,12 @@ class MockExpectedCallsList
virtual ~MockExpectedCallsList();
virtual void deleteAllExpectationsAndClearList();
- virtual int size() const;
- virtual int amountOfExpectationsFor(const SimpleString& name) const;
- virtual int amountOfUnfulfilledExpectations() const;
- virtual bool hasUnfullfilledExpectations() const;
- virtual bool hasFulfilledExpectations() const;
- virtual bool hasFulfilledExpectationsWithoutIgnoredParameters() const;
- virtual bool hasUnfulfilledExpectationsBecauseOfMissingParameters() const;
+ virtual unsigned int size() const;
+ virtual unsigned int amountOfActualCallsFulfilledFor(const SimpleString& name) const;
+ virtual unsigned int amountOfUnfulfilledExpectations() const;
+ virtual bool hasUnfulfilledExpectations() const;
+ virtual bool hasFinalizedMatchingExpectations() const;
+ virtual bool hasUnmatchingExpectationsBecauseOfMissingParameters() const;
virtual bool hasExpectationWithName(const SimpleString& name) const;
virtual bool hasCallsOutOfOrder() const;
virtual bool isEmpty() const;
@@ -53,32 +52,31 @@ class MockExpectedCallsList
virtual void addExpectedCall(MockCheckedExpectedCall* call);
virtual void addExpectations(const MockExpectedCallsList& list);
virtual void addExpectationsRelatedTo(const SimpleString& name, const MockExpectedCallsList& list);
- virtual void addUnfilfilledExpectations(const MockExpectedCallsList& list);
+
+ virtual void onlyKeepOutOfOrderExpectations();
+ virtual void addPotentiallyMatchingExpectations(const MockExpectedCallsList& list);
virtual void onlyKeepExpectationsRelatedTo(const SimpleString& name);
virtual void onlyKeepExpectationsWithInputParameter(const MockNamedValue& parameter);
virtual void onlyKeepExpectationsWithInputParameterName(const SimpleString& name);
+ virtual void onlyKeepExpectationsWithOutputParameter(const MockNamedValue& parameter);
virtual void onlyKeepExpectationsWithOutputParameterName(const SimpleString& name);
- virtual void onlyKeepExpectationsOnObject(void* objectPtr);
- virtual void onlyKeepUnfulfilledExpectations();
- virtual void onlyKeepUnfulfilledExpectationsRelatedTo(const SimpleString& name);
- virtual void onlyKeepUnfulfilledExpectationsWithInputParameter(const MockNamedValue& parameter);
- virtual void onlyKeepUnfulfilledExpectationsWithOutputParameter(const MockNamedValue& parameter);
- virtual void onlyKeepUnfulfilledExpectationsOnObject(void* objectPtr);
-
- virtual MockCheckedExpectedCall* removeOneFulfilledExpectation();
- virtual MockCheckedExpectedCall* removeOneFulfilledExpectationWithIgnoredParameters();
- virtual MockCheckedExpectedCall* getOneFulfilledExpectationWithIgnoredParameters();
-
- virtual void resetExpectations();
- virtual void callWasMade(int callOrder);
+ virtual void onlyKeepExpectationsOnObject(const void* objectPtr);
+ virtual void onlyKeepUnmatchingExpectations();
+
+ virtual MockCheckedExpectedCall* removeFirstFinalizedMatchingExpectation();
+ virtual MockCheckedExpectedCall* removeFirstMatchingExpectation();
+ virtual MockCheckedExpectedCall* getFirstMatchingExpectation();
+
+ virtual void resetActualCallMatchingState();
virtual void wasPassedToObject();
virtual void parameterWasPassed(const SimpleString& parameterName);
virtual void outputParameterWasPassed(const SimpleString& parameterName);
virtual SimpleString unfulfilledCallsToString(const SimpleString& linePrefix = "") const;
virtual SimpleString fulfilledCallsToString(const SimpleString& linePrefix = "") const;
- virtual SimpleString missingParametersToString() const;
+ virtual SimpleString callsWithMissingParametersToString(const SimpleString& linePrefix,
+ const SimpleString& missingParametersPrefix) const;
protected:
virtual void pruneEmptyNodeFromList();
@@ -90,10 +88,9 @@ class MockExpectedCallsList
MockExpectedCallsListNode* next_;
MockExpectedCallsListNode(MockCheckedExpectedCall* expectedCall)
- : expectedCall_(expectedCall), next_(NULL) {}
+ : expectedCall_(expectedCall), next_(NULLPTR) {}
};
- virtual MockExpectedCallsListNode* findNodeWithCallOrderOf(int callOrder) const;
private:
MockExpectedCallsListNode* head_;
diff --git a/include/CppUTestExt/MockFailure.h b/include/CppUTestExt/MockFailure.h
index 9a96ca385..3ee4f73d3 100644
--- a/include/CppUTestExt/MockFailure.h
+++ b/include/CppUTestExt/MockFailure.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -47,14 +47,14 @@ class MockFailureReporter
virtual void failTest(const MockFailure& failure);
virtual UtestShell* getTestToFail();
- virtual void crashOnFailure() {crashOnFailure_ = true; }
+ virtual void crashOnFailure(bool shouldCrash) { crashOnFailure_ = shouldCrash; }
};
class MockFailure : public TestFailure
{
public:
MockFailure(UtestShell* test);
- virtual ~MockFailure(){}
+ virtual ~MockFailure() CPPUTEST_DESTRUCTOR_OVERRIDE {}
protected:
void addExpectationsAndCallHistory(const MockExpectedCallsList& expectations);
void addExpectationsAndCallHistoryRelatedTo(const SimpleString& function, const MockExpectedCallsList& expectations);
@@ -64,63 +64,61 @@ class MockExpectedCallsDidntHappenFailure : public MockFailure
{
public:
MockExpectedCallsDidntHappenFailure(UtestShell* test, const MockExpectedCallsList& expectations);
- virtual ~MockExpectedCallsDidntHappenFailure(){}
};
class MockUnexpectedCallHappenedFailure : public MockFailure
{
public:
MockUnexpectedCallHappenedFailure(UtestShell* test, const SimpleString& name, const MockExpectedCallsList& expectations);
- virtual ~MockUnexpectedCallHappenedFailure(){}
};
class MockCallOrderFailure : public MockFailure
{
public:
MockCallOrderFailure(UtestShell* test, const MockExpectedCallsList& expectations);
- virtual ~MockCallOrderFailure(){}
};
class MockUnexpectedInputParameterFailure : public MockFailure
{
public:
MockUnexpectedInputParameterFailure(UtestShell* test, const SimpleString& functionName, const MockNamedValue& parameter, const MockExpectedCallsList& expectations);
- virtual ~MockUnexpectedInputParameterFailure(){}
};
class MockUnexpectedOutputParameterFailure : public MockFailure
{
public:
MockUnexpectedOutputParameterFailure(UtestShell* test, const SimpleString& functionName, const MockNamedValue& parameter, const MockExpectedCallsList& expectations);
- virtual ~MockUnexpectedOutputParameterFailure(){}
};
class MockExpectedParameterDidntHappenFailure : public MockFailure
{
public:
- MockExpectedParameterDidntHappenFailure(UtestShell* test, const SimpleString& functionName, const MockExpectedCallsList& expectations);
- virtual ~MockExpectedParameterDidntHappenFailure(){}
+ MockExpectedParameterDidntHappenFailure(UtestShell* test, const SimpleString& functionName, const MockExpectedCallsList& allExpectations,
+ const MockExpectedCallsList& matchingExpectations);
};
class MockNoWayToCompareCustomTypeFailure : public MockFailure
{
public:
MockNoWayToCompareCustomTypeFailure(UtestShell* test, const SimpleString& typeName);
- virtual ~MockNoWayToCompareCustomTypeFailure(){}
+};
+
+class MockNoWayToCopyCustomTypeFailure : public MockFailure
+{
+public:
+ MockNoWayToCopyCustomTypeFailure(UtestShell* test, const SimpleString& typeName);
};
class MockUnexpectedObjectFailure : public MockFailure
{
public:
- MockUnexpectedObjectFailure(UtestShell* test, const SimpleString& functionName, void* expected, const MockExpectedCallsList& expectations);
- virtual ~MockUnexpectedObjectFailure(){}
+ MockUnexpectedObjectFailure(UtestShell* test, const SimpleString& functionName, const void* expected, const MockExpectedCallsList& expectations);
};
class MockExpectedObjectDidntHappenFailure : public MockFailure
{
public:
MockExpectedObjectDidntHappenFailure(UtestShell* test, const SimpleString& functionName, const MockExpectedCallsList& expectations);
- virtual ~MockExpectedObjectDidntHappenFailure(){}
};
#endif
diff --git a/include/CppUTestExt/MockNamedValue.h b/include/CppUTestExt/MockNamedValue.h
index e88cac16d..b6e5be2cc 100644
--- a/include/CppUTestExt/MockNamedValue.h
+++ b/include/CppUTestExt/MockNamedValue.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -27,8 +27,11 @@
#ifndef D_MockNamedValue_h
#define D_MockNamedValue_h
+
+#include "CppUTest/CppUTestConfig.h"
+
/*
- * MockParameterComparator is an interface that needs to be used when creating Comparators.
+ * MockNamedValueComparator is an interface that needs to be used when creating Comparators.
* This is needed when comparing values of non-native type.
*/
@@ -42,6 +45,21 @@ class MockNamedValueComparator
virtual SimpleString valueToString(const void* object)=0;
};
+/*
+ * MockNamedValueCopier is an interface that needs to be used when creating Copiers.
+ * This is needed when copying values of non-native type.
+ */
+
+class MockNamedValueCopier
+{
+public:
+ MockNamedValueCopier() {}
+ virtual ~MockNamedValueCopier() {}
+
+ virtual void copy(void* out, const void* in)=0;
+};
+
+
class MockFunctionComparator : public MockNamedValueComparator
{
public:
@@ -50,15 +68,27 @@ class MockFunctionComparator : public MockNamedValueComparator
MockFunctionComparator(isEqualFunction equal, valueToStringFunction valToString)
: equal_(equal), valueToString_(valToString) {}
- virtual ~MockFunctionComparator(){}
- virtual bool isEqual(const void* object1, const void* object2) _override { return equal_(object1, object2); }
- virtual SimpleString valueToString(const void* object) _override { return valueToString_(object); }
+ virtual bool isEqual(const void* object1, const void* object2) CPPUTEST_OVERRIDE { return equal_(object1, object2); }
+ virtual SimpleString valueToString(const void* object) CPPUTEST_OVERRIDE { return valueToString_(object); }
private:
isEqualFunction equal_;
valueToStringFunction valueToString_;
};
+class MockFunctionCopier : public MockNamedValueCopier
+{
+public:
+ typedef void (*copyFunction)(void*, const void*);
+
+ MockFunctionCopier(copyFunction copier) : copier_(copier) {}
+
+ virtual void copy(void* dst, const void* src) CPPUTEST_OVERRIDE { copier_(dst, src); }
+
+private:
+ copyFunction copier_;
+};
+
/*
* MockNamedValue is the generic value class used. It encapsulates basic types and can use them "as if one"
* Also it enables other types by putting object pointers. They can be compared with comparators.
@@ -66,7 +96,7 @@ class MockFunctionComparator : public MockNamedValueComparator
* Basically this class ties together a Name, a Value, a Type, and a Comparator
*/
-class MockNamedValueComparatorRepository;
+class MockNamedValueComparatorsAndCopiersRepository;
class MockNamedValue
{
public:
@@ -74,58 +104,92 @@ class MockNamedValue
DEFAULT_COPY_CONSTRUCTOR(MockNamedValue)
virtual ~MockNamedValue();
+ virtual void setValue(bool value);
virtual void setValue(int value);
virtual void setValue(unsigned int value);
virtual void setValue(long int value);
virtual void setValue(unsigned long int value);
+ virtual void setValue(cpputest_longlong value);
+ virtual void setValue(cpputest_ulonglong value);
virtual void setValue(double value);
+ virtual void setValue(double value, double tolerance);
virtual void setValue(void* value);
virtual void setValue(const void* value);
+ virtual void setValue(void (*value)());
virtual void setValue(const char* value);
- virtual void setObjectPointer(const SimpleString& type, const void* objectPtr);
+ virtual void setMemoryBuffer(const unsigned char* value, size_t size);
+ virtual void setConstObjectPointer(const SimpleString& type, const void* objectPtr);
+ virtual void setObjectPointer(const SimpleString& type, void* objectPtr);
virtual void setSize(size_t size);
- virtual void setComparator(MockNamedValueComparator* comparator);
virtual void setName(const char* name);
virtual bool equals(const MockNamedValue& p) const;
+ virtual bool compatibleForCopying(const MockNamedValue& p) const;
virtual SimpleString toString() const;
virtual SimpleString getName() const;
virtual SimpleString getType() const;
+ virtual bool getBoolValue() const;
virtual int getIntValue() const;
virtual unsigned int getUnsignedIntValue() const;
virtual long int getLongIntValue() const;
virtual unsigned long int getUnsignedLongIntValue() const;
+ virtual cpputest_longlong getLongLongIntValue() const;
+ virtual cpputest_ulonglong getUnsignedLongLongIntValue() const;
virtual double getDoubleValue() const;
+ virtual double getDoubleTolerance() const;
virtual const char* getStringValue() const;
virtual void* getPointerValue() const;
virtual const void* getConstPointerValue() const;
- virtual const void* getObjectPointer() const;
+ virtual void (*getFunctionPointerValue() const)();
+ virtual const unsigned char* getMemoryBuffer() const;
+ virtual const void* getConstObjectPointer() const;
+ virtual void* getObjectPointer() const;
virtual size_t getSize() const;
+
+
virtual MockNamedValueComparator* getComparator() const;
+ virtual MockNamedValueCopier* getCopier() const;
- static void setDefaultComparatorRepository(MockNamedValueComparatorRepository* repository);
+ static void setDefaultComparatorsAndCopiersRepository(MockNamedValueComparatorsAndCopiersRepository* repository);
+ static MockNamedValueComparatorsAndCopiersRepository* getDefaultComparatorsAndCopiersRepository();
+
+ static const double defaultDoubleTolerance;
private:
SimpleString name_;
SimpleString type_;
union {
+ bool boolValue_;
int intValue_;
unsigned int unsignedIntValue_;
long int longIntValue_;
unsigned long int unsignedLongIntValue_;
- double doubleValue_;
+#if CPPUTEST_USE_LONG_LONG
+ cpputest_longlong longLongIntValue_;
+ cpputest_ulonglong unsignedLongLongIntValue_;
+#else
+ char longLongPlaceholder_[CPPUTEST_SIZE_OF_FAKE_LONG_LONG_TYPE];
+#endif
+ struct {
+ double value;
+ double tolerance;
+ } doubleValue_;
const char* stringValue_;
void* pointerValue_;
const void* constPointerValue_;
- const void* objectPointerValue_;
+ void (*functionPointerValue_)();
+ const unsigned char* memoryBufferValue_;
+ const void* constObjectPointerValue_;
+ void* objectPointerValue_;
const void* outputPointerValue_;
} value_;
size_t size_;
MockNamedValueComparator* comparator_;
- static MockNamedValueComparatorRepository* defaultRepository_;
+ MockNamedValueCopier* copier_;
+ static MockNamedValueComparatorsAndCopiersRepository* defaultRepository_;
};
class MockNamedValueListNode
@@ -163,21 +227,23 @@ class MockNamedValueList
};
/*
- * MockParameterComparatorRepository is a class which stores comparators which can be used for comparing non-native types
+ * MockParameterComparatorRepository is a class which stores comparators and copiers which can be used for comparing non-native types
*
*/
-struct MockNamedValueComparatorRepositoryNode;
-class MockNamedValueComparatorRepository
+struct MockNamedValueComparatorsAndCopiersRepositoryNode;
+class MockNamedValueComparatorsAndCopiersRepository
{
- MockNamedValueComparatorRepositoryNode* head_;
+ MockNamedValueComparatorsAndCopiersRepositoryNode* head_;
public:
- MockNamedValueComparatorRepository();
- virtual ~MockNamedValueComparatorRepository();
+ MockNamedValueComparatorsAndCopiersRepository();
+ virtual ~MockNamedValueComparatorsAndCopiersRepository();
virtual void installComparator(const SimpleString& name, MockNamedValueComparator& comparator);
- virtual void installComparators(const MockNamedValueComparatorRepository& repository);
+ virtual void installCopier(const SimpleString& name, MockNamedValueCopier& copier);
+ virtual void installComparatorsAndCopiers(const MockNamedValueComparatorsAndCopiersRepository& repository);
virtual MockNamedValueComparator* getComparatorForType(const SimpleString& name);
+ virtual MockNamedValueCopier* getCopierForType(const SimpleString& name);
void clear();
};
diff --git a/include/CppUTestExt/MockSupport.h b/include/CppUTestExt/MockSupport.h
index 314f222fe..ea770ab3a 100644
--- a/include/CppUTestExt/MockSupport.h
+++ b/include/CppUTestExt/MockSupport.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -37,20 +37,23 @@ class UtestShell;
class MockSupport;
/* This allows access to "the global" mocking support for easier testing */
-MockSupport& mock(const SimpleString& mockName = "", MockFailureReporter* failureReporterForThisCall = NULL);
+MockSupport& mock(const SimpleString& mockName = "", MockFailureReporter* failureReporterForThisCall = NULLPTR);
class MockSupport
{
public:
- MockSupport();
+ MockSupport(const SimpleString& mockName = "");
virtual ~MockSupport();
virtual void strictOrder();
virtual MockExpectedCall& expectOneCall(const SimpleString& functionName);
- virtual MockExpectedCall& expectNCalls(int amount, const SimpleString& functionName);
+ virtual void expectNoCall(const SimpleString& functionName);
+ virtual MockExpectedCall& expectNCalls(unsigned int amount, const SimpleString& functionName);
virtual MockActualCall& actualCall(const SimpleString& functionName);
virtual bool hasReturnValue();
virtual MockNamedValue returnValue();
+ virtual bool boolReturnValue();
+ virtual bool returnBoolValueOrDefault(bool defaultValue);
virtual int intReturnValue();
virtual int returnIntValueOrDefault(int defaultValue);
virtual unsigned int unsignedIntReturnValue();
@@ -58,6 +61,10 @@ class MockSupport
virtual long int returnLongIntValueOrDefault(long int defaultValue);
virtual unsigned long int unsignedLongIntReturnValue();
virtual unsigned long int returnUnsignedLongIntValueOrDefault(unsigned long int defaultValue);
+ virtual cpputest_longlong longLongIntReturnValue();
+ virtual cpputest_longlong returnLongLongIntValueOrDefault(cpputest_longlong defaultValue);
+ virtual cpputest_ulonglong unsignedLongLongIntReturnValue();
+ virtual cpputest_ulonglong returnUnsignedLongLongIntValueOrDefault(cpputest_ulonglong defaultValue);
virtual unsigned int returnUnsignedIntValueOrDefault(unsigned int defaultValue);
virtual const char* stringReturnValue();
virtual const char* returnStringValueOrDefault(const char * defaultValue);
@@ -67,15 +74,20 @@ class MockSupport
virtual void* returnPointerValueOrDefault(void * defaultValue);
virtual const void* returnConstPointerValueOrDefault(const void * defaultValue);
virtual const void* constPointerReturnValue();
+ virtual void (*returnFunctionPointerValueOrDefault(void (*defaultValue)()))();
+ virtual void (*functionPointerReturnValue())();
bool hasData(const SimpleString& name);
+ void setData(const SimpleString& name, bool value);
void setData(const SimpleString& name, int value);
void setData(const SimpleString& name, unsigned int value);
void setData(const SimpleString& name, const char* value);
void setData(const SimpleString& name, double value);
void setData(const SimpleString& name, void* value);
void setData(const SimpleString& name, const void* value);
+ void setData(const SimpleString& name, void (*value)());
void setDataObject(const SimpleString& name, const SimpleString& type, void* value);
+ void setDataConstObject(const SimpleString& name, const SimpleString& type, const void* value);
MockNamedValue getData(const SimpleString& name);
MockSupport* getMockSupportScope(const SimpleString& name);
@@ -95,7 +107,7 @@ class MockSupport
virtual bool expectedCallsLeft();
virtual void clear();
- virtual void crashOnFailure();
+ virtual void crashOnFailure(bool shouldFail = true);
/*
* Each mock() call will set the activeReporter to standard, unless a special reporter is passed for this call.
@@ -103,19 +115,22 @@ class MockSupport
virtual void setMockFailureStandardReporter(MockFailureReporter* reporter);
virtual void setActiveReporter(MockFailureReporter* activeReporter);
- virtual void setDefaultComparatorRepository();
+ virtual void setDefaultComparatorsAndCopiersRepository();
virtual void installComparator(const SimpleString& typeName, MockNamedValueComparator& comparator);
- virtual void installComparators(const MockNamedValueComparatorRepository& repository);
- virtual void removeAllComparators();
+ virtual void installCopier(const SimpleString& typeName, MockNamedValueCopier& copier);
+ virtual void installComparatorsAndCopiers(const MockNamedValueComparatorsAndCopiersRepository& repository);
+ virtual void removeAllComparatorsAndCopiers();
protected:
- MockSupport* clone();
- virtual MockCheckedActualCall *createActualFunctionCall();
+ MockSupport* clone(const SimpleString& mockName);
+ virtual MockCheckedActualCall *createActualCall();
virtual void failTest(MockFailure& failure);
+ void countCheck();
+
private:
- static int callOrder_;
- static int expectedCallOrder_;
+ unsigned int actualCallOrder_;
+ unsigned int expectedCallOrder_;
bool strictOrdering_;
MockFailureReporter *activeReporter_;
MockFailureReporter *standardReporter_;
@@ -124,20 +139,26 @@ class MockSupport
bool ignoreOtherCalls_;
bool enabled_;
MockCheckedActualCall *lastActualFunctionCall_;
- MockExpectedCallComposite compositeCalls_;
- MockNamedValueComparatorRepository comparatorRepository_;
+ MockNamedValueComparatorsAndCopiersRepository comparatorsAndCopiersRepository_;
MockNamedValueList data_;
+ const SimpleString mockName_;
bool tracing_;
- void checkExpectationsOfLastCall();
- bool wasLastCallFulfilled();
- void failTestWithUnexpectedCalls();
+ void checkExpectationsOfLastActualCall();
+ bool wasLastActualCallFulfilled();
+ void failTestWithExpectedCallsNotFulfilled();
void failTestWithOutOfOrderCalls();
MockNamedValue* retrieveDataFromStore(const SimpleString& name);
MockSupport* getMockSupport(MockNamedValueListNode* node);
+
+ bool callIsIgnored(const SimpleString& functionName);
+ bool hasCallsOutOfOrder();
+
+ SimpleString appendScopeToName(const SimpleString& functionName);
+
};
#endif
diff --git a/include/CppUTestExt/MockSupportPlugin.h b/include/CppUTestExt/MockSupportPlugin.h
index 11a729190..b77041c38 100644
--- a/include/CppUTestExt/MockSupportPlugin.h
+++ b/include/CppUTestExt/MockSupportPlugin.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -35,14 +35,17 @@ class MockSupportPlugin : public TestPlugin
{
public:
MockSupportPlugin(const SimpleString& name = "MockSupportPLugin");
- virtual ~MockSupportPlugin();
+ virtual ~MockSupportPlugin() CPPUTEST_DESTRUCTOR_OVERRIDE;
- virtual void preTestAction(UtestShell&, TestResult&) _override;
- virtual void postTestAction(UtestShell&, TestResult&) _override;
+ virtual void preTestAction(UtestShell&, TestResult&) CPPUTEST_OVERRIDE;
+ virtual void postTestAction(UtestShell&, TestResult&) CPPUTEST_OVERRIDE;
virtual void installComparator(const SimpleString& name, MockNamedValueComparator& comparator);
+ virtual void installCopier(const SimpleString& name, MockNamedValueCopier& copier);
+
+ void clear();
private:
- MockNamedValueComparatorRepository repository_;
+ MockNamedValueComparatorsAndCopiersRepository repository_;
};
#endif
diff --git a/include/CppUTestExt/MockSupport_c.h b/include/CppUTestExt/MockSupport_c.h
index beb30b3da..b133e3682 100644
--- a/include/CppUTestExt/MockSupport_c.h
+++ b/include/CppUTestExt/MockSupport_c.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -32,17 +32,23 @@
extern "C" {
#endif
+#include "CppUTest/CppUTestConfig.h"
#include "CppUTest/StandardCLibrary.h"
typedef enum {
+ MOCKVALUETYPE_BOOL,
MOCKVALUETYPE_UNSIGNED_INTEGER,
MOCKVALUETYPE_INTEGER,
MOCKVALUETYPE_LONG_INTEGER,
MOCKVALUETYPE_UNSIGNED_LONG_INTEGER,
+ MOCKVALUETYPE_LONG_LONG_INTEGER,
+ MOCKVALUETYPE_UNSIGNED_LONG_LONG_INTEGER,
MOCKVALUETYPE_DOUBLE,
MOCKVALUETYPE_STRING,
MOCKVALUETYPE_POINTER,
MOCKVALUETYPE_CONST_POINTER,
+ MOCKVALUETYPE_FUNCTIONPOINTER,
+ MOCKVALUETYPE_MEMORYBUFFER,
MOCKVALUETYPE_OBJECT
} MockValueType_c;
@@ -50,90 +56,178 @@ typedef struct SMockValue_c
{
MockValueType_c type;
union {
+ int boolValue;
int intValue;
unsigned int unsignedIntValue;
long int longIntValue;
unsigned long int unsignedLongIntValue;
+#if CPPUTEST_USE_LONG_LONG
+ cpputest_longlong longLongIntValue;
+ cpputest_ulonglong unsignedLongLongIntValue;
+#else
+ char longLongPlaceholder[CPPUTEST_SIZE_OF_FAKE_LONG_LONG_TYPE];
+#endif
double doubleValue;
const char* stringValue;
void* pointerValue;
const void* constPointerValue;
- const void* objectValue;
+ void (*functionPointerValue)(void);
+ const unsigned char* memoryBufferValue;
+ void* objectValue;
+ const void* constObjectValue;
} value;
} MockValue_c;
typedef struct SMockActualCall_c MockActualCall_c;
struct SMockActualCall_c
{
+ MockActualCall_c* (*withBoolParameters)(const char* name, int value);
MockActualCall_c* (*withIntParameters)(const char* name, int value);
MockActualCall_c* (*withUnsignedIntParameters)(const char* name, unsigned int value);
MockActualCall_c* (*withLongIntParameters)(const char* name, long int value);
MockActualCall_c* (*withUnsignedLongIntParameters)(const char* name, unsigned long int value);
+ MockActualCall_c* (*withLongLongIntParameters)(const char* name, cpputest_longlong value);
+ MockActualCall_c* (*withUnsignedLongLongIntParameters)(const char* name, cpputest_ulonglong value);
MockActualCall_c* (*withDoubleParameters)(const char* name, double value);
MockActualCall_c* (*withStringParameters)(const char* name, const char* value);
MockActualCall_c* (*withPointerParameters)(const char* name, void* value);
MockActualCall_c* (*withConstPointerParameters)(const char* name, const void* value);
+ MockActualCall_c* (*withFunctionPointerParameters)(const char* name, void (*value)(void));
+ MockActualCall_c* (*withMemoryBufferParameter)(const char* name, const unsigned char* value, size_t size);
MockActualCall_c* (*withParameterOfType)(const char* type, const char* name, const void* value);
MockActualCall_c* (*withOutputParameter)(const char* name, void* value);
-
+ MockActualCall_c* (*withOutputParameterOfType)(const char* type, const char* name, void* value);
+ int (*hasReturnValue)(void);
MockValue_c (*returnValue)(void);
+ int (*boolReturnValue)(void);
+ int (*returnBoolValueOrDefault)(int defaultValue);
+ int (*intReturnValue)(void);
+ int (*returnIntValueOrDefault)(int defaultValue);
+ unsigned int (*unsignedIntReturnValue)(void);
+ unsigned int (*returnUnsignedIntValueOrDefault)(unsigned int defaultValue);
+ long int (*longIntReturnValue)(void);
+ long int (*returnLongIntValueOrDefault)(long int defaultValue);
+ unsigned long int (*unsignedLongIntReturnValue)(void);
+ unsigned long int (*returnUnsignedLongIntValueOrDefault)(unsigned long int defaultValue);
+ cpputest_longlong (*longLongIntReturnValue)(void);
+ cpputest_longlong (*returnLongLongIntValueOrDefault)(cpputest_longlong defaultValue);
+ cpputest_ulonglong (*unsignedLongLongIntReturnValue)(void);
+ cpputest_ulonglong (*returnUnsignedLongLongIntValueOrDefault)(cpputest_ulonglong defaultValue);
+ const char* (*stringReturnValue)(void);
+ const char* (*returnStringValueOrDefault)(const char * defaultValue);
+ double (*doubleReturnValue)(void);
+ double (*returnDoubleValueOrDefault)(double defaultValue);
+ void* (*pointerReturnValue)(void);
+ void* (*returnPointerValueOrDefault)(void * defaultValue);
+ const void* (*constPointerReturnValue)(void);
+ const void* (*returnConstPointerValueOrDefault)(const void * defaultValue);
+ void (*(*functionPointerReturnValue)(void))(void);
+ void (*(*returnFunctionPointerValueOrDefault)(void(*defaultValue)(void)))(void);
};
typedef struct SMockExpectedCall_c MockExpectedCall_c;
struct SMockExpectedCall_c
{
+ MockExpectedCall_c* (*withBoolParameters)(const char* name, int value);
MockExpectedCall_c* (*withIntParameters)(const char* name, int value);
MockExpectedCall_c* (*withUnsignedIntParameters)(const char* name, unsigned int value);
MockExpectedCall_c* (*withLongIntParameters)(const char* name, long int value);
MockExpectedCall_c* (*withUnsignedLongIntParameters)(const char* name, unsigned long int value);
+ MockExpectedCall_c* (*withLongLongIntParameters)(const char* name, cpputest_longlong value);
+ MockExpectedCall_c* (*withUnsignedLongLongIntParameters)(const char* name, cpputest_ulonglong value);
MockExpectedCall_c* (*withDoubleParameters)(const char* name, double value);
+ MockExpectedCall_c* (*withDoubleParametersAndTolerance)(const char* name, double value, double tolerance);
MockExpectedCall_c* (*withStringParameters)(const char* name, const char* value);
MockExpectedCall_c* (*withPointerParameters)(const char* name, void* value);
MockExpectedCall_c* (*withConstPointerParameters)(const char* name, const void* value);
+ MockExpectedCall_c* (*withFunctionPointerParameters)(const char* name, void (*value)(void));
+ MockExpectedCall_c* (*withMemoryBufferParameter)(const char* name, const unsigned char* value, size_t size);
MockExpectedCall_c* (*withParameterOfType)(const char* type, const char* name, const void* value);
MockExpectedCall_c* (*withOutputParameterReturning)(const char* name, const void* value, size_t size);
+ MockExpectedCall_c* (*withOutputParameterOfTypeReturning)(const char* type, const char* name, const void* value);
+ MockExpectedCall_c* (*withUnmodifiedOutputParameter)(const char* name);
+ MockExpectedCall_c* (*ignoreOtherParameters)(void);
+ MockExpectedCall_c* (*andReturnBoolValue)(int value);
MockExpectedCall_c* (*andReturnUnsignedIntValue)(unsigned int value);
MockExpectedCall_c* (*andReturnIntValue)(int value);
MockExpectedCall_c* (*andReturnLongIntValue)(long int value);
MockExpectedCall_c* (*andReturnUnsignedLongIntValue)(unsigned long int value);
+ MockExpectedCall_c* (*andReturnLongLongIntValue)(cpputest_longlong value);
+ MockExpectedCall_c* (*andReturnUnsignedLongLongIntValue)(cpputest_ulonglong value);
MockExpectedCall_c* (*andReturnDoubleValue)(double value);
MockExpectedCall_c* (*andReturnStringValue)(const char* value);
MockExpectedCall_c* (*andReturnPointerValue)(void* value);
MockExpectedCall_c* (*andReturnConstPointerValue)(const void* value);
+ MockExpectedCall_c* (*andReturnFunctionPointerValue)(void (*value)(void));
};
typedef int (*MockTypeEqualFunction_c)(const void* object1, const void* object2);
-typedef char* (*MockTypeValueToStringFunction_c)(const void* object1);
+typedef const char* (*MockTypeValueToStringFunction_c)(const void* object1);
+typedef void (*MockTypeCopyFunction_c)(void* dst, const void* src);
typedef struct SMockSupport_c MockSupport_c;
struct SMockSupport_c
{
+ void (*strictOrder)(void);
MockExpectedCall_c* (*expectOneCall)(const char* name);
+ void (*expectNoCall)(const char* name);
+ MockExpectedCall_c* (*expectNCalls)(unsigned int number, const char* name);
MockActualCall_c* (*actualCall)(const char* name);
+ int (*hasReturnValue)(void);
MockValue_c (*returnValue)(void);
-
- void (*enable)(void);
- void (*disable)(void);
-
+ int (*boolReturnValue)(void);
+ int (*returnBoolValueOrDefault)(int defaultValue);
+ int (*intReturnValue)(void);
+ int (*returnIntValueOrDefault)(int defaultValue);
+ unsigned int (*unsignedIntReturnValue)(void);
+ unsigned int (*returnUnsignedIntValueOrDefault)(unsigned int defaultValue);
+ long int (*longIntReturnValue)(void);
+ long int (*returnLongIntValueOrDefault)(long int defaultValue);
+ unsigned long int (*unsignedLongIntReturnValue)(void);
+ unsigned long int (*returnUnsignedLongIntValueOrDefault)(unsigned long int defaultValue);
+ cpputest_longlong (*longLongIntReturnValue)(void);
+ cpputest_longlong (*returnLongLongIntValueOrDefault)(cpputest_longlong defaultValue);
+ cpputest_ulonglong (*unsignedLongLongIntReturnValue)(void);
+ cpputest_ulonglong (*returnUnsignedLongLongIntValueOrDefault)(cpputest_ulonglong defaultValue);
+ const char* (*stringReturnValue)(void);
+ const char* (*returnStringValueOrDefault)(const char * defaultValue);
+ double (*doubleReturnValue)(void);
+ double (*returnDoubleValueOrDefault)(double defaultValue);
+ void* (*pointerReturnValue)(void);
+ void* (*returnPointerValueOrDefault)(void * defaultValue);
+ const void* (*constPointerReturnValue)(void);
+ const void* (*returnConstPointerValueOrDefault)(const void * defaultValue);
+ void (*(*functionPointerReturnValue)(void))(void);
+ void (*(*returnFunctionPointerValueOrDefault) (void(*defaultValue)(void)))(void);
+
+ void (*setBoolData) (const char* name, int value);
void (*setIntData) (const char* name, int value);
- void (*setDoubleData) (const char* name, double value);
+ void (*setUnsignedIntData) (const char* name, unsigned int value);
void (*setStringData) (const char* name, const char* value);
+ void (*setDoubleData) (const char* name, double value);
void (*setPointerData) (const char* name, void* value);
void (*setConstPointerData) (const char* name, const void* value);
+ void (*setFunctionPointerData) (const char* name, void (*value)(void));
void (*setDataObject) (const char* name, const char* type, void* value);
+ void (*setDataConstObject) (const char* name, const char* type, const void* value);
MockValue_c (*getData)(const char* name);
+ void (*disable)(void);
+ void (*enable)(void);
+ void (*ignoreOtherCalls)(void);
+
void (*checkExpectations)(void);
int (*expectedCallsLeft)(void);
void (*clear)(void);
+ void (*crashOnFailure)(unsigned shouldCrash);
void (*installComparator) (const char* typeName, MockTypeEqualFunction_c isEqual, MockTypeValueToStringFunction_c valueToString);
- void (*removeAllComparators)(void);
+ void (*installCopier) (const char* typeName, MockTypeCopyFunction_c copier);
+ void (*removeAllComparatorsAndCopiers)(void);
};
-
MockSupport_c* mock_c(void);
MockSupport_c* mock_scope_c(const char* scope);
diff --git a/include/CppUTestExt/OrderedTest.h b/include/CppUTestExt/OrderedTest.h
index cf1933966..3db756b2a 100644
--- a/include/CppUTestExt/OrderedTest.h
+++ b/include/CppUTestExt/OrderedTest.h
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -32,7 +32,7 @@ class OrderedTestShell : public UtestShell
{
public:
OrderedTestShell();
- virtual ~OrderedTestShell();
+ virtual ~OrderedTestShell() CPPUTEST_DESTRUCTOR_OVERRIDE;
virtual OrderedTestShell* addOrderedTest(OrderedTestShell* test);
virtual OrderedTestShell* getNextOrderedTest();
@@ -56,7 +56,7 @@ class OrderedTestShell : public UtestShell
class OrderedTestInstaller
{
public:
- explicit OrderedTestInstaller(OrderedTestShell& test, const char* groupName, const char* testName, const char* fileName, int lineNumber, int level);
+ explicit OrderedTestInstaller(OrderedTestShell& test, const char* groupName, const char* testName, const char* fileName, size_t lineNumber, int level);
virtual ~OrderedTestInstaller();
private:
@@ -71,12 +71,17 @@ class OrderedTestInstaller
extern TEST_##testGroup##_##testName##_TestShell TEST_##testGroup##_##testName##_Instance; \
class TEST_##testGroup##_##testName##_Test : public TEST_GROUP_##CppUTestGroup##testGroup \
{ public: TEST_##testGroup##_##testName##_Test () : TEST_GROUP_##CppUTestGroup##testGroup () {} \
- void testBody(); }; \
+ void testBody() CPPUTEST_OVERRIDE; }; \
class TEST_##testGroup##_##testName##_TestShell : public OrderedTestShell { \
- virtual Utest* createTest() _override { return new TEST_##testGroup##_##testName##_Test; } \
+ virtual Utest* createTest() CPPUTEST_OVERRIDE { return new TEST_##testGroup##_##testName##_Test; } \
} TEST_##testGroup##_##testName##_Instance; \
static OrderedTestInstaller TEST_##testGroup##_##testName##_Installer(TEST_##testGroup##_##testName##_Instance, #testGroup, #testName, __FILE__,__LINE__, testLevel); \
void TEST_##testGroup##_##testName##_Test::testBody()
-#endif
+#define TEST_ORDERED_C_WRAPPER(group_name, test_name, testLevel) \
+ extern "C" void test_##group_name##_##test_name##_wrapper_c(void); \
+ TEST_ORDERED(group_name, test_name, testLevel) { \
+ test_##group_name##_##test_name##_wrapper_c(); \
+ }
+#endif
diff --git a/include/Platforms/Symbian/Platform.h b/include/Platforms/Symbian/Platform.h
deleted file mode 100644
index 4c67dbc8a..000000000
--- a/include/Platforms/Symbian/Platform.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-#ifndef PLATFORM_H_
-#define PLATFORM_H_
-
-#endif /*PLATFORM_H_*/
-
diff --git a/include/Platforms/VisualCpp/stdint.h b/include/Platforms/VisualCpp/stdint.h
deleted file mode 100644
index 81e746a5c..000000000
--- a/include/Platforms/VisualCpp/stdint.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/* ISO C9x 7.18 Integer types
- * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794)
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * Contributor: Danny Smith
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Date: 2000-12-02
- */
-
-
-#ifndef _STDINT_H
-#define _STDINT_H
-#define __need_wint_t
-#define __need_wchar_t
-#include
-
-/* 7.18.1.1 Exact-width integer types */
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef short int16_t;
-typedef unsigned short uint16_t;
-typedef int int32_t;
-typedef unsigned uint32_t;
-//typedef long long int64_t;
-//typedef unsigned long long uint64_t;
-
-/* 7.18.1.2 Minimum-width integer types */
-typedef signed char int_least8_t;
-typedef unsigned char uint_least8_t;
-typedef short int_least16_t;
-typedef unsigned short uint_least16_t;
-typedef int int_least32_t;
-typedef unsigned uint_least32_t;
-//typedef long long int_least64_t;
-//typedef unsigned long long uint_least64_t;
-
-/* 7.18.1.3 Fastest minimum-width integer types
- * Not actually guaranteed to be fastest for all purposes
- * Here we use the exact-width types for 8 and 16-bit ints.
- */
-typedef signed char int_fast8_t;
-typedef unsigned char uint_fast8_t;
-typedef short int_fast16_t;
-typedef unsigned short uint_fast16_t;
-typedef int int_fast32_t;
-typedef unsigned int uint_fast32_t;
-//typedef long long int_fast64_t;
-//typedef unsigned long long uint_fast64_t;
-
-/* 7.18.1.4 Integer types capable of holding object pointers */
-
-#ifndef _INTPTR_T_DEFINED
-#define _INTPTR_T_DEFINED
-#ifdef _WIN64
- typedef __int64 intptr_t;
-#else
- typedef int intptr_t;
-#endif
-#endif
-
-#ifndef _UINTPTR_T_DEFINED
-#define _UINTPTR_T_DEFINED
-#ifdef _WIN64
- typedef unsigned __int64 uintptr_t;
-#else
- typedef unsigned int uintptr_t;
-#endif
-#endif
-
-/* 7.18.1.5 Greatest-width integer types */
-//typedef long long intmax_t;
-//typedef unsigned long long uintmax_t;
-
-/* 7.18.2 Limits of specified-width integer types */
-#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS)
-
-/* 7.18.2.1 Limits of exact-width integer types */
-#define INT8_MIN (-128)
-#define INT16_MIN (-32768)
-#define INT32_MIN (-2147483647 - 1)
-#define INT64_MIN (-9223372036854775807LL - 1)
-
-#define INT8_MAX 127
-#define INT16_MAX 32767
-#define INT32_MAX 2147483647
-#define INT64_MAX 9223372036854775807LL
-
-#define UINT8_MAX 0xff /* 255U */
-#define UINT16_MAX 0xffff /* 65535U */
-#define UINT32_MAX 0xffffffff /* 4294967295U */
-#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
-
-/* 7.18.2.2 Limits of minimum-width integer types */
-#define INT_LEAST8_MIN INT8_MIN
-#define INT_LEAST16_MIN INT16_MIN
-#define INT_LEAST32_MIN INT32_MIN
-#define INT_LEAST64_MIN INT64_MIN
-
-#define INT_LEAST8_MAX INT8_MAX
-#define INT_LEAST16_MAX INT16_MAX
-#define INT_LEAST32_MAX INT32_MAX
-#define INT_LEAST64_MAX INT64_MAX
-
-#define UINT_LEAST8_MAX UINT8_MAX
-#define UINT_LEAST16_MAX UINT16_MAX
-#define UINT_LEAST32_MAX UINT32_MAX
-#define UINT_LEAST64_MAX UINT64_MAX
-
-/* 7.18.2.3 Limits of fastest minimum-width integer types */
-#define INT_FAST8_MIN INT8_MIN
-#define INT_FAST16_MIN INT16_MIN
-#define INT_FAST32_MIN INT32_MIN
-#define INT_FAST64_MIN INT64_MIN
-
-#define INT_FAST8_MAX INT8_MAX
-#define INT_FAST16_MAX INT16_MAX
-#define INT_FAST32_MAX INT32_MAX
-#define INT_FAST64_MAX INT64_MAX
-
-#define UINT_FAST8_MAX UINT8_MAX
-#define UINT_FAST16_MAX UINT16_MAX
-#define UINT_FAST32_MAX UINT32_MAX
-#define UINT_FAST64_MAX UINT64_MAX
-
-/* 7.18.2.4 Limits of integer types capable of holding
- object pointers */
-#ifdef _WIN64
-#define INTPTR_MIN INT64_MIN
-#define INTPTR_MAX INT64_MAX
-#define UINTPTR_MAX UINT64_MAX
-#else
-#define INTPTR_MIN INT32_MIN
-#define INTPTR_MAX INT32_MAX
-#define UINTPTR_MAX UINT32_MAX
-#endif
-
-/* 7.18.2.5 Limits of greatest-width integer types */
-#define INTMAX_MIN INT64_MIN
-#define INTMAX_MAX INT64_MAX
-#define UINTMAX_MAX UINT64_MAX
-
-/* 7.18.3 Limits of other integer types */
-#define PTRDIFF_MIN INTPTR_MIN
-#define PTRDIFF_MAX INTPTR_MAX
-
-#define SIG_ATOMIC_MIN INTPTR_MIN
-#define SIG_ATOMIC_MAX INTPTR_MAX
-
-#define SIZE_MAX UINTPTR_MAX
-
-#ifndef WCHAR_MIN /* also in wchar.h */
-#define WCHAR_MIN 0
-#define WCHAR_MAX 0xffff /* UINT16_MAX */
-#endif
-
-/*
- * wint_t is unsigned short for compatibility with MS runtime
- */
-#define WINT_MIN 0
-#define WINT_MAX 0xffff /* UINT16_MAX */
-
-#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */
-
-
-/* 7.18.4 Macros for integer constants */
-#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS)
-
-/* 7.18.4.1 Macros for minimum-width integer constants
-
- Accoding to Douglas Gwyn :
- "This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC
- 9899:1999 as initially published, the expansion was required
- to be an integer constant of precisely matching type, which
- is impossible to accomplish for the shorter types on most
- platforms, because C99 provides no standard way to designate
- an integer constant with width less than that of type int.
- TC1 changed this to require just an integer constant
- *expression* with *promoted* type."
-*/
-
-#define INT8_C(val) val
-#define UINT8_C(val) val
-#define INT16_C(val) val
-#define UINT16_C(val) val
-
-#define INT32_C(val) val
-#define UINT32_C(val) val##U
-#define INT64_C(val) val##LL
-#define UINT64_C(val) val##ULL
-
-/* 7.18.4.2 Macros for greatest-width integer constants */
-#define INTMAX_C(val) INT64_C(val)
-#define UINTMAX_C(val) UINT64_C(val)
-
-#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */
-
-#endif
diff --git a/include/Platforms/armcc/Platform.h b/include/Platforms/armcc/Platform.h
deleted file mode 100644
index 4c67dbc8a..000000000
--- a/include/Platforms/armcc/Platform.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-#ifndef PLATFORM_H_
-#define PLATFORM_H_
-
-#endif /*PLATFORM_H_*/
-
diff --git a/include/Platforms/c2000/stdint.h b/include/Platforms/c2000/stdint.h
index f81307690..3e076a500 100644
--- a/include/Platforms/c2000/stdint.h
+++ b/include/Platforms/c2000/stdint.h
@@ -14,7 +14,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -28,9 +28,9 @@
#ifndef stdint_wrapper_h
#define stdint_wrapper_h
-
+
#include
-
+
typedef unsigned char uint8_t; /* This will still compile to 16 bit */
-
+
#endif /* stdint_wrapper_h */
\ No newline at end of file
diff --git a/lib/NoteOnVisualStudio.txt b/lib/NoteOnVisualStudio.txt
deleted file mode 100644
index 70026cc05..000000000
--- a/lib/NoteOnVisualStudio.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-This directory will contain the last lib created by any of the visual studion builds.
-
-In case you simultaneously use more than one VS version, there are subdirectories
-for each supported VS version where CppUTest.lib and the associated pdb file are copied.
diff --git a/m4/m4_ax_compiler_vendor.m4 b/m4/m4_ax_compiler_vendor.m4
new file mode 100644
index 000000000..f06e86540
--- /dev/null
+++ b/m4/m4_ax_compiler_vendor.m4
@@ -0,0 +1,117 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_COMPILER_VENDOR
+#
+# DESCRIPTION
+#
+# Determine the vendor of the C, C++ or Fortran compiler. The vendor is
+# returned in the cache variable $ax_cv_c_compiler_vendor for C,
+# $ax_cv_cxx_compiler_vendor for C++ or $ax_cv_fc_compiler_vendor for
+# (modern) Fortran. The value is one of "intel", "ibm", "pathscale",
+# "clang" (LLVM), "cray", "fujitsu", "sdcc", "sx", "portland" (PGI), "gnu"
+# (GCC), "sun" (Oracle Developer Studio), "hp", "dec", "borland",
+# "comeau", "kai", "lcc", "sgi", "microsoft", "metrowerks", "watcom",
+# "tcc" (Tiny CC) or "unknown" (if the compiler cannot be determined).
+#
+# To check for a Fortran compiler, you must first call AC_FC_PP_SRCEXT
+# with an appropriate preprocessor-enabled extension. For example:
+#
+# AC_LANG_PUSH([Fortran])
+# AC_PROG_FC
+# AC_FC_PP_SRCEXT([F])
+# AX_COMPILER_VENDOR
+# AC_LANG_POP([Fortran])
+#
+# LICENSE
+#
+# Copyright (c) 2008 Steven G. Johnson
+# Copyright (c) 2008 Matteo Frigo
+# Copyright (c) 2018-19 John Zaitseff
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see .
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 30
+
+AC_DEFUN([AX_COMPILER_VENDOR], [dnl
+ AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [dnl
+ dnl If you modify this list of vendors, please add similar support
+ dnl to ax_compiler_version.m4 if at all possible.
+ dnl
+ dnl Note: Do NOT check for GCC first since some other compilers
+ dnl define __GNUC__ to remain compatible with it. Compilers that
+ dnl are very slow to start (such as Intel) are listed first.
+
+ vendors="
+ intel: __ICC,__ECC,__INTEL_COMPILER
+ ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__,__ibmxl__
+ pathscale: __PATHCC__,__PATHSCALE__
+ clang: __clang__
+ cray: _CRAYC
+ fujitsu: __FUJITSU
+ sdcc: SDCC,__SDCC
+ sx: _SX
+ portland: __PGI
+ gnu: __GNUC__
+ sun: __SUNPRO_C,__SUNPRO_CC,__SUNPRO_F90,__SUNPRO_F95
+ hp: __HP_cc,__HP_aCC
+ dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
+ borland: __BORLANDC__,__CODEGEARC__,__TURBOC__
+ comeau: __COMO__
+ kai: __KCC
+ lcc: __LCC__
+ sgi: __sgi,sgi
+ microsoft: _MSC_VER
+ metrowerks: __MWERKS__
+ watcom: __WATCOMC__
+ tcc: __TINYC__
+ unknown: UNKNOWN
+ "
+ for ventest in $vendors; do
+ case $ventest in
+ *:)
+ vendor=$ventest
+ continue
+ ;;
+ *)
+ vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")"
+ ;;
+ esac
+
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
+#if !($vencpp)
+ thisisanerror;
+#endif
+ ]])], [break])
+ done
+
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
+ ])
+])dnl
diff --git a/m4/m4_ax_compiler_version.m4 b/m4/m4_ax_compiler_version.m4
new file mode 100644
index 000000000..0581d1bc0
--- /dev/null
+++ b/m4/m4_ax_compiler_version.m4
@@ -0,0 +1,529 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_compiler_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_COMPILER_VERSION
+#
+# DESCRIPTION
+#
+# This macro retrieves the compiler version and returns it in the cache
+# variable $ax_cv_c_compiler_version for C and $ax_cv_cxx_compiler_version
+# for C++.
+#
+# Version is returned as epoch:major.minor.patchversion
+#
+# Epoch is used in order to have an increasing version number in case of
+# marketing change.
+#
+# Epoch use: * borland compiler use chronologically 0turboc for turboc
+# era,
+#
+# 1borlanc BORLANDC++ before 5, 2cppbuilder for cppbuilder era,
+# 3borlancpp for return of BORLANDC++ (after version 5.5),
+# 4cppbuilder for cppbuilder with year version,
+# and 5xe for XE era.
+#
+# An empty string is returned otherwise.
+#
+# LICENSE
+#
+# Copyright (c) 2014 Bastien ROUCARIES
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 12
+
+# for intel
+AC_DEFUN([_AX_COMPILER_VERSION_INTEL],
+ [ dnl
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ [__INTEL_COMPILER/100],,
+ AC_MSG_FAILURE([[[$0]] unknown intel compiler version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ [(__INTEL_COMPILER%100)/10],,
+ AC_MSG_FAILURE([[[$0]] unknown intel compiler version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ [(__INTEL_COMPILER%10)],,
+ AC_MSG_FAILURE([[[$0]] unknown intel compiler version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+
+# for IBM
+AC_DEFUN([_AX_COMPILER_VERSION_IBM],
+ [ dnl
+ dnl check between z/OS C/C++ and XL C/C++
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([],
+ [
+ #if defined(__COMPILER_VER__)
+ choke me;
+ #endif
+ ])],
+ [
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ [__xlC__/100],,
+ AC_MSG_FAILURE([[[$0]] unknown IBM compiler major version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ [__xlC__%100],,
+ AC_MSG_FAILURE([[[$0]] unknown IBM compiler minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ [__xlC_ver__/0x100],,
+ AC_MSG_FAILURE([[[$0]] unknown IBM compiler patch version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_build,
+ [__xlC_ver__%0x100],,
+ AC_MSG_FAILURE([[[$0]] unknown IBM compiler build version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_build"
+ ],
+ [
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ [__xlC__%1000],,
+ AC_MSG_FAILURE([[[$0]] unknown IBM compiler patch version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ [(__xlC__/10000)%10],,
+ AC_MSG_FAILURE([[[$0]] unknown IBM compiler minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ [(__xlC__/100000)%10],,
+ AC_MSG_FAILURE([[[$0]] unknown IBM compiler major version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+])
+
+# for pathscale
+AC_DEFUN([_AX_COMPILER_VERSION_PATHSCALE],[
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ __PATHCC__,,
+ AC_MSG_FAILURE([[[$0]] unknown pathscale major]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ __PATHCC_MINOR__,,
+ AC_MSG_FAILURE([[[$0]] unknown pathscale minor]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ [__PATHCC_PATCHLEVEL__],,
+ AC_MSG_FAILURE([[[$0]] unknown pathscale patch level]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+
+# for clang
+AC_DEFUN([_AX_COMPILER_VERSION_CLANG],[
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ __clang_major__,,
+ AC_MSG_FAILURE([[[$0]] unknown clang major]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ __clang_minor__,,
+ AC_MSG_FAILURE([[[$0]] unknown clang minor]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ [__clang_patchlevel__],,0)
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+
+# for crayc
+AC_DEFUN([_AX_COMPILER_VERSION_CRAY],[
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ _RELEASE,,
+ AC_MSG_FAILURE([[[$0]] unknown crayc release]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ _RELEASE_MINOR,,
+ AC_MSG_FAILURE([[[$0]] unknown crayc minor]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor"
+ ])
+
+# for fujitsu
+AC_DEFUN([_AX_COMPILER_VERSION_FUJITSU],[
+ AC_COMPUTE_INT(ax_cv_[]_AC_LANG_ABBREV[]_compiler_version,
+ __FCC_VERSION,,
+ AC_MSG_FAILURE([[[$0]]unknown fujitsu release]))
+ ])
+
+# for GNU
+AC_DEFUN([_AX_COMPILER_VERSION_GNU],[
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ __GNUC__,,
+ AC_MSG_FAILURE([[[$0]] unknown gcc major]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ __GNUC_MINOR__,,
+ AC_MSG_FAILURE([[[$0]] unknown gcc minor]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ [__GNUC_PATCHLEVEL__],,
+ AC_MSG_FAILURE([[[$0]] unknown gcc patch level]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+
+# For sun
+AC_DEFUN([_AX_COMPILER_VERSION_SUN],[
+ m4_define([_AX_COMPILER_VERSION_SUN_NUMBER],
+ [
+ #if defined(__SUNPRO_CC)
+ __SUNPRO_CC
+ #else
+ __SUNPRO_C
+ #endif
+ ])
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_until59,
+ !!(_AX_COMPILER_VERSION_SUN_NUMBER < 0x1000),,
+ AC_MSG_FAILURE([[[$0]] unknown sun release version]))
+ AS_IF([test "X$_ax_[]_AC_LANG_ABBREV[]_compiler_version_until59" = X1],
+ [dnl
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ _AX_COMPILER_VERSION_SUN_NUMBER % 0x10,,
+ AC_MSG_FAILURE([[[$0]] unknown sun patch version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ (_AX_COMPILER_VERSION_SUN_NUMBER / 0x10) % 0x10,,
+ AC_MSG_FAILURE([[[$0]] unknown sun minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ (_AX_COMPILER_VERSION_SUN_NUMBER / 0x100),,
+ AC_MSG_FAILURE([[[$0]] unknown sun major version]))
+ ],
+ [dnl
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ _AX_COMPILER_VERSION_SUN_NUMBER % 0x10,,
+ AC_MSG_FAILURE([[[$0]] unknown sun patch version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ (_AX_COMPILER_VERSION_SUN_NUMBER / 0x100) % 0x100,,
+ AC_MSG_FAILURE([[[$0]] unknown sun minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ (_AX_COMPILER_VERSION_SUN_NUMBER / 0x1000),,
+ AC_MSG_FAILURE([[[$0]] unknown sun major version]))
+ ])
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+])
+
+AC_DEFUN([_AX_COMPILER_VERSION_HP],[
+ m4_define([_AX_COMPILER_VERSION_HP_NUMBER],
+ [
+ #if defined(__HP_cc)
+ __HP_cc
+ #else
+ __HP_aCC
+ #endif
+ ])
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_untilA0121,
+ !!(_AX_COMPILER_VERSION_HP_NUMBER <= 1),,
+ AC_MSG_FAILURE([[[$0]] unknown hp release version]))
+ AS_IF([test "X$_ax_[]_AC_LANG_ABBREV[]_compiler_version_untilA0121" = X1],
+ [dnl By default output last version with this behavior.
+ dnl it is so old
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="01.21.00"
+ ],
+ [dnl
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ (_AX_COMPILER_VERSION_HP_NUMBER % 100),,
+ AC_MSG_FAILURE([[[$0]] unknown hp release version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ ((_AX_COMPILER_VERSION_HP_NUMBER / 100)%100),,
+ AC_MSG_FAILURE([[[$0]] unknown hp minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ ((_AX_COMPILER_VERSION_HP_NUMBER / 10000)%100),,
+ AC_MSG_FAILURE([[[$0]] unknown hp major version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+])
+
+AC_DEFUN([_AX_COMPILER_VERSION_DEC],[dnl
+ m4_define([_AX_COMPILER_VERSION_DEC_NUMBER],
+ [
+ #if defined(__DECC_VER)
+ __DECC_VER
+ #else
+ __DECCXX_VER
+ #endif
+ ])
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ (_AX_COMPILER_VERSION_DEC_NUMBER % 10000),,
+ AC_MSG_FAILURE([[[$0]] unknown dec release version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ ((_AX_COMPILER_VERSION_DEC_NUMBER / 100000UL)%100),,
+ AC_MSG_FAILURE([[[$0]] unknown dec minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ ((_AX_COMPILER_VERSION_DEC_NUMBER / 10000000UL)%100),,
+ AC_MSG_FAILURE([[[$0]] unknown dec major version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+
+# borland
+AC_DEFUN([_AX_COMPILER_VERSION_BORLAND],[dnl
+ m4_define([_AX_COMPILER_VERSION_TURBOC_NUMBER],
+ [
+ #if defined(__TURBOC__)
+ __TURBOC__
+ #else
+ choke me
+ #endif
+ ])
+ m4_define([_AX_COMPILER_VERSION_BORLANDC_NUMBER],
+ [
+ #if defined(__BORLANDC__)
+ __BORLANDC__
+ #else
+ __CODEGEARC__
+ #endif
+ ])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(,
+ _AX_COMPILER_VERSION_TURBOC_NUMBER)],
+ [dnl TURBOC
+ AC_COMPUTE_INT(
+ _ax_[]_AC_LANG_ABBREV[]_compiler_version_turboc_raw,
+ _AX_COMPILER_VERSION_TURBOC_NUMBER,,
+ AC_MSG_FAILURE([[[$0]] unknown turboc version]))
+ AS_IF(
+ [test $_ax_[]_AC_LANG_ABBREV[]_compiler_version_turboc_raw -lt 661 || test $_ax_[]_AC_LANG_ABBREV[]_compiler_version_turboc_raw -gt 1023],
+ [dnl compute normal version
+ AC_COMPUTE_INT(
+ _ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ _AX_COMPILER_VERSION_TURBOC_NUMBER % 0x100,,
+ AC_MSG_FAILURE([[[$0]] unknown turboc minor version]))
+ AC_COMPUTE_INT(
+ _ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ (_AX_COMPILER_VERSION_TURBOC_NUMBER/0x100)%0x100,,
+ AC_MSG_FAILURE([[[$0]] unknown turboc major version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="0turboc:$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor"],
+ [dnl special version
+ AS_CASE([$_ax_[]_AC_LANG_ABBREV[]_compiler_version_turboc_raw],
+ [661],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="0turboc:1.00"],
+ [662],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="0turboc:1.01"],
+ [663],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="0turboc:2.00"],
+ [
+ AC_MSG_WARN([[[$0]] unknown turboc version between 0x295 and 0x400 please report bug])
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version=""
+ ])
+ ])
+ ],
+ # borlandc
+ [
+ AC_COMPUTE_INT(
+ _ax_[]_AC_LANG_ABBREV[]_compiler_version_borlandc_raw,
+ _AX_COMPILER_VERSION_BORLANDC_NUMBER,,
+ AC_MSG_FAILURE([[[$0]] unknown borlandc version]))
+ AS_CASE([$_ax_[]_AC_LANG_ABBREV[]_compiler_version_borlandc_raw],
+ dnl BORLANDC++ before 5.5
+ [512] ,[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:2.00"],
+ [1024],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:3.00"],
+ [1024],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:3.00"],
+ [1040],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:3.1"],
+ [1106],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:4.0"],
+ [1280],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:5.0"],
+ [1312],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:5.02"],
+ dnl C++ Builder era
+ [1328],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="2cppbuilder:3.0"],
+ [1344],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="2cppbuilder:4.0"],
+ dnl BORLANDC++ after 5.5
+ [1360],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="3borlancpp:5.5"],
+ [1361],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="3borlancpp:5.51"],
+ [1378],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="3borlancpp:5.6.4"],
+ dnl C++ Builder with year number
+ [1392],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="4cppbuilder:2006"],
+ [1424],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="4cppbuilder:2007"],
+ [1555],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="4cppbuilder:2009"],
+ [1569],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="4cppbuilder:2010"],
+ dnl XE version
+ [1584],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="5xe"],
+ [1600],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="5xe:2"],
+ [1616],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="5xe:3"],
+ [1632],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="5xe:4"],
+ [
+ AC_MSG_WARN([[[$0]] Unknown borlandc compiler version $_ax_[]_AC_LANG_ABBREV[]_compiler_version_borlandc_raw please report bug])
+ ])
+ ])
+ ])
+
+# COMO
+AC_DEFUN([_AX_COMPILER_VERSION_COMEAU],
+ [ dnl
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ [__COMO_VERSION__%100],,
+ AC_MSG_FAILURE([[[$0]] unknown comeau compiler minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ [(__COMO_VERSION__/100)%10],,
+ AC_MSG_FAILURE([[[$0]] unknown comeau compiler major version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor"
+ ])
+
+# KAI
+AC_DEFUN([_AX_COMPILER_VERSION_KAI],[
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ [__KCC_VERSION%100],,
+ AC_MSG_FAILURE([[[$0]] unknown kay compiler patch version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ [(__KCC_VERSION/100)%10],,
+ AC_MSG_FAILURE([[[$0]] unknown kay compiler minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ [(__KCC_VERSION/1000)%10],,
+ AC_MSG_FAILURE([[[$0]] unknown kay compiler major version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+
+dnl LCC
+dnl LCC does not output version...
+
+# SGI
+AC_DEFUN([_AX_COMPILER_VERSION_SGI],[
+ m4_define([_AX_COMPILER_VERSION_SGI_NUMBER],
+ [
+ #if defined(_COMPILER_VERSION)
+ _COMPILER_VERSION
+ #else
+ _SGI_COMPILER_VERSION
+ #endif
+ ])
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ [_AX_COMPILER_VERSION_SGI_NUMBER%10],,
+ AC_MSG_FAILURE([[[$0]] unknown SGI compiler patch version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ [(_AX_COMPILER_VERSION_SGI_NUMBER/10)%10],,
+ AC_MSG_FAILURE([[[$0]] unknown SGI compiler minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ [(_AX_COMPILER_VERSION_SGI_NUMBER/100)%10],,
+ AC_MSG_FAILURE([[[$0]] unknown SGI compiler major version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+
+# microsoft
+AC_DEFUN([_AX_COMPILER_VERSION_MICROSOFT],[
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ _MSC_VER%100,,
+ AC_MSG_FAILURE([[[$0]] unknown microsoft compiler minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ (_MSC_VER/100)%100,,
+ AC_MSG_FAILURE([[[$0]] unknown microsoft compiler major version]))
+ dnl could be overridden
+ _ax_[]_AC_LANG_ABBREV[]_compiler_version_patch=0
+ _ax_[]_AC_LANG_ABBREV[]_compiler_version_build=0
+ # special case for version 6
+ AS_IF([test "X$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major" = "X12"],
+ [AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ _MSC_FULL_VER%1000,,
+ _ax_[]_AC_LANG_ABBREV[]_compiler_version_patch=0)])
+ # for version 7
+ AS_IF([test "X$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major" = "X13"],
+ [AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ _MSC_FULL_VER%1000,,
+ AC_MSG_FAILURE([[[$0]] unknown microsoft compiler patch version]))
+ ])
+ # for version > 8
+ AS_IF([test $_ax_[]_AC_LANG_ABBREV[]_compiler_version_major -ge 14],
+ [AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ _MSC_FULL_VER%10000,,
+ AC_MSG_FAILURE([[[$0]] unknown microsoft compiler patch version]))
+ ])
+ AS_IF([test $_ax_[]_AC_LANG_ABBREV[]_compiler_version_major -ge 15],
+ [AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_build,
+ _MSC_BUILD,,
+ AC_MSG_FAILURE([[[$0]] unknown microsoft compiler build version]))
+ ])
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_build"
+ ])
+
+# for metrowerks
+AC_DEFUN([_AX_COMPILER_VERSION_METROWERKS],[dnl
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ __MWERKS__%0x100,,
+ AC_MSG_FAILURE([[[$0]] unknown metrowerks compiler patch version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ (__MWERKS__/0x100)%0x10,,
+ AC_MSG_FAILURE([[[$0]] unknown metrowerks compiler minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ (__MWERKS__/0x1000)%0x10,,
+ AC_MSG_FAILURE([[[$0]] unknown metrowerks compiler major version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+
+# for watcom
+AC_DEFUN([_AX_COMPILER_VERSION_WATCOM],[dnl
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ __WATCOMC__%100,,
+ AC_MSG_FAILURE([[[$0]] unknown watcom compiler minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ (__WATCOMC__/100)%100,,
+ AC_MSG_FAILURE([[[$0]] unknown watcom compiler major version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor"
+ ])
+
+# for PGI
+AC_DEFUN([_AX_COMPILER_VERSION_PORTLAND],[
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ __PGIC__,,
+ AC_MSG_FAILURE([[[$0]] unknown pgi major]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ __PGIC_MINOR__,,
+ AC_MSG_FAILURE([[[$0]] unknown pgi minor]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ [__PGIC_PATCHLEVEL__],,
+ AC_MSG_FAILURE([[[$0]] unknown pgi patch level]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+
+# tcc
+AC_DEFUN([_AX_COMPILER_VERSION_TCC],[
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version=[`tcc -v | $SED 's/^[ ]*tcc[ ]\+version[ ]\+\([0-9.]\+\).*/\1/g'`]
+ ])
+
+# for GNU
+AC_DEFUN([_AX_COMPILER_VERSION_SDCC],[
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ /* avoid parse error with comments */
+ #if(defined(__SDCC_VERSION_MAJOR))
+ __SDCC_VERSION_MAJOR
+ #else
+ SDCC/100
+ #endif
+ ,,
+ AC_MSG_FAILURE([[[$0]] unknown sdcc major]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ /* avoid parse error with comments */
+ #if(defined(__SDCC_VERSION_MINOR))
+ __SDCC_VERSION_MINOR
+ #else
+ (SDCC%100)/10
+ #endif
+ ,,
+ AC_MSG_FAILURE([[[$0]] unknown sdcc minor]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ [
+ /* avoid parse error with comments */
+ #if(defined(__SDCC_VERSION_PATCH))
+ __SDCC_VERSION_PATCH
+ #elsif(defined(_SDCC_VERSION_PATCHLEVEL))
+ __SDCC_VERSION_PATCHLEVEL
+ #else
+ SDCC%10
+ #endif
+ ],,
+ AC_MSG_FAILURE([[[$0]] unknown sdcc patch level]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+
+# main entry point
+AC_DEFUN([AX_COMPILER_VERSION],[dnl
+ AC_REQUIRE([AX_COMPILER_VENDOR])
+ AC_REQUIRE([AC_PROG_SED])
+ AC_CACHE_CHECK([for _AC_LANG compiler version],
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version,
+ [ dnl
+ AS_CASE([$ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor],
+ [intel],[_AX_COMPILER_VERSION_INTEL],
+ [ibm],[_AX_COMPILER_VERSION_IBM],
+ [pathscale],[_AX_COMPILER_VERSION_PATHSCALE],
+ [clang],[_AX_COMPILER_VERSION_CLANG],
+ [cray],[_AX_COMPILER_VERSION_CRAY],
+ [fujitsu],[_AX_COMPILER_VERSION_FUJITSU],
+ [gnu],[_AX_COMPILER_VERSION_GNU],
+ [sun],[_AX_COMPILER_VERSION_SUN],
+ [hp],[_AX_COMPILER_VERSION_HP],
+ [dec],[_AX_COMPILER_VERSION_DEC],
+ [borland],[_AX_COMPILER_VERSION_BORLAND],
+ [comeau],[_AX_COMPILER_VERSION_COMEAU],
+ [kai],[_AX_COMPILER_VERSION_KAI],
+ [sgi],[_AX_COMPILER_VERSION_SGI],
+ [microsoft],[_AX_COMPILER_VERSION_MICROSOFT],
+ [metrowerks],[_AX_COMPILER_VERSION_METROWERKS],
+ [watcom],[_AX_COMPILER_VERSION_WATCOM],
+ [portland],[_AX_COMPILER_VERSION_PORTLAND],
+ [tcc],[_AX_COMPILER_VERSION_TCC],
+ [sdcc],[_AX_COMPILER_VERSION_SDCC],
+ [ax_cv_[]_AC_LANG_ABBREV[]_compiler_version=""])
+ ])
+])
diff --git a/m4/m4_ax_prefix_config_h.m4 b/m4/m4_ax_prefix_config_h.m4
new file mode 100644
index 000000000..c17563f44
--- /dev/null
+++ b/m4/m4_ax_prefix_config_h.m4
@@ -0,0 +1,203 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_prefix_config_h.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX [,ORIG-HEADER]])]
+#
+# DESCRIPTION
+#
+# Generate an installable config.h.
+#
+# A package should not normally install its config.h as a system header,
+# but if it must, this macro can be used to avoid namespace pollution by
+# making a copy of config.h with a prefix added to all the macro names.
+#
+# Each "#define SOMEDEF" line of the configuration header has the given
+# prefix added, in the same case as the first character of the macro name.
+#
+# Defaults:
+#
+# OUTPUT-HEADER = $PACKAGE-config.h
+# PREFIX = $PACKAGE
+# ORIG-HEADER, from AM_CONFIG_HEADER(config.h)
+#
+# Your configure.ac script should contain both macros in this order.
+#
+# Example:
+#
+# AC_INIT(config.h.in) # config.h.in as created by "autoheader"
+# AM_INIT_AUTOMAKE(testpkg, 0.1.1) # makes #undef VERSION and PACKAGE
+# AM_CONFIG_HEADER(config.h) # prep config.h from config.h.in
+# AX_PREFIX_CONFIG_H(mylib/_config.h) # prep mylib/_config.h from it..
+# AC_MEMORY_H # makes "#undef NEED_MEMORY_H"
+# AC_C_CONST_H # makes "#undef const"
+# AC_OUTPUT(Makefile) # creates the "config.h" now
+# # and also mylib/_config.h
+#
+# If the argument to AX_PREFIX_CONFIG_H would have been omitted then the
+# default output file would have been called simply "testpkg-config.h",
+# but even under the name "mylib/_config.h" it contains prefix-defines
+# like
+#
+# #ifndef TESTPKG_VERSION
+# #define TESTPKG_VERSION "0.1.1"
+# #endif
+# #ifndef TESTPKG_NEED_MEMORY_H
+# #define TESTPKG_NEED_MEMORY_H 1
+# #endif
+# #ifndef _testpkg_const
+# #define _testpkg_const _const
+# #endif
+#
+# and this "mylib/_config.h" can be installed along with other header
+# files, which is most convenient when creating a shared library (that has
+# some headers) whose functionality depends on features detected at
+# compile-time. No need to invent some "mylib-confdefs.h.in" manually.
+#
+# Note that some AC_DEFINEs that end up in the config.h file are actually
+# self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the AC_TYPE_OFF_T
+# say that they "will define inline|const|off_t if the system does not do
+# it by itself". You might want to clean up about these - consider an
+# extra mylib/conf.h that reads something like:
+#
+# #include
+# #ifndef _testpkg_const
+# #define _testpkg_const const
+# #endif
+#
+# and then start using _testpkg_const in the header files. That is also a
+# good thing to differentiate whether some library-user has starting to
+# take up with a different compiler, so perhaps it could read something
+# like this:
+#
+# #ifdef _MSC_VER
+# #include
+# #else
+# #include
+# #endif
+# #ifndef _testpkg_const
+# #define _testpkg_const const
+# #endif
+#
+# LICENSE
+#
+# Copyright (c) 2014 Reuben Thomas
+# Copyright (c) 2008 Guido U. Draheim
+# Copyright (c) 2008 Marten Svantesson
+# Copyright (c) 2008 Gerald Point
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see .
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 15
+
+AC_DEFUN([AX_PREFIX_CONFIG_H],[dnl
+AC_PREREQ([2.62])
+AC_BEFORE([AC_CONFIG_HEADERS],[$0])dnl
+AC_CONFIG_COMMANDS(m4_default([$1], [$PACKAGE-config.h]),[dnl
+AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl
+AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl
+AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl
+AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl
+AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl
+AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl
+m4_pushdef([_script],[conftest.prefix])dnl
+m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl
+_OUT=`echo m4_default([$1], [$PACKAGE-config.h])`
+_DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"`
+_PKG=`echo m4_default([$2], [$PACKAGE])`
+_LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"`
+_UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:" -e "/^@<:@m4_cr_digits@:>@/s/^/_/"`
+_INP=`echo "$3" | sed -e 's/ *//'`
+if test ".$_INP" = "."; then
+ for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
+ case "$ac_file" in
+ *.h) _INP=$ac_file ;;
+ *)
+ esac
+ test ".$_INP" != "." && break
+ done
+fi
+if test ".$_INP" = "."; then
+ case "$_OUT" in
+ */*) _INP=`basename "$_OUT"`
+ ;;
+ *-*) _INP=`echo "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"`
+ ;;
+ *) _INP=config.h
+ ;;
+ esac
+fi
+if test -z "$_PKG" ; then
+ AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H])
+else
+ if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then
+ _INP="$srcdir/$_INP"
+ fi fi
+ AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines)
+ if test -f $_INP ; then
+ AS_ECHO(["s/^@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/"]) > _script
+ AS_ECHO(["s/^@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/"]) >> _script
+ AS_ECHO(["s/^@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1\\"]) >> _script
+ AS_ECHO(["@%:@def[]ine $_UPP""_\\1\\2\\"]) >> _script
+ AS_ECHO(["@%:@endif/"]) >> _script
+ AS_ECHO(["s/^@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1\\"]) >> _script
+ AS_ECHO(["@%:@define $_LOW""_\\1\\2\\"]) >> _script
+ AS_ECHO(["@%:@endif/"]) >> _script
+ # now executing _script on _DEF input to create _OUT output file
+ echo "@%:@ifndef $_DEF" >$tmp/pconfig.h
+ echo "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h
+ echo ' ' >>$tmp/pconfig.h
+ echo /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h
+
+ sed -f _script $_INP >>$tmp/pconfig.h
+ echo ' ' >>$tmp/pconfig.h
+ echo '/* once:' $_DEF '*/' >>$tmp/pconfig.h
+ echo "@%:@endif" >>$tmp/pconfig.h
+ if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then
+ AC_MSG_NOTICE([$_OUT is unchanged])
+ else
+ ac_dir=`AS_DIRNAME(["$_OUT"])`
+ AS_MKDIR_P(["$ac_dir"])
+ rm -f "$_OUT"
+ mv $tmp/pconfig.h "$_OUT"
+ fi
+ else
+ AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT])
+ fi
+ rm -f conftest.*
+fi
+m4_popdef([_symbol])dnl
+m4_popdef([_script])dnl
+AS_VAR_POPDEF([_INP])dnl
+AS_VAR_POPDEF([_UPP])dnl
+AS_VAR_POPDEF([_LOW])dnl
+AS_VAR_POPDEF([_PKG])dnl
+AS_VAR_POPDEF([_DEF])dnl
+AS_VAR_POPDEF([_OUT])dnl
+],[PACKAGE="$PACKAGE"])])
diff --git a/makeVS2010.bat b/makeVS201x.bat
similarity index 83%
rename from makeVS2010.bat
rename to makeVS201x.bat
index 2bbb4fba5..ead5eb7b4 100644
--- a/makeVS2010.bat
+++ b/makeVS201x.bat
@@ -3,6 +3,7 @@ rem * Command line build - For CppUTest - Run from CppUTest directory
rem *
rem * this path works on my machine
rem ****PATH=C:\Windows\Microsoft.NET\Framework\v4.0.30319;c:\windows\system32;c:\windows
-msbuild /t:rebuild /verbosity:quiet CppUTest_VS2010.sln
+msbuild /t:rebuild /verbosity:quiet CppUTest_VS201x.sln
set test_exe=tests\Debug\AllTests.exe
if exist %test_exe% %test_exe% -v
+
diff --git a/makeVc6.bat b/makeVc6.bat
deleted file mode 100644
index d60d91830..000000000
--- a/makeVc6.bat
+++ /dev/null
@@ -1,16 +0,0 @@
-rem ****
-rem * Command line build - For CppUTest - Run from dsw directory
-rem *
-rem * A single parameter is supported and it is the last parameter of msdev
-rem * for example:
-rem * /clean
-rem * make sure to use the slash
-rem * this needs to be in your path
-rem ****PATH=C:\Program Files\Microsoft Visual Studio\VC98\Bin;%PATH%
-
-msdev CppUTest.dsp /MAKE "CppUTest - Debug" %1
-msdev tests\AllTests.dsp /MAKE "AllTests - Debug" %1
-if "%1" EQU "/clean" goto end
-if "%1" EQU "/CLEAN" goto end
-tests\Debug\AllTests
-:end
diff --git a/platforms/CCStudio/CppUTest.pjt b/platforms/CCStudio/CppUTest.pjt
index c19e0228f..3186c6109 100644
--- a/platforms/CCStudio/CppUTest.pjt
+++ b/platforms/CCStudio/CppUTest.pjt
@@ -16,7 +16,9 @@ Source="..\..\src\CppUTest\CommandLineTestRunner.cpp"
Source="..\..\src\CppUTest\JUnitTestOutput.cpp"
Source="..\..\src\CppUTest\MemoryLeakDetector.cpp"
Source="..\..\src\CppUTest\MemoryLeakWarningPlugin.cpp"
+Source="..\..\src\CppUTest\SimpleMutex.cpp"
Source="..\..\src\CppUTest\SimpleString.cpp"
+Source="..\..\src\CppUTest\TeamCityTestOutput.cpp"
Source="..\..\src\CppUTest\TestFailure.cpp"
Source="..\..\src\CppUTest\TestFilter.cpp"
Source="..\..\src\CppUTest\TestHarness_c.cpp"
@@ -25,8 +27,10 @@ Source="..\..\src\CppUTest\TestOutput.cpp"
Source="..\..\src\CppUTest\TestPlugin.cpp"
Source="..\..\src\CppUTest\TestRegistry.cpp"
Source="..\..\src\CppUTest\TestResult.cpp"
+Source="..\..\src\CppUTest\TestTestingFixture.cpp"
Source="..\..\src\CppUTest\Utest.cpp"
Source="..\..\src\CppUTestExt\CodeMemoryReportFormatter.cpp"
+Source="..\..\src\CppUTestExt\GTest.cpp"
Source="..\..\src\CppUTestExt\MemoryReportAllocator.cpp"
Source="..\..\src\CppUTestExt\MemoryReporterPlugin.cpp"
Source="..\..\src\CppUTestExt\MemoryReportFormatter.cpp"
diff --git a/platforms/CCStudio/CppUTest.wks b/platforms/CCStudio/CppUTest.wks
index 1dd4eb319..edcb3b00c 100644
Binary files a/platforms/CCStudio/CppUTest.wks and b/platforms/CCStudio/CppUTest.wks differ
diff --git a/platforms/CCStudio/CppUTestExtRunAllTests1.pjt b/platforms/CCStudio/CppUTestExtRunAllTests1.pjt
index 395875821..2afdd31e3 100644
--- a/platforms/CCStudio/CppUTestExtRunAllTests1.pjt
+++ b/platforms/CCStudio/CppUTestExtRunAllTests1.pjt
@@ -16,7 +16,10 @@ Source="..\..\src\CppUTest\CommandLineTestRunner.cpp"
Source="..\..\src\CppUTest\JUnitTestOutput.cpp"
Source="..\..\src\CppUTest\MemoryLeakDetector.cpp"
Source="..\..\src\CppUTest\MemoryLeakWarningPlugin.cpp"
+Source="..\..\src\CppUTest\SimpleMutex.cpp"
Source="..\..\src\CppUTest\SimpleString.cpp"
+Source="..\..\src\CppUTest\SimpleStringInternalCache.cpp"
+Source="..\..\src\CppUTest\TeamCityTestOutput.cpp"
Source="..\..\src\CppUTest\TestFailure.cpp"
Source="..\..\src\CppUTest\TestFilter.cpp"
Source="..\..\src\CppUTest\TestHarness_c.cpp"
@@ -25,8 +28,10 @@ Source="..\..\src\CppUTest\TestOutput.cpp"
Source="..\..\src\CppUTest\TestPlugin.cpp"
Source="..\..\src\CppUTest\TestRegistry.cpp"
Source="..\..\src\CppUTest\TestResult.cpp"
+Source="..\..\src\CppUTest\TestTestingFixture.cpp"
Source="..\..\src\CppUTest\Utest.cpp"
Source="..\..\src\CppUTestExt\CodeMemoryReportFormatter.cpp"
+Source="..\..\src\CppUTestExt\GTest.cpp"
Source="..\..\src\CppUTestExt\MemoryReportAllocator.cpp"
Source="..\..\src\CppUTestExt\MemoryReporterPlugin.cpp"
Source="..\..\src\CppUTestExt\MemoryReportFormatter.cpp"
@@ -36,22 +41,25 @@ Source="..\..\src\CppUTestExt\MockExpectedCallsList.cpp"
Source="..\..\src\CppUTestExt\MockFailure.cpp"
Source="..\..\src\CppUTestExt\MockNamedValue.cpp"
Source="..\..\src\CppUTestExt\MockSupport.cpp"
-Source="..\..\src\CppUTestExt\MockSupport_c.cpp"
Source="..\..\src\CppUTestExt\MockSupportPlugin.cpp"
Source="..\..\src\CppUTestExt\OrderedTest.cpp"
Source="..\..\src\Platforms\C2000\UtestPlatform.cpp"
-Source="..\..\tests\CppUTestExt\CodeMemoryReportFormatterTest.cpp"
+Source="..\..\tests\CppUTestExt\CodeMemoryReporterTest.cpp"
Source="..\..\tests\CppUTestExt\GMockTest.cpp"
Source="..\..\tests\CppUTestExt\GTest1Test.cpp"
Source="..\..\tests\CppUTestExt\GTest2ConvertorTest.cpp"
Source="..\..\tests\CppUTestExt\MemoryReportAllocatorTest.cpp"
-Source="..\..\tests\CppUTestExt\MemoryReporterPluginTest.cpp"
Source="..\..\tests\CppUTestExt\MemoryReportFormatterTest.cpp"
Source="..\..\tests\CppUTestExt\MockActualCallTest.cpp"
Source="..\..\tests\CppUTestExt\MockCheatSheetTest.cpp"
Source="..\..\tests\CppUTestExt\MockExpectedCallTest.cpp"
-Source="..\..\tests\CppUTestExt\MockExpectedFunctionsListTest.cpp"
+Source="..\..\tests\CppUTestExt\MockFailureReporterForTest.cpp"
Source="..\..\tests\CppUTestExt\MockFailureTest.cpp"
+Source="..\..\tests\CppUTestExt\MockHierarchyTest.cpp"
+Source="..\..\tests\CppUTestExt\MockPluginTest.cpp"
+Source="..\..\tests\CppUTestExt\MockReturnValueTest.cpp"
+Source="..\..\tests\CppUTestExt\MockStrictOrderTest.cpp"
+Source="..\..\tests\CppUTestExt\MockSupportTest.cpp"
Source="C:\CCStudio_v3.3\C2000\cgtools\lib\src\farmem_cpp.cpp"
Source="tests\CppUTestExt\AllTestsForTarget.cpp"
Source="sim28335.cmd"
diff --git a/platforms/CCStudio/CppUTestExtRunAllTests2.pjt b/platforms/CCStudio/CppUTestExtRunAllTests2.pjt
index dd1f9073a..b9a40b195 100644
--- a/platforms/CCStudio/CppUTestExtRunAllTests2.pjt
+++ b/platforms/CCStudio/CppUTestExtRunAllTests2.pjt
@@ -16,7 +16,10 @@ Source="..\..\src\CppUTest\CommandLineTestRunner.cpp"
Source="..\..\src\CppUTest\JUnitTestOutput.cpp"
Source="..\..\src\CppUTest\MemoryLeakDetector.cpp"
Source="..\..\src\CppUTest\MemoryLeakWarningPlugin.cpp"
+Source="..\..\src\CppUTest\SimpleMutex.cpp"
Source="..\..\src\CppUTest\SimpleString.cpp"
+Source="..\..\src\CppUTest\SimpleStringInternalCache.cpp"
+Source="..\..\src\CppUTest\TeamCityTestOutput.cpp"
Source="..\..\src\CppUTest\TestFailure.cpp"
Source="..\..\src\CppUTest\TestFilter.cpp"
Source="..\..\src\CppUTest\TestHarness_c.cpp"
@@ -25,8 +28,10 @@ Source="..\..\src\CppUTest\TestOutput.cpp"
Source="..\..\src\CppUTest\TestPlugin.cpp"
Source="..\..\src\CppUTest\TestRegistry.cpp"
Source="..\..\src\CppUTest\TestResult.cpp"
+Source="..\..\src\CppUTest\TestTestingFixture.cpp"
Source="..\..\src\CppUTest\Utest.cpp"
Source="..\..\src\CppUTestExt\CodeMemoryReportFormatter.cpp"
+Source="..\..\src\CppUTestExt\GTest.cpp"
Source="..\..\src\CppUTestExt\MemoryReportAllocator.cpp"
Source="..\..\src\CppUTestExt\MemoryReporterPlugin.cpp"
Source="..\..\src\CppUTestExt\MemoryReportFormatter.cpp"
@@ -40,12 +45,16 @@ Source="..\..\src\CppUTestExt\MockSupport_c.cpp"
Source="..\..\src\CppUTestExt\MockSupportPlugin.cpp"
Source="..\..\src\CppUTestExt\OrderedTest.cpp"
Source="..\..\src\Platforms\C2000\UtestPlatform.cpp"
-Source="..\..\tests\CppUTestExt\MockFailureTest.cpp"
-Source="..\..\tests\CppUTestExt\MockPluginTest.cpp"
+Source="..\..\tests\CppUTestExt\MemoryReporterPluginTest.cpp"
+Source="..\..\tests\CppUTestExt\MockCallTest.cpp"
+Source="..\..\tests\CppUTestExt\MockComparatorCopierTest.cpp"
+Source="..\..\tests\CppUTestExt\MockFailureReporterForTest.cpp"
+Source="..\..\tests\CppUTestExt\MockNamedValueTest.cpp"
+Source="..\..\tests\CppUTestExt\MockParameterTest.cpp"
Source="..\..\tests\CppUTestExt\MockSupport_cTest.cpp"
Source="..\..\tests\CppUTestExt\MockSupport_cTestCFile.c"
-Source="..\..\tests\CppUTestExt\MockSupportTest.cpp"
Source="..\..\tests\CppUTestExt\OrderedTestTest.cpp"
+Source="..\..\tests\CppUTestExt\OrderedTestTest_c.c"
Source="C:\CCStudio_v3.3\C2000\cgtools\lib\src\farmem_cpp.cpp"
Source="tests\CppUTestExt\AllTestsForTarget.cpp"
Source="sim28335.cmd"
diff --git a/platforms/CCStudio/CppUTestRunAllTests1.pjt b/platforms/CCStudio/CppUTestRunAllTests1.pjt
index 58006abcb..9625021ee 100644
--- a/platforms/CCStudio/CppUTestRunAllTests1.pjt
+++ b/platforms/CCStudio/CppUTestRunAllTests1.pjt
@@ -16,7 +16,10 @@ Source="..\..\src\CppUTest\CommandLineTestRunner.cpp"
Source="..\..\src\CppUTest\JUnitTestOutput.cpp"
Source="..\..\src\CppUTest\MemoryLeakDetector.cpp"
Source="..\..\src\CppUTest\MemoryLeakWarningPlugin.cpp"
+Source="..\..\src\CppUTest\SimpleMutex.cpp"
Source="..\..\src\CppUTest\SimpleString.cpp"
+Source="..\..\src\CppUTest\SimpleStringInternalCache.cpp"
+Source="..\..\src\CppUTest\TeamCityTestOutput.cpp"
Source="..\..\src\CppUTest\TestFailure.cpp"
Source="..\..\src\CppUTest\TestFilter.cpp"
Source="..\..\src\CppUTest\TestHarness_c.cpp"
@@ -25,6 +28,7 @@ Source="..\..\src\CppUTest\TestOutput.cpp"
Source="..\..\src\CppUTest\TestPlugin.cpp"
Source="..\..\src\CppUTest\TestRegistry.cpp"
Source="..\..\src\CppUTest\TestResult.cpp"
+Source="..\..\src\CppUTest\TestTestingFixture.cpp"
Source="..\..\src\CppUTest\Utest.cpp"
Source="..\..\src\Platforms\C2000\UtestPlatform.cpp"
Source="..\..\tests\AllocationInCFile.c"
@@ -32,15 +36,20 @@ Source="..\..\tests\AllocationInCppFile.cpp"
Source="..\..\tests\AllocLetTestFree.c"
Source="..\..\tests\AllocLetTestFreeTest.cpp"
Source="..\..\tests\CheatSheetTest.cpp"
+Source="..\..\tests\CompatabilityTests.cpp"
Source="..\..\tests\CommandLineArgumentsTest.cpp"
Source="..\..\tests\CommandLineTestRunnerTest.cpp"
Source="..\..\tests\JUnitOutputTest.cpp"
Source="..\..\tests\MemoryLeakDetectorTest.cpp"
-Source="..\..\tests\MemoryLeakOperatorOverloadsTest.cpp"
Source="..\..\tests\MemoryLeakWarningTest.cpp"
+Source="..\..\tests\MemoryOperatorOverloadTest.cpp"
Source="..\..\tests\PluginTest.cpp"
Source="..\..\tests\PreprocessorTest.cpp"
Source="..\..\tests\SetPluginTest.cpp"
+Source="..\..\tests\TeamCityOutputTest.cpp"
+Source="..\..\tests\TestFailureNaNTest.cpp"
+Source="..\..\tests\TestFailureTest.cpp"
+Source="..\..\tests\TestUTestStringMacro.cpp"
Source="C:\CCStudio_v3.3\C2000\cgtools\lib\src\farmem_cpp.cpp"
Source="tests\CppUTest\AllTestsForTarget.cpp"
Source="sim28335.cmd"
diff --git a/platforms/CCStudio/CppUTestRunAllTests2.pjt b/platforms/CCStudio/CppUTestRunAllTests2.pjt
index 82ac5d5c7..256969796 100644
--- a/platforms/CCStudio/CppUTestRunAllTests2.pjt
+++ b/platforms/CCStudio/CppUTestRunAllTests2.pjt
@@ -16,7 +16,10 @@ Source="..\..\src\CppUTest\CommandLineTestRunner.cpp"
Source="..\..\src\CppUTest\JUnitTestOutput.cpp"
Source="..\..\src\CppUTest\MemoryLeakDetector.cpp"
Source="..\..\src\CppUTest\MemoryLeakWarningPlugin.cpp"
+Source="..\..\src\CppUTest\SimpleMutex.cpp"
Source="..\..\src\CppUTest\SimpleString.cpp"
+Source="..\..\src\CppUTest\SimpleStringInternalCache.cpp"
+Source="..\..\src\CppUTest\TeamCityTestOutput.cpp"
Source="..\..\src\CppUTest\TestFailure.cpp"
Source="..\..\src\CppUTest\TestFilter.cpp"
Source="..\..\src\CppUTest\TestHarness_c.cpp"
@@ -25,11 +28,11 @@ Source="..\..\src\CppUTest\TestOutput.cpp"
Source="..\..\src\CppUTest\TestPlugin.cpp"
Source="..\..\src\CppUTest\TestRegistry.cpp"
Source="..\..\src\CppUTest\TestResult.cpp"
+Source="..\..\src\CppUTest\TestTestingFixture.cpp"
Source="..\..\src\CppUTest\Utest.cpp"
+Source="..\..\src\CppUTestExt\MockSupportPlugin.cpp"
Source="..\..\src\Platforms\C2000\UtestPlatform.cpp"
-Source="..\..\tests\SimpleStringTest.cpp"
-Source="..\..\tests\TestFailureNaNTest.cpp"
-Source="..\..\tests\TestFailureTest.cpp"
+Source="..\..\tests\SimpleStringCacheTest.cpp"
Source="..\..\tests\TestFilterTest.cpp"
Source="..\..\tests\TestHarness_cTest.cpp"
Source="..\..\tests\TestHarness_cTestCFile.c"
diff --git a/platforms/CCStudio/tests/CppUTest/AllTestsForTarget.cpp b/platforms/CCStudio/tests/CppUTest/AllTestsForTarget.cpp
index 47cda0edc..1c977dbde 100644
--- a/platforms/CCStudio/tests/CppUTest/AllTestsForTarget.cpp
+++ b/platforms/CCStudio/tests/CppUTest/AllTestsForTarget.cpp
@@ -14,7 +14,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
diff --git a/platforms/CCStudio/tests/CppUTestExt/AllTestsForTarget.cpp b/platforms/CCStudio/tests/CppUTestExt/AllTestsForTarget.cpp
index 4d7ec09df..d55800a2d 100644
--- a/platforms/CCStudio/tests/CppUTestExt/AllTestsForTarget.cpp
+++ b/platforms/CCStudio/tests/CppUTestExt/AllTestsForTarget.cpp
@@ -14,7 +14,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
diff --git a/platforms/Dos/.gitignore b/platforms/Dos/.gitignore
new file mode 100644
index 000000000..e37978cfb
--- /dev/null
+++ b/platforms/Dos/.gitignore
@@ -0,0 +1 @@
+platform.mk
diff --git a/platforms/Dos/ALLTESTS.BAT b/platforms/Dos/ALLTESTS.BAT
new file mode 100644
index 000000000..25bf9dfee
--- /dev/null
+++ b/platforms/Dos/ALLTESTS.BAT
@@ -0,0 +1,16 @@
+REM Run all tests on Windows systems
+@echo off
+set log=%~n0.LOG & shift & set args=%*
+if exist %log% del %log%
+echo.>exit
+for %%a in (*.EXE) do call :run %%a
+echo. & type %log%
+echo. & echo Done.
+exit/b
+
+:run
+ echo Running %1 inside DOSBox...
+ echo *** %1 (%~z1 bytes) *********************>>%log%
+ DOSBox.exe -conf ..\platforms\Dos\dosbox-0.74.conf exit ^
+ -c "%1 %args%>>%log%" -noconsole -exit
+exit/b
diff --git a/platforms/Dos/Makefile b/platforms/Dos/Makefile
new file mode 100644
index 000000000..7b19cafa4
--- /dev/null
+++ b/platforms/Dos/Makefile
@@ -0,0 +1,68 @@
+CXX := wcl
+CC := wcl
+AR := wlib
+LINK := wlink
+LOG := ALLTESTS.LOG
+NULL :=
+space := $(NULL) #
+comma := ,
+path_separator := /
+drive = $(subst $(CYGDRIVE),$(lastword $(subst /, ,$(CYGDRIVE))):/,$(1))
+convert_paths = $(if $(CYGDRIVE),$(subst /,$(path_separator),$(call drive,$(1))),$(1))
+export CPPUTEST_HOME ?= .
+
+-include $(CPPUTEST_HOME)/platforms/Dos/platform.mk
+include $(CPPUTEST_HOME)/platforms/Dos/sources.mk
+
+COMMONFLAGS := \
+ -q -c -os -oc -d0 -we -w=3 -ml -zm \
+ -dCPPUTEST_MEM_LEAK_DETECTION_DISABLED=1 -dCPPUTEST_STD_CPP_LIB_DISABLED=1 \
+ -i$(call convert_paths,$(CPPUTEST_HOME)/include) \
+ -i$(call convert_paths,$(WATCOM)/h) -i$(call convert_paths,$(WATCOM)/h/nt) \
+
+# Disable W303 unreferenced parameter - PUNUSED is GNU-specific
+CFLAGS := \
+ $(COMMONFLAGS) \
+ -wcd=303
+
+# Disable W013 unreachable code - it overreacts to CHECK_EQUAL macros
+# Disable W367 conditional expression in if statement is always true - same
+# Disable W368 conditional expression in if statement is always false - same
+# Disable W391 assignment found in boolean expression - we don't care
+CXXFLAGS := \
+ $(COMMONFLAGS) \
+ -wcd=13 \
+ -wcd=367 \
+ -wcd=368 \
+ -wcd=391 \
+ -xds
+
+.PHONY: all clean
+
+all: CPPU.LIB CPPUX.LIB \
+ CPPU1.EXE CPPU2.EXE CPPU3.EXE CPPU4.EXE CPPU5.EXE CPPU6.EXE CPPU7.EXE CPPU8.EXE \
+ CPPUX1.EXE CPPUX2.EXE CPPUX3.EXE CPPUX4.EXE CPPUX5.EXE CPPUX6.EXE CPPUX7.EXE CPPUX8.EXE CPPUX9.EXE
+
+clean:
+ rm -rf ../src/CppUTest/*.o ../src/CppUTestExt/*.o \
+ ../src/Platforms/dos/*.o ../tests/*.o ../tests/CppUTestExt/*.o \
+ *.o *.map *.LOG *.EXE *.err *.LIB *.LST
+
+%.o: %.cpp
+ $(CXX) $(CXXFLAGS) -fo=$(call convert_paths,$@) $(call convert_paths,$<)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -fo=$(call convert_paths,$@) $(call convert_paths,$<)
+
+.SECONDEXPANSION:
+
+%.LIB: $$($$*_OBJECTS)
+ $(AR) -q -lCPPU.LST $@ $(addprefix +,$(call convert_paths,$?))
+
+%.EXE: $$($$*_OBJECTS) | CPPU.LIB CPPUX.LIB
+ $(LINK) opt q,map,st=50k sys dos lib CPPU.LIB,CPPUX.LIB \
+ file $(subst $(space),$(comma),$(call convert_paths,$?)) name $@
+
+.PHONY:
+test:
+ $(CPPUTEST_HOME)/platforms/Dos/alltests.sh
diff --git a/platforms/Dos/README.txt b/platforms/Dos/README.txt
new file mode 100644
index 000000000..66825b6c0
--- /dev/null
+++ b/platforms/Dos/README.txt
@@ -0,0 +1,25 @@
+To compile on your Windows PC (or other platform), please create
+a file called "platform.mk" in this directory.
+
+### Example platform.mk for use with Cygwin on Windows XP
+WATCOM := d:\\bin\\watcom
+CPPUTEST_HOME := /d/dev/05_CppUTest/cpputest
+DOSBOX := DOSBox
+CYGDRIVE:= /d/
+path_separator := \\
+
+### Another example platform.mk for use with Cygwin on Windows 7
+WATCOM := d:\watcom
+CPPUTEST_HOME := /cygdrive/c/data/00_Dev/05_CppUTest/cpputest
+INCLUDE := c:\data\00_Dev\05_CppUTest\cpputest\include
+DOSBOX := DOSBox
+CYGDRIVE:= /cygdrive/d/
+path_separator := \\
+
+### platform.mk for use with Cygwin 2.5.0 on Windows 7
+WATCOM := d:\watcom
+CPPUTEST_HOME := c:\\data\\00_Dev\\05_CppUTest\\cpputest
+INCLUDE := c:\data\00_Dev\05_CppUTest\cpputest\include
+DOSBOX := DOSBox
+CYGDRIVE:= /cygdrive/d/
+path_separator := \\
diff --git a/platforms/Dos/alltests.sh b/platforms/Dos/alltests.sh
new file mode 100755
index 000000000..9c54b3e0b
--- /dev/null
+++ b/platforms/Dos/alltests.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+: "${CPPUTEST_HOME:=.}"
+
+checkForCppUTestToolsEnvVariable() {
+ if [ -z "$CPPUTEST_HOME" ] ; then
+ echo "CPPUTEST_HOME not set. You must set CPPUTEST_HOME to the top level CppUTest directory"
+ exit 1
+ fi
+ if [ ! -d "$CPPUTEST_HOME" ] ; then
+ echo "CPPUTEST_HOME not set to a directory. You must set CPPUTEST_HOME to the top level CppUTest directory"
+ exit 2
+ fi
+}
+
+checkForCppUTestToolsEnvVariable
+
+printf "" > exit # so dosbox will run 'external' command 'exit' correctly
+printf "" >ALLTESTS.LOG
+for test in `ls *.EXE`; do
+ kb=`ls -lsk ${test} | awk '{print $1}'`
+ printf "Running ${test} (${kb}k) inside DOSBox...\n"
+ dosbox -conf $CPPUTEST_HOME/platforms/Dos/dosbox-0.74.conf exit \
+ -c "echo *** ${test} (${kb}k) *****************************>>ALLTESTS.LOG" \
+ -c "${test}>>ALLTESTS.LOG" \
+ -noconsole -exit 1>console_output 2>dosbox_error.log || { printf "error running command!\n"; cat dosbox_error.log; exit 1; }
+done
+printf "\n"
+[ "`cat ALLTESTS.LOG`" ] || { printf "No tests to run!\n"; exit 1; }
+[ "`cat ALLTESTS.LOG|grep checks`" ] || { printf "No test output!\n"; exit 1; }
+cat ALLTESTS.LOG
+[ -z "`cat ALLTESTS.LOG|grep Failure`" ] || { printf "Failed tests!\n"; exit 1; }
diff --git a/platforms/Dos/dosbox-0.74.conf b/platforms/Dos/dosbox-0.74.conf
new file mode 100644
index 000000000..3846a0ece
--- /dev/null
+++ b/platforms/Dos/dosbox-0.74.conf
@@ -0,0 +1,240 @@
+# This is the configurationfile for DOSBox 0.74. (Please use the latest version of DOSBox)
+# Lines starting with a # are commentlines and are ignored by DOSBox.
+# They are used to (briefly) document the effect of each option.
+
+[sdl]
+# fullscreen: Start dosbox directly in fullscreen. (Press ALT-Enter to go back)
+# fulldouble: Use double buffering in fullscreen. It can reduce screen flickering, but it can also result in a slow DOSBox.
+# fullresolution: What resolution to use for fullscreen: original or fixed size (e.g. 1024x768).
+# Using your monitor's native resolution with aspect=true might give the best results.
+# If you end up with small window on a large screen, try an output different from surface.
+# windowresolution: Scale the window to this size IF the output device supports hardware scaling.
+# (output=surface does not!)
+# output: What video system to use for output.
+# Possible values: surface, overlay, opengl, openglnb.
+# autolock: Mouse will automatically lock, if you click on the screen. (Press CTRL-F10 to unlock)
+# sensitivity: Mouse sensitivity.
+# waitonerror: Wait before closing the console if dosbox has an error.
+# priority: Priority levels for dosbox. Second entry behind the comma is for when dosbox is not focused/minimized.
+# pause is only valid for the second entry.
+# Possible values: lowest, lower, normal, higher, highest, pause.
+# mapperfile: File used to load/save the key/event mappings from. Resetmapper only works with the defaul value.
+# usescancodes: Avoid usage of symkeys, might not work on all operating systems.
+
+fullscreen=false
+fulldouble=false
+fullresolution=1366x768
+windowresulultion=900x675
+output=surface
+autolock=false
+sensitivity=50
+waitonerror=true
+priority=higher,normal
+mapperfile=mapper-0.74.map
+usescancodes=true
+
+[dosbox]
+# language: Select another language file.
+# machine: The type of machine tries to emulate.
+# Possible values: hercules, cga, tandy, pcjr, ega, vgaonly, svga_s3, svga_et3000, svga_et4000, svga_paradise, vesa_nolfb, vesa_oldvbe.
+# captures: Directory where things like wave, midi, screenshot get captured.
+# memsize: Amount of memory DOSBox has in megabytes.
+# This value is best left at its default to avoid problems with some games,
+# though few games might require a higher value.
+# There is generally no speed advantage when raising this value.
+
+language=
+machine=svga_s3
+captures=capture
+memsize=16
+
+[render]
+# frameskip: How many frames DOSBox skips before drawing one.
+# aspect: Do aspect correction, if your output method doesn't support scaling this can slow things down!.
+# scaler: Scaler used to enlarge/enhance low resolution modes.
+# If 'forced' is appended, then the scaler will be used even if the result might not be desired.
+# Possible values: none, normal2x, normal3x, advmame2x, advmame3x, advinterp2x, advinterp3x, hq2x, hq3x, 2xsai, super2xsai, supereagle, tv2x, tv3x, rgb2x, rgb3x, scan2x, scan3x.
+
+frameskip=0
+aspect=false
+scaler=normal2x
+
+[cpu]
+# core: CPU Core used in emulation. auto will switch to dynamic if available and appropriate.
+# Possible values: auto, dynamic, normal, simple.
+# cputype: CPU Type used in emulation. auto is the fastest choice.
+# Possible values: auto, 386, 386_slow, 486_slow, pentium_slow, 386_prefetch.
+# cycles: Amount of instructions DOSBox tries to emulate each millisecond.
+# Setting this value too high results in sound dropouts and lags.
+# Cycles can be set in 3 ways:
+# 'auto' tries to guess what a game needs.
+# It usually works, but can fail for certain games.
+# 'fixed #number' will set a fixed amount of cycles. This is what you usually need if 'auto' fails.
+# (Example: fixed 4000).
+# 'max' will allocate as much cycles as your computer is able to handle.
+#
+# Possible values: auto, fixed, max.
+# cycleup: Amount of cycles to decrease/increase with keycombo.(CTRL-F11/CTRL-F12)
+# cycledown: Setting it lower than 100 will be a percentage.
+
+core=auto
+cputype=auto
+cycles=max
+cycleup=10
+cycledown=20
+
+[mixer]
+# nosound: Enable silent mode, sound is still emulated though.
+# rate: Mixer sample rate, setting any device's rate higher than this will probably lower their sound quality.
+# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.
+# blocksize: Mixer block size, larger blocks might help sound stuttering but sound will also be more lagged.
+# Possible values: 1024, 2048, 4096, 8192, 512, 256.
+# prebuffer: How many milliseconds of data to keep on top of the blocksize.
+
+nosound=true
+rate=44100
+blocksize=1024
+prebuffer=20
+
+[midi]
+# mpu401: Type of MPU-401 to emulate.
+# Possible values: intelligent, uart, none.
+# mididevice: Device that will receive the MIDI data from MPU-401.
+# Possible values: default, win32, alsa, oss, coreaudio, coremidi, none.
+# midiconfig: Special configuration options for the device driver. This is usually the id of the device you want to use.
+# See the README/Manual for more details.
+
+mpu401=none
+mididevice=none
+midiconfig=
+
+[sblaster]
+# sbtype: Type of Soundblaster to emulate. gb is Gameblaster.
+# Possible values: sb1, sb2, sbpro1, sbpro2, sb16, gb, none.
+# sbbase: The IO address of the soundblaster.
+# Possible values: 220, 240, 260, 280, 2a0, 2c0, 2e0, 300.
+# irq: The IRQ number of the soundblaster.
+# Possible values: 7, 5, 3, 9, 10, 11, 12.
+# dma: The DMA number of the soundblaster.
+# Possible values: 1, 5, 0, 3, 6, 7.
+# hdma: The High DMA number of the soundblaster.
+# Possible values: 1, 5, 0, 3, 6, 7.
+# sbmixer: Allow the soundblaster mixer to modify the DOSBox mixer.
+# oplmode: Type of OPL emulation. On 'auto' the mode is determined by sblaster type. All OPL modes are Adlib-compatible, except for 'cms'.
+# Possible values: auto, cms, opl2, dualopl2, opl3, none.
+# oplemu: Provider for the OPL emulation. compat might provide better quality (see oplrate as well).
+# Possible values: default, compat, fast.
+# oplrate: Sample rate of OPL music emulation. Use 49716 for highest quality (set the mixer rate accordingly).
+# Possible values: 44100, 49716, 48000, 32000, 22050, 16000, 11025, 8000.
+
+sbtype=none
+sbbase=220
+irq=7
+dma=1
+hdma=5
+sbmixer=false
+oplmode=none
+oplemu=default
+oplrate=44100
+
+[gus]
+# gus: Enable the Gravis Ultrasound emulation.
+# gusrate: Sample rate of Ultrasound emulation.
+# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.
+# gusbase: The IO base address of the Gravis Ultrasound.
+# Possible values: 240, 220, 260, 280, 2a0, 2c0, 2e0, 300.
+# gusirq: The IRQ number of the Gravis Ultrasound.
+# Possible values: 5, 3, 7, 9, 10, 11, 12.
+# gusdma: The DMA channel of the Gravis Ultrasound.
+# Possible values: 3, 0, 1, 5, 6, 7.
+# ultradir: Path to Ultrasound directory. In this directory
+# there should be a MIDI directory that contains
+# the patch files for GUS playback. Patch sets used
+# with Timidity should work fine.
+
+gus=false
+gusrate=44100
+gusbase=240
+gusirq=5
+gusdma=3
+ultradir=~
+
+[speaker]
+# pcspeaker: Enable PC-Speaker emulation.
+# pcrate: Sample rate of the PC-Speaker sound generation.
+# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.
+# tandy: Enable Tandy Sound System emulation. For 'auto', emulation is present only if machine is set to 'tandy'.
+# Possible values: auto, on, off.
+# tandyrate: Sample rate of the Tandy 3-Voice generation.
+# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.
+# disney: Enable Disney Sound Source emulation. (Covox Voice Master and Speech Thing compatible).
+
+pcspeaker=false
+pcrate=44100
+tandy=auto
+tandyrate=44100
+disney=false
+
+[joystick]
+# joysticktype: Type of joystick to emulate: auto (default), none,
+# 2axis (supports two joysticks),
+# 4axis (supports one joystick, first joystick used),
+# 4axis_2 (supports one joystick, second joystick used),
+# fcs (Thrustmaster), ch (CH Flightstick).
+# none disables joystick emulation.
+# auto chooses emulation depending on real joystick(s).
+# (Remember to reset dosbox's mapperfile if you saved it earlier)
+# Possible values: auto, 2axis, 4axis, 4axis_2, fcs, ch, none.
+# timed: enable timed intervals for axis. Experiment with this option, if your joystick drifts (away).
+# autofire: continuously fires as long as you keep the button pressed.
+# swap34: swap the 3rd and the 4th axis. can be useful for certain joysticks.
+# buttonwrap: enable button wrapping at the number of emulated buttons.
+
+joysticktype=none
+
+[serial]
+# serial1: set type of device connected to com port.
+# Can be disabled, dummy, modem, nullmodem, directserial.
+# Additional parameters must be in the same line in the form of
+# parameter:value. Parameter for all types is irq (optional).
+# for directserial: realport (required), rxdelay (optional).
+# (realport:COM1 realport:ttyS0).
+# for modem: listenport (optional).
+# for nullmodem: server, rxdelay, txdelay, telnet, usedtr,
+# transparent, port, inhsocket (all optional).
+# Example: serial1=modem listenport:5000
+# Possible values: dummy, disabled, modem, nullmodem, directserial.
+# serial2: see serial1
+# Possible values: dummy, disabled, modem, nullmodem, directserial.
+# serial3: see serial1
+# Possible values: dummy, disabled, modem, nullmodem, directserial.
+# serial4: see serial1
+# Possible values: dummy, disabled, modem, nullmodem, directserial.
+
+serial1=dummy
+serial2=dummy
+serial3=disabled
+serial4=disabled
+
+[dos]
+# xms: Enable XMS support.
+# ems: Enable EMS support.
+# umb: Enable UMB support.
+# keyboardlayout: Language code of the keyboard layout (or none).
+
+xms=true
+ems=true
+umb=true
+keyboardlayout=auto
+
+[ipx]
+# ipx: Enable ipx over UDP/IP emulation.
+
+ipx=false
+
+[autoexec]
+# Lines in this section will be run at startup.
+# You can put your MOUNT lines here.
+mount d .
+d:
+cd \
diff --git a/platforms/Dos/sources.mk b/platforms/Dos/sources.mk
new file mode 100644
index 000000000..7515febe6
--- /dev/null
+++ b/platforms/Dos/sources.mk
@@ -0,0 +1,166 @@
+CPPU_OBJECTS := \
+ $(CPPUTEST_HOME)/src/CppUTest/CommandLineArguments.o \
+ $(CPPUTEST_HOME)/src/CppUTest/CommandLineTestRunner.o \
+ $(CPPUTEST_HOME)/src/CppUTest/JUnitTestOutput.o \
+ $(CPPUTEST_HOME)/src/CppUTest/TeamCityTestOutput.o \
+ $(CPPUTEST_HOME)/src/CppUTest/MemoryLeakDetector.o \
+ $(CPPUTEST_HOME)/src/CppUTest/MemoryLeakWarningPlugin.o \
+ $(CPPUTEST_HOME)/src/CppUTest/SimpleMutex.o \
+ $(CPPUTEST_HOME)/src/CppUTest/SimpleString.o \
+ $(CPPUTEST_HOME)/src/CppUTest/SimpleStringInternalCache.o \
+ $(CPPUTEST_HOME)/src/CppUTest/TestFailure.o \
+ $(CPPUTEST_HOME)/src/CppUTest/TestFilter.o \
+ $(CPPUTEST_HOME)/src/CppUTest/TestHarness_c.o \
+ $(CPPUTEST_HOME)/src/CppUTest/TestMemoryAllocator.o \
+ $(CPPUTEST_HOME)/src/CppUTest/TestOutput.o \
+ $(CPPUTEST_HOME)/src/CppUTest/TestPlugin.o \
+ $(CPPUTEST_HOME)/src/CppUTest/TestRegistry.o \
+ $(CPPUTEST_HOME)/src/CppUTest/TestTestingFixture.o \
+ $(CPPUTEST_HOME)/src/CppUTest/TestResult.o \
+ $(CPPUTEST_HOME)/src/CppUTest/Utest.o \
+ $(CPPUTEST_HOME)/src/Platforms/Dos/UtestPlatform.o
+
+CPPUX_OBJECTS := \
+ $(CPPUTEST_HOME)/src/CppUTestExt/CodeMemoryReportFormatter.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/MemoryReporterPlugin.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/IEEE754ExceptionsPlugin.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/MockFailure.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/MockSupportPlugin.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/MockActualCall.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/MockSupport_c.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/MemoryReportAllocator.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/MockExpectedCall.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/MockNamedValue.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/OrderedTest.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/MemoryReportFormatter.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/MockExpectedCallsList.o \
+ $(CPPUTEST_HOME)/src/CppUTestExt/MockSupport.o
+
+CPPU1_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTest/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/AllocLetTestFree.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/AllocLetTestFreeTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/CheatSheetTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/CompatabilityTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/CommandLineArgumentsTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/CommandLineTestRunnerTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/JUnitOutputTest.o
+
+CPPU2_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTest/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/DummyMemoryLeakDetector.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/MemoryLeakWarningTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/PluginTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/PreprocessorTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/SetPluginTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/SimpleMutexTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TeamCityOutputTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TestFailureNaNTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TestFailureTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TestResultTest.o \
+
+CPPU3_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTest/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/MemoryLeakDetectorTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/SimpleStringTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/SimpleStringCacheTest.o
+
+CPPU4_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTest/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TestOutputTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TestRegistryTest.o \
+
+CPPU5_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTest/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/AllocationInCFile.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/AllocationInCppFile.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/MemoryOperatorOverloadTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TeamCityOutputTest.o
+
+CPPU6_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTest/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TestFilterTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TestHarness_cTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TestHarness_cTestCFile.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TestInstallerTest.o
+
+CPPU7_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTest/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TestMemoryAllocatorTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TestUTestMacro.o
+
+CPPU8_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTest/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/UtestPlatformTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/UtestTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTest/TestUTestStringMacro.o \
+
+CPPUX1_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockFailureReporterForTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/ExpectedFunctionsListTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/GMockTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/GTest1Test.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/GTest2ConvertorTest.o
+
+CPPUX2_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockFailureReporterForTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MemoryReportAllocatorTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MemoryReportFormatterTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MemoryReporterPluginTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockActualCallTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockCheatSheetTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockComparatorCopierTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockExpectedCallTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockHierarchyTest.o
+
+CPPUX3_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockFailureReporterForTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/CodeMemoryReporterTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/OrderedTestTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/OrderedTestTest_c.o \
+
+CPPUX4_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockFailureReporterForTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockReturnValueTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockNamedValueTest.o
+
+CPPUX5_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockFailureReporterForTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockPluginTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockSupport_cTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockSupport_cTestCFile.o \
+
+CPPUX6_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockFailureReporterForTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/ExpectedFunctionsListTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockCallTest.o
+
+CPPUX7_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockFailureReporterForTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockComparatorCopierTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockHierarchyTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockParameterTest.o \
+
+CPPUX8_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockFailureReporterForTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/IEEE754PluginTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/IEEE754PluginTest_c.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockComparatorCopierTest.o
+
+CPPUX9_OBJECTS := \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/AllTests.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockFailureReporterForTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockFailureTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockHierarchyTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockPluginTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockReturnValueTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockStrictOrderTest.o \
+ $(CPPUTEST_HOME)/tests/CppUTestExt/MockSupportTest.o \
diff --git a/platforms/Eclipse-Cygwin/.project b/platforms/Eclipse-Cygwin/.project
index 590458436..488e625d5 100644
--- a/platforms/Eclipse-Cygwin/.project
+++ b/platforms/Eclipse-Cygwin/.project
@@ -39,11 +39,6 @@
1
PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/.travis.yml
-
- .travis_github_deployer.yml
- 1
- PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/.travis_github_deployer.yml
-
AUTHORS
1
@@ -229,11 +224,6 @@
1
PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/configure.ac
-
- cpputest-hist.txt
- 1
- PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/cpputest-hist.txt
-
cpputest.pc.in
1
@@ -394,11 +384,6 @@
1
PARENT-2-PROJECT_LOC/cpputest_build/Makefile
-
- docs/WalkThrough_VS21010.docx
- 1
- PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/docs/WalkThrough_VS21010.docx
-
examples/.cdtproject
1
@@ -734,6 +719,11 @@
1
PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/CheatSheetTest.cpp
+
+ tests/CompatabilityTests.cpp
+ 1
+ PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/CompatabilityTests.cpp
+
tests/CommandLineArgumentsTest.cpp
1
@@ -794,6 +784,11 @@
1
PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/SetPluginTest.cpp
+
+ tests/SimpleStringCacheTest.cpp
+ 1
+ PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/SimpleStringCacheTest.cpp
+
tests/SimpleStringTest.cpp
1
@@ -1024,6 +1019,11 @@
1
PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/include/CppUTest/SimpleString.h
+
+ include/CppUTest/SimpleStringInternalCache.h
+ 1
+ PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/include/CppUTest/SimpleStringInternalCache.h
+
include/CppUTest/StandardCLibrary.h
1
@@ -1099,6 +1099,11 @@
1
PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/include/CppUTestExt/GMock.h
+
+ include/CppUTestExt/GTestSupport.h
+ 1
+ PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/include/CppUTestExt/GTestSupport.h
+
include/CppUTestExt/GTest.h
1
@@ -1509,10 +1514,15 @@
1
PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/src/CppUTest/MemoryLeakWarningPlugin.cpp
-
+ src/CppUTest/SimpleString.cpp
1
PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/src/CppUTest/SimpleString.cpp
+
+ src/CppUTest/SimpleStringInternalCache.cpp
+ 1
+ PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/src/CppUTest/SimpleStringInternalCache.cpp
src/CppUTest/TestFailure.cpp
@@ -1569,6 +1579,11 @@
1
PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/src/CppUTestExt/CodeMemoryReportFormatter.cpp
+
+ src/CppUTestExt/GTest.cpp
+ 1
+ PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/src/CppUTestExt/GTest.cpp
+
src/CppUTestExt/MemoryReportAllocator.cpp
1
@@ -1769,6 +1784,16 @@
1
PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/CppUTestExt/OrderedTestTest.cpp
+
+ tests/CppUTestExt/OrderedTestTest_c.c
+ 1
+ PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/CppUTestExt/OrderedTestTest_c.c
+
+
+ tests/CppUTestExt/OrderedTestTest.h
+ 1
+ PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/CppUTestExt/OrderedTestTest.h
+
tests/Debug/AllTests.bsc
1
@@ -1859,6 +1884,16 @@
1
PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/Debug/CodeMemoryReportFormatterTest.sbr
+
+ tests/Debug/CompatabilityTests.obj
+ 1
+ PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/Debug/CompatabilityTests.obj
+
+
+ tests/Debug/CompatabilityTests.sbr
+ 1
+ PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/Debug/CompatabilityTests.sbr
+
tests/Debug/CommandLineArgumentsTest.obj
1
@@ -2069,6 +2104,16 @@
1
PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/Debug/OrderedTestTest.sbr
+
+ tests/Debug/OrderedTestTest_c.obj
+ 1
+ PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/Debug/OrderedTestTest_c.obj
+
+
+ tests/Debug/OrderedTestTest_c.sbr
+ 1
+ PARENT-2-ECLIPSE_HOME/00_Dev/05_CppUTest/cpputest/tests/Debug/OrderedTestTest_c.sbr
+
tests/Debug/PluginTest.obj
1
diff --git a/platforms/Eclipse-Cygwin/README.md b/platforms/Eclipse-Cygwin/README.md
index fc007194c..503b21eb5 100644
--- a/platforms/Eclipse-Cygwin/README.md
+++ b/platforms/Eclipse-Cygwin/README.md
@@ -1,21 +1,21 @@
-##Using the Eclipse-Cygwin Project
+## Using the Eclipse-Cygwin Project
This project is for use on the Windows platform. These are the steps required for using it. (If you only wish to compile the CppUTest libraries, it is recommended that you use the method described at http://cpputest.github.io, rather than setting up Eclipse).
-###Preparation
-####1. Install Cygwin
+### Preparation
+#### 1. Install Cygwin
You need to have Cygwin installed, with at least the Gnu C\C++ compiler, make, autotools and libtool. Please follow the instructions at http://cpputest.github.io to build CppUTest from the Cygwin bash prompt.
-####2. Set your PATH
+#### 2. Set your PATH
Next, you need to add the path to your Cygwin binaries to your Windows system path, e.g.
```dos
C:\\Cygwin\bin
```
-####3. Install Eclipse CDT
+#### 3. Install Eclipse CDT
Use your existing Eclipse CDT (Juno, Kepler, ...) or unpack the release to your system drive. You may use the 32 bit version as it will work on all systems. Unless you have a specific reason, you do not require the 64 bit version. You may need to install or update your Java JRE and add it to your system path. The JRE needs to match, e.g. 32 bit Eclipse requires the 32 bit JRE.
-####4. Install the C/C++Unit plugin
+#### 4. Install the C/C++Unit plugin
Open Eclipse.
Accept the default workspace for now (you may want to set a more appropriate workspace location later on). Then install the "C/C++ Unit Test" plugin:
"Help"->"Install New Software"-> work with "Kepler - http://download.eclipse.org/releases/kepler".
@@ -30,20 +30,20 @@ While you are at it, you might also want to install:
[x] Gcov Integration
```
-####5. Add the CppUTest plugin
+#### 5. Add the CppUTest plugin
Clone the [CppUTest Eclipse Test Runner](https://github.com/tcmak/CppUTestEclipseJunoTestRunner) and add it to Eclipse following the instructions there.
-###Import this project into Eclipse
+### Import this project into Eclipse
In Eclipse you can't simply "open" a project - you have to first import it into the workspace:
* File->Import...->General->Existing Projects into workspace
* [Next >]->Select root directory: `/Platforms/Eclipse-Cygwin`
* Make sure that `[ ] Copy projects into workspace` is **NOT** ticked.
* Click Finish.
-###Compile and run tests
+### Compile and run tests
Before you can compile CppUTest in Eclipse, you must configure it using Automake. Instructions can be found at http://cpputest.github.io/. Once you have done this, select a configuration (Libraries, Check, CppUTestTests or CppUTestExtTests) via Project->BuildConfiguration->Set Active>. The 'Check' configuration will build the libraries along with all tests and run the tests.
-###Working with the C/C++ Unit plugin
+### Working with the C/C++ Unit plugin
Make sure your unit test executable has been built and exists, e.g. cpputest_build/CppUTestTests.exe.
The first time you run tests using the plugin, you need to select them via
@@ -56,10 +56,10 @@ Note that launch configurations have been included with this project; in your ow
This is an example of what a successful test run would look like:

You can select and rerun individual tests in the upper pane, and error messages for failed tests will appear in the lower pane.
-###Troubleshooting
-####Problem: I am getting no test results...
+### Troubleshooting
+#### Problem: I am getting no test results...
...but you know your tests should have run, and you did not receive any error message.
-#####Possible Reason:
+##### Possible Reason:
This can happen if the Cygwin-generated binary can't find the Cygwin DLLs. (If you were to run your test executable at the Windows cmd prompt, you would see a Windows error message box to that effect). Since no error message is displayed in the console via stderr, this leaves the test runner ignorant of what happenend
-#####Solution:
+##### Solution:
You need to add /Cygwin/bin to your system PATH variable. Then you must restart Eclipse.
diff --git a/platforms/IAR-STR912.zip b/platforms/IAR-STR912.zip
deleted file mode 100644
index f5e69943e..000000000
Binary files a/platforms/IAR-STR912.zip and /dev/null differ
diff --git a/platforms/armcc/Makefile b/platforms/armcc/Makefile
index 83e64c57a..0bb7c5db9 100644
--- a/platforms/armcc/Makefile
+++ b/platforms/armcc/Makefile
@@ -29,7 +29,6 @@ COMPONENT_NAME := CppUTest
INCLUDE_DIRS :=\
$(CPPUTEST_HOME)/include \
- $(CPPUTEST_HOME)/include/Platforms/armcc \
# armcc system include path
SYS_INCLUDE_DIRS:=$(KEIL_DIR)/include
diff --git a/platforms/iar/CppUTest.ewd b/platforms/iar/CppUTest.ewd
new file mode 100644
index 000000000..1c6f889c9
--- /dev/null
+++ b/platforms/iar/CppUTest.ewd
@@ -0,0 +1,3269 @@
+
+
+
+ 2
+
+ Debug
+
+ ARM
+
+ 1
+
+ C-SPY
+ 2
+
+ 28
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ARMSIM_ID
+ 2
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ ANGEL_ID
+ 2
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+ CADI_ID
+ 2
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+
+
+ CMSISDAP_ID
+ 2
+
+ 4
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GDBSERVER_ID
+ 2
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+ IARROM_ID
+ 2
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+ IJET_ID
+ 2
+
+ 8
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JLINK_ID
+ 2
+
+ 16
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LMIFTDI_ID
+ 2
+
+ 2
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+ MACRAIGOR_ID
+ 2
+
+ 3
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PEMICRO_ID
+ 2
+
+ 3
+ 1
+ 1
+
+
+
+
+
+
+
+ RDI_ID
+ 2
+
+ 2
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ STLINK_ID
+ 2
+
+ 3
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ THIRDPARTY_ID
+ 2
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+
+ TIFET_ID
+ 2
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ XDS100_ID
+ 2
+
+ 5
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin
+ 1
+
+
+ $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin
+ 0
+
+
+
+
+ Release
+
+ ARM
+
+ 0
+
+ C-SPY
+ 2
+
+ 28
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ARMSIM_ID
+ 2
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+ ANGEL_ID
+ 2
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ CADI_ID
+ 2
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+
+ CMSISDAP_ID
+ 2
+
+ 4
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GDBSERVER_ID
+ 2
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+ IARROM_ID
+ 2
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+ IJET_ID
+ 2
+
+ 8
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JLINK_ID
+ 2
+
+ 16
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LMIFTDI_ID
+ 2
+
+ 2
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+ MACRAIGOR_ID
+ 2
+
+ 3
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PEMICRO_ID
+ 2
+
+ 3
+ 1
+ 0
+
+
+
+
+
+
+
+ RDI_ID
+ 2
+
+ 2
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ STLINK_ID
+ 2
+
+ 3
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ THIRDPARTY_ID
+ 2
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+ TIFET_ID
+ 2
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ XDS100_ID
+ 2
+
+ 5
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin
+ 1
+
+
+ $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin
+ 0
+
+
+
+
+
+
diff --git a/platforms/iar/CppUTest.ewp b/platforms/iar/CppUTest.ewp
new file mode 100644
index 000000000..f2f1fbe16
--- /dev/null
+++ b/platforms/iar/CppUTest.ewp
@@ -0,0 +1,2005 @@
+
+
+
+ 2
+
+ Debug
+
+ ARM
+
+ 1
+
+ General
+ 3
+
+ 24
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ICCARM
+ 2
+
+ 31
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AARM
+ 2
+
+ 9
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OBJCOPY
+ 0
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+ CUSTOM
+ 3
+
+
+
+ 0
+
+
+
+ BICOMP
+ 0
+
+
+
+ BUILDACTION
+ 1
+
+
+
+
+
+
+ ILINK
+ 0
+
+ 18
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IARCHIVE
+ 0
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+ BILINK
+ 0
+
+
+
+
+ Release
+
+ ARM
+
+ 0
+
+ General
+ 3
+
+ 24
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ICCARM
+ 2
+
+ 31
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AARM
+ 2
+
+ 9
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OBJCOPY
+ 0
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+ CUSTOM
+ 3
+
+
+
+ 0
+
+
+
+ BICOMP
+ 0
+
+
+
+ BUILDACTION
+ 1
+
+
+
+
+
+
+ ILINK
+ 0
+
+ 18
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IARCHIVE
+ 0
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+ BILINK
+ 0
+
+
+
+
+ src
+
+ CppUTest
+
+ $PROJ_DIR$\..\..\src\CppUTest\CommandLineArguments.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\CommandLineTestRunner.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\JUnitTestOutput.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\MemoryLeakDetector.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\MemoryLeakWarningPlugin.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\SimpleMutex.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\SimpleString.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\SimpleStringInternalCache.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\TeamCityTestOutput.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\TestFailure.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\TestFilter.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\TestHarness_c.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\TestMemoryAllocator.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\TestOutput.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\TestPlugin.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\TestRegistry.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\TestResult.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\TestTestingFixture.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTest\Utest.cpp
+
+
+
+ Platforms
+
+ Iar
+
+ $PROJ_DIR$\..\..\src\Platforms\Iar\UtestPlatform.cpp
+
+
+
+
+
+
+
diff --git a/platforms/iar/CppUTest.eww b/platforms/iar/CppUTest.eww
new file mode 100644
index 000000000..004925c23
--- /dev/null
+++ b/platforms/iar/CppUTest.eww
@@ -0,0 +1,19 @@
+
+
+
+
+ $WS_DIR$\CppUTest.ewp
+
+
+ $WS_DIR$\CppUTestExt.ewp
+
+
+ $WS_DIR$\CppUTestExtTest.ewp
+
+
+ $WS_DIR$\CppUTestTest.ewp
+
+
+
+
+
diff --git a/platforms/iar/CppUTestExt.ewp b/platforms/iar/CppUTestExt.ewp
new file mode 100644
index 000000000..429c3f5cf
--- /dev/null
+++ b/platforms/iar/CppUTestExt.ewp
@@ -0,0 +1,1993 @@
+
+
+
+ 2
+
+ Debug
+
+ ARM
+
+ 1
+
+ General
+ 3
+
+ 24
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ICCARM
+ 2
+
+ 31
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AARM
+ 2
+
+ 9
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OBJCOPY
+ 0
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+ CUSTOM
+ 3
+
+
+
+ 0
+
+
+
+ BICOMP
+ 0
+
+
+
+ BUILDACTION
+ 1
+
+
+
+
+
+
+ ILINK
+ 0
+
+ 18
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IARCHIVE
+ 0
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+ BILINK
+ 0
+
+
+
+
+ Release
+
+ ARM
+
+ 0
+
+ General
+ 3
+
+ 24
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ICCARM
+ 2
+
+ 31
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AARM
+ 2
+
+ 9
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OBJCOPY
+ 0
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+ CUSTOM
+ 3
+
+
+
+ 0
+
+
+
+ BICOMP
+ 0
+
+
+
+ BUILDACTION
+ 1
+
+
+
+
+
+
+ ILINK
+ 0
+
+ 18
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IARCHIVE
+ 0
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+ BILINK
+ 0
+
+
+
+
+ src
+
+ CppUTestExt
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\CodeMemoryReportFormatter.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\GTest.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\IEEE754ExceptionsPlugin.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\MemoryReportAllocator.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\MemoryReporterPlugin.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\MemoryReportFormatter.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\MockActualCall.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\MockExpectedCall.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\MockExpectedCallsList.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\MockFailure.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\MockNamedValue.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\MockSupport.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\MockSupport_c.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\MockSupportPlugin.cpp
+
+
+ $PROJ_DIR$\..\..\src\CppUTestExt\OrderedTest.cpp
+
+
+
+ Platforms
+
+ Iar
+
+ $PROJ_DIR$\..\..\src\Platforms\Iar\UtestPlatform.cpp
+
+
+
+
+
+
+
diff --git a/platforms/iar/CppUTestExtTest.ewp b/platforms/iar/CppUTestExtTest.ewp
new file mode 100644
index 000000000..6ad4084c7
--- /dev/null
+++ b/platforms/iar/CppUTestExtTest.ewp
@@ -0,0 +1,2048 @@
+
+
+
+ 2
+
+ Debug
+
+ ARM
+
+ 1
+
+ General
+ 3
+
+ 24
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ICCARM
+ 2
+
+ 31
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AARM
+ 2
+
+ 9
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OBJCOPY
+ 0
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+ CUSTOM
+ 3
+
+
+
+ 0
+
+
+
+ BICOMP
+ 0
+
+
+
+ BUILDACTION
+ 1
+
+
+
+
+
+
+ ILINK
+ 0
+
+ 18
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IARCHIVE
+ 0
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+ BILINK
+ 0
+
+
+
+
+ Release
+
+ ARM
+
+ 0
+
+ General
+ 3
+
+ 24
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ICCARM
+ 2
+
+ 31
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AARM
+ 2
+
+ 9
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OBJCOPY
+ 0
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+ CUSTOM
+ 3
+
+
+
+ 0
+
+
+
+ BICOMP
+ 0
+
+
+
+ BUILDACTION
+ 1
+
+
+
+
+
+
+ ILINK
+ 0
+
+ 18
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IARCHIVE
+ 0
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+ BILINK
+ 0
+
+
+
+
+ tests
+
+ failing
+
+
+ passing
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\CodeMemoryReporterTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\ExpectedFunctionsListTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\GMockTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\GTest1Test.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\GTest2ConvertorTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\IEEE754PluginTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\IEEE754PluginTest_c.c
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\IEEE754PluginTest_c.h
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MemoryReportAllocatorTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MemoryReporterPluginTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MemoryReportFormatterTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockActualCallTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockCallTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockCheatSheetTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockComparatorCopierTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockExpectedCallTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockFailureReporterForTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockFailureReporterForTest.h
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockFailureTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockHierarchyTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockNamedValueTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockParameterTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockPluginTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockReturnValueTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockStrictOrderTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockSupport_cTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockSupport_cTestCFile.c
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockSupport_cTestCFile.h
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\MockSupportTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\OrderedTestTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\OrderedTestTest.h
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\OrderedTestTest_c.c
+
+
+
+ warnings
+
+
+ $PROJ_DIR$\..\..\tests\CppUTestExt\AllTests.cpp
+
+
+ $PROJ_DIR$\tests\iar_argc_argv.c
+
+
+
+
+
diff --git a/platforms/iar/CppUTestExtTest.icf b/platforms/iar/CppUTestExtTest.icf
new file mode 100644
index 000000000..23bfb64c3
--- /dev/null
+++ b/platforms/iar/CppUTestExtTest.icf
@@ -0,0 +1,72 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_1.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x00000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_IROM1_start__ = 0x00000080;
+define symbol __ICFEDIT_region_IROM1_end__ = 0x000FFFFF;
+define symbol __ICFEDIT_region_IROM2_start__ = 0x0;
+define symbol __ICFEDIT_region_IROM2_end__ = 0x0;
+define symbol __ICFEDIT_region_EROM1_start__ = 0x0;
+define symbol __ICFEDIT_region_EROM1_end__ = 0x0;
+define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
+define symbol __ICFEDIT_region_EROM2_end__ = 0x0;
+define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
+define symbol __ICFEDIT_region_EROM3_end__ = 0x0;
+define symbol __ICFEDIT_region_IRAM1_start__ = 0x00100000;
+define symbol __ICFEDIT_region_IRAM1_end__ = 0x001FFFFF;
+define symbol __ICFEDIT_region_IRAM2_start__ = 0x0;
+define symbol __ICFEDIT_region_IRAM2_end__ = 0x0;
+define symbol __ICFEDIT_region_ERAM1_start__ = 0x0;
+define symbol __ICFEDIT_region_ERAM1_end__ = 0x0;
+define symbol __ICFEDIT_region_ERAM2_start__ = 0x0;
+define symbol __ICFEDIT_region_ERAM2_end__ = 0x0;
+define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
+define symbol __ICFEDIT_region_ERAM3_end__ = 0x0;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x2000;
+define symbol __ICFEDIT_size_svcstack__ = 0x100;
+define symbol __ICFEDIT_size_irqstack__ = 0x100;
+define symbol __ICFEDIT_size_fiqstack__ = 0x100;
+define symbol __ICFEDIT_size_undstack__ = 0x100;
+define symbol __ICFEDIT_size_abtstack__ = 0x100;
+define symbol __ICFEDIT_size_heap__ = 0x10000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region IROM_region = mem:[from __ICFEDIT_region_IROM1_start__ to __ICFEDIT_region_IROM1_end__]
+ | mem:[from __ICFEDIT_region_IROM2_start__ to __ICFEDIT_region_IROM2_end__];
+define region EROM_region = mem:[from __ICFEDIT_region_EROM1_start__ to __ICFEDIT_region_EROM1_end__]
+ | mem:[from __ICFEDIT_region_EROM2_start__ to __ICFEDIT_region_EROM2_end__]
+ | mem:[from __ICFEDIT_region_EROM3_start__ to __ICFEDIT_region_EROM3_end__];
+define region IRAM_region = mem:[from __ICFEDIT_region_IRAM1_start__ to __ICFEDIT_region_IRAM1_end__]
+ | mem:[from __ICFEDIT_region_IRAM2_start__ to __ICFEDIT_region_IRAM2_end__];
+define region ERAM_region = mem:[from __ICFEDIT_region_ERAM1_start__ to __ICFEDIT_region_ERAM1_end__]
+ | mem:[from __ICFEDIT_region_ERAM2_start__ to __ICFEDIT_region_ERAM2_end__]
+ | mem:[from __ICFEDIT_region_ERAM3_start__ to __ICFEDIT_region_ERAM3_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
+define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
+define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
+define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
+define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+do not initialize { section .noinit };
+initialize by copy { readwrite };
+if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
+{
+ // Required in a multi-threaded application
+ initialize by copy with packing = none { section __DLIB_PERTHREAD };
+}
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in IROM_region { readonly };
+place in EROM_region { readonly section application_specific_ro };
+place in IRAM_region { readwrite,
+ block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
+ block UND_STACK, block ABT_STACK, block HEAP };
+place in ERAM_region { readwrite section application_specific_rw };
\ No newline at end of file
diff --git a/platforms/iar/CppUTestTest.ewd b/platforms/iar/CppUTestTest.ewd
new file mode 100644
index 000000000..1c6f889c9
--- /dev/null
+++ b/platforms/iar/CppUTestTest.ewd
@@ -0,0 +1,3269 @@
+
+
+
+ 2
+
+ Debug
+
+ ARM
+
+ 1
+
+ C-SPY
+ 2
+
+ 28
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ARMSIM_ID
+ 2
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ ANGEL_ID
+ 2
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+ CADI_ID
+ 2
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+
+
+ CMSISDAP_ID
+ 2
+
+ 4
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GDBSERVER_ID
+ 2
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+ IARROM_ID
+ 2
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+ IJET_ID
+ 2
+
+ 8
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JLINK_ID
+ 2
+
+ 16
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LMIFTDI_ID
+ 2
+
+ 2
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+ MACRAIGOR_ID
+ 2
+
+ 3
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PEMICRO_ID
+ 2
+
+ 3
+ 1
+ 1
+
+
+
+
+
+
+
+ RDI_ID
+ 2
+
+ 2
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ STLINK_ID
+ 2
+
+ 3
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ THIRDPARTY_ID
+ 2
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+
+ TIFET_ID
+ 2
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ XDS100_ID
+ 2
+
+ 5
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin
+ 1
+
+
+ $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin
+ 0
+
+
+
+
+ Release
+
+ ARM
+
+ 0
+
+ C-SPY
+ 2
+
+ 28
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ARMSIM_ID
+ 2
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+ ANGEL_ID
+ 2
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ CADI_ID
+ 2
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+
+ CMSISDAP_ID
+ 2
+
+ 4
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GDBSERVER_ID
+ 2
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+ IARROM_ID
+ 2
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+ IJET_ID
+ 2
+
+ 8
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JLINK_ID
+ 2
+
+ 16
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LMIFTDI_ID
+ 2
+
+ 2
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+ MACRAIGOR_ID
+ 2
+
+ 3
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PEMICRO_ID
+ 2
+
+ 3
+ 1
+ 0
+
+
+
+
+
+
+
+ RDI_ID
+ 2
+
+ 2
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ STLINK_ID
+ 2
+
+ 3
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ THIRDPARTY_ID
+ 2
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+ TIFET_ID
+ 2
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ XDS100_ID
+ 2
+
+ 5
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin
+ 1
+
+
+ $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin
+ 0
+
+
+
+
+
+
diff --git a/platforms/iar/CppUTestTest.ewp b/platforms/iar/CppUTestTest.ewp
new file mode 100644
index 000000000..c1283fe9e
--- /dev/null
+++ b/platforms/iar/CppUTestTest.ewp
@@ -0,0 +1,2053 @@
+
+
+
+ 2
+
+ Debug
+
+ ARM
+
+ 1
+
+ General
+ 3
+
+ 24
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ICCARM
+ 2
+
+ 31
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AARM
+ 2
+
+ 9
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OBJCOPY
+ 0
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+ CUSTOM
+ 3
+
+
+
+ 0
+
+
+
+ BICOMP
+ 0
+
+
+
+ BUILDACTION
+ 1
+
+
+
+
+
+
+ ILINK
+ 0
+
+ 18
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IARCHIVE
+ 0
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+ BILINK
+ 0
+
+
+
+
+ Release
+
+ ARM
+
+ 0
+
+ General
+ 3
+
+ 24
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ICCARM
+ 2
+
+ 31
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AARM
+ 2
+
+ 9
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OBJCOPY
+ 0
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+ CUSTOM
+ 3
+
+
+
+ 0
+
+
+
+ BICOMP
+ 0
+
+
+
+ BUILDACTION
+ 1
+
+
+
+
+
+
+ ILINK
+ 0
+
+ 18
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IARCHIVE
+ 0
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+ BILINK
+ 0
+
+
+
+
+ tests
+
+ failing
+
+
+ passing
+
+ $PROJ_DIR$\..\..\tests\CppUTest\AllocationInCFile.c
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\AllocationInCppFile.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\AllocLetTestFree.c
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\AllocLetTestFreeTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\CheatSheetTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\CommandLineArgumentsTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\CommandLineTestRunnerTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\CompatabilityTests.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\DummyMemoryLeakDetector.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\JUnitOutputTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\MemoryLeakDetectorTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\MemoryLeakWarningTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\MemoryOperatorOverloadTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\PluginTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\PreprocessorTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\SetPluginTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\SimpleMutexTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\SimpleStringCacheTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\SimpleStringTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TeamCityOutputTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TestFailureNaNTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TestFailureTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TestFilterTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TestHarness_cTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TestHarness_cTestCFile.c
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TestInstallerTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TestMemoryAllocatorTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TestOutputTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TestRegistryTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TestResultTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TestUTestMacro.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\TestUTestStringMacro.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\UtestPlatformTest.cpp
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\UtestTest.cpp
+
+
+
+ warnings
+
+
+ $PROJ_DIR$\..\..\tests\CppUTest\AllTests.cpp
+
+
+ $PROJ_DIR$\tests\iar_argc_argv.c
+
+
+
+
+
diff --git a/platforms/iar/CppUTestTest.icf b/platforms/iar/CppUTestTest.icf
new file mode 100644
index 000000000..23bfb64c3
--- /dev/null
+++ b/platforms/iar/CppUTestTest.icf
@@ -0,0 +1,72 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_1.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x00000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_IROM1_start__ = 0x00000080;
+define symbol __ICFEDIT_region_IROM1_end__ = 0x000FFFFF;
+define symbol __ICFEDIT_region_IROM2_start__ = 0x0;
+define symbol __ICFEDIT_region_IROM2_end__ = 0x0;
+define symbol __ICFEDIT_region_EROM1_start__ = 0x0;
+define symbol __ICFEDIT_region_EROM1_end__ = 0x0;
+define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
+define symbol __ICFEDIT_region_EROM2_end__ = 0x0;
+define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
+define symbol __ICFEDIT_region_EROM3_end__ = 0x0;
+define symbol __ICFEDIT_region_IRAM1_start__ = 0x00100000;
+define symbol __ICFEDIT_region_IRAM1_end__ = 0x001FFFFF;
+define symbol __ICFEDIT_region_IRAM2_start__ = 0x0;
+define symbol __ICFEDIT_region_IRAM2_end__ = 0x0;
+define symbol __ICFEDIT_region_ERAM1_start__ = 0x0;
+define symbol __ICFEDIT_region_ERAM1_end__ = 0x0;
+define symbol __ICFEDIT_region_ERAM2_start__ = 0x0;
+define symbol __ICFEDIT_region_ERAM2_end__ = 0x0;
+define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
+define symbol __ICFEDIT_region_ERAM3_end__ = 0x0;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x2000;
+define symbol __ICFEDIT_size_svcstack__ = 0x100;
+define symbol __ICFEDIT_size_irqstack__ = 0x100;
+define symbol __ICFEDIT_size_fiqstack__ = 0x100;
+define symbol __ICFEDIT_size_undstack__ = 0x100;
+define symbol __ICFEDIT_size_abtstack__ = 0x100;
+define symbol __ICFEDIT_size_heap__ = 0x10000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region IROM_region = mem:[from __ICFEDIT_region_IROM1_start__ to __ICFEDIT_region_IROM1_end__]
+ | mem:[from __ICFEDIT_region_IROM2_start__ to __ICFEDIT_region_IROM2_end__];
+define region EROM_region = mem:[from __ICFEDIT_region_EROM1_start__ to __ICFEDIT_region_EROM1_end__]
+ | mem:[from __ICFEDIT_region_EROM2_start__ to __ICFEDIT_region_EROM2_end__]
+ | mem:[from __ICFEDIT_region_EROM3_start__ to __ICFEDIT_region_EROM3_end__];
+define region IRAM_region = mem:[from __ICFEDIT_region_IRAM1_start__ to __ICFEDIT_region_IRAM1_end__]
+ | mem:[from __ICFEDIT_region_IRAM2_start__ to __ICFEDIT_region_IRAM2_end__];
+define region ERAM_region = mem:[from __ICFEDIT_region_ERAM1_start__ to __ICFEDIT_region_ERAM1_end__]
+ | mem:[from __ICFEDIT_region_ERAM2_start__ to __ICFEDIT_region_ERAM2_end__]
+ | mem:[from __ICFEDIT_region_ERAM3_start__ to __ICFEDIT_region_ERAM3_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
+define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
+define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
+define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
+define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+do not initialize { section .noinit };
+initialize by copy { readwrite };
+if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
+{
+ // Required in a multi-threaded application
+ initialize by copy with packing = none { section __DLIB_PERTHREAD };
+}
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in IROM_region { readonly };
+place in EROM_region { readonly section application_specific_ro };
+place in IRAM_region { readwrite,
+ block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
+ block UND_STACK, block ABT_STACK, block HEAP };
+place in ERAM_region { readwrite section application_specific_rw };
\ No newline at end of file
diff --git a/platforms/iar/tests/iar_argc_argv.c b/platforms/iar/tests/iar_argc_argv.c
new file mode 100644
index 000000000..e12de9d41
--- /dev/null
+++ b/platforms/iar/tests/iar_argc_argv.c
@@ -0,0 +1,14 @@
+#define NUM_ARGS 2
+
+static char __argvbuf0[] = {"exe"};
+static char __argvbuf1[] = {"-v"};
+
+static int __argc = NUM_ARGS;
+static char * __argv[NUM_ARGS] = { __argvbuf0, __argvbuf1 };
+
+void __iar_argc_argv(void)
+{
+ // setup R0 (argc) and R1 (argv) arguments to main (see cmain.s)
+ asm volatile ("MOVS R1, %0" : : "r" (__argv));
+ asm volatile ("MOVS R0, %0" : : "r" (__argc));
+}
diff --git a/platforms_examples/armcc/AT91SAM7A3/tests/main.cpp b/platforms_examples/armcc/AT91SAM7A3/tests/main.cpp
index 47b2f60bb..8199883d5 100644
--- a/platforms_examples/armcc/AT91SAM7A3/tests/main.cpp
+++ b/platforms_examples/armcc/AT91SAM7A3/tests/main.cpp
@@ -1,27 +1,34 @@
-//- ------------------------------------------------------------------
-//- Copyright (c) James W. Grenning -- All Rights Reserved
-//- For use by owners of Test-Driven Development for Embedded C,
-//- and attendees of Renaissance Software Consulting, Co. training
-//- classes.
-//-
-//- Available at http://pragprog.com/titles/jgade/
-//- ISBN 1-934356-62-X, ISBN13 978-1-934356-62-3
-//-
-//- Authorized users may use this source code in your own
-//- projects, however the source code may not be used to
-//- create training material, courses, books, articles, and
-//- the like. We make no guarantees that this source code is
-//- fit for any purpose.
-//-
-//- www.renaissancesoftware.net james@renaissancesoftware.net
-//- ------------------------------------------------------------------
+/*
+ * Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of the nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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.
+ */
#include "CppUTest/CommandLineTestRunner.h"
int main(int ac, char** av)
{
- int result = RUN_ALL_TESTS(ac, av);
-
- return result;
+ return RUN_ALL_TESTS(ac, av);
}
diff --git a/platforms_examples/armcc/LPC1768/tests/main.cpp b/platforms_examples/armcc/LPC1768/tests/main.cpp
index 2f40fde8b..254b171ae 100644
--- a/platforms_examples/armcc/LPC1768/tests/main.cpp
+++ b/platforms_examples/armcc/LPC1768/tests/main.cpp
@@ -1,27 +1,37 @@
-//- ------------------------------------------------------------------
-//- Copyright (c) James W. Grenning -- All Rights Reserved
-//- For use by owners of Test-Driven Development for Embedded C,
-//- and attendees of Renaissance Software Consulting, Co. training
-//- classes.
-//-
-//- Available at http://pragprog.com/titles/jgade/
-//- ISBN 1-934356-62-X, ISBN13 978-1-934356-62-3
-//-
-//- Authorized users may use this source code in your own
-//- projects, however the source code may not be used to
-//- create training material, courses, books, articles, and
-//- the like. We make no guarantees that this source code is
-//- fit for any purpose.
-//-
-//- www.renaissancesoftware.net james@renaissancesoftware.net
-//- ------------------------------------------------------------------
+/*
+ * Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of the nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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.
+ */
#include "CppUTest/CommandLineTestRunner.h"
#include
+#include
extern "C" void _clock_init(void);
-extern uint32_t SystemCoreClock;
-extern const uint32_t SystemCoreClock12;
+extern std::uint32_t SystemCoreClock;
+extern const std::uint32_t SystemCoreClock12;
int main(int ac, char** av)
{
diff --git a/platforms_examples/armcc/LPC1833/tests/main.cpp b/platforms_examples/armcc/LPC1833/tests/main.cpp
index 90f317a05..f1299259f 100644
--- a/platforms_examples/armcc/LPC1833/tests/main.cpp
+++ b/platforms_examples/armcc/LPC1833/tests/main.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
diff --git a/platforms_examples/armcc/LPC1833/tests/test1.cpp b/platforms_examples/armcc/LPC1833/tests/test1.cpp
new file mode 100644
index 000000000..cbbfad965
--- /dev/null
+++ b/platforms_examples/armcc/LPC1833/tests/test1.cpp
@@ -0,0 +1,10 @@
+#include "CppUTest/TestHarness.h"
+
+TEST_GROUP(start)
+{
+};
+
+TEST(start, first)
+{
+ FAIL("Start here!");
+}
diff --git a/platforms_startup/README b/platforms_startup/README
deleted file mode 100644
index c62c9a8f4..000000000
--- a/platforms_startup/README
+++ /dev/null
@@ -1,4 +0,0 @@
-Directory to place startup files for different toolchains/chips combinations.
-
-Source files from this directory is compiled to library placed in lib
- directory in CppUTest home.
diff --git a/platforms_startup/armcc/AT91SAM7A3/AT91SAM7A3.h b/platforms_startup/armcc/AT91SAM7A3/AT91SAM7A3.h
deleted file mode 100644
index 66c15496f..000000000
--- a/platforms_startup/armcc/AT91SAM7A3/AT91SAM7A3.h
+++ /dev/null
@@ -1,2992 +0,0 @@
-// ----------------------------------------------------------------------------
-// ATMEL Microcontroller Software Support - ROUSSET -
-// ----------------------------------------------------------------------------
-// DISCLAIMER: 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
-// 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.
-// ----------------------------------------------------------------------------
-// File Name : AT91SAM7A3.h
-// Object : AT91SAM7A3 definitions
-// Generated : AT91 SW Application Group 09/13/2005 (09:48:02)
-//
-// CVS Reference : /AT91SAM7A3.pl/1.28/Tue Sep 13 07:43:39 2005//
-// CVS Reference : /SYS_SAM7A3.pl/1.7/Thu Feb 3 17:24:14 2005//
-// CVS Reference : /MC_SAM7A3.pl/1.2/Fri May 20 14:22:29 2005//
-// CVS Reference : /PMC_SAM7A3.pl/1.2/Tue Feb 8 14:00:18 2005//
-// CVS Reference : /RSTC_SAM7A3.pl/1.2/Wed Jul 13 15:25:16 2005//
-// CVS Reference : /SHDWC_SAM7A3.pl/1.1/Thu Feb 3 17:23:24 2005//
-// CVS Reference : /UDP_SAM7A3.pl/1.1/Tue May 10 12:39:23 2005//
-// CVS Reference : /PWM_SAM7A3.pl/1.1/Tue May 10 12:38:54 2005//
-// CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:21:42 2005//
-// CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:29:42 2005//
-// CVS Reference : /RTTC_6081A.pl/1.2/Thu Nov 4 13:57:22 2004//
-// CVS Reference : /PITC_6079A.pl/1.2/Thu Nov 4 13:56:22 2004//
-// CVS Reference : /WDTC_6080A.pl/1.3/Thu Nov 4 13:58:52 2004//
-// CVS Reference : /PDC_6074C.pl/1.2/Thu Feb 3 09:02:11 2005//
-// CVS Reference : /DBGU_6059D.pl/1.1/Mon Jan 31 13:54:41 2005//
-// CVS Reference : /SPI_6088D.pl/1.3/Fri May 20 14:23:02 2005//
-// CVS Reference : /US_6089C.pl/1.1/Mon Jan 31 13:56:02 2005//
-// CVS Reference : /SSC_6078A.pl/1.1/Tue Jul 13 07:10:41 2004//
-// CVS Reference : /TWI_6061A.pl/1.1/Tue Jul 13 06:38:23 2004//
-// CVS Reference : /TC_6082A.pl/1.7/Wed Mar 9 16:31:51 2005//
-// CVS Reference : /CAN_6019B.pl/1.1/Mon Jan 31 13:54:30 2005//
-// CVS Reference : /MCI_6101A.pl/1.1/Tue Jul 13 06:33:59 2004//
-// CVS Reference : /ADC_6051C.pl/1.1/Mon Jan 31 13:12:40 2005//
-// CVS Reference : /AES_6149A.pl/1.10/Mon Feb 7 09:46:08 2005//
-// CVS Reference : /DES3_6150A.pl/1.1/Mon Jan 17 13:30:33 2005//
-// ----------------------------------------------------------------------------
-
-#ifndef AT91SAM7A3_H
-#define AT91SAM7A3_H
-
-typedef volatile unsigned int AT91_REG;// Hardware register definition
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR System Peripherals
-// *****************************************************************************
-typedef struct _AT91S_SYS {
- AT91_REG AIC_SMR[32]; // Source Mode Register
- AT91_REG AIC_SVR[32]; // Source Vector Register
- AT91_REG AIC_IVR; // IRQ Vector Register
- AT91_REG AIC_FVR; // FIQ Vector Register
- AT91_REG AIC_ISR; // Interrupt Status Register
- AT91_REG AIC_IPR; // Interrupt Pending Register
- AT91_REG AIC_IMR; // Interrupt Mask Register
- AT91_REG AIC_CISR; // Core Interrupt Status Register
- AT91_REG Reserved0[2]; //
- AT91_REG AIC_IECR; // Interrupt Enable Command Register
- AT91_REG AIC_IDCR; // Interrupt Disable Command Register
- AT91_REG AIC_ICCR; // Interrupt Clear Command Register
- AT91_REG AIC_ISCR; // Interrupt Set Command Register
- AT91_REG AIC_EOICR; // End of Interrupt Command Register
- AT91_REG AIC_SPU; // Spurious Vector Register
- AT91_REG AIC_DCR; // Debug Control Register (Protect)
- AT91_REG Reserved1[1]; //
- AT91_REG AIC_FFER; // Fast Forcing Enable Register
- AT91_REG AIC_FFDR; // Fast Forcing Disable Register
- AT91_REG AIC_FFSR; // Fast Forcing Status Register
- AT91_REG Reserved2[45]; //
- AT91_REG DBGU_CR; // Control Register
- AT91_REG DBGU_MR; // Mode Register
- AT91_REG DBGU_IER; // Interrupt Enable Register
- AT91_REG DBGU_IDR; // Interrupt Disable Register
- AT91_REG DBGU_IMR; // Interrupt Mask Register
- AT91_REG DBGU_CSR; // Channel Status Register
- AT91_REG DBGU_RHR; // Receiver Holding Register
- AT91_REG DBGU_THR; // Transmitter Holding Register
- AT91_REG DBGU_BRGR; // Baud Rate Generator Register
- AT91_REG Reserved3[7]; //
- AT91_REG DBGU_CIDR; // Chip ID Register
- AT91_REG DBGU_EXID; // Chip ID Extension Register
- AT91_REG DBGU_FNTR; // Force NTRST Register
- AT91_REG Reserved4[45]; //
- AT91_REG DBGU_RPR; // Receive Pointer Register
- AT91_REG DBGU_RCR; // Receive Counter Register
- AT91_REG DBGU_TPR; // Transmit Pointer Register
- AT91_REG DBGU_TCR; // Transmit Counter Register
- AT91_REG DBGU_RNPR; // Receive Next Pointer Register
- AT91_REG DBGU_RNCR; // Receive Next Counter Register
- AT91_REG DBGU_TNPR; // Transmit Next Pointer Register
- AT91_REG DBGU_TNCR; // Transmit Next Counter Register
- AT91_REG DBGU_PTCR; // PDC Transfer Control Register
- AT91_REG DBGU_PTSR; // PDC Transfer Status Register
- AT91_REG Reserved5[54]; //
- AT91_REG PIOA_PER; // PIO Enable Register
- AT91_REG PIOA_PDR; // PIO Disable Register
- AT91_REG PIOA_PSR; // PIO Status Register
- AT91_REG Reserved6[1]; //
- AT91_REG PIOA_OER; // Output Enable Register
- AT91_REG PIOA_ODR; // Output Disable Registerr
- AT91_REG PIOA_OSR; // Output Status Register
- AT91_REG Reserved7[1]; //
- AT91_REG PIOA_IFER; // Input Filter Enable Register
- AT91_REG PIOA_IFDR; // Input Filter Disable Register
- AT91_REG PIOA_IFSR; // Input Filter Status Register
- AT91_REG Reserved8[1]; //
- AT91_REG PIOA_SODR; // Set Output Data Register
- AT91_REG PIOA_CODR; // Clear Output Data Register
- AT91_REG PIOA_ODSR; // Output Data Status Register
- AT91_REG PIOA_PDSR; // Pin Data Status Register
- AT91_REG PIOA_IER; // Interrupt Enable Register
- AT91_REG PIOA_IDR; // Interrupt Disable Register
- AT91_REG PIOA_IMR; // Interrupt Mask Register
- AT91_REG PIOA_ISR; // Interrupt Status Register
- AT91_REG PIOA_MDER; // Multi-driver Enable Register
- AT91_REG PIOA_MDDR; // Multi-driver Disable Register
- AT91_REG PIOA_MDSR; // Multi-driver Status Register
- AT91_REG Reserved9[1]; //
- AT91_REG PIOA_PPUDR; // Pull-up Disable Register
- AT91_REG PIOA_PPUER; // Pull-up Enable Register
- AT91_REG PIOA_PPUSR; // Pull-up Status Register
- AT91_REG Reserved10[1]; //
- AT91_REG PIOA_ASR; // Select A Register
- AT91_REG PIOA_BSR; // Select B Register
- AT91_REG PIOA_ABSR; // AB Select Status Register
- AT91_REG Reserved11[9]; //
- AT91_REG PIOA_OWER; // Output Write Enable Register
- AT91_REG PIOA_OWDR; // Output Write Disable Register
- AT91_REG PIOA_OWSR; // Output Write Status Register
- AT91_REG Reserved12[85]; //
- AT91_REG PIOB_PER; // PIO Enable Register
- AT91_REG PIOB_PDR; // PIO Disable Register
- AT91_REG PIOB_PSR; // PIO Status Register
- AT91_REG Reserved13[1]; //
- AT91_REG PIOB_OER; // Output Enable Register
- AT91_REG PIOB_ODR; // Output Disable Registerr
- AT91_REG PIOB_OSR; // Output Status Register
- AT91_REG Reserved14[1]; //
- AT91_REG PIOB_IFER; // Input Filter Enable Register
- AT91_REG PIOB_IFDR; // Input Filter Disable Register
- AT91_REG PIOB_IFSR; // Input Filter Status Register
- AT91_REG Reserved15[1]; //
- AT91_REG PIOB_SODR; // Set Output Data Register
- AT91_REG PIOB_CODR; // Clear Output Data Register
- AT91_REG PIOB_ODSR; // Output Data Status Register
- AT91_REG PIOB_PDSR; // Pin Data Status Register
- AT91_REG PIOB_IER; // Interrupt Enable Register
- AT91_REG PIOB_IDR; // Interrupt Disable Register
- AT91_REG PIOB_IMR; // Interrupt Mask Register
- AT91_REG PIOB_ISR; // Interrupt Status Register
- AT91_REG PIOB_MDER; // Multi-driver Enable Register
- AT91_REG PIOB_MDDR; // Multi-driver Disable Register
- AT91_REG PIOB_MDSR; // Multi-driver Status Register
- AT91_REG Reserved16[1]; //
- AT91_REG PIOB_PPUDR; // Pull-up Disable Register
- AT91_REG PIOB_PPUER; // Pull-up Enable Register
- AT91_REG PIOB_PPUSR; // Pull-up Status Register
- AT91_REG Reserved17[1]; //
- AT91_REG PIOB_ASR; // Select A Register
- AT91_REG PIOB_BSR; // Select B Register
- AT91_REG PIOB_ABSR; // AB Select Status Register
- AT91_REG Reserved18[9]; //
- AT91_REG PIOB_OWER; // Output Write Enable Register
- AT91_REG PIOB_OWDR; // Output Write Disable Register
- AT91_REG PIOB_OWSR; // Output Write Status Register
- AT91_REG Reserved19[341]; //
- AT91_REG PMC_SCER; // System Clock Enable Register
- AT91_REG PMC_SCDR; // System Clock Disable Register
- AT91_REG PMC_SCSR; // System Clock Status Register
- AT91_REG Reserved20[1]; //
- AT91_REG PMC_PCER; // Peripheral Clock Enable Register
- AT91_REG PMC_PCDR; // Peripheral Clock Disable Register
- AT91_REG PMC_PCSR; // Peripheral Clock Status Register
- AT91_REG Reserved21[1]; //
- AT91_REG PMC_MOR; // Main Oscillator Register
- AT91_REG PMC_MCFR; // Main Clock Frequency Register
- AT91_REG Reserved22[1]; //
- AT91_REG PMC_PLLR; // PLL Register
- AT91_REG PMC_MCKR; // Master Clock Register
- AT91_REG Reserved23[3]; //
- AT91_REG PMC_PCKR[4]; // Programmable Clock Register
- AT91_REG Reserved24[4]; //
- AT91_REG PMC_IER; // Interrupt Enable Register
- AT91_REG PMC_IDR; // Interrupt Disable Register
- AT91_REG PMC_SR; // Status Register
- AT91_REG PMC_IMR; // Interrupt Mask Register
- AT91_REG Reserved25[36]; //
- AT91_REG RSTC_RCR; // Reset Control Register
- AT91_REG RSTC_RSR; // Reset Status Register
- AT91_REG RSTC_RMR; // Reset Mode Register
- AT91_REG Reserved26[1]; //
- AT91_REG SHDWC_SHCR; // Shut Down Control Register
- AT91_REG SHDWC_SHMR; // Shut Down Mode Register
- AT91_REG SHDWC_SHSR; // Shut Down Status Register
- AT91_REG Reserved27[1]; //
- AT91_REG RTTC_RTMR; // Real-time Mode Register
- AT91_REG RTTC_RTAR; // Real-time Alarm Register
- AT91_REG RTTC_RTVR; // Real-time Value Register
- AT91_REG RTTC_RTSR; // Real-time Status Register
- AT91_REG PITC_PIMR; // Period Interval Mode Register
- AT91_REG PITC_PISR; // Period Interval Status Register
- AT91_REG PITC_PIVR; // Period Interval Value Register
- AT91_REG PITC_PIIR; // Period Interval Image Register
- AT91_REG WDTC_WDCR; // Watchdog Control Register
- AT91_REG WDTC_WDMR; // Watchdog Mode Register
- AT91_REG WDTC_WDSR; // Watchdog Status Register
- AT91_REG Reserved28[1]; //
- AT91_REG SYS_GPBR0; // General Purpose Register 0
- AT91_REG SYS_GPBR1; // General Purpose Register 1
- AT91_REG Reserved29[106]; //
- AT91_REG MC_RCR; // MC Remap Control Register
- AT91_REG MC_ASR; // MC Abort Status Register
- AT91_REG MC_AASR; // MC Abort Address Status Register
- AT91_REG Reserved30[1]; //
- AT91_REG MC_PUIA[16]; // MC Protection Unit Area
- AT91_REG MC_PUP; // MC Protection Unit Peripherals
- AT91_REG MC_PUER; // MC Protection Unit Enable Register
- AT91_REG Reserved31[2]; //
- AT91_REG MC_FMR; // MC Flash Mode Register
- AT91_REG MC_FCR; // MC Flash Command Register
- AT91_REG MC_FSR; // MC Flash Status Register
-} AT91S_SYS, *AT91PS_SYS;
-
-// -------- GPBR : (SYS Offset: 0xd50) GPBR General Purpose Register --------
-// -------- GPBR : (SYS Offset: 0xd54) GPBR General Purpose Register --------
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Advanced Interrupt Controller
-// *****************************************************************************
-typedef struct _AT91S_AIC {
- AT91_REG AIC_SMR[32]; // Source Mode Register
- AT91_REG AIC_SVR[32]; // Source Vector Register
- AT91_REG AIC_IVR; // IRQ Vector Register
- AT91_REG AIC_FVR; // FIQ Vector Register
- AT91_REG AIC_ISR; // Interrupt Status Register
- AT91_REG AIC_IPR; // Interrupt Pending Register
- AT91_REG AIC_IMR; // Interrupt Mask Register
- AT91_REG AIC_CISR; // Core Interrupt Status Register
- AT91_REG Reserved0[2]; //
- AT91_REG AIC_IECR; // Interrupt Enable Command Register
- AT91_REG AIC_IDCR; // Interrupt Disable Command Register
- AT91_REG AIC_ICCR; // Interrupt Clear Command Register
- AT91_REG AIC_ISCR; // Interrupt Set Command Register
- AT91_REG AIC_EOICR; // End of Interrupt Command Register
- AT91_REG AIC_SPU; // Spurious Vector Register
- AT91_REG AIC_DCR; // Debug Control Register (Protect)
- AT91_REG Reserved1[1]; //
- AT91_REG AIC_FFER; // Fast Forcing Enable Register
- AT91_REG AIC_FFDR; // Fast Forcing Disable Register
- AT91_REG AIC_FFSR; // Fast Forcing Status Register
-} AT91S_AIC, *AT91PS_AIC;
-
-// -------- AIC_SMR : (AIC Offset: 0x0) Control Register --------
-#define AT91C_AIC_PRIOR ((unsigned int) 0x7 << 0) // (AIC) Priority Level
-#define AT91C_AIC_PRIOR_LOWEST ((unsigned int) 0x0) // (AIC) Lowest priority level
-#define AT91C_AIC_PRIOR_HIGHEST ((unsigned int) 0x7) // (AIC) Highest priority level
-#define AT91C_AIC_SRCTYPE ((unsigned int) 0x3 << 5) // (AIC) Interrupt Source Type
-#define AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL ((unsigned int) 0x0 << 5) // (AIC) External Sources Code Label Low-level Sensitive
-#define AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL ((unsigned int) 0x0 << 5) // (AIC) Internal Sources Code Label High-level Sensitive
-#define AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) Internal Sources Code Label Positive Edge triggered
-#define AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE ((unsigned int) 0x1 << 5) // (AIC) External Sources Code Label Negative Edge triggered
-#define AT91C_AIC_SRCTYPE_HIGH_LEVEL ((unsigned int) 0x2 << 5) // (AIC) Internal Or External Sources Code Label High-level Sensitive
-#define AT91C_AIC_SRCTYPE_POSITIVE_EDGE ((unsigned int) 0x3 << 5) // (AIC) Internal Or External Sources Code Label Positive Edge triggered
-// -------- AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register --------
-#define AT91C_AIC_NFIQ ((unsigned int) 0x1 << 0) // (AIC) NFIQ Status
-#define AT91C_AIC_NIRQ ((unsigned int) 0x1 << 1) // (AIC) NIRQ Status
-// -------- AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) --------
-#define AT91C_AIC_DCR_PROT ((unsigned int) 0x1 << 0) // (AIC) Protection Mode
-#define AT91C_AIC_DCR_GMSK ((unsigned int) 0x1 << 1) // (AIC) General Mask
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Peripheral DMA Controller
-// *****************************************************************************
-typedef struct _AT91S_PDC {
- AT91_REG PDC_RPR; // Receive Pointer Register
- AT91_REG PDC_RCR; // Receive Counter Register
- AT91_REG PDC_TPR; // Transmit Pointer Register
- AT91_REG PDC_TCR; // Transmit Counter Register
- AT91_REG PDC_RNPR; // Receive Next Pointer Register
- AT91_REG PDC_RNCR; // Receive Next Counter Register
- AT91_REG PDC_TNPR; // Transmit Next Pointer Register
- AT91_REG PDC_TNCR; // Transmit Next Counter Register
- AT91_REG PDC_PTCR; // PDC Transfer Control Register
- AT91_REG PDC_PTSR; // PDC Transfer Status Register
-} AT91S_PDC, *AT91PS_PDC;
-
-// -------- PDC_PTCR : (PDC Offset: 0x20) PDC Transfer Control Register --------
-#define AT91C_PDC_RXTEN ((unsigned int) 0x1 << 0) // (PDC) Receiver Transfer Enable
-#define AT91C_PDC_RXTDIS ((unsigned int) 0x1 << 1) // (PDC) Receiver Transfer Disable
-#define AT91C_PDC_TXTEN ((unsigned int) 0x1 << 8) // (PDC) Transmitter Transfer Enable
-#define AT91C_PDC_TXTDIS ((unsigned int) 0x1 << 9) // (PDC) Transmitter Transfer Disable
-// -------- PDC_PTSR : (PDC Offset: 0x24) PDC Transfer Status Register --------
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Debug Unit
-// *****************************************************************************
-typedef struct _AT91S_DBGU {
- AT91_REG DBGU_CR; // Control Register
- AT91_REG DBGU_MR; // Mode Register
- AT91_REG DBGU_IER; // Interrupt Enable Register
- AT91_REG DBGU_IDR; // Interrupt Disable Register
- AT91_REG DBGU_IMR; // Interrupt Mask Register
- AT91_REG DBGU_CSR; // Channel Status Register
- AT91_REG DBGU_RHR; // Receiver Holding Register
- AT91_REG DBGU_THR; // Transmitter Holding Register
- AT91_REG DBGU_BRGR; // Baud Rate Generator Register
- AT91_REG Reserved0[7]; //
- AT91_REG DBGU_CIDR; // Chip ID Register
- AT91_REG DBGU_EXID; // Chip ID Extension Register
- AT91_REG DBGU_FNTR; // Force NTRST Register
- AT91_REG Reserved1[45]; //
- AT91_REG DBGU_RPR; // Receive Pointer Register
- AT91_REG DBGU_RCR; // Receive Counter Register
- AT91_REG DBGU_TPR; // Transmit Pointer Register
- AT91_REG DBGU_TCR; // Transmit Counter Register
- AT91_REG DBGU_RNPR; // Receive Next Pointer Register
- AT91_REG DBGU_RNCR; // Receive Next Counter Register
- AT91_REG DBGU_TNPR; // Transmit Next Pointer Register
- AT91_REG DBGU_TNCR; // Transmit Next Counter Register
- AT91_REG DBGU_PTCR; // PDC Transfer Control Register
- AT91_REG DBGU_PTSR; // PDC Transfer Status Register
-} AT91S_DBGU, *AT91PS_DBGU;
-
-// -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register --------
-#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) // (DBGU) Reset Receiver
-#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) // (DBGU) Reset Transmitter
-#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) // (DBGU) Receiver Enable
-#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) // (DBGU) Receiver Disable
-#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) // (DBGU) Transmitter Enable
-#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) // (DBGU) Transmitter Disable
-#define AT91C_US_RSTSTA ((unsigned int) 0x1 << 8) // (DBGU) Reset Status Bits
-// -------- DBGU_MR : (DBGU Offset: 0x4) Debug Unit Mode Register --------
-#define AT91C_US_PAR ((unsigned int) 0x7 << 9) // (DBGU) Parity type
-#define AT91C_US_PAR_EVEN ((unsigned int) 0x0 << 9) // (DBGU) Even Parity
-#define AT91C_US_PAR_ODD ((unsigned int) 0x1 << 9) // (DBGU) Odd Parity
-#define AT91C_US_PAR_SPACE ((unsigned int) 0x2 << 9) // (DBGU) Parity forced to 0 (Space)
-#define AT91C_US_PAR_MARK ((unsigned int) 0x3 << 9) // (DBGU) Parity forced to 1 (Mark)
-#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) // (DBGU) No Parity
-#define AT91C_US_PAR_MULTI_DROP ((unsigned int) 0x6 << 9) // (DBGU) Multi-drop mode
-#define AT91C_US_CHMODE ((unsigned int) 0x3 << 14) // (DBGU) Channel Mode
-#define AT91C_US_CHMODE_NORMAL ((unsigned int) 0x0 << 14) // (DBGU) Normal Mode: The USART channel operates as an RX/TX USART.
-#define AT91C_US_CHMODE_AUTO ((unsigned int) 0x1 << 14) // (DBGU) Automatic Echo: Receiver Data Input is connected to the TXD pin.
-#define AT91C_US_CHMODE_LOCAL ((unsigned int) 0x2 << 14) // (DBGU) Local Loopback: Transmitter Output Signal is connected to Receiver Input Signal.
-#define AT91C_US_CHMODE_REMOTE ((unsigned int) 0x3 << 14) // (DBGU) Remote Loopback: RXD pin is internally connected to TXD pin.
-// -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register --------
-#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) // (DBGU) RXRDY Interrupt
-#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) // (DBGU) TXRDY Interrupt
-#define AT91C_US_ENDRX ((unsigned int) 0x1 << 3) // (DBGU) End of Receive Transfer Interrupt
-#define AT91C_US_ENDTX ((unsigned int) 0x1 << 4) // (DBGU) End of Transmit Interrupt
-#define AT91C_US_OVRE ((unsigned int) 0x1 << 5) // (DBGU) Overrun Interrupt
-#define AT91C_US_FRAME ((unsigned int) 0x1 << 6) // (DBGU) Framing Error Interrupt
-#define AT91C_US_PARE ((unsigned int) 0x1 << 7) // (DBGU) Parity Error Interrupt
-#define AT91C_US_TXEMPTY ((unsigned int) 0x1 << 9) // (DBGU) TXEMPTY Interrupt
-#define AT91C_US_TXBUFE ((unsigned int) 0x1 << 11) // (DBGU) TXBUFE Interrupt
-#define AT91C_US_RXBUFF ((unsigned int) 0x1 << 12) // (DBGU) RXBUFF Interrupt
-#define AT91C_US_COMM_TX ((unsigned int) 0x1 << 30) // (DBGU) COMM_TX Interrupt
-#define AT91C_US_COMM_RX ((unsigned int) 0x1 << 31) // (DBGU) COMM_RX Interrupt
-// -------- DBGU_IDR : (DBGU Offset: 0xc) Debug Unit Interrupt Disable Register --------
-// -------- DBGU_IMR : (DBGU Offset: 0x10) Debug Unit Interrupt Mask Register --------
-// -------- DBGU_CSR : (DBGU Offset: 0x14) Debug Unit Channel Status Register --------
-// -------- DBGU_FNTR : (DBGU Offset: 0x48) Debug Unit FORCE_NTRST Register --------
-#define AT91C_US_FORCE_NTRST ((unsigned int) 0x1 << 0) // (DBGU) Force NTRST in JTAG
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Parallel Input Output Controler
-// *****************************************************************************
-typedef struct _AT91S_PIO {
- AT91_REG PIO_PER; // PIO Enable Register
- AT91_REG PIO_PDR; // PIO Disable Register
- AT91_REG PIO_PSR; // PIO Status Register
- AT91_REG Reserved0[1]; //
- AT91_REG PIO_OER; // Output Enable Register
- AT91_REG PIO_ODR; // Output Disable Registerr
- AT91_REG PIO_OSR; // Output Status Register
- AT91_REG Reserved1[1]; //
- AT91_REG PIO_IFER; // Input Filter Enable Register
- AT91_REG PIO_IFDR; // Input Filter Disable Register
- AT91_REG PIO_IFSR; // Input Filter Status Register
- AT91_REG Reserved2[1]; //
- AT91_REG PIO_SODR; // Set Output Data Register
- AT91_REG PIO_CODR; // Clear Output Data Register
- AT91_REG PIO_ODSR; // Output Data Status Register
- AT91_REG PIO_PDSR; // Pin Data Status Register
- AT91_REG PIO_IER; // Interrupt Enable Register
- AT91_REG PIO_IDR; // Interrupt Disable Register
- AT91_REG PIO_IMR; // Interrupt Mask Register
- AT91_REG PIO_ISR; // Interrupt Status Register
- AT91_REG PIO_MDER; // Multi-driver Enable Register
- AT91_REG PIO_MDDR; // Multi-driver Disable Register
- AT91_REG PIO_MDSR; // Multi-driver Status Register
- AT91_REG Reserved3[1]; //
- AT91_REG PIO_PPUDR; // Pull-up Disable Register
- AT91_REG PIO_PPUER; // Pull-up Enable Register
- AT91_REG PIO_PPUSR; // Pull-up Status Register
- AT91_REG Reserved4[1]; //
- AT91_REG PIO_ASR; // Select A Register
- AT91_REG PIO_BSR; // Select B Register
- AT91_REG PIO_ABSR; // AB Select Status Register
- AT91_REG Reserved5[9]; //
- AT91_REG PIO_OWER; // Output Write Enable Register
- AT91_REG PIO_OWDR; // Output Write Disable Register
- AT91_REG PIO_OWSR; // Output Write Status Register
-} AT91S_PIO, *AT91PS_PIO;
-
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Clock Generator Controler
-// *****************************************************************************
-typedef struct _AT91S_CKGR {
- AT91_REG CKGR_MOR; // Main Oscillator Register
- AT91_REG CKGR_MCFR; // Main Clock Frequency Register
- AT91_REG Reserved0[1]; //
- AT91_REG CKGR_PLLR; // PLL Register
-} AT91S_CKGR, *AT91PS_CKGR;
-
-// -------- CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register --------
-#define AT91C_CKGR_MOSCEN ((unsigned int) 0x1 << 0) // (CKGR) Main Oscillator Enable
-#define AT91C_CKGR_OSCBYPASS ((unsigned int) 0x1 << 1) // (CKGR) Main Oscillator Bypass
-#define AT91C_CKGR_OSCOUNT ((unsigned int) 0xFF << 8) // (CKGR) Main Oscillator Start-up Time
-// -------- CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register --------
-#define AT91C_CKGR_MAINF ((unsigned int) 0xFFFF << 0) // (CKGR) Main Clock Frequency
-#define AT91C_CKGR_MAINRDY ((unsigned int) 0x1 << 16) // (CKGR) Main Clock Ready
-// -------- CKGR_PLLR : (CKGR Offset: 0xc) PLL B Register --------
-#define AT91C_CKGR_DIV ((unsigned int) 0xFF << 0) // (CKGR) Divider Selected
-#define AT91C_CKGR_DIV_0 ((unsigned int) 0x0) // (CKGR) Divider output is 0
-#define AT91C_CKGR_DIV_BYPASS ((unsigned int) 0x1) // (CKGR) Divider is bypassed
-#define AT91C_CKGR_PLLCOUNT ((unsigned int) 0x3F << 8) // (CKGR) PLL Counter
-#define AT91C_CKGR_OUT ((unsigned int) 0x3 << 14) // (CKGR) PLL Output Frequency Range
-#define AT91C_CKGR_OUT_0 ((unsigned int) 0x0 << 14) // (CKGR) Please refer to the PLL datasheet
-#define AT91C_CKGR_OUT_1 ((unsigned int) 0x1 << 14) // (CKGR) Please refer to the PLL datasheet
-#define AT91C_CKGR_OUT_2 ((unsigned int) 0x2 << 14) // (CKGR) Please refer to the PLL datasheet
-#define AT91C_CKGR_OUT_3 ((unsigned int) 0x3 << 14) // (CKGR) Please refer to the PLL datasheet
-#define AT91C_CKGR_MUL ((unsigned int) 0x7FF << 16) // (CKGR) PLL Multiplier
-#define AT91C_CKGR_USBDIV ((unsigned int) 0x3 << 28) // (CKGR) Divider for USB Clocks
-#define AT91C_CKGR_USBDIV_0 ((unsigned int) 0x0 << 28) // (CKGR) Divider output is PLL clock output
-#define AT91C_CKGR_USBDIV_1 ((unsigned int) 0x1 << 28) // (CKGR) Divider output is PLL clock output divided by 2
-#define AT91C_CKGR_USBDIV_2 ((unsigned int) 0x2 << 28) // (CKGR) Divider output is PLL clock output divided by 4
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Power Management Controler
-// *****************************************************************************
-typedef struct _AT91S_PMC {
- AT91_REG PMC_SCER; // System Clock Enable Register
- AT91_REG PMC_SCDR; // System Clock Disable Register
- AT91_REG PMC_SCSR; // System Clock Status Register
- AT91_REG Reserved0[1]; //
- AT91_REG PMC_PCER; // Peripheral Clock Enable Register
- AT91_REG PMC_PCDR; // Peripheral Clock Disable Register
- AT91_REG PMC_PCSR; // Peripheral Clock Status Register
- AT91_REG Reserved1[1]; //
- AT91_REG PMC_MOR; // Main Oscillator Register
- AT91_REG PMC_MCFR; // Main Clock Frequency Register
- AT91_REG Reserved2[1]; //
- AT91_REG PMC_PLLR; // PLL Register
- AT91_REG PMC_MCKR; // Master Clock Register
- AT91_REG Reserved3[3]; //
- AT91_REG PMC_PCKR[4]; // Programmable Clock Register
- AT91_REG Reserved4[4]; //
- AT91_REG PMC_IER; // Interrupt Enable Register
- AT91_REG PMC_IDR; // Interrupt Disable Register
- AT91_REG PMC_SR; // Status Register
- AT91_REG PMC_IMR; // Interrupt Mask Register
-} AT91S_PMC, *AT91PS_PMC;
-
-// -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register --------
-#define AT91C_PMC_PCK ((unsigned int) 0x1 << 0) // (PMC) Processor Clock
-#define AT91C_PMC_UDP ((unsigned int) 0x1 << 7) // (PMC) USB Device Port Clock
-#define AT91C_PMC_PCK0 ((unsigned int) 0x1 << 8) // (PMC) Programmable Clock Output
-#define AT91C_PMC_PCK1 ((unsigned int) 0x1 << 9) // (PMC) Programmable Clock Output
-#define AT91C_PMC_PCK2 ((unsigned int) 0x1 << 10) // (PMC) Programmable Clock Output
-#define AT91C_PMC_PCK3 ((unsigned int) 0x1 << 11) // (PMC) Programmable Clock Output
-// -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register --------
-// -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register --------
-// -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register --------
-// -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register --------
-// -------- CKGR_PLLR : (PMC Offset: 0x2c) PLL B Register --------
-// -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register --------
-#define AT91C_PMC_CSS ((unsigned int) 0x3 << 0) // (PMC) Programmable Clock Selection
-#define AT91C_PMC_CSS_SLOW_CLK ((unsigned int) 0x0) // (PMC) Slow Clock is selected
-#define AT91C_PMC_CSS_MAIN_CLK ((unsigned int) 0x1) // (PMC) Main Clock is selected
-#define AT91C_PMC_CSS_PLL_CLK ((unsigned int) 0x3) // (PMC) Clock from PLL is selected
-#define AT91C_PMC_PRES ((unsigned int) 0x7 << 2) // (PMC) Programmable Clock Prescaler
-#define AT91C_PMC_PRES_CLK ((unsigned int) 0x0 << 2) // (PMC) Selected clock
-#define AT91C_PMC_PRES_CLK_2 ((unsigned int) 0x1 << 2) // (PMC) Selected clock divided by 2
-#define AT91C_PMC_PRES_CLK_4 ((unsigned int) 0x2 << 2) // (PMC) Selected clock divided by 4
-#define AT91C_PMC_PRES_CLK_8 ((unsigned int) 0x3 << 2) // (PMC) Selected clock divided by 8
-#define AT91C_PMC_PRES_CLK_16 ((unsigned int) 0x4 << 2) // (PMC) Selected clock divided by 16
-#define AT91C_PMC_PRES_CLK_32 ((unsigned int) 0x5 << 2) // (PMC) Selected clock divided by 32
-#define AT91C_PMC_PRES_CLK_64 ((unsigned int) 0x6 << 2) // (PMC) Selected clock divided by 64
-// -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register --------
-// -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register --------
-#define AT91C_PMC_MOSCS ((unsigned int) 0x1 << 0) // (PMC) MOSC Status/Enable/Disable/Mask
-#define AT91C_PMC_LOCK ((unsigned int) 0x1 << 2) // (PMC) PLL Status/Enable/Disable/Mask
-#define AT91C_PMC_MCKRDY ((unsigned int) 0x1 << 3) // (PMC) MCK_RDY Status/Enable/Disable/Mask
-#define AT91C_PMC_PCK0RDY ((unsigned int) 0x1 << 8) // (PMC) PCK0_RDY Status/Enable/Disable/Mask
-#define AT91C_PMC_PCK1RDY ((unsigned int) 0x1 << 9) // (PMC) PCK1_RDY Status/Enable/Disable/Mask
-#define AT91C_PMC_PCK2RDY ((unsigned int) 0x1 << 10) // (PMC) PCK2_RDY Status/Enable/Disable/Mask
-#define AT91C_PMC_PCK3RDY ((unsigned int) 0x1 << 11) // (PMC) PCK3_RDY Status/Enable/Disable/Mask
-// -------- PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register --------
-// -------- PMC_SR : (PMC Offset: 0x68) PMC Status Register --------
-// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register --------
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Reset Controller Interface
-// *****************************************************************************
-typedef struct _AT91S_RSTC {
- AT91_REG RSTC_RCR; // Reset Control Register
- AT91_REG RSTC_RSR; // Reset Status Register
- AT91_REG RSTC_RMR; // Reset Mode Register
-} AT91S_RSTC, *AT91PS_RSTC;
-
-// -------- RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register --------
-#define AT91C_RSTC_PROCRST ((unsigned int) 0x1 << 0) // (RSTC) Processor Reset
-#define AT91C_RSTC_PERRST ((unsigned int) 0x1 << 2) // (RSTC) Peripheral Reset
-#define AT91C_RSTC_EXTRST ((unsigned int) 0x1 << 3) // (RSTC) External Reset
-#define AT91C_RSTC_KEY ((unsigned int) 0xFF << 24) // (RSTC) Password
-// -------- RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register --------
-#define AT91C_RSTC_URSTS ((unsigned int) 0x1 << 0) // (RSTC) User Reset Status
-#define AT91C_RSTC_RSTTYP ((unsigned int) 0x7 << 8) // (RSTC) Reset Type
-#define AT91C_RSTC_RSTTYP_GENERAL ((unsigned int) 0x0 << 8) // (RSTC) General reset. Both VDDCORE and VDDBU rising.
-#define AT91C_RSTC_RSTTYP_WAKEUP ((unsigned int) 0x1 << 8) // (RSTC) WakeUp Reset. VDDCORE rising.
-#define AT91C_RSTC_RSTTYP_WATCHDOG ((unsigned int) 0x2 << 8) // (RSTC) Watchdog Reset. Watchdog overflow occured.
-#define AT91C_RSTC_RSTTYP_SOFTWARE ((unsigned int) 0x3 << 8) // (RSTC) Software Reset. Processor reset required by the software.
-#define AT91C_RSTC_RSTTYP_USER ((unsigned int) 0x4 << 8) // (RSTC) User Reset. NRST pin detected low.
-#define AT91C_RSTC_NRSTL ((unsigned int) 0x1 << 16) // (RSTC) NRST pin level
-#define AT91C_RSTC_SRCMP ((unsigned int) 0x1 << 17) // (RSTC) Software Reset Command in Progress.
-// -------- RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register --------
-#define AT91C_RSTC_URSTEN ((unsigned int) 0x1 << 0) // (RSTC) User Reset Enable
-#define AT91C_RSTC_URSTIEN ((unsigned int) 0x1 << 4) // (RSTC) User Reset Interrupt Enable
-#define AT91C_RSTC_ERSTL ((unsigned int) 0xF << 8) // (RSTC) User Reset Length
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Shut Down Controller Interface
-// *****************************************************************************
-typedef struct _AT91S_SHDWC {
- AT91_REG SHDWC_SHCR; // Shut Down Control Register
- AT91_REG SHDWC_SHMR; // Shut Down Mode Register
- AT91_REG SHDWC_SHSR; // Shut Down Status Register
-} AT91S_SHDWC, *AT91PS_SHDWC;
-
-// -------- SHDWC_SHCR : (SHDWC Offset: 0x0) Shut Down Control Register --------
-#define AT91C_SHDWC_SHDW ((unsigned int) 0x1 << 0) // (SHDWC) Processor Reset
-#define AT91C_SHDWC_KEY ((unsigned int) 0xFF << 24) // (SHDWC) Shut down KEY Password
-// -------- SHDWC_SHMR : (SHDWC Offset: 0x4) Shut Down Mode Register --------
-#define AT91C_SHDWC_WKMODE0 ((unsigned int) 0x3 << 0) // (SHDWC) Wake Up 0 Mode Selection
-#define AT91C_SHDWC_WKMODE0_NONE ((unsigned int) 0x0) // (SHDWC) None. No detection is performed on the wake up input.
-#define AT91C_SHDWC_WKMODE0_HIGH ((unsigned int) 0x1) // (SHDWC) High Level.
-#define AT91C_SHDWC_WKMODE0_LOW ((unsigned int) 0x2) // (SHDWC) Low Level.
-#define AT91C_SHDWC_WKMODE0_ANYLEVEL ((unsigned int) 0x3) // (SHDWC) Any level change.
-#define AT91C_SHDWC_CPTWK0 ((unsigned int) 0xF << 4) // (SHDWC) Counter On Wake Up 0
-#define AT91C_SHDWC_WKMODE1 ((unsigned int) 0x3 << 8) // (SHDWC) Wake Up 1 Mode Selection
-#define AT91C_SHDWC_WKMODE1_NONE ((unsigned int) 0x0 << 8) // (SHDWC) None. No detection is performed on the wake up input.
-#define AT91C_SHDWC_WKMODE1_HIGH ((unsigned int) 0x1 << 8) // (SHDWC) High Level.
-#define AT91C_SHDWC_WKMODE1_LOW ((unsigned int) 0x2 << 8) // (SHDWC) Low Level.
-#define AT91C_SHDWC_WKMODE1_ANYLEVEL ((unsigned int) 0x3 << 8) // (SHDWC) Any level change.
-#define AT91C_SHDWC_CPTWK1 ((unsigned int) 0xF << 12) // (SHDWC) Counter On Wake Up 1
-#define AT91C_SHDWC_RTTWKEN ((unsigned int) 0x1 << 16) // (SHDWC) Real Time Timer Wake Up Enable
-// -------- SHDWC_SHSR : (SHDWC Offset: 0x8) Shut Down Status Register --------
-#define AT91C_SHDWC_WAKEUP0 ((unsigned int) 0x1 << 0) // (SHDWC) Wake Up 0 Status
-#define AT91C_SHDWC_WAKEUP1 ((unsigned int) 0x1 << 1) // (SHDWC) Wake Up 1 Status
-#define AT91C_SHDWC_FWKUP ((unsigned int) 0x1 << 2) // (SHDWC) Force Wake Up Status
-#define AT91C_SHDWC_RTTWK ((unsigned int) 0x1 << 16) // (SHDWC) Real Time Timer wake Up
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Real Time Timer Controller Interface
-// *****************************************************************************
-typedef struct _AT91S_RTTC {
- AT91_REG RTTC_RTMR; // Real-time Mode Register
- AT91_REG RTTC_RTAR; // Real-time Alarm Register
- AT91_REG RTTC_RTVR; // Real-time Value Register
- AT91_REG RTTC_RTSR; // Real-time Status Register
-} AT91S_RTTC, *AT91PS_RTTC;
-
-// -------- RTTC_RTMR : (RTTC Offset: 0x0) Real-time Mode Register --------
-#define AT91C_RTTC_RTPRES ((unsigned int) 0xFFFF << 0) // (RTTC) Real-time Timer Prescaler Value
-#define AT91C_RTTC_ALMIEN ((unsigned int) 0x1 << 16) // (RTTC) Alarm Interrupt Enable
-#define AT91C_RTTC_RTTINCIEN ((unsigned int) 0x1 << 17) // (RTTC) Real Time Timer Increment Interrupt Enable
-#define AT91C_RTTC_RTTRST ((unsigned int) 0x1 << 18) // (RTTC) Real Time Timer Restart
-// -------- RTTC_RTAR : (RTTC Offset: 0x4) Real-time Alarm Register --------
-#define AT91C_RTTC_ALMV ((unsigned int) 0x0 << 0) // (RTTC) Alarm Value
-// -------- RTTC_RTVR : (RTTC Offset: 0x8) Current Real-time Value Register --------
-#define AT91C_RTTC_CRTV ((unsigned int) 0x0 << 0) // (RTTC) Current Real-time Value
-// -------- RTTC_RTSR : (RTTC Offset: 0xc) Real-time Status Register --------
-#define AT91C_RTTC_ALMS ((unsigned int) 0x1 << 0) // (RTTC) Real-time Alarm Status
-#define AT91C_RTTC_RTTINC ((unsigned int) 0x1 << 1) // (RTTC) Real-time Timer Increment
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface
-// *****************************************************************************
-typedef struct _AT91S_PITC {
- AT91_REG PITC_PIMR; // Period Interval Mode Register
- AT91_REG PITC_PISR; // Period Interval Status Register
- AT91_REG PITC_PIVR; // Period Interval Value Register
- AT91_REG PITC_PIIR; // Period Interval Image Register
-} AT91S_PITC, *AT91PS_PITC;
-
-// -------- PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register --------
-#define AT91C_PITC_PIV ((unsigned int) 0xFFFFF << 0) // (PITC) Periodic Interval Value
-#define AT91C_PITC_PITEN ((unsigned int) 0x1 << 24) // (PITC) Periodic Interval Timer Enabled
-#define AT91C_PITC_PITIEN ((unsigned int) 0x1 << 25) // (PITC) Periodic Interval Timer Interrupt Enable
-// -------- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register --------
-#define AT91C_PITC_PITS ((unsigned int) 0x1 << 0) // (PITC) Periodic Interval Timer Status
-// -------- PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register --------
-#define AT91C_PITC_CPIV ((unsigned int) 0xFFFFF << 0) // (PITC) Current Periodic Interval Value
-#define AT91C_PITC_PICNT ((unsigned int) 0xFFF << 20) // (PITC) Periodic Interval Counter
-// -------- PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register --------
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface
-// *****************************************************************************
-typedef struct _AT91S_WDTC {
- AT91_REG WDTC_WDCR; // Watchdog Control Register
- AT91_REG WDTC_WDMR; // Watchdog Mode Register
- AT91_REG WDTC_WDSR; // Watchdog Status Register
-} AT91S_WDTC, *AT91PS_WDTC;
-
-// -------- WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register --------
-#define AT91C_WDTC_WDRSTT ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Restart
-#define AT91C_WDTC_KEY ((unsigned int) 0xFF << 24) // (WDTC) Watchdog KEY Password
-// -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register --------
-#define AT91C_WDTC_WDV ((unsigned int) 0xFFF << 0) // (WDTC) Watchdog Timer Restart
-#define AT91C_WDTC_WDFIEN ((unsigned int) 0x1 << 12) // (WDTC) Watchdog Fault Interrupt Enable
-#define AT91C_WDTC_WDRSTEN ((unsigned int) 0x1 << 13) // (WDTC) Watchdog Reset Enable
-#define AT91C_WDTC_WDRPROC ((unsigned int) 0x1 << 14) // (WDTC) Watchdog Timer Restart
-#define AT91C_WDTC_WDDIS ((unsigned int) 0x1 << 15) // (WDTC) Watchdog Disable
-#define AT91C_WDTC_WDD ((unsigned int) 0xFFF << 16) // (WDTC) Watchdog Delta Value
-#define AT91C_WDTC_WDDBGHLT ((unsigned int) 0x1 << 28) // (WDTC) Watchdog Debug Halt
-#define AT91C_WDTC_WDIDLEHLT ((unsigned int) 0x1 << 29) // (WDTC) Watchdog Idle Halt
-// -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register --------
-#define AT91C_WDTC_WDUNF ((unsigned int) 0x1 << 0) // (WDTC) Watchdog Underflow
-#define AT91C_WDTC_WDERR ((unsigned int) 0x1 << 1) // (WDTC) Watchdog Error
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Memory Controller Interface
-// *****************************************************************************
-typedef struct _AT91S_MC {
- AT91_REG MC_RCR; // MC Remap Control Register
- AT91_REG MC_ASR; // MC Abort Status Register
- AT91_REG MC_AASR; // MC Abort Address Status Register
- AT91_REG Reserved0[1]; //
- AT91_REG MC_PUIA[16]; // MC Protection Unit Area
- AT91_REG MC_PUP; // MC Protection Unit Peripherals
- AT91_REG MC_PUER; // MC Protection Unit Enable Register
- AT91_REG Reserved1[2]; //
- AT91_REG MC_FMR; // MC Flash Mode Register
- AT91_REG MC_FCR; // MC Flash Command Register
- AT91_REG MC_FSR; // MC Flash Status Register
-} AT91S_MC, *AT91PS_MC;
-
-// -------- MC_RCR : (MC Offset: 0x0) MC Remap Control Register --------
-#define AT91C_MC_RCB ((unsigned int) 0x1 << 0) // (MC) Remap Command Bit
-// -------- MC_ASR : (MC Offset: 0x4) MC Abort Status Register --------
-#define AT91C_MC_UNDADD ((unsigned int) 0x1 << 0) // (MC) Undefined Addess Abort Status
-#define AT91C_MC_MISADD ((unsigned int) 0x1 << 1) // (MC) Misaligned Addess Abort Status
-#define AT91C_MC_MPU ((unsigned int) 0x1 << 2) // (MC) Memory protection Unit Abort Status
-#define AT91C_MC_ABTSZ ((unsigned int) 0x3 << 8) // (MC) Abort Size Status
-#define AT91C_MC_ABTSZ_BYTE ((unsigned int) 0x0 << 8) // (MC) Byte
-#define AT91C_MC_ABTSZ_HWORD ((unsigned int) 0x1 << 8) // (MC) Half-word
-#define AT91C_MC_ABTSZ_WORD ((unsigned int) 0x2 << 8) // (MC) Word
-#define AT91C_MC_ABTTYP ((unsigned int) 0x3 << 10) // (MC) Abort Type Status
-#define AT91C_MC_ABTTYP_DATAR ((unsigned int) 0x0 << 10) // (MC) Data Read
-#define AT91C_MC_ABTTYP_DATAW ((unsigned int) 0x1 << 10) // (MC) Data Write
-#define AT91C_MC_ABTTYP_FETCH ((unsigned int) 0x2 << 10) // (MC) Code Fetch
-#define AT91C_MC_MST0 ((unsigned int) 0x1 << 16) // (MC) Master 0 Abort Source
-#define AT91C_MC_MST1 ((unsigned int) 0x1 << 17) // (MC) Master 1 Abort Source
-#define AT91C_MC_SVMST0 ((unsigned int) 0x1 << 24) // (MC) Saved Master 0 Abort Source
-#define AT91C_MC_SVMST1 ((unsigned int) 0x1 << 25) // (MC) Saved Master 1 Abort Source
-// -------- MC_PUIA : (MC Offset: 0x10) MC Protection Unit Area --------
-#define AT91C_MC_PROT ((unsigned int) 0x3 << 0) // (MC) Protection
-#define AT91C_MC_PROT_PNAUNA ((unsigned int) 0x0) // (MC) Privilege: No Access, User: No Access
-#define AT91C_MC_PROT_PRWUNA ((unsigned int) 0x1) // (MC) Privilege: Read/Write, User: No Access
-#define AT91C_MC_PROT_PRWURO ((unsigned int) 0x2) // (MC) Privilege: Read/Write, User: Read Only
-#define AT91C_MC_PROT_PRWURW ((unsigned int) 0x3) // (MC) Privilege: Read/Write, User: Read/Write
-#define AT91C_MC_SIZE ((unsigned int) 0xF << 4) // (MC) Internal Area Size
-#define AT91C_MC_SIZE_1KB ((unsigned int) 0x0 << 4) // (MC) Area size 1KByte
-#define AT91C_MC_SIZE_2KB ((unsigned int) 0x1 << 4) // (MC) Area size 2KByte
-#define AT91C_MC_SIZE_4KB ((unsigned int) 0x2 << 4) // (MC) Area size 4KByte
-#define AT91C_MC_SIZE_8KB ((unsigned int) 0x3 << 4) // (MC) Area size 8KByte
-#define AT91C_MC_SIZE_16KB ((unsigned int) 0x4 << 4) // (MC) Area size 16KByte
-#define AT91C_MC_SIZE_32KB ((unsigned int) 0x5 << 4) // (MC) Area size 32KByte
-#define AT91C_MC_SIZE_64KB ((unsigned int) 0x6 << 4) // (MC) Area size 64KByte
-#define AT91C_MC_SIZE_128KB ((unsigned int) 0x7 << 4) // (MC) Area size 128KByte
-#define AT91C_MC_SIZE_256KB ((unsigned int) 0x8 << 4) // (MC) Area size 256KByte
-#define AT91C_MC_SIZE_512KB ((unsigned int) 0x9 << 4) // (MC) Area size 512KByte
-#define AT91C_MC_SIZE_1MB ((unsigned int) 0xA << 4) // (MC) Area size 1MByte
-#define AT91C_MC_SIZE_2MB ((unsigned int) 0xB << 4) // (MC) Area size 2MByte
-#define AT91C_MC_SIZE_4MB ((unsigned int) 0xC << 4) // (MC) Area size 4MByte
-#define AT91C_MC_SIZE_8MB ((unsigned int) 0xD << 4) // (MC) Area size 8MByte
-#define AT91C_MC_SIZE_16MB ((unsigned int) 0xE << 4) // (MC) Area size 16MByte
-#define AT91C_MC_SIZE_64MB ((unsigned int) 0xF << 4) // (MC) Area size 64MByte
-#define AT91C_MC_BA ((unsigned int) 0x3FFFF << 10) // (MC) Internal Area Base Address
-// -------- MC_PUP : (MC Offset: 0x50) MC Protection Unit Peripheral --------
-// -------- MC_PUER : (MC Offset: 0x54) MC Protection Unit Area --------
-#define AT91C_MC_PUEB ((unsigned int) 0x1 << 0) // (MC) Protection Unit enable Bit
-// -------- MC_FMR : (MC Offset: 0x60) MC Flash Mode Register --------
-#define AT91C_MC_EOP ((unsigned int) 0x1 << 0) // (MC) End Of Programming Flag
-#define AT91C_MC_EOL ((unsigned int) 0x1 << 1) // (MC) End Of Lock/Unlock Flag
-#define AT91C_MC_LOCKE ((unsigned int) 0x1 << 2) // (MC) Lock Error Flag
-#define AT91C_MC_PROGE ((unsigned int) 0x1 << 3) // (MC) Programming Error Flag
-#define AT91C_MC_NEBP ((unsigned int) 0x1 << 7) // (MC) No Erase Before Programming
-#define AT91C_MC_FWS ((unsigned int) 0x3 << 8) // (MC) Flash Wait State
-#define AT91C_MC_FWS_0FWS ((unsigned int) 0x0 << 8) // (MC) 1 cycle for Read, 2 for Write operations
-#define AT91C_MC_FWS_1FWS ((unsigned int) 0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations
-#define AT91C_MC_FWS_2FWS ((unsigned int) 0x2 << 8) // (MC) 3 cycles for Read, 4 for Write operations
-#define AT91C_MC_FWS_3FWS ((unsigned int) 0x3 << 8) // (MC) 4 cycles for Read, 4 for Write operations
-#define AT91C_MC_FMCN ((unsigned int) 0xFF << 16) // (MC) Flash Microsecond Cycle Number
-// -------- MC_FCR : (MC Offset: 0x64) MC Flash Command Register --------
-#define AT91C_MC_FCMD ((unsigned int) 0xF << 0) // (MC) Flash Command
-#define AT91C_MC_FCMD_START_PROG ((unsigned int) 0x1) // (MC) Starts the programming of th epage specified by PAGEN.
-#define AT91C_MC_FCMD_LOCK ((unsigned int) 0x2) // (MC) Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN.
-#define AT91C_MC_FCMD_PROG_AND_LOCK ((unsigned int) 0x3) // (MC) The lock sequence automatically happens after the programming sequence is completed.
-#define AT91C_MC_FCMD_UNLOCK ((unsigned int) 0x4) // (MC) Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN.
-#define AT91C_MC_FCMD_ERASE_ALL ((unsigned int) 0x8) // (MC) Starts the erase of the entire flash.If at least a page is locked, the command is cancelled.
-#define AT91C_MC_PAGEN ((unsigned int) 0x3FF << 8) // (MC) Page Number
-#define AT91C_MC_KEY ((unsigned int) 0xFF << 24) // (MC) Writing Protect Key
-// -------- MC_FSR : (MC Offset: 0x68) MC Flash Command Register --------
-#define AT91C_MC_LOCKS0 ((unsigned int) 0x1 << 16) // (MC) Sector 0 Lock Status
-#define AT91C_MC_LOCKS1 ((unsigned int) 0x1 << 17) // (MC) Sector 1 Lock Status
-#define AT91C_MC_LOCKS2 ((unsigned int) 0x1 << 18) // (MC) Sector 2 Lock Status
-#define AT91C_MC_LOCKS3 ((unsigned int) 0x1 << 19) // (MC) Sector 3 Lock Status
-#define AT91C_MC_LOCKS4 ((unsigned int) 0x1 << 20) // (MC) Sector 4 Lock Status
-#define AT91C_MC_LOCKS5 ((unsigned int) 0x1 << 21) // (MC) Sector 5 Lock Status
-#define AT91C_MC_LOCKS6 ((unsigned int) 0x1 << 22) // (MC) Sector 6 Lock Status
-#define AT91C_MC_LOCKS7 ((unsigned int) 0x1 << 23) // (MC) Sector 7 Lock Status
-#define AT91C_MC_LOCKS8 ((unsigned int) 0x1 << 24) // (MC) Sector 8 Lock Status
-#define AT91C_MC_LOCKS9 ((unsigned int) 0x1 << 25) // (MC) Sector 9 Lock Status
-#define AT91C_MC_LOCKS10 ((unsigned int) 0x1 << 26) // (MC) Sector 10 Lock Status
-#define AT91C_MC_LOCKS11 ((unsigned int) 0x1 << 27) // (MC) Sector 11 Lock Status
-#define AT91C_MC_LOCKS12 ((unsigned int) 0x1 << 28) // (MC) Sector 12 Lock Status
-#define AT91C_MC_LOCKS13 ((unsigned int) 0x1 << 29) // (MC) Sector 13 Lock Status
-#define AT91C_MC_LOCKS14 ((unsigned int) 0x1 << 30) // (MC) Sector 14 Lock Status
-#define AT91C_MC_LOCKS15 ((unsigned int) 0x1 << 31) // (MC) Sector 15 Lock Status
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Control Area Network MailBox Interface
-// *****************************************************************************
-typedef struct _AT91S_CAN_MB {
- AT91_REG CAN_MB_MMR; // MailBox Mode Register
- AT91_REG CAN_MB_MAM; // MailBox Acceptance Mask Register
- AT91_REG CAN_MB_MID; // MailBox ID Register
- AT91_REG CAN_MB_MFID; // MailBox Family ID Register
- AT91_REG CAN_MB_MSR; // MailBox Status Register
- AT91_REG CAN_MB_MDL; // MailBox Data Low Register
- AT91_REG CAN_MB_MDH; // MailBox Data High Register
- AT91_REG CAN_MB_MCR; // MailBox Control Register
-} AT91S_CAN_MB, *AT91PS_CAN_MB;
-
-// -------- CAN_MMR : (CAN_MB Offset: 0x0) CAN Message Mode Register --------
-#define AT91C_CAN_MTIMEMARK ((unsigned int) 0xFFFF << 0) // (CAN_MB) Mailbox Timemark
-#define AT91C_CAN_PRIOR ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Priority
-#define AT91C_CAN_MOT ((unsigned int) 0x7 << 24) // (CAN_MB) Mailbox Object Type
-#define AT91C_CAN_MOT_DIS ((unsigned int) 0x0 << 24) // (CAN_MB)
-#define AT91C_CAN_MOT_RX ((unsigned int) 0x1 << 24) // (CAN_MB)
-#define AT91C_CAN_MOT_RXOVERWRITE ((unsigned int) 0x2 << 24) // (CAN_MB)
-#define AT91C_CAN_MOT_TX ((unsigned int) 0x3 << 24) // (CAN_MB)
-#define AT91C_CAN_MOT_CONSUMER ((unsigned int) 0x4 << 24) // (CAN_MB)
-#define AT91C_CAN_MOT_PRODUCER ((unsigned int) 0x5 << 24) // (CAN_MB)
-// -------- CAN_MAM : (CAN_MB Offset: 0x4) CAN Message Acceptance Mask Register --------
-#define AT91C_CAN_MIDvB ((unsigned int) 0x3FFFF << 0) // (CAN_MB) Complementary bits for identifier in extended mode
-#define AT91C_CAN_MIDvA ((unsigned int) 0x7FF << 18) // (CAN_MB) Identifier for standard frame mode
-#define AT91C_CAN_MIDE ((unsigned int) 0x1 << 29) // (CAN_MB) Identifier Version
-// -------- CAN_MID : (CAN_MB Offset: 0x8) CAN Message ID Register --------
-// -------- CAN_MFID : (CAN_MB Offset: 0xc) CAN Message Family ID Register --------
-// -------- CAN_MSR : (CAN_MB Offset: 0x10) CAN Message Status Register --------
-#define AT91C_CAN_MTIMESTAMP ((unsigned int) 0xFFFF << 0) // (CAN_MB) Timer Value
-#define AT91C_CAN_MDLC ((unsigned int) 0xF << 16) // (CAN_MB) Mailbox Data Length Code
-#define AT91C_CAN_MRTR ((unsigned int) 0x1 << 20) // (CAN_MB) Mailbox Remote Transmission Request
-#define AT91C_CAN_MABT ((unsigned int) 0x1 << 22) // (CAN_MB) Mailbox Message Abort
-#define AT91C_CAN_MRDY ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Ready
-#define AT91C_CAN_MMI ((unsigned int) 0x1 << 24) // (CAN_MB) Mailbox Message Ignored
-// -------- CAN_MDL : (CAN_MB Offset: 0x14) CAN Message Data Low Register --------
-// -------- CAN_MDH : (CAN_MB Offset: 0x18) CAN Message Data High Register --------
-// -------- CAN_MCR : (CAN_MB Offset: 0x1c) CAN Message Control Register --------
-#define AT91C_CAN_MACR ((unsigned int) 0x1 << 22) // (CAN_MB) Abort Request for Mailbox
-#define AT91C_CAN_MTCR ((unsigned int) 0x1 << 23) // (CAN_MB) Mailbox Transfer Command
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Control Area Network Interface
-// *****************************************************************************
-typedef struct _AT91S_CAN {
- AT91_REG CAN_MR; // Mode Register
- AT91_REG CAN_IER; // Interrupt Enable Register
- AT91_REG CAN_IDR; // Interrupt Disable Register
- AT91_REG CAN_IMR; // Interrupt Mask Register
- AT91_REG CAN_SR; // Status Register
- AT91_REG CAN_BR; // Baudrate Register
- AT91_REG CAN_TIM; // Timer Register
- AT91_REG CAN_TIMESTP; // Time Stamp Register
- AT91_REG CAN_ECR; // Error Counter Register
- AT91_REG CAN_TCR; // Transfer Command Register
- AT91_REG CAN_ACR; // Abort Command Register
- AT91_REG Reserved0[52]; //
- AT91_REG CAN_VR; // Version Register
- AT91_REG Reserved1[64]; //
- AT91S_CAN_MB CAN_MB0; // CAN Mailbox 0
- AT91S_CAN_MB CAN_MB1; // CAN Mailbox 1
- AT91S_CAN_MB CAN_MB2; // CAN Mailbox 2
- AT91S_CAN_MB CAN_MB3; // CAN Mailbox 3
- AT91S_CAN_MB CAN_MB4; // CAN Mailbox 4
- AT91S_CAN_MB CAN_MB5; // CAN Mailbox 5
- AT91S_CAN_MB CAN_MB6; // CAN Mailbox 6
- AT91S_CAN_MB CAN_MB7; // CAN Mailbox 7
- AT91S_CAN_MB CAN_MB8; // CAN Mailbox 8
- AT91S_CAN_MB CAN_MB9; // CAN Mailbox 9
- AT91S_CAN_MB CAN_MB10; // CAN Mailbox 10
- AT91S_CAN_MB CAN_MB11; // CAN Mailbox 11
- AT91S_CAN_MB CAN_MB12; // CAN Mailbox 12
- AT91S_CAN_MB CAN_MB13; // CAN Mailbox 13
- AT91S_CAN_MB CAN_MB14; // CAN Mailbox 14
- AT91S_CAN_MB CAN_MB15; // CAN Mailbox 15
-} AT91S_CAN, *AT91PS_CAN;
-
-// -------- CAN_MR : (CAN Offset: 0x0) CAN Mode Register --------
-#define AT91C_CAN_CANEN ((unsigned int) 0x1 << 0) // (CAN) CAN Controller Enable
-#define AT91C_CAN_LPM ((unsigned int) 0x1 << 1) // (CAN) Disable/Enable Low Power Mode
-#define AT91C_CAN_ABM ((unsigned int) 0x1 << 2) // (CAN) Disable/Enable Autobaud/Listen Mode
-#define AT91C_CAN_OVL ((unsigned int) 0x1 << 3) // (CAN) Disable/Enable Overload Frame
-#define AT91C_CAN_TEOF ((unsigned int) 0x1 << 4) // (CAN) Time Stamp messages at each end of Frame
-#define AT91C_CAN_TTM ((unsigned int) 0x1 << 5) // (CAN) Disable/Enable Time Trigger Mode
-#define AT91C_CAN_TIMFRZ ((unsigned int) 0x1 << 6) // (CAN) Enable Timer Freeze
-#define AT91C_CAN_DRPT ((unsigned int) 0x1 << 7) // (CAN) Disable Repeat
-// -------- CAN_IER : (CAN Offset: 0x4) CAN Interrupt Enable Register --------
-#define AT91C_CAN_MB0 ((unsigned int) 0x1 << 0) // (CAN) Mailbox 0 Flag
-#define AT91C_CAN_MB1 ((unsigned int) 0x1 << 1) // (CAN) Mailbox 1 Flag
-#define AT91C_CAN_MB2 ((unsigned int) 0x1 << 2) // (CAN) Mailbox 2 Flag
-#define AT91C_CAN_MB3 ((unsigned int) 0x1 << 3) // (CAN) Mailbox 3 Flag
-#define AT91C_CAN_MB4 ((unsigned int) 0x1 << 4) // (CAN) Mailbox 4 Flag
-#define AT91C_CAN_MB5 ((unsigned int) 0x1 << 5) // (CAN) Mailbox 5 Flag
-#define AT91C_CAN_MB6 ((unsigned int) 0x1 << 6) // (CAN) Mailbox 6 Flag
-#define AT91C_CAN_MB7 ((unsigned int) 0x1 << 7) // (CAN) Mailbox 7 Flag
-#define AT91C_CAN_MB8 ((unsigned int) 0x1 << 8) // (CAN) Mailbox 8 Flag
-#define AT91C_CAN_MB9 ((unsigned int) 0x1 << 9) // (CAN) Mailbox 9 Flag
-#define AT91C_CAN_MB10 ((unsigned int) 0x1 << 10) // (CAN) Mailbox 10 Flag
-#define AT91C_CAN_MB11 ((unsigned int) 0x1 << 11) // (CAN) Mailbox 11 Flag
-#define AT91C_CAN_MB12 ((unsigned int) 0x1 << 12) // (CAN) Mailbox 12 Flag
-#define AT91C_CAN_MB13 ((unsigned int) 0x1 << 13) // (CAN) Mailbox 13 Flag
-#define AT91C_CAN_MB14 ((unsigned int) 0x1 << 14) // (CAN) Mailbox 14 Flag
-#define AT91C_CAN_MB15 ((unsigned int) 0x1 << 15) // (CAN) Mailbox 15 Flag
-#define AT91C_CAN_ERRA ((unsigned int) 0x1 << 16) // (CAN) Error Active Mode Flag
-#define AT91C_CAN_WARN ((unsigned int) 0x1 << 17) // (CAN) Warning Limit Flag
-#define AT91C_CAN_ERRP ((unsigned int) 0x1 << 18) // (CAN) Error Passive Mode Flag
-#define AT91C_CAN_BOFF ((unsigned int) 0x1 << 19) // (CAN) Bus Off Mode Flag
-#define AT91C_CAN_SLEEP ((unsigned int) 0x1 << 20) // (CAN) Sleep Flag
-#define AT91C_CAN_WAKEUP ((unsigned int) 0x1 << 21) // (CAN) Wakeup Flag
-#define AT91C_CAN_TOVF ((unsigned int) 0x1 << 22) // (CAN) Timer Overflow Flag
-#define AT91C_CAN_TSTP ((unsigned int) 0x1 << 23) // (CAN) Timestamp Flag
-#define AT91C_CAN_CERR ((unsigned int) 0x1 << 24) // (CAN) CRC Error
-#define AT91C_CAN_SERR ((unsigned int) 0x1 << 25) // (CAN) Stuffing Error
-#define AT91C_CAN_AERR ((unsigned int) 0x1 << 26) // (CAN) Acknowledgment Error
-#define AT91C_CAN_FERR ((unsigned int) 0x1 << 27) // (CAN) Form Error
-#define AT91C_CAN_BERR ((unsigned int) 0x1 << 28) // (CAN) Bit Error
-// -------- CAN_IDR : (CAN Offset: 0x8) CAN Interrupt Disable Register --------
-// -------- CAN_IMR : (CAN Offset: 0xc) CAN Interrupt Mask Register --------
-// -------- CAN_SR : (CAN Offset: 0x10) CAN Status Register --------
-#define AT91C_CAN_RBSY ((unsigned int) 0x1 << 29) // (CAN) Receiver Busy
-#define AT91C_CAN_TBSY ((unsigned int) 0x1 << 30) // (CAN) Transmitter Busy
-#define AT91C_CAN_OVLY ((unsigned int) 0x1 << 31) // (CAN) Overload Busy
-// -------- CAN_BR : (CAN Offset: 0x14) CAN Baudrate Register --------
-#define AT91C_CAN_PHASE2 ((unsigned int) 0x7 << 0) // (CAN) Phase 2 segment
-#define AT91C_CAN_PHASE1 ((unsigned int) 0x7 << 4) // (CAN) Phase 1 segment
-#define AT91C_CAN_PROPAG ((unsigned int) 0x7 << 8) // (CAN) Programmation time segment
-#define AT91C_CAN_SYNC ((unsigned int) 0x3 << 12) // (CAN) Re-synchronization jump width segment
-#define AT91C_CAN_BRP ((unsigned int) 0x7F << 16) // (CAN) Baudrate Prescaler
-#define AT91C_CAN_SMP ((unsigned int) 0x1 << 24) // (CAN) Sampling mode
-// -------- CAN_TIM : (CAN Offset: 0x18) CAN Timer Register --------
-#define AT91C_CAN_TIMER ((unsigned int) 0xFFFF << 0) // (CAN) Timer field
-// -------- CAN_TIMESTP : (CAN Offset: 0x1c) CAN Timestamp Register --------
-// -------- CAN_ECR : (CAN Offset: 0x20) CAN Error Counter Register --------
-#define AT91C_CAN_REC ((unsigned int) 0xFF << 0) // (CAN) Receive Error Counter
-#define AT91C_CAN_TEC ((unsigned int) 0xFF << 16) // (CAN) Transmit Error Counter
-// -------- CAN_TCR : (CAN Offset: 0x24) CAN Transfer Command Register --------
-#define AT91C_CAN_TIMRST ((unsigned int) 0x1 << 31) // (CAN) Timer Reset Field
-// -------- CAN_ACR : (CAN Offset: 0x28) CAN Abort Command Register --------
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Timer Counter Channel Interface
-// *****************************************************************************
-typedef struct _AT91S_TC {
- AT91_REG TC_CCR; // Channel Control Register
- AT91_REG TC_CMR; // Channel Mode Register (Capture Mode / Waveform Mode)
- AT91_REG Reserved0[2]; //
- AT91_REG TC_CV; // Counter Value
- AT91_REG TC_RA; // Register A
- AT91_REG TC_RB; // Register B
- AT91_REG TC_RC; // Register C
- AT91_REG TC_SR; // Status Register
- AT91_REG TC_IER; // Interrupt Enable Register
- AT91_REG TC_IDR; // Interrupt Disable Register
- AT91_REG TC_IMR; // Interrupt Mask Register
-} AT91S_TC, *AT91PS_TC;
-
-// -------- TC_CCR : (TC Offset: 0x0) TC Channel Control Register --------
-#define AT91C_TC_CLKEN ((unsigned int) 0x1 << 0) // (TC) Counter Clock Enable Command
-#define AT91C_TC_CLKDIS ((unsigned int) 0x1 << 1) // (TC) Counter Clock Disable Command
-#define AT91C_TC_SWTRG ((unsigned int) 0x1 << 2) // (TC) Software Trigger Command
-// -------- TC_CMR : (TC Offset: 0x4) TC Channel Mode Register: Capture Mode / Waveform Mode --------
-#define AT91C_TC_CLKS ((unsigned int) 0x7 << 0) // (TC) Clock Selection
-#define AT91C_TC_CLKS_TIMER_DIV1_CLOCK ((unsigned int) 0x0) // (TC) Clock selected: TIMER_DIV1_CLOCK
-#define AT91C_TC_CLKS_TIMER_DIV2_CLOCK ((unsigned int) 0x1) // (TC) Clock selected: TIMER_DIV2_CLOCK
-#define AT91C_TC_CLKS_TIMER_DIV3_CLOCK ((unsigned int) 0x2) // (TC) Clock selected: TIMER_DIV3_CLOCK
-#define AT91C_TC_CLKS_TIMER_DIV4_CLOCK ((unsigned int) 0x3) // (TC) Clock selected: TIMER_DIV4_CLOCK
-#define AT91C_TC_CLKS_TIMER_DIV5_CLOCK ((unsigned int) 0x4) // (TC) Clock selected: TIMER_DIV5_CLOCK
-#define AT91C_TC_CLKS_XC0 ((unsigned int) 0x5) // (TC) Clock selected: XC0
-#define AT91C_TC_CLKS_XC1 ((unsigned int) 0x6) // (TC) Clock selected: XC1
-#define AT91C_TC_CLKS_XC2 ((unsigned int) 0x7) // (TC) Clock selected: XC2
-#define AT91C_TC_CLKI ((unsigned int) 0x1 << 3) // (TC) Clock Invert
-#define AT91C_TC_BURST ((unsigned int) 0x3 << 4) // (TC) Burst Signal Selection
-#define AT91C_TC_BURST_NONE ((unsigned int) 0x0 << 4) // (TC) The clock is not gated by an external signal
-#define AT91C_TC_BURST_XC0 ((unsigned int) 0x1 << 4) // (TC) XC0 is ANDed with the selected clock
-#define AT91C_TC_BURST_XC1 ((unsigned int) 0x2 << 4) // (TC) XC1 is ANDed with the selected clock
-#define AT91C_TC_BURST_XC2 ((unsigned int) 0x3 << 4) // (TC) XC2 is ANDed with the selected clock
-#define AT91C_TC_CPCSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RC Compare
-#define AT91C_TC_LDBSTOP ((unsigned int) 0x1 << 6) // (TC) Counter Clock Stopped with RB Loading
-#define AT91C_TC_LDBDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disabled with RB Loading
-#define AT91C_TC_CPCDIS ((unsigned int) 0x1 << 7) // (TC) Counter Clock Disable with RC Compare
-#define AT91C_TC_ETRGEDG ((unsigned int) 0x3 << 8) // (TC) External Trigger Edge Selection
-#define AT91C_TC_ETRGEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None
-#define AT91C_TC_ETRGEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge
-#define AT91C_TC_ETRGEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge
-#define AT91C_TC_ETRGEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge
-#define AT91C_TC_EEVTEDG ((unsigned int) 0x3 << 8) // (TC) External Event Edge Selection
-#define AT91C_TC_EEVTEDG_NONE ((unsigned int) 0x0 << 8) // (TC) Edge: None
-#define AT91C_TC_EEVTEDG_RISING ((unsigned int) 0x1 << 8) // (TC) Edge: rising edge
-#define AT91C_TC_EEVTEDG_FALLING ((unsigned int) 0x2 << 8) // (TC) Edge: falling edge
-#define AT91C_TC_EEVTEDG_BOTH ((unsigned int) 0x3 << 8) // (TC) Edge: each edge
-#define AT91C_TC_ABETRG ((unsigned int) 0x1 << 10) // (TC) TIOA or TIOB External Trigger Selection
-#define AT91C_TC_EEVT ((unsigned int) 0x3 << 10) // (TC) External Event Selection
-#define AT91C_TC_EEVT_TIOB ((unsigned int) 0x0 << 10) // (TC) Signal selected as external event: TIOB TIOB direction: input
-#define AT91C_TC_EEVT_XC0 ((unsigned int) 0x1 << 10) // (TC) Signal selected as external event: XC0 TIOB direction: output
-#define AT91C_TC_EEVT_XC1 ((unsigned int) 0x2 << 10) // (TC) Signal selected as external event: XC1 TIOB direction: output
-#define AT91C_TC_EEVT_XC2 ((unsigned int) 0x3 << 10) // (TC) Signal selected as external event: XC2 TIOB direction: output
-#define AT91C_TC_ENETRG ((unsigned int) 0x1 << 12) // (TC) External Event Trigger enable
-#define AT91C_TC_WAVESEL ((unsigned int) 0x3 << 13) // (TC) Waveform Selection
-#define AT91C_TC_WAVESEL_UP ((unsigned int) 0x0 << 13) // (TC) UP mode without atomatic trigger on RC Compare
-#define AT91C_TC_WAVESEL_UPDOWN ((unsigned int) 0x1 << 13) // (TC) UPDOWN mode without automatic trigger on RC Compare
-#define AT91C_TC_WAVESEL_UP_AUTO ((unsigned int) 0x2 << 13) // (TC) UP mode with automatic trigger on RC Compare
-#define AT91C_TC_WAVESEL_UPDOWN_AUTO ((unsigned int) 0x3 << 13) // (TC) UPDOWN mode with automatic trigger on RC Compare
-#define AT91C_TC_CPCTRG ((unsigned int) 0x1 << 14) // (TC) RC Compare Trigger Enable
-#define AT91C_TC_WAVE ((unsigned int) 0x1 << 15) // (TC)
-#define AT91C_TC_LDRA ((unsigned int) 0x3 << 16) // (TC) RA Loading Selection
-#define AT91C_TC_LDRA_NONE ((unsigned int) 0x0 << 16) // (TC) Edge: None
-#define AT91C_TC_LDRA_RISING ((unsigned int) 0x1 << 16) // (TC) Edge: rising edge of TIOA
-#define AT91C_TC_LDRA_FALLING ((unsigned int) 0x2 << 16) // (TC) Edge: falling edge of TIOA
-#define AT91C_TC_LDRA_BOTH ((unsigned int) 0x3 << 16) // (TC) Edge: each edge of TIOA
-#define AT91C_TC_ACPA ((unsigned int) 0x3 << 16) // (TC) RA Compare Effect on TIOA
-#define AT91C_TC_ACPA_NONE ((unsigned int) 0x0 << 16) // (TC) Effect: none
-#define AT91C_TC_ACPA_SET ((unsigned int) 0x1 << 16) // (TC) Effect: set
-#define AT91C_TC_ACPA_CLEAR ((unsigned int) 0x2 << 16) // (TC) Effect: clear
-#define AT91C_TC_ACPA_TOGGLE ((unsigned int) 0x3 << 16) // (TC) Effect: toggle
-#define AT91C_TC_LDRB ((unsigned int) 0x3 << 18) // (TC) RB Loading Selection
-#define AT91C_TC_LDRB_NONE ((unsigned int) 0x0 << 18) // (TC) Edge: None
-#define AT91C_TC_LDRB_RISING ((unsigned int) 0x1 << 18) // (TC) Edge: rising edge of TIOA
-#define AT91C_TC_LDRB_FALLING ((unsigned int) 0x2 << 18) // (TC) Edge: falling edge of TIOA
-#define AT91C_TC_LDRB_BOTH ((unsigned int) 0x3 << 18) // (TC) Edge: each edge of TIOA
-#define AT91C_TC_ACPC ((unsigned int) 0x3 << 18) // (TC) RC Compare Effect on TIOA
-#define AT91C_TC_ACPC_NONE ((unsigned int) 0x0 << 18) // (TC) Effect: none
-#define AT91C_TC_ACPC_SET ((unsigned int) 0x1 << 18) // (TC) Effect: set
-#define AT91C_TC_ACPC_CLEAR ((unsigned int) 0x2 << 18) // (TC) Effect: clear
-#define AT91C_TC_ACPC_TOGGLE ((unsigned int) 0x3 << 18) // (TC) Effect: toggle
-#define AT91C_TC_AEEVT ((unsigned int) 0x3 << 20) // (TC) External Event Effect on TIOA
-#define AT91C_TC_AEEVT_NONE ((unsigned int) 0x0 << 20) // (TC) Effect: none
-#define AT91C_TC_AEEVT_SET ((unsigned int) 0x1 << 20) // (TC) Effect: set
-#define AT91C_TC_AEEVT_CLEAR ((unsigned int) 0x2 << 20) // (TC) Effect: clear
-#define AT91C_TC_AEEVT_TOGGLE ((unsigned int) 0x3 << 20) // (TC) Effect: toggle
-#define AT91C_TC_ASWTRG ((unsigned int) 0x3 << 22) // (TC) Software Trigger Effect on TIOA
-#define AT91C_TC_ASWTRG_NONE ((unsigned int) 0x0 << 22) // (TC) Effect: none
-#define AT91C_TC_ASWTRG_SET ((unsigned int) 0x1 << 22) // (TC) Effect: set
-#define AT91C_TC_ASWTRG_CLEAR ((unsigned int) 0x2 << 22) // (TC) Effect: clear
-#define AT91C_TC_ASWTRG_TOGGLE ((unsigned int) 0x3 << 22) // (TC) Effect: toggle
-#define AT91C_TC_BCPB ((unsigned int) 0x3 << 24) // (TC) RB Compare Effect on TIOB
-#define AT91C_TC_BCPB_NONE ((unsigned int) 0x0 << 24) // (TC) Effect: none
-#define AT91C_TC_BCPB_SET ((unsigned int) 0x1 << 24) // (TC) Effect: set
-#define AT91C_TC_BCPB_CLEAR ((unsigned int) 0x2 << 24) // (TC) Effect: clear
-#define AT91C_TC_BCPB_TOGGLE ((unsigned int) 0x3 << 24) // (TC) Effect: toggle
-#define AT91C_TC_BCPC ((unsigned int) 0x3 << 26) // (TC) RC Compare Effect on TIOB
-#define AT91C_TC_BCPC_NONE ((unsigned int) 0x0 << 26) // (TC) Effect: none
-#define AT91C_TC_BCPC_SET ((unsigned int) 0x1 << 26) // (TC) Effect: set
-#define AT91C_TC_BCPC_CLEAR ((unsigned int) 0x2 << 26) // (TC) Effect: clear
-#define AT91C_TC_BCPC_TOGGLE ((unsigned int) 0x3 << 26) // (TC) Effect: toggle
-#define AT91C_TC_BEEVT ((unsigned int) 0x3 << 28) // (TC) External Event Effect on TIOB
-#define AT91C_TC_BEEVT_NONE ((unsigned int) 0x0 << 28) // (TC) Effect: none
-#define AT91C_TC_BEEVT_SET ((unsigned int) 0x1 << 28) // (TC) Effect: set
-#define AT91C_TC_BEEVT_CLEAR ((unsigned int) 0x2 << 28) // (TC) Effect: clear
-#define AT91C_TC_BEEVT_TOGGLE ((unsigned int) 0x3 << 28) // (TC) Effect: toggle
-#define AT91C_TC_BSWTRG ((unsigned int) 0x3 << 30) // (TC) Software Trigger Effect on TIOB
-#define AT91C_TC_BSWTRG_NONE ((unsigned int) 0x0 << 30) // (TC) Effect: none
-#define AT91C_TC_BSWTRG_SET ((unsigned int) 0x1 << 30) // (TC) Effect: set
-#define AT91C_TC_BSWTRG_CLEAR ((unsigned int) 0x2 << 30) // (TC) Effect: clear
-#define AT91C_TC_BSWTRG_TOGGLE ((unsigned int) 0x3 << 30) // (TC) Effect: toggle
-// -------- TC_SR : (TC Offset: 0x20) TC Channel Status Register --------
-#define AT91C_TC_COVFS ((unsigned int) 0x1 << 0) // (TC) Counter Overflow
-#define AT91C_TC_LOVRS ((unsigned int) 0x1 << 1) // (TC) Load Overrun
-#define AT91C_TC_CPAS ((unsigned int) 0x1 << 2) // (TC) RA Compare
-#define AT91C_TC_CPBS ((unsigned int) 0x1 << 3) // (TC) RB Compare
-#define AT91C_TC_CPCS ((unsigned int) 0x1 << 4) // (TC) RC Compare
-#define AT91C_TC_LDRAS ((unsigned int) 0x1 << 5) // (TC) RA Loading
-#define AT91C_TC_LDRBS ((unsigned int) 0x1 << 6) // (TC) RB Loading
-#define AT91C_TC_ETRGS ((unsigned int) 0x1 << 7) // (TC) External Trigger
-#define AT91C_TC_CLKSTA ((unsigned int) 0x1 << 16) // (TC) Clock Enabling
-#define AT91C_TC_MTIOA ((unsigned int) 0x1 << 17) // (TC) TIOA Mirror
-#define AT91C_TC_MTIOB ((unsigned int) 0x1 << 18) // (TC) TIOA Mirror
-// -------- TC_IER : (TC Offset: 0x24) TC Channel Interrupt Enable Register --------
-// -------- TC_IDR : (TC Offset: 0x28) TC Channel Interrupt Disable Register --------
-// -------- TC_IMR : (TC Offset: 0x2c) TC Channel Interrupt Mask Register --------
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Timer Counter Interface
-// *****************************************************************************
-typedef struct _AT91S_TCB {
- AT91S_TC TCB_TC0; // TC Channel 0
- AT91_REG Reserved0[4]; //
- AT91S_TC TCB_TC1; // TC Channel 1
- AT91_REG Reserved1[4]; //
- AT91S_TC TCB_TC2; // TC Channel 2
- AT91_REG Reserved2[4]; //
- AT91_REG TCB_BCR; // TC Block Control Register
- AT91_REG TCB_BMR; // TC Block Mode Register
-} AT91S_TCB, *AT91PS_TCB;
-
-// -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register --------
-#define AT91C_TCB_SYNC ((unsigned int) 0x1 << 0) // (TCB) Synchro Command
-// -------- TCB_BMR : (TCB Offset: 0xc4) TC Block Mode Register --------
-#define AT91C_TCB_TC0XC0S ((unsigned int) 0x3 << 0) // (TCB) External Clock Signal 0 Selection
-#define AT91C_TCB_TC0XC0S_TCLK0 ((unsigned int) 0x0) // (TCB) TCLK0 connected to XC0
-#define AT91C_TCB_TC0XC0S_NONE ((unsigned int) 0x1) // (TCB) None signal connected to XC0
-#define AT91C_TCB_TC0XC0S_TIOA1 ((unsigned int) 0x2) // (TCB) TIOA1 connected to XC0
-#define AT91C_TCB_TC0XC0S_TIOA2 ((unsigned int) 0x3) // (TCB) TIOA2 connected to XC0
-#define AT91C_TCB_TC1XC1S ((unsigned int) 0x3 << 2) // (TCB) External Clock Signal 1 Selection
-#define AT91C_TCB_TC1XC1S_TCLK1 ((unsigned int) 0x0 << 2) // (TCB) TCLK1 connected to XC1
-#define AT91C_TCB_TC1XC1S_NONE ((unsigned int) 0x1 << 2) // (TCB) None signal connected to XC1
-#define AT91C_TCB_TC1XC1S_TIOA0 ((unsigned int) 0x2 << 2) // (TCB) TIOA0 connected to XC1
-#define AT91C_TCB_TC1XC1S_TIOA2 ((unsigned int) 0x3 << 2) // (TCB) TIOA2 connected to XC1
-#define AT91C_TCB_TC2XC2S ((unsigned int) 0x3 << 4) // (TCB) External Clock Signal 2 Selection
-#define AT91C_TCB_TC2XC2S_TCLK2 ((unsigned int) 0x0 << 4) // (TCB) TCLK2 connected to XC2
-#define AT91C_TCB_TC2XC2S_NONE ((unsigned int) 0x1 << 4) // (TCB) None signal connected to XC2
-#define AT91C_TCB_TC2XC2S_TIOA0 ((unsigned int) 0x2 << 4) // (TCB) TIOA0 connected to XC2
-#define AT91C_TCB_TC2XC2S_TIOA1 ((unsigned int) 0x3 << 4) // (TCB) TIOA2 connected to XC2
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Multimedia Card Interface
-// *****************************************************************************
-typedef struct _AT91S_MCI {
- AT91_REG MCI_CR; // MCI Control Register
- AT91_REG MCI_MR; // MCI Mode Register
- AT91_REG MCI_DTOR; // MCI Data Timeout Register
- AT91_REG MCI_SDCR; // MCI SD Card Register
- AT91_REG MCI_ARGR; // MCI Argument Register
- AT91_REG MCI_CMDR; // MCI Command Register
- AT91_REG Reserved0[2]; //
- AT91_REG MCI_RSPR[4]; // MCI Response Register
- AT91_REG MCI_RDR; // MCI Receive Data Register
- AT91_REG MCI_TDR; // MCI Transmit Data Register
- AT91_REG Reserved1[2]; //
- AT91_REG MCI_SR; // MCI Status Register
- AT91_REG MCI_IER; // MCI Interrupt Enable Register
- AT91_REG MCI_IDR; // MCI Interrupt Disable Register
- AT91_REG MCI_IMR; // MCI Interrupt Mask Register
- AT91_REG Reserved2[44]; //
- AT91_REG MCI_RPR; // Receive Pointer Register
- AT91_REG MCI_RCR; // Receive Counter Register
- AT91_REG MCI_TPR; // Transmit Pointer Register
- AT91_REG MCI_TCR; // Transmit Counter Register
- AT91_REG MCI_RNPR; // Receive Next Pointer Register
- AT91_REG MCI_RNCR; // Receive Next Counter Register
- AT91_REG MCI_TNPR; // Transmit Next Pointer Register
- AT91_REG MCI_TNCR; // Transmit Next Counter Register
- AT91_REG MCI_PTCR; // PDC Transfer Control Register
- AT91_REG MCI_PTSR; // PDC Transfer Status Register
-} AT91S_MCI, *AT91PS_MCI;
-
-// -------- MCI_CR : (MCI Offset: 0x0) MCI Control Register --------
-#define AT91C_MCI_MCIEN ((unsigned int) 0x1 << 0) // (MCI) Multimedia Interface Enable
-#define AT91C_MCI_MCIDIS ((unsigned int) 0x1 << 1) // (MCI) Multimedia Interface Disable
-#define AT91C_MCI_PWSEN ((unsigned int) 0x1 << 2) // (MCI) Power Save Mode Enable
-#define AT91C_MCI_PWSDIS ((unsigned int) 0x1 << 3) // (MCI) Power Save Mode Disable
-#define AT91C_MCI_SWRST ((unsigned int) 0x1 << 7) // (MCI) MCI Software reset
-// -------- MCI_MR : (MCI Offset: 0x4) MCI Mode Register --------
-#define AT91C_MCI_CLKDIV ((unsigned int) 0xFF << 0) // (MCI) Clock Divider
-#define AT91C_MCI_PWSDIV ((unsigned int) 0x7 << 8) // (MCI) Power Saving Divider
-#define AT91C_MCI_PDCPADV ((unsigned int) 0x1 << 14) // (MCI) PDC Padding Value
-#define AT91C_MCI_PDCMODE ((unsigned int) 0x1 << 15) // (MCI) PDC Oriented Mode
-#define AT91C_MCI_BLKLEN ((unsigned int) 0xFFF << 18) // (MCI) Data Block Length
-// -------- MCI_DTOR : (MCI Offset: 0x8) MCI Data Timeout Register --------
-#define AT91C_MCI_DTOCYC ((unsigned int) 0xF << 0) // (MCI) Data Timeout Cycle Number
-#define AT91C_MCI_DTOMUL ((unsigned int) 0x7 << 4) // (MCI) Data Timeout Multiplier
-#define AT91C_MCI_DTOMUL_1 ((unsigned int) 0x0 << 4) // (MCI) DTOCYC x 1
-#define AT91C_MCI_DTOMUL_16 ((unsigned int) 0x1 << 4) // (MCI) DTOCYC x 16
-#define AT91C_MCI_DTOMUL_128 ((unsigned int) 0x2 << 4) // (MCI) DTOCYC x 128
-#define AT91C_MCI_DTOMUL_256 ((unsigned int) 0x3 << 4) // (MCI) DTOCYC x 256
-#define AT91C_MCI_DTOMUL_1024 ((unsigned int) 0x4 << 4) // (MCI) DTOCYC x 1024
-#define AT91C_MCI_DTOMUL_4096 ((unsigned int) 0x5 << 4) // (MCI) DTOCYC x 4096
-#define AT91C_MCI_DTOMUL_65536 ((unsigned int) 0x6 << 4) // (MCI) DTOCYC x 65536
-#define AT91C_MCI_DTOMUL_1048576 ((unsigned int) 0x7 << 4) // (MCI) DTOCYC x 1048576
-// -------- MCI_SDCR : (MCI Offset: 0xc) MCI SD Card Register --------
-#define AT91C_MCI_SCDSEL ((unsigned int) 0xF << 0) // (MCI) SD Card Selector
-#define AT91C_MCI_SCDBUS ((unsigned int) 0x1 << 7) // (MCI) SD Card Bus Width
-// -------- MCI_CMDR : (MCI Offset: 0x14) MCI Command Register --------
-#define AT91C_MCI_CMDNB ((unsigned int) 0x3F << 0) // (MCI) Command Number
-#define AT91C_MCI_RSPTYP ((unsigned int) 0x3 << 6) // (MCI) Response Type
-#define AT91C_MCI_RSPTYP_NO ((unsigned int) 0x0 << 6) // (MCI) No response
-#define AT91C_MCI_RSPTYP_48 ((unsigned int) 0x1 << 6) // (MCI) 48-bit response
-#define AT91C_MCI_RSPTYP_136 ((unsigned int) 0x2 << 6) // (MCI) 136-bit response
-#define AT91C_MCI_SPCMD ((unsigned int) 0x7 << 8) // (MCI) Special CMD
-#define AT91C_MCI_SPCMD_NONE ((unsigned int) 0x0 << 8) // (MCI) Not a special CMD
-#define AT91C_MCI_SPCMD_INIT ((unsigned int) 0x1 << 8) // (MCI) Initialization CMD
-#define AT91C_MCI_SPCMD_SYNC ((unsigned int) 0x2 << 8) // (MCI) Synchronized CMD
-#define AT91C_MCI_SPCMD_IT_CMD ((unsigned int) 0x4 << 8) // (MCI) Interrupt command
-#define AT91C_MCI_SPCMD_IT_REP ((unsigned int) 0x5 << 8) // (MCI) Interrupt response
-#define AT91C_MCI_OPDCMD ((unsigned int) 0x1 << 11) // (MCI) Open Drain Command
-#define AT91C_MCI_MAXLAT ((unsigned int) 0x1 << 12) // (MCI) Maximum Latency for Command to respond
-#define AT91C_MCI_TRCMD ((unsigned int) 0x3 << 16) // (MCI) Transfer CMD
-#define AT91C_MCI_TRCMD_NO ((unsigned int) 0x0 << 16) // (MCI) No transfer
-#define AT91C_MCI_TRCMD_START ((unsigned int) 0x1 << 16) // (MCI) Start transfer
-#define AT91C_MCI_TRCMD_STOP ((unsigned int) 0x2 << 16) // (MCI) Stop transfer
-#define AT91C_MCI_TRDIR ((unsigned int) 0x1 << 18) // (MCI) Transfer Direction
-#define AT91C_MCI_TRTYP ((unsigned int) 0x3 << 19) // (MCI) Transfer Type
-#define AT91C_MCI_TRTYP_BLOCK ((unsigned int) 0x0 << 19) // (MCI) Block Transfer type
-#define AT91C_MCI_TRTYP_MULTIPLE ((unsigned int) 0x1 << 19) // (MCI) Multiple Block transfer type
-#define AT91C_MCI_TRTYP_STREAM ((unsigned int) 0x2 << 19) // (MCI) Stream transfer type
-// -------- MCI_SR : (MCI Offset: 0x40) MCI Status Register --------
-#define AT91C_MCI_CMDRDY ((unsigned int) 0x1 << 0) // (MCI) Command Ready flag
-#define AT91C_MCI_RXRDY ((unsigned int) 0x1 << 1) // (MCI) RX Ready flag
-#define AT91C_MCI_TXRDY ((unsigned int) 0x1 << 2) // (MCI) TX Ready flag
-#define AT91C_MCI_BLKE ((unsigned int) 0x1 << 3) // (MCI) Data Block Transfer Ended flag
-#define AT91C_MCI_DTIP ((unsigned int) 0x1 << 4) // (MCI) Data Transfer in Progress flag
-#define AT91C_MCI_NOTBUSY ((unsigned int) 0x1 << 5) // (MCI) Data Line Not Busy flag
-#define AT91C_MCI_ENDRX ((unsigned int) 0x1 << 6) // (MCI) End of RX Buffer flag
-#define AT91C_MCI_ENDTX ((unsigned int) 0x1 << 7) // (MCI) End of TX Buffer flag
-#define AT91C_MCI_RXBUFF ((unsigned int) 0x1 << 14) // (MCI) RX Buffer Full flag
-#define AT91C_MCI_TXBUFE ((unsigned int) 0x1 << 15) // (MCI) TX Buffer Empty flag
-#define AT91C_MCI_RINDE ((unsigned int) 0x1 << 16) // (MCI) Response Index Error flag
-#define AT91C_MCI_RDIRE ((unsigned int) 0x1 << 17) // (MCI) Response Direction Error flag
-#define AT91C_MCI_RCRCE ((unsigned int) 0x1 << 18) // (MCI) Response CRC Error flag
-#define AT91C_MCI_RENDE ((unsigned int) 0x1 << 19) // (MCI) Response End Bit Error flag
-#define AT91C_MCI_RTOE ((unsigned int) 0x1 << 20) // (MCI) Response Time-out Error flag
-#define AT91C_MCI_DCRCE ((unsigned int) 0x1 << 21) // (MCI) data CRC Error flag
-#define AT91C_MCI_DTOE ((unsigned int) 0x1 << 22) // (MCI) Data timeout Error flag
-#define AT91C_MCI_OVRE ((unsigned int) 0x1 << 30) // (MCI) Overrun flag
-#define AT91C_MCI_UNRE ((unsigned int) 0x1 << 31) // (MCI) Underrun flag
-// -------- MCI_IER : (MCI Offset: 0x44) MCI Interrupt Enable Register --------
-// -------- MCI_IDR : (MCI Offset: 0x48) MCI Interrupt Disable Register --------
-// -------- MCI_IMR : (MCI Offset: 0x4c) MCI Interrupt Mask Register --------
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR USB Device Interface
-// *****************************************************************************
-typedef struct _AT91S_UDP {
- AT91_REG UDP_NUM; // Frame Number Register
- AT91_REG UDP_GLBSTATE; // Global State Register
- AT91_REG UDP_FADDR; // Function Address Register
- AT91_REG Reserved0[1]; //
- AT91_REG UDP_IER; // Interrupt Enable Register
- AT91_REG UDP_IDR; // Interrupt Disable Register
- AT91_REG UDP_IMR; // Interrupt Mask Register
- AT91_REG UDP_ISR; // Interrupt Status Register
- AT91_REG UDP_ICR; // Interrupt Clear Register
- AT91_REG Reserved1[1]; //
- AT91_REG UDP_RSTEP; // Reset Endpoint Register
- AT91_REG Reserved2[1]; //
- AT91_REG UDP_CSR[6]; // Endpoint Control and Status Register
- AT91_REG Reserved3[2]; //
- AT91_REG UDP_FDR[6]; // Endpoint FIFO Data Register
- AT91_REG Reserved4[3]; //
- AT91_REG UDP_TXVC; // Transceiver Control Register
-} AT91S_UDP, *AT91PS_UDP;
-
-// -------- UDP_FRM_NUM : (UDP Offset: 0x0) USB Frame Number Register --------
-#define AT91C_UDP_FRM_NUM ((unsigned int) 0x7FF << 0) // (UDP) Frame Number as Defined in the Packet Field Formats
-#define AT91C_UDP_FRM_ERR ((unsigned int) 0x1 << 16) // (UDP) Frame Error
-#define AT91C_UDP_FRM_OK ((unsigned int) 0x1 << 17) // (UDP) Frame OK
-// -------- UDP_GLB_STATE : (UDP Offset: 0x4) USB Global State Register --------
-#define AT91C_UDP_FADDEN ((unsigned int) 0x1 << 0) // (UDP) Function Address Enable
-#define AT91C_UDP_CONFG ((unsigned int) 0x1 << 1) // (UDP) Configured
-#define AT91C_UDP_ESR ((unsigned int) 0x1 << 2) // (UDP) Enable Send Resume
-#define AT91C_UDP_RSMINPR ((unsigned int) 0x1 << 3) // (UDP) A Resume Has Been Sent to the Host
-#define AT91C_UDP_RMWUPE ((unsigned int) 0x1 << 4) // (UDP) Remote Wake Up Enable
-// -------- UDP_FADDR : (UDP Offset: 0x8) USB Function Address Register --------
-#define AT91C_UDP_FADD ((unsigned int) 0xFF << 0) // (UDP) Function Address Value
-#define AT91C_UDP_FEN ((unsigned int) 0x1 << 8) // (UDP) Function Enable
-// -------- UDP_IER : (UDP Offset: 0x10) USB Interrupt Enable Register --------
-#define AT91C_UDP_EPINT0 ((unsigned int) 0x1 << 0) // (UDP) Endpoint 0 Interrupt
-#define AT91C_UDP_EPINT1 ((unsigned int) 0x1 << 1) // (UDP) Endpoint 0 Interrupt
-#define AT91C_UDP_EPINT2 ((unsigned int) 0x1 << 2) // (UDP) Endpoint 2 Interrupt
-#define AT91C_UDP_EPINT3 ((unsigned int) 0x1 << 3) // (UDP) Endpoint 3 Interrupt
-#define AT91C_UDP_EPINT4 ((unsigned int) 0x1 << 4) // (UDP) Endpoint 4 Interrupt
-#define AT91C_UDP_EPINT5 ((unsigned int) 0x1 << 5) // (UDP) Endpoint 5 Interrupt
-#define AT91C_UDP_RXSUSP ((unsigned int) 0x1 << 8) // (UDP) USB Suspend Interrupt
-#define AT91C_UDP_RXRSM ((unsigned int) 0x1 << 9) // (UDP) USB Resume Interrupt
-#define AT91C_UDP_EXTRSM ((unsigned int) 0x1 << 10) // (UDP) USB External Resume Interrupt
-#define AT91C_UDP_SOFINT ((unsigned int) 0x1 << 11) // (UDP) USB Start Of frame Interrupt
-#define AT91C_UDP_WAKEUP ((unsigned int) 0x1 << 13) // (UDP) USB Resume Interrupt
-// -------- UDP_IDR : (UDP Offset: 0x14) USB Interrupt Disable Register --------
-// -------- UDP_IMR : (UDP Offset: 0x18) USB Interrupt Mask Register --------
-// -------- UDP_ISR : (UDP Offset: 0x1c) USB Interrupt Status Register --------
-#define AT91C_UDP_ENDBUSRES ((unsigned int) 0x1 << 12) // (UDP) USB End Of Bus Reset Interrupt
-// -------- UDP_ICR : (UDP Offset: 0x20) USB Interrupt Clear Register --------
-// -------- UDP_RST_EP : (UDP Offset: 0x28) USB Reset Endpoint Register --------
-#define AT91C_UDP_EP0 ((unsigned int) 0x1 << 0) // (UDP) Reset Endpoint 0
-#define AT91C_UDP_EP1 ((unsigned int) 0x1 << 1) // (UDP) Reset Endpoint 1
-#define AT91C_UDP_EP2 ((unsigned int) 0x1 << 2) // (UDP) Reset Endpoint 2
-#define AT91C_UDP_EP3 ((unsigned int) 0x1 << 3) // (UDP) Reset Endpoint 3
-#define AT91C_UDP_EP4 ((unsigned int) 0x1 << 4) // (UDP) Reset Endpoint 4
-#define AT91C_UDP_EP5 ((unsigned int) 0x1 << 5) // (UDP) Reset Endpoint 5
-// -------- UDP_CSR : (UDP Offset: 0x30) USB Endpoint Control and Status Register --------
-#define AT91C_UDP_TXCOMP ((unsigned int) 0x1 << 0) // (UDP) Generates an IN packet with data previously written in the DPR
-#define AT91C_UDP_RX_DATA_BK0 ((unsigned int) 0x1 << 1) // (UDP) Receive Data Bank 0
-#define AT91C_UDP_RXSETUP ((unsigned int) 0x1 << 2) // (UDP) Sends STALL to the Host (Control endpoints)
-#define AT91C_UDP_ISOERROR ((unsigned int) 0x1 << 3) // (UDP) Isochronous error (Isochronous endpoints)
-#define AT91C_UDP_TXPKTRDY ((unsigned int) 0x1 << 4) // (UDP) Transmit Packet Ready
-#define AT91C_UDP_FORCESTALL ((unsigned int) 0x1 << 5) // (UDP) Force Stall (used by Control, Bulk and Isochronous endpoints).
-#define AT91C_UDP_RX_DATA_BK1 ((unsigned int) 0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes).
-#define AT91C_UDP_DIR ((unsigned int) 0x1 << 7) // (UDP) Transfer Direction
-#define AT91C_UDP_EPTYPE ((unsigned int) 0x7 << 8) // (UDP) Endpoint type
-#define AT91C_UDP_EPTYPE_CTRL ((unsigned int) 0x0 << 8) // (UDP) Control
-#define AT91C_UDP_EPTYPE_ISO_OUT ((unsigned int) 0x1 << 8) // (UDP) Isochronous OUT
-#define AT91C_UDP_EPTYPE_BULK_OUT ((unsigned int) 0x2 << 8) // (UDP) Bulk OUT
-#define AT91C_UDP_EPTYPE_INT_OUT ((unsigned int) 0x3 << 8) // (UDP) Interrupt OUT
-#define AT91C_UDP_EPTYPE_ISO_IN ((unsigned int) 0x5 << 8) // (UDP) Isochronous IN
-#define AT91C_UDP_EPTYPE_BULK_IN ((unsigned int) 0x6 << 8) // (UDP) Bulk IN
-#define AT91C_UDP_EPTYPE_INT_IN ((unsigned int) 0x7 << 8) // (UDP) Interrupt IN
-#define AT91C_UDP_DTGLE ((unsigned int) 0x1 << 11) // (UDP) Data Toggle
-#define AT91C_UDP_EPEDS ((unsigned int) 0x1 << 15) // (UDP) Endpoint Enable Disable
-#define AT91C_UDP_RXBYTECNT ((unsigned int) 0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO
-// -------- UDP_TXVC : (UDP Offset: 0x74) Transceiver Control Register --------
-#define AT91C_UDP_TXVDIS ((unsigned int) 0x1 << 8) // (UDP)
-#define AT91C_UDP_PUON ((unsigned int) 0x1 << 9) // (UDP) Pull-up ON
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Two-wire Interface
-// *****************************************************************************
-typedef struct _AT91S_TWI {
- AT91_REG TWI_CR; // Control Register
- AT91_REG TWI_MMR; // Master Mode Register
- AT91_REG Reserved0[1]; //
- AT91_REG TWI_IADR; // Internal Address Register
- AT91_REG TWI_CWGR; // Clock Waveform Generator Register
- AT91_REG Reserved1[3]; //
- AT91_REG TWI_SR; // Status Register
- AT91_REG TWI_IER; // Interrupt Enable Register
- AT91_REG TWI_IDR; // Interrupt Disable Register
- AT91_REG TWI_IMR; // Interrupt Mask Register
- AT91_REG TWI_RHR; // Receive Holding Register
- AT91_REG TWI_THR; // Transmit Holding Register
-} AT91S_TWI, *AT91PS_TWI;
-
-// -------- TWI_CR : (TWI Offset: 0x0) TWI Control Register --------
-#define AT91C_TWI_START ((unsigned int) 0x1 << 0) // (TWI) Send a START Condition
-#define AT91C_TWI_STOP ((unsigned int) 0x1 << 1) // (TWI) Send a STOP Condition
-#define AT91C_TWI_MSEN ((unsigned int) 0x1 << 2) // (TWI) TWI Master Transfer Enabled
-#define AT91C_TWI_MSDIS ((unsigned int) 0x1 << 3) // (TWI) TWI Master Transfer Disabled
-#define AT91C_TWI_SWRST ((unsigned int) 0x1 << 7) // (TWI) Software Reset
-// -------- TWI_MMR : (TWI Offset: 0x4) TWI Master Mode Register --------
-#define AT91C_TWI_IADRSZ ((unsigned int) 0x3 << 8) // (TWI) Internal Device Address Size
-#define AT91C_TWI_IADRSZ_NO ((unsigned int) 0x0 << 8) // (TWI) No internal device address
-#define AT91C_TWI_IADRSZ_1_BYTE ((unsigned int) 0x1 << 8) // (TWI) One-byte internal device address
-#define AT91C_TWI_IADRSZ_2_BYTE ((unsigned int) 0x2 << 8) // (TWI) Two-byte internal device address
-#define AT91C_TWI_IADRSZ_3_BYTE ((unsigned int) 0x3 << 8) // (TWI) Three-byte internal device address
-#define AT91C_TWI_MREAD ((unsigned int) 0x1 << 12) // (TWI) Master Read Direction
-#define AT91C_TWI_DADR ((unsigned int) 0x7F << 16) // (TWI) Device Address
-// -------- TWI_CWGR : (TWI Offset: 0x10) TWI Clock Waveform Generator Register --------
-#define AT91C_TWI_CLDIV ((unsigned int) 0xFF << 0) // (TWI) Clock Low Divider
-#define AT91C_TWI_CHDIV ((unsigned int) 0xFF << 8) // (TWI) Clock High Divider
-#define AT91C_TWI_CKDIV ((unsigned int) 0x7 << 16) // (TWI) Clock Divider
-// -------- TWI_SR : (TWI Offset: 0x20) TWI Status Register --------
-#define AT91C_TWI_TXCOMP ((unsigned int) 0x1 << 0) // (TWI) Transmission Completed
-#define AT91C_TWI_RXRDY ((unsigned int) 0x1 << 1) // (TWI) Receive holding register ReaDY
-#define AT91C_TWI_TXRDY ((unsigned int) 0x1 << 2) // (TWI) Transmit holding register ReaDY
-#define AT91C_TWI_OVRE ((unsigned int) 0x1 << 6) // (TWI) Overrun Error
-#define AT91C_TWI_UNRE ((unsigned int) 0x1 << 7) // (TWI) Underrun Error
-#define AT91C_TWI_NACK ((unsigned int) 0x1 << 8) // (TWI) Not Acknowledged
-// -------- TWI_IER : (TWI Offset: 0x24) TWI Interrupt Enable Register --------
-// -------- TWI_IDR : (TWI Offset: 0x28) TWI Interrupt Disable Register --------
-// -------- TWI_IMR : (TWI Offset: 0x2c) TWI Interrupt Mask Register --------
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Usart
-// *****************************************************************************
-typedef struct _AT91S_USART {
- AT91_REG US_CR; // Control Register
- AT91_REG US_MR; // Mode Register
- AT91_REG US_IER; // Interrupt Enable Register
- AT91_REG US_IDR; // Interrupt Disable Register
- AT91_REG US_IMR; // Interrupt Mask Register
- AT91_REG US_CSR; // Channel Status Register
- AT91_REG US_RHR; // Receiver Holding Register
- AT91_REG US_THR; // Transmitter Holding Register
- AT91_REG US_BRGR; // Baud Rate Generator Register
- AT91_REG US_RTOR; // Receiver Time-out Register
- AT91_REG US_TTGR; // Transmitter Time-guard Register
- AT91_REG Reserved0[5]; //
- AT91_REG US_FIDI; // FI_DI_Ratio Register
- AT91_REG US_NER; // Nb Errors Register
- AT91_REG Reserved1[1]; //
- AT91_REG US_IF; // IRDA_FILTER Register
- AT91_REG Reserved2[44]; //
- AT91_REG US_RPR; // Receive Pointer Register
- AT91_REG US_RCR; // Receive Counter Register
- AT91_REG US_TPR; // Transmit Pointer Register
- AT91_REG US_TCR; // Transmit Counter Register
- AT91_REG US_RNPR; // Receive Next Pointer Register
- AT91_REG US_RNCR; // Receive Next Counter Register
- AT91_REG US_TNPR; // Transmit Next Pointer Register
- AT91_REG US_TNCR; // Transmit Next Counter Register
- AT91_REG US_PTCR; // PDC Transfer Control Register
- AT91_REG US_PTSR; // PDC Transfer Status Register
-} AT91S_USART, *AT91PS_USART;
-
-// -------- US_CR : (USART Offset: 0x0) Debug Unit Control Register --------
-#define AT91C_US_STTBRK ((unsigned int) 0x1 << 9) // (USART) Start Break
-#define AT91C_US_STPBRK ((unsigned int) 0x1 << 10) // (USART) Stop Break
-#define AT91C_US_STTTO ((unsigned int) 0x1 << 11) // (USART) Start Time-out
-#define AT91C_US_SENDA ((unsigned int) 0x1 << 12) // (USART) Send Address
-#define AT91C_US_RSTIT ((unsigned int) 0x1 << 13) // (USART) Reset Iterations
-#define AT91C_US_RSTNACK ((unsigned int) 0x1 << 14) // (USART) Reset Non Acknowledge
-#define AT91C_US_RETTO ((unsigned int) 0x1 << 15) // (USART) Rearm Time-out
-#define AT91C_US_DTREN ((unsigned int) 0x1 << 16) // (USART) Data Terminal ready Enable
-#define AT91C_US_DTRDIS ((unsigned int) 0x1 << 17) // (USART) Data Terminal ready Disable
-#define AT91C_US_RTSEN ((unsigned int) 0x1 << 18) // (USART) Request to Send enable
-#define AT91C_US_RTSDIS ((unsigned int) 0x1 << 19) // (USART) Request to Send Disable
-// -------- US_MR : (USART Offset: 0x4) Debug Unit Mode Register --------
-#define AT91C_US_USMODE ((unsigned int) 0xF << 0) // (USART) Usart mode
-#define AT91C_US_USMODE_NORMAL ((unsigned int) 0x0) // (USART) Normal
-#define AT91C_US_USMODE_RS485 ((unsigned int) 0x1) // (USART) RS485
-#define AT91C_US_USMODE_HWHSH ((unsigned int) 0x2) // (USART) Hardware Handshaking
-#define AT91C_US_USMODE_MODEM ((unsigned int) 0x3) // (USART) Modem
-#define AT91C_US_USMODE_ISO7816_0 ((unsigned int) 0x4) // (USART) ISO7816 protocol: T = 0
-#define AT91C_US_USMODE_ISO7816_1 ((unsigned int) 0x6) // (USART) ISO7816 protocol: T = 1
-#define AT91C_US_USMODE_IRDA ((unsigned int) 0x8) // (USART) IrDA
-#define AT91C_US_USMODE_SWHSH ((unsigned int) 0xC) // (USART) Software Handshaking
-#define AT91C_US_CLKS ((unsigned int) 0x3 << 4) // (USART) Clock Selection (Baud Rate generator Input Clock
-#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) // (USART) Clock
-#define AT91C_US_CLKS_FDIV1 ((unsigned int) 0x1 << 4) // (USART) fdiv1
-#define AT91C_US_CLKS_SLOW ((unsigned int) 0x2 << 4) // (USART) slow_clock (ARM)
-#define AT91C_US_CLKS_EXT ((unsigned int) 0x3 << 4) // (USART) External (SCK)
-#define AT91C_US_CHRL ((unsigned int) 0x3 << 6) // (USART) Clock Selection (Baud Rate generator Input Clock
-#define AT91C_US_CHRL_5_BITS ((unsigned int) 0x0 << 6) // (USART) Character Length: 5 bits
-#define AT91C_US_CHRL_6_BITS ((unsigned int) 0x1 << 6) // (USART) Character Length: 6 bits
-#define AT91C_US_CHRL_7_BITS ((unsigned int) 0x2 << 6) // (USART) Character Length: 7 bits
-#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) // (USART) Character Length: 8 bits
-#define AT91C_US_SYNC ((unsigned int) 0x1 << 8) // (USART) Synchronous Mode Select
-#define AT91C_US_NBSTOP ((unsigned int) 0x3 << 12) // (USART) Number of Stop bits
-#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) // (USART) 1 stop bit
-#define AT91C_US_NBSTOP_15_BIT ((unsigned int) 0x1 << 12) // (USART) Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits
-#define AT91C_US_NBSTOP_2_BIT ((unsigned int) 0x2 << 12) // (USART) 2 stop bits
-#define AT91C_US_MSBF ((unsigned int) 0x1 << 16) // (USART) Bit Order
-#define AT91C_US_MODE9 ((unsigned int) 0x1 << 17) // (USART) 9-bit Character length
-#define AT91C_US_CKLO ((unsigned int) 0x1 << 18) // (USART) Clock Output Select
-#define AT91C_US_OVER ((unsigned int) 0x1 << 19) // (USART) Over Sampling Mode
-#define AT91C_US_INACK ((unsigned int) 0x1 << 20) // (USART) Inhibit Non Acknowledge
-#define AT91C_US_DSNACK ((unsigned int) 0x1 << 21) // (USART) Disable Successive NACK
-#define AT91C_US_MAX_ITER ((unsigned int) 0x1 << 24) // (USART) Number of Repetitions
-#define AT91C_US_FILTER ((unsigned int) 0x1 << 28) // (USART) Receive Line Filter
-// -------- US_IER : (USART Offset: 0x8) Debug Unit Interrupt Enable Register --------
-#define AT91C_US_RXBRK ((unsigned int) 0x1 << 2) // (USART) Break Received/End of Break
-#define AT91C_US_TIMEOUT ((unsigned int) 0x1 << 8) // (USART) Receiver Time-out
-#define AT91C_US_ITERATION ((unsigned int) 0x1 << 10) // (USART) Max number of Repetitions Reached
-#define AT91C_US_NACK ((unsigned int) 0x1 << 13) // (USART) Non Acknowledge
-#define AT91C_US_RIIC ((unsigned int) 0x1 << 16) // (USART) Ring INdicator Input Change Flag
-#define AT91C_US_DSRIC ((unsigned int) 0x1 << 17) // (USART) Data Set Ready Input Change Flag
-#define AT91C_US_DCDIC ((unsigned int) 0x1 << 18) // (USART) Data Carrier Flag
-#define AT91C_US_CTSIC ((unsigned int) 0x1 << 19) // (USART) Clear To Send Input Change Flag
-// -------- US_IDR : (USART Offset: 0xc) Debug Unit Interrupt Disable Register --------
-// -------- US_IMR : (USART Offset: 0x10) Debug Unit Interrupt Mask Register --------
-// -------- US_CSR : (USART Offset: 0x14) Debug Unit Channel Status Register --------
-#define AT91C_US_RI ((unsigned int) 0x1 << 20) // (USART) Image of RI Input
-#define AT91C_US_DSR ((unsigned int) 0x1 << 21) // (USART) Image of DSR Input
-#define AT91C_US_DCD ((unsigned int) 0x1 << 22) // (USART) Image of DCD Input
-#define AT91C_US_CTS ((unsigned int) 0x1 << 23) // (USART) Image of CTS Input
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR PWMC Channel Interface
-// *****************************************************************************
-typedef struct _AT91S_PWMC_CH {
- AT91_REG PWMC_CMR; // Channel Mode Register
- AT91_REG PWMC_CDTYR; // Channel Duty Cycle Register
- AT91_REG PWMC_CPRDR; // Channel Period Register
- AT91_REG PWMC_CCNTR; // Channel Counter Register
- AT91_REG PWMC_CUPDR; // Channel Update Register
- AT91_REG PWMC_Reserved[3]; // Reserved
-} AT91S_PWMC_CH, *AT91PS_PWMC_CH;
-
-// -------- PWMC_CMR : (PWMC_CH Offset: 0x0) PWMC Channel Mode Register --------
-#define AT91C_PWMC_CPRE ((unsigned int) 0xF << 0) // (PWMC_CH) Channel Pre-scaler : PWMC_CLKx
-#define AT91C_PWMC_CPRE_MCK ((unsigned int) 0x0) // (PWMC_CH)
-#define AT91C_PWMC_CPRE_MCKA ((unsigned int) 0xB) // (PWMC_CH)
-#define AT91C_PWMC_CPRE_MCKB ((unsigned int) 0xC) // (PWMC_CH)
-#define AT91C_PWMC_CALG ((unsigned int) 0x1 << 8) // (PWMC_CH) Channel Alignment
-#define AT91C_PWMC_CPOL ((unsigned int) 0x1 << 9) // (PWMC_CH) Channel Polarity
-#define AT91C_PWMC_CPD ((unsigned int) 0x1 << 10) // (PWMC_CH) Channel Update Period
-// -------- PWMC_CDTYR : (PWMC_CH Offset: 0x4) PWMC Channel Duty Cycle Register --------
-#define AT91C_PWMC_CDTY ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Duty Cycle
-// -------- PWMC_CPRDR : (PWMC_CH Offset: 0x8) PWMC Channel Period Register --------
-#define AT91C_PWMC_CPRD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Period
-// -------- PWMC_CCNTR : (PWMC_CH Offset: 0xc) PWMC Channel Counter Register --------
-#define AT91C_PWMC_CCNT ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Counter
-// -------- PWMC_CUPDR : (PWMC_CH Offset: 0x10) PWMC Channel Update Register --------
-#define AT91C_PWMC_CUPD ((unsigned int) 0x0 << 0) // (PWMC_CH) Channel Update
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Pulse Width Modulation Controller Interface
-// *****************************************************************************
-typedef struct _AT91S_PWMC {
- AT91_REG PWMC_MR; // PWMC Mode Register
- AT91_REG PWMC_ENA; // PWMC Enable Register
- AT91_REG PWMC_DIS; // PWMC Disable Register
- AT91_REG PWMC_SR; // PWMC Status Register
- AT91_REG PWMC_IER; // PWMC Interrupt Enable Register
- AT91_REG PWMC_IDR; // PWMC Interrupt Disable Register
- AT91_REG PWMC_IMR; // PWMC Interrupt Mask Register
- AT91_REG PWMC_ISR; // PWMC Interrupt Status Register
- AT91_REG Reserved0[55]; //
- AT91_REG PWMC_VR; // PWMC Version Register
- AT91_REG Reserved1[64]; //
- AT91S_PWMC_CH PWMC_CH[8]; // PWMC Channel
-} AT91S_PWMC, *AT91PS_PWMC;
-
-// -------- PWMC_MR : (PWMC Offset: 0x0) PWMC Mode Register --------
-#define AT91C_PWMC_DIVA ((unsigned int) 0xFF << 0) // (PWMC) CLKA divide factor.
-#define AT91C_PWMC_PREA ((unsigned int) 0xF << 8) // (PWMC) Divider Input Clock Prescaler A
-#define AT91C_PWMC_PREA_MCK ((unsigned int) 0x0 << 8) // (PWMC)
-#define AT91C_PWMC_DIVB ((unsigned int) 0xFF << 16) // (PWMC) CLKB divide factor.
-#define AT91C_PWMC_PREB ((unsigned int) 0xF << 24) // (PWMC) Divider Input Clock Prescaler B
-#define AT91C_PWMC_PREB_MCK ((unsigned int) 0x0 << 24) // (PWMC)
-// -------- PWMC_ENA : (PWMC Offset: 0x4) PWMC Enable Register --------
-#define AT91C_PWMC_CHID0 ((unsigned int) 0x1 << 0) // (PWMC) Channel ID 0
-#define AT91C_PWMC_CHID1 ((unsigned int) 0x1 << 1) // (PWMC) Channel ID 1
-#define AT91C_PWMC_CHID2 ((unsigned int) 0x1 << 2) // (PWMC) Channel ID 2
-#define AT91C_PWMC_CHID3 ((unsigned int) 0x1 << 3) // (PWMC) Channel ID 3
-#define AT91C_PWMC_CHID4 ((unsigned int) 0x1 << 4) // (PWMC) Channel ID 4
-#define AT91C_PWMC_CHID5 ((unsigned int) 0x1 << 5) // (PWMC) Channel ID 5
-#define AT91C_PWMC_CHID6 ((unsigned int) 0x1 << 6) // (PWMC) Channel ID 6
-#define AT91C_PWMC_CHID7 ((unsigned int) 0x1 << 7) // (PWMC) Channel ID 7
-// -------- PWMC_DIS : (PWMC Offset: 0x8) PWMC Disable Register --------
-// -------- PWMC_SR : (PWMC Offset: 0xc) PWMC Status Register --------
-// -------- PWMC_IER : (PWMC Offset: 0x10) PWMC Interrupt Enable Register --------
-// -------- PWMC_IDR : (PWMC Offset: 0x14) PWMC Interrupt Disable Register --------
-// -------- PWMC_IMR : (PWMC Offset: 0x18) PWMC Interrupt Mask Register --------
-// -------- PWMC_ISR : (PWMC Offset: 0x1c) PWMC Interrupt Status Register --------
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Synchronous Serial Controller Interface
-// *****************************************************************************
-typedef struct _AT91S_SSC {
- AT91_REG SSC_CR; // Control Register
- AT91_REG SSC_CMR; // Clock Mode Register
- AT91_REG Reserved0[2]; //
- AT91_REG SSC_RCMR; // Receive Clock ModeRegister
- AT91_REG SSC_RFMR; // Receive Frame Mode Register
- AT91_REG SSC_TCMR; // Transmit Clock Mode Register
- AT91_REG SSC_TFMR; // Transmit Frame Mode Register
- AT91_REG SSC_RHR; // Receive Holding Register
- AT91_REG SSC_THR; // Transmit Holding Register
- AT91_REG Reserved1[2]; //
- AT91_REG SSC_RSHR; // Receive Sync Holding Register
- AT91_REG SSC_TSHR; // Transmit Sync Holding Register
- AT91_REG Reserved2[2]; //
- AT91_REG SSC_SR; // Status Register
- AT91_REG SSC_IER; // Interrupt Enable Register
- AT91_REG SSC_IDR; // Interrupt Disable Register
- AT91_REG SSC_IMR; // Interrupt Mask Register
- AT91_REG Reserved3[44]; //
- AT91_REG SSC_RPR; // Receive Pointer Register
- AT91_REG SSC_RCR; // Receive Counter Register
- AT91_REG SSC_TPR; // Transmit Pointer Register
- AT91_REG SSC_TCR; // Transmit Counter Register
- AT91_REG SSC_RNPR; // Receive Next Pointer Register
- AT91_REG SSC_RNCR; // Receive Next Counter Register
- AT91_REG SSC_TNPR; // Transmit Next Pointer Register
- AT91_REG SSC_TNCR; // Transmit Next Counter Register
- AT91_REG SSC_PTCR; // PDC Transfer Control Register
- AT91_REG SSC_PTSR; // PDC Transfer Status Register
-} AT91S_SSC, *AT91PS_SSC;
-
-// -------- SSC_CR : (SSC Offset: 0x0) SSC Control Register --------
-#define AT91C_SSC_RXEN ((unsigned int) 0x1 << 0) // (SSC) Receive Enable
-#define AT91C_SSC_RXDIS ((unsigned int) 0x1 << 1) // (SSC) Receive Disable
-#define AT91C_SSC_TXEN ((unsigned int) 0x1 << 8) // (SSC) Transmit Enable
-#define AT91C_SSC_TXDIS ((unsigned int) 0x1 << 9) // (SSC) Transmit Disable
-#define AT91C_SSC_SWRST ((unsigned int) 0x1 << 15) // (SSC) Software Reset
-// -------- SSC_RCMR : (SSC Offset: 0x10) SSC Receive Clock Mode Register --------
-#define AT91C_SSC_CKS ((unsigned int) 0x3 << 0) // (SSC) Receive/Transmit Clock Selection
-#define AT91C_SSC_CKS_DIV ((unsigned int) 0x0) // (SSC) Divided Clock
-#define AT91C_SSC_CKS_TK ((unsigned int) 0x1) // (SSC) TK Clock signal
-#define AT91C_SSC_CKS_RK ((unsigned int) 0x2) // (SSC) RK pin
-#define AT91C_SSC_CKO ((unsigned int) 0x7 << 2) // (SSC) Receive/Transmit Clock Output Mode Selection
-#define AT91C_SSC_CKO_NONE ((unsigned int) 0x0 << 2) // (SSC) Receive/Transmit Clock Output Mode: None RK pin: Input-only
-#define AT91C_SSC_CKO_CONTINOUS ((unsigned int) 0x1 << 2) // (SSC) Continuous Receive/Transmit Clock RK pin: Output
-#define AT91C_SSC_CKO_DATA_TX ((unsigned int) 0x2 << 2) // (SSC) Receive/Transmit Clock only during data transfers RK pin: Output
-#define AT91C_SSC_CKI ((unsigned int) 0x1 << 5) // (SSC) Receive/Transmit Clock Inversion
-#define AT91C_SSC_START ((unsigned int) 0xF << 8) // (SSC) Receive/Transmit Start Selection
-#define AT91C_SSC_START_CONTINOUS ((unsigned int) 0x0 << 8) // (SSC) Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data.
-#define AT91C_SSC_START_TX ((unsigned int) 0x1 << 8) // (SSC) Transmit/Receive start
-#define AT91C_SSC_START_LOW_RF ((unsigned int) 0x2 << 8) // (SSC) Detection of a low level on RF input
-#define AT91C_SSC_START_HIGH_RF ((unsigned int) 0x3 << 8) // (SSC) Detection of a high level on RF input
-#define AT91C_SSC_START_FALL_RF ((unsigned int) 0x4 << 8) // (SSC) Detection of a falling edge on RF input
-#define AT91C_SSC_START_RISE_RF ((unsigned int) 0x5 << 8) // (SSC) Detection of a rising edge on RF input
-#define AT91C_SSC_START_LEVEL_RF ((unsigned int) 0x6 << 8) // (SSC) Detection of any level change on RF input
-#define AT91C_SSC_START_EDGE_RF ((unsigned int) 0x7 << 8) // (SSC) Detection of any edge on RF input
-#define AT91C_SSC_START_0 ((unsigned int) 0x8 << 8) // (SSC) Compare 0
-#define AT91C_SSC_STTDLY ((unsigned int) 0xFF << 16) // (SSC) Receive/Transmit Start Delay
-#define AT91C_SSC_PERIOD ((unsigned int) 0xFF << 24) // (SSC) Receive/Transmit Period Divider Selection
-// -------- SSC_RFMR : (SSC Offset: 0x14) SSC Receive Frame Mode Register --------
-#define AT91C_SSC_DATLEN ((unsigned int) 0x1F << 0) // (SSC) Data Length
-#define AT91C_SSC_LOOP ((unsigned int) 0x1 << 5) // (SSC) Loop Mode
-#define AT91C_SSC_MSBF ((unsigned int) 0x1 << 7) // (SSC) Most Significant Bit First
-#define AT91C_SSC_DATNB ((unsigned int) 0xF << 8) // (SSC) Data Number per Frame
-#define AT91C_SSC_FSLEN ((unsigned int) 0xF << 16) // (SSC) Receive/Transmit Frame Sync length
-#define AT91C_SSC_FSOS ((unsigned int) 0x7 << 20) // (SSC) Receive/Transmit Frame Sync Output Selection
-#define AT91C_SSC_FSOS_NONE ((unsigned int) 0x0 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: None RK pin Input-only
-#define AT91C_SSC_FSOS_NEGATIVE ((unsigned int) 0x1 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Negative Pulse
-#define AT91C_SSC_FSOS_POSITIVE ((unsigned int) 0x2 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Positive Pulse
-#define AT91C_SSC_FSOS_LOW ((unsigned int) 0x3 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver Low during data transfer
-#define AT91C_SSC_FSOS_HIGH ((unsigned int) 0x4 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Driver High during data transfer
-#define AT91C_SSC_FSOS_TOGGLE ((unsigned int) 0x5 << 20) // (SSC) Selected Receive/Transmit Frame Sync Signal: Toggling at each start of data transfer
-#define AT91C_SSC_FSEDGE ((unsigned int) 0x1 << 24) // (SSC) Frame Sync Edge Detection
-// -------- SSC_TCMR : (SSC Offset: 0x18) SSC Transmit Clock Mode Register --------
-// -------- SSC_TFMR : (SSC Offset: 0x1c) SSC Transmit Frame Mode Register --------
-#define AT91C_SSC_DATDEF ((unsigned int) 0x1 << 5) // (SSC) Data Default Value
-#define AT91C_SSC_FSDEN ((unsigned int) 0x1 << 23) // (SSC) Frame Sync Data Enable
-// -------- SSC_SR : (SSC Offset: 0x40) SSC Status Register --------
-#define AT91C_SSC_TXRDY ((unsigned int) 0x1 << 0) // (SSC) Transmit Ready
-#define AT91C_SSC_TXEMPTY ((unsigned int) 0x1 << 1) // (SSC) Transmit Empty
-#define AT91C_SSC_ENDTX ((unsigned int) 0x1 << 2) // (SSC) End Of Transmission
-#define AT91C_SSC_TXBUFE ((unsigned int) 0x1 << 3) // (SSC) Transmit Buffer Empty
-#define AT91C_SSC_RXRDY ((unsigned int) 0x1 << 4) // (SSC) Receive Ready
-#define AT91C_SSC_OVRUN ((unsigned int) 0x1 << 5) // (SSC) Receive Overrun
-#define AT91C_SSC_ENDRX ((unsigned int) 0x1 << 6) // (SSC) End of Reception
-#define AT91C_SSC_RXBUFF ((unsigned int) 0x1 << 7) // (SSC) Receive Buffer Full
-#define AT91C_SSC_TXSYN ((unsigned int) 0x1 << 10) // (SSC) Transmit Sync
-#define AT91C_SSC_RXSYN ((unsigned int) 0x1 << 11) // (SSC) Receive Sync
-#define AT91C_SSC_TXENA ((unsigned int) 0x1 << 16) // (SSC) Transmit Enable
-#define AT91C_SSC_RXENA ((unsigned int) 0x1 << 17) // (SSC) Receive Enable
-// -------- SSC_IER : (SSC Offset: 0x44) SSC Interrupt Enable Register --------
-// -------- SSC_IDR : (SSC Offset: 0x48) SSC Interrupt Disable Register --------
-// -------- SSC_IMR : (SSC Offset: 0x4c) SSC Interrupt Mask Register --------
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Analog to Digital Convertor
-// *****************************************************************************
-typedef struct _AT91S_ADC {
- AT91_REG ADC_CR; // ADC Control Register
- AT91_REG ADC_MR; // ADC Mode Register
- AT91_REG Reserved0[2]; //
- AT91_REG ADC_CHER; // ADC Channel Enable Register
- AT91_REG ADC_CHDR; // ADC Channel Disable Register
- AT91_REG ADC_CHSR; // ADC Channel Status Register
- AT91_REG ADC_SR; // ADC Status Register
- AT91_REG ADC_LCDR; // ADC Last Converted Data Register
- AT91_REG ADC_IER; // ADC Interrupt Enable Register
- AT91_REG ADC_IDR; // ADC Interrupt Disable Register
- AT91_REG ADC_IMR; // ADC Interrupt Mask Register
- AT91_REG ADC_CDR0; // ADC Channel Data Register 0
- AT91_REG ADC_CDR1; // ADC Channel Data Register 1
- AT91_REG ADC_CDR2; // ADC Channel Data Register 2
- AT91_REG ADC_CDR3; // ADC Channel Data Register 3
- AT91_REG ADC_CDR4; // ADC Channel Data Register 4
- AT91_REG ADC_CDR5; // ADC Channel Data Register 5
- AT91_REG ADC_CDR6; // ADC Channel Data Register 6
- AT91_REG ADC_CDR7; // ADC Channel Data Register 7
- AT91_REG Reserved1[44]; //
- AT91_REG ADC_RPR; // Receive Pointer Register
- AT91_REG ADC_RCR; // Receive Counter Register
- AT91_REG ADC_TPR; // Transmit Pointer Register
- AT91_REG ADC_TCR; // Transmit Counter Register
- AT91_REG ADC_RNPR; // Receive Next Pointer Register
- AT91_REG ADC_RNCR; // Receive Next Counter Register
- AT91_REG ADC_TNPR; // Transmit Next Pointer Register
- AT91_REG ADC_TNCR; // Transmit Next Counter Register
- AT91_REG ADC_PTCR; // PDC Transfer Control Register
- AT91_REG ADC_PTSR; // PDC Transfer Status Register
-} AT91S_ADC, *AT91PS_ADC;
-
-// -------- ADC_CR : (ADC Offset: 0x0) ADC Control Register --------
-#define AT91C_ADC_SWRST ((unsigned int) 0x1 << 0) // (ADC) Software Reset
-#define AT91C_ADC_START ((unsigned int) 0x1 << 1) // (ADC) Start Conversion
-// -------- ADC_MR : (ADC Offset: 0x4) ADC Mode Register --------
-#define AT91C_ADC_TRGEN ((unsigned int) 0x1 << 0) // (ADC) Trigger Enable
-#define AT91C_ADC_TRGEN_DIS ((unsigned int) 0x0) // (ADC) Hradware triggers are disabled. Starting a conversion is only possible by software
-#define AT91C_ADC_TRGEN_EN ((unsigned int) 0x1) // (ADC) Hardware trigger selected by TRGSEL field is enabled.
-#define AT91C_ADC_TRGSEL ((unsigned int) 0x7 << 1) // (ADC) Trigger Selection
-#define AT91C_ADC_TRGSEL_TIOA0 ((unsigned int) 0x0 << 1) // (ADC) Selected TRGSEL = TIAO0
-#define AT91C_ADC_TRGSEL_TIOA1 ((unsigned int) 0x1 << 1) // (ADC) Selected TRGSEL = TIAO1
-#define AT91C_ADC_TRGSEL_TIOA2 ((unsigned int) 0x2 << 1) // (ADC) Selected TRGSEL = TIAO2
-#define AT91C_ADC_TRGSEL_TIOA3 ((unsigned int) 0x3 << 1) // (ADC) Selected TRGSEL = TIAO3
-#define AT91C_ADC_TRGSEL_TIOA4 ((unsigned int) 0x4 << 1) // (ADC) Selected TRGSEL = TIAO4
-#define AT91C_ADC_TRGSEL_TIOA5 ((unsigned int) 0x5 << 1) // (ADC) Selected TRGSEL = TIAO5
-#define AT91C_ADC_TRGSEL_EXT ((unsigned int) 0x6 << 1) // (ADC) Selected TRGSEL = External Trigger
-#define AT91C_ADC_LOWRES ((unsigned int) 0x1 << 4) // (ADC) Resolution.
-#define AT91C_ADC_LOWRES_10_BIT ((unsigned int) 0x0 << 4) // (ADC) 10-bit resolution
-#define AT91C_ADC_LOWRES_8_BIT ((unsigned int) 0x1 << 4) // (ADC) 8-bit resolution
-#define AT91C_ADC_SLEEP ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode
-#define AT91C_ADC_SLEEP_NORMAL_MODE ((unsigned int) 0x0 << 5) // (ADC) Normal Mode
-#define AT91C_ADC_SLEEP_MODE ((unsigned int) 0x1 << 5) // (ADC) Sleep Mode
-#define AT91C_ADC_PRESCAL ((unsigned int) 0x3F << 8) // (ADC) Prescaler rate selection
-#define AT91C_ADC_STARTUP ((unsigned int) 0x1F << 16) // (ADC) Startup Time
-#define AT91C_ADC_SHTIM ((unsigned int) 0xF << 24) // (ADC) Sample & Hold Time
-// -------- ADC_CHER : (ADC Offset: 0x10) ADC Channel Enable Register --------
-#define AT91C_ADC_CH0 ((unsigned int) 0x1 << 0) // (ADC) Channel 0
-#define AT91C_ADC_CH1 ((unsigned int) 0x1 << 1) // (ADC) Channel 1
-#define AT91C_ADC_CH2 ((unsigned int) 0x1 << 2) // (ADC) Channel 2
-#define AT91C_ADC_CH3 ((unsigned int) 0x1 << 3) // (ADC) Channel 3
-#define AT91C_ADC_CH4 ((unsigned int) 0x1 << 4) // (ADC) Channel 4
-#define AT91C_ADC_CH5 ((unsigned int) 0x1 << 5) // (ADC) Channel 5
-#define AT91C_ADC_CH6 ((unsigned int) 0x1 << 6) // (ADC) Channel 6
-#define AT91C_ADC_CH7 ((unsigned int) 0x1 << 7) // (ADC) Channel 7
-// -------- ADC_CHDR : (ADC Offset: 0x14) ADC Channel Disable Register --------
-// -------- ADC_CHSR : (ADC Offset: 0x18) ADC Channel Status Register --------
-// -------- ADC_SR : (ADC Offset: 0x1c) ADC Status Register --------
-#define AT91C_ADC_EOC0 ((unsigned int) 0x1 << 0) // (ADC) End of Conversion
-#define AT91C_ADC_EOC1 ((unsigned int) 0x1 << 1) // (ADC) End of Conversion
-#define AT91C_ADC_EOC2 ((unsigned int) 0x1 << 2) // (ADC) End of Conversion
-#define AT91C_ADC_EOC3 ((unsigned int) 0x1 << 3) // (ADC) End of Conversion
-#define AT91C_ADC_EOC4 ((unsigned int) 0x1 << 4) // (ADC) End of Conversion
-#define AT91C_ADC_EOC5 ((unsigned int) 0x1 << 5) // (ADC) End of Conversion
-#define AT91C_ADC_EOC6 ((unsigned int) 0x1 << 6) // (ADC) End of Conversion
-#define AT91C_ADC_EOC7 ((unsigned int) 0x1 << 7) // (ADC) End of Conversion
-#define AT91C_ADC_OVRE0 ((unsigned int) 0x1 << 8) // (ADC) Overrun Error
-#define AT91C_ADC_OVRE1 ((unsigned int) 0x1 << 9) // (ADC) Overrun Error
-#define AT91C_ADC_OVRE2 ((unsigned int) 0x1 << 10) // (ADC) Overrun Error
-#define AT91C_ADC_OVRE3 ((unsigned int) 0x1 << 11) // (ADC) Overrun Error
-#define AT91C_ADC_OVRE4 ((unsigned int) 0x1 << 12) // (ADC) Overrun Error
-#define AT91C_ADC_OVRE5 ((unsigned int) 0x1 << 13) // (ADC) Overrun Error
-#define AT91C_ADC_OVRE6 ((unsigned int) 0x1 << 14) // (ADC) Overrun Error
-#define AT91C_ADC_OVRE7 ((unsigned int) 0x1 << 15) // (ADC) Overrun Error
-#define AT91C_ADC_DRDY ((unsigned int) 0x1 << 16) // (ADC) Data Ready
-#define AT91C_ADC_GOVRE ((unsigned int) 0x1 << 17) // (ADC) General Overrun
-#define AT91C_ADC_ENDRX ((unsigned int) 0x1 << 18) // (ADC) End of Receiver Transfer
-#define AT91C_ADC_RXBUFF ((unsigned int) 0x1 << 19) // (ADC) RXBUFF Interrupt
-// -------- ADC_LCDR : (ADC Offset: 0x20) ADC Last Converted Data Register --------
-#define AT91C_ADC_LDATA ((unsigned int) 0x3FF << 0) // (ADC) Last Data Converted
-// -------- ADC_IER : (ADC Offset: 0x24) ADC Interrupt Enable Register --------
-// -------- ADC_IDR : (ADC Offset: 0x28) ADC Interrupt Disable Register --------
-// -------- ADC_IMR : (ADC Offset: 0x2c) ADC Interrupt Mask Register --------
-// -------- ADC_CDR0 : (ADC Offset: 0x30) ADC Channel Data Register 0 --------
-#define AT91C_ADC_DATA ((unsigned int) 0x3FF << 0) // (ADC) Converted Data
-// -------- ADC_CDR1 : (ADC Offset: 0x34) ADC Channel Data Register 1 --------
-// -------- ADC_CDR2 : (ADC Offset: 0x38) ADC Channel Data Register 2 --------
-// -------- ADC_CDR3 : (ADC Offset: 0x3c) ADC Channel Data Register 3 --------
-// -------- ADC_CDR4 : (ADC Offset: 0x40) ADC Channel Data Register 4 --------
-// -------- ADC_CDR5 : (ADC Offset: 0x44) ADC Channel Data Register 5 --------
-// -------- ADC_CDR6 : (ADC Offset: 0x48) ADC Channel Data Register 6 --------
-// -------- ADC_CDR7 : (ADC Offset: 0x4c) ADC Channel Data Register 7 --------
-
-// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Serial Parallel Interface
-// *****************************************************************************
-typedef struct _AT91S_SPI {
- AT91_REG SPI_CR; // Control Register
- AT91_REG SPI_MR; // Mode Register
- AT91_REG SPI_RDR; // Receive Data Register
- AT91_REG SPI_TDR; // Transmit Data Register
- AT91_REG SPI_SR; // Status Register
- AT91_REG SPI_IER; // Interrupt Enable Register
- AT91_REG SPI_IDR; // Interrupt Disable Register
- AT91_REG SPI_IMR; // Interrupt Mask Register
- AT91_REG Reserved0[4]; //
- AT91_REG SPI_CSR[4]; // Chip Select Register
- AT91_REG Reserved1[48]; //
- AT91_REG SPI_RPR; // Receive Pointer Register
- AT91_REG SPI_RCR; // Receive Counter Register
- AT91_REG SPI_TPR; // Transmit Pointer Register
- AT91_REG SPI_TCR; // Transmit Counter Register
- AT91_REG SPI_RNPR; // Receive Next Pointer Register
- AT91_REG SPI_RNCR; // Receive Next Counter Register
- AT91_REG SPI_TNPR; // Transmit Next Pointer Register
- AT91_REG SPI_TNCR; // Transmit Next Counter Register
- AT91_REG SPI_PTCR; // PDC Transfer Control Register
- AT91_REG SPI_PTSR; // PDC Transfer Status Register
-} AT91S_SPI, *AT91PS_SPI;
-
-// -------- SPI_CR : (SPI Offset: 0x0) SPI Control Register --------
-#define AT91C_SPI_SPIEN ((unsigned int) 0x1 << 0) // (SPI) SPI Enable
-#define AT91C_SPI_SPIDIS ((unsigned int) 0x1 << 1) // (SPI) SPI Disable
-#define AT91C_SPI_SWRST ((unsigned int) 0x1 << 7) // (SPI) SPI Software reset
-#define AT91C_SPI_LASTXFER ((unsigned int) 0x1 << 24) // (SPI) SPI Last Transfer
-// -------- SPI_MR : (SPI Offset: 0x4) SPI Mode Register --------
-#define AT91C_SPI_MSTR ((unsigned int) 0x1 << 0) // (SPI) Master/Slave Mode
-#define AT91C_SPI_PS ((unsigned int) 0x1 << 1) // (SPI) Peripheral Select
-#define AT91C_SPI_PS_FIXED ((unsigned int) 0x0 << 1) // (SPI) Fixed Peripheral Select
-#define AT91C_SPI_PS_VARIABLE ((unsigned int) 0x1 << 1) // (SPI) Variable Peripheral Select
-#define AT91C_SPI_PCSDEC ((unsigned int) 0x1 << 2) // (SPI) Chip Select Decode
-#define AT91C_SPI_FDIV ((unsigned int) 0x1 << 3) // (SPI) Clock Selection
-#define AT91C_SPI_MODFDIS ((unsigned int) 0x1 << 4) // (SPI) Mode Fault Detection
-#define AT91C_SPI_LLB ((unsigned int) 0x1 << 7) // (SPI) Clock Selection
-#define AT91C_SPI_PCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select
-#define AT91C_SPI_DLYBCS ((unsigned int) 0xFF << 24) // (SPI) Delay Between Chip Selects
-// -------- SPI_RDR : (SPI Offset: 0x8) Receive Data Register --------
-#define AT91C_SPI_RD ((unsigned int) 0xFFFF << 0) // (SPI) Receive Data
-#define AT91C_SPI_RPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status
-// -------- SPI_TDR : (SPI Offset: 0xc) Transmit Data Register --------
-#define AT91C_SPI_TD ((unsigned int) 0xFFFF << 0) // (SPI) Transmit Data
-#define AT91C_SPI_TPCS ((unsigned int) 0xF << 16) // (SPI) Peripheral Chip Select Status
-// -------- SPI_SR : (SPI Offset: 0x10) Status Register --------
-#define AT91C_SPI_RDRF ((unsigned int) 0x1 << 0) // (SPI) Receive Data Register Full
-#define AT91C_SPI_TDRE ((unsigned int) 0x1 << 1) // (SPI) Transmit Data Register Empty
-#define AT91C_SPI_MODF ((unsigned int) 0x1 << 2) // (SPI) Mode Fault Error
-#define AT91C_SPI_OVRES ((unsigned int) 0x1 << 3) // (SPI) Overrun Error Status
-#define AT91C_SPI_ENDRX ((unsigned int) 0x1 << 4) // (SPI) End of Receiver Transfer
-#define AT91C_SPI_ENDTX ((unsigned int) 0x1 << 5) // (SPI) End of Receiver Transfer
-#define AT91C_SPI_RXBUFF ((unsigned int) 0x1 << 6) // (SPI) RXBUFF Interrupt
-#define AT91C_SPI_TXBUFE ((unsigned int) 0x1 << 7) // (SPI) TXBUFE Interrupt
-#define AT91C_SPI_NSSR ((unsigned int) 0x1 << 8) // (SPI) NSSR Interrupt
-#define AT91C_SPI_TXEMPTY ((unsigned int) 0x1 << 9) // (SPI) TXEMPTY Interrupt
-#define AT91C_SPI_SPIENS ((unsigned int) 0x1 << 16) // (SPI) Enable Status
-// -------- SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register --------
-// -------- SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register --------
-// -------- SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register --------
-// -------- SPI_CSR : (SPI Offset: 0x30) Chip Select Register --------
-#define AT91C_SPI_CPOL ((unsigned int) 0x1 << 0) // (SPI) Clock Polarity
-#define AT91C_SPI_NCPHA ((unsigned int) 0x1 << 1) // (SPI) Clock Phase
-#define AT91C_SPI_CSAAT ((unsigned int) 0x1 << 3) // (SPI) Chip Select Active After Transfer
-#define AT91C_SPI_BITS ((unsigned int) 0xF << 4) // (SPI) Bits Per Transfer
-#define AT91C_SPI_BITS_8 ((unsigned int) 0x0 << 4) // (SPI) 8 Bits Per transfer
-#define AT91C_SPI_BITS_9 ((unsigned int) 0x1 << 4) // (SPI) 9 Bits Per transfer
-#define AT91C_SPI_BITS_10 ((unsigned int) 0x2 << 4) // (SPI) 10 Bits Per transfer
-#define AT91C_SPI_BITS_11 ((unsigned int) 0x3 << 4) // (SPI) 11 Bits Per transfer
-#define AT91C_SPI_BITS_12 ((unsigned int) 0x4 << 4) // (SPI) 12 Bits Per transfer
-#define AT91C_SPI_BITS_13 ((unsigned int) 0x5 << 4) // (SPI) 13 Bits Per transfer
-#define AT91C_SPI_BITS_14 ((unsigned int) 0x6 << 4) // (SPI) 14 Bits Per transfer
-#define AT91C_SPI_BITS_15 ((unsigned int) 0x7 << 4) // (SPI) 15 Bits Per transfer
-#define AT91C_SPI_BITS_16 ((unsigned int) 0x8 << 4) // (SPI) 16 Bits Per transfer
-#define AT91C_SPI_SCBR ((unsigned int) 0xFF << 8) // (SPI) Serial Clock Baud Rate
-#define AT91C_SPI_DLYBS ((unsigned int) 0xFF << 16) // (SPI) Delay Before SPCK
-#define AT91C_SPI_DLYBCT ((unsigned int) 0xFF << 24) // (SPI) Delay Between Consecutive Transfers
-
-// *****************************************************************************
-// REGISTER ADDRESS DEFINITION FOR AT91SAM7A3
-// *****************************************************************************
-// ========== Register definition for SYS peripheral ==========
-#define AT91C_SYS_GPBR1 ((AT91_REG *) 0xFFFFFD54) // (SYS) General Purpose Register 1
-#define AT91C_SYS_GPBR0 ((AT91_REG *) 0xFFFFFD50) // (SYS) General Purpose Register 0
-// ========== Register definition for AIC peripheral ==========
-#define AT91C_AIC_ICCR ((AT91_REG *) 0xFFFFF128) // (AIC) Interrupt Clear Command Register
-#define AT91C_AIC_IECR ((AT91_REG *) 0xFFFFF120) // (AIC) Interrupt Enable Command Register
-#define AT91C_AIC_SMR ((AT91_REG *) 0xFFFFF000) // (AIC) Source Mode Register
-#define AT91C_AIC_ISCR ((AT91_REG *) 0xFFFFF12C) // (AIC) Interrupt Set Command Register
-#define AT91C_AIC_EOICR ((AT91_REG *) 0xFFFFF130) // (AIC) End of Interrupt Command Register
-#define AT91C_AIC_DCR ((AT91_REG *) 0xFFFFF138) // (AIC) Debug Control Register (Protect)
-#define AT91C_AIC_FFER ((AT91_REG *) 0xFFFFF140) // (AIC) Fast Forcing Enable Register
-#define AT91C_AIC_SVR ((AT91_REG *) 0xFFFFF080) // (AIC) Source Vector Register
-#define AT91C_AIC_SPU ((AT91_REG *) 0xFFFFF134) // (AIC) Spurious Vector Register
-#define AT91C_AIC_FFDR ((AT91_REG *) 0xFFFFF144) // (AIC) Fast Forcing Disable Register
-#define AT91C_AIC_FVR ((AT91_REG *) 0xFFFFF104) // (AIC) FIQ Vector Register
-#define AT91C_AIC_FFSR ((AT91_REG *) 0xFFFFF148) // (AIC) Fast Forcing Status Register
-#define AT91C_AIC_IMR ((AT91_REG *) 0xFFFFF110) // (AIC) Interrupt Mask Register
-#define AT91C_AIC_ISR ((AT91_REG *) 0xFFFFF108) // (AIC) Interrupt Status Register
-#define AT91C_AIC_IVR ((AT91_REG *) 0xFFFFF100) // (AIC) IRQ Vector Register
-#define AT91C_AIC_IDCR ((AT91_REG *) 0xFFFFF124) // (AIC) Interrupt Disable Command Register
-#define AT91C_AIC_CISR ((AT91_REG *) 0xFFFFF114) // (AIC) Core Interrupt Status Register
-#define AT91C_AIC_IPR ((AT91_REG *) 0xFFFFF10C) // (AIC) Interrupt Pending Register
-// ========== Register definition for PDC_DBGU peripheral ==========
-#define AT91C_DBGU_TNCR ((AT91_REG *) 0xFFFFF31C) // (PDC_DBGU) Transmit Next Counter Register
-#define AT91C_DBGU_RNCR ((AT91_REG *) 0xFFFFF314) // (PDC_DBGU) Receive Next Counter Register
-#define AT91C_DBGU_PTCR ((AT91_REG *) 0xFFFFF320) // (PDC_DBGU) PDC Transfer Control Register
-#define AT91C_DBGU_PTSR ((AT91_REG *) 0xFFFFF324) // (PDC_DBGU) PDC Transfer Status Register
-#define AT91C_DBGU_RCR ((AT91_REG *) 0xFFFFF304) // (PDC_DBGU) Receive Counter Register
-#define AT91C_DBGU_TCR ((AT91_REG *) 0xFFFFF30C) // (PDC_DBGU) Transmit Counter Register
-#define AT91C_DBGU_RPR ((AT91_REG *) 0xFFFFF300) // (PDC_DBGU) Receive Pointer Register
-#define AT91C_DBGU_TPR ((AT91_REG *) 0xFFFFF308) // (PDC_DBGU) Transmit Pointer Register
-#define AT91C_DBGU_RNPR ((AT91_REG *) 0xFFFFF310) // (PDC_DBGU) Receive Next Pointer Register
-#define AT91C_DBGU_TNPR ((AT91_REG *) 0xFFFFF318) // (PDC_DBGU) Transmit Next Pointer Register
-// ========== Register definition for DBGU peripheral ==========
-#define AT91C_DBGU_EXID ((AT91_REG *) 0xFFFFF244) // (DBGU) Chip ID Extension Register
-#define AT91C_DBGU_THR ((AT91_REG *) 0xFFFFF21C) // (DBGU) Transmitter Holding Register
-#define AT91C_DBGU_CSR ((AT91_REG *) 0xFFFFF214) // (DBGU) Channel Status Register
-#define AT91C_DBGU_IDR ((AT91_REG *) 0xFFFFF20C) // (DBGU) Interrupt Disable Register
-#define AT91C_DBGU_MR ((AT91_REG *) 0xFFFFF204) // (DBGU) Mode Register
-#define AT91C_DBGU_FNTR ((AT91_REG *) 0xFFFFF248) // (DBGU) Force NTRST Register
-#define AT91C_DBGU_CIDR ((AT91_REG *) 0xFFFFF240) // (DBGU) Chip ID Register
-#define AT91C_DBGU_BRGR ((AT91_REG *) 0xFFFFF220) // (DBGU) Baud Rate Generator Register
-#define AT91C_DBGU_RHR ((AT91_REG *) 0xFFFFF218) // (DBGU) Receiver Holding Register
-#define AT91C_DBGU_IMR ((AT91_REG *) 0xFFFFF210) // (DBGU) Interrupt Mask Register
-#define AT91C_DBGU_IER ((AT91_REG *) 0xFFFFF208) // (DBGU) Interrupt Enable Register
-#define AT91C_DBGU_CR ((AT91_REG *) 0xFFFFF200) // (DBGU) Control Register
-// ========== Register definition for PIOA peripheral ==========
-#define AT91C_PIOA_IMR ((AT91_REG *) 0xFFFFF448) // (PIOA) Interrupt Mask Register
-#define AT91C_PIOA_IER ((AT91_REG *) 0xFFFFF440) // (PIOA) Interrupt Enable Register
-#define AT91C_PIOA_OWDR ((AT91_REG *) 0xFFFFF4A4) // (PIOA) Output Write Disable Register
-#define AT91C_PIOA_ISR ((AT91_REG *) 0xFFFFF44C) // (PIOA) Interrupt Status Register
-#define AT91C_PIOA_PPUDR ((AT91_REG *) 0xFFFFF460) // (PIOA) Pull-up Disable Register
-#define AT91C_PIOA_MDSR ((AT91_REG *) 0xFFFFF458) // (PIOA) Multi-driver Status Register
-#define AT91C_PIOA_MDER ((AT91_REG *) 0xFFFFF450) // (PIOA) Multi-driver Enable Register
-#define AT91C_PIOA_PER ((AT91_REG *) 0xFFFFF400) // (PIOA) PIO Enable Register
-#define AT91C_PIOA_PSR ((AT91_REG *) 0xFFFFF408) // (PIOA) PIO Status Register
-#define AT91C_PIOA_OER ((AT91_REG *) 0xFFFFF410) // (PIOA) Output Enable Register
-#define AT91C_PIOA_BSR ((AT91_REG *) 0xFFFFF474) // (PIOA) Select B Register
-#define AT91C_PIOA_PPUER ((AT91_REG *) 0xFFFFF464) // (PIOA) Pull-up Enable Register
-#define AT91C_PIOA_MDDR ((AT91_REG *) 0xFFFFF454) // (PIOA) Multi-driver Disable Register
-#define AT91C_PIOA_PDR ((AT91_REG *) 0xFFFFF404) // (PIOA) PIO Disable Register
-#define AT91C_PIOA_ODR ((AT91_REG *) 0xFFFFF414) // (PIOA) Output Disable Registerr
-#define AT91C_PIOA_IFDR ((AT91_REG *) 0xFFFFF424) // (PIOA) Input Filter Disable Register
-#define AT91C_PIOA_ABSR ((AT91_REG *) 0xFFFFF478) // (PIOA) AB Select Status Register
-#define AT91C_PIOA_ASR ((AT91_REG *) 0xFFFFF470) // (PIOA) Select A Register
-#define AT91C_PIOA_PPUSR ((AT91_REG *) 0xFFFFF468) // (PIOA) Pull-up Status Register
-#define AT91C_PIOA_ODSR ((AT91_REG *) 0xFFFFF438) // (PIOA) Output Data Status Register
-#define AT91C_PIOA_SODR ((AT91_REG *) 0xFFFFF430) // (PIOA) Set Output Data Register
-#define AT91C_PIOA_IFSR ((AT91_REG *) 0xFFFFF428) // (PIOA) Input Filter Status Register
-#define AT91C_PIOA_IFER ((AT91_REG *) 0xFFFFF420) // (PIOA) Input Filter Enable Register
-#define AT91C_PIOA_OSR ((AT91_REG *) 0xFFFFF418) // (PIOA) Output Status Register
-#define AT91C_PIOA_IDR ((AT91_REG *) 0xFFFFF444) // (PIOA) Interrupt Disable Register
-#define AT91C_PIOA_PDSR ((AT91_REG *) 0xFFFFF43C) // (PIOA) Pin Data Status Register
-#define AT91C_PIOA_CODR ((AT91_REG *) 0xFFFFF434) // (PIOA) Clear Output Data Register
-#define AT91C_PIOA_OWSR ((AT91_REG *) 0xFFFFF4A8) // (PIOA) Output Write Status Register
-#define AT91C_PIOA_OWER ((AT91_REG *) 0xFFFFF4A0) // (PIOA) Output Write Enable Register
-// ========== Register definition for PIOB peripheral ==========
-#define AT91C_PIOB_OWSR ((AT91_REG *) 0xFFFFF6A8) // (PIOB) Output Write Status Register
-#define AT91C_PIOB_PPUSR ((AT91_REG *) 0xFFFFF668) // (PIOB) Pull-up Status Register
-#define AT91C_PIOB_PPUDR ((AT91_REG *) 0xFFFFF660) // (PIOB) Pull-up Disable Register
-#define AT91C_PIOB_MDSR ((AT91_REG *) 0xFFFFF658) // (PIOB) Multi-driver Status Register
-#define AT91C_PIOB_MDER ((AT91_REG *) 0xFFFFF650) // (PIOB) Multi-driver Enable Register
-#define AT91C_PIOB_IMR ((AT91_REG *) 0xFFFFF648) // (PIOB) Interrupt Mask Register
-#define AT91C_PIOB_OSR ((AT91_REG *) 0xFFFFF618) // (PIOB) Output Status Register
-#define AT91C_PIOB_OER ((AT91_REG *) 0xFFFFF610) // (PIOB) Output Enable Register
-#define AT91C_PIOB_PSR ((AT91_REG *) 0xFFFFF608) // (PIOB) PIO Status Register
-#define AT91C_PIOB_PER ((AT91_REG *) 0xFFFFF600) // (PIOB) PIO Enable Register
-#define AT91C_PIOB_BSR ((AT91_REG *) 0xFFFFF674) // (PIOB) Select B Register
-#define AT91C_PIOB_PPUER ((AT91_REG *) 0xFFFFF664) // (PIOB) Pull-up Enable Register
-#define AT91C_PIOB_IFDR ((AT91_REG *) 0xFFFFF624) // (PIOB) Input Filter Disable Register
-#define AT91C_PIOB_ODR ((AT91_REG *) 0xFFFFF614) // (PIOB) Output Disable Registerr
-#define AT91C_PIOB_ABSR ((AT91_REG *) 0xFFFFF678) // (PIOB) AB Select Status Register
-#define AT91C_PIOB_ASR ((AT91_REG *) 0xFFFFF670) // (PIOB) Select A Register
-#define AT91C_PIOB_IFER ((AT91_REG *) 0xFFFFF620) // (PIOB) Input Filter Enable Register
-#define AT91C_PIOB_IFSR ((AT91_REG *) 0xFFFFF628) // (PIOB) Input Filter Status Register
-#define AT91C_PIOB_SODR ((AT91_REG *) 0xFFFFF630) // (PIOB) Set Output Data Register
-#define AT91C_PIOB_ODSR ((AT91_REG *) 0xFFFFF638) // (PIOB) Output Data Status Register
-#define AT91C_PIOB_CODR ((AT91_REG *) 0xFFFFF634) // (PIOB) Clear Output Data Register
-#define AT91C_PIOB_PDSR ((AT91_REG *) 0xFFFFF63C) // (PIOB) Pin Data Status Register
-#define AT91C_PIOB_OWER ((AT91_REG *) 0xFFFFF6A0) // (PIOB) Output Write Enable Register
-#define AT91C_PIOB_IER ((AT91_REG *) 0xFFFFF640) // (PIOB) Interrupt Enable Register
-#define AT91C_PIOB_OWDR ((AT91_REG *) 0xFFFFF6A4) // (PIOB) Output Write Disable Register
-#define AT91C_PIOB_MDDR ((AT91_REG *) 0xFFFFF654) // (PIOB) Multi-driver Disable Register
-#define AT91C_PIOB_ISR ((AT91_REG *) 0xFFFFF64C) // (PIOB) Interrupt Status Register
-#define AT91C_PIOB_IDR ((AT91_REG *) 0xFFFFF644) // (PIOB) Interrupt Disable Register
-#define AT91C_PIOB_PDR ((AT91_REG *) 0xFFFFF604) // (PIOB) PIO Disable Register
-// ========== Register definition for CKGR peripheral ==========
-#define AT91C_CKGR_PLLR ((AT91_REG *) 0xFFFFFC2C) // (CKGR) PLL Register
-#define AT91C_CKGR_MCFR ((AT91_REG *) 0xFFFFFC24) // (CKGR) Main Clock Frequency Register
-#define AT91C_CKGR_MOR ((AT91_REG *) 0xFFFFFC20) // (CKGR) Main Oscillator Register
-// ========== Register definition for PMC peripheral ==========
-#define AT91C_PMC_SCSR ((AT91_REG *) 0xFFFFFC08) // (PMC) System Clock Status Register
-#define AT91C_PMC_SCER ((AT91_REG *) 0xFFFFFC00) // (PMC) System Clock Enable Register
-#define AT91C_PMC_IMR ((AT91_REG *) 0xFFFFFC6C) // (PMC) Interrupt Mask Register
-#define AT91C_PMC_IDR ((AT91_REG *) 0xFFFFFC64) // (PMC) Interrupt Disable Register
-#define AT91C_PMC_PCDR ((AT91_REG *) 0xFFFFFC14) // (PMC) Peripheral Clock Disable Register
-#define AT91C_PMC_SCDR ((AT91_REG *) 0xFFFFFC04) // (PMC) System Clock Disable Register
-#define AT91C_PMC_SR ((AT91_REG *) 0xFFFFFC68) // (PMC) Status Register
-#define AT91C_PMC_IER ((AT91_REG *) 0xFFFFFC60) // (PMC) Interrupt Enable Register
-#define AT91C_PMC_MCKR ((AT91_REG *) 0xFFFFFC30) // (PMC) Master Clock Register
-#define AT91C_PMC_MOR ((AT91_REG *) 0xFFFFFC20) // (PMC) Main Oscillator Register
-#define AT91C_PMC_PCER ((AT91_REG *) 0xFFFFFC10) // (PMC) Peripheral Clock Enable Register
-#define AT91C_PMC_PCSR ((AT91_REG *) 0xFFFFFC18) // (PMC) Peripheral Clock Status Register
-#define AT91C_PMC_PLLR ((AT91_REG *) 0xFFFFFC2C) // (PMC) PLL Register
-#define AT91C_PMC_MCFR ((AT91_REG *) 0xFFFFFC24) // (PMC) Main Clock Frequency Register
-#define AT91C_PMC_PCKR ((AT91_REG *) 0xFFFFFC40) // (PMC) Programmable Clock Register
-// ========== Register definition for RSTC peripheral ==========
-#define AT91C_RSTC_RSR ((AT91_REG *) 0xFFFFFD04) // (RSTC) Reset Status Register
-#define AT91C_RSTC_RMR ((AT91_REG *) 0xFFFFFD08) // (RSTC) Reset Mode Register
-#define AT91C_RSTC_RCR ((AT91_REG *) 0xFFFFFD00) // (RSTC) Reset Control Register
-// ========== Register definition for SHDWC peripheral ==========
-#define AT91C_SHDWC_SHMR ((AT91_REG *) 0xFFFFFD14) // (SHDWC) Shut Down Mode Register
-#define AT91C_SHDWC_SHSR ((AT91_REG *) 0xFFFFFD18) // (SHDWC) Shut Down Status Register
-#define AT91C_SHDWC_SHCR ((AT91_REG *) 0xFFFFFD10) // (SHDWC) Shut Down Control Register
-// ========== Register definition for RTTC peripheral ==========
-#define AT91C_RTTC_RTSR ((AT91_REG *) 0xFFFFFD2C) // (RTTC) Real-time Status Register
-#define AT91C_RTTC_RTAR ((AT91_REG *) 0xFFFFFD24) // (RTTC) Real-time Alarm Register
-#define AT91C_RTTC_RTVR ((AT91_REG *) 0xFFFFFD28) // (RTTC) Real-time Value Register
-#define AT91C_RTTC_RTMR ((AT91_REG *) 0xFFFFFD20) // (RTTC) Real-time Mode Register
-// ========== Register definition for PITC peripheral ==========
-#define AT91C_PITC_PIIR ((AT91_REG *) 0xFFFFFD3C) // (PITC) Period Interval Image Register
-#define AT91C_PITC_PISR ((AT91_REG *) 0xFFFFFD34) // (PITC) Period Interval Status Register
-#define AT91C_PITC_PIVR ((AT91_REG *) 0xFFFFFD38) // (PITC) Period Interval Value Register
-#define AT91C_PITC_PIMR ((AT91_REG *) 0xFFFFFD30) // (PITC) Period Interval Mode Register
-// ========== Register definition for WDTC peripheral ==========
-#define AT91C_WDTC_WDMR ((AT91_REG *) 0xFFFFFD44) // (WDTC) Watchdog Mode Register
-#define AT91C_WDTC_WDSR ((AT91_REG *) 0xFFFFFD48) // (WDTC) Watchdog Status Register
-#define AT91C_WDTC_WDCR ((AT91_REG *) 0xFFFFFD40) // (WDTC) Watchdog Control Register
-// ========== Register definition for MC peripheral ==========
-#define AT91C_MC_FCR ((AT91_REG *) 0xFFFFFF64) // (MC) MC Flash Command Register
-#define AT91C_MC_PUER ((AT91_REG *) 0xFFFFFF54) // (MC) MC Protection Unit Enable Register
-#define AT91C_MC_ASR ((AT91_REG *) 0xFFFFFF04) // (MC) MC Abort Status Register
-#define AT91C_MC_FSR ((AT91_REG *) 0xFFFFFF68) // (MC) MC Flash Status Register
-#define AT91C_MC_FMR ((AT91_REG *) 0xFFFFFF60) // (MC) MC Flash Mode Register
-#define AT91C_MC_PUP ((AT91_REG *) 0xFFFFFF50) // (MC) MC Protection Unit Peripherals
-#define AT91C_MC_PUIA ((AT91_REG *) 0xFFFFFF10) // (MC) MC Protection Unit Area
-#define AT91C_MC_AASR ((AT91_REG *) 0xFFFFFF08) // (MC) MC Abort Address Status Register
-#define AT91C_MC_RCR ((AT91_REG *) 0xFFFFFF00) // (MC) MC Remap Control Register
-// ========== Register definition for CAN0_MB0 peripheral ==========
-#define AT91C_CAN0_MB0_MDH ((AT91_REG *) 0xFFF80218) // (CAN0_MB0) MailBox Data High Register
-#define AT91C_CAN0_MB0_MSR ((AT91_REG *) 0xFFF80210) // (CAN0_MB0) MailBox Status Register
-#define AT91C_CAN0_MB0_MID ((AT91_REG *) 0xFFF80208) // (CAN0_MB0) MailBox ID Register
-#define AT91C_CAN0_MB0_MMR ((AT91_REG *) 0xFFF80200) // (CAN0_MB0) MailBox Mode Register
-#define AT91C_CAN0_MB0_MCR ((AT91_REG *) 0xFFF8021C) // (CAN0_MB0) MailBox Control Register
-#define AT91C_CAN0_MB0_MDL ((AT91_REG *) 0xFFF80214) // (CAN0_MB0) MailBox Data Low Register
-#define AT91C_CAN0_MB0_MFID ((AT91_REG *) 0xFFF8020C) // (CAN0_MB0) MailBox Family ID Register
-#define AT91C_CAN0_MB0_MAM ((AT91_REG *) 0xFFF80204) // (CAN0_MB0) MailBox Acceptance Mask Register
-// ========== Register definition for CAN0_MB1 peripheral ==========
-#define AT91C_CAN0_MB1_MDH ((AT91_REG *) 0xFFF80238) // (CAN0_MB1) MailBox Data High Register
-#define AT91C_CAN0_MB1_MSR ((AT91_REG *) 0xFFF80230) // (CAN0_MB1) MailBox Status Register
-#define AT91C_CAN0_MB1_MID ((AT91_REG *) 0xFFF80228) // (CAN0_MB1) MailBox ID Register
-#define AT91C_CAN0_MB1_MMR ((AT91_REG *) 0xFFF80220) // (CAN0_MB1) MailBox Mode Register
-#define AT91C_CAN0_MB1_MCR ((AT91_REG *) 0xFFF8023C) // (CAN0_MB1) MailBox Control Register
-#define AT91C_CAN0_MB1_MDL ((AT91_REG *) 0xFFF80234) // (CAN0_MB1) MailBox Data Low Register
-#define AT91C_CAN0_MB1_MFID ((AT91_REG *) 0xFFF8022C) // (CAN0_MB1) MailBox Family ID Register
-#define AT91C_CAN0_MB1_MAM ((AT91_REG *) 0xFFF80224) // (CAN0_MB1) MailBox Acceptance Mask Register
-// ========== Register definition for CAN0_MB2 peripheral ==========
-#define AT91C_CAN0_MB2_MDH ((AT91_REG *) 0xFFF80258) // (CAN0_MB2) MailBox Data High Register
-#define AT91C_CAN0_MB2_MSR ((AT91_REG *) 0xFFF80250) // (CAN0_MB2) MailBox Status Register
-#define AT91C_CAN0_MB2_MID ((AT91_REG *) 0xFFF80248) // (CAN0_MB2) MailBox ID Register
-#define AT91C_CAN0_MB2_MMR ((AT91_REG *) 0xFFF80240) // (CAN0_MB2) MailBox Mode Register
-#define AT91C_CAN0_MB2_MCR ((AT91_REG *) 0xFFF8025C) // (CAN0_MB2) MailBox Control Register
-#define AT91C_CAN0_MB2_MDL ((AT91_REG *) 0xFFF80254) // (CAN0_MB2) MailBox Data Low Register
-#define AT91C_CAN0_MB2_MFID ((AT91_REG *) 0xFFF8024C) // (CAN0_MB2) MailBox Family ID Register
-#define AT91C_CAN0_MB2_MAM ((AT91_REG *) 0xFFF80244) // (CAN0_MB2) MailBox Acceptance Mask Register
-// ========== Register definition for CAN0_MB3 peripheral ==========
-#define AT91C_CAN0_MB3_MDH ((AT91_REG *) 0xFFF80278) // (CAN0_MB3) MailBox Data High Register
-#define AT91C_CAN0_MB3_MSR ((AT91_REG *) 0xFFF80270) // (CAN0_MB3) MailBox Status Register
-#define AT91C_CAN0_MB3_MID ((AT91_REG *) 0xFFF80268) // (CAN0_MB3) MailBox ID Register
-#define AT91C_CAN0_MB3_MMR ((AT91_REG *) 0xFFF80260) // (CAN0_MB3) MailBox Mode Register
-#define AT91C_CAN0_MB3_MCR ((AT91_REG *) 0xFFF8027C) // (CAN0_MB3) MailBox Control Register
-#define AT91C_CAN0_MB3_MDL ((AT91_REG *) 0xFFF80274) // (CAN0_MB3) MailBox Data Low Register
-#define AT91C_CAN0_MB3_MFID ((AT91_REG *) 0xFFF8026C) // (CAN0_MB3) MailBox Family ID Register
-#define AT91C_CAN0_MB3_MAM ((AT91_REG *) 0xFFF80264) // (CAN0_MB3) MailBox Acceptance Mask Register
-// ========== Register definition for CAN0_MB4 peripheral ==========
-#define AT91C_CAN0_MB4_MDH ((AT91_REG *) 0xFFF80298) // (CAN0_MB4) MailBox Data High Register
-#define AT91C_CAN0_MB4_MSR ((AT91_REG *) 0xFFF80290) // (CAN0_MB4) MailBox Status Register
-#define AT91C_CAN0_MB4_MID ((AT91_REG *) 0xFFF80288) // (CAN0_MB4) MailBox ID Register
-#define AT91C_CAN0_MB4_MMR ((AT91_REG *) 0xFFF80280) // (CAN0_MB4) MailBox Mode Register
-#define AT91C_CAN0_MB4_MCR ((AT91_REG *) 0xFFF8029C) // (CAN0_MB4) MailBox Control Register
-#define AT91C_CAN0_MB4_MDL ((AT91_REG *) 0xFFF80294) // (CAN0_MB4) MailBox Data Low Register
-#define AT91C_CAN0_MB4_MFID ((AT91_REG *) 0xFFF8028C) // (CAN0_MB4) MailBox Family ID Register
-#define AT91C_CAN0_MB4_MAM ((AT91_REG *) 0xFFF80284) // (CAN0_MB4) MailBox Acceptance Mask Register
-// ========== Register definition for CAN0_MB5 peripheral ==========
-#define AT91C_CAN0_MB5_MSR ((AT91_REG *) 0xFFF802B0) // (CAN0_MB5) MailBox Status Register
-#define AT91C_CAN0_MB5_MID ((AT91_REG *) 0xFFF802A8) // (CAN0_MB5) MailBox ID Register
-#define AT91C_CAN0_MB5_MMR ((AT91_REG *) 0xFFF802A0) // (CAN0_MB5) MailBox Mode Register
-#define AT91C_CAN0_MB5_MCR ((AT91_REG *) 0xFFF802BC) // (CAN0_MB5) MailBox Control Register
-#define AT91C_CAN0_MB5_MDL ((AT91_REG *) 0xFFF802B4) // (CAN0_MB5) MailBox Data Low Register
-#define AT91C_CAN0_MB5_MFID ((AT91_REG *) 0xFFF802AC) // (CAN0_MB5) MailBox Family ID Register
-#define AT91C_CAN0_MB5_MAM ((AT91_REG *) 0xFFF802A4) // (CAN0_MB5) MailBox Acceptance Mask Register
-#define AT91C_CAN0_MB5_MDH ((AT91_REG *) 0xFFF802B8) // (CAN0_MB5) MailBox Data High Register
-// ========== Register definition for CAN0_MB6 peripheral ==========
-#define AT91C_CAN0_MB6_MCR ((AT91_REG *) 0xFFF802DC) // (CAN0_MB6) MailBox Control Register
-#define AT91C_CAN0_MB6_MDL ((AT91_REG *) 0xFFF802D4) // (CAN0_MB6) MailBox Data Low Register
-#define AT91C_CAN0_MB6_MFID ((AT91_REG *) 0xFFF802CC) // (CAN0_MB6) MailBox Family ID Register
-#define AT91C_CAN0_MB6_MAM ((AT91_REG *) 0xFFF802C4) // (CAN0_MB6) MailBox Acceptance Mask Register
-#define AT91C_CAN0_MB6_MDH ((AT91_REG *) 0xFFF802D8) // (CAN0_MB6) MailBox Data High Register
-#define AT91C_CAN0_MB6_MSR ((AT91_REG *) 0xFFF802D0) // (CAN0_MB6) MailBox Status Register
-#define AT91C_CAN0_MB6_MID ((AT91_REG *) 0xFFF802C8) // (CAN0_MB6) MailBox ID Register
-#define AT91C_CAN0_MB6_MMR ((AT91_REG *) 0xFFF802C0) // (CAN0_MB6) MailBox Mode Register
-// ========== Register definition for CAN0_MB7 peripheral ==========
-#define AT91C_CAN0_MB7_MCR ((AT91_REG *) 0xFFF802FC) // (CAN0_MB7) MailBox Control Register
-#define AT91C_CAN0_MB7_MDL ((AT91_REG *) 0xFFF802F4) // (CAN0_MB7) MailBox Data Low Register
-#define AT91C_CAN0_MB7_MFID ((AT91_REG *) 0xFFF802EC) // (CAN0_MB7) MailBox Family ID Register
-#define AT91C_CAN0_MB7_MAM ((AT91_REG *) 0xFFF802E4) // (CAN0_MB7) MailBox Acceptance Mask Register
-#define AT91C_CAN0_MB7_MDH ((AT91_REG *) 0xFFF802F8) // (CAN0_MB7) MailBox Data High Register
-#define AT91C_CAN0_MB7_MSR ((AT91_REG *) 0xFFF802F0) // (CAN0_MB7) MailBox Status Register
-#define AT91C_CAN0_MB7_MID ((AT91_REG *) 0xFFF802E8) // (CAN0_MB7) MailBox ID Register
-#define AT91C_CAN0_MB7_MMR ((AT91_REG *) 0xFFF802E0) // (CAN0_MB7) MailBox Mode Register
-// ========== Register definition for CAN0_MB8 peripheral ==========
-#define AT91C_CAN0_MB8_MCR ((AT91_REG *) 0xFFF8031C) // (CAN0_MB8) MailBox Control Register
-#define AT91C_CAN0_MB8_MDL ((AT91_REG *) 0xFFF80314) // (CAN0_MB8) MailBox Data Low Register
-#define AT91C_CAN0_MB8_MFID ((AT91_REG *) 0xFFF8030C) // (CAN0_MB8) MailBox Family ID Register
-#define AT91C_CAN0_MB8_MAM ((AT91_REG *) 0xFFF80304) // (CAN0_MB8) MailBox Acceptance Mask Register
-#define AT91C_CAN0_MB8_MDH ((AT91_REG *) 0xFFF80318) // (CAN0_MB8) MailBox Data High Register
-#define AT91C_CAN0_MB8_MMR ((AT91_REG *) 0xFFF80300) // (CAN0_MB8) MailBox Mode Register
-#define AT91C_CAN0_MB8_MID ((AT91_REG *) 0xFFF80308) // (CAN0_MB8) MailBox ID Register
-#define AT91C_CAN0_MB8_MSR ((AT91_REG *) 0xFFF80310) // (CAN0_MB8) MailBox Status Register
-// ========== Register definition for CAN0_MB9 peripheral ==========
-#define AT91C_CAN0_MB9_MCR ((AT91_REG *) 0xFFF8033C) // (CAN0_MB9) MailBox Control Register
-#define AT91C_CAN0_MB9_MDL ((AT91_REG *) 0xFFF80334) // (CAN0_MB9) MailBox Data Low Register
-#define AT91C_CAN0_MB9_MFID ((AT91_REG *) 0xFFF8032C) // (CAN0_MB9) MailBox Family ID Register
-#define AT91C_CAN0_MB9_MAM ((AT91_REG *) 0xFFF80324) // (CAN0_MB9) MailBox Acceptance Mask Register
-#define AT91C_CAN0_MB9_MDH ((AT91_REG *) 0xFFF80338) // (CAN0_MB9) MailBox Data High Register
-#define AT91C_CAN0_MB9_MSR ((AT91_REG *) 0xFFF80330) // (CAN0_MB9) MailBox Status Register
-#define AT91C_CAN0_MB9_MID ((AT91_REG *) 0xFFF80328) // (CAN0_MB9) MailBox ID Register
-#define AT91C_CAN0_MB9_MMR ((AT91_REG *) 0xFFF80320) // (CAN0_MB9) MailBox Mode Register
-// ========== Register definition for CAN0_MB10 peripheral ==========
-#define AT91C_CAN0_MB10_MCR ((AT91_REG *) 0xFFF8035C) // (CAN0_MB10) MailBox Control Register
-#define AT91C_CAN0_MB10_MDL ((AT91_REG *) 0xFFF80354) // (CAN0_MB10) MailBox Data Low Register
-#define AT91C_CAN0_MB10_MFID ((AT91_REG *) 0xFFF8034C) // (CAN0_MB10) MailBox Family ID Register
-#define AT91C_CAN0_MB10_MAM ((AT91_REG *) 0xFFF80344) // (CAN0_MB10) MailBox Acceptance Mask Register
-#define AT91C_CAN0_MB10_MDH ((AT91_REG *) 0xFFF80358) // (CAN0_MB10) MailBox Data High Register
-#define AT91C_CAN0_MB10_MSR ((AT91_REG *) 0xFFF80350) // (CAN0_MB10) MailBox Status Register
-#define AT91C_CAN0_MB10_MID ((AT91_REG *) 0xFFF80348) // (CAN0_MB10) MailBox ID Register
-#define AT91C_CAN0_MB10_MMR ((AT91_REG *) 0xFFF80340) // (CAN0_MB10) MailBox Mode Register
-// ========== Register definition for CAN0_MB11 peripheral ==========
-#define AT91C_CAN0_MB11_MCR ((AT91_REG *) 0xFFF8037C) // (CAN0_MB11) MailBox Control Register
-#define AT91C_CAN0_MB11_MDL ((AT91_REG *) 0xFFF80374) // (CAN0_MB11) MailBox Data Low Register
-#define AT91C_CAN0_MB11_MFID ((AT91_REG *) 0xFFF8036C) // (CAN0_MB11) MailBox Family ID Register
-#define AT91C_CAN0_MB11_MAM ((AT91_REG *) 0xFFF80364) // (CAN0_MB11) MailBox Acceptance Mask Register
-#define AT91C_CAN0_MB11_MDH ((AT91_REG *) 0xFFF80378) // (CAN0_MB11) MailBox Data High Register
-#define AT91C_CAN0_MB11_MSR ((AT91_REG *) 0xFFF80370) // (CAN0_MB11) MailBox Status Register
-#define AT91C_CAN0_MB11_MMR ((AT91_REG *) 0xFFF80360) // (CAN0_MB11) MailBox Mode Register
-#define AT91C_CAN0_MB11_MID ((AT91_REG *) 0xFFF80368) // (CAN0_MB11) MailBox ID Register
-// ========== Register definition for CAN0_MB12 peripheral ==========
-#define AT91C_CAN0_MB12_MCR ((AT91_REG *) 0xFFF8039C) // (CAN0_MB12) MailBox Control Register
-#define AT91C_CAN0_MB12_MDL ((AT91_REG *) 0xFFF80394) // (CAN0_MB12) MailBox Data Low Register
-#define AT91C_CAN0_MB12_MFID ((AT91_REG *) 0xFFF8038C) // (CAN0_MB12) MailBox Family ID Register
-#define AT91C_CAN0_MB12_MAM ((AT91_REG *) 0xFFF80384) // (CAN0_MB12) MailBox Acceptance Mask Register
-#define AT91C_CAN0_MB12_MDH ((AT91_REG *) 0xFFF80398) // (CAN0_MB12) MailBox Data High Register
-#define AT91C_CAN0_MB12_MSR ((AT91_REG *) 0xFFF80390) // (CAN0_MB12) MailBox Status Register
-#define AT91C_CAN0_MB12_MID ((AT91_REG *) 0xFFF80388) // (CAN0_MB12) MailBox ID Register
-#define AT91C_CAN0_MB12_MMR ((AT91_REG *) 0xFFF80380) // (CAN0_MB12) MailBox Mode Register
-// ========== Register definition for CAN0_MB13 peripheral ==========
-#define AT91C_CAN0_MB13_MCR ((AT91_REG *) 0xFFF803BC) // (CAN0_MB13) MailBox Control Register
-#define AT91C_CAN0_MB13_MDL ((AT91_REG *) 0xFFF803B4) // (CAN0_MB13) MailBox Data Low Register
-#define AT91C_CAN0_MB13_MFID ((AT91_REG *) 0xFFF803AC) // (CAN0_MB13) MailBox Family ID Register
-#define AT91C_CAN0_MB13_MAM ((AT91_REG *) 0xFFF803A4) // (CAN0_MB13) MailBox Acceptance Mask Register
-#define AT91C_CAN0_MB13_MDH ((AT91_REG *) 0xFFF803B8) // (CAN0_MB13) MailBox Data High Register
-#define AT91C_CAN0_MB13_MSR ((AT91_REG *) 0xFFF803B0) // (CAN0_MB13) MailBox Status Register
-#define AT91C_CAN0_MB13_MID ((AT91_REG *) 0xFFF803A8) // (CAN0_MB13) MailBox ID Register
-#define AT91C_CAN0_MB13_MMR ((AT91_REG *) 0xFFF803A0) // (CAN0_MB13) MailBox Mode Register
-// ========== Register definition for CAN0_MB14 peripheral ==========
-#define AT91C_CAN0_MB14_MCR ((AT91_REG *) 0xFFF803DC) // (CAN0_MB14) MailBox Control Register
-#define AT91C_CAN0_MB14_MDL ((AT91_REG *) 0xFFF803D4) // (CAN0_MB14) MailBox Data Low Register
-#define AT91C_CAN0_MB14_MFID ((AT91_REG *) 0xFFF803CC) // (CAN0_MB14) MailBox Family ID Register
-#define AT91C_CAN0_MB14_MAM ((AT91_REG *) 0xFFF803C4) // (CAN0_MB14) MailBox Acceptance Mask Register
-#define AT91C_CAN0_MB14_MDH ((AT91_REG *) 0xFFF803D8) // (CAN0_MB14) MailBox Data High Register
-#define AT91C_CAN0_MB14_MSR ((AT91_REG *) 0xFFF803D0) // (CAN0_MB14) MailBox Status Register
-#define AT91C_CAN0_MB14_MID ((AT91_REG *) 0xFFF803C8) // (CAN0_MB14) MailBox ID Register
-#define AT91C_CAN0_MB14_MMR ((AT91_REG *) 0xFFF803C0) // (CAN0_MB14) MailBox Mode Register
-// ========== Register definition for CAN0_MB15 peripheral ==========
-#define AT91C_CAN0_MB15_MMR ((AT91_REG *) 0xFFF803E0) // (CAN0_MB15) MailBox Mode Register
-#define AT91C_CAN0_MB15_MDH ((AT91_REG *) 0xFFF803F8) // (CAN0_MB15) MailBox Data High Register
-#define AT91C_CAN0_MB15_MSR ((AT91_REG *) 0xFFF803F0) // (CAN0_MB15) MailBox Status Register
-#define AT91C_CAN0_MB15_MID ((AT91_REG *) 0xFFF803E8) // (CAN0_MB15) MailBox ID Register
-#define AT91C_CAN0_MB15_MCR ((AT91_REG *) 0xFFF803FC) // (CAN0_MB15) MailBox Control Register
-#define AT91C_CAN0_MB15_MDL ((AT91_REG *) 0xFFF803F4) // (CAN0_MB15) MailBox Data Low Register
-#define AT91C_CAN0_MB15_MFID ((AT91_REG *) 0xFFF803EC) // (CAN0_MB15) MailBox Family ID Register
-#define AT91C_CAN0_MB15_MAM ((AT91_REG *) 0xFFF803E4) // (CAN0_MB15) MailBox Acceptance Mask Register
-// ========== Register definition for CAN0 peripheral ==========
-#define AT91C_CAN0_TCR ((AT91_REG *) 0xFFF80024) // (CAN0) Transfer Command Register
-#define AT91C_CAN0_TIMESTP ((AT91_REG *) 0xFFF8001C) // (CAN0) Time Stamp Register
-#define AT91C_CAN0_BR ((AT91_REG *) 0xFFF80014) // (CAN0) Baudrate Register
-#define AT91C_CAN0_ACR ((AT91_REG *) 0xFFF80028) // (CAN0) Abort Command Register
-#define AT91C_CAN0_VR ((AT91_REG *) 0xFFF800FC) // (CAN0) Version Register
-#define AT91C_CAN0_IER ((AT91_REG *) 0xFFF80004) // (CAN0) Interrupt Enable Register
-#define AT91C_CAN0_IMR ((AT91_REG *) 0xFFF8000C) // (CAN0) Interrupt Mask Register
-#define AT91C_CAN0_MR ((AT91_REG *) 0xFFF80000) // (CAN0) Mode Register
-#define AT91C_CAN0_IDR ((AT91_REG *) 0xFFF80008) // (CAN0) Interrupt Disable Register
-#define AT91C_CAN0_SR ((AT91_REG *) 0xFFF80010) // (CAN0) Status Register
-#define AT91C_CAN0_TIM ((AT91_REG *) 0xFFF80018) // (CAN0) Timer Register
-#define AT91C_CAN0_ECR ((AT91_REG *) 0xFFF80020) // (CAN0) Error Counter Register
-// ========== Register definition for CAN1_MB0 peripheral ==========
-#define AT91C_CAN1_MB0_MDH ((AT91_REG *) 0xFFF84218) // (CAN1_MB0) MailBox Data High Register
-#define AT91C_CAN1_MB0_MSR ((AT91_REG *) 0xFFF84210) // (CAN1_MB0) MailBox Status Register
-#define AT91C_CAN1_MB0_MID ((AT91_REG *) 0xFFF84208) // (CAN1_MB0) MailBox ID Register
-#define AT91C_CAN1_MB0_MMR ((AT91_REG *) 0xFFF84200) // (CAN1_MB0) MailBox Mode Register
-#define AT91C_CAN1_MB0_MCR ((AT91_REG *) 0xFFF8421C) // (CAN1_MB0) MailBox Control Register
-#define AT91C_CAN1_MB0_MDL ((AT91_REG *) 0xFFF84214) // (CAN1_MB0) MailBox Data Low Register
-#define AT91C_CAN1_MB0_MFID ((AT91_REG *) 0xFFF8420C) // (CAN1_MB0) MailBox Family ID Register
-#define AT91C_CAN1_MB0_MAM ((AT91_REG *) 0xFFF84204) // (CAN1_MB0) MailBox Acceptance Mask Register
-// ========== Register definition for CAN1_MB1 peripheral ==========
-#define AT91C_CAN1_MB1_MDH ((AT91_REG *) 0xFFF84238) // (CAN1_MB1) MailBox Data High Register
-#define AT91C_CAN1_MB1_MSR ((AT91_REG *) 0xFFF84230) // (CAN1_MB1) MailBox Status Register
-#define AT91C_CAN1_MB1_MID ((AT91_REG *) 0xFFF84228) // (CAN1_MB1) MailBox ID Register
-#define AT91C_CAN1_MB1_MMR ((AT91_REG *) 0xFFF84220) // (CAN1_MB1) MailBox Mode Register
-#define AT91C_CAN1_MB1_MCR ((AT91_REG *) 0xFFF8423C) // (CAN1_MB1) MailBox Control Register
-#define AT91C_CAN1_MB1_MDL ((AT91_REG *) 0xFFF84234) // (CAN1_MB1) MailBox Data Low Register
-#define AT91C_CAN1_MB1_MFID ((AT91_REG *) 0xFFF8422C) // (CAN1_MB1) MailBox Family ID Register
-#define AT91C_CAN1_MB1_MAM ((AT91_REG *) 0xFFF84224) // (CAN1_MB1) MailBox Acceptance Mask Register
-// ========== Register definition for CAN1_MB2 peripheral ==========
-#define AT91C_CAN1_MB2_MDH ((AT91_REG *) 0xFFF84258) // (CAN1_MB2) MailBox Data High Register
-#define AT91C_CAN1_MB2_MSR ((AT91_REG *) 0xFFF84250) // (CAN1_MB2) MailBox Status Register
-#define AT91C_CAN1_MB2_MID ((AT91_REG *) 0xFFF84248) // (CAN1_MB2) MailBox ID Register
-#define AT91C_CAN1_MB2_MMR ((AT91_REG *) 0xFFF84240) // (CAN1_MB2) MailBox Mode Register
-#define AT91C_CAN1_MB2_MCR ((AT91_REG *) 0xFFF8425C) // (CAN1_MB2) MailBox Control Register
-#define AT91C_CAN1_MB2_MDL ((AT91_REG *) 0xFFF84254) // (CAN1_MB2) MailBox Data Low Register
-#define AT91C_CAN1_MB2_MFID ((AT91_REG *) 0xFFF8424C) // (CAN1_MB2) MailBox Family ID Register
-#define AT91C_CAN1_MB2_MAM ((AT91_REG *) 0xFFF84244) // (CAN1_MB2) MailBox Acceptance Mask Register
-// ========== Register definition for CAN1_MB3 peripheral ==========
-#define AT91C_CAN1_MB3_MCR ((AT91_REG *) 0xFFF8427C) // (CAN1_MB3) MailBox Control Register
-#define AT91C_CAN1_MB3_MFID ((AT91_REG *) 0xFFF8426C) // (CAN1_MB3) MailBox Family ID Register
-#define AT91C_CAN1_MB3_MAM ((AT91_REG *) 0xFFF84264) // (CAN1_MB3) MailBox Acceptance Mask Register
-#define AT91C_CAN1_MB3_MMR ((AT91_REG *) 0xFFF84260) // (CAN1_MB3) MailBox Mode Register
-#define AT91C_CAN1_MB3_MDH ((AT91_REG *) 0xFFF84278) // (CAN1_MB3) MailBox Data High Register
-#define AT91C_CAN1_MB3_MSR ((AT91_REG *) 0xFFF84270) // (CAN1_MB3) MailBox Status Register
-#define AT91C_CAN1_MB3_MID ((AT91_REG *) 0xFFF84268) // (CAN1_MB3) MailBox ID Register
-#define AT91C_CAN1_MB3_MDL ((AT91_REG *) 0xFFF84274) // (CAN1_MB3) MailBox Data Low Register
-// ========== Register definition for CAN1_MB4 peripheral ==========
-#define AT91C_CAN1_MB4_MCR ((AT91_REG *) 0xFFF8429C) // (CAN1_MB4) MailBox Control Register
-#define AT91C_CAN1_MB4_MDL ((AT91_REG *) 0xFFF84294) // (CAN1_MB4) MailBox Data Low Register
-#define AT91C_CAN1_MB4_MFID ((AT91_REG *) 0xFFF8428C) // (CAN1_MB4) MailBox Family ID Register
-#define AT91C_CAN1_MB4_MAM ((AT91_REG *) 0xFFF84284) // (CAN1_MB4) MailBox Acceptance Mask Register
-#define AT91C_CAN1_MB4_MDH ((AT91_REG *) 0xFFF84298) // (CAN1_MB4) MailBox Data High Register
-#define AT91C_CAN1_MB4_MSR ((AT91_REG *) 0xFFF84290) // (CAN1_MB4) MailBox Status Register
-#define AT91C_CAN1_MB4_MID ((AT91_REG *) 0xFFF84288) // (CAN1_MB4) MailBox ID Register
-#define AT91C_CAN1_MB4_MMR ((AT91_REG *) 0xFFF84280) // (CAN1_MB4) MailBox Mode Register
-// ========== Register definition for CAN1_MB5 peripheral ==========
-#define AT91C_CAN1_MB5_MCR ((AT91_REG *) 0xFFF842BC) // (CAN1_MB5) MailBox Control Register
-#define AT91C_CAN1_MB5_MDL ((AT91_REG *) 0xFFF842B4) // (CAN1_MB5) MailBox Data Low Register
-#define AT91C_CAN1_MB5_MFID ((AT91_REG *) 0xFFF842AC) // (CAN1_MB5) MailBox Family ID Register
-#define AT91C_CAN1_MB5_MAM ((AT91_REG *) 0xFFF842A4) // (CAN1_MB5) MailBox Acceptance Mask Register
-#define AT91C_CAN1_MB5_MDH ((AT91_REG *) 0xFFF842B8) // (CAN1_MB5) MailBox Data High Register
-#define AT91C_CAN1_MB5_MSR ((AT91_REG *) 0xFFF842B0) // (CAN1_MB5) MailBox Status Register
-#define AT91C_CAN1_MB5_MID ((AT91_REG *) 0xFFF842A8) // (CAN1_MB5) MailBox ID Register
-#define AT91C_CAN1_MB5_MMR ((AT91_REG *) 0xFFF842A0) // (CAN1_MB5) MailBox Mode Register
-// ========== Register definition for CAN1_MB6 peripheral ==========
-#define AT91C_CAN1_MB6_MDH ((AT91_REG *) 0xFFF842D8) // (CAN1_MB6) MailBox Data High Register
-#define AT91C_CAN1_MB6_MSR ((AT91_REG *) 0xFFF842D0) // (CAN1_MB6) MailBox Status Register
-#define AT91C_CAN1_MB6_MID ((AT91_REG *) 0xFFF842C8) // (CAN1_MB6) MailBox ID Register
-#define AT91C_CAN1_MB6_MMR ((AT91_REG *) 0xFFF842C0) // (CAN1_MB6) MailBox Mode Register
-#define AT91C_CAN1_MB6_MAM ((AT91_REG *) 0xFFF842C4) // (CAN1_MB6) MailBox Acceptance Mask Register
-#define AT91C_CAN1_MB6_MCR ((AT91_REG *) 0xFFF842DC) // (CAN1_MB6) MailBox Control Register
-#define AT91C_CAN1_MB6_MDL ((AT91_REG *) 0xFFF842D4) // (CAN1_MB6) MailBox Data Low Register
-#define AT91C_CAN1_MB6_MFID ((AT91_REG *) 0xFFF842CC) // (CAN1_MB6) MailBox Family ID Register
-// ========== Register definition for CAN1_MB7 peripheral ==========
-#define AT91C_CAN1_MB7_MDH ((AT91_REG *) 0xFFF842F8) // (CAN1_MB7) MailBox Data High Register
-#define AT91C_CAN1_MB7_MSR ((AT91_REG *) 0xFFF842F0) // (CAN1_MB7) MailBox Status Register
-#define AT91C_CAN1_MB7_MID ((AT91_REG *) 0xFFF842E8) // (CAN1_MB7) MailBox ID Register
-#define AT91C_CAN1_MB7_MMR ((AT91_REG *) 0xFFF842E0) // (CAN1_MB7) MailBox Mode Register
-#define AT91C_CAN1_MB7_MCR ((AT91_REG *) 0xFFF842FC) // (CAN1_MB7) MailBox Control Register
-#define AT91C_CAN1_MB7_MDL ((AT91_REG *) 0xFFF842F4) // (CAN1_MB7) MailBox Data Low Register
-#define AT91C_CAN1_MB7_MFID ((AT91_REG *) 0xFFF842EC) // (CAN1_MB7) MailBox Family ID Register
-#define AT91C_CAN1_MB7_MAM ((AT91_REG *) 0xFFF842E4) // (CAN1_MB7) MailBox Acceptance Mask Register
-// ========== Register definition for CAN1_MB8 peripheral ==========
-#define AT91C_CAN1_MB8_MDH ((AT91_REG *) 0xFFF84318) // (CAN1_MB8) MailBox Data High Register
-#define AT91C_CAN1_MB8_MSR ((AT91_REG *) 0xFFF84310) // (CAN1_MB8) MailBox Status Register
-#define AT91C_CAN1_MB8_MID ((AT91_REG *) 0xFFF84308) // (CAN1_MB8) MailBox ID Register
-#define AT91C_CAN1_MB8_MMR ((AT91_REG *) 0xFFF84300) // (CAN1_MB8) MailBox Mode Register
-#define AT91C_CAN1_MB8_MCR ((AT91_REG *) 0xFFF8431C) // (CAN1_MB8) MailBox Control Register
-#define AT91C_CAN1_MB8_MDL ((AT91_REG *) 0xFFF84314) // (CAN1_MB8) MailBox Data Low Register
-#define AT91C_CAN1_MB8_MFID ((AT91_REG *) 0xFFF8430C) // (CAN1_MB8) MailBox Family ID Register
-#define AT91C_CAN1_MB8_MAM ((AT91_REG *) 0xFFF84304) // (CAN1_MB8) MailBox Acceptance Mask Register
-// ========== Register definition for CAN1_MB9 peripheral ==========
-#define AT91C_CAN1_MB9_MID ((AT91_REG *) 0xFFF84328) // (CAN1_MB9) MailBox ID Register
-#define AT91C_CAN1_MB9_MDH ((AT91_REG *) 0xFFF84338) // (CAN1_MB9) MailBox Data High Register
-#define AT91C_CAN1_MB9_MSR ((AT91_REG *) 0xFFF84330) // (CAN1_MB9) MailBox Status Register
-#define AT91C_CAN1_MB9_MMR ((AT91_REG *) 0xFFF84320) // (CAN1_MB9) MailBox Mode Register
-#define AT91C_CAN1_MB9_MCR ((AT91_REG *) 0xFFF8433C) // (CAN1_MB9) MailBox Control Register
-#define AT91C_CAN1_MB9_MDL ((AT91_REG *) 0xFFF84334) // (CAN1_MB9) MailBox Data Low Register
-#define AT91C_CAN1_MB9_MFID ((AT91_REG *) 0xFFF8432C) // (CAN1_MB9) MailBox Family ID Register
-#define AT91C_CAN1_MB9_MAM ((AT91_REG *) 0xFFF84324) // (CAN1_MB9) MailBox Acceptance Mask Register
-// ========== Register definition for CAN1_MB10 peripheral ==========
-#define AT91C_CAN1_MB10_MDH ((AT91_REG *) 0xFFF84358) // (CAN1_MB10) MailBox Data High Register
-#define AT91C_CAN1_MB10_MSR ((AT91_REG *) 0xFFF84350) // (CAN1_MB10) MailBox Status Register
-#define AT91C_CAN1_MB10_MID ((AT91_REG *) 0xFFF84348) // (CAN1_MB10) MailBox ID Register
-#define AT91C_CAN1_MB10_MMR ((AT91_REG *) 0xFFF84340) // (CAN1_MB10) MailBox Mode Register
-#define AT91C_CAN1_MB10_MCR ((AT91_REG *) 0xFFF8435C) // (CAN1_MB10) MailBox Control Register
-#define AT91C_CAN1_MB10_MDL ((AT91_REG *) 0xFFF84354) // (CAN1_MB10) MailBox Data Low Register
-#define AT91C_CAN1_MB10_MFID ((AT91_REG *) 0xFFF8434C) // (CAN1_MB10) MailBox Family ID Register
-#define AT91C_CAN1_MB10_MAM ((AT91_REG *) 0xFFF84344) // (CAN1_MB10) MailBox Acceptance Mask Register
-// ========== Register definition for CAN1_MB11 peripheral ==========
-#define AT91C_CAN1_MB11_MDH ((AT91_REG *) 0xFFF84378) // (CAN1_MB11) MailBox Data High Register
-#define AT91C_CAN1_MB11_MSR ((AT91_REG *) 0xFFF84370) // (CAN1_MB11) MailBox Status Register
-#define AT91C_CAN1_MB11_MID ((AT91_REG *) 0xFFF84368) // (CAN1_MB11) MailBox ID Register
-#define AT91C_CAN1_MB11_MMR ((AT91_REG *) 0xFFF84360) // (CAN1_MB11) MailBox Mode Register
-#define AT91C_CAN1_MB11_MCR ((AT91_REG *) 0xFFF8437C) // (CAN1_MB11) MailBox Control Register
-#define AT91C_CAN1_MB11_MDL ((AT91_REG *) 0xFFF84374) // (CAN1_MB11) MailBox Data Low Register
-#define AT91C_CAN1_MB11_MFID ((AT91_REG *) 0xFFF8436C) // (CAN1_MB11) MailBox Family ID Register
-#define AT91C_CAN1_MB11_MAM ((AT91_REG *) 0xFFF84364) // (CAN1_MB11) MailBox Acceptance Mask Register
-// ========== Register definition for CAN1_MB12 peripheral ==========
-#define AT91C_CAN1_MB12_MDH ((AT91_REG *) 0xFFF84398) // (CAN1_MB12) MailBox Data High Register
-#define AT91C_CAN1_MB12_MSR ((AT91_REG *) 0xFFF84390) // (CAN1_MB12) MailBox Status Register
-#define AT91C_CAN1_MB12_MID ((AT91_REG *) 0xFFF84388) // (CAN1_MB12) MailBox ID Register
-#define AT91C_CAN1_MB12_MMR ((AT91_REG *) 0xFFF84380) // (CAN1_MB12) MailBox Mode Register
-#define AT91C_CAN1_MB12_MCR ((AT91_REG *) 0xFFF8439C) // (CAN1_MB12) MailBox Control Register
-#define AT91C_CAN1_MB12_MDL ((AT91_REG *) 0xFFF84394) // (CAN1_MB12) MailBox Data Low Register
-#define AT91C_CAN1_MB12_MFID ((AT91_REG *) 0xFFF8438C) // (CAN1_MB12) MailBox Family ID Register
-#define AT91C_CAN1_MB12_MAM ((AT91_REG *) 0xFFF84384) // (CAN1_MB12) MailBox Acceptance Mask Register
-// ========== Register definition for CAN1_MB13 peripheral ==========
-#define AT91C_CAN1_MB13_MDH ((AT91_REG *) 0xFFF843B8) // (CAN1_MB13) MailBox Data High Register
-#define AT91C_CAN1_MB13_MSR ((AT91_REG *) 0xFFF843B0) // (CAN1_MB13) MailBox Status Register
-#define AT91C_CAN1_MB13_MID ((AT91_REG *) 0xFFF843A8) // (CAN1_MB13) MailBox ID Register
-#define AT91C_CAN1_MB13_MMR ((AT91_REG *) 0xFFF843A0) // (CAN1_MB13) MailBox Mode Register
-#define AT91C_CAN1_MB13_MCR ((AT91_REG *) 0xFFF843BC) // (CAN1_MB13) MailBox Control Register
-#define AT91C_CAN1_MB13_MDL ((AT91_REG *) 0xFFF843B4) // (CAN1_MB13) MailBox Data Low Register
-#define AT91C_CAN1_MB13_MFID ((AT91_REG *) 0xFFF843AC) // (CAN1_MB13) MailBox Family ID Register
-#define AT91C_CAN1_MB13_MAM ((AT91_REG *) 0xFFF843A4) // (CAN1_MB13) MailBox Acceptance Mask Register
-// ========== Register definition for CAN1_MB14 peripheral ==========
-#define AT91C_CAN1_MB14_MDH ((AT91_REG *) 0xFFF843D8) // (CAN1_MB14) MailBox Data High Register
-#define AT91C_CAN1_MB14_MSR ((AT91_REG *) 0xFFF843D0) // (CAN1_MB14) MailBox Status Register
-#define AT91C_CAN1_MB14_MID ((AT91_REG *) 0xFFF843C8) // (CAN1_MB14) MailBox ID Register
-#define AT91C_CAN1_MB14_MMR ((AT91_REG *) 0xFFF843C0) // (CAN1_MB14) MailBox Mode Register
-#define AT91C_CAN1_MB14_MCR ((AT91_REG *) 0xFFF843DC) // (CAN1_MB14) MailBox Control Register
-#define AT91C_CAN1_MB14_MDL ((AT91_REG *) 0xFFF843D4) // (CAN1_MB14) MailBox Data Low Register
-#define AT91C_CAN1_MB14_MFID ((AT91_REG *) 0xFFF843CC) // (CAN1_MB14) MailBox Family ID Register
-#define AT91C_CAN1_MB14_MAM ((AT91_REG *) 0xFFF843C4) // (CAN1_MB14) MailBox Acceptance Mask Register
-// ========== Register definition for CAN1_MB15 peripheral ==========
-#define AT91C_CAN1_MB15_MDH ((AT91_REG *) 0xFFF843F8) // (CAN1_MB15) MailBox Data High Register
-#define AT91C_CAN1_MB15_MSR ((AT91_REG *) 0xFFF843F0) // (CAN1_MB15) MailBox Status Register
-#define AT91C_CAN1_MB15_MID ((AT91_REG *) 0xFFF843E8) // (CAN1_MB15) MailBox ID Register
-#define AT91C_CAN1_MB15_MMR ((AT91_REG *) 0xFFF843E0) // (CAN1_MB15) MailBox Mode Register
-#define AT91C_CAN1_MB15_MCR ((AT91_REG *) 0xFFF843FC) // (CAN1_MB15) MailBox Control Register
-#define AT91C_CAN1_MB15_MDL ((AT91_REG *) 0xFFF843F4) // (CAN1_MB15) MailBox Data Low Register
-#define AT91C_CAN1_MB15_MFID ((AT91_REG *) 0xFFF843EC) // (CAN1_MB15) MailBox Family ID Register
-#define AT91C_CAN1_MB15_MAM ((AT91_REG *) 0xFFF843E4) // (CAN1_MB15) MailBox Acceptance Mask Register
-// ========== Register definition for CAN1 peripheral ==========
-#define AT91C_CAN1_MR ((AT91_REG *) 0xFFF84000) // (CAN1) Mode Register
-#define AT91C_CAN1_VR ((AT91_REG *) 0xFFF840FC) // (CAN1) Version Register
-#define AT91C_CAN1_TIMESTP ((AT91_REG *) 0xFFF8401C) // (CAN1) Time Stamp Register
-#define AT91C_CAN1_BR ((AT91_REG *) 0xFFF84014) // (CAN1) Baudrate Register
-#define AT91C_CAN1_IMR ((AT91_REG *) 0xFFF8400C) // (CAN1) Interrupt Mask Register
-#define AT91C_CAN1_IER ((AT91_REG *) 0xFFF84004) // (CAN1) Interrupt Enable Register
-#define AT91C_CAN1_ACR ((AT91_REG *) 0xFFF84028) // (CAN1) Abort Command Register
-#define AT91C_CAN1_ECR ((AT91_REG *) 0xFFF84020) // (CAN1) Error Counter Register
-#define AT91C_CAN1_TIM ((AT91_REG *) 0xFFF84018) // (CAN1) Timer Register
-#define AT91C_CAN1_SR ((AT91_REG *) 0xFFF84010) // (CAN1) Status Register
-#define AT91C_CAN1_TCR ((AT91_REG *) 0xFFF84024) // (CAN1) Transfer Command Register
-#define AT91C_CAN1_IDR ((AT91_REG *) 0xFFF84008) // (CAN1) Interrupt Disable Register
-// ========== Register definition for TC0 peripheral ==========
-#define AT91C_TC0_IMR ((AT91_REG *) 0xFFFA002C) // (TC0) Interrupt Mask Register
-#define AT91C_TC0_IER ((AT91_REG *) 0xFFFA0024) // (TC0) Interrupt Enable Register
-#define AT91C_TC0_RC ((AT91_REG *) 0xFFFA001C) // (TC0) Register C
-#define AT91C_TC0_RA ((AT91_REG *) 0xFFFA0014) // (TC0) Register A
-#define AT91C_TC0_CMR ((AT91_REG *) 0xFFFA0004) // (TC0) Channel Mode Register (Capture Mode / Waveform Mode)
-#define AT91C_TC0_IDR ((AT91_REG *) 0xFFFA0028) // (TC0) Interrupt Disable Register
-#define AT91C_TC0_SR ((AT91_REG *) 0xFFFA0020) // (TC0) Status Register
-#define AT91C_TC0_RB ((AT91_REG *) 0xFFFA0018) // (TC0) Register B
-#define AT91C_TC0_CV ((AT91_REG *) 0xFFFA0010) // (TC0) Counter Value
-#define AT91C_TC0_CCR ((AT91_REG *) 0xFFFA0000) // (TC0) Channel Control Register
-// ========== Register definition for TC1 peripheral ==========
-#define AT91C_TC1_IMR ((AT91_REG *) 0xFFFA006C) // (TC1) Interrupt Mask Register
-#define AT91C_TC1_IER ((AT91_REG *) 0xFFFA0064) // (TC1) Interrupt Enable Register
-#define AT91C_TC1_RC ((AT91_REG *) 0xFFFA005C) // (TC1) Register C
-#define AT91C_TC1_RA ((AT91_REG *) 0xFFFA0054) // (TC1) Register A
-#define AT91C_TC1_CMR ((AT91_REG *) 0xFFFA0044) // (TC1) Channel Mode Register (Capture Mode / Waveform Mode)
-#define AT91C_TC1_IDR ((AT91_REG *) 0xFFFA0068) // (TC1) Interrupt Disable Register
-#define AT91C_TC1_SR ((AT91_REG *) 0xFFFA0060) // (TC1) Status Register
-#define AT91C_TC1_RB ((AT91_REG *) 0xFFFA0058) // (TC1) Register B
-#define AT91C_TC1_CV ((AT91_REG *) 0xFFFA0050) // (TC1) Counter Value
-#define AT91C_TC1_CCR ((AT91_REG *) 0xFFFA0040) // (TC1) Channel Control Register
-// ========== Register definition for TC2 peripheral ==========
-#define AT91C_TC2_IMR ((AT91_REG *) 0xFFFA00AC) // (TC2) Interrupt Mask Register
-#define AT91C_TC2_IER ((AT91_REG *) 0xFFFA00A4) // (TC2) Interrupt Enable Register
-#define AT91C_TC2_RC ((AT91_REG *) 0xFFFA009C) // (TC2) Register C
-#define AT91C_TC2_RA ((AT91_REG *) 0xFFFA0094) // (TC2) Register A
-#define AT91C_TC2_CMR ((AT91_REG *) 0xFFFA0084) // (TC2) Channel Mode Register (Capture Mode / Waveform Mode)
-#define AT91C_TC2_IDR ((AT91_REG *) 0xFFFA00A8) // (TC2) Interrupt Disable Register
-#define AT91C_TC2_SR ((AT91_REG *) 0xFFFA00A0) // (TC2) Status Register
-#define AT91C_TC2_RB ((AT91_REG *) 0xFFFA0098) // (TC2) Register B
-#define AT91C_TC2_CV ((AT91_REG *) 0xFFFA0090) // (TC2) Counter Value
-#define AT91C_TC2_CCR ((AT91_REG *) 0xFFFA0080) // (TC2) Channel Control Register
-// ========== Register definition for TCB0 peripheral ==========
-#define AT91C_TCB0_BMR ((AT91_REG *) 0xFFFA00C4) // (TCB0) TC Block Mode Register
-#define AT91C_TCB0_BCR ((AT91_REG *) 0xFFFA00C0) // (TCB0) TC Block Control Register
-// ========== Register definition for TC3 peripheral ==========
-#define AT91C_TC3_IMR ((AT91_REG *) 0xFFFA402C) // (TC3) Interrupt Mask Register
-#define AT91C_TC3_CV ((AT91_REG *) 0xFFFA4010) // (TC3) Counter Value
-#define AT91C_TC3_CCR ((AT91_REG *) 0xFFFA4000) // (TC3) Channel Control Register
-#define AT91C_TC3_IER ((AT91_REG *) 0xFFFA4024) // (TC3) Interrupt Enable Register
-#define AT91C_TC3_CMR ((AT91_REG *) 0xFFFA4004) // (TC3) Channel Mode Register (Capture Mode / Waveform Mode)
-#define AT91C_TC3_RA ((AT91_REG *) 0xFFFA4014) // (TC3) Register A
-#define AT91C_TC3_RC ((AT91_REG *) 0xFFFA401C) // (TC3) Register C
-#define AT91C_TC3_IDR ((AT91_REG *) 0xFFFA4028) // (TC3) Interrupt Disable Register
-#define AT91C_TC3_RB ((AT91_REG *) 0xFFFA4018) // (TC3) Register B
-#define AT91C_TC3_SR ((AT91_REG *) 0xFFFA4020) // (TC3) Status Register
-// ========== Register definition for TC4 peripheral ==========
-#define AT91C_TC4_IMR ((AT91_REG *) 0xFFFA406C) // (TC4) Interrupt Mask Register
-#define AT91C_TC4_IER ((AT91_REG *) 0xFFFA4064) // (TC4) Interrupt Enable Register
-#define AT91C_TC4_RC ((AT91_REG *) 0xFFFA405C) // (TC4) Register C
-#define AT91C_TC4_RA ((AT91_REG *) 0xFFFA4054) // (TC4) Register A
-#define AT91C_TC4_CMR ((AT91_REG *) 0xFFFA4044) // (TC4) Channel Mode Register (Capture Mode / Waveform Mode)
-#define AT91C_TC4_IDR ((AT91_REG *) 0xFFFA4068) // (TC4) Interrupt Disable Register
-#define AT91C_TC4_SR ((AT91_REG *) 0xFFFA4060) // (TC4) Status Register
-#define AT91C_TC4_RB ((AT91_REG *) 0xFFFA4058) // (TC4) Register B
-#define AT91C_TC4_CV ((AT91_REG *) 0xFFFA4050) // (TC4) Counter Value
-#define AT91C_TC4_CCR ((AT91_REG *) 0xFFFA4040) // (TC4) Channel Control Register
-// ========== Register definition for TC5 peripheral ==========
-#define AT91C_TC5_CMR ((AT91_REG *) 0xFFFA4084) // (TC5) Channel Mode Register (Capture Mode / Waveform Mode)
-#define AT91C_TC5_IDR ((AT91_REG *) 0xFFFA40A8) // (TC5) Interrupt Disable Register
-#define AT91C_TC5_SR ((AT91_REG *) 0xFFFA40A0) // (TC5) Status Register
-#define AT91C_TC5_RB ((AT91_REG *) 0xFFFA4098) // (TC5) Register B
-#define AT91C_TC5_CV ((AT91_REG *) 0xFFFA4090) // (TC5) Counter Value
-#define AT91C_TC5_CCR ((AT91_REG *) 0xFFFA4080) // (TC5) Channel Control Register
-#define AT91C_TC5_IMR ((AT91_REG *) 0xFFFA40AC) // (TC5) Interrupt Mask Register
-#define AT91C_TC5_IER ((AT91_REG *) 0xFFFA40A4) // (TC5) Interrupt Enable Register
-#define AT91C_TC5_RC ((AT91_REG *) 0xFFFA409C) // (TC5) Register C
-#define AT91C_TC5_RA ((AT91_REG *) 0xFFFA4094) // (TC5) Register A
-// ========== Register definition for TCB1 peripheral ==========
-#define AT91C_TCB1_BCR ((AT91_REG *) 0xFFFA40C0) // (TCB1) TC Block Control Register
-#define AT91C_TCB1_BMR ((AT91_REG *) 0xFFFA40C4) // (TCB1) TC Block Mode Register
-// ========== Register definition for TC6 peripheral ==========
-#define AT91C_TC6_IDR ((AT91_REG *) 0xFFFA8028) // (TC6) Interrupt Disable Register
-#define AT91C_TC6_SR ((AT91_REG *) 0xFFFA8020) // (TC6) Status Register
-#define AT91C_TC6_RB ((AT91_REG *) 0xFFFA8018) // (TC6) Register B
-#define AT91C_TC6_CV ((AT91_REG *) 0xFFFA8010) // (TC6) Counter Value
-#define AT91C_TC6_CCR ((AT91_REG *) 0xFFFA8000) // (TC6) Channel Control Register
-#define AT91C_TC6_IMR ((AT91_REG *) 0xFFFA802C) // (TC6) Interrupt Mask Register
-#define AT91C_TC6_IER ((AT91_REG *) 0xFFFA8024) // (TC6) Interrupt Enable Register
-#define AT91C_TC6_RC ((AT91_REG *) 0xFFFA801C) // (TC6) Register C
-#define AT91C_TC6_RA ((AT91_REG *) 0xFFFA8014) // (TC6) Register A
-#define AT91C_TC6_CMR ((AT91_REG *) 0xFFFA8004) // (TC6) Channel Mode Register (Capture Mode / Waveform Mode)
-// ========== Register definition for TC7 peripheral ==========
-#define AT91C_TC7_IDR ((AT91_REG *) 0xFFFA8068) // (TC7) Interrupt Disable Register
-#define AT91C_TC7_SR ((AT91_REG *) 0xFFFA8060) // (TC7) Status Register
-#define AT91C_TC7_RB ((AT91_REG *) 0xFFFA8058) // (TC7) Register B
-#define AT91C_TC7_CV ((AT91_REG *) 0xFFFA8050) // (TC7) Counter Value
-#define AT91C_TC7_CCR ((AT91_REG *) 0xFFFA8040) // (TC7) Channel Control Register
-#define AT91C_TC7_IMR ((AT91_REG *) 0xFFFA806C) // (TC7) Interrupt Mask Register
-#define AT91C_TC7_IER ((AT91_REG *) 0xFFFA8064) // (TC7) Interrupt Enable Register
-#define AT91C_TC7_RC ((AT91_REG *) 0xFFFA805C) // (TC7) Register C
-#define AT91C_TC7_RA ((AT91_REG *) 0xFFFA8054) // (TC7) Register A
-#define AT91C_TC7_CMR ((AT91_REG *) 0xFFFA8044) // (TC7) Channel Mode Register (Capture Mode / Waveform Mode)
-// ========== Register definition for TC8 peripheral ==========
-#define AT91C_TC8_CV ((AT91_REG *) 0xFFFA8090) // (TC8) Counter Value
-#define AT91C_TC8_CCR ((AT91_REG *) 0xFFFA8080) // (TC8) Channel Control Register
-#define AT91C_TC8_IMR ((AT91_REG *) 0xFFFA80AC) // (TC8) Interrupt Mask Register
-#define AT91C_TC8_IER ((AT91_REG *) 0xFFFA80A4) // (TC8) Interrupt Enable Register
-#define AT91C_TC8_RC ((AT91_REG *) 0xFFFA809C) // (TC8) Register C
-#define AT91C_TC8_RA ((AT91_REG *) 0xFFFA8094) // (TC8) Register A
-#define AT91C_TC8_CMR ((AT91_REG *) 0xFFFA8084) // (TC8) Channel Mode Register (Capture Mode / Waveform Mode)
-#define AT91C_TC8_IDR ((AT91_REG *) 0xFFFA80A8) // (TC8) Interrupt Disable Register
-#define AT91C_TC8_SR ((AT91_REG *) 0xFFFA80A0) // (TC8) Status Register
-#define AT91C_TC8_RB ((AT91_REG *) 0xFFFA8098) // (TC8) Register B
-// ========== Register definition for TCB2 peripheral ==========
-#define AT91C_TCB2_BMR ((AT91_REG *) 0xFFFA80C4) // (TCB2) TC Block Mode Register
-#define AT91C_TCB2_BCR ((AT91_REG *) 0xFFFA80C0) // (TCB2) TC Block Control Register
-// ========== Register definition for PDC_MCI peripheral ==========
-#define AT91C_MCI_RCR ((AT91_REG *) 0xFFFAC104) // (PDC_MCI) Receive Counter Register
-#define AT91C_MCI_PTCR ((AT91_REG *) 0xFFFAC120) // (PDC_MCI) PDC Transfer Control Register
-#define AT91C_MCI_TNPR ((AT91_REG *) 0xFFFAC118) // (PDC_MCI) Transmit Next Pointer Register
-#define AT91C_MCI_RNPR ((AT91_REG *) 0xFFFAC110) // (PDC_MCI) Receive Next Pointer Register
-#define AT91C_MCI_TPR ((AT91_REG *) 0xFFFAC108) // (PDC_MCI) Transmit Pointer Register
-#define AT91C_MCI_RPR ((AT91_REG *) 0xFFFAC100) // (PDC_MCI) Receive Pointer Register
-#define AT91C_MCI_PTSR ((AT91_REG *) 0xFFFAC124) // (PDC_MCI) PDC Transfer Status Register
-#define AT91C_MCI_TNCR ((AT91_REG *) 0xFFFAC11C) // (PDC_MCI) Transmit Next Counter Register
-#define AT91C_MCI_RNCR ((AT91_REG *) 0xFFFAC114) // (PDC_MCI) Receive Next Counter Register
-#define AT91C_MCI_TCR ((AT91_REG *) 0xFFFAC10C) // (PDC_MCI) Transmit Counter Register
-// ========== Register definition for MCI peripheral ==========
-#define AT91C_MCI_IER ((AT91_REG *) 0xFFFAC044) // (MCI) MCI Interrupt Enable Register
-#define AT91C_MCI_TDR ((AT91_REG *) 0xFFFAC034) // (MCI) MCI Transmit Data Register
-#define AT91C_MCI_IDR ((AT91_REG *) 0xFFFAC048) // (MCI) MCI Interrupt Disable Register
-#define AT91C_MCI_SR ((AT91_REG *) 0xFFFAC040) // (MCI) MCI Status Register
-#define AT91C_MCI_DTOR ((AT91_REG *) 0xFFFAC008) // (MCI) MCI Data Timeout Register
-#define AT91C_MCI_CR ((AT91_REG *) 0xFFFAC000) // (MCI) MCI Control Register
-#define AT91C_MCI_IMR ((AT91_REG *) 0xFFFAC04C) // (MCI) MCI Interrupt Mask Register
-#define AT91C_MCI_MR ((AT91_REG *) 0xFFFAC004) // (MCI) MCI Mode Register
-#define AT91C_MCI_SDCR ((AT91_REG *) 0xFFFAC00C) // (MCI) MCI SD Card Register
-#define AT91C_MCI_CMDR ((AT91_REG *) 0xFFFAC014) // (MCI) MCI Command Register
-#define AT91C_MCI_ARGR ((AT91_REG *) 0xFFFAC010) // (MCI) MCI Argument Register
-#define AT91C_MCI_RSPR ((AT91_REG *) 0xFFFAC020) // (MCI) MCI Response Register
-#define AT91C_MCI_RDR ((AT91_REG *) 0xFFFAC030) // (MCI) MCI Receive Data Register
-// ========== Register definition for UDP peripheral ==========
-#define AT91C_UDP_TXVC ((AT91_REG *) 0xFFFB0074) // (UDP) Transceiver Control Register
-#define AT91C_UDP_ISR ((AT91_REG *) 0xFFFB001C) // (UDP) Interrupt Status Register
-#define AT91C_UDP_IDR ((AT91_REG *) 0xFFFB0014) // (UDP) Interrupt Disable Register
-#define AT91C_UDP_CSR ((AT91_REG *) 0xFFFB0030) // (UDP) Endpoint Control and Status Register
-#define AT91C_UDP_RSTEP ((AT91_REG *) 0xFFFB0028) // (UDP) Reset Endpoint Register
-#define AT91C_UDP_ICR ((AT91_REG *) 0xFFFB0020) // (UDP) Interrupt Clear Register
-#define AT91C_UDP_GLBSTATE ((AT91_REG *) 0xFFFB0004) // (UDP) Global State Register
-#define AT91C_UDP_NUM ((AT91_REG *) 0xFFFB0000) // (UDP) Frame Number Register
-#define AT91C_UDP_FADDR ((AT91_REG *) 0xFFFB0008) // (UDP) Function Address Register
-#define AT91C_UDP_IER ((AT91_REG *) 0xFFFB0010) // (UDP) Interrupt Enable Register
-#define AT91C_UDP_IMR ((AT91_REG *) 0xFFFB0018) // (UDP) Interrupt Mask Register
-#define AT91C_UDP_FDR ((AT91_REG *) 0xFFFB0050) // (UDP) Endpoint FIFO Data Register
-// ========== Register definition for TWI peripheral ==========
-#define AT91C_TWI_RHR ((AT91_REG *) 0xFFFB8030) // (TWI) Receive Holding Register
-#define AT91C_TWI_IDR ((AT91_REG *) 0xFFFB8028) // (TWI) Interrupt Disable Register
-#define AT91C_TWI_SR ((AT91_REG *) 0xFFFB8020) // (TWI) Status Register
-#define AT91C_TWI_CWGR ((AT91_REG *) 0xFFFB8010) // (TWI) Clock Waveform Generator Register
-#define AT91C_TWI_CR ((AT91_REG *) 0xFFFB8000) // (TWI) Control Register
-#define AT91C_TWI_THR ((AT91_REG *) 0xFFFB8034) // (TWI) Transmit Holding Register
-#define AT91C_TWI_IMR ((AT91_REG *) 0xFFFB802C) // (TWI) Interrupt Mask Register
-#define AT91C_TWI_IER ((AT91_REG *) 0xFFFB8024) // (TWI) Interrupt Enable Register
-#define AT91C_TWI_IADR ((AT91_REG *) 0xFFFB800C) // (TWI) Internal Address Register
-#define AT91C_TWI_MMR ((AT91_REG *) 0xFFFB8004) // (TWI) Master Mode Register
-// ========== Register definition for PDC_US0 peripheral ==========
-#define AT91C_US0_PTCR ((AT91_REG *) 0xFFFC0120) // (PDC_US0) PDC Transfer Control Register
-#define AT91C_US0_TNPR ((AT91_REG *) 0xFFFC0118) // (PDC_US0) Transmit Next Pointer Register
-#define AT91C_US0_RNPR ((AT91_REG *) 0xFFFC0110) // (PDC_US0) Receive Next Pointer Register
-#define AT91C_US0_TPR ((AT91_REG *) 0xFFFC0108) // (PDC_US0) Transmit Pointer Register
-#define AT91C_US0_RPR ((AT91_REG *) 0xFFFC0100) // (PDC_US0) Receive Pointer Register
-#define AT91C_US0_PTSR ((AT91_REG *) 0xFFFC0124) // (PDC_US0) PDC Transfer Status Register
-#define AT91C_US0_TNCR ((AT91_REG *) 0xFFFC011C) // (PDC_US0) Transmit Next Counter Register
-#define AT91C_US0_RNCR ((AT91_REG *) 0xFFFC0114) // (PDC_US0) Receive Next Counter Register
-#define AT91C_US0_TCR ((AT91_REG *) 0xFFFC010C) // (PDC_US0) Transmit Counter Register
-#define AT91C_US0_RCR ((AT91_REG *) 0xFFFC0104) // (PDC_US0) Receive Counter Register
-// ========== Register definition for US0 peripheral ==========
-#define AT91C_US0_TTGR ((AT91_REG *) 0xFFFC0028) // (US0) Transmitter Time-guard Register
-#define AT91C_US0_BRGR ((AT91_REG *) 0xFFFC0020) // (US0) Baud Rate Generator Register
-#define AT91C_US0_RHR ((AT91_REG *) 0xFFFC0018) // (US0) Receiver Holding Register
-#define AT91C_US0_IMR ((AT91_REG *) 0xFFFC0010) // (US0) Interrupt Mask Register
-#define AT91C_US0_NER ((AT91_REG *) 0xFFFC0044) // (US0) Nb Errors Register
-#define AT91C_US0_RTOR ((AT91_REG *) 0xFFFC0024) // (US0) Receiver Time-out Register
-#define AT91C_US0_FIDI ((AT91_REG *) 0xFFFC0040) // (US0) FI_DI_Ratio Register
-#define AT91C_US0_CR ((AT91_REG *) 0xFFFC0000) // (US0) Control Register
-#define AT91C_US0_IER ((AT91_REG *) 0xFFFC0008) // (US0) Interrupt Enable Register
-#define AT91C_US0_IF ((AT91_REG *) 0xFFFC004C) // (US0) IRDA_FILTER Register
-#define AT91C_US0_MR ((AT91_REG *) 0xFFFC0004) // (US0) Mode Register
-#define AT91C_US0_IDR ((AT91_REG *) 0xFFFC000C) // (US0) Interrupt Disable Register
-#define AT91C_US0_CSR ((AT91_REG *) 0xFFFC0014) // (US0) Channel Status Register
-#define AT91C_US0_THR ((AT91_REG *) 0xFFFC001C) // (US0) Transmitter Holding Register
-// ========== Register definition for PDC_US1 peripheral ==========
-#define AT91C_US1_PTSR ((AT91_REG *) 0xFFFC4124) // (PDC_US1) PDC Transfer Status Register
-#define AT91C_US1_TNCR ((AT91_REG *) 0xFFFC411C) // (PDC_US1) Transmit Next Counter Register
-#define AT91C_US1_RNCR ((AT91_REG *) 0xFFFC4114) // (PDC_US1) Receive Next Counter Register
-#define AT91C_US1_TCR ((AT91_REG *) 0xFFFC410C) // (PDC_US1) Transmit Counter Register
-#define AT91C_US1_RCR ((AT91_REG *) 0xFFFC4104) // (PDC_US1) Receive Counter Register
-#define AT91C_US1_PTCR ((AT91_REG *) 0xFFFC4120) // (PDC_US1) PDC Transfer Control Register
-#define AT91C_US1_TNPR ((AT91_REG *) 0xFFFC4118) // (PDC_US1) Transmit Next Pointer Register
-#define AT91C_US1_RNPR ((AT91_REG *) 0xFFFC4110) // (PDC_US1) Receive Next Pointer Register
-#define AT91C_US1_TPR ((AT91_REG *) 0xFFFC4108) // (PDC_US1) Transmit Pointer Register
-#define AT91C_US1_RPR ((AT91_REG *) 0xFFFC4100) // (PDC_US1) Receive Pointer Register
-// ========== Register definition for US1 peripheral ==========
-#define AT91C_US1_RHR ((AT91_REG *) 0xFFFC4018) // (US1) Receiver Holding Register
-#define AT91C_US1_IMR ((AT91_REG *) 0xFFFC4010) // (US1) Interrupt Mask Register
-#define AT91C_US1_IER ((AT91_REG *) 0xFFFC4008) // (US1) Interrupt Enable Register
-#define AT91C_US1_CR ((AT91_REG *) 0xFFFC4000) // (US1) Control Register
-#define AT91C_US1_RTOR ((AT91_REG *) 0xFFFC4024) // (US1) Receiver Time-out Register
-#define AT91C_US1_THR ((AT91_REG *) 0xFFFC401C) // (US1) Transmitter Holding Register
-#define AT91C_US1_CSR ((AT91_REG *) 0xFFFC4014) // (US1) Channel Status Register
-#define AT91C_US1_IDR ((AT91_REG *) 0xFFFC400C) // (US1) Interrupt Disable Register
-#define AT91C_US1_FIDI ((AT91_REG *) 0xFFFC4040) // (US1) FI_DI_Ratio Register
-#define AT91C_US1_BRGR ((AT91_REG *) 0xFFFC4020) // (US1) Baud Rate Generator Register
-#define AT91C_US1_TTGR ((AT91_REG *) 0xFFFC4028) // (US1) Transmitter Time-guard Register
-#define AT91C_US1_IF ((AT91_REG *) 0xFFFC404C) // (US1) IRDA_FILTER Register
-#define AT91C_US1_NER ((AT91_REG *) 0xFFFC4044) // (US1) Nb Errors Register
-#define AT91C_US1_MR ((AT91_REG *) 0xFFFC4004) // (US1) Mode Register
-// ========== Register definition for PDC_US2 peripheral ==========
-#define AT91C_US2_PTSR ((AT91_REG *) 0xFFFC8124) // (PDC_US2) PDC Transfer Status Register
-#define AT91C_US2_TNCR ((AT91_REG *) 0xFFFC811C) // (PDC_US2) Transmit Next Counter Register
-#define AT91C_US2_RNCR ((AT91_REG *) 0xFFFC8114) // (PDC_US2) Receive Next Counter Register
-#define AT91C_US2_TCR ((AT91_REG *) 0xFFFC810C) // (PDC_US2) Transmit Counter Register
-#define AT91C_US2_PTCR ((AT91_REG *) 0xFFFC8120) // (PDC_US2) PDC Transfer Control Register
-#define AT91C_US2_RCR ((AT91_REG *) 0xFFFC8104) // (PDC_US2) Receive Counter Register
-#define AT91C_US2_TNPR ((AT91_REG *) 0xFFFC8118) // (PDC_US2) Transmit Next Pointer Register
-#define AT91C_US2_RPR ((AT91_REG *) 0xFFFC8100) // (PDC_US2) Receive Pointer Register
-#define AT91C_US2_TPR ((AT91_REG *) 0xFFFC8108) // (PDC_US2) Transmit Pointer Register
-#define AT91C_US2_RNPR ((AT91_REG *) 0xFFFC8110) // (PDC_US2) Receive Next Pointer Register
-// ========== Register definition for US2 peripheral ==========
-#define AT91C_US2_FIDI ((AT91_REG *) 0xFFFC8040) // (US2) FI_DI_Ratio Register
-#define AT91C_US2_TTGR ((AT91_REG *) 0xFFFC8028) // (US2) Transmitter Time-guard Register
-#define AT91C_US2_BRGR ((AT91_REG *) 0xFFFC8020) // (US2) Baud Rate Generator Register
-#define AT91C_US2_RHR ((AT91_REG *) 0xFFFC8018) // (US2) Receiver Holding Register
-#define AT91C_US2_IMR ((AT91_REG *) 0xFFFC8010) // (US2) Interrupt Mask Register
-#define AT91C_US2_IER ((AT91_REG *) 0xFFFC8008) // (US2) Interrupt Enable Register
-#define AT91C_US2_CR ((AT91_REG *) 0xFFFC8000) // (US2) Control Register
-#define AT91C_US2_IF ((AT91_REG *) 0xFFFC804C) // (US2) IRDA_FILTER Register
-#define AT91C_US2_NER ((AT91_REG *) 0xFFFC8044) // (US2) Nb Errors Register
-#define AT91C_US2_RTOR ((AT91_REG *) 0xFFFC8024) // (US2) Receiver Time-out Register
-#define AT91C_US2_THR ((AT91_REG *) 0xFFFC801C) // (US2) Transmitter Holding Register
-#define AT91C_US2_CSR ((AT91_REG *) 0xFFFC8014) // (US2) Channel Status Register
-#define AT91C_US2_IDR ((AT91_REG *) 0xFFFC800C) // (US2) Interrupt Disable Register
-#define AT91C_US2_MR ((AT91_REG *) 0xFFFC8004) // (US2) Mode Register
-// ========== Register definition for PWMC_CH0 peripheral ==========
-#define AT91C_PWMC_CH0_CUPDR ((AT91_REG *) 0xFFFCC210) // (PWMC_CH0) Channel Update Register
-#define AT91C_PWMC_CH0_CPRDR ((AT91_REG *) 0xFFFCC208) // (PWMC_CH0) Channel Period Register
-#define AT91C_PWMC_CH0_CMR ((AT91_REG *) 0xFFFCC200) // (PWMC_CH0) Channel Mode Register
-#define AT91C_PWMC_CH0_Reserved ((AT91_REG *) 0xFFFCC214) // (PWMC_CH0) Reserved
-#define AT91C_PWMC_CH0_CCNTR ((AT91_REG *) 0xFFFCC20C) // (PWMC_CH0) Channel Counter Register
-#define AT91C_PWMC_CH0_CDTYR ((AT91_REG *) 0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register
-// ========== Register definition for PWMC_CH1 peripheral ==========
-#define AT91C_PWMC_CH1_CUPDR ((AT91_REG *) 0xFFFCC230) // (PWMC_CH1) Channel Update Register
-#define AT91C_PWMC_CH1_CPRDR ((AT91_REG *) 0xFFFCC228) // (PWMC_CH1) Channel Period Register
-#define AT91C_PWMC_CH1_CMR ((AT91_REG *) 0xFFFCC220) // (PWMC_CH1) Channel Mode Register
-#define AT91C_PWMC_CH1_Reserved ((AT91_REG *) 0xFFFCC234) // (PWMC_CH1) Reserved
-#define AT91C_PWMC_CH1_CCNTR ((AT91_REG *) 0xFFFCC22C) // (PWMC_CH1) Channel Counter Register
-#define AT91C_PWMC_CH1_CDTYR ((AT91_REG *) 0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register
-// ========== Register definition for PWMC_CH2 peripheral ==========
-#define AT91C_PWMC_CH2_CUPDR ((AT91_REG *) 0xFFFCC250) // (PWMC_CH2) Channel Update Register
-#define AT91C_PWMC_CH2_CPRDR ((AT91_REG *) 0xFFFCC248) // (PWMC_CH2) Channel Period Register
-#define AT91C_PWMC_CH2_CMR ((AT91_REG *) 0xFFFCC240) // (PWMC_CH2) Channel Mode Register
-#define AT91C_PWMC_CH2_Reserved ((AT91_REG *) 0xFFFCC254) // (PWMC_CH2) Reserved
-#define AT91C_PWMC_CH2_CCNTR ((AT91_REG *) 0xFFFCC24C) // (PWMC_CH2) Channel Counter Register
-#define AT91C_PWMC_CH2_CDTYR ((AT91_REG *) 0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register
-// ========== Register definition for PWMC_CH3 peripheral ==========
-#define AT91C_PWMC_CH3_CUPDR ((AT91_REG *) 0xFFFCC270) // (PWMC_CH3) Channel Update Register
-#define AT91C_PWMC_CH3_CPRDR ((AT91_REG *) 0xFFFCC268) // (PWMC_CH3) Channel Period Register
-#define AT91C_PWMC_CH3_CMR ((AT91_REG *) 0xFFFCC260) // (PWMC_CH3) Channel Mode Register
-#define AT91C_PWMC_CH3_Reserved ((AT91_REG *) 0xFFFCC274) // (PWMC_CH3) Reserved
-#define AT91C_PWMC_CH3_CCNTR ((AT91_REG *) 0xFFFCC26C) // (PWMC_CH3) Channel Counter Register
-#define AT91C_PWMC_CH3_CDTYR ((AT91_REG *) 0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register
-// ========== Register definition for PWMC_CH4 peripheral ==========
-#define AT91C_PWMC_CH4_CUPDR ((AT91_REG *) 0xFFFCC290) // (PWMC_CH4) Channel Update Register
-#define AT91C_PWMC_CH4_CPRDR ((AT91_REG *) 0xFFFCC288) // (PWMC_CH4) Channel Period Register
-#define AT91C_PWMC_CH4_CMR ((AT91_REG *) 0xFFFCC280) // (PWMC_CH4) Channel Mode Register
-#define AT91C_PWMC_CH4_Reserved ((AT91_REG *) 0xFFFCC294) // (PWMC_CH4) Reserved
-#define AT91C_PWMC_CH4_CCNTR ((AT91_REG *) 0xFFFCC28C) // (PWMC_CH4) Channel Counter Register
-#define AT91C_PWMC_CH4_CDTYR ((AT91_REG *) 0xFFFCC284) // (PWMC_CH4) Channel Duty Cycle Register
-// ========== Register definition for PWMC_CH5 peripheral ==========
-#define AT91C_PWMC_CH5_CUPDR ((AT91_REG *) 0xFFFCC2B0) // (PWMC_CH5) Channel Update Register
-#define AT91C_PWMC_CH5_CPRDR ((AT91_REG *) 0xFFFCC2A8) // (PWMC_CH5) Channel Period Register
-#define AT91C_PWMC_CH5_CMR ((AT91_REG *) 0xFFFCC2A0) // (PWMC_CH5) Channel Mode Register
-#define AT91C_PWMC_CH5_Reserved ((AT91_REG *) 0xFFFCC2B4) // (PWMC_CH5) Reserved
-#define AT91C_PWMC_CH5_CCNTR ((AT91_REG *) 0xFFFCC2AC) // (PWMC_CH5) Channel Counter Register
-#define AT91C_PWMC_CH5_CDTYR ((AT91_REG *) 0xFFFCC2A4) // (PWMC_CH5) Channel Duty Cycle Register
-// ========== Register definition for PWMC_CH6 peripheral ==========
-#define AT91C_PWMC_CH6_Reserved ((AT91_REG *) 0xFFFCC2D4) // (PWMC_CH6) Reserved
-#define AT91C_PWMC_CH6_CCNTR ((AT91_REG *) 0xFFFCC2CC) // (PWMC_CH6) Channel Counter Register
-#define AT91C_PWMC_CH6_CDTYR ((AT91_REG *) 0xFFFCC2C4) // (PWMC_CH6) Channel Duty Cycle Register
-#define AT91C_PWMC_CH6_CUPDR ((AT91_REG *) 0xFFFCC2D0) // (PWMC_CH6) Channel Update Register
-#define AT91C_PWMC_CH6_CPRDR ((AT91_REG *) 0xFFFCC2C8) // (PWMC_CH6) Channel Period Register
-#define AT91C_PWMC_CH6_CMR ((AT91_REG *) 0xFFFCC2C0) // (PWMC_CH6) Channel Mode Register
-// ========== Register definition for PWMC_CH7 peripheral ==========
-#define AT91C_PWMC_CH7_Reserved ((AT91_REG *) 0xFFFCC2F4) // (PWMC_CH7) Reserved
-#define AT91C_PWMC_CH7_CCNTR ((AT91_REG *) 0xFFFCC2EC) // (PWMC_CH7) Channel Counter Register
-#define AT91C_PWMC_CH7_CDTYR ((AT91_REG *) 0xFFFCC2E4) // (PWMC_CH7) Channel Duty Cycle Register
-#define AT91C_PWMC_CH7_CUPDR ((AT91_REG *) 0xFFFCC2F0) // (PWMC_CH7) Channel Update Register
-#define AT91C_PWMC_CH7_CPRDR ((AT91_REG *) 0xFFFCC2E8) // (PWMC_CH7) Channel Period Register
-#define AT91C_PWMC_CH7_CMR ((AT91_REG *) 0xFFFCC2E0) // (PWMC_CH7) Channel Mode Register
-// ========== Register definition for PWMC peripheral ==========
-#define AT91C_PWMC_VR ((AT91_REG *) 0xFFFCC0FC) // (PWMC) PWMC Version Register
-#define AT91C_PWMC_ISR ((AT91_REG *) 0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register
-#define AT91C_PWMC_IDR ((AT91_REG *) 0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register
-#define AT91C_PWMC_SR ((AT91_REG *) 0xFFFCC00C) // (PWMC) PWMC Status Register
-#define AT91C_PWMC_ENA ((AT91_REG *) 0xFFFCC004) // (PWMC) PWMC Enable Register
-#define AT91C_PWMC_IMR ((AT91_REG *) 0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register
-#define AT91C_PWMC_MR ((AT91_REG *) 0xFFFCC000) // (PWMC) PWMC Mode Register
-#define AT91C_PWMC_DIS ((AT91_REG *) 0xFFFCC008) // (PWMC) PWMC Disable Register
-#define AT91C_PWMC_IER ((AT91_REG *) 0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register
-// ========== Register definition for PDC_SSC0 peripheral ==========
-#define AT91C_SSC0_PTCR ((AT91_REG *) 0xFFFD0120) // (PDC_SSC0) PDC Transfer Control Register
-#define AT91C_SSC0_TNPR ((AT91_REG *) 0xFFFD0118) // (PDC_SSC0) Transmit Next Pointer Register
-#define AT91C_SSC0_RNPR ((AT91_REG *) 0xFFFD0110) // (PDC_SSC0) Receive Next Pointer Register
-#define AT91C_SSC0_TPR ((AT91_REG *) 0xFFFD0108) // (PDC_SSC0) Transmit Pointer Register
-#define AT91C_SSC0_RPR ((AT91_REG *) 0xFFFD0100) // (PDC_SSC0) Receive Pointer Register
-#define AT91C_SSC0_PTSR ((AT91_REG *) 0xFFFD0124) // (PDC_SSC0) PDC Transfer Status Register
-#define AT91C_SSC0_TNCR ((AT91_REG *) 0xFFFD011C) // (PDC_SSC0) Transmit Next Counter Register
-#define AT91C_SSC0_RNCR ((AT91_REG *) 0xFFFD0114) // (PDC_SSC0) Receive Next Counter Register
-#define AT91C_SSC0_TCR ((AT91_REG *) 0xFFFD010C) // (PDC_SSC0) Transmit Counter Register
-#define AT91C_SSC0_RCR ((AT91_REG *) 0xFFFD0104) // (PDC_SSC0) Receive Counter Register
-// ========== Register definition for SSC0 peripheral ==========
-#define AT91C_SSC0_IMR ((AT91_REG *) 0xFFFD004C) // (SSC0) Interrupt Mask Register
-#define AT91C_SSC0_IER ((AT91_REG *) 0xFFFD0044) // (SSC0) Interrupt Enable Register
-#define AT91C_SSC0_TSHR ((AT91_REG *) 0xFFFD0034) // (SSC0) Transmit Sync Holding Register
-#define AT91C_SSC0_THR ((AT91_REG *) 0xFFFD0024) // (SSC0) Transmit Holding Register
-#define AT91C_SSC0_TFMR ((AT91_REG *) 0xFFFD001C) // (SSC0) Transmit Frame Mode Register
-#define AT91C_SSC0_RFMR ((AT91_REG *) 0xFFFD0014) // (SSC0) Receive Frame Mode Register
-#define AT91C_SSC0_CMR ((AT91_REG *) 0xFFFD0004) // (SSC0) Clock Mode Register
-#define AT91C_SSC0_IDR ((AT91_REG *) 0xFFFD0048) // (SSC0) Interrupt Disable Register
-#define AT91C_SSC0_SR ((AT91_REG *) 0xFFFD0040) // (SSC0) Status Register
-#define AT91C_SSC0_RSHR ((AT91_REG *) 0xFFFD0030) // (SSC0) Receive Sync Holding Register
-#define AT91C_SSC0_RHR ((AT91_REG *) 0xFFFD0020) // (SSC0) Receive Holding Register
-#define AT91C_SSC0_TCMR ((AT91_REG *) 0xFFFD0018) // (SSC0) Transmit Clock Mode Register
-#define AT91C_SSC0_RCMR ((AT91_REG *) 0xFFFD0010) // (SSC0) Receive Clock ModeRegister
-#define AT91C_SSC0_CR ((AT91_REG *) 0xFFFD0000) // (SSC0) Control Register
-// ========== Register definition for PDC_SSC1 peripheral ==========
-#define AT91C_SSC1_PTCR ((AT91_REG *) 0xFFFD4120) // (PDC_SSC1) PDC Transfer Control Register
-#define AT91C_SSC1_TNPR ((AT91_REG *) 0xFFFD4118) // (PDC_SSC1) Transmit Next Pointer Register
-#define AT91C_SSC1_RNPR ((AT91_REG *) 0xFFFD4110) // (PDC_SSC1) Receive Next Pointer Register
-#define AT91C_SSC1_TPR ((AT91_REG *) 0xFFFD4108) // (PDC_SSC1) Transmit Pointer Register
-#define AT91C_SSC1_RPR ((AT91_REG *) 0xFFFD4100) // (PDC_SSC1) Receive Pointer Register
-#define AT91C_SSC1_PTSR ((AT91_REG *) 0xFFFD4124) // (PDC_SSC1) PDC Transfer Status Register
-#define AT91C_SSC1_TNCR ((AT91_REG *) 0xFFFD411C) // (PDC_SSC1) Transmit Next Counter Register
-#define AT91C_SSC1_RNCR ((AT91_REG *) 0xFFFD4114) // (PDC_SSC1) Receive Next Counter Register
-#define AT91C_SSC1_TCR ((AT91_REG *) 0xFFFD410C) // (PDC_SSC1) Transmit Counter Register
-#define AT91C_SSC1_RCR ((AT91_REG *) 0xFFFD4104) // (PDC_SSC1) Receive Counter Register
-// ========== Register definition for SSC1 peripheral ==========
-#define AT91C_SSC1_RFMR ((AT91_REG *) 0xFFFD4014) // (SSC1) Receive Frame Mode Register
-#define AT91C_SSC1_CMR ((AT91_REG *) 0xFFFD4004) // (SSC1) Clock Mode Register
-#define AT91C_SSC1_IDR ((AT91_REG *) 0xFFFD4048) // (SSC1) Interrupt Disable Register
-#define AT91C_SSC1_SR ((AT91_REG *) 0xFFFD4040) // (SSC1) Status Register
-#define AT91C_SSC1_RSHR ((AT91_REG *) 0xFFFD4030) // (SSC1) Receive Sync Holding Register
-#define AT91C_SSC1_RHR ((AT91_REG *) 0xFFFD4020) // (SSC1) Receive Holding Register
-#define AT91C_SSC1_TCMR ((AT91_REG *) 0xFFFD4018) // (SSC1) Transmit Clock Mode Register
-#define AT91C_SSC1_RCMR ((AT91_REG *) 0xFFFD4010) // (SSC1) Receive Clock ModeRegister
-#define AT91C_SSC1_CR ((AT91_REG *) 0xFFFD4000) // (SSC1) Control Register
-#define AT91C_SSC1_IMR ((AT91_REG *) 0xFFFD404C) // (SSC1) Interrupt Mask Register
-#define AT91C_SSC1_IER ((AT91_REG *) 0xFFFD4044) // (SSC1) Interrupt Enable Register
-#define AT91C_SSC1_TSHR ((AT91_REG *) 0xFFFD4034) // (SSC1) Transmit Sync Holding Register
-#define AT91C_SSC1_THR ((AT91_REG *) 0xFFFD4024) // (SSC1) Transmit Holding Register
-#define AT91C_SSC1_TFMR ((AT91_REG *) 0xFFFD401C) // (SSC1) Transmit Frame Mode Register
-// ========== Register definition for PDC_ADC0 peripheral ==========
-#define AT91C_ADC0_PTCR ((AT91_REG *) 0xFFFD8120) // (PDC_ADC0) PDC Transfer Control Register
-#define AT91C_ADC0_TNPR ((AT91_REG *) 0xFFFD8118) // (PDC_ADC0) Transmit Next Pointer Register
-#define AT91C_ADC0_RNPR ((AT91_REG *) 0xFFFD8110) // (PDC_ADC0) Receive Next Pointer Register
-#define AT91C_ADC0_TPR ((AT91_REG *) 0xFFFD8108) // (PDC_ADC0) Transmit Pointer Register
-#define AT91C_ADC0_RPR ((AT91_REG *) 0xFFFD8100) // (PDC_ADC0) Receive Pointer Register
-#define AT91C_ADC0_PTSR ((AT91_REG *) 0xFFFD8124) // (PDC_ADC0) PDC Transfer Status Register
-#define AT91C_ADC0_TNCR ((AT91_REG *) 0xFFFD811C) // (PDC_ADC0) Transmit Next Counter Register
-#define AT91C_ADC0_RNCR ((AT91_REG *) 0xFFFD8114) // (PDC_ADC0) Receive Next Counter Register
-#define AT91C_ADC0_TCR ((AT91_REG *) 0xFFFD810C) // (PDC_ADC0) Transmit Counter Register
-#define AT91C_ADC0_RCR ((AT91_REG *) 0xFFFD8104) // (PDC_ADC0) Receive Counter Register
-// ========== Register definition for ADC0 peripheral ==========
-#define AT91C_ADC0_IMR ((AT91_REG *) 0xFFFD802C) // (ADC0) ADC Interrupt Mask Register
-#define AT91C_ADC0_CDR4 ((AT91_REG *) 0xFFFD8040) // (ADC0) ADC Channel Data Register 4
-#define AT91C_ADC0_CDR2 ((AT91_REG *) 0xFFFD8038) // (ADC0) ADC Channel Data Register 2
-#define AT91C_ADC0_CDR0 ((AT91_REG *) 0xFFFD8030) // (ADC0) ADC Channel Data Register 0
-#define AT91C_ADC0_CDR7 ((AT91_REG *) 0xFFFD804C) // (ADC0) ADC Channel Data Register 7
-#define AT91C_ADC0_CDR1 ((AT91_REG *) 0xFFFD8034) // (ADC0) ADC Channel Data Register 1
-#define AT91C_ADC0_CDR3 ((AT91_REG *) 0xFFFD803C) // (ADC0) ADC Channel Data Register 3
-#define AT91C_ADC0_CDR5 ((AT91_REG *) 0xFFFD8044) // (ADC0) ADC Channel Data Register 5
-#define AT91C_ADC0_MR ((AT91_REG *) 0xFFFD8004) // (ADC0) ADC Mode Register
-#define AT91C_ADC0_CDR6 ((AT91_REG *) 0xFFFD8048) // (ADC0) ADC Channel Data Register 6
-#define AT91C_ADC0_CR ((AT91_REG *) 0xFFFD8000) // (ADC0) ADC Control Register
-#define AT91C_ADC0_CHER ((AT91_REG *) 0xFFFD8010) // (ADC0) ADC Channel Enable Register
-#define AT91C_ADC0_CHSR ((AT91_REG *) 0xFFFD8018) // (ADC0) ADC Channel Status Register
-#define AT91C_ADC0_IER ((AT91_REG *) 0xFFFD8024) // (ADC0) ADC Interrupt Enable Register
-#define AT91C_ADC0_SR ((AT91_REG *) 0xFFFD801C) // (ADC0) ADC Status Register
-#define AT91C_ADC0_CHDR ((AT91_REG *) 0xFFFD8014) // (ADC0) ADC Channel Disable Register
-#define AT91C_ADC0_IDR ((AT91_REG *) 0xFFFD8028) // (ADC0) ADC Interrupt Disable Register
-#define AT91C_ADC0_LCDR ((AT91_REG *) 0xFFFD8020) // (ADC0) ADC Last Converted Data Register
-// ========== Register definition for PDC_ADC1 peripheral ==========
-#define AT91C_ADC1_RPR ((AT91_REG *) 0xFFFDC100) // (PDC_ADC1) Receive Pointer Register
-#define AT91C_ADC1_RCR ((AT91_REG *) 0xFFFDC104) // (PDC_ADC1) Receive Counter Register
-#define AT91C_ADC1_PTSR ((AT91_REG *) 0xFFFDC124) // (PDC_ADC1) PDC Transfer Status Register
-#define AT91C_ADC1_TNCR ((AT91_REG *) 0xFFFDC11C) // (PDC_ADC1) Transmit Next Counter Register
-#define AT91C_ADC1_RNCR ((AT91_REG *) 0xFFFDC114) // (PDC_ADC1) Receive Next Counter Register
-#define AT91C_ADC1_TCR ((AT91_REG *) 0xFFFDC10C) // (PDC_ADC1) Transmit Counter Register
-#define AT91C_ADC1_PTCR ((AT91_REG *) 0xFFFDC120) // (PDC_ADC1) PDC Transfer Control Register
-#define AT91C_ADC1_TNPR ((AT91_REG *) 0xFFFDC118) // (PDC_ADC1) Transmit Next Pointer Register
-#define AT91C_ADC1_RNPR ((AT91_REG *) 0xFFFDC110) // (PDC_ADC1) Receive Next Pointer Register
-#define AT91C_ADC1_TPR ((AT91_REG *) 0xFFFDC108) // (PDC_ADC1) Transmit Pointer Register
-// ========== Register definition for ADC1 peripheral ==========
-#define AT91C_ADC1_CDR1 ((AT91_REG *) 0xFFFDC034) // (ADC1) ADC Channel Data Register 1
-#define AT91C_ADC1_IMR ((AT91_REG *) 0xFFFDC02C) // (ADC1) ADC Interrupt Mask Register
-#define AT91C_ADC1_IER ((AT91_REG *) 0xFFFDC024) // (ADC1) ADC Interrupt Enable Register
-#define AT91C_ADC1_SR ((AT91_REG *) 0xFFFDC01C) // (ADC1) ADC Status Register
-#define AT91C_ADC1_CDR2 ((AT91_REG *) 0xFFFDC038) // (ADC1) ADC Channel Data Register 2
-#define AT91C_ADC1_CDR0 ((AT91_REG *) 0xFFFDC030) // (ADC1) ADC Channel Data Register 0
-#define AT91C_ADC1_CDR3 ((AT91_REG *) 0xFFFDC03C) // (ADC1) ADC Channel Data Register 3
-#define AT91C_ADC1_CDR6 ((AT91_REG *) 0xFFFDC048) // (ADC1) ADC Channel Data Register 6
-#define AT91C_ADC1_CDR4 ((AT91_REG *) 0xFFFDC040) // (ADC1) ADC Channel Data Register 4
-#define AT91C_ADC1_CR ((AT91_REG *) 0xFFFDC000) // (ADC1) ADC Control Register
-#define AT91C_ADC1_CDR7 ((AT91_REG *) 0xFFFDC04C) // (ADC1) ADC Channel Data Register 7
-#define AT91C_ADC1_CDR5 ((AT91_REG *) 0xFFFDC044) // (ADC1) ADC Channel Data Register 5
-#define AT91C_ADC1_CHDR ((AT91_REG *) 0xFFFDC014) // (ADC1) ADC Channel Disable Register
-#define AT91C_ADC1_MR ((AT91_REG *) 0xFFFDC004) // (ADC1) ADC Mode Register
-#define AT91C_ADC1_IDR ((AT91_REG *) 0xFFFDC028) // (ADC1) ADC Interrupt Disable Register
-#define AT91C_ADC1_LCDR ((AT91_REG *) 0xFFFDC020) // (ADC1) ADC Last Converted Data Register
-#define AT91C_ADC1_CHSR ((AT91_REG *) 0xFFFDC018) // (ADC1) ADC Channel Status Register
-#define AT91C_ADC1_CHER ((AT91_REG *) 0xFFFDC010) // (ADC1) ADC Channel Enable Register
-// ========== Register definition for PDC_SPI0 peripheral ==========
-#define AT91C_SPI0_PTCR ((AT91_REG *) 0xFFFE0120) // (PDC_SPI0) PDC Transfer Control Register
-#define AT91C_SPI0_TNPR ((AT91_REG *) 0xFFFE0118) // (PDC_SPI0) Transmit Next Pointer Register
-#define AT91C_SPI0_RNPR ((AT91_REG *) 0xFFFE0110) // (PDC_SPI0) Receive Next Pointer Register
-#define AT91C_SPI0_TPR ((AT91_REG *) 0xFFFE0108) // (PDC_SPI0) Transmit Pointer Register
-#define AT91C_SPI0_RPR ((AT91_REG *) 0xFFFE0100) // (PDC_SPI0) Receive Pointer Register
-#define AT91C_SPI0_PTSR ((AT91_REG *) 0xFFFE0124) // (PDC_SPI0) PDC Transfer Status Register
-#define AT91C_SPI0_TNCR ((AT91_REG *) 0xFFFE011C) // (PDC_SPI0) Transmit Next Counter Register
-#define AT91C_SPI0_RNCR ((AT91_REG *) 0xFFFE0114) // (PDC_SPI0) Receive Next Counter Register
-#define AT91C_SPI0_TCR ((AT91_REG *) 0xFFFE010C) // (PDC_SPI0) Transmit Counter Register
-#define AT91C_SPI0_RCR ((AT91_REG *) 0xFFFE0104) // (PDC_SPI0) Receive Counter Register
-// ========== Register definition for SPI0 peripheral ==========
-#define AT91C_SPI0_CSR ((AT91_REG *) 0xFFFE0030) // (SPI0) Chip Select Register
-#define AT91C_SPI0_IDR ((AT91_REG *) 0xFFFE0018) // (SPI0) Interrupt Disable Register
-#define AT91C_SPI0_SR ((AT91_REG *) 0xFFFE0010) // (SPI0) Status Register
-#define AT91C_SPI0_RDR ((AT91_REG *) 0xFFFE0008) // (SPI0) Receive Data Register
-#define AT91C_SPI0_CR ((AT91_REG *) 0xFFFE0000) // (SPI0) Control Register
-#define AT91C_SPI0_IMR ((AT91_REG *) 0xFFFE001C) // (SPI0) Interrupt Mask Register
-#define AT91C_SPI0_IER ((AT91_REG *) 0xFFFE0014) // (SPI0) Interrupt Enable Register
-#define AT91C_SPI0_TDR ((AT91_REG *) 0xFFFE000C) // (SPI0) Transmit Data Register
-#define AT91C_SPI0_MR ((AT91_REG *) 0xFFFE0004) // (SPI0) Mode Register
-// ========== Register definition for PDC_SPI1 peripheral ==========
-#define AT91C_SPI1_RNPR ((AT91_REG *) 0xFFFE4110) // (PDC_SPI1) Receive Next Pointer Register
-#define AT91C_SPI1_TPR ((AT91_REG *) 0xFFFE4108) // (PDC_SPI1) Transmit Pointer Register
-#define AT91C_SPI1_RPR ((AT91_REG *) 0xFFFE4100) // (PDC_SPI1) Receive Pointer Register
-#define AT91C_SPI1_PTSR ((AT91_REG *) 0xFFFE4124) // (PDC_SPI1) PDC Transfer Status Register
-#define AT91C_SPI1_RCR ((AT91_REG *) 0xFFFE4104) // (PDC_SPI1) Receive Counter Register
-#define AT91C_SPI1_TCR ((AT91_REG *) 0xFFFE410C) // (PDC_SPI1) Transmit Counter Register
-#define AT91C_SPI1_RNCR ((AT91_REG *) 0xFFFE4114) // (PDC_SPI1) Receive Next Counter Register
-#define AT91C_SPI1_TNCR ((AT91_REG *) 0xFFFE411C) // (PDC_SPI1) Transmit Next Counter Register
-#define AT91C_SPI1_TNPR ((AT91_REG *) 0xFFFE4118) // (PDC_SPI1) Transmit Next Pointer Register
-#define AT91C_SPI1_PTCR ((AT91_REG *) 0xFFFE4120) // (PDC_SPI1) PDC Transfer Control Register
-// ========== Register definition for SPI1 peripheral ==========
-#define AT91C_SPI1_CSR ((AT91_REG *) 0xFFFE4030) // (SPI1) Chip Select Register
-#define AT91C_SPI1_IDR ((AT91_REG *) 0xFFFE4018) // (SPI1) Interrupt Disable Register
-#define AT91C_SPI1_SR ((AT91_REG *) 0xFFFE4010) // (SPI1) Status Register
-#define AT91C_SPI1_RDR ((AT91_REG *) 0xFFFE4008) // (SPI1) Receive Data Register
-#define AT91C_SPI1_CR ((AT91_REG *) 0xFFFE4000) // (SPI1) Control Register
-#define AT91C_SPI1_IMR ((AT91_REG *) 0xFFFE401C) // (SPI1) Interrupt Mask Register
-#define AT91C_SPI1_IER ((AT91_REG *) 0xFFFE4014) // (SPI1) Interrupt Enable Register
-#define AT91C_SPI1_TDR ((AT91_REG *) 0xFFFE400C) // (SPI1) Transmit Data Register
-#define AT91C_SPI1_MR ((AT91_REG *) 0xFFFE4004) // (SPI1) Mode Register
-
-// *****************************************************************************
-// PIO DEFINITIONS FOR AT91SAM7A3
-// *****************************************************************************
-#define AT91C_PIO_PA0 ((unsigned int) 1 << 0) // Pin Controlled by PA0
-#define AT91C_PA0_TWD ((unsigned int) AT91C_PIO_PA0) // TWI Two-wire Serial Data
-#define AT91C_PA0_ADTRG0 ((unsigned int) AT91C_PIO_PA0) // ADC0 External Trigger
-#define AT91C_PIO_PA1 ((unsigned int) 1 << 1) // Pin Controlled by PA1
-#define AT91C_PA1_TWCK ((unsigned int) AT91C_PIO_PA1) // TWI Two-wire Serial Clock
-#define AT91C_PA1_ADTRG1 ((unsigned int) AT91C_PIO_PA1) // ADC1 External Trigger
-#define AT91C_PIO_PA10 ((unsigned int) 1 << 10) // Pin Controlled by PA10
-#define AT91C_PA10_TXD2 ((unsigned int) AT91C_PIO_PA10) // USART 2 Transmit Data
-#define AT91C_PA10_SPI1_SPCK ((unsigned int) AT91C_PIO_PA10) // SPI1 Serial Clock
-#define AT91C_PIO_PA11 ((unsigned int) 1 << 11) // Pin Controlled by PA11
-#define AT91C_PA11_SPI0_NPCS0 ((unsigned int) AT91C_PIO_PA11) // SPI0 Peripheral Chip Select 0
-#define AT91C_PIO_PA12 ((unsigned int) 1 << 12) // Pin Controlled by PA12
-#define AT91C_PA12_SPI0_NPCS1 ((unsigned int) AT91C_PIO_PA12) // SPI0 Peripheral Chip Select 1
-#define AT91C_PA12_MCDA1 ((unsigned int) AT91C_PIO_PA12) // Multimedia Card A Data 1
-#define AT91C_PIO_PA13 ((unsigned int) 1 << 13) // Pin Controlled by PA13
-#define AT91C_PA13_SPI0_NPCS2 ((unsigned int) AT91C_PIO_PA13) // SPI0 Peripheral Chip Select 2
-#define AT91C_PA13_MCDA2 ((unsigned int) AT91C_PIO_PA13) // Multimedia Card A Data 2
-#define AT91C_PIO_PA14 ((unsigned int) 1 << 14) // Pin Controlled by PA14
-#define AT91C_PA14_SPI0_NPCS3 ((unsigned int) AT91C_PIO_PA14) // SPI0 Peripheral Chip Select 3
-#define AT91C_PA14_MCDA3 ((unsigned int) AT91C_PIO_PA14) // Multimedia Card A Data 3
-#define AT91C_PIO_PA15 ((unsigned int) 1 << 15) // Pin Controlled by PA15
-#define AT91C_PA15_SPI0_MISO ((unsigned int) AT91C_PIO_PA15) // SPI0 Master In Slave
-#define AT91C_PA15_MCDA0 ((unsigned int) AT91C_PIO_PA15) // Multimedia Card A Data 0
-#define AT91C_PIO_PA16 ((unsigned int) 1 << 16) // Pin Controlled by PA16
-#define AT91C_PA16_SPI0_MOSI ((unsigned int) AT91C_PIO_PA16) // SPI0 Master Out Slave
-#define AT91C_PA16_MCCDA ((unsigned int) AT91C_PIO_PA16) // Multimedia Card A Command
-#define AT91C_PIO_PA17 ((unsigned int) 1 << 17) // Pin Controlled by PA17
-#define AT91C_PA17_SPI0_SPCK ((unsigned int) AT91C_PIO_PA17) // SPI0 Serial Clock
-#define AT91C_PA17_MCCK ((unsigned int) AT91C_PIO_PA17) // Multimedia Card Clock
-#define AT91C_PIO_PA18 ((unsigned int) 1 << 18) // Pin Controlled by PA18
-#define AT91C_PA18_PWM0 ((unsigned int) AT91C_PIO_PA18) // PWMC Channel 0
-#define AT91C_PA18_PCK0 ((unsigned int) AT91C_PIO_PA18) // PMC Programmable Clock Output 0
-#define AT91C_PIO_PA19 ((unsigned int) 1 << 19) // Pin Controlled by PA19
-#define AT91C_PA19_PWM1 ((unsigned int) AT91C_PIO_PA19) // PWMC Channel 1
-#define AT91C_PA19_PCK1 ((unsigned int) AT91C_PIO_PA19) // PMC Programmable Clock Output 1
-#define AT91C_PIO_PA2 ((unsigned int) 1 << 2) // Pin Controlled by PA2
-#define AT91C_PA2_RXD0 ((unsigned int) AT91C_PIO_PA2) // USART 0 Receive Data
-#define AT91C_PIO_PA20 ((unsigned int) 1 << 20) // Pin Controlled by PA20
-#define AT91C_PA20_PWM2 ((unsigned int) AT91C_PIO_PA20) // PWMC Channel 2
-#define AT91C_PA20_PCK2 ((unsigned int) AT91C_PIO_PA20) // PMC Programmable Clock Output 2
-#define AT91C_PIO_PA21 ((unsigned int) 1 << 21) // Pin Controlled by PA21
-#define AT91C_PA21_PWM3 ((unsigned int) AT91C_PIO_PA21) // PWMC Channel 3
-#define AT91C_PA21_PCK3 ((unsigned int) AT91C_PIO_PA21) // PMC Programmable Clock Output 3
-#define AT91C_PIO_PA22 ((unsigned int) 1 << 22) // Pin Controlled by PA22
-#define AT91C_PA22_PWM4 ((unsigned int) AT91C_PIO_PA22) // PWMC Channel 4
-#define AT91C_PA22_IRQ0 ((unsigned int) AT91C_PIO_PA22) // Interrupt input 0
-#define AT91C_PIO_PA23 ((unsigned int) 1 << 23) // Pin Controlled by PA23
-#define AT91C_PA23_PWM5 ((unsigned int) AT91C_PIO_PA23) // PWMC Channel 5
-#define AT91C_PA23_IRQ1 ((unsigned int) AT91C_PIO_PA23) // Interrupt input 1
-#define AT91C_PIO_PA24 ((unsigned int) 1 << 24) // Pin Controlled by PA24
-#define AT91C_PA24_PWM6 ((unsigned int) AT91C_PIO_PA24) // PWMC Channel 6
-#define AT91C_PA24_TCLK4 ((unsigned int) AT91C_PIO_PA24) // Timer Counter 4 external Clock Input
-#define AT91C_PIO_PA25 ((unsigned int) 1 << 25) // Pin Controlled by PA25
-#define AT91C_PA25_PWM7 ((unsigned int) AT91C_PIO_PA25) // PWMC Channel 7
-#define AT91C_PA25_TCLK5 ((unsigned int) AT91C_PIO_PA25) // Timer Counter 5 external Clock Input
-#define AT91C_PIO_PA26 ((unsigned int) 1 << 26) // Pin Controlled by PA26
-#define AT91C_PA26_CANRX0 ((unsigned int) AT91C_PIO_PA26) // CAN Receive 0
-#define AT91C_PIO_PA27 ((unsigned int) 1 << 27) // Pin Controlled by PA27
-#define AT91C_PA27_CANTX0 ((unsigned int) AT91C_PIO_PA27) // CAN Transmit 0
-#define AT91C_PIO_PA28 ((unsigned int) 1 << 28) // Pin Controlled by PA28
-#define AT91C_PA28_CANRX1 ((unsigned int) AT91C_PIO_PA28) // CAN Receive 1
-#define AT91C_PA28_TCLK3 ((unsigned int) AT91C_PIO_PA28) // Timer Counter 3 external Clock Input
-#define AT91C_PIO_PA29 ((unsigned int) 1 << 29) // Pin Controlled by PA29
-#define AT91C_PA29_CANTX1 ((unsigned int) AT91C_PIO_PA29) // CAN Transmit 1
-#define AT91C_PA29_TCLK6 ((unsigned int) AT91C_PIO_PA29) // Timer Counter 6 external clock input
-#define AT91C_PIO_PA3 ((unsigned int) 1 << 3) // Pin Controlled by PA3
-#define AT91C_PA3_TXD0 ((unsigned int) AT91C_PIO_PA3) // USART 0 Transmit Data
-#define AT91C_PIO_PA30 ((unsigned int) 1 << 30) // Pin Controlled by PA30
-#define AT91C_PA30_DRXD ((unsigned int) AT91C_PIO_PA30) // DBGU Debug Receive Data
-#define AT91C_PA30_TCLK7 ((unsigned int) AT91C_PIO_PA30) // Timer Counter 7 external clock input
-#define AT91C_PIO_PA31 ((unsigned int) 1 << 31) // Pin Controlled by PA31
-#define AT91C_PA31_DTXD ((unsigned int) AT91C_PIO_PA31) // DBGU Debug Transmit Data
-#define AT91C_PA31_TCLK8 ((unsigned int) AT91C_PIO_PA31) // Timer Counter 8 external clock input
-#define AT91C_PIO_PA4 ((unsigned int) 1 << 4) // Pin Controlled by PA4
-#define AT91C_PA4_SCK0 ((unsigned int) AT91C_PIO_PA4) // USART 0 Serial Clock
-#define AT91C_PA4_SPI1_NPCS0 ((unsigned int) AT91C_PIO_PA4) // SPI1 Peripheral Chip Select 0
-#define AT91C_PIO_PA5 ((unsigned int) 1 << 5) // Pin Controlled by PA5
-#define AT91C_PA5_RTS0 ((unsigned int) AT91C_PIO_PA5) // USART 0 Ready To Send
-#define AT91C_PA5_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PA5) // SPI1 Peripheral Chip Select 1
-#define AT91C_PIO_PA6 ((unsigned int) 1 << 6) // Pin Controlled by PA6
-#define AT91C_PA6_CTS0 ((unsigned int) AT91C_PIO_PA6) // USART 0 Clear To Send
-#define AT91C_PA6_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PA6) // SPI1 Peripheral Chip Select 2
-#define AT91C_PIO_PA7 ((unsigned int) 1 << 7) // Pin Controlled by PA7
-#define AT91C_PA7_RXD1 ((unsigned int) AT91C_PIO_PA7) // USART 1 Receive Data
-#define AT91C_PA7_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PA7) // SPI1 Peripheral Chip Select 3
-#define AT91C_PIO_PA8 ((unsigned int) 1 << 8) // Pin Controlled by PA8
-#define AT91C_PA8_TXD1 ((unsigned int) AT91C_PIO_PA8) // USART 1 Transmit Data
-#define AT91C_PA8_SPI1_MISO ((unsigned int) AT91C_PIO_PA8) // SPI1 Master In Slave
-#define AT91C_PIO_PA9 ((unsigned int) 1 << 9) // Pin Controlled by PA9
-#define AT91C_PA9_RXD2 ((unsigned int) AT91C_PIO_PA9) // USART 2 Receive Data
-#define AT91C_PA9_SPI1_MOSI ((unsigned int) AT91C_PIO_PA9) // SPI1 Master Out Slave
-#define AT91C_PIO_PB0 ((unsigned int) 1 << 0) // Pin Controlled by PB0
-#define AT91C_PB0_IRQ2 ((unsigned int) AT91C_PIO_PB0) // Interrupt input 2
-#define AT91C_PB0_PWM5 ((unsigned int) AT91C_PIO_PB0) // PWMC Channel 5
-#define AT91C_PIO_PB1 ((unsigned int) 1 << 1) // Pin Controlled by PB1
-#define AT91C_PB1_IRQ3 ((unsigned int) AT91C_PIO_PB1) // Interrupt input 3
-#define AT91C_PB1_PWM6 ((unsigned int) AT91C_PIO_PB1) // PWMC Channel 6
-#define AT91C_PIO_PB10 ((unsigned int) 1 << 10) // Pin Controlled by PB10
-#define AT91C_PB10_TCLK1 ((unsigned int) AT91C_PIO_PB10) // Timer Counter 1 external clock input
-#define AT91C_PB10_RK1 ((unsigned int) AT91C_PIO_PB10) // SSC Receive Clock 1
-#define AT91C_PIO_PB11 ((unsigned int) 1 << 11) // Pin Controlled by PB11
-#define AT91C_PB11_TCLK2 ((unsigned int) AT91C_PIO_PB11) // Timer Counter 2 external clock input
-#define AT91C_PB11_RF1 ((unsigned int) AT91C_PIO_PB11) // SSC Receive Frame Sync 1
-#define AT91C_PIO_PB12 ((unsigned int) 1 << 12) // Pin Controlled by PB12
-#define AT91C_PB12_TIOA0 ((unsigned int) AT91C_PIO_PB12) // Timer Counter 0 Multipurpose Timer I/O Pin A
-#define AT91C_PB12_TD1 ((unsigned int) AT91C_PIO_PB12) // SSC Transmit Data 1
-#define AT91C_PIO_PB13 ((unsigned int) 1 << 13) // Pin Controlled by PB13
-#define AT91C_PB13_TIOB0 ((unsigned int) AT91C_PIO_PB13) // Timer Counter 0 Multipurpose Timer I/O Pin B
-#define AT91C_PB13_RD1 ((unsigned int) AT91C_PIO_PB13) // SSC Receive Data 1
-#define AT91C_PIO_PB14 ((unsigned int) 1 << 14) // Pin Controlled by PB14
-#define AT91C_PB14_TIOA1 ((unsigned int) AT91C_PIO_PB14) // Timer Counter 1 Multipurpose Timer I/O Pin A
-#define AT91C_PB14_PWM0 ((unsigned int) AT91C_PIO_PB14) // PWMC Channel 0
-#define AT91C_PIO_PB15 ((unsigned int) 1 << 15) // Pin Controlled by PB15
-#define AT91C_PB15_TIOB1 ((unsigned int) AT91C_PIO_PB15) // Timer Counter 1 Multipurpose Timer I/O Pin B
-#define AT91C_PB15_PWM1 ((unsigned int) AT91C_PIO_PB15) // PWMC Channel 1
-#define AT91C_PIO_PB16 ((unsigned int) 1 << 16) // Pin Controlled by PB16
-#define AT91C_PB16_TIOA2 ((unsigned int) AT91C_PIO_PB16) // Timer Counter 2 Multipurpose Timer I/O Pin A
-#define AT91C_PB16_PWM2 ((unsigned int) AT91C_PIO_PB16) // PWMC Channel 2
-#define AT91C_PIO_PB17 ((unsigned int) 1 << 17) // Pin Controlled by PB17
-#define AT91C_PB17_TIOB2 ((unsigned int) AT91C_PIO_PB17) // Timer Counter 2 Multipurpose Timer I/O Pin B
-#define AT91C_PB17_PWM3 ((unsigned int) AT91C_PIO_PB17) // PWMC Channel 3
-#define AT91C_PIO_PB18 ((unsigned int) 1 << 18) // Pin Controlled by PB18
-#define AT91C_PB18_TIOA3 ((unsigned int) AT91C_PIO_PB18) // Timer Counter 3 Multipurpose Timer I/O Pin A
-#define AT91C_PB18_PWM4 ((unsigned int) AT91C_PIO_PB18) // PWMC Channel 4
-#define AT91C_PIO_PB19 ((unsigned int) 1 << 19) // Pin Controlled by PB19
-#define AT91C_PB19_TIOB3 ((unsigned int) AT91C_PIO_PB19) // Timer Counter 3 Multipurpose Timer I/O Pin B
-#define AT91C_PB19_SPI1_NPCS1 ((unsigned int) AT91C_PIO_PB19) // SPI1 Peripheral Chip Select 1
-#define AT91C_PIO_PB2 ((unsigned int) 1 << 2) // Pin Controlled by PB2
-#define AT91C_PB2_TF0 ((unsigned int) AT91C_PIO_PB2) // SSC Transmit Frame Sync 0
-#define AT91C_PB2_PWM7 ((unsigned int) AT91C_PIO_PB2) // PWMC Channel 7
-#define AT91C_PIO_PB20 ((unsigned int) 1 << 20) // Pin Controlled by PB20
-#define AT91C_PB20_TIOA4 ((unsigned int) AT91C_PIO_PB20) // Timer Counter 4 Multipurpose Timer I/O Pin A
-#define AT91C_PB20_SPI1_NPCS2 ((unsigned int) AT91C_PIO_PB20) // SPI1 Peripheral Chip Select 2
-#define AT91C_PIO_PB21 ((unsigned int) 1 << 21) // Pin Controlled by PB21
-#define AT91C_PB21_TIOB4 ((unsigned int) AT91C_PIO_PB21) // Timer Counter 4 Multipurpose Timer I/O Pin B
-#define AT91C_PB21_SPI1_NPCS3 ((unsigned int) AT91C_PIO_PB21) // SPI1 Peripheral Chip Select 3
-#define AT91C_PIO_PB22 ((unsigned int) 1 << 22) // Pin Controlled by PB22
-#define AT91C_PB22_TIOA5 ((unsigned int) AT91C_PIO_PB22) // Timer Counter 5 Multipurpose Timer I/O Pin A
-#define AT91C_PIO_PB23 ((unsigned int) 1 << 23) // Pin Controlled by PB23
-#define AT91C_PB23_TIOB5 ((unsigned int) AT91C_PIO_PB23) // Timer Counter 5 Multipurpose Timer I/O Pin B
-#define AT91C_PIO_PB24 ((unsigned int) 1 << 24) // Pin Controlled by PB24
-#define AT91C_PB24_TIOA6 ((unsigned int) AT91C_PIO_PB24) // Timer Counter 6 Multipurpose Timer I/O Pin A
-#define AT91C_PB24_RTS1 ((unsigned int) AT91C_PIO_PB24) // USART 1 Ready To Send
-#define AT91C_PIO_PB25 ((unsigned int) 1 << 25) // Pin Controlled by PB25
-#define AT91C_PB25_TIOB6 ((unsigned int) AT91C_PIO_PB25) // Timer Counter 6 Multipurpose Timer I/O Pin B
-#define AT91C_PB25_CTS1 ((unsigned int) AT91C_PIO_PB25) // USART 1 Clear To Send
-#define AT91C_PIO_PB26 ((unsigned int) 1 << 26) // Pin Controlled by PB26
-#define AT91C_PB26_TIOA7 ((unsigned int) AT91C_PIO_PB26) // Timer Counter 7 Multipurpose Timer I/O Pin A
-#define AT91C_PB26_SCK1 ((unsigned int) AT91C_PIO_PB26) // USART 1 Serial Clock
-#define AT91C_PIO_PB27 ((unsigned int) 1 << 27) // Pin Controlled by PB27
-#define AT91C_PB27_TIOB7 ((unsigned int) AT91C_PIO_PB27) // Timer Counter 7 Multipurpose Timer I/O Pin B
-#define AT91C_PB27_RTS2 ((unsigned int) AT91C_PIO_PB27) // USART 2 Ready To Send
-#define AT91C_PIO_PB28 ((unsigned int) 1 << 28) // Pin Controlled by PB28
-#define AT91C_PB28_TIOA8 ((unsigned int) AT91C_PIO_PB28) // Timer Counter 8 Multipurpose Timer I/O Pin A
-#define AT91C_PB28_CTS2 ((unsigned int) AT91C_PIO_PB28) // USART 2 Clear To Send
-#define AT91C_PIO_PB29 ((unsigned int) 1 << 29) // Pin Controlled by PB29
-#define AT91C_PB29_TIOB8 ((unsigned int) AT91C_PIO_PB29) // Timer Counter 8 Multipurpose Timer I/O Pin B
-#define AT91C_PB29_SCK2 ((unsigned int) AT91C_PIO_PB29) // USART 2 Serial Clock
-#define AT91C_PIO_PB3 ((unsigned int) 1 << 3) // Pin Controlled by PB3
-#define AT91C_PB3_TK0 ((unsigned int) AT91C_PIO_PB3) // SSC Transmit Clock 0
-#define AT91C_PB3_PCK0 ((unsigned int) AT91C_PIO_PB3) // PMC Programmable Clock Output 0
-#define AT91C_PIO_PB4 ((unsigned int) 1 << 4) // Pin Controlled by PB4
-#define AT91C_PB4_TD0 ((unsigned int) AT91C_PIO_PB4) // SSC Transmit data
-#define AT91C_PB4_PCK1 ((unsigned int) AT91C_PIO_PB4) // PMC Programmable Clock Output 1
-#define AT91C_PIO_PB5 ((unsigned int) 1 << 5) // Pin Controlled by PB5
-#define AT91C_PB5_RD0 ((unsigned int) AT91C_PIO_PB5) // SSC Receive Data
-#define AT91C_PB5_PCK2 ((unsigned int) AT91C_PIO_PB5) // PMC Programmable Clock Output 2
-#define AT91C_PIO_PB6 ((unsigned int) 1 << 6) // Pin Controlled by PB6
-#define AT91C_PB6_RK0 ((unsigned int) AT91C_PIO_PB6) // SSC Receive Clock
-#define AT91C_PB6_PCK3 ((unsigned int) AT91C_PIO_PB6) // PMC Programmable Clock Output 3
-#define AT91C_PIO_PB7 ((unsigned int) 1 << 7) // Pin Controlled by PB7
-#define AT91C_PB7_RF0 ((unsigned int) AT91C_PIO_PB7) // SSC Receive Frame Sync 0
-#define AT91C_PB7_CANTX1 ((unsigned int) AT91C_PIO_PB7) // CAN Transmit 1
-#define AT91C_PIO_PB8 ((unsigned int) 1 << 8) // Pin Controlled by PB8
-#define AT91C_PB8_FIQ ((unsigned int) AT91C_PIO_PB8) // AIC Fast Interrupt Input
-#define AT91C_PB8_TF1 ((unsigned int) AT91C_PIO_PB8) // SSC Transmit Frame Sync 1
-#define AT91C_PIO_PB9 ((unsigned int) 1 << 9) // Pin Controlled by PB9
-#define AT91C_PB9_TCLK0 ((unsigned int) AT91C_PIO_PB9) // Timer Counter 0 external clock input
-#define AT91C_PB9_TK1 ((unsigned int) AT91C_PIO_PB9) // SSC Transmit Clock 1
-
-// *****************************************************************************
-// PERIPHERAL ID DEFINITIONS FOR AT91SAM7A3
-// *****************************************************************************
-#define AT91C_ID_FIQ ((unsigned int) 0) // Advanced Interrupt Controller (FIQ)
-#define AT91C_ID_SYS ((unsigned int) 1) // System Peripheral
-#define AT91C_ID_PIOA ((unsigned int) 2) // Parallel IO Controller A
-#define AT91C_ID_PIOB ((unsigned int) 3) // Parallel IO Controller B
-#define AT91C_ID_CAN0 ((unsigned int) 4) // Control Area Network Controller 0
-#define AT91C_ID_CAN1 ((unsigned int) 5) // Control Area Network Controller 1
-#define AT91C_ID_US0 ((unsigned int) 6) // USART 0
-#define AT91C_ID_US1 ((unsigned int) 7) // USART 1
-#define AT91C_ID_US2 ((unsigned int) 8) // USART 2
-#define AT91C_ID_MCI ((unsigned int) 9) // Multimedia Card Interface
-#define AT91C_ID_TWI ((unsigned int) 10) // Two-Wire Interface
-#define AT91C_ID_SPI0 ((unsigned int) 11) // Serial Peripheral Interface 0
-#define AT91C_ID_SPI1 ((unsigned int) 12) // Serial Peripheral Interface 1
-#define AT91C_ID_SSC0 ((unsigned int) 13) // Serial Synchronous Controller 0
-#define AT91C_ID_SSC1 ((unsigned int) 14) // Serial Synchronous Controller 1
-#define AT91C_ID_TC0 ((unsigned int) 15) // Timer Counter 0
-#define AT91C_ID_TC1 ((unsigned int) 16) // Timer Counter 1
-#define AT91C_ID_TC2 ((unsigned int) 17) // Timer Counter 2
-#define AT91C_ID_TC3 ((unsigned int) 18) // Timer Counter 3
-#define AT91C_ID_TC4 ((unsigned int) 19) // Timer Counter 4
-#define AT91C_ID_TC5 ((unsigned int) 20) // Timer Counter 5
-#define AT91C_ID_TC6 ((unsigned int) 21) // Timer Counter 6
-#define AT91C_ID_TC7 ((unsigned int) 22) // Timer Counter 7
-#define AT91C_ID_TC8 ((unsigned int) 23) // Timer Counter 8
-#define AT91C_ID_ADC0 ((unsigned int) 24) // Analog To Digital Converter 0
-#define AT91C_ID_ADC1 ((unsigned int) 25) // Analog To Digital Converter 1
-#define AT91C_ID_PWMC ((unsigned int) 26) // Pulse Width Modulation Controller
-#define AT91C_ID_UDP ((unsigned int) 27) // USB Device Port
-#define AT91C_ID_IRQ0 ((unsigned int) 28) // Advanced Interrupt Controller (IRQ0)
-#define AT91C_ID_IRQ1 ((unsigned int) 29) // Advanced Interrupt Controller (IRQ1)
-#define AT91C_ID_IRQ2 ((unsigned int) 30) // Advanced Interrupt Controller (IRQ2)
-#define AT91C_ID_IRQ3 ((unsigned int) 31) // Advanced Interrupt Controller (IRQ3)
-#define AT91C_ALL_INT ((unsigned int) 0xFFFFFFFF) // ALL VALID INTERRUPTS
-
-// *****************************************************************************
-// BASE ADDRESS DEFINITIONS FOR AT91SAM7A3
-// *****************************************************************************
-#define AT91C_BASE_SYS ((AT91PS_SYS) 0xFFFFF000) // (SYS) Base Address
-#define AT91C_BASE_AIC ((AT91PS_AIC) 0xFFFFF000) // (AIC) Base Address
-#define AT91C_BASE_PDC_DBGU ((AT91PS_PDC) 0xFFFFF300) // (PDC_DBGU) Base Address
-#define AT91C_BASE_DBGU ((AT91PS_DBGU) 0xFFFFF200) // (DBGU) Base Address
-#define AT91C_BASE_PIOA ((AT91PS_PIO) 0xFFFFF400) // (PIOA) Base Address
-#define AT91C_BASE_PIOB ((AT91PS_PIO) 0xFFFFF600) // (PIOB) Base Address
-#define AT91C_BASE_CKGR ((AT91PS_CKGR) 0xFFFFFC20) // (CKGR) Base Address
-#define AT91C_BASE_PMC ((AT91PS_PMC) 0xFFFFFC00) // (PMC) Base Address
-#define AT91C_BASE_RSTC ((AT91PS_RSTC) 0xFFFFFD00) // (RSTC) Base Address
-#define AT91C_BASE_SHDWC ((AT91PS_SHDWC) 0xFFFFFD10) // (SHDWC) Base Address
-#define AT91C_BASE_RTTC ((AT91PS_RTTC) 0xFFFFFD20) // (RTTC) Base Address
-#define AT91C_BASE_PITC ((AT91PS_PITC) 0xFFFFFD30) // (PITC) Base Address
-#define AT91C_BASE_WDTC ((AT91PS_WDTC) 0xFFFFFD40) // (WDTC) Base Address
-#define AT91C_BASE_MC ((AT91PS_MC) 0xFFFFFF00) // (MC) Base Address
-#define AT91C_BASE_CAN0_MB0 ((AT91PS_CAN_MB) 0xFFF80200) // (CAN0_MB0) Base Address
-#define AT91C_BASE_CAN0_MB1 ((AT91PS_CAN_MB) 0xFFF80220) // (CAN0_MB1) Base Address
-#define AT91C_BASE_CAN0_MB2 ((AT91PS_CAN_MB) 0xFFF80240) // (CAN0_MB2) Base Address
-#define AT91C_BASE_CAN0_MB3 ((AT91PS_CAN_MB) 0xFFF80260) // (CAN0_MB3) Base Address
-#define AT91C_BASE_CAN0_MB4 ((AT91PS_CAN_MB) 0xFFF80280) // (CAN0_MB4) Base Address
-#define AT91C_BASE_CAN0_MB5 ((AT91PS_CAN_MB) 0xFFF802A0) // (CAN0_MB5) Base Address
-#define AT91C_BASE_CAN0_MB6 ((AT91PS_CAN_MB) 0xFFF802C0) // (CAN0_MB6) Base Address
-#define AT91C_BASE_CAN0_MB7 ((AT91PS_CAN_MB) 0xFFF802E0) // (CAN0_MB7) Base Address
-#define AT91C_BASE_CAN0_MB8 ((AT91PS_CAN_MB) 0xFFF80300) // (CAN0_MB8) Base Address
-#define AT91C_BASE_CAN0_MB9 ((AT91PS_CAN_MB) 0xFFF80320) // (CAN0_MB9) Base Address
-#define AT91C_BASE_CAN0_MB10 ((AT91PS_CAN_MB) 0xFFF80340) // (CAN0_MB10) Base Address
-#define AT91C_BASE_CAN0_MB11 ((AT91PS_CAN_MB) 0xFFF80360) // (CAN0_MB11) Base Address
-#define AT91C_BASE_CAN0_MB12 ((AT91PS_CAN_MB) 0xFFF80380) // (CAN0_MB12) Base Address
-#define AT91C_BASE_CAN0_MB13 ((AT91PS_CAN_MB) 0xFFF803A0) // (CAN0_MB13) Base Address
-#define AT91C_BASE_CAN0_MB14 ((AT91PS_CAN_MB) 0xFFF803C0) // (CAN0_MB14) Base Address
-#define AT91C_BASE_CAN0_MB15 ((AT91PS_CAN_MB) 0xFFF803E0) // (CAN0_MB15) Base Address
-#define AT91C_BASE_CAN0 ((AT91PS_CAN) 0xFFF80000) // (CAN0) Base Address
-#define AT91C_BASE_CAN1_MB0 ((AT91PS_CAN_MB) 0xFFF84200) // (CAN1_MB0) Base Address
-#define AT91C_BASE_CAN1_MB1 ((AT91PS_CAN_MB) 0xFFF84220) // (CAN1_MB1) Base Address
-#define AT91C_BASE_CAN1_MB2 ((AT91PS_CAN_MB) 0xFFF84240) // (CAN1_MB2) Base Address
-#define AT91C_BASE_CAN1_MB3 ((AT91PS_CAN_MB) 0xFFF84260) // (CAN1_MB3) Base Address
-#define AT91C_BASE_CAN1_MB4 ((AT91PS_CAN_MB) 0xFFF84280) // (CAN1_MB4) Base Address
-#define AT91C_BASE_CAN1_MB5 ((AT91PS_CAN_MB) 0xFFF842A0) // (CAN1_MB5) Base Address
-#define AT91C_BASE_CAN1_MB6 ((AT91PS_CAN_MB) 0xFFF842C0) // (CAN1_MB6) Base Address
-#define AT91C_BASE_CAN1_MB7 ((AT91PS_CAN_MB) 0xFFF842E0) // (CAN1_MB7) Base Address
-#define AT91C_BASE_CAN1_MB8 ((AT91PS_CAN_MB) 0xFFF84300) // (CAN1_MB8) Base Address
-#define AT91C_BASE_CAN1_MB9 ((AT91PS_CAN_MB) 0xFFF84320) // (CAN1_MB9) Base Address
-#define AT91C_BASE_CAN1_MB10 ((AT91PS_CAN_MB) 0xFFF84340) // (CAN1_MB10) Base Address
-#define AT91C_BASE_CAN1_MB11 ((AT91PS_CAN_MB) 0xFFF84360) // (CAN1_MB11) Base Address
-#define AT91C_BASE_CAN1_MB12 ((AT91PS_CAN_MB) 0xFFF84380) // (CAN1_MB12) Base Address
-#define AT91C_BASE_CAN1_MB13 ((AT91PS_CAN_MB) 0xFFF843A0) // (CAN1_MB13) Base Address
-#define AT91C_BASE_CAN1_MB14 ((AT91PS_CAN_MB) 0xFFF843C0) // (CAN1_MB14) Base Address
-#define AT91C_BASE_CAN1_MB15 ((AT91PS_CAN_MB) 0xFFF843E0) // (CAN1_MB15) Base Address
-#define AT91C_BASE_CAN1 ((AT91PS_CAN) 0xFFF84000) // (CAN1) Base Address
-#define AT91C_BASE_TC0 ((AT91PS_TC) 0xFFFA0000) // (TC0) Base Address
-#define AT91C_BASE_TC1 ((AT91PS_TC) 0xFFFA0040) // (TC1) Base Address
-#define AT91C_BASE_TC2 ((AT91PS_TC) 0xFFFA0080) // (TC2) Base Address
-#define AT91C_BASE_TCB0 ((AT91PS_TCB) 0xFFFA0000) // (TCB0) Base Address
-#define AT91C_BASE_TC3 ((AT91PS_TC) 0xFFFA4000) // (TC3) Base Address
-#define AT91C_BASE_TC4 ((AT91PS_TC) 0xFFFA4040) // (TC4) Base Address
-#define AT91C_BASE_TC5 ((AT91PS_TC) 0xFFFA4080) // (TC5) Base Address
-#define AT91C_BASE_TCB1 ((AT91PS_TCB) 0xFFFA4000) // (TCB1) Base Address
-#define AT91C_BASE_TC6 ((AT91PS_TC) 0xFFFA8000) // (TC6) Base Address
-#define AT91C_BASE_TC7 ((AT91PS_TC) 0xFFFA8040) // (TC7) Base Address
-#define AT91C_BASE_TC8 ((AT91PS_TC) 0xFFFA8080) // (TC8) Base Address
-#define AT91C_BASE_TCB2 ((AT91PS_TCB) 0xFFFA8000) // (TCB2) Base Address
-#define AT91C_BASE_PDC_MCI ((AT91PS_PDC) 0xFFFAC100) // (PDC_MCI) Base Address
-#define AT91C_BASE_MCI ((AT91PS_MCI) 0xFFFAC000) // (MCI) Base Address
-#define AT91C_BASE_UDP ((AT91PS_UDP) 0xFFFB0000) // (UDP) Base Address
-#define AT91C_BASE_TWI ((AT91PS_TWI) 0xFFFB8000) // (TWI) Base Address
-#define AT91C_BASE_PDC_US0 ((AT91PS_PDC) 0xFFFC0100) // (PDC_US0) Base Address
-#define AT91C_BASE_US0 ((AT91PS_USART) 0xFFFC0000) // (US0) Base Address
-#define AT91C_BASE_PDC_US1 ((AT91PS_PDC) 0xFFFC4100) // (PDC_US1) Base Address
-#define AT91C_BASE_US1 ((AT91PS_USART) 0xFFFC4000) // (US1) Base Address
-#define AT91C_BASE_PDC_US2 ((AT91PS_PDC) 0xFFFC8100) // (PDC_US2) Base Address
-#define AT91C_BASE_US2 ((AT91PS_USART) 0xFFFC8000) // (US2) Base Address
-#define AT91C_BASE_PWMC_CH0 ((AT91PS_PWMC_CH) 0xFFFCC200) // (PWMC_CH0) Base Address
-#define AT91C_BASE_PWMC_CH1 ((AT91PS_PWMC_CH) 0xFFFCC220) // (PWMC_CH1) Base Address
-#define AT91C_BASE_PWMC_CH2 ((AT91PS_PWMC_CH) 0xFFFCC240) // (PWMC_CH2) Base Address
-#define AT91C_BASE_PWMC_CH3 ((AT91PS_PWMC_CH) 0xFFFCC260) // (PWMC_CH3) Base Address
-#define AT91C_BASE_PWMC_CH4 ((AT91PS_PWMC_CH) 0xFFFCC280) // (PWMC_CH4) Base Address
-#define AT91C_BASE_PWMC_CH5 ((AT91PS_PWMC_CH) 0xFFFCC2A0) // (PWMC_CH5) Base Address
-#define AT91C_BASE_PWMC_CH6 ((AT91PS_PWMC_CH) 0xFFFCC2C0) // (PWMC_CH6) Base Address
-#define AT91C_BASE_PWMC_CH7 ((AT91PS_PWMC_CH) 0xFFFCC2E0) // (PWMC_CH7) Base Address
-#define AT91C_BASE_PWMC ((AT91PS_PWMC) 0xFFFCC000) // (PWMC) Base Address
-#define AT91C_BASE_PDC_SSC0 ((AT91PS_PDC) 0xFFFD0100) // (PDC_SSC0) Base Address
-#define AT91C_BASE_SSC0 ((AT91PS_SSC) 0xFFFD0000) // (SSC0) Base Address
-#define AT91C_BASE_PDC_SSC1 ((AT91PS_PDC) 0xFFFD4100) // (PDC_SSC1) Base Address
-#define AT91C_BASE_SSC1 ((AT91PS_SSC) 0xFFFD4000) // (SSC1) Base Address
-#define AT91C_BASE_PDC_ADC0 ((AT91PS_PDC) 0xFFFD8100) // (PDC_ADC0) Base Address
-#define AT91C_BASE_ADC0 ((AT91PS_ADC) 0xFFFD8000) // (ADC0) Base Address
-#define AT91C_BASE_PDC_ADC1 ((AT91PS_PDC) 0xFFFDC100) // (PDC_ADC1) Base Address
-#define AT91C_BASE_ADC1 ((AT91PS_ADC) 0xFFFDC000) // (ADC1) Base Address
-#define AT91C_BASE_PDC_SPI0 ((AT91PS_PDC) 0xFFFE0100) // (PDC_SPI0) Base Address
-#define AT91C_BASE_SPI0 ((AT91PS_SPI) 0xFFFE0000) // (SPI0) Base Address
-#define AT91C_BASE_PDC_SPI1 ((AT91PS_PDC) 0xFFFE4100) // (PDC_SPI1) Base Address
-#define AT91C_BASE_SPI1 ((AT91PS_SPI) 0xFFFE4000) // (SPI1) Base Address
-
-// *****************************************************************************
-// MEMORY MAPPING DEFINITIONS FOR AT91SAM7A3
-// *****************************************************************************
-// ISRAM
-#define AT91C_ISRAM ((char *) 0x00200000) // Internal SRAM base address
-#define AT91C_ISRAM_SIZE ((unsigned int) 0x00008000) // Internal SRAM size in byte (32 Kbytes)
-// IFLASH
-#define AT91C_IFLASH ((char *) 0x00100000) // Internal FLASH base address
-#define AT91C_IFLASH_SIZE ((unsigned int) 0x00040000) // Internal FLASH size in byte (256 Kbytes)
-#define AT91C_IFLASH_PAGE_SIZE ((unsigned int) 256) // Internal FLASH Page Size: 256 bytes
-#define AT91C_IFLASH_LOCK_REGION_SIZE ((unsigned int) 16384) // Internal FLASH Lock Region Size: 16 Kbytes
-#define AT91C_IFLASH_NB_OF_PAGES ((unsigned int) 1024) // Internal FLASH Number of Pages: 1024 bytes
-#define AT91C_IFLASH_NB_OF_LOCK_BITS ((unsigned int) 16) // Internal FLASH Number of Lock Bits: 16 bytes
-
-#endif
diff --git a/platforms_startup/armcc/AT91SAM7A3/Makefile b/platforms_startup/armcc/AT91SAM7A3/Makefile
deleted file mode 100644
index 13dac3705..000000000
--- a/platforms_startup/armcc/AT91SAM7A3/Makefile
+++ /dev/null
@@ -1,125 +0,0 @@
-# Makefile to create startup library for AT91SAM7A3 chip
-
-.SILENT:
-
-CPU = ARM7TDMI
-CPU_MODE = thumb
-TARGET_PLATFORM =armcc_$(CPU)_$(CPU_MODE)
-
-CPPUTEST_HOME = ../../..
-
-# component name
-COMPONENT_NAME = Startup_AT91SAM7A3
-
-# directory to place artefacts
-OBJS_DIR = objs
-
-# directory to place startup library
-LIB_DIR = $(CPPUTEST_HOME)/lib/$(TARGET_PLATFORM)
-
-# directory with source files
-SRC_DIRS = .
-
-# directory with header files
-INCLUDE_DIRS = .
-
-# CYGWIN path
-CYGWIN =C:/CYGWIN/bin
-MKDIR =$(CYGWIN)/mkdir
-RM =$(CYGWIN)/rm
-TOUCH =$(CYGWIN)/touch
-
-KEIL_DIR=D:/Keil/ARM/ARMCC
-CC=$(KEIL_DIR)/bin/armcc.exe
-AS=$(KEIL_DIR)/bin/armasm.exe
-AR=$(KEIL_DIR)/bin/armar.exe
-# armcc system include path
-SYS_INCLUDE_DIRS =$(KEIL_DIR)/include
-
-# adding Keil MDK-ARM system headers to build startup library
-INCLUDE_DIRS +=$(SYS_INCLUDE_DIRS)
-
-CPUFLAGS =--cpu=$(CPU)
-ifeq ($(CPU_MODE), thumb)
- CPUFLAGS +=--apcs=/interwork
-endif
-
-DEPFLAGS =-M \
- $(INCLUDES) \
- --depend_format=unix_escaped \
- --depend_single_line \
- --no_depend_system_headers
-
-OPTFLAGS =-O3
-
-CPPUTEST_CPPFLAGS =$(CPUFLAGS) \
- $(OPTFLAGS) \
- -c \
- -g \
- $(INCLUDES) \
- --$(CPU_MODE) \
- -D__CLK_TCK=1000 \
-
-ARFLAGS = --debug_symbols
-
-
-TARGET_LIB = \
- $(LIB_DIR)/lib$(COMPONENT_NAME).a
-
-#Helper Functions
-get_src_from_dir = $(wildcard $1/*.c) $(wildcard $1/*.asm)
-get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir)))
-__src_to = $(subst .asm,$1, $(subst .c,$1,$2))
-src_to = $(addprefix $3/,$(call __src_to,$1,$2))
-src_to_o = $(call src_to,.o,$1,$2)
-src_to_d = $(call src_to,.d,$1,$2)
-time = $(shell date +%s)
-delta_t = $(eval minus, $1, $2)
-debug_print_list = $(foreach word,$1,echo " $(word)";) echo
-
-# for building CRT library
-SRC = $(call get_src_from_dir_list, $(SRC_DIRS))
-OBJ = $(call src_to_o,$(SRC),$(OBJS_DIR))
-INCLUDES += $(foreach dir, $(INCLUDE_DIRS), -I$(dir))
-DEP_FILES = $(call src_to_d, $(SRC), $(OBJS_DIR))
-STUFF_TO_CLEAN = $(OBJ) $(DEP_FILES)
-
-#Don't create CRT dependencies when we're cleaning, for instance
-ifeq (0, $(words $(findstring $(MAKECMDGOALS), $(NODEPS))))
- -include $(DEP_FILES)
-endif
-
-all: $(TARGET_LIB)
- echo Done!
-
-$(TARGET_LIB): $(OBJ) | $(LIB_DIR)
- $(AR) $(ARFLAGS) --create $@ $^
- echo Build CRT library done!
-
-$(LIB_DIR) $(OBJS_DIR):
- echo Updating directory $@
- $(MKDIR) -p $@
-
-#This is the rule for creating the dependency files
-$(OBJS_DIR)/%.d: %.c Makefile | $(OBJS_DIR)
- echo Compiling C file $< for dependency. Out file $@.
- $(CC) $(DEPFLAGS) $< --depend=$@ --depend_target='$(patsubst %.d,%.o,$@)'
-
-$(OBJS_DIR)/%.d: %.asm | $(OBJS_DIR)
- echo Compiling ASM file $< for dependency. Out file $@.
- $(TOUCH) $@
-
-#This rule does the compilation C files
-$(OBJS_DIR)/%.o: %.c $(OBJS_DIR)/%.d
- echo Compiling C file $<. Out file $@
- $(CC) $(CPPUTEST_CPPFLAGS) $< -o $@
-
-#This rule does the compilation ASM
-$(OBJS_DIR)/%.o: %.asm $(OBJS_DIR)/%.d
- echo Assembling file $<. Out file $@
- $(AS) $(CPUFLAGS) --diag-suppress 1786 $< -o $@
-
-
-clean:
- @$(RM) -f $(STUFF_TO_CLEAN)
-
diff --git a/platforms_startup/armcc/AT91SAM7A3/README b/platforms_startup/armcc/AT91SAM7A3/README
deleted file mode 100644
index ed704bc2d..000000000
--- a/platforms_startup/armcc/AT91SAM7A3/README
+++ /dev/null
@@ -1,9 +0,0 @@
-Startup library for ARM C/C++ compiler and AT91SAM7A3 chip.
-Semihosting is in use, so you may use standard printf() or std::cout << "Hello!"
-
-Requirements:
-1. CYGWIN (rm.exe, mkdir.exe, make.exe, echo.exe)
-2. Keil MDK-ARM
-
-Library libStartup_AT91SAM7A3.a is placed in ./lib/armcc_ARM7TDMI_thumb
- directory of home CppUTest directory.
diff --git a/platforms_startup/armcc/AT91SAM7A3/Retarget.c b/platforms_startup/armcc/AT91SAM7A3/Retarget.c
deleted file mode 100644
index 24f3443e3..000000000
--- a/platforms_startup/armcc/AT91SAM7A3/Retarget.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*----------------------------------------------------------------------------
- * Name: Retarget.c
- * Purpose: 'Retarget' layer for target-dependent low level functions
- * Note(s):
- *----------------------------------------------------------------------------
- * This file is part of the uVision/ARM development tools.
- * This software may only be used under the terms of a valid, current,
- * end user licence from KEIL for a compatible version of KEIL software
- * development tools. Nothing else gives you the right to use this software.
- *
- * This software is supplied "AS IS" without warranties of any kind.
- *
- * Copyright (c) 2011 Keil - An ARM Company. All rights reserved.
- *----------------------------------------------------------------------------*/
-
-#include
-#include
-#include
-#include "lib_AT91SAM7A3.h"
-
-/* Standard IO device handles. */
-#define STDIN 0x8001
-#define STDOUT 0x8002
-#define STDERR 0x8003
-
-
-#pragma import(__use_no_semihosting_swi)
-
-const char __stdin_name[] = "STDIN";
-const char __stdout_name[] = "STDOUT";
-const char __stderr_name[] = "STDERR";
-
-static int init_UART_done = 0;
-static void UART_putc(unsigned char);
-static void UART_init(void);
-
-
-FILEHANDLE _sys_open(const char *name, int openmode)
-{
- FILEHANDLE rc;
- /* Register standard Input Output devices. */
- if (strcmp(name, "STDIN") == 0) rc = STDIN;
- else if (strcmp(name, "STDOUT") == 0) rc = STDOUT;
- else if (strcmp(name, "STDERR") == 0) rc = STDERR;
- else rc = 1;
- return (rc);
-}
-
-int _sys_close(FILEHANDLE fh)
-{
- return 0;
-}
-
-int _sys_write(FILEHANDLE fh, const unsigned char *buf,
- unsigned len, int mode)
-{
- while (len) {
- UART_putc(*buf);
- buf++;
- len--;
- }
- return len;
-}
-
-int _sys_read(FILEHANDLE fh, unsigned char *buf,
- unsigned len, int mode)
-{
- return -1; /* not supported */
-}
-
-void _ttywrch(int ch)
-{
- UART_putc(ch);
-}
-
-int _sys_istty(FILEHANDLE fh)
-{
- return 0; /* buffered output */
-}
-
-int _sys_seek(FILEHANDLE fh, long pos)
-{
- return -1; /* not supported */
-}
-
-long _sys_flen(FILEHANDLE fh)
-{
- return -1; /* not supported */
-}
-
-void _sys_exit(int return_code) {
- while(1);
-}
-
-char *_sys_command_string(char *cmd, int len)
-{
- const char * const arg[] = {
- "tst.axf",
- "-v",
- "-gSimpleStringBuffer",
- "-ojunit"};
- int i, j;
- char *rc = cmd;
- if (len) {
- /* Specify commandline arguments here as needed */
- len = sizeof(arg) / sizeof(char *);
- for (i = 0; i < len; i++) {
- j = strlen(arg[i])+1;
- if (cmd - rc + j > len) {
- rc = NULL;
- break;
- }
- memcpy(cmd, arg[i], j);
- cmd += j;
- }
- if (rc) rc = cmd;
- } else rc = NULL;
- return rc;
-}
-
-void _clock_init(void)
-{
- AT91F_PITInit(AT91C_BASE_PITC, 1000, 50); /* Period = 1000 Hz, CLK = 50 MHz */
-}
-
-clock_t clock(void)
-{
- static clock_t rc = 0;
- rc += AT91F_PITGetPIVR(AT91C_BASE_PITC) >> 20;
- return rc;
-}
-
-time_t time(time_t *timer)
-{
- return 0;
-}
-
-
-static void UART_putc(unsigned char ch)
-{
- if (init_UART_done == 0) {
- UART_init();
- init_UART_done++;
- }
- while ((AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_TXRDY) == 0) __nop();
- AT91C_BASE_DBGU->DBGU_THR = ch;
-}
-
-static void UART_init(void)
-{
- AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_SYS;
- AT91C_BASE_PIOA->PIO_PDR = (1<<30) | (1UL<<31);
- AT91C_BASE_PIOA->PIO_ASR = (1<<30) | (1UL<<31);
- AT91C_BASE_DBGU->DBGU_IDR = ~0;
- AT91C_BASE_DBGU->DBGU_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS | AT91C_US_RSTSTA;
- AT91C_BASE_DBGU->DBGU_BRGR = 27; /* 115200 if MCLK = 50 МГц */
- AT91C_BASE_DBGU->DBGU_MR = AT91C_US_PAR_NONE | AT91C_US_CHMODE_NORMAL;
- AT91C_BASE_DBGU->DBGU_CR = AT91C_US_TXEN;
- AT91C_BASE_DBGU->DBGU_CR = AT91C_US_RXEN;
- AT91C_BASE_DBGU->DBGU_CR = AT91C_US_RSTSTA; /* Reset status IRQ */
-}
-
-/* Replace of default Keil MDK-ARM function to create linked list of
- * destructor addresses of global or statically created objects. List is
- * placed in heap at startup.
- * No exit() is planned to call (exit from main() never take place in
- * embedded applications). So, it is no need to that list and it is possible
- * to use less heap memory.
- * New version of __aeabi_atexit does not create that list. See also
- * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka3951.html
- * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0041d/IHI0041D_cppabi.pdf
- */
-int __aeabi_atexit(void* object, void (*destroyer)(void*), void* dso_handle)
-{
- return 1; // 0: failed; non-0: OK
-// return __cxa_atexit(destroyer, object, dso_handle); /* Keil MDK-ARM version */
-}
diff --git a/platforms_startup/armcc/AT91SAM7A3/SAM7A3.asm b/platforms_startup/armcc/AT91SAM7A3/SAM7A3.asm
deleted file mode 100644
index 2edec9072..000000000
--- a/platforms_startup/armcc/AT91SAM7A3/SAM7A3.asm
+++ /dev/null
@@ -1,434 +0,0 @@
-;/*****************************************************************************/
-;/* SAM7.S: Startup file for Atmel AT91SAM7 device series */
-;/*****************************************************************************/
-;/* <<< Use Configuration Wizard in Context Menu >>> */
-;/*****************************************************************************/
-;/* This file is part of the uVision/ARM development tools. */
-;/* Copyright (c) 2005-2008 Keil Software. All rights reserved. */
-;/* This software may only be used under the terms of a valid, current, */
-;/* end user licence from KEIL for a compatible version of KEIL software */
-;/* development tools. Nothing else gives you the right to use this software. */
-;/*****************************************************************************/
-
-
-;/*
-; * The SAM7.S code is executed after CPU Reset. This file may be
-; * translated with the following SET symbols. In uVision these SET
-; * symbols are entered under Options - ASM - Define.
-; *
-; * REMAP: when set the startup code remaps exception vectors from
-; * on-chip RAM to address 0.
-; *
-; * RAM_INTVEC: when set the startup code copies exception vectors
-; * from on-chip Flash to on-chip RAM.
-; */
-
-
-; Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs
-
-Mode_USR EQU 0x10
-Mode_FIQ EQU 0x11
-Mode_IRQ EQU 0x12
-Mode_SVC EQU 0x13
-Mode_ABT EQU 0x17
-Mode_UND EQU 0x1B
-Mode_SYS EQU 0x1F
-
-I_Bit EQU 0x80 ; when I bit is set, IRQ is disabled
-F_Bit EQU 0x40 ; when F bit is set, FIQ is disabled
-
-
-; Internal Memory Base Addresses
-FLASH_BASE EQU 0x00100000
-RAM_BASE EQU 0x00200000
-
-
-;// Stack Configuration (Stack Sizes in Bytes)
-;// Undefined Mode <0x0-0xFFFFFFFF:8>
-;// Supervisor Mode <0x0-0xFFFFFFFF:8>
-;// Abort Mode <0x0-0xFFFFFFFF:8>
-;// Fast Interrupt Mode <0x0-0xFFFFFFFF:8>
-;// Interrupt Mode <0x0-0xFFFFFFFF:8>
-;// User/System Mode <0x0-0xFFFFFFFF:8>
-;//
-
-UND_Stack_Size EQU 0x00000000
-SVC_Stack_Size EQU 0x00001000
-ABT_Stack_Size EQU 0x00000000
-FIQ_Stack_Size EQU 0x00000000
-IRQ_Stack_Size EQU 0x00000070
-USR_Stack_Size EQU 0x00000000
-
-ISR_Stack_Size EQU (UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + \
- FIQ_Stack_Size + IRQ_Stack_Size)
-
- AREA STACK, NOINIT, READWRITE, ALIGN=3
-
-Stack_Mem SPACE USR_Stack_Size
-__initial_sp SPACE ISR_Stack_Size
-
-Stack_Top
-
-
-;// Heap Configuration
-;// Heap Size (in Bytes) <0x0-0xFFFFFFFF>
-;//
-
-Heap_Size EQU 0x0002800
-
- AREA HEAP, NOINIT, READWRITE, ALIGN=3
-__heap_base
-Heap_Mem SPACE Heap_Size
-__heap_limit
-
-
-; Reset Controller (RSTC) definitions
-RSTC_BASE EQU 0xFFFFFD00 ; RSTC Base Address
-RSTC_MR EQU 0x08 ; RSTC_MR Offset
-
-;/*
-;// Reset Controller (RSTC)
-;// URSTEN: User Reset Enable
-;// Enables NRST Pin to generate Reset
-;// ERSTL: External Reset Length <0-15>
-;// External Reset Time in 2^(ERSTL+1) Slow Clock Cycles
-;//
-;*/
-RSTC_SETUP EQU 1
-RSTC_MR_Val EQU 0xA5000401
-
-
-; Embedded Flash Controller (EFC) definitions
-EFC_BASE EQU 0xFFFFFF00 ; EFC Base Address
-EFC0_FMR EQU 0x60 ; EFC0_FMR Offset
-EFC1_FMR EQU 0x70 ; EFC1_FMR Offset
-
-;// Embedded Flash Controller 0 (EFC0)
-;// FMCN: Flash Microsecond Cycle Number <0-255>
-;// Number of Master Clock Cycles in 1us
-;// FWS: Flash Wait State
-;// <0=> Read: 1 cycle / Write: 2 cycles
-;// <1=> Read: 2 cycle / Write: 3 cycles
-;// <2=> Read: 3 cycle / Write: 4 cycles
-;// <3=> Read: 4 cycle / Write: 4 cycles
-;//
-EFC0_SETUP EQU 1
-EFC0_FMR_Val EQU 0x004B0100
-
-;// Embedded Flash Controller 1 (EFC1)
-;// FMCN: Flash Microsecond Cycle Number <0-255>
-;// Number of Master Clock Cycles in 1us
-;// FWS: Flash Wait State
-;// <0=> Read: 1 cycle / Write: 2 cycles
-;// <1=> Read: 2 cycle / Write: 3 cycles
-;// <2=> Read: 3 cycle / Write: 4 cycles
-;// <3=> Read: 4 cycle / Write: 4 cycles
-;//
-EFC1_SETUP EQU 0
-EFC1_FMR_Val EQU 0x00320100
-
-
-; Watchdog Timer (WDT) definitions
-WDT_BASE EQU 0xFFFFFD40 ; WDT Base Address
-WDT_MR EQU 0x04 ; WDT_MR Offset
-
-;// Watchdog Timer (WDT)
-;// WDV: Watchdog Counter Value <0-4095>
-;// WDD: Watchdog Delta Value <0-4095>
-;// WDFIEN: Watchdog Fault Interrupt Enable
-;// WDRSTEN: Watchdog Reset Enable
-;// WDRPROC: Watchdog Reset Processor
-;// WDDBGHLT: Watchdog Debug Halt
-;// WDIDLEHLT: Watchdog Idle Halt
-;// WDDIS: Watchdog Disable
-;//
-WDT_SETUP EQU 1
-WDT_MR_Val EQU 0x00008000
-
-
-; Power Mangement Controller (PMC) definitions
-PMC_BASE EQU 0xFFFFFC00 ; PMC Base Address
-PMC_MOR EQU 0x20 ; PMC_MOR Offset
-PMC_MCFR EQU 0x24 ; PMC_MCFR Offset
-PMC_PLLR EQU 0x2C ; PMC_PLLR Offset
-PMC_MCKR EQU 0x30 ; PMC_MCKR Offset
-PMC_SR EQU 0x68 ; PMC_SR Offset
-PMC_MOSCEN EQU (1<<0) ; Main Oscillator Enable
-PMC_OSCBYPASS EQU (1<<1) ; Main Oscillator Bypass
-PMC_OSCOUNT EQU (0xFF<<8) ; Main OScillator Start-up Time
-PMC_DIV EQU (0xFF<<0) ; PLL Divider
-PMC_PLLCOUNT EQU (0x3F<<8) ; PLL Lock Counter
-PMC_OUT EQU (0x03<<14) ; PLL Clock Frequency Range
-PMC_MUL EQU (0x7FF<<16) ; PLL Multiplier
-PMC_USBDIV EQU (0x03<<28) ; USB Clock Divider
-PMC_CSS EQU (3<<0) ; Clock Source Selection
-PMC_PRES EQU (7<<2) ; Prescaler Selection
-PMC_MOSCS EQU (1<<0) ; Main Oscillator Stable
-PMC_LOCK EQU (1<<2) ; PLL Lock Status
-PMC_MCKRDY EQU (1<<3) ; Master Clock Status
-
-;// Power Mangement Controller (PMC)
-;// Main Oscillator
-;// MOSCEN: Main Oscillator Enable
-;// OSCBYPASS: Oscillator Bypass
-;// OSCCOUNT: Main Oscillator Startup Time <0-255>
-;//
-;// Phase Locked Loop (PLL)
-;// DIV: PLL Divider <0-255>
-;// MUL: PLL Multiplier <0-2047>
-;// PLL Output is multiplied by MUL+1
-;// OUT: PLL Clock Frequency Range
-;// <0=> 80..160MHz <1=> Reserved
-;// <2=> 150..220MHz <3=> Reserved
-;// PLLCOUNT: PLL Lock Counter <0-63>
-;// USBDIV: USB Clock Divider
-;// <0=> None <1=> 2 <2=> 4 <3=> Reserved
-;//
-;// CSS: Clock Source Selection
-;// <0=> Slow Clock
-;// <1=> Main Clock
-;// <2=> Reserved
-;// <3=> PLL Clock
-;// PRES: Prescaler
-;// <0=> None
-;// <1=> Clock / 2 <2=> Clock / 4
-;// <3=> Clock / 8 <4=> Clock / 16
-;// <5=> Clock / 32 <6=> Clock / 64
-;// <7=> Reserved
-;//
-PMC_SETUP EQU 1
-PMC_MOR_Val EQU 0x00000601
-PMC_PLLR_Val EQU 0x00C71E04
-PMC_MCKR_Val EQU 0x0000000B
-
-
- PRESERVE8
-
-
-; Area Definition and Entry Point
-; Startup Code must be linked first at Address at which it expects to run.
-
- AREA |.reset|, CODE, READONLY
- ARM
-
-
-; Exception Vectors
-; Mapped to Address 0.
-; Absolute addressing mode must be used.
-; Dummy Handlers are implemented as infinite loops which can be modified.
-
-Vectors LDR PC,Reset_Addr
- LDR PC,Undef_Addr
- LDR PC,SWI_Addr
- LDR PC,PAbt_Addr
- LDR PC,DAbt_Addr
- NOP ; Reserved Vector
-; LDR PC,IRQ_Addr
- LDR PC,[PC,#-0xF20] ; Vector From AIC_IVR
-; LDR PC,FIQ_Addr
- LDR PC,[PC,#-0xF20] ; Vector From AIC_FVR
-
-Reset_Addr DCD Reset_Handler
-Undef_Addr DCD Undef_Handler
-SWI_Addr DCD SWI_Handler
-PAbt_Addr DCD PAbt_Handler
-DAbt_Addr DCD DAbt_Handler
- DCD 0 ; Reserved Address
-IRQ_Addr DCD IRQ_Handler
-FIQ_Addr DCD FIQ_Handler
-
-Undef_Handler B Undef_Handler
-SWI_Handler B SWI_Handler ; Part of RTL
-PAbt_Handler B PAbt_Handler
-DAbt_Handler B DAbt_Handler
-IRQ_Handler B IRQ_Handler
-FIQ_Handler B FIQ_Handler
-
-
-; Reset Handler
-
- EXPORT Reset_Handler
-Reset_Handler
-
-
-; Setup RSTC
- IF RSTC_SETUP != 0
- LDR R0, =RSTC_BASE
- LDR R1, =RSTC_MR_Val
- STR R1, [R0, #RSTC_MR]
- ENDIF
-
-
-; Setup EFC0
- IF EFC0_SETUP != 0
- LDR R0, =EFC_BASE
- LDR R1, =EFC0_FMR_Val
- STR R1, [R0, #EFC0_FMR]
- ENDIF
-
-; Setup EFC1
- IF EFC1_SETUP != 0
- LDR R0, =EFC_BASE
- LDR R1, =EFC1_FMR_Val
- STR R1, [R0, #EFC1_FMR]
- ENDIF
-
-
-; Setup WDT
- IF WDT_SETUP != 0
- LDR R0, =WDT_BASE
- LDR R1, =WDT_MR_Val
- STR R1, [R0, #WDT_MR]
- ENDIF
-
-
-; Setup PMC
- IF PMC_SETUP != 0
- LDR R0, =PMC_BASE
-
-; Setup Main Oscillator
- LDR R1, =PMC_MOR_Val
- STR R1, [R0, #PMC_MOR]
-
-; Wait until Main Oscillator is stablilized
- IF (PMC_MOR_Val:AND:PMC_MOSCEN) != 0
-MOSCS_Loop LDR R2, [R0, #PMC_SR]
- ANDS R2, R2, #PMC_MOSCS
- BEQ MOSCS_Loop
- ENDIF
-
-; Setup the PLL
- IF (PMC_PLLR_Val:AND:PMC_MUL) != 0
- LDR R1, =PMC_PLLR_Val
- STR R1, [R0, #PMC_PLLR]
-
-; Wait until PLL is stabilized
-PLL_Loop LDR R2, [R0, #PMC_SR]
- ANDS R2, R2, #PMC_LOCK
- BEQ PLL_Loop
- ENDIF
-
-; Select Clock
- IF (PMC_MCKR_Val:AND:PMC_CSS) == 1 ; Main Clock Selected
- LDR R1, =PMC_MCKR_Val
- AND R1, #PMC_CSS
- STR R1, [R0, #PMC_MCKR]
-WAIT_Rdy1 LDR R2, [R0, #PMC_SR]
- ANDS R2, R2, #PMC_MCKRDY
- BEQ WAIT_Rdy1
- LDR R1, =PMC_MCKR_Val
- STR R1, [R0, #PMC_MCKR]
-WAIT_Rdy2 LDR R2, [R0, #PMC_SR]
- ANDS R2, R2, #PMC_MCKRDY
- BEQ WAIT_Rdy2
- ELIF (PMC_MCKR_Val:AND:PMC_CSS) == 3 ; PLL Clock Selected
- LDR R1, =PMC_MCKR_Val
- AND R1, #PMC_PRES
- STR R1, [R0, #PMC_MCKR]
-WAIT_Rdy1 LDR R2, [R0, #PMC_SR]
- ANDS R2, R2, #PMC_MCKRDY
- BEQ WAIT_Rdy1
- LDR R1, =PMC_MCKR_Val
- STR R1, [R0, #PMC_MCKR]
-WAIT_Rdy2 LDR R2, [R0, #PMC_SR]
- ANDS R2, R2, #PMC_MCKRDY
- BEQ WAIT_Rdy2
- ENDIF ; Select Clock
- ENDIF ; PMC_SETUP
-
-
-; Copy Exception Vectors to Internal RAM
-
- IF :DEF:RAM_INTVEC
- ADR R8, Vectors ; Source
- LDR R9, =RAM_BASE ; Destination
- LDMIA R8!, {R0-R7} ; Load Vectors
- STMIA R9!, {R0-R7} ; Store Vectors
- LDMIA R8!, {R0-R7} ; Load Handler Addresses
- STMIA R9!, {R0-R7} ; Store Handler Addresses
- ENDIF
-
-
-; Remap on-chip RAM to address 0
-
-MC_BASE EQU 0xFFFFFF00 ; MC Base Address
-MC_RCR EQU 0x00 ; MC_RCR Offset
-
- IF :DEF:REMAP
- LDR R0, =MC_BASE
- MOV R1, #1
- STR R1, [R0, #MC_RCR] ; Remap
- ENDIF
-
-
-; Setup Stack for each mode
-
- LDR R0, =Stack_Top
-
-; Enter Undefined Instruction Mode and set its Stack Pointer
- MSR CPSR_c, #Mode_UND:OR:I_Bit:OR:F_Bit
- MOV SP, R0
- SUB R0, R0, #UND_Stack_Size
-
-; Enter Abort Mode and set its Stack Pointer
- MSR CPSR_c, #Mode_ABT:OR:I_Bit:OR:F_Bit
- MOV SP, R0
- SUB R0, R0, #ABT_Stack_Size
-
-; Enter FIQ Mode and set its Stack Pointer
- MSR CPSR_c, #Mode_FIQ:OR:I_Bit:OR:F_Bit
- MOV SP, R0
- SUB R0, R0, #FIQ_Stack_Size
-
-; Enter IRQ Mode and set its Stack Pointer
- MSR CPSR_c, #Mode_IRQ:OR:I_Bit:OR:F_Bit
- MOV SP, R0
- SUB R0, R0, #IRQ_Stack_Size
-
-; Enter Supervisor Mode and set its Stack Pointer
- MSR CPSR_c, #Mode_SVC:OR:I_Bit:OR:F_Bit
- MOV SP, R0
- SUB R0, R0, #SVC_Stack_Size
-
-; Enter User Mode and set its Stack Pointer
-; MSR CPSR_c, #Mode_USR
-; IF :DEF:__MICROLIB
-
-; EXPORT __initial_sp
-
-; ELSE
-
-; MOV SP, R0
-; SUB SL, SP, #USR_Stack_Size
-
-; ENDIF
-
-
-; Enter the C code
-
- IMPORT __main
- LDR R0, =__main
- BX R0
-
-
- IF :DEF:__MICROLIB
-
- EXPORT __heap_base
- EXPORT __heap_limit
-
- ELSE
-; User Initial Stack & Heap
- AREA |.text|, CODE, READONLY
-
- IMPORT __use_two_region_memory
- EXPORT __user_setup_stackheap
-__user_setup_stackheap
-
- LDR R0, = Heap_Mem
- LDR R2, = (Heap_Mem + Heap_Size)
- LDR SP, =(Stack_Mem + SVC_Stack_Size)
- BX LR
- ENDIF
-
-
- END
diff --git a/platforms_startup/armcc/AT91SAM7A3/lib_AT91SAM7A3.h b/platforms_startup/armcc/AT91SAM7A3/lib_AT91SAM7A3.h
deleted file mode 100644
index a21319445..000000000
--- a/platforms_startup/armcc/AT91SAM7A3/lib_AT91SAM7A3.h
+++ /dev/null
@@ -1,5054 +0,0 @@
-//* ----------------------------------------------------------------------------
-//* ATMEL Microcontroller Software Support - ROUSSET -
-//* ----------------------------------------------------------------------------
-//* DISCLAIMER: 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
-//* 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.
-//* ----------------------------------------------------------------------------
-//* File Name : lib_AT91SAM7A3.h
-//* Object : AT91SAM7A3 inlined functions
-//* Generated : AT91 SW Application Group 09/13/2005 (09:48:02)
-//*
-//* CVS Reference : /lib_MC_SAM.h/1.3/Wed Apr 28 09:02:35 2004//
-//* CVS Reference : /lib_pdc.h/1.2/Tue Jul 2 12:29:40 2002//
-//* CVS Reference : /lib_dbgu.h/1.1/Fri Jan 31 12:18:40 2003//
-//* CVS Reference : /lib_shdwc_6122A.h/1.1/Wed Oct 6 13:06:00 2004//
-//* CVS Reference : /lib_spi2.h/1.2/Tue Aug 23 15:43:14 2005//
-//* CVS Reference : /lib_ssc.h/1.4/Fri Jan 31 12:19:20 2003//
-//* CVS Reference : /lib_PWM_SAM.h/1.3/Wed Dec 3 10:23:10 2003//
-//* CVS Reference : /lib_tc_1753b.h/1.1/Fri Jan 31 12:20:02 2003//
-//* CVS Reference : /lib_pitc_6079A.h/1.2/Thu Nov 4 14:01:11 2004//
-//* CVS Reference : /lib_adc.h/1.6/Fri Oct 17 08:12:38 2003//
-//* CVS Reference : /lib_pmc_SAM.h/1.9/Tue Aug 30 13:03:40 2005//
-//* CVS Reference : /lib_rstc_6098A.h/1.1/Wed Oct 6 09:39:19 2004//
-//* CVS Reference : /lib_pio.h/1.3/Fri Jan 31 12:18:56 2003//
-//* CVS Reference : /lib_rttc_6081A.h/1.1/Wed Oct 6 09:39:38 2004//
-//* CVS Reference : /lib_twi.h/1.3/Mon Jul 19 13:37:30 2004//
-//* CVS Reference : /lib_usart.h/1.5/Thu Nov 21 16:01:53 2002//
-//* CVS Reference : /lib_mci.h/1.7/Thu May 27 08:47:43 2004//
-//* CVS Reference : /lib_wdtc_6080A.h/1.1/Wed Oct 6 09:38:30 2004//
-//* CVS Reference : /lib_udp.h/1.5/Mon Aug 29 08:17:54 2005//
-//* CVS Reference : /lib_aic_6075b.h/1.2/Mon Jul 18 11:06:01 2005//
-//* CVS Reference : /lib_can_AT91.h/1.5/Tue Aug 23 15:42:51 2005//
-//* ----------------------------------------------------------------------------
-
-#ifndef lib_AT91SAM7A3_H
-#define lib_AT91SAM7A3_H
-
-#include "AT91SAM7A3.h"
-/* *****************************************************************************
- SOFTWARE API FOR AIC
- ***************************************************************************** */
-#define AT91C_AIC_BRANCH_OPCODE ((void (*) ()) 0xE51FFF20) // ldr, pc, [pc, #-&F20]
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_AIC_ConfigureIt
-//* \brief Interrupt Handler Initialization
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_AIC_ConfigureIt (
- AT91PS_AIC pAic, // \arg pointer to the AIC registers
- unsigned int irq_id, // \arg interrupt number to initialize
- unsigned int priority, // \arg priority to give to the interrupt
- unsigned int src_type, // \arg activation and sense of activation
- void (*newHandler) () ) // \arg address of the interrupt handler
-{
- unsigned int oldHandler;
- unsigned int mask ;
-
- oldHandler = pAic->AIC_SVR[irq_id];
-
- mask = 0x1 << irq_id ;
- //* Disable the interrupt on the interrupt controller
- pAic->AIC_IDCR = mask ;
- //* Save the interrupt handler routine pointer and the interrupt priority
- pAic->AIC_SVR[irq_id] = (unsigned int) newHandler ;
- //* Store the Source Mode Register
- pAic->AIC_SMR[irq_id] = src_type | priority ;
- //* Clear the interrupt on the interrupt controller
- pAic->AIC_ICCR = mask ;
-
- return oldHandler;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_AIC_EnableIt
-//* \brief Enable corresponding IT number
-//*----------------------------------------------------------------------------
-__inline void AT91F_AIC_EnableIt (
- AT91PS_AIC pAic, // \arg pointer to the AIC registers
- unsigned int irq_id ) // \arg interrupt number to initialize
-{
- //* Enable the interrupt on the interrupt controller
- pAic->AIC_IECR = 0x1 << irq_id ;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_AIC_DisableIt
-//* \brief Disable corresponding IT number
-//*----------------------------------------------------------------------------
-__inline void AT91F_AIC_DisableIt (
- AT91PS_AIC pAic, // \arg pointer to the AIC registers
- unsigned int irq_id ) // \arg interrupt number to initialize
-{
- unsigned int mask = 0x1 << irq_id;
- //* Disable the interrupt on the interrupt controller
- pAic->AIC_IDCR = mask ;
- //* Clear the interrupt on the Interrupt Controller ( if one is pending )
- pAic->AIC_ICCR = mask ;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_AIC_ClearIt
-//* \brief Clear corresponding IT number
-//*----------------------------------------------------------------------------
-__inline void AT91F_AIC_ClearIt (
- AT91PS_AIC pAic, // \arg pointer to the AIC registers
- unsigned int irq_id) // \arg interrupt number to initialize
-{
- //* Clear the interrupt on the Interrupt Controller ( if one is pending )
- pAic->AIC_ICCR = (0x1 << irq_id);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_AIC_AcknowledgeIt
-//* \brief Acknowledge corresponding IT number
-//*----------------------------------------------------------------------------
-__inline void AT91F_AIC_AcknowledgeIt (
- AT91PS_AIC pAic) // \arg pointer to the AIC registers
-{
- pAic->AIC_EOICR = pAic->AIC_EOICR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_AIC_SetExceptionVector
-//* \brief Configure vector handler
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_AIC_SetExceptionVector (
- unsigned int *pVector, // \arg pointer to the AIC registers
- void (*Handler) () ) // \arg Interrupt Handler
-{
- unsigned int oldVector = *pVector;
-
- if ((unsigned int) Handler == (unsigned int) AT91C_AIC_BRANCH_OPCODE)
- *pVector = (unsigned int) AT91C_AIC_BRANCH_OPCODE;
- else
- *pVector = (((((unsigned int) Handler) - ((unsigned int) pVector) - 0x8) >> 2) & 0x00FFFFFF) | 0xEA000000;
-
- return oldVector;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_AIC_Trig
-//* \brief Trig an IT
-//*----------------------------------------------------------------------------
-__inline void AT91F_AIC_Trig (
- AT91PS_AIC pAic, // \arg pointer to the AIC registers
- unsigned int irq_id) // \arg interrupt number
-{
- pAic->AIC_ISCR = (0x1 << irq_id) ;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_AIC_IsActive
-//* \brief Test if an IT is active
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_AIC_IsActive (
- AT91PS_AIC pAic, // \arg pointer to the AIC registers
- unsigned int irq_id) // \arg Interrupt Number
-{
- return (pAic->AIC_ISR & (0x1 << irq_id));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_AIC_IsPending
-//* \brief Test if an IT is pending
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_AIC_IsPending (
- AT91PS_AIC pAic, // \arg pointer to the AIC registers
- unsigned int irq_id) // \arg Interrupt Number
-{
- return (pAic->AIC_IPR & (0x1 << irq_id));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_AIC_Open
-//* \brief Set exception vectors and AIC registers to default values
-//*----------------------------------------------------------------------------
-__inline void AT91F_AIC_Open(
- AT91PS_AIC pAic, // \arg pointer to the AIC registers
- void (*IrqHandler) (), // \arg Default IRQ vector exception
- void (*FiqHandler) (), // \arg Default FIQ vector exception
- void (*DefaultHandler) (), // \arg Default Handler set in ISR
- void (*SpuriousHandler) (), // \arg Default Spurious Handler
- unsigned int protectMode) // \arg Debug Control Register
-{
- int i;
-
- // Disable all interrupts and set IVR to the default handler
- for (i = 0; i < 32; ++i) {
- AT91F_AIC_DisableIt(pAic, i);
- AT91F_AIC_ConfigureIt(pAic, i, AT91C_AIC_PRIOR_LOWEST, AT91C_AIC_SRCTYPE_HIGH_LEVEL, DefaultHandler);
- }
-
- // Set the IRQ exception vector
- AT91F_AIC_SetExceptionVector((unsigned int *) 0x18, IrqHandler);
- // Set the Fast Interrupt exception vector
- AT91F_AIC_SetExceptionVector((unsigned int *) 0x1C, FiqHandler);
-
- pAic->AIC_SPU = (unsigned int) SpuriousHandler;
- pAic->AIC_DCR = protectMode;
-}
-/* *****************************************************************************
- SOFTWARE API FOR PDC
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_SetNextRx
-//* \brief Set the next receive transfer descriptor
-//*----------------------------------------------------------------------------
-__inline void AT91F_PDC_SetNextRx (
- AT91PS_PDC pPDC, // \arg pointer to a PDC controller
- char *address, // \arg address to the next bloc to be received
- unsigned int bytes) // \arg number of bytes to be received
-{
- pPDC->PDC_RNPR = (unsigned int) address;
- pPDC->PDC_RNCR = bytes;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_SetNextTx
-//* \brief Set the next transmit transfer descriptor
-//*----------------------------------------------------------------------------
-__inline void AT91F_PDC_SetNextTx (
- AT91PS_PDC pPDC, // \arg pointer to a PDC controller
- char *address, // \arg address to the next bloc to be transmitted
- unsigned int bytes) // \arg number of bytes to be transmitted
-{
- pPDC->PDC_TNPR = (unsigned int) address;
- pPDC->PDC_TNCR = bytes;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_SetRx
-//* \brief Set the receive transfer descriptor
-//*----------------------------------------------------------------------------
-__inline void AT91F_PDC_SetRx (
- AT91PS_PDC pPDC, // \arg pointer to a PDC controller
- char *address, // \arg address to the next bloc to be received
- unsigned int bytes) // \arg number of bytes to be received
-{
- pPDC->PDC_RPR = (unsigned int) address;
- pPDC->PDC_RCR = bytes;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_SetTx
-//* \brief Set the transmit transfer descriptor
-//*----------------------------------------------------------------------------
-__inline void AT91F_PDC_SetTx (
- AT91PS_PDC pPDC, // \arg pointer to a PDC controller
- char *address, // \arg address to the next bloc to be transmitted
- unsigned int bytes) // \arg number of bytes to be transmitted
-{
- pPDC->PDC_TPR = (unsigned int) address;
- pPDC->PDC_TCR = bytes;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_EnableTx
-//* \brief Enable transmit
-//*----------------------------------------------------------------------------
-__inline void AT91F_PDC_EnableTx (
- AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
-{
- pPDC->PDC_PTCR = AT91C_PDC_TXTEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_EnableRx
-//* \brief Enable receive
-//*----------------------------------------------------------------------------
-__inline void AT91F_PDC_EnableRx (
- AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
-{
- pPDC->PDC_PTCR = AT91C_PDC_RXTEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_DisableTx
-//* \brief Disable transmit
-//*----------------------------------------------------------------------------
-__inline void AT91F_PDC_DisableTx (
- AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
-{
- pPDC->PDC_PTCR = AT91C_PDC_TXTDIS;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_DisableRx
-//* \brief Disable receive
-//*----------------------------------------------------------------------------
-__inline void AT91F_PDC_DisableRx (
- AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
-{
- pPDC->PDC_PTCR = AT91C_PDC_RXTDIS;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_IsTxEmpty
-//* \brief Test if the current transfer descriptor has been sent
-//*----------------------------------------------------------------------------
-__inline int AT91F_PDC_IsTxEmpty ( // \return return 1 if transfer is complete
- AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
-{
- return !(pPDC->PDC_TCR);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_IsNextTxEmpty
-//* \brief Test if the next transfer descriptor has been moved to the current td
-//*----------------------------------------------------------------------------
-__inline int AT91F_PDC_IsNextTxEmpty ( // \return return 1 if transfer is complete
- AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
-{
- return !(pPDC->PDC_TNCR);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_IsRxEmpty
-//* \brief Test if the current transfer descriptor has been filled
-//*----------------------------------------------------------------------------
-__inline int AT91F_PDC_IsRxEmpty ( // \return return 1 if transfer is complete
- AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
-{
- return !(pPDC->PDC_RCR);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_IsNextRxEmpty
-//* \brief Test if the next transfer descriptor has been moved to the current td
-//*----------------------------------------------------------------------------
-__inline int AT91F_PDC_IsNextRxEmpty ( // \return return 1 if transfer is complete
- AT91PS_PDC pPDC ) // \arg pointer to a PDC controller
-{
- return !(pPDC->PDC_RNCR);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_Open
-//* \brief Open PDC: disable TX and RX reset transfer descriptors, re-enable RX and TX
-//*----------------------------------------------------------------------------
-__inline void AT91F_PDC_Open (
- AT91PS_PDC pPDC) // \arg pointer to a PDC controller
-{
- //* Disable the RX and TX PDC transfer requests
- AT91F_PDC_DisableRx(pPDC);
- AT91F_PDC_DisableTx(pPDC);
-
- //* Reset all Counter register Next buffer first
- AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0);
- AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0);
- AT91F_PDC_SetTx(pPDC, (char *) 0, 0);
- AT91F_PDC_SetRx(pPDC, (char *) 0, 0);
-
- //* Enable the RX and TX PDC transfer requests
- AT91F_PDC_EnableRx(pPDC);
- AT91F_PDC_EnableTx(pPDC);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_Close
-//* \brief Close PDC: disable TX and RX reset transfer descriptors
-//*----------------------------------------------------------------------------
-__inline void AT91F_PDC_Close (
- AT91PS_PDC pPDC) // \arg pointer to a PDC controller
-{
- //* Disable the RX and TX PDC transfer requests
- AT91F_PDC_DisableRx(pPDC);
- AT91F_PDC_DisableTx(pPDC);
-
- //* Reset all Counter register Next buffer first
- AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0);
- AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0);
- AT91F_PDC_SetTx(pPDC, (char *) 0, 0);
- AT91F_PDC_SetRx(pPDC, (char *) 0, 0);
-
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_SendFrame
-//* \brief Close PDC: disable TX and RX reset transfer descriptors
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PDC_SendFrame(
- AT91PS_PDC pPDC,
- char *pBuffer,
- unsigned int szBuffer,
- char *pNextBuffer,
- unsigned int szNextBuffer )
-{
- if (AT91F_PDC_IsTxEmpty(pPDC)) {
- //* Buffer and next buffer can be initialized
- AT91F_PDC_SetTx(pPDC, pBuffer, szBuffer);
- AT91F_PDC_SetNextTx(pPDC, pNextBuffer, szNextBuffer);
- return 2;
- }
- else if (AT91F_PDC_IsNextTxEmpty(pPDC)) {
- //* Only one buffer can be initialized
- AT91F_PDC_SetNextTx(pPDC, pBuffer, szBuffer);
- return 1;
- }
- else {
- //* All buffer are in use...
- return 0;
- }
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PDC_ReceiveFrame
-//* \brief Close PDC: disable TX and RX reset transfer descriptors
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PDC_ReceiveFrame (
- AT91PS_PDC pPDC,
- char *pBuffer,
- unsigned int szBuffer,
- char *pNextBuffer,
- unsigned int szNextBuffer )
-{
- if (AT91F_PDC_IsRxEmpty(pPDC)) {
- //* Buffer and next buffer can be initialized
- AT91F_PDC_SetRx(pPDC, pBuffer, szBuffer);
- AT91F_PDC_SetNextRx(pPDC, pNextBuffer, szNextBuffer);
- return 2;
- }
- else if (AT91F_PDC_IsNextRxEmpty(pPDC)) {
- //* Only one buffer can be initialized
- AT91F_PDC_SetNextRx(pPDC, pBuffer, szBuffer);
- return 1;
- }
- else {
- //* All buffer are in use...
- return 0;
- }
-}
-/* *****************************************************************************
- SOFTWARE API FOR DBGU
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_DBGU_InterruptEnable
-//* \brief Enable DBGU Interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_DBGU_InterruptEnable(
- AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller
- unsigned int flag) // \arg dbgu interrupt to be enabled
-{
- pDbgu->DBGU_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_DBGU_InterruptDisable
-//* \brief Disable DBGU Interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_DBGU_InterruptDisable(
- AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller
- unsigned int flag) // \arg dbgu interrupt to be disabled
-{
- pDbgu->DBGU_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_DBGU_GetInterruptMaskStatus
-//* \brief Return DBGU Interrupt Mask Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_DBGU_GetInterruptMaskStatus( // \return DBGU Interrupt Mask Status
- AT91PS_DBGU pDbgu) // \arg pointer to a DBGU controller
-{
- return pDbgu->DBGU_IMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_DBGU_IsInterruptMasked
-//* \brief Test if DBGU Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline int AT91F_DBGU_IsInterruptMasked(
- AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_DBGU_GetInterruptMaskStatus(pDbgu) & flag);
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR PIO
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_CfgPeriph
-//* \brief Enable pins to be drived by peripheral
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_CfgPeriph(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int periphAEnable, // \arg PERIPH A to enable
- unsigned int periphBEnable) // \arg PERIPH B to enable
-
-{
- pPio->PIO_ASR = periphAEnable;
- pPio->PIO_BSR = periphBEnable;
- pPio->PIO_PDR = (periphAEnable | periphBEnable); // Set in Periph mode
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_CfgOutput
-//* \brief Enable PIO in output mode
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_CfgOutput(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int pioEnable) // \arg PIO to be enabled
-{
- pPio->PIO_PER = pioEnable; // Set in PIO mode
- pPio->PIO_OER = pioEnable; // Configure in Output
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_CfgInput
-//* \brief Enable PIO in input mode
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_CfgInput(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int inputEnable) // \arg PIO to be enabled
-{
- // Disable output
- pPio->PIO_ODR = inputEnable;
- pPio->PIO_PER = inputEnable;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_CfgOpendrain
-//* \brief Configure PIO in open drain
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_CfgOpendrain(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int multiDrvEnable) // \arg pio to be configured in open drain
-{
- // Configure the multi-drive option
- pPio->PIO_MDDR = ~multiDrvEnable;
- pPio->PIO_MDER = multiDrvEnable;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_CfgPullup
-//* \brief Enable or disable pullup on PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_CfgPullup(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int pullupEnable) // \arg enable pullup on PIO
-{
- // Connect or not Pullup
- pPio->PIO_PPUDR = ~pullupEnable;
- pPio->PIO_PPUER = pullupEnable;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_PullupEnable
-//* \brief Enable pullup on PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_PullupEnable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int pullupEnable) // \arg enable pullup on PIO
-{
- // Connect Pullup
- pPio->PIO_PPUER = pullupEnable;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_PullupDisable
-//* \brief Disable pullup on PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_PullupDisable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int pullupDisable) // \arg enable pullup on PIO
-{
- // Not connect Pullup
- pPio->PIO_PPUDR = pullupDisable;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_CfgDirectDrive
-//* \brief Enable direct drive on PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_CfgDirectDrive(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int directDrive) // \arg PIO to be configured with direct drive
-
-{
- // Configure the Direct Drive
- pPio->PIO_OWDR = ~directDrive;
- pPio->PIO_OWER = directDrive;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_CfgInputFilter
-//* \brief Enable input filter on input PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_CfgInputFilter(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int inputFilter) // \arg PIO to be configured with input filter
-
-{
- // Configure the Direct Drive
- pPio->PIO_IFDR = ~inputFilter;
- pPio->PIO_IFER = inputFilter;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_GetInput
-//* \brief Return PIO input value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PIO_GetInput( // \return PIO input
- AT91PS_PIO pPio) // \arg pointer to a PIO controller
-{
- return pPio->PIO_PDSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_IsInputSet
-//* \brief Test if PIO is input flag is active
-//*----------------------------------------------------------------------------
-__inline int AT91F_PIO_IsInputSet(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PIO_GetInput(pPio) & flag);
-}
-
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_SetOutput
-//* \brief Set to 1 output PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_SetOutput(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg output to be set
-{
- pPio->PIO_SODR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_ClearOutput
-//* \brief Set to 0 output PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_ClearOutput(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg output to be cleared
-{
- pPio->PIO_CODR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_ForceOutput
-//* \brief Force output when Direct drive option is enabled
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_ForceOutput(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg output to be forced
-{
- pPio->PIO_ODSR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_Enable
-//* \brief Enable PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_Enable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio to be enabled
-{
- pPio->PIO_PER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_Disable
-//* \brief Disable PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_Disable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio to be disabled
-{
- pPio->PIO_PDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_GetStatus
-//* \brief Return PIO Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PIO_GetStatus( // \return PIO Status
- AT91PS_PIO pPio) // \arg pointer to a PIO controller
-{
- return pPio->PIO_PSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_IsSet
-//* \brief Test if PIO is Set
-//*----------------------------------------------------------------------------
-__inline int AT91F_PIO_IsSet(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PIO_GetStatus(pPio) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_OutputEnable
-//* \brief Output Enable PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_OutputEnable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio output to be enabled
-{
- pPio->PIO_OER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_OutputDisable
-//* \brief Output Enable PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_OutputDisable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio output to be disabled
-{
- pPio->PIO_ODR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_GetOutputStatus
-//* \brief Return PIO Output Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PIO_GetOutputStatus( // \return PIO Output Status
- AT91PS_PIO pPio) // \arg pointer to a PIO controller
-{
- return pPio->PIO_OSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_IsOuputSet
-//* \brief Test if PIO Output is Set
-//*----------------------------------------------------------------------------
-__inline int AT91F_PIO_IsOutputSet(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PIO_GetOutputStatus(pPio) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_InputFilterEnable
-//* \brief Input Filter Enable PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_InputFilterEnable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio input filter to be enabled
-{
- pPio->PIO_IFER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_InputFilterDisable
-//* \brief Input Filter Disable PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_InputFilterDisable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio input filter to be disabled
-{
- pPio->PIO_IFDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_GetInputFilterStatus
-//* \brief Return PIO Input Filter Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PIO_GetInputFilterStatus( // \return PIO Input Filter Status
- AT91PS_PIO pPio) // \arg pointer to a PIO controller
-{
- return pPio->PIO_IFSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_IsInputFilterSet
-//* \brief Test if PIO Input filter is Set
-//*----------------------------------------------------------------------------
-__inline int AT91F_PIO_IsInputFilterSet(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PIO_GetInputFilterStatus(pPio) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_GetOutputDataStatus
-//* \brief Return PIO Output Data Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status
- AT91PS_PIO pPio) // \arg pointer to a PIO controller
-{
- return pPio->PIO_ODSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_InterruptEnable
-//* \brief Enable PIO Interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_InterruptEnable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio interrupt to be enabled
-{
- pPio->PIO_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_InterruptDisable
-//* \brief Disable PIO Interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_InterruptDisable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio interrupt to be disabled
-{
- pPio->PIO_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_GetInterruptMaskStatus
-//* \brief Return PIO Interrupt Mask Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PIO_GetInterruptMaskStatus( // \return PIO Interrupt Mask Status
- AT91PS_PIO pPio) // \arg pointer to a PIO controller
-{
- return pPio->PIO_IMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_GetInterruptStatus
-//* \brief Return PIO Interrupt Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PIO_GetInterruptStatus( // \return PIO Interrupt Status
- AT91PS_PIO pPio) // \arg pointer to a PIO controller
-{
- return pPio->PIO_ISR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_IsInterruptMasked
-//* \brief Test if PIO Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline int AT91F_PIO_IsInterruptMasked(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PIO_GetInterruptMaskStatus(pPio) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_IsInterruptSet
-//* \brief Test if PIO Interrupt is Set
-//*----------------------------------------------------------------------------
-__inline int AT91F_PIO_IsInterruptSet(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PIO_GetInterruptStatus(pPio) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_MultiDriverEnable
-//* \brief Multi Driver Enable PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_MultiDriverEnable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio to be enabled
-{
- pPio->PIO_MDER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_MultiDriverDisable
-//* \brief Multi Driver Disable PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_MultiDriverDisable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio to be disabled
-{
- pPio->PIO_MDDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_GetMultiDriverStatus
-//* \brief Return PIO Multi Driver Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PIO_GetMultiDriverStatus( // \return PIO Multi Driver Status
- AT91PS_PIO pPio) // \arg pointer to a PIO controller
-{
- return pPio->PIO_MDSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_IsMultiDriverSet
-//* \brief Test if PIO MultiDriver is Set
-//*----------------------------------------------------------------------------
-__inline int AT91F_PIO_IsMultiDriverSet(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PIO_GetMultiDriverStatus(pPio) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_A_RegisterSelection
-//* \brief PIO A Register Selection
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_A_RegisterSelection(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio A register selection
-{
- pPio->PIO_ASR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_B_RegisterSelection
-//* \brief PIO B Register Selection
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_B_RegisterSelection(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio B register selection
-{
- pPio->PIO_BSR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_Get_AB_RegisterStatus
-//* \brief Return PIO Interrupt Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PIO_Get_AB_RegisterStatus( // \return PIO AB Register Status
- AT91PS_PIO pPio) // \arg pointer to a PIO controller
-{
- return pPio->PIO_ABSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_IsAB_RegisterSet
-//* \brief Test if PIO AB Register is Set
-//*----------------------------------------------------------------------------
-__inline int AT91F_PIO_IsAB_RegisterSet(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PIO_Get_AB_RegisterStatus(pPio) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_OutputWriteEnable
-//* \brief Output Write Enable PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_OutputWriteEnable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio output write to be enabled
-{
- pPio->PIO_OWER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_OutputWriteDisable
-//* \brief Output Write Disable PIO
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIO_OutputWriteDisable(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg pio output write to be disabled
-{
- pPio->PIO_OWDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_GetOutputWriteStatus
-//* \brief Return PIO Output Write Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PIO_GetOutputWriteStatus( // \return PIO Output Write Status
- AT91PS_PIO pPio) // \arg pointer to a PIO controller
-{
- return pPio->PIO_OWSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_IsOutputWriteSet
-//* \brief Test if PIO OutputWrite is Set
-//*----------------------------------------------------------------------------
-__inline int AT91F_PIO_IsOutputWriteSet(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PIO_GetOutputWriteStatus(pPio) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_GetCfgPullup
-//* \brief Return PIO Configuration Pullup
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup
- AT91PS_PIO pPio) // \arg pointer to a PIO controller
-{
- return pPio->PIO_PPUSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_IsOutputDataStatusSet
-//* \brief Test if PIO Output Data Status is Set
-//*----------------------------------------------------------------------------
-__inline int AT91F_PIO_IsOutputDataStatusSet(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PIO_GetOutputDataStatus(pPio) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIO_IsCfgPullupStatusSet
-//* \brief Test if PIO Configuration Pullup Status is Set
-//*----------------------------------------------------------------------------
-__inline int AT91F_PIO_IsCfgPullupStatusSet(
- AT91PS_PIO pPio, // \arg pointer to a PIO controller
- unsigned int flag) // \arg flag to be tested
-{
- return (~AT91F_PIO_GetCfgPullup(pPio) & flag);
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR PMC
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_CfgSysClkEnableReg
-//* \brief Configure the System Clock Enable Register of the PMC controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_PMC_CfgSysClkEnableReg (
- AT91PS_PMC pPMC, // \arg pointer to PMC controller
- unsigned int mode)
-{
- //* Write to the SCER register
- pPMC->PMC_SCER = mode;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_CfgSysClkDisableReg
-//* \brief Configure the System Clock Disable Register of the PMC controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_PMC_CfgSysClkDisableReg (
- AT91PS_PMC pPMC, // \arg pointer to PMC controller
- unsigned int mode)
-{
- //* Write to the SCDR register
- pPMC->PMC_SCDR = mode;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_GetSysClkStatusReg
-//* \brief Return the System Clock Status Register of the PMC controller
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PMC_GetSysClkStatusReg (
- AT91PS_PMC pPMC // pointer to a CAN controller
- )
-{
- return pPMC->PMC_SCSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_EnablePeriphClock
-//* \brief Enable peripheral clock
-//*----------------------------------------------------------------------------
-__inline void AT91F_PMC_EnablePeriphClock (
- AT91PS_PMC pPMC, // \arg pointer to PMC controller
- unsigned int periphIds) // \arg IDs of peripherals to enable
-{
- pPMC->PMC_PCER = periphIds;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_DisablePeriphClock
-//* \brief Disable peripheral clock
-//*----------------------------------------------------------------------------
-__inline void AT91F_PMC_DisablePeriphClock (
- AT91PS_PMC pPMC, // \arg pointer to PMC controller
- unsigned int periphIds) // \arg IDs of peripherals to enable
-{
- pPMC->PMC_PCDR = periphIds;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_GetPeriphClock
-//* \brief Get peripheral clock status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PMC_GetPeriphClock (
- AT91PS_PMC pPMC) // \arg pointer to PMC controller
-{
- return pPMC->PMC_PCSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CKGR_CfgMainOscillatorReg
-//* \brief Cfg the main oscillator
-//*----------------------------------------------------------------------------
-__inline void AT91F_CKGR_CfgMainOscillatorReg (
- AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller
- unsigned int mode)
-{
- pCKGR->CKGR_MOR = mode;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CKGR_GetMainOscillatorReg
-//* \brief Cfg the main oscillator
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CKGR_GetMainOscillatorReg (
- AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller
-{
- return pCKGR->CKGR_MOR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CKGR_EnableMainOscillator
-//* \brief Enable the main oscillator
-//*----------------------------------------------------------------------------
-__inline void AT91F_CKGR_EnableMainOscillator(
- AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller
-{
- pCKGR->CKGR_MOR |= AT91C_CKGR_MOSCEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CKGR_DisableMainOscillator
-//* \brief Disable the main oscillator
-//*----------------------------------------------------------------------------
-__inline void AT91F_CKGR_DisableMainOscillator (
- AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller
-{
- pCKGR->CKGR_MOR &= ~AT91C_CKGR_MOSCEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CKGR_CfgMainOscStartUpTime
-//* \brief Cfg MOR Register according to the main osc startup time
-//*----------------------------------------------------------------------------
-__inline void AT91F_CKGR_CfgMainOscStartUpTime (
- AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller
- unsigned int startup_time, // \arg main osc startup time in microsecond (us)
- unsigned int slowClock) // \arg slowClock in Hz
-{
- pCKGR->CKGR_MOR &= ~AT91C_CKGR_OSCOUNT;
- pCKGR->CKGR_MOR |= ((slowClock * startup_time)/(8*1000000)) << 8;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CKGR_GetMainClockFreqReg
-//* \brief Cfg the main oscillator
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CKGR_GetMainClockFreqReg (
- AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller
-{
- return pCKGR->CKGR_MCFR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CKGR_GetMainClock
-//* \brief Return Main clock in Hz
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CKGR_GetMainClock (
- AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller
- unsigned int slowClock) // \arg slowClock in Hz
-{
- return ((pCKGR->CKGR_MCFR & AT91C_CKGR_MAINF) * slowClock) >> 4;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_CfgMCKReg
-//* \brief Cfg Master Clock Register
-//*----------------------------------------------------------------------------
-__inline void AT91F_PMC_CfgMCKReg (
- AT91PS_PMC pPMC, // \arg pointer to PMC controller
- unsigned int mode)
-{
- pPMC->PMC_MCKR = mode;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_GetMCKReg
-//* \brief Return Master Clock Register
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PMC_GetMCKReg(
- AT91PS_PMC pPMC) // \arg pointer to PMC controller
-{
- return pPMC->PMC_MCKR;
-}
-
-//*------------------------------------------------------------------------------
-//* \fn AT91F_PMC_GetMasterClock
-//* \brief Return master clock in Hz which correponds to processor clock for ARM7
-//*------------------------------------------------------------------------------
-__inline unsigned int AT91F_PMC_GetMasterClock (
- AT91PS_PMC pPMC, // \arg pointer to PMC controller
- AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller
- unsigned int slowClock) // \arg slowClock in Hz
-{
- unsigned int reg = pPMC->PMC_MCKR;
- unsigned int prescaler = (1 << ((reg & AT91C_PMC_PRES) >> 2));
- unsigned int pllDivider, pllMultiplier;
-
- switch (reg & AT91C_PMC_CSS) {
- case AT91C_PMC_CSS_SLOW_CLK: // Slow clock selected
- return slowClock / prescaler;
- case AT91C_PMC_CSS_MAIN_CLK: // Main clock is selected
- return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / prescaler;
- case AT91C_PMC_CSS_PLL_CLK: // PLLB clock is selected
- reg = pCKGR->CKGR_PLLR;
- pllDivider = (reg & AT91C_CKGR_DIV);
- pllMultiplier = ((reg & AT91C_CKGR_MUL) >> 16) + 1;
- return AT91F_CKGR_GetMainClock(pCKGR, slowClock) / pllDivider * pllMultiplier / prescaler;
- }
- return 0;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_EnablePCK
-//* \brief Enable peripheral clock
-//*----------------------------------------------------------------------------
-__inline void AT91F_PMC_EnablePCK (
- AT91PS_PMC pPMC, // \arg pointer to PMC controller
- unsigned int pck, // \arg Peripheral clock identifier 0 .. 7
- unsigned int mode)
-{
- pPMC->PMC_PCKR[pck] = mode;
- pPMC->PMC_SCER = (1 << pck) << 8;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_DisablePCK
-//* \brief Enable peripheral clock
-//*----------------------------------------------------------------------------
-__inline void AT91F_PMC_DisablePCK (
- AT91PS_PMC pPMC, // \arg pointer to PMC controller
- unsigned int pck) // \arg Peripheral clock identifier 0 .. 7
-{
- pPMC->PMC_SCDR = (1 << pck) << 8;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_EnableIt
-//* \brief Enable PMC interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_PMC_EnableIt (
- AT91PS_PMC pPMC, // pointer to a PMC controller
- unsigned int flag) // IT to be enabled
-{
- //* Write to the IER register
- pPMC->PMC_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_DisableIt
-//* \brief Disable PMC interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_PMC_DisableIt (
- AT91PS_PMC pPMC, // pointer to a PMC controller
- unsigned int flag) // IT to be disabled
-{
- //* Write to the IDR register
- pPMC->PMC_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_GetStatus
-//* \brief Return PMC Interrupt Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PMC_GetStatus( // \return PMC Interrupt Status
- AT91PS_PMC pPMC) // pointer to a PMC controller
-{
- return pPMC->PMC_SR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_GetInterruptMaskStatus
-//* \brief Return PMC Interrupt Mask Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PMC_GetInterruptMaskStatus( // \return PMC Interrupt Mask Status
- AT91PS_PMC pPMC) // pointer to a PMC controller
-{
- return pPMC->PMC_IMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_IsInterruptMasked
-//* \brief Test if PMC Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PMC_IsInterruptMasked(
- AT91PS_PMC pPMC, // \arg pointer to a PMC controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PMC_GetInterruptMaskStatus(pPMC) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_IsStatusSet
-//* \brief Test if PMC Status is Set
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PMC_IsStatusSet(
- AT91PS_PMC pPMC, // \arg pointer to a PMC controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PMC_GetStatus(pPMC) & flag);
-}
-
-// ----------------------------------------------------------------------------
-// \fn AT91F_CKGR_CfgPLLReg
-// \brief Cfg the PLL Register
-// ----------------------------------------------------------------------------
-__inline void AT91F_CKGR_CfgPLLReg (
- AT91PS_CKGR pCKGR, // \arg pointer to CKGR controller
- unsigned int mode)
-{
- pCKGR->CKGR_PLLR = mode;
-}
-
-// ----------------------------------------------------------------------------
-// \fn AT91F_CKGR_GetPLLReg
-// \brief Get the PLL Register
-// ----------------------------------------------------------------------------
-__inline unsigned int AT91F_CKGR_GetPLLReg (
- AT91PS_CKGR pCKGR) // \arg pointer to CKGR controller
-{
- return pCKGR->CKGR_PLLR;
-}
-
-
-/* *****************************************************************************
- SOFTWARE API FOR RSTC
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_RSTSoftReset
-//* \brief Start Software Reset
-//*----------------------------------------------------------------------------
-__inline void AT91F_RSTSoftReset(
- AT91PS_RSTC pRSTC,
- unsigned int reset)
-{
- pRSTC->RSTC_RCR = (0xA5000000 | reset);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_RSTSetMode
-//* \brief Set Reset Mode
-//*----------------------------------------------------------------------------
-__inline void AT91F_RSTSetMode(
- AT91PS_RSTC pRSTC,
- unsigned int mode)
-{
- pRSTC->RSTC_RMR = (0xA5000000 | mode);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_RSTGetMode
-//* \brief Get Reset Mode
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_RSTGetMode(
- AT91PS_RSTC pRSTC)
-{
- return (pRSTC->RSTC_RMR);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_RSTGetStatus
-//* \brief Get Reset Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_RSTGetStatus(
- AT91PS_RSTC pRSTC)
-{
- return (pRSTC->RSTC_RSR);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_RSTIsSoftRstActive
-//* \brief Return !=0 if software reset is still not completed
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_RSTIsSoftRstActive(
- AT91PS_RSTC pRSTC)
-{
- return ((pRSTC->RSTC_RSR) & AT91C_RSTC_SRCMP);
-}
-/* *****************************************************************************
- SOFTWARE API FOR SHDWC
- ***************************************************************************** */
-//*--------------------------------------------------------------------------------------
-//* Function Name : AT91F_SHDWNSetMode()
-//* Object : Set the Shutdown mode register
-//*--------------------------------------------------------------------------------------
-__inline unsigned int AT91F_SHDWNSetMode(
- AT91PS_SHDWC pSHDWC,
- unsigned int mode)
-{
- pSHDWC->SHDWC_SHMR = mode;
- return(pSHDWC->SHDWC_SHMR);
-}
-
-//*--------------------------------------------------------------------------------------
-//* Function Name : AT91F_SHDWNGetMode()
-//* Object : Get the Shutdown mode register
-//*--------------------------------------------------------------------------------------
-__inline unsigned int AT91F_SHDWNGetMode(
- AT91PS_SHDWC pSHDWC)
-{
- return(pSHDWC->SHDWC_SHMR);
-}
-
-//*--------------------------------------------------------------------------------------
-//* Function Name : AT91F_SHDWNEnable()
-//* Object : Enable Shutdown
-//*--------------------------------------------------------------------------------------
-__inline void AT91F_SHDWNEnable(
- AT91PS_SHDWC pSHDWC)
-{
- pSHDWC->SHDWC_SHCR = 0xA5000001;
-}
-
-//*--------------------------------------------------------------------------------------
-//* Function Name : AT91F_SHDWNGetStatus()
-//* Object : Get Shutdown Status
-//*--------------------------------------------------------------------------------------
-__inline unsigned int AT91F_SHDWNGetStatus(
- AT91PS_SHDWC pSHDWC)
-{
- return(pSHDWC->SHDWC_SHSR);
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR RTTC
- ***************************************************************************** */
-//*--------------------------------------------------------------------------------------
-//* \fn AT91F_SetRTT_TimeBase()
-//* \brief Set the RTT prescaler according to the TimeBase in ms
-//*--------------------------------------------------------------------------------------
-__inline unsigned int AT91F_RTTSetTimeBase(
- AT91PS_RTTC pRTTC,
- unsigned int ms)
-{
- if (ms > 2000)
- return 1; // AT91C_TIME_OUT_OF_RANGE
- pRTTC->RTTC_RTMR &= ~0xFFFF;
- pRTTC->RTTC_RTMR |= (((ms << 15) /1000) & 0xFFFF);
- return 0;
-}
-
-//*--------------------------------------------------------------------------------------
-//* \fn AT91F_RTTSetPrescaler()
-//* \brief Set the new prescaler value
-//*--------------------------------------------------------------------------------------
-__inline unsigned int AT91F_RTTSetPrescaler(
- AT91PS_RTTC pRTTC,
- unsigned int rtpres)
-{
- pRTTC->RTTC_RTMR &= ~0xFFFF;
- pRTTC->RTTC_RTMR |= (rtpres & 0xFFFF);
- return (pRTTC->RTTC_RTMR);
-}
-
-//*--------------------------------------------------------------------------------------
-//* \fn AT91F_RTTRestart()
-//* \brief Restart the RTT prescaler
-//*--------------------------------------------------------------------------------------
-__inline void AT91F_RTTRestart(
- AT91PS_RTTC pRTTC)
-{
- pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTRST;
-}
-
-
-//*--------------------------------------------------------------------------------------
-//* \fn AT91F_RTT_SetAlarmINT()
-//* \brief Enable RTT Alarm Interrupt
-//*--------------------------------------------------------------------------------------
-__inline void AT91F_RTTSetAlarmINT(
- AT91PS_RTTC pRTTC)
-{
- pRTTC->RTTC_RTMR |= AT91C_RTTC_ALMIEN;
-}
-
-//*--------------------------------------------------------------------------------------
-//* \fn AT91F_RTT_ClearAlarmINT()
-//* \brief Disable RTT Alarm Interrupt
-//*--------------------------------------------------------------------------------------
-__inline void AT91F_RTTClearAlarmINT(
- AT91PS_RTTC pRTTC)
-{
- pRTTC->RTTC_RTMR &= ~AT91C_RTTC_ALMIEN;
-}
-
-//*--------------------------------------------------------------------------------------
-//* \fn AT91F_RTT_SetRttIncINT()
-//* \brief Enable RTT INC Interrupt
-//*--------------------------------------------------------------------------------------
-__inline void AT91F_RTTSetRttIncINT(
- AT91PS_RTTC pRTTC)
-{
- pRTTC->RTTC_RTMR |= AT91C_RTTC_RTTINCIEN;
-}
-
-//*--------------------------------------------------------------------------------------
-//* \fn AT91F_RTT_ClearRttIncINT()
-//* \brief Disable RTT INC Interrupt
-//*--------------------------------------------------------------------------------------
-__inline void AT91F_RTTClearRttIncINT(
- AT91PS_RTTC pRTTC)
-{
- pRTTC->RTTC_RTMR &= ~AT91C_RTTC_RTTINCIEN;
-}
-
-//*--------------------------------------------------------------------------------------
-//* \fn AT91F_RTT_SetAlarmValue()
-//* \brief Set RTT Alarm Value
-//*--------------------------------------------------------------------------------------
-__inline void AT91F_RTTSetAlarmValue(
- AT91PS_RTTC pRTTC, unsigned int alarm)
-{
- pRTTC->RTTC_RTAR = alarm;
-}
-
-//*--------------------------------------------------------------------------------------
-//* \fn AT91F_RTT_GetAlarmValue()
-//* \brief Get RTT Alarm Value
-//*--------------------------------------------------------------------------------------
-__inline unsigned int AT91F_RTTGetAlarmValue(
- AT91PS_RTTC pRTTC)
-{
- return(pRTTC->RTTC_RTAR);
-}
-
-//*--------------------------------------------------------------------------------------
-//* \fn AT91F_RTTGetStatus()
-//* \brief Read the RTT status
-//*--------------------------------------------------------------------------------------
-__inline unsigned int AT91F_RTTGetStatus(
- AT91PS_RTTC pRTTC)
-{
- return(pRTTC->RTTC_RTSR);
-}
-
-//*--------------------------------------------------------------------------------------
-//* \fn AT91F_RTT_ReadValue()
-//* \brief Read the RTT value
-//*--------------------------------------------------------------------------------------
-__inline unsigned int AT91F_RTTReadValue(
- AT91PS_RTTC pRTTC)
-{
- register volatile unsigned int val1,val2;
- do
- {
- val1 = pRTTC->RTTC_RTVR;
- val2 = pRTTC->RTTC_RTVR;
- }
- while(val1 != val2);
- return(val1);
-}
-/* *****************************************************************************
- SOFTWARE API FOR PITC
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PITInit
-//* \brief System timer init : period in �second, system clock freq in MHz
-//*----------------------------------------------------------------------------
-__inline void AT91F_PITInit(
- AT91PS_PITC pPITC,
- unsigned int period,
- unsigned int pit_frequency)
-{
- pPITC->PITC_PIMR = period ? (period * pit_frequency + 8) >> 4 : 0; // +8 to avoid %10 and /10
- pPITC->PITC_PIMR |= AT91C_PITC_PITEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PITSetPIV
-//* \brief Set the PIT Periodic Interval Value
-//*----------------------------------------------------------------------------
-__inline void AT91F_PITSetPIV(
- AT91PS_PITC pPITC,
- unsigned int piv)
-{
- pPITC->PITC_PIMR = piv | (pPITC->PITC_PIMR & (AT91C_PITC_PITEN | AT91C_PITC_PITIEN));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PITEnableInt
-//* \brief Enable PIT periodic interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_PITEnableInt(
- AT91PS_PITC pPITC)
-{
- pPITC->PITC_PIMR |= AT91C_PITC_PITIEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PITDisableInt
-//* \brief Disable PIT periodic interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_PITDisableInt(
- AT91PS_PITC pPITC)
-{
- pPITC->PITC_PIMR &= ~AT91C_PITC_PITIEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PITGetMode
-//* \brief Read PIT mode register
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PITGetMode(
- AT91PS_PITC pPITC)
-{
- return(pPITC->PITC_PIMR);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PITGetStatus
-//* \brief Read PIT status register
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PITGetStatus(
- AT91PS_PITC pPITC)
-{
- return(pPITC->PITC_PISR);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PITGetPIIR
-//* \brief Read PIT CPIV and PICNT without ressetting the counters
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PITGetPIIR(
- AT91PS_PITC pPITC)
-{
- return(pPITC->PITC_PIIR);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PITGetPIVR
-//* \brief Read System timer CPIV and PICNT without ressetting the counters
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PITGetPIVR(
- AT91PS_PITC pPITC)
-{
- return(pPITC->PITC_PIVR);
-}
-/* *****************************************************************************
- SOFTWARE API FOR WDTC
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_WDTSetMode
-//* \brief Set Watchdog Mode Register
-//*----------------------------------------------------------------------------
-__inline void AT91F_WDTSetMode(
- AT91PS_WDTC pWDTC,
- unsigned int Mode)
-{
- pWDTC->WDTC_WDMR = Mode;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_WDTRestart
-//* \brief Restart Watchdog
-//*----------------------------------------------------------------------------
-__inline void AT91F_WDTRestart(
- AT91PS_WDTC pWDTC)
-{
- pWDTC->WDTC_WDCR = 0xA5000001;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_WDTSGettatus
-//* \brief Get Watchdog Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_WDTSGettatus(
- AT91PS_WDTC pWDTC)
-{
- return(pWDTC->WDTC_WDSR & 0x3);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_WDTGetPeriod
-//* \brief Translate ms into Watchdog Compatible value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_WDTGetPeriod(unsigned int ms)
-{
- if ((ms < 4) || (ms > 16000))
- return 0;
- return((ms << 8) / 1000);
-}
-/* *****************************************************************************
- SOFTWARE API FOR MC
- ***************************************************************************** */
-
-#define AT91C_MC_CORRECT_KEY ((unsigned int) 0x5A << 24) // (MC) Correct Protect Key
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MC_Remap
-//* \brief Make Remap
-//*----------------------------------------------------------------------------
-__inline void AT91F_MC_Remap (void) //
-{
- AT91PS_MC pMC = (AT91PS_MC) AT91C_BASE_MC;
-
- pMC->MC_RCR = AT91C_MC_RCB;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MC_EFC_CfgModeReg
-//* \brief Configure the EFC Mode Register of the MC controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_MC_EFC_CfgModeReg (
- AT91PS_MC pMC, // pointer to a MC controller
- unsigned int mode) // mode register
-{
- // Write to the FMR register
- pMC->MC_FMR = mode;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MC_EFC_GetModeReg
-//* \brief Return MC EFC Mode Regsiter
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MC_EFC_GetModeReg(
- AT91PS_MC pMC) // pointer to a MC controller
-{
- return pMC->MC_FMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MC_EFC_ComputeFMCN
-//* \brief Return MC EFC Mode Regsiter
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MC_EFC_ComputeFMCN(
- int master_clock) // master clock in Hz
-{
- return (master_clock/1000000 +2);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MC_EFC_PerformCmd
-//* \brief Perform EFC Command
-//*----------------------------------------------------------------------------
-__inline void AT91F_MC_EFC_PerformCmd (
- AT91PS_MC pMC, // pointer to a MC controller
- unsigned int transfer_cmd)
-{
- pMC->MC_FCR = transfer_cmd;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MC_EFC_GetStatus
-//* \brief Return MC EFC Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MC_EFC_GetStatus(
- AT91PS_MC pMC) // pointer to a MC controller
-{
- return pMC->MC_FSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MC_EFC_IsInterruptMasked
-//* \brief Test if EFC MC Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MC_EFC_IsInterruptMasked(
- AT91PS_MC pMC, // \arg pointer to a MC controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_MC_EFC_GetModeReg(pMC) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MC_EFC_IsInterruptSet
-//* \brief Test if EFC MC Interrupt is Set
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MC_EFC_IsInterruptSet(
- AT91PS_MC pMC, // \arg pointer to a MC controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_MC_EFC_GetStatus(pMC) & flag);
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR CAN
- ***************************************************************************** */
-#define STANDARD_FORMAT 0
-#define EXTENDED_FORMAT 1
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_InitMailboxRegisters()
-//* \brief Configure the corresponding mailbox
-//*----------------------------------------------------------------------------
-__inline void AT91F_InitMailboxRegisters(AT91PS_CAN_MB CAN_Mailbox,
- int mode_reg,
- int acceptance_mask_reg,
- int id_reg,
- int data_low_reg,
- int data_high_reg,
- int control_reg)
-{
- CAN_Mailbox->CAN_MB_MCR = 0x0;
- CAN_Mailbox->CAN_MB_MMR = mode_reg;
- CAN_Mailbox->CAN_MB_MAM = acceptance_mask_reg;
- CAN_Mailbox->CAN_MB_MID = id_reg;
- CAN_Mailbox->CAN_MB_MDL = data_low_reg;
- CAN_Mailbox->CAN_MB_MDH = data_high_reg;
- CAN_Mailbox->CAN_MB_MCR = control_reg;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_EnableCAN()
-//* \brief
-//*----------------------------------------------------------------------------
-__inline void AT91F_EnableCAN(
- AT91PS_CAN pCAN) // pointer to a CAN controller
-{
- pCAN->CAN_MR |= AT91C_CAN_CANEN;
-
- // Wait for WAKEUP flag raising <=> 11-recessive-bit were scanned by the transceiver
- while( (pCAN->CAN_SR & AT91C_CAN_WAKEUP) != AT91C_CAN_WAKEUP );
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_DisableCAN()
-//* \brief
-//*----------------------------------------------------------------------------
-__inline void AT91F_DisableCAN(
- AT91PS_CAN pCAN) // pointer to a CAN controller
-{
- pCAN->CAN_MR &= ~AT91C_CAN_CANEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_EnableIt
-//* \brief Enable CAN interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN_EnableIt (
- AT91PS_CAN pCAN, // pointer to a CAN controller
- unsigned int flag) // IT to be enabled
-{
- //* Write to the IER register
- pCAN->CAN_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_DisableIt
-//* \brief Disable CAN interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN_DisableIt (
- AT91PS_CAN pCAN, // pointer to a CAN controller
- unsigned int flag) // IT to be disabled
-{
- //* Write to the IDR register
- pCAN->CAN_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetStatus
-//* \brief Return CAN Interrupt Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetStatus( // \return CAN Interrupt Status
- AT91PS_CAN pCAN) // pointer to a CAN controller
-{
- return pCAN->CAN_SR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetInterruptMaskStatus
-//* \brief Return CAN Interrupt Mask Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetInterruptMaskStatus( // \return CAN Interrupt Mask Status
- AT91PS_CAN pCAN) // pointer to a CAN controller
-{
- return pCAN->CAN_IMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_IsInterruptMasked
-//* \brief Test if CAN Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_IsInterruptMasked(
- AT91PS_CAN pCAN, // \arg pointer to a CAN controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_CAN_GetInterruptMaskStatus(pCAN) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_IsStatusSet
-//* \brief Test if CAN Interrupt is Set
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_IsStatusSet(
- AT91PS_CAN pCAN, // \arg pointer to a CAN controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_CAN_GetStatus(pCAN) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_CfgModeReg
-//* \brief Configure the Mode Register of the CAN controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN_CfgModeReg (
- AT91PS_CAN pCAN, // pointer to a CAN controller
- unsigned int mode) // mode register
-{
- //* Write to the MR register
- pCAN->CAN_MR = mode;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetModeReg
-//* \brief Return the Mode Register of the CAN controller value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetModeReg (
- AT91PS_CAN pCAN // pointer to a CAN controller
- )
-{
- return pCAN->CAN_MR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_CfgBaudrateReg
-//* \brief Configure the Baudrate of the CAN controller for the network
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN_CfgBaudrateReg (
- AT91PS_CAN pCAN, // pointer to a CAN controller
- unsigned int baudrate_cfg)
-{
- //* Write to the BR register
- pCAN->CAN_BR = baudrate_cfg;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetBaudrate
-//* \brief Return the Baudrate of the CAN controller for the network value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetBaudrate (
- AT91PS_CAN pCAN // pointer to a CAN controller
- )
-{
- return pCAN->CAN_BR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetInternalCounter
-//* \brief Return CAN Timer Regsiter Value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetInternalCounter (
- AT91PS_CAN pCAN // pointer to a CAN controller
- )
-{
- return pCAN->CAN_TIM;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetTimestamp
-//* \brief Return CAN Timestamp Register Value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetTimestamp (
- AT91PS_CAN pCAN // pointer to a CAN controller
- )
-{
- return pCAN->CAN_TIMESTP;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetErrorCounter
-//* \brief Return CAN Error Counter Register Value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetErrorCounter (
- AT91PS_CAN pCAN // pointer to a CAN controller
- )
-{
- return pCAN->CAN_ECR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_InitTransferRequest
-//* \brief Request for a transfer on the corresponding mailboxes
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN_InitTransferRequest (
- AT91PS_CAN pCAN, // pointer to a CAN controller
- unsigned int transfer_cmd)
-{
- pCAN->CAN_TCR = transfer_cmd;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_InitAbortRequest
-//* \brief Abort the corresponding mailboxes
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN_InitAbortRequest (
- AT91PS_CAN pCAN, // pointer to a CAN controller
- unsigned int abort_cmd)
-{
- pCAN->CAN_ACR = abort_cmd;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_CfgMessageModeReg
-//* \brief Program the Message Mode Register
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN_CfgMessageModeReg (
- AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
- unsigned int mode)
-{
- CAN_Mailbox->CAN_MB_MMR = mode;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetMessageModeReg
-//* \brief Return the Message Mode Register
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetMessageModeReg (
- AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
-{
- return CAN_Mailbox->CAN_MB_MMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_CfgMessageIDReg
-//* \brief Program the Message ID Register
-//* \brief Version == 0 for Standard messsage, Version == 1 for Extended
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN_CfgMessageIDReg (
- AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
- unsigned int id,
- unsigned char version)
-{
- if(version==0) // IDvA Standard Format
- CAN_Mailbox->CAN_MB_MID = id<<18;
- else // IDvB Extended Format
- CAN_Mailbox->CAN_MB_MID = id | (1<<29); // set MIDE bit
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetMessageIDReg
-//* \brief Return the Message ID Register
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetMessageIDReg (
- AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
-{
- return CAN_Mailbox->CAN_MB_MID;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_CfgMessageAcceptanceMaskReg
-//* \brief Program the Message Acceptance Mask Register
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN_CfgMessageAcceptanceMaskReg (
- AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
- unsigned int mask)
-{
- CAN_Mailbox->CAN_MB_MAM = mask;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetMessageAcceptanceMaskReg
-//* \brief Return the Message Acceptance Mask Register
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetMessageAcceptanceMaskReg (
- AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
-{
- return CAN_Mailbox->CAN_MB_MAM;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetFamilyID
-//* \brief Return the Message ID Register
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetFamilyID (
- AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
-{
- return CAN_Mailbox->CAN_MB_MFID;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_CfgMessageCtrl
-//* \brief Request and config for a transfer on the corresponding mailbox
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN_CfgMessageCtrlReg (
- AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
- unsigned int message_ctrl_cmd)
-{
- CAN_Mailbox->CAN_MB_MCR = message_ctrl_cmd;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetMessageStatus
-//* \brief Return CAN Mailbox Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetMessageStatus (
- AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
-{
- return CAN_Mailbox->CAN_MB_MSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_CfgMessageDataLow
-//* \brief Program data low value
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN_CfgMessageDataLow (
- AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
- unsigned int data)
-{
- CAN_Mailbox->CAN_MB_MDL = data;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetMessageDataLow
-//* \brief Return data low value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetMessageDataLow (
- AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
-{
- return CAN_Mailbox->CAN_MB_MDL;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_CfgMessageDataHigh
-//* \brief Program data high value
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN_CfgMessageDataHigh (
- AT91PS_CAN_MB CAN_Mailbox, // pointer to a CAN Mailbox
- unsigned int data)
-{
- CAN_Mailbox->CAN_MB_MDH = data;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN_GetMessageDataHigh
-//* \brief Return data high value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_CAN_GetMessageDataHigh (
- AT91PS_CAN_MB CAN_Mailbox) // pointer to a CAN Mailbox
-{
- return CAN_Mailbox->CAN_MB_MDH;
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR TC
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC_InterruptEnable
-//* \brief Enable TC Interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC_InterruptEnable(
- AT91PS_TC pTc, // \arg pointer to a TC controller
- unsigned int flag) // \arg TC interrupt to be enabled
-{
- pTc->TC_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC_InterruptDisable
-//* \brief Disable TC Interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC_InterruptDisable(
- AT91PS_TC pTc, // \arg pointer to a TC controller
- unsigned int flag) // \arg TC interrupt to be disabled
-{
- pTc->TC_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC_GetInterruptMaskStatus
-//* \brief Return TC Interrupt Mask Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_TC_GetInterruptMaskStatus( // \return TC Interrupt Mask Status
- AT91PS_TC pTc) // \arg pointer to a TC controller
-{
- return pTc->TC_IMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC_IsInterruptMasked
-//* \brief Test if TC Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline int AT91F_TC_IsInterruptMasked(
- AT91PS_TC pTc, // \arg pointer to a TC controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_TC_GetInterruptMaskStatus(pTc) & flag);
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR MCI
- ***************************************************************************** */
-//* Classic MCI Data Timeout Register Configuration with 1048576 MCK cycles between 2 data transfer
-#define AT91C_MCI_DTOR_1MEGA_CYCLES (AT91C_MCI_DTOCYC | AT91C_MCI_DTOMUL)
-
-//* Classic MCI SDCard Register Configuration with 1-bit data bus on slot A
-#define AT91C_MCI_MMC_SLOTA (AT91C_MCI_SCDSEL & 0x0)
-
-//* Classic MCI SDCard Register Configuration with 1-bit data bus on slot B
-#define AT91C_MCI_MMC_SLOTB (AT91C_MCI_SCDSEL & 0x1)
-
-//* Classic MCI SDCard Register Configuration with 4-bit data bus on slot A
-#define AT91C_MCI_SDCARD_4BITS_SLOTA ( (AT91C_MCI_SCDSEL & 0x0) | AT91C_MCI_SCDBUS )
-
-//* Classic MCI SDCard Register Configuration with 4-bit data bus on slot B
-#define AT91C_MCI_SDCARD_4BITS_SLOTB ( (AT91C_MCI_SCDSEL & 0x1) | AT91C_MCI_SCDBUS )
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_Configure
-//* \brief Configure the MCI
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_Configure (
- AT91PS_MCI pMCI, // \arg pointer to a MCI controller
- unsigned int DTOR_register, // \arg Data Timeout Register to be programmed
- unsigned int MR_register, // \arg Mode Register to be programmed
- unsigned int SDCR_register) // \arg SDCard Register to be programmed
-{
- //* Disable the MCI
- pMCI->MCI_CR = AT91C_MCI_MCIDIS | AT91C_MCI_PWSDIS;
-
- //* Disable all the interrupts
- pMCI->MCI_IDR = 0xFFFFFFFF;
-
- //* Set the Data Timeout Register
- pMCI->MCI_DTOR = DTOR_register;
-
- //* Set the Mode Register
- pMCI->MCI_MR = MR_register;
-
- //* Set the SDCard Register
- pMCI->MCI_SDCR = SDCR_register;
-
- //* Enable the MCI
- pMCI->MCI_CR = AT91C_MCI_MCIEN | AT91C_MCI_PWSEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_EnableIt
-//* \brief Enable MCI IT
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_EnableIt (
- AT91PS_MCI pMCI, // \arg pointer to a MCI controller
- unsigned int flag) // \arg IT to be enabled
-{
- //* Write to the IER register
- pMCI->MCI_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_DisableIt
-//* \brief Disable MCI IT
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_DisableIt (
- AT91PS_MCI pMCI, // \arg pointer to a MCI controller
- unsigned int flag) // \arg IT to be disabled
-{
- //* Write to the IDR register
- pMCI->MCI_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_GetStatus
-//* \brief Return MCI Interrupt Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MCI_GetStatus( // \return MCI Interrupt Status
- AT91PS_MCI pMCI) // pointer to a MCI controller
-{
- return pMCI->MCI_SR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_GetInterruptMaskStatus
-//* \brief Return MCI Interrupt Mask Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MCI_GetInterruptMaskStatus( // \return MCI Interrupt Mask Status
- AT91PS_MCI pMCI) // pointer to a MCI controller
-{
- return pMCI->MCI_IMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_IsInterruptMasked
-//* \brief Test if MCI Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MCI_IsInterruptMasked(
- AT91PS_MCI pMCI, // \arg pointer to a MCI controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_MCI_GetInterruptMaskStatus(pMCI) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_IsStatusSet
-//* \brief Test if MCI Status is Set
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MCI_IsStatusSet(
- AT91PS_MCI pMCI, // \arg pointer to a MCI controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_MCI_GetStatus(pMCI) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_Enable
-//* \brief Enable the MCI Interface
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_Enable (
- AT91PS_MCI pMCI) // \arg pointer to a MCI controller
-{
- //* Enable the MCI
- pMCI->MCI_CR = AT91C_MCI_MCIEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_Disable
-//* \brief Disable the MCI Interface
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_Disable (
- AT91PS_MCI pMCI) // \arg pointer to a MCI controller
-{
- //* Disable the MCI
- pMCI->MCI_CR = AT91C_MCI_MCIDIS;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_SW_Reset
-//* \brief Reset the MCI Interface
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_SW_Reset (
- AT91PS_MCI pMCI) // \arg pointer to a MCI controller
-{
- //* Disable the MCI
- pMCI->MCI_CR = AT91C_MCI_SWRST;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_CfgModeReg
-//* \brief Configure the Mode Register of the MCI controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_CfgModeReg (
- AT91PS_MCI pMCI, // pointer to a MCI controller
- unsigned int mode) // mode register
-{
- //* Write to the MR register
- pMCI->MCI_MR = mode;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_GetModeReg
-//* \brief Return the Mode Register of the MCI controller value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MCI_GetModeReg (
- AT91PS_MCI pMCI // pointer to a MCI controller
- )
-{
- return pMCI->MCI_MR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_CfgFrequency
-//* \brief Configure the frequency MCCK of the MCI controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_CfgFrequency (
- AT91PS_MCI pMCI, // pointer to a MCI controller
- unsigned int mck_clock, // in MHz
- unsigned int mci_clock) // in MHz
-{
- unsigned int prescal;
-
- prescal = mck_clock/(2*mci_clock) - 1;
-
- //* Write to the MR register
- pMCI->MCI_MR &= ~AT91C_MCI_CLKDIV;
- pMCI->MCI_MR |= (prescal & AT91C_MCI_CLKDIV);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_CfgDataTimeOutReg
-//* \brief Configure the Data TimeOut Register of the MCI controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_CfgDataTimeOutReg (
- AT91PS_MCI pMCI, // pointer to a MCI controller
- unsigned int cfg)
-{
- //* Write to the DTOR register
- pMCI->MCI_DTOR = cfg;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_GetDataTimeOutReg
-//* \brief Return the Data TimeOut Register of the MCI controller value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MCI_GetDataTimeOutReg (
- AT91PS_MCI pMCI // pointer to a MCI controller
- )
-{
- return pMCI->MCI_DTOR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_CfgSDCardReg
-//* \brief Configure the SDCard Register of the MCI controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_CfgSDCardReg (
- AT91PS_MCI pMCI, // pointer to a MCI controller
- unsigned int cfg)
-{
- //* Write to the SDCR register
- pMCI->MCI_SDCR = cfg;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_GetSDCardReg
-//* \brief Return the SDCard Register of the MCI controller value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MCI_GetSDCardReg (
- AT91PS_MCI pMCI // pointer to a MCI controller
- )
-{
- return pMCI->MCI_SDCR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_CfgARGReg
-//* \brief Configure the Command ARGUMENT Register of the MCI controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_CfgARGReg (
- AT91PS_MCI pMCI, // pointer to a MCI controller
- unsigned int arg)
-{
- //* Write to the ARG register
- pMCI->MCI_ARGR = arg;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_GetARGReg
-//* \brief Return the Command ARGUMENT Register of the MCI controller value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MCI_GetARGReg (
- AT91PS_MCI pMCI // pointer to a MCI controller
- )
-{
- return pMCI->MCI_ARGR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_CfgCMDReg
-//* \brief Configure the COMMAND Register of the MCI controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_CfgCMDReg (
- AT91PS_MCI pMCI, // pointer to a MCI controller
- unsigned int cmd)
-{
- //* Write to the ARG register
- pMCI->MCI_CMDR = cmd;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_GetRSP0Reg
-//* \brief Return the RESPONSE Register 0 of the MCI controller value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MCI_GetRSP0Reg (
- AT91PS_MCI pMCI // pointer to a MCI controller
- )
-{
- return pMCI->MCI_RSPR[0];
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_GetRSP1Reg
-//* \brief Return the RESPONSE Register 1 of the MCI controller value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MCI_GetRSP1Reg (
- AT91PS_MCI pMCI // pointer to a MCI controller
- )
-{
- return pMCI->MCI_RSPR[0];
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_GetRSP2Reg
-//* \brief Return the RESPONSE Register 2 of the MCI controller value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MCI_GetRSP2Reg (
- AT91PS_MCI pMCI // pointer to a MCI controller
- )
-{
- return pMCI->MCI_RSPR[0];
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_GetRSP3Reg
-//* \brief Return the RESPONSE Register 3 of the MCI controller value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_MCI_GetRSP3Reg (
- AT91PS_MCI pMCI // pointer to a MCI controller
- )
-{
- return pMCI->MCI_RSPR[0];
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR UDP
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_EnableIt
-//* \brief Enable UDP IT
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_EnableIt (
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned int flag) // \arg IT to be enabled
-{
- //* Write to the IER register
- pUDP->UDP_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_DisableIt
-//* \brief Disable UDP IT
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_DisableIt (
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned int flag) // \arg IT to be disabled
-{
- //* Write to the IDR register
- pUDP->UDP_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_SetAddress
-//* \brief Set UDP functional address
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_SetAddress (
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned char address) // \arg new UDP address
-{
- pUDP->UDP_FADDR = (AT91C_UDP_FEN | address);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_EnableEp
-//* \brief Enable Endpoint
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_EnableEp (
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned char endpoint) // \arg endpoint number
-{
- pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_DisableEp
-//* \brief Enable Endpoint
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_DisableEp (
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned char endpoint) // \arg endpoint number
-{
- pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_SetState
-//* \brief Set UDP Device state
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_SetState (
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned int flag) // \arg new UDP address
-{
- pUDP->UDP_GLBSTATE &= ~(AT91C_UDP_FADDEN | AT91C_UDP_CONFG);
- pUDP->UDP_GLBSTATE |= flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_GetState
-//* \brief return UDP Device state
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_UDP_GetState ( // \return the UDP device state
- AT91PS_UDP pUDP) // \arg pointer to a UDP controller
-{
- return (pUDP->UDP_GLBSTATE & (AT91C_UDP_FADDEN | AT91C_UDP_CONFG));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_ResetEp
-//* \brief Reset UDP endpoint
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_ResetEp ( // \return the UDP device state
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned int flag) // \arg Endpoints to be reset
-{
- pUDP->UDP_RSTEP = flag;
- pUDP->UDP_RSTEP = 0;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_EpStall
-//* \brief Endpoint will STALL requests
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_EpStall(
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned char endpoint) // \arg endpoint number
-{
- pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_EpWrite
-//* \brief Write value in the DPR
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_EpWrite(
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned char endpoint, // \arg endpoint number
- unsigned char value) // \arg value to be written in the DPR
-{
- pUDP->UDP_FDR[endpoint] = value;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_EpRead
-//* \brief Return value from the DPR
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_UDP_EpRead(
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned char endpoint) // \arg endpoint number
-{
- return pUDP->UDP_FDR[endpoint];
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_EpEndOfWr
-//* \brief Notify the UDP that values in DPR are ready to be sent
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_EpEndOfWr(
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned char endpoint) // \arg endpoint number
-{
- pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_EpClear
-//* \brief Clear flag in the endpoint CSR register
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_EpClear(
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned char endpoint, // \arg endpoint number
- unsigned int flag) // \arg flag to be cleared
-{
- pUDP->UDP_CSR[endpoint] &= ~(flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_EpSet
-//* \brief Set flag in the endpoint CSR register
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_EpSet(
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned char endpoint, // \arg endpoint number
- unsigned int flag) // \arg flag to be cleared
-{
- pUDP->UDP_CSR[endpoint] |= flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_EpStatus
-//* \brief Return the endpoint CSR register
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_UDP_EpStatus(
- AT91PS_UDP pUDP, // \arg pointer to a UDP controller
- unsigned char endpoint) // \arg endpoint number
-{
- return pUDP->UDP_CSR[endpoint];
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_GetInterruptMaskStatus
-//* \brief Return UDP Interrupt Mask Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_UDP_GetInterruptMaskStatus(
- AT91PS_UDP pUdp) // \arg pointer to a UDP controller
-{
- return pUdp->UDP_IMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_IsInterruptMasked
-//* \brief Test if UDP Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline int AT91F_UDP_IsInterruptMasked(
- AT91PS_UDP pUdp, // \arg pointer to a UDP controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_UDP_GetInterruptMaskStatus(pUdp) & flag);
-}
-
-// ----------------------------------------------------------------------------
-// \fn AT91F_UDP_InterruptStatusRegister
-// \brief Return the Interrupt Status Register
-// ----------------------------------------------------------------------------
-__inline unsigned int AT91F_UDP_InterruptStatusRegister(
- AT91PS_UDP pUDP ) // \arg pointer to a UDP controller
-{
- return pUDP->UDP_ISR;
-}
-
-// ----------------------------------------------------------------------------
-// \fn AT91F_UDP_InterruptClearRegister
-// \brief Clear Interrupt Register
-// ----------------------------------------------------------------------------
-__inline void AT91F_UDP_InterruptClearRegister (
- AT91PS_UDP pUDP, // \arg pointer to UDP controller
- unsigned int flag) // \arg IT to be cleat
-{
- pUDP->UDP_ICR = flag;
-}
-
-// ----------------------------------------------------------------------------
-// \fn AT91F_UDP_EnableTransceiver
-// \brief Enable transceiver
-// ----------------------------------------------------------------------------
-__inline void AT91F_UDP_EnableTransceiver(
- AT91PS_UDP pUDP ) // \arg pointer to a UDP controller
-{
- pUDP->UDP_TXVC &= ~AT91C_UDP_TXVDIS;
-}
-
-// ----------------------------------------------------------------------------
-// \fn AT91F_UDP_DisableTransceiver
-// \brief Disable transceiver
-// ----------------------------------------------------------------------------
-__inline void AT91F_UDP_DisableTransceiver(
- AT91PS_UDP pUDP ) // \arg pointer to a UDP controller
-{
- pUDP->UDP_TXVC = AT91C_UDP_TXVDIS;
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR TWI
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TWI_EnableIt
-//* \brief Enable TWI IT
-//*----------------------------------------------------------------------------
-__inline void AT91F_TWI_EnableIt (
- AT91PS_TWI pTWI, // \arg pointer to a TWI controller
- unsigned int flag) // \arg IT to be enabled
-{
- //* Write to the IER register
- pTWI->TWI_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TWI_DisableIt
-//* \brief Disable TWI IT
-//*----------------------------------------------------------------------------
-__inline void AT91F_TWI_DisableIt (
- AT91PS_TWI pTWI, // \arg pointer to a TWI controller
- unsigned int flag) // \arg IT to be disabled
-{
- //* Write to the IDR register
- pTWI->TWI_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TWI_Configure
-//* \brief Configure TWI in master mode
-//*----------------------------------------------------------------------------
-__inline void AT91F_TWI_Configure ( AT91PS_TWI pTWI ) // \arg pointer to a TWI controller
-{
- //* Disable interrupts
- pTWI->TWI_IDR = (unsigned int) -1;
-
- //* Reset peripheral
- pTWI->TWI_CR = AT91C_TWI_SWRST;
-
- //* Set Master mode
- pTWI->TWI_CR = AT91C_TWI_MSEN;
-
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TWI_GetInterruptMaskStatus
-//* \brief Return TWI Interrupt Mask Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_TWI_GetInterruptMaskStatus( // \return TWI Interrupt Mask Status
- AT91PS_TWI pTwi) // \arg pointer to a TWI controller
-{
- return pTwi->TWI_IMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TWI_IsInterruptMasked
-//* \brief Test if TWI Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline int AT91F_TWI_IsInterruptMasked(
- AT91PS_TWI pTwi, // \arg pointer to a TWI controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_TWI_GetInterruptMaskStatus(pTwi) & flag);
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR USART
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_Baudrate
-//* \brief Calculate the baudrate
-//* Standard Asynchronous Mode : 8 bits , 1 stop , no parity
-#define AT91C_US_ASYNC_MODE ( AT91C_US_USMODE_NORMAL + \
- AT91C_US_NBSTOP_1_BIT + \
- AT91C_US_PAR_NONE + \
- AT91C_US_CHRL_8_BITS + \
- AT91C_US_CLKS_CLOCK )
-
-//* Standard External Asynchronous Mode : 8 bits , 1 stop , no parity
-#define AT91C_US_ASYNC_SCK_MODE ( AT91C_US_USMODE_NORMAL + \
- AT91C_US_NBSTOP_1_BIT + \
- AT91C_US_PAR_NONE + \
- AT91C_US_CHRL_8_BITS + \
- AT91C_US_CLKS_EXT )
-
-//* Standard Synchronous Mode : 8 bits , 1 stop , no parity
-#define AT91C_US_SYNC_MODE ( AT91C_US_SYNC + \
- AT91C_US_USMODE_NORMAL + \
- AT91C_US_NBSTOP_1_BIT + \
- AT91C_US_PAR_NONE + \
- AT91C_US_CHRL_8_BITS + \
- AT91C_US_CLKS_CLOCK )
-
-//* SCK used Label
-#define AT91C_US_SCK_USED (AT91C_US_CKLO | AT91C_US_CLKS_EXT)
-
-//* Standard ISO T=0 Mode : 8 bits , 1 stop , parity
-#define AT91C_US_ISO_READER_MODE ( AT91C_US_USMODE_ISO7816_0 + \
- AT91C_US_CLKS_CLOCK +\
- AT91C_US_NBSTOP_1_BIT + \
- AT91C_US_PAR_EVEN + \
- AT91C_US_CHRL_8_BITS + \
- AT91C_US_CKLO +\
- AT91C_US_OVER)
-
-//* Standard IRDA mode
-#define AT91C_US_ASYNC_IRDA_MODE ( AT91C_US_USMODE_IRDA + \
- AT91C_US_NBSTOP_1_BIT + \
- AT91C_US_PAR_NONE + \
- AT91C_US_CHRL_8_BITS + \
- AT91C_US_CLKS_CLOCK )
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_Baudrate
-//* \brief Caluculate baud_value according to the main clock and the baud rate
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_US_Baudrate (
- const unsigned int main_clock, // \arg peripheral clock
- const unsigned int baud_rate) // \arg UART baudrate
-{
- unsigned int baud_value = ((main_clock*10)/(baud_rate * 16));
- if ((baud_value % 10) >= 5)
- baud_value = (baud_value / 10) + 1;
- else
- baud_value /= 10;
- return baud_value;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_SetBaudrate
-//* \brief Set the baudrate according to the CPU clock
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_SetBaudrate (
- AT91PS_USART pUSART, // \arg pointer to a USART controller
- unsigned int mainClock, // \arg peripheral clock
- unsigned int speed) // \arg UART baudrate
-{
- //* Define the baud rate divisor register
- pUSART->US_BRGR = AT91F_US_Baudrate(mainClock, speed);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_SetTimeguard
-//* \brief Set USART timeguard
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_SetTimeguard (
- AT91PS_USART pUSART, // \arg pointer to a USART controller
- unsigned int timeguard) // \arg timeguard value
-{
- //* Write the Timeguard Register
- pUSART->US_TTGR = timeguard ;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_EnableIt
-//* \brief Enable USART IT
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_EnableIt (
- AT91PS_USART pUSART, // \arg pointer to a USART controller
- unsigned int flag) // \arg IT to be enabled
-{
- //* Write to the IER register
- pUSART->US_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_DisableIt
-//* \brief Disable USART IT
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_DisableIt (
- AT91PS_USART pUSART, // \arg pointer to a USART controller
- unsigned int flag) // \arg IT to be disabled
-{
- //* Write to the IER register
- pUSART->US_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_Configure
-//* \brief Configure USART
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_Configure (
- AT91PS_USART pUSART, // \arg pointer to a USART controller
- unsigned int mainClock, // \arg peripheral clock
- unsigned int mode , // \arg mode Register to be programmed
- unsigned int baudRate , // \arg baudrate to be programmed
- unsigned int timeguard ) // \arg timeguard to be programmed
-{
- //* Disable interrupts
- pUSART->US_IDR = (unsigned int) -1;
-
- //* Reset receiver and transmitter
- pUSART->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS ;
-
- //* Define the baud rate divisor register
- AT91F_US_SetBaudrate(pUSART, mainClock, baudRate);
-
- //* Write the Timeguard Register
- AT91F_US_SetTimeguard(pUSART, timeguard);
-
- //* Clear Transmit and Receive Counters
- AT91F_PDC_Open((AT91PS_PDC) &(pUSART->US_RPR));
-
- //* Define the USART mode
- pUSART->US_MR = mode ;
-
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_EnableRx
-//* \brief Enable receiving characters
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_EnableRx (
- AT91PS_USART pUSART) // \arg pointer to a USART controller
-{
- //* Enable receiver
- pUSART->US_CR = AT91C_US_RXEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_EnableTx
-//* \brief Enable sending characters
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_EnableTx (
- AT91PS_USART pUSART) // \arg pointer to a USART controller
-{
- //* Enable transmitter
- pUSART->US_CR = AT91C_US_TXEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_ResetRx
-//* \brief Reset Receiver and re-enable it
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_ResetRx (
- AT91PS_USART pUSART) // \arg pointer to a USART controller
-{
- //* Reset receiver
- pUSART->US_CR = AT91C_US_RSTRX;
- //* Re-Enable receiver
- pUSART->US_CR = AT91C_US_RXEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_ResetTx
-//* \brief Reset Transmitter and re-enable it
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_ResetTx (
- AT91PS_USART pUSART) // \arg pointer to a USART controller
-{
- //* Reset transmitter
- pUSART->US_CR = AT91C_US_RSTTX;
- //* Enable transmitter
- pUSART->US_CR = AT91C_US_TXEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_DisableRx
-//* \brief Disable Receiver
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_DisableRx (
- AT91PS_USART pUSART) // \arg pointer to a USART controller
-{
- //* Disable receiver
- pUSART->US_CR = AT91C_US_RXDIS;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_DisableTx
-//* \brief Disable Transmitter
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_DisableTx (
- AT91PS_USART pUSART) // \arg pointer to a USART controller
-{
- //* Disable transmitter
- pUSART->US_CR = AT91C_US_TXDIS;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_Close
-//* \brief Close USART: disable IT disable receiver and transmitter, close PDC
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_Close (
- AT91PS_USART pUSART) // \arg pointer to a USART controller
-{
- //* Reset the baud rate divisor register
- pUSART->US_BRGR = 0 ;
-
- //* Reset the USART mode
- pUSART->US_MR = 0 ;
-
- //* Reset the Timeguard Register
- pUSART->US_TTGR = 0;
-
- //* Disable all interrupts
- pUSART->US_IDR = 0xFFFFFFFF ;
-
- //* Abort the Peripheral Data Transfers
- AT91F_PDC_Close((AT91PS_PDC) &(pUSART->US_RPR));
-
- //* Disable receiver and transmitter and stop any activity immediately
- pUSART->US_CR = AT91C_US_TXDIS | AT91C_US_RXDIS | AT91C_US_RSTTX | AT91C_US_RSTRX ;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_TxReady
-//* \brief Return 1 if a character can be written in US_THR
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_US_TxReady (
- AT91PS_USART pUSART ) // \arg pointer to a USART controller
-{
- return (pUSART->US_CSR & AT91C_US_TXRDY);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_RxReady
-//* \brief Return 1 if a character can be read in US_RHR
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_US_RxReady (
- AT91PS_USART pUSART ) // \arg pointer to a USART controller
-{
- return (pUSART->US_CSR & AT91C_US_RXRDY);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_Error
-//* \brief Return the error flag
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_US_Error (
- AT91PS_USART pUSART ) // \arg pointer to a USART controller
-{
- return (pUSART->US_CSR &
- (AT91C_US_OVRE | // Overrun error
- AT91C_US_FRAME | // Framing error
- AT91C_US_PARE)); // Parity error
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_PutChar
-//* \brief Send a character,does not check if ready to send
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_PutChar (
- AT91PS_USART pUSART,
- int character )
-{
- pUSART->US_THR = (character & 0x1FF);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_GetChar
-//* \brief Receive a character,does not check if a character is available
-//*----------------------------------------------------------------------------
-__inline int AT91F_US_GetChar (
- const AT91PS_USART pUSART)
-{
- return((pUSART->US_RHR) & 0x1FF);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_SendFrame
-//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_US_SendFrame(
- AT91PS_USART pUSART,
- char *pBuffer,
- unsigned int szBuffer,
- char *pNextBuffer,
- unsigned int szNextBuffer )
-{
- return AT91F_PDC_SendFrame(
- (AT91PS_PDC) &(pUSART->US_RPR),
- pBuffer,
- szBuffer,
- pNextBuffer,
- szNextBuffer);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_ReceiveFrame
-//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_US_ReceiveFrame (
- AT91PS_USART pUSART,
- char *pBuffer,
- unsigned int szBuffer,
- char *pNextBuffer,
- unsigned int szNextBuffer )
-{
- return AT91F_PDC_ReceiveFrame(
- (AT91PS_PDC) &(pUSART->US_RPR),
- pBuffer,
- szBuffer,
- pNextBuffer,
- szNextBuffer);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US_SetIrdaFilter
-//* \brief Set the value of IrDa filter tregister
-//*----------------------------------------------------------------------------
-__inline void AT91F_US_SetIrdaFilter (
- AT91PS_USART pUSART,
- unsigned char value
-)
-{
- pUSART->US_IF = value;
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR PWMC
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWM_GetStatus
-//* \brief Return PWM Interrupt Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PWMC_GetStatus( // \return PWM Interrupt Status
- AT91PS_PWMC pPWM) // pointer to a PWM controller
-{
- return pPWM->PWMC_SR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWM_InterruptEnable
-//* \brief Enable PWM Interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_InterruptEnable(
- AT91PS_PWMC pPwm, // \arg pointer to a PWM controller
- unsigned int flag) // \arg PWM interrupt to be enabled
-{
- pPwm->PWMC_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWM_InterruptDisable
-//* \brief Disable PWM Interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_InterruptDisable(
- AT91PS_PWMC pPwm, // \arg pointer to a PWM controller
- unsigned int flag) // \arg PWM interrupt to be disabled
-{
- pPwm->PWMC_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWM_GetInterruptMaskStatus
-//* \brief Return PWM Interrupt Mask Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PWMC_GetInterruptMaskStatus( // \return PWM Interrupt Mask Status
- AT91PS_PWMC pPwm) // \arg pointer to a PWM controller
-{
- return pPwm->PWMC_IMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWM_IsInterruptMasked
-//* \brief Test if PWM Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PWMC_IsInterruptMasked(
- AT91PS_PWMC pPWM, // \arg pointer to a PWM controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PWMC_GetInterruptMaskStatus(pPWM) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWM_IsStatusSet
-//* \brief Test if PWM Interrupt is Set
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_PWMC_IsStatusSet(
- AT91PS_PWMC pPWM, // \arg pointer to a PWM controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_PWMC_GetStatus(pPWM) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWM_CfgChannel
-//* \brief Test if PWM Interrupt is Set
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_CfgChannel(
- AT91PS_PWMC pPWM, // \arg pointer to a PWM controller
- unsigned int channelId, // \arg PWM channel ID
- unsigned int mode, // \arg PWM mode
- unsigned int period, // \arg PWM period
- unsigned int duty) // \arg PWM duty cycle
-{
- pPWM->PWMC_CH[channelId].PWMC_CMR = mode;
- pPWM->PWMC_CH[channelId].PWMC_CDTYR = duty;
- pPWM->PWMC_CH[channelId].PWMC_CPRDR = period;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWM_StartChannel
-//* \brief Enable channel
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_StartChannel(
- AT91PS_PWMC pPWM, // \arg pointer to a PWM controller
- unsigned int flag) // \arg Channels IDs to be enabled
-{
- pPWM->PWMC_ENA = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWM_StopChannel
-//* \brief Disable channel
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_StopChannel(
- AT91PS_PWMC pPWM, // \arg pointer to a PWM controller
- unsigned int flag) // \arg Channels IDs to be enabled
-{
- pPWM->PWMC_DIS = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWM_UpdateChannel
-//* \brief Update Period or Duty Cycle
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_UpdateChannel(
- AT91PS_PWMC pPWM, // \arg pointer to a PWM controller
- unsigned int channelId, // \arg PWM channel ID
- unsigned int update) // \arg Channels IDs to be enabled
-{
- pPWM->PWMC_CH[channelId].PWMC_CUPDR = update;
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR SSC
- ***************************************************************************** */
-//* Define the standard I2S mode configuration
-
-//* Configuration to set in the SSC Transmit Clock Mode Register
-//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits
-//* nb_slot_by_frame : number of channels
-#define AT91C_I2S_ASY_MASTER_TX_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\
- AT91C_SSC_CKS_DIV +\
- AT91C_SSC_CKO_CONTINOUS +\
- AT91C_SSC_CKG_NONE +\
- AT91C_SSC_START_FALL_RF +\
- AT91C_SSC_STTOUT +\
- ((1<<16) & AT91C_SSC_STTDLY) +\
- ((((nb_bit_by_slot*nb_slot_by_frame)/2)-1) <<24))
-
-
-//* Configuration to set in the SSC Transmit Frame Mode Register
-//* Parameters : nb_bit_by_slot : 8, 16 or 32 bits
-//* nb_slot_by_frame : number of channels
-#define AT91C_I2S_ASY_TX_FRAME_SETTING(nb_bit_by_slot, nb_slot_by_frame)( +\
- (nb_bit_by_slot-1) +\
- AT91C_SSC_MSBF +\
- (((nb_slot_by_frame-1)<<8) & AT91C_SSC_DATNB) +\
- (((nb_bit_by_slot-1)<<16) & AT91C_SSC_FSLEN) +\
- AT91C_SSC_FSOS_NEGATIVE)
-
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC_SetBaudrate
-//* \brief Set the baudrate according to the CPU clock
-//*----------------------------------------------------------------------------
-__inline void AT91F_SSC_SetBaudrate (
- AT91PS_SSC pSSC, // \arg pointer to a SSC controller
- unsigned int mainClock, // \arg peripheral clock
- unsigned int speed) // \arg SSC baudrate
-{
- unsigned int baud_value;
- //* Define the baud rate divisor register
- if (speed == 0)
- baud_value = 0;
- else
- {
- baud_value = (unsigned int) (mainClock * 10)/(2*speed);
- if ((baud_value % 10) >= 5)
- baud_value = (baud_value / 10) + 1;
- else
- baud_value /= 10;
- }
-
- pSSC->SSC_CMR = baud_value;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC_Configure
-//* \brief Configure SSC
-//*----------------------------------------------------------------------------
-__inline void AT91F_SSC_Configure (
- AT91PS_SSC pSSC, // \arg pointer to a SSC controller
- unsigned int syst_clock, // \arg System Clock Frequency
- unsigned int baud_rate, // \arg Expected Baud Rate Frequency
- unsigned int clock_rx, // \arg Receiver Clock Parameters
- unsigned int mode_rx, // \arg mode Register to be programmed
- unsigned int clock_tx, // \arg Transmitter Clock Parameters
- unsigned int mode_tx) // \arg mode Register to be programmed
-{
- //* Disable interrupts
- pSSC->SSC_IDR = (unsigned int) -1;
-
- //* Reset receiver and transmitter
- pSSC->SSC_CR = AT91C_SSC_SWRST | AT91C_SSC_RXDIS | AT91C_SSC_TXDIS ;
-
- //* Define the Clock Mode Register
- AT91F_SSC_SetBaudrate(pSSC, syst_clock, baud_rate);
-
- //* Write the Receive Clock Mode Register
- pSSC->SSC_RCMR = clock_rx;
-
- //* Write the Transmit Clock Mode Register
- pSSC->SSC_TCMR = clock_tx;
-
- //* Write the Receive Frame Mode Register
- pSSC->SSC_RFMR = mode_rx;
-
- //* Write the Transmit Frame Mode Register
- pSSC->SSC_TFMR = mode_tx;
-
- //* Clear Transmit and Receive Counters
- AT91F_PDC_Open((AT91PS_PDC) &(pSSC->SSC_RPR));
-
-
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC_EnableRx
-//* \brief Enable receiving datas
-//*----------------------------------------------------------------------------
-__inline void AT91F_SSC_EnableRx (
- AT91PS_SSC pSSC) // \arg pointer to a SSC controller
-{
- //* Enable receiver
- pSSC->SSC_CR = AT91C_SSC_RXEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC_DisableRx
-//* \brief Disable receiving datas
-//*----------------------------------------------------------------------------
-__inline void AT91F_SSC_DisableRx (
- AT91PS_SSC pSSC) // \arg pointer to a SSC controller
-{
- //* Disable receiver
- pSSC->SSC_CR = AT91C_SSC_RXDIS;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC_EnableTx
-//* \brief Enable sending datas
-//*----------------------------------------------------------------------------
-__inline void AT91F_SSC_EnableTx (
- AT91PS_SSC pSSC) // \arg pointer to a SSC controller
-{
- //* Enable transmitter
- pSSC->SSC_CR = AT91C_SSC_TXEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC_DisableTx
-//* \brief Disable sending datas
-//*----------------------------------------------------------------------------
-__inline void AT91F_SSC_DisableTx (
- AT91PS_SSC pSSC) // \arg pointer to a SSC controller
-{
- //* Disable transmitter
- pSSC->SSC_CR = AT91C_SSC_TXDIS;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC_EnableIt
-//* \brief Enable SSC IT
-//*----------------------------------------------------------------------------
-__inline void AT91F_SSC_EnableIt (
- AT91PS_SSC pSSC, // \arg pointer to a SSC controller
- unsigned int flag) // \arg IT to be enabled
-{
- //* Write to the IER register
- pSSC->SSC_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC_DisableIt
-//* \brief Disable SSC IT
-//*----------------------------------------------------------------------------
-__inline void AT91F_SSC_DisableIt (
- AT91PS_SSC pSSC, // \arg pointer to a SSC controller
- unsigned int flag) // \arg IT to be disabled
-{
- //* Write to the IDR register
- pSSC->SSC_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC_ReceiveFrame
-//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_SSC_ReceiveFrame (
- AT91PS_SSC pSSC,
- char *pBuffer,
- unsigned int szBuffer,
- char *pNextBuffer,
- unsigned int szNextBuffer )
-{
- return AT91F_PDC_ReceiveFrame(
- (AT91PS_PDC) &(pSSC->SSC_RPR),
- pBuffer,
- szBuffer,
- pNextBuffer,
- szNextBuffer);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC_SendFrame
-//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initialized with Next Buffer, 0 if PDC is busy
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_SSC_SendFrame(
- AT91PS_SSC pSSC,
- char *pBuffer,
- unsigned int szBuffer,
- char *pNextBuffer,
- unsigned int szNextBuffer )
-{
- return AT91F_PDC_SendFrame(
- (AT91PS_PDC) &(pSSC->SSC_RPR),
- pBuffer,
- szBuffer,
- pNextBuffer,
- szNextBuffer);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC_GetInterruptMaskStatus
-//* \brief Return SSC Interrupt Mask Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_SSC_GetInterruptMaskStatus( // \return SSC Interrupt Mask Status
- AT91PS_SSC pSsc) // \arg pointer to a SSC controller
-{
- return pSsc->SSC_IMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC_IsInterruptMasked
-//* \brief Test if SSC Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline int AT91F_SSC_IsInterruptMasked(
- AT91PS_SSC pSsc, // \arg pointer to a SSC controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_SSC_GetInterruptMaskStatus(pSsc) & flag);
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR ADC
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_EnableIt
-//* \brief Enable ADC interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_ADC_EnableIt (
- AT91PS_ADC pADC, // pointer to a ADC controller
- unsigned int flag) // IT to be enabled
-{
- //* Write to the IER register
- pADC->ADC_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_DisableIt
-//* \brief Disable ADC interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_ADC_DisableIt (
- AT91PS_ADC pADC, // pointer to a ADC controller
- unsigned int flag) // IT to be disabled
-{
- //* Write to the IDR register
- pADC->ADC_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetStatus
-//* \brief Return ADC Interrupt Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetStatus( // \return ADC Interrupt Status
- AT91PS_ADC pADC) // pointer to a ADC controller
-{
- return pADC->ADC_SR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetInterruptMaskStatus
-//* \brief Return ADC Interrupt Mask Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetInterruptMaskStatus( // \return ADC Interrupt Mask Status
- AT91PS_ADC pADC) // pointer to a ADC controller
-{
- return pADC->ADC_IMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_IsInterruptMasked
-//* \brief Test if ADC Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_IsInterruptMasked(
- AT91PS_ADC pADC, // \arg pointer to a ADC controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_ADC_GetInterruptMaskStatus(pADC) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_IsStatusSet
-//* \brief Test if ADC Status is Set
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_IsStatusSet(
- AT91PS_ADC pADC, // \arg pointer to a ADC controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_ADC_GetStatus(pADC) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_CfgModeReg
-//* \brief Configure the Mode Register of the ADC controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_ADC_CfgModeReg (
- AT91PS_ADC pADC, // pointer to a ADC controller
- unsigned int mode) // mode register
-{
- //* Write to the MR register
- pADC->ADC_MR = mode;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetModeReg
-//* \brief Return the Mode Register of the ADC controller value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetModeReg (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- return pADC->ADC_MR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_CfgTimings
-//* \brief Configure the different necessary timings of the ADC controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_ADC_CfgTimings (
- AT91PS_ADC pADC, // pointer to a ADC controller
- unsigned int mck_clock, // in MHz
- unsigned int adc_clock, // in MHz
- unsigned int startup_time, // in us
- unsigned int sample_and_hold_time) // in ns
-{
- unsigned int prescal,startup,shtim;
-
- prescal = mck_clock/(2*adc_clock) - 1;
- startup = adc_clock*startup_time/8 - 1;
- shtim = adc_clock*sample_and_hold_time/1000 - 1;
-
- //* Write to the MR register
- pADC->ADC_MR = ( (prescal<<8) & AT91C_ADC_PRESCAL) | ( (startup<<16) & AT91C_ADC_STARTUP) | ( (shtim<<24) & AT91C_ADC_SHTIM);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_EnableChannel
-//* \brief Return ADC Timer Register Value
-//*----------------------------------------------------------------------------
-__inline void AT91F_ADC_EnableChannel (
- AT91PS_ADC pADC, // pointer to a ADC controller
- unsigned int channel) // mode register
-{
- //* Write to the CHER register
- pADC->ADC_CHER = channel;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_DisableChannel
-//* \brief Return ADC Timer Register Value
-//*----------------------------------------------------------------------------
-__inline void AT91F_ADC_DisableChannel (
- AT91PS_ADC pADC, // pointer to a ADC controller
- unsigned int channel) // mode register
-{
- //* Write to the CHDR register
- pADC->ADC_CHDR = channel;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetChannelStatus
-//* \brief Return ADC Timer Register Value
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetChannelStatus (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- return pADC->ADC_CHSR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_StartConversion
-//* \brief Software request for a analog to digital conversion
-//*----------------------------------------------------------------------------
-__inline void AT91F_ADC_StartConversion (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- pADC->ADC_CR = AT91C_ADC_START;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_SoftReset
-//* \brief Software reset
-//*----------------------------------------------------------------------------
-__inline void AT91F_ADC_SoftReset (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- pADC->ADC_CR = AT91C_ADC_SWRST;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetLastConvertedData
-//* \brief Return the Last Converted Data
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetLastConvertedData (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- return pADC->ADC_LCDR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetConvertedDataCH0
-//* \brief Return the Channel 0 Converted Data
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetConvertedDataCH0 (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- return pADC->ADC_CDR0;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetConvertedDataCH1
-//* \brief Return the Channel 1 Converted Data
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetConvertedDataCH1 (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- return pADC->ADC_CDR1;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetConvertedDataCH2
-//* \brief Return the Channel 2 Converted Data
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetConvertedDataCH2 (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- return pADC->ADC_CDR2;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetConvertedDataCH3
-//* \brief Return the Channel 3 Converted Data
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetConvertedDataCH3 (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- return pADC->ADC_CDR3;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetConvertedDataCH4
-//* \brief Return the Channel 4 Converted Data
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetConvertedDataCH4 (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- return pADC->ADC_CDR4;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetConvertedDataCH5
-//* \brief Return the Channel 5 Converted Data
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetConvertedDataCH5 (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- return pADC->ADC_CDR5;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetConvertedDataCH6
-//* \brief Return the Channel 6 Converted Data
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetConvertedDataCH6 (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- return pADC->ADC_CDR6;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC_GetConvertedDataCH7
-//* \brief Return the Channel 7 Converted Data
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_ADC_GetConvertedDataCH7 (
- AT91PS_ADC pADC // pointer to a ADC controller
- )
-{
- return pADC->ADC_CDR7;
-}
-
-/* *****************************************************************************
- SOFTWARE API FOR SPI
- ***************************************************************************** */
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_CfgCs
-//* \brief Configure SPI chip select register
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI_CfgCs (
- AT91PS_SPI pSPI, // pointer to a SPI controller
- int cs, // SPI cs number (0 to 3)
- int val) // chip select register
-{
- //* Write to the CSR register
- *(pSPI->SPI_CSR + cs) = val;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_EnableIt
-//* \brief Enable SPI interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI_EnableIt (
- AT91PS_SPI pSPI, // pointer to a SPI controller
- unsigned int flag) // IT to be enabled
-{
- //* Write to the IER register
- pSPI->SPI_IER = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_DisableIt
-//* \brief Disable SPI interrupt
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI_DisableIt (
- AT91PS_SPI pSPI, // pointer to a SPI controller
- unsigned int flag) // IT to be disabled
-{
- //* Write to the IDR register
- pSPI->SPI_IDR = flag;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_Reset
-//* \brief Reset the SPI controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI_Reset (
- AT91PS_SPI pSPI // pointer to a SPI controller
- )
-{
- //* Write to the CR register
- pSPI->SPI_CR = AT91C_SPI_SWRST;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_Enable
-//* \brief Enable the SPI controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI_Enable (
- AT91PS_SPI pSPI // pointer to a SPI controller
- )
-{
- //* Write to the CR register
- pSPI->SPI_CR = AT91C_SPI_SPIEN;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_Disable
-//* \brief Disable the SPI controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI_Disable (
- AT91PS_SPI pSPI // pointer to a SPI controller
- )
-{
- //* Write to the CR register
- pSPI->SPI_CR = AT91C_SPI_SPIDIS;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_CfgMode
-//* \brief Enable the SPI controller
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI_CfgMode (
- AT91PS_SPI pSPI, // pointer to a SPI controller
- int mode) // mode register
-{
- //* Write to the MR register
- pSPI->SPI_MR = mode;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_CfgPCS
-//* \brief Switch to the correct PCS of SPI Mode Register : Fixed Peripheral Selected
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI_CfgPCS (
- AT91PS_SPI pSPI, // pointer to a SPI controller
- char PCS_Device) // PCS of the Device
-{
- //* Write to the MR register
- pSPI->SPI_MR &= 0xFFF0FFFF;
- pSPI->SPI_MR |= ( (PCS_Device<<16) & AT91C_SPI_PCS );
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_ReceiveFrame
-//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is busy
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_SPI_ReceiveFrame (
- AT91PS_SPI pSPI,
- char *pBuffer,
- unsigned int szBuffer,
- char *pNextBuffer,
- unsigned int szNextBuffer )
-{
- return AT91F_PDC_ReceiveFrame(
- (AT91PS_PDC) &(pSPI->SPI_RPR),
- pBuffer,
- szBuffer,
- pNextBuffer,
- szNextBuffer);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_SendFrame
-//* \brief Return 2 if PDC has been initialized with Buffer and Next Buffer, 1 if PDC has been initializaed with Next Buffer, 0 if PDC is bSPIy
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_SPI_SendFrame(
- AT91PS_SPI pSPI,
- char *pBuffer,
- unsigned int szBuffer,
- char *pNextBuffer,
- unsigned int szNextBuffer )
-{
- return AT91F_PDC_SendFrame(
- (AT91PS_PDC) &(pSPI->SPI_RPR),
- pBuffer,
- szBuffer,
- pNextBuffer,
- szNextBuffer);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_Close
-//* \brief Close SPI: disable IT disable transfert, close PDC
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI_Close (
- AT91PS_SPI pSPI) // \arg pointer to a SPI controller
-{
- //* Reset all the Chip Select register
- pSPI->SPI_CSR[0] = 0 ;
- pSPI->SPI_CSR[1] = 0 ;
- pSPI->SPI_CSR[2] = 0 ;
- pSPI->SPI_CSR[3] = 0 ;
-
- //* Reset the SPI mode
- pSPI->SPI_MR = 0 ;
-
- //* Disable all interrupts
- pSPI->SPI_IDR = 0xFFFFFFFF ;
-
- //* Abort the Peripheral Data Transfers
- AT91F_PDC_Close((AT91PS_PDC) &(pSPI->SPI_RPR));
-
- //* Disable receiver and transmitter and stop any activity immediately
- pSPI->SPI_CR = AT91C_SPI_SPIDIS;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_PutChar
-//* \brief Send a character,does not check if ready to send
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI_PutChar (
- AT91PS_SPI pSPI,
- unsigned int character,
- unsigned int cs_number )
-{
- unsigned int value_for_cs;
- value_for_cs = (~(1 << cs_number)) & 0xF; //Place a zero among a 4 ONEs number
- pSPI->SPI_TDR = (character & 0xFFFF) | (value_for_cs << 16);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_GetChar
-//* \brief Receive a character,does not check if a character is available
-//*----------------------------------------------------------------------------
-__inline int AT91F_SPI_GetChar (
- const AT91PS_SPI pSPI)
-{
- return((pSPI->SPI_RDR) & 0xFFFF);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_GetInterruptMaskStatus
-//* \brief Return SPI Interrupt Mask Status
-//*----------------------------------------------------------------------------
-__inline unsigned int AT91F_SPI_GetInterruptMaskStatus( // \return SPI Interrupt Mask Status
- AT91PS_SPI pSpi) // \arg pointer to a SPI controller
-{
- return pSpi->SPI_IMR;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI_IsInterruptMasked
-//* \brief Test if SPI Interrupt is Masked
-//*----------------------------------------------------------------------------
-__inline int AT91F_SPI_IsInterruptMasked(
- AT91PS_SPI pSpi, // \arg pointer to a SPI controller
- unsigned int flag) // \arg flag to be tested
-{
- return (AT91F_SPI_GetInterruptMaskStatus(pSpi) & flag);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MC_CfgPMC
-//* \brief Enable Peripheral clock in PMC for MC
-//*----------------------------------------------------------------------------
-__inline void AT91F_MC_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_SYS));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_DBGU_CfgPMC
-//* \brief Enable Peripheral clock in PMC for DBGU
-//*----------------------------------------------------------------------------
-__inline void AT91F_DBGU_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_SYS));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_DBGU_CfgPIO
-//* \brief Configure PIO controllers to drive DBGU signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_DBGU_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA31_DTXD ) |
- ((unsigned int) AT91C_PA30_DRXD ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWMC_CH0_CfgPIO
-//* \brief Configure PIO controllers to drive PWMC_CH0 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_CH0_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA18_PWM0 ), // Peripheral A
- 0); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB14_PWM0 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWMC_CH1_CfgPIO
-//* \brief Configure PIO controllers to drive PWMC_CH1 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_CH1_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA19_PWM1 ), // Peripheral A
- 0); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB15_PWM1 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWMC_CH2_CfgPIO
-//* \brief Configure PIO controllers to drive PWMC_CH2 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_CH2_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA20_PWM2 ), // Peripheral A
- 0); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB16_PWM2 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWMC_CH3_CfgPIO
-//* \brief Configure PIO controllers to drive PWMC_CH3 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_CH3_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA21_PWM3 ), // Peripheral A
- 0); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB17_PWM3 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWMC_CH4_CfgPIO
-//* \brief Configure PIO controllers to drive PWMC_CH4 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_CH4_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA22_PWM4 ), // Peripheral A
- 0); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB18_PWM4 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWMC_CH5_CfgPIO
-//* \brief Configure PIO controllers to drive PWMC_CH5 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_CH5_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA23_PWM5 ), // Peripheral A
- 0); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB0_PWM5 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWMC_CH6_CfgPIO
-//* \brief Configure PIO controllers to drive PWMC_CH6 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_CH6_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA24_PWM6 ), // Peripheral A
- 0); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB1_PWM6 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWMC_CH7_CfgPIO
-//* \brief Configure PIO controllers to drive PWMC_CH7 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_CH7_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA25_PWM7 ), // Peripheral A
- 0); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB2_PWM7 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SHDWC_CfgPMC
-//* \brief Enable Peripheral clock in PMC for SHDWC
-//*----------------------------------------------------------------------------
-__inline void AT91F_SHDWC_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_SYS));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI0_CfgPMC
-//* \brief Enable Peripheral clock in PMC for SPI0
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI0_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_SPI0));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI0_CfgPIO
-//* \brief Configure PIO controllers to drive SPI0 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI0_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA16_SPI0_MOSI) |
- ((unsigned int) AT91C_PA11_SPI0_NPCS0) |
- ((unsigned int) AT91C_PA12_SPI0_NPCS1) |
- ((unsigned int) AT91C_PA15_SPI0_MISO) |
- ((unsigned int) AT91C_PA13_SPI0_NPCS2) |
- ((unsigned int) AT91C_PA17_SPI0_SPCK) |
- ((unsigned int) AT91C_PA14_SPI0_NPCS3), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI1_CfgPMC
-//* \brief Enable Peripheral clock in PMC for SPI1
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI1_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_SPI1));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SPI1_CfgPIO
-//* \brief Configure PIO controllers to drive SPI1 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_SPI1_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PA9_SPI1_MOSI) |
- ((unsigned int) AT91C_PA4_SPI1_NPCS0) |
- ((unsigned int) AT91C_PA8_SPI1_MISO) |
- ((unsigned int) AT91C_PA5_SPI1_NPCS1) |
- ((unsigned int) AT91C_PA10_SPI1_SPCK) |
- ((unsigned int) AT91C_PA6_SPI1_NPCS2) |
- ((unsigned int) AT91C_PA7_SPI1_NPCS3)); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB19_SPI1_NPCS1) |
- ((unsigned int) AT91C_PB20_SPI1_NPCS2) |
- ((unsigned int) AT91C_PB21_SPI1_NPCS3)); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC0_CfgPMC
-//* \brief Enable Peripheral clock in PMC for SSC0
-//*----------------------------------------------------------------------------
-__inline void AT91F_SSC0_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_SSC0));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC0_CfgPIO
-//* \brief Configure PIO controllers to drive SSC0 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_SSC0_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- ((unsigned int) AT91C_PB7_RF0 ) |
- ((unsigned int) AT91C_PB3_TK0 ) |
- ((unsigned int) AT91C_PB6_RK0 ) |
- ((unsigned int) AT91C_PB4_TD0 ) |
- ((unsigned int) AT91C_PB5_RD0 ) |
- ((unsigned int) AT91C_PB2_TF0 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC1_CfgPMC
-//* \brief Enable Peripheral clock in PMC for SSC1
-//*----------------------------------------------------------------------------
-__inline void AT91F_SSC1_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_SSC1));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_SSC1_CfgPIO
-//* \brief Configure PIO controllers to drive SSC1 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_SSC1_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB9_TK1 ) |
- ((unsigned int) AT91C_PB11_RF1 ) |
- ((unsigned int) AT91C_PB10_RK1 ) |
- ((unsigned int) AT91C_PB12_TD1 ) |
- ((unsigned int) AT91C_PB13_RD1 ) |
- ((unsigned int) AT91C_PB8_TF1 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWMC_CfgPMC
-//* \brief Enable Peripheral clock in PMC for PWMC
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_PWMC));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC0_CfgPMC
-//* \brief Enable Peripheral clock in PMC for TC0
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC0_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_TC0));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC0_CfgPIO
-//* \brief Configure PIO controllers to drive TC0 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC0_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- ((unsigned int) AT91C_PB12_TIOA0 ) |
- ((unsigned int) AT91C_PB13_TIOB0 ) |
- ((unsigned int) AT91C_PB9_TCLK0 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC1_CfgPMC
-//* \brief Enable Peripheral clock in PMC for TC1
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC1_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_TC1));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC1_CfgPIO
-//* \brief Configure PIO controllers to drive TC1 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC1_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- ((unsigned int) AT91C_PB14_TIOA1 ) |
- ((unsigned int) AT91C_PB15_TIOB1 ) |
- ((unsigned int) AT91C_PB10_TCLK1 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC2_CfgPMC
-//* \brief Enable Peripheral clock in PMC for TC2
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC2_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_TC2));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC2_CfgPIO
-//* \brief Configure PIO controllers to drive TC2 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC2_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- ((unsigned int) AT91C_PB16_TIOA2 ) |
- ((unsigned int) AT91C_PB17_TIOB2 ) |
- ((unsigned int) AT91C_PB11_TCLK2 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC3_CfgPMC
-//* \brief Enable Peripheral clock in PMC for TC3
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC3_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_TC3));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC3_CfgPIO
-//* \brief Configure PIO controllers to drive TC3 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC3_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PA28_TCLK3 )); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- ((unsigned int) AT91C_PB18_TIOA3 ) |
- ((unsigned int) AT91C_PB19_TIOB3 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC4_CfgPMC
-//* \brief Enable Peripheral clock in PMC for TC4
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC4_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_TC4));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC4_CfgPIO
-//* \brief Configure PIO controllers to drive TC4 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC4_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PA24_TCLK4 )); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- ((unsigned int) AT91C_PB21_TIOB4 ) |
- ((unsigned int) AT91C_PB20_TIOA4 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC5_CfgPMC
-//* \brief Enable Peripheral clock in PMC for TC5
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC5_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_TC5));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC5_CfgPIO
-//* \brief Configure PIO controllers to drive TC5 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC5_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PA25_TCLK5 )); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- ((unsigned int) AT91C_PB23_TIOB5 ) |
- ((unsigned int) AT91C_PB22_TIOA5 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC6_CfgPMC
-//* \brief Enable Peripheral clock in PMC for TC6
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC6_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_TC6));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC6_CfgPIO
-//* \brief Configure PIO controllers to drive TC6 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC6_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PA29_TCLK6 )); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- ((unsigned int) AT91C_PB24_TIOA6 ) |
- ((unsigned int) AT91C_PB25_TIOB6 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC7_CfgPMC
-//* \brief Enable Peripheral clock in PMC for TC7
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC7_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_TC7));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC7_CfgPIO
-//* \brief Configure PIO controllers to drive TC7 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC7_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PA30_TCLK7 )); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- ((unsigned int) AT91C_PB26_TIOA7 ) |
- ((unsigned int) AT91C_PB27_TIOB7 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC8_CfgPMC
-//* \brief Enable Peripheral clock in PMC for TC8
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC8_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_TC8));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TC8_CfgPIO
-//* \brief Configure PIO controllers to drive TC8 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_TC8_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PA31_TCLK8 )); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- ((unsigned int) AT91C_PB28_TIOA8 ) |
- ((unsigned int) AT91C_PB29_TIOB8 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PITC_CfgPMC
-//* \brief Enable Peripheral clock in PMC for PITC
-//*----------------------------------------------------------------------------
-__inline void AT91F_PITC_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_SYS));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC0_CfgPMC
-//* \brief Enable Peripheral clock in PMC for ADC0
-//*----------------------------------------------------------------------------
-__inline void AT91F_ADC0_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_ADC0));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC0_CfgPIO
-//* \brief Configure PIO controllers to drive ADC0 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_ADC0_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PA0_ADTRG0 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC1_CfgPMC
-//* \brief Enable Peripheral clock in PMC for ADC1
-//*----------------------------------------------------------------------------
-__inline void AT91F_ADC1_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_ADC1));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_ADC1_CfgPIO
-//* \brief Configure PIO controllers to drive ADC1 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_ADC1_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PA1_ADTRG1 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_CfgPMC
-//* \brief Enable Peripheral clock in PMC for PMC
-//*----------------------------------------------------------------------------
-__inline void AT91F_PMC_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_SYS));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PMC_CfgPIO
-//* \brief Configure PIO controllers to drive PMC signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_PMC_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PA19_PCK1 ) |
- ((unsigned int) AT91C_PA20_PCK2 ) |
- ((unsigned int) AT91C_PA21_PCK3 ) |
- ((unsigned int) AT91C_PA18_PCK0 )); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB4_PCK1 ) |
- ((unsigned int) AT91C_PB5_PCK2 ) |
- ((unsigned int) AT91C_PB6_PCK3 ) |
- ((unsigned int) AT91C_PB3_PCK0 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_RSTC_CfgPMC
-//* \brief Enable Peripheral clock in PMC for RSTC
-//*----------------------------------------------------------------------------
-__inline void AT91F_RSTC_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_SYS));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIOA_CfgPMC
-//* \brief Enable Peripheral clock in PMC for PIOA
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIOA_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_PIOA));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PIOB_CfgPMC
-//* \brief Enable Peripheral clock in PMC for PIOB
-//*----------------------------------------------------------------------------
-__inline void AT91F_PIOB_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_PIOB));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_RTTC_CfgPMC
-//* \brief Enable Peripheral clock in PMC for RTTC
-//*----------------------------------------------------------------------------
-__inline void AT91F_RTTC_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_SYS));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TWI_CfgPMC
-//* \brief Enable Peripheral clock in PMC for TWI
-//*----------------------------------------------------------------------------
-__inline void AT91F_TWI_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_TWI));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_TWI_CfgPIO
-//* \brief Configure PIO controllers to drive TWI signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_TWI_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA0_TWD ) |
- ((unsigned int) AT91C_PA1_TWCK ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US0_CfgPMC
-//* \brief Enable Peripheral clock in PMC for US0
-//*----------------------------------------------------------------------------
-__inline void AT91F_US0_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_US0));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US0_CfgPIO
-//* \brief Configure PIO controllers to drive US0 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_US0_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA2_RXD0 ) |
- ((unsigned int) AT91C_PA3_TXD0 ) |
- ((unsigned int) AT91C_PA5_RTS0 ) |
- ((unsigned int) AT91C_PA4_SCK0 ) |
- ((unsigned int) AT91C_PA6_CTS0 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US1_CfgPMC
-//* \brief Enable Peripheral clock in PMC for US1
-//*----------------------------------------------------------------------------
-__inline void AT91F_US1_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_US1));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US1_CfgPIO
-//* \brief Configure PIO controllers to drive US1 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_US1_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA7_RXD1 ) |
- ((unsigned int) AT91C_PA8_TXD1 ), // Peripheral A
- 0); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB26_SCK1 ) |
- ((unsigned int) AT91C_PB24_RTS1 ) |
- ((unsigned int) AT91C_PB25_CTS1 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US2_CfgPMC
-//* \brief Enable Peripheral clock in PMC for US2
-//*----------------------------------------------------------------------------
-__inline void AT91F_US2_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_US2));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_US2_CfgPIO
-//* \brief Configure PIO controllers to drive US2 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_US2_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA10_TXD2 ) |
- ((unsigned int) AT91C_PA9_RXD2 ), // Peripheral A
- 0); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB28_CTS2 ) |
- ((unsigned int) AT91C_PB29_SCK2 ) |
- ((unsigned int) AT91C_PB27_RTS2 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_CfgPMC
-//* \brief Enable Peripheral clock in PMC for MCI
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_MCI));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_MCI_CfgPIO
-//* \brief Configure PIO controllers to drive MCI signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_MCI_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PA14_MCDA3 ) |
- ((unsigned int) AT91C_PA16_MCCDA ) |
- ((unsigned int) AT91C_PA15_MCDA0 ) |
- ((unsigned int) AT91C_PA17_MCCK ) |
- ((unsigned int) AT91C_PA12_MCDA1 ) |
- ((unsigned int) AT91C_PA13_MCDA2 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_WDTC_CfgPMC
-//* \brief Enable Peripheral clock in PMC for WDTC
-//*----------------------------------------------------------------------------
-__inline void AT91F_WDTC_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_SYS));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_UDP_CfgPMC
-//* \brief Enable Peripheral clock in PMC for UDP
-//*----------------------------------------------------------------------------
-__inline void AT91F_UDP_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_UDP));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_AIC_CfgPMC
-//* \brief Enable Peripheral clock in PMC for AIC
-//*----------------------------------------------------------------------------
-__inline void AT91F_AIC_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_IRQ1) |
- ((unsigned int) 1 << AT91C_ID_IRQ2) |
- ((unsigned int) 1 << AT91C_ID_FIQ) |
- ((unsigned int) 1 << AT91C_ID_IRQ3) |
- ((unsigned int) 1 << AT91C_ID_IRQ0));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_AIC_CfgPIO
-//* \brief Configure PIO controllers to drive AIC signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_AIC_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PA22_IRQ0 ) |
- ((unsigned int) AT91C_PA23_IRQ1 )); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- ((unsigned int) AT91C_PB8_FIQ ) |
- ((unsigned int) AT91C_PB0_IRQ2 ) |
- ((unsigned int) AT91C_PB1_IRQ3 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN0_CfgPMC
-//* \brief Enable Peripheral clock in PMC for CAN0
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN0_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_CAN0));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN0_CfgPIO
-//* \brief Configure PIO controllers to drive CAN0 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN0_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA27_CANTX0 ) |
- ((unsigned int) AT91C_PA26_CANRX0 ), // Peripheral A
- 0); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN1_CfgPMC
-//* \brief Enable Peripheral clock in PMC for CAN1
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN1_CfgPMC (void)
-{
- AT91F_PMC_EnablePeriphClock(
- AT91C_BASE_PMC, // PIO controller base address
- ((unsigned int) 1 << AT91C_ID_CAN1));
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_CAN1_CfgPIO
-//* \brief Configure PIO controllers to drive CAN1 signals
-//*----------------------------------------------------------------------------
-__inline void AT91F_CAN1_CfgPIO (void)
-{
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOA, // PIO controller base address
- ((unsigned int) AT91C_PA29_CANTX1 ) |
- ((unsigned int) AT91C_PA28_CANRX1 ), // Peripheral A
- 0); // Peripheral B
- // Configure PIO controllers to periph mode
- AT91F_PIO_CfgPeriph(
- AT91C_BASE_PIOB, // PIO controller base address
- 0, // Peripheral A
- ((unsigned int) AT91C_PB7_CANTX1 )); // Peripheral B
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_DBGU_SetBaudRate
-//* \brief Set baud rate for DBGU
-//*----------------------------------------------------------------------------
-__inline void AT91F_DBGU_SetBaudRate(
- AT91PS_DBGU pDbgu, // \arg pointer to a DBGU controller
- unsigned int cd) // \arg dbgu CD
-{
- pDbgu->DBGU_BRGR = cd;
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_DBGU_Configure
-//* \brief Configure DBGU
-//*----------------------------------------------------------------------------
-__inline void AT91F_DBGU_Configure (
- AT91PS_DBGU pDbgu, // \arg pointer to a USART controller
- unsigned int bd, // \arg baudrate to be programmed
- unsigned int mode) // \arg mode Register to be programmed
-{
- // Disable interrupts
- pDbgu->DBGU_IDR = (unsigned int) -1;
- // Reset receiver and transmitter
- pDbgu->DBGU_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RXDIS | AT91C_US_TXDIS | AT91C_US_RSTSTA;
- // Define the baud rate divisor register
- AT91F_DBGU_SetBaudRate(pDbgu, bd);
- // Define the DBGU mode
- pDbgu->DBGU_MR = mode;
-}
-
-__inline void AT91F_DBGU_EnableRx (
- AT91PS_DBGU pDbgu) // \arg pointer to a USART controller
-{
- //* Enable receiver
- pDbgu->DBGU_CR = AT91C_US_RXEN;
-}
-
-__inline void AT91F_DBGU_EnableTx (
- AT91PS_DBGU pDbgu) // \arg pointer to a USART controller
-{
- //* Enable transmitter
- pDbgu->DBGU_CR = AT91C_US_TXEN;
-}
-
-__inline void AT91F_DBGU_PutChar (
- AT91PS_DBGU pDbgu,
- unsigned char character )
-{
- pDbgu->DBGU_THR = (character & 0xFF);
-}
-
-__inline unsigned int AT91F_DBGU_IsENDTXInt (
- AT91PS_DBGU pDbgu ) // \arg pointer to a USART controller
-{
- return (pDbgu->DBGU_CSR & AT91C_US_ENDTX);
-}
-
-__inline unsigned int AT91F_DBGU_IsTXRDYInt (
- AT91PS_DBGU pDbgu ) // \arg pointer to a USART controller
-{
- return (pDbgu->DBGU_CSR & AT91C_US_TXRDY);
-}
-
-__inline unsigned int AT91F_DBGU_IsRXRDYInt(
- AT91PS_DBGU pDbgu ) // \arg pointer to a USART controller
-{
- return (pDbgu->DBGU_CSR & AT91C_US_RXRDY);
-}
-
-__inline unsigned int AT91F_DBGU_IsOVREInt (
- AT91PS_DBGU pDbgu ) // \arg pointer to a USART controller
-{
- return (pDbgu->DBGU_CSR & AT91C_US_OVRE);
-}
-
-__inline unsigned int AT91F_DBGU_IsFRAMEInt (
- AT91PS_DBGU pDbgu ) // \arg pointer to a USART controller
-{
- return (pDbgu->DBGU_CSR & AT91C_US_FRAME);
-}
-
-__inline unsigned int AT91F_DBGU_IsPAREInt (
- AT91PS_DBGU pDbgu ) // \arg pointer to a USART controller
-{
- return (pDbgu->DBGU_CSR & AT91C_US_PARE);
-}
-
-__inline unsigned int AT91F_DBGU_IsTXEMPTYInt (
- AT91PS_DBGU pDbgu ) // \arg pointer to a USART controller
-{
- return (pDbgu->DBGU_CSR & AT91C_US_TXEMPTY);
-}
-
-__inline void AT91F_DBGU_ResetStatus (
- AT91PS_DBGU pDbgu ) // \arg pointer to a USART controller
-{
- pDbgu->DBGU_CR = AT91C_US_RSTSTA;
-}
-
-__inline unsigned char AT91F_DBGU_GetChar (
- AT91PS_DBGU pDbgu ) // \arg pointer to a USART controller
-{
- return (AT91C_BASE_DBGU->DBGU_RHR);
-}
-
-//*----------------------------------------------------------------------------
-//* \fn AT91F_PWMC_Reset
-//* \brief Reset PWM main registers
-//*----------------------------------------------------------------------------
-__inline void AT91F_PWMC_Reset(
- AT91PS_PWMC pPWM) // pointer to a PWM controller
-{
- pPWM->PWMC_MR = 0; //clock off
-}
-
-
-#endif // lib_AT91SAM7A3_H
diff --git a/platforms_startup/armcc/LPC1768/LPC17xx.h b/platforms_startup/armcc/LPC1768/LPC17xx.h
deleted file mode 100644
index 556b1fad4..000000000
--- a/platforms_startup/armcc/LPC1768/LPC17xx.h
+++ /dev/null
@@ -1,1083 +0,0 @@
-/**************************************************************************//**
- * @file LPC17xx.h
- * @brief CMSIS Cortex-M3 Core Peripheral Access Layer Header File for
- * NXP LPC17xx Device Series
- * @version: V1.09
- * @date: 25. July. 2011
- *
- * @note
- * Copyright (C) 2009 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M
- * processor based microcontrollers. This file can be freely distributed
- * within development tools that are supporting such ARM based processors.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#ifndef __LPC17xx_H__
-#define __LPC17xx_H__
-
-/*
- * ==========================================================================
- * ---------- Interrupt Number Definition -----------------------------------
- * ==========================================================================
- */
-
-/** @addtogroup LPC17xx_System
- * @{
- */
-
-/** @brief IRQ interrupt source definition */
-typedef enum IRQn
-{
-/****** Cortex-M3 Processor Exceptions Numbers ***************************************************/
- NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
- MemoryManagement_IRQn = -12, /*!< 4 Cortex-M3 Memory Management Interrupt */
- BusFault_IRQn = -11, /*!< 5 Cortex-M3 Bus Fault Interrupt */
- UsageFault_IRQn = -10, /*!< 6 Cortex-M3 Usage Fault Interrupt */
- SVCall_IRQn = -5, /*!< 11 Cortex-M3 SV Call Interrupt */
- DebugMonitor_IRQn = -4, /*!< 12 Cortex-M3 Debug Monitor Interrupt */
- PendSV_IRQn = -2, /*!< 14 Cortex-M3 Pend SV Interrupt */
- SysTick_IRQn = -1, /*!< 15 Cortex-M3 System Tick Interrupt */
-
-/****** LPC17xx Specific Interrupt Numbers *******************************************************/
- WDT_IRQn = 0, /*!< Watchdog Timer Interrupt */
- TIMER0_IRQn = 1, /*!< Timer0 Interrupt */
- TIMER1_IRQn = 2, /*!< Timer1 Interrupt */
- TIMER2_IRQn = 3, /*!< Timer2 Interrupt */
- TIMER3_IRQn = 4, /*!< Timer3 Interrupt */
- UART0_IRQn = 5, /*!< UART0 Interrupt */
- UART1_IRQn = 6, /*!< UART1 Interrupt */
- UART2_IRQn = 7, /*!< UART2 Interrupt */
- UART3_IRQn = 8, /*!< UART3 Interrupt */
- PWM1_IRQn = 9, /*!< PWM1 Interrupt */
- I2C0_IRQn = 10, /*!< I2C0 Interrupt */
- I2C1_IRQn = 11, /*!< I2C1 Interrupt */
- I2C2_IRQn = 12, /*!< I2C2 Interrupt */
- SPI_IRQn = 13, /*!< SPI Interrupt */
- SSP0_IRQn = 14, /*!< SSP0 Interrupt */
- SSP1_IRQn = 15, /*!< SSP1 Interrupt */
- PLL0_IRQn = 16, /*!< PLL0 Lock (Main PLL) Interrupt */
- RTC_IRQn = 17, /*!< Real Time Clock Interrupt */
- EINT0_IRQn = 18, /*!< External Interrupt 0 Interrupt */
- EINT1_IRQn = 19, /*!< External Interrupt 1 Interrupt */
- EINT2_IRQn = 20, /*!< External Interrupt 2 Interrupt */
- EINT3_IRQn = 21, /*!< External Interrupt 3 Interrupt */
- ADC_IRQn = 22, /*!< A/D Converter Interrupt */
- BOD_IRQn = 23, /*!< Brown-Out Detect Interrupt */
- USB_IRQn = 24, /*!< USB Interrupt */
- CAN_IRQn = 25, /*!< CAN Interrupt */
- DMA_IRQn = 26, /*!< General Purpose DMA Interrupt */
- I2S_IRQn = 27, /*!< I2S Interrupt */
- ENET_IRQn = 28, /*!< Ethernet Interrupt */
- RIT_IRQn = 29, /*!< Repetitive Interrupt Timer Interrupt */
- MCPWM_IRQn = 30, /*!< Motor Control PWM Interrupt */
- QEI_IRQn = 31, /*!< Quadrature Encoder Interface Interrupt */
- PLL1_IRQn = 32, /*!< PLL1 Lock (USB PLL) Interrupt */
- USBActivity_IRQn = 33, /*!< USB Activity Interrupt */
- CANActivity_IRQn = 34 /*!< CAN Activity Interrupt */
-} IRQn_Type;
-
-
-/*
- * ==========================================================================
- * ----------- Processor and Core Peripheral Section ------------------------
- * ==========================================================================
- */
-
-/* Configuration of the Cortex-M3 Processor and Core Peripherals */
-#define __MPU_PRESENT 1 /*!< MPU present or not */
-#define __NVIC_PRIO_BITS 5 /*!< Number of Bits used for Priority Levels */
-#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
-
-
-#include "system_LPC17xx.h" /* System Header */
-#include "core_cm3.h" /* Cortex-M3 processor and core peripherals */
-
-
-/******************************************************************************/
-/* Device Specific Peripheral registers structures */
-/******************************************************************************/
-
-#if defined ( __CC_ARM )
-#pragma anon_unions
-#elif defined ( __ICCARM__ )
-#pragma language=save
-#pragma language=extended
-#endif
-
-/*------------- System Control (SC) ------------------------------------------*/
-/** @brief System Control (SC) register structure definition */
-typedef struct
-{
- __IO uint32_t FLASHCFG; /* Flash Accelerator Module */
- uint32_t RESERVED0[31];
- __IO uint32_t PLL0CON; /* Clocking and Power Control */
- __IO uint32_t PLL0CFG;
- __I uint32_t PLL0STAT;
- __O uint32_t PLL0FEED;
- uint32_t RESERVED1[4];
- __IO uint32_t PLL1CON;
- __IO uint32_t PLL1CFG;
- __I uint32_t PLL1STAT;
- __O uint32_t PLL1FEED;
- uint32_t RESERVED2[4];
- __IO uint32_t PCON;
- __IO uint32_t PCONP;
- uint32_t RESERVED3[15];
- __IO uint32_t CCLKCFG;
- __IO uint32_t USBCLKCFG;
- __IO uint32_t CLKSRCSEL;
- __IO uint32_t CANSLEEPCLR;
- __IO uint32_t CANWAKEFLAGS;
- uint32_t RESERVED4[10];
- __IO uint32_t EXTINT; /* External Interrupts */
- uint32_t RESERVED5;
- __IO uint32_t EXTMODE;
- __IO uint32_t EXTPOLAR;
- uint32_t RESERVED6[12];
- __IO uint32_t RSID; /* Reset */
- uint32_t RESERVED7[7];
- __IO uint32_t SCS; /* Syscon Miscellaneous Registers */
- __IO uint32_t IRCTRIM; /* Clock Dividers */
- __IO uint32_t PCLKSEL0;
- __IO uint32_t PCLKSEL1;
- uint32_t RESERVED8[4];
- __IO uint32_t USBIntSt; /* USB Device/OTG Interrupt Register */
- __IO uint32_t DMAREQSEL;
- __IO uint32_t CLKOUTCFG; /* Clock Output Configuration */
- } LPC_SC_TypeDef;
-
-/*------------- Pin Connect Block (PINCON) -----------------------------------*/
-/** @brief Pin Connect Block (PINCON) register structure definition */
-typedef struct
-{
- __IO uint32_t PINSEL0;
- __IO uint32_t PINSEL1;
- __IO uint32_t PINSEL2;
- __IO uint32_t PINSEL3;
- __IO uint32_t PINSEL4;
- __IO uint32_t PINSEL5;
- __IO uint32_t PINSEL6;
- __IO uint32_t PINSEL7;
- __IO uint32_t PINSEL8;
- __IO uint32_t PINSEL9;
- __IO uint32_t PINSEL10;
- uint32_t RESERVED0[5];
- __IO uint32_t PINMODE0;
- __IO uint32_t PINMODE1;
- __IO uint32_t PINMODE2;
- __IO uint32_t PINMODE3;
- __IO uint32_t PINMODE4;
- __IO uint32_t PINMODE5;
- __IO uint32_t PINMODE6;
- __IO uint32_t PINMODE7;
- __IO uint32_t PINMODE8;
- __IO uint32_t PINMODE9;
- __IO uint32_t PINMODE_OD0;
- __IO uint32_t PINMODE_OD1;
- __IO uint32_t PINMODE_OD2;
- __IO uint32_t PINMODE_OD3;
- __IO uint32_t PINMODE_OD4;
- __IO uint32_t I2CPADCFG;
-} LPC_PINCON_TypeDef;
-
-/*------------- General Purpose Input/Output (GPIO) --------------------------*/
-/** @brief General Purpose Input/Output (GPIO) register structure definition */
-typedef struct
-{
- union {
- __IO uint32_t FIODIR;
- struct {
- __IO uint16_t FIODIRL;
- __IO uint16_t FIODIRH;
- };
- struct {
- __IO uint8_t FIODIR0;
- __IO uint8_t FIODIR1;
- __IO uint8_t FIODIR2;
- __IO uint8_t FIODIR3;
- };
- };
- uint32_t RESERVED0[3];
- union {
- __IO uint32_t FIOMASK;
- struct {
- __IO uint16_t FIOMASKL;
- __IO uint16_t FIOMASKH;
- };
- struct {
- __IO uint8_t FIOMASK0;
- __IO uint8_t FIOMASK1;
- __IO uint8_t FIOMASK2;
- __IO uint8_t FIOMASK3;
- };
- };
- union {
- __IO uint32_t FIOPIN;
- struct {
- __IO uint16_t FIOPINL;
- __IO uint16_t FIOPINH;
- };
- struct {
- __IO uint8_t FIOPIN0;
- __IO uint8_t FIOPIN1;
- __IO uint8_t FIOPIN2;
- __IO uint8_t FIOPIN3;
- };
- };
- union {
- __IO uint32_t FIOSET;
- struct {
- __IO uint16_t FIOSETL;
- __IO uint16_t FIOSETH;
- };
- struct {
- __IO uint8_t FIOSET0;
- __IO uint8_t FIOSET1;
- __IO uint8_t FIOSET2;
- __IO uint8_t FIOSET3;
- };
- };
- union {
- __O uint32_t FIOCLR;
- struct {
- __O uint16_t FIOCLRL;
- __O uint16_t FIOCLRH;
- };
- struct {
- __O uint8_t FIOCLR0;
- __O uint8_t FIOCLR1;
- __O uint8_t FIOCLR2;
- __O uint8_t FIOCLR3;
- };
- };
-} LPC_GPIO_TypeDef;
-
-/** @brief General Purpose Input/Output interrupt (GPIOINT) register structure definition */
-typedef struct
-{
- __I uint32_t IntStatus;
- __I uint32_t IO0IntStatR;
- __I uint32_t IO0IntStatF;
- __O uint32_t IO0IntClr;
- __IO uint32_t IO0IntEnR;
- __IO uint32_t IO0IntEnF;
- uint32_t RESERVED0[3];
- __I uint32_t IO2IntStatR;
- __I uint32_t IO2IntStatF;
- __O uint32_t IO2IntClr;
- __IO uint32_t IO2IntEnR;
- __IO uint32_t IO2IntEnF;
-} LPC_GPIOINT_TypeDef;
-
-/*------------- Timer (TIM) --------------------------------------------------*/
-/** @brief Timer (TIM) register structure definition */
-typedef struct
-{
- __IO uint32_t IR;
- __IO uint32_t TCR;
- __IO uint32_t TC;
- __IO uint32_t PR;
- __IO uint32_t PC;
- __IO uint32_t MCR;
- __IO uint32_t MR0;
- __IO uint32_t MR1;
- __IO uint32_t MR2;
- __IO uint32_t MR3;
- __IO uint32_t CCR;
- __I uint32_t CR0;
- __I uint32_t CR1;
- uint32_t RESERVED0[2];
- __IO uint32_t EMR;
- uint32_t RESERVED1[12];
- __IO uint32_t CTCR;
-} LPC_TIM_TypeDef;
-
-/*------------- Pulse-Width Modulation (PWM) ---------------------------------*/
-/** @brief Pulse-Width Modulation (PWM) register structure definition */
-typedef struct
-{
- __IO uint32_t IR;
- __IO uint32_t TCR;
- __IO uint32_t TC;
- __IO uint32_t PR;
- __IO uint32_t PC;
- __IO uint32_t MCR;
- __IO uint32_t MR0;
- __IO uint32_t MR1;
- __IO uint32_t MR2;
- __IO uint32_t MR3;
- __IO uint32_t CCR;
- __I uint32_t CR0;
- __I uint32_t CR1;
- __I uint32_t CR2;
- __I uint32_t CR3;
- uint32_t RESERVED0;
- __IO uint32_t MR4;
- __IO uint32_t MR5;
- __IO uint32_t MR6;
- __IO uint32_t PCR;
- __IO uint32_t LER;
- uint32_t RESERVED1[7];
- __IO uint32_t CTCR;
-} LPC_PWM_TypeDef;
-
-/*------------- Universal Asynchronous Receiver Transmitter (UART) -----------*/
-/** @brief Universal Asynchronous Receiver Transmitter (UART) register structure definition */
-typedef struct
-{
- union {
- __I uint8_t RBR;
- __O uint8_t THR;
- __IO uint8_t DLL;
- uint32_t RESERVED0;
- };
- union {
- __IO uint8_t DLM;
- __IO uint32_t IER;
- };
- union {
- __I uint32_t IIR;
- __O uint8_t FCR;
- };
- __IO uint8_t LCR;
- uint8_t RESERVED1[7];
- __I uint8_t LSR;
- uint8_t RESERVED2[7];
- __IO uint8_t SCR;
- uint8_t RESERVED3[3];
- __IO uint32_t ACR;
- __IO uint8_t ICR;
- uint8_t RESERVED4[3];
- __IO uint8_t FDR;
- uint8_t RESERVED5[7];
- __IO uint8_t TER;
- uint8_t RESERVED6[39];
- __I uint8_t FIFOLVL;
-} LPC_UART_TypeDef;
-
-/** @brief Universal Asynchronous Receiver Transmitter 0 (UART0) register structure definition */
-typedef struct
-{
- union {
- __I uint8_t RBR;
- __O uint8_t THR;
- __IO uint8_t DLL;
- uint32_t RESERVED0;
- };
- union {
- __IO uint8_t DLM;
- __IO uint32_t IER;
- };
- union {
- __I uint32_t IIR;
- __O uint8_t FCR;
- };
- __IO uint8_t LCR;
- uint8_t RESERVED1[7];
- __I uint8_t LSR;
- uint8_t RESERVED2[7];
- __IO uint8_t SCR;
- uint8_t RESERVED3[3];
- __IO uint32_t ACR;
- __IO uint8_t ICR;
- uint8_t RESERVED4[3];
- __IO uint8_t FDR;
- uint8_t RESERVED5[7];
- __IO uint8_t TER;
- uint8_t RESERVED6[39];
- __I uint8_t FIFOLVL;
-} LPC_UART0_TypeDef;
-
-/** @brief Universal Asynchronous Receiver Transmitter 1 (UART1) register structure definition */
-typedef struct
-{
- union {
- __I uint8_t RBR;
- __O uint8_t THR;
- __IO uint8_t DLL;
- uint32_t RESERVED0;
- };
- union {
- __IO uint8_t DLM;
- __IO uint32_t IER;
- };
- union {
- __I uint32_t IIR;
- __O uint8_t FCR;
- };
- __IO uint8_t LCR;
- uint8_t RESERVED1[3];
- __IO uint8_t MCR;
- uint8_t RESERVED2[3];
- __I uint8_t LSR;
- uint8_t RESERVED3[3];
- __I uint8_t MSR;
- uint8_t RESERVED4[3];
- __IO uint8_t SCR;
- uint8_t RESERVED5[3];
- __IO uint32_t ACR;
- uint32_t RESERVED6;
- __IO uint32_t FDR;
- uint32_t RESERVED7;
- __IO uint8_t TER;
- uint8_t RESERVED8[27];
- __IO uint8_t RS485CTRL;
- uint8_t RESERVED9[3];
- __IO uint8_t ADRMATCH;
- uint8_t RESERVED10[3];
- __IO uint8_t RS485DLY;
- uint8_t RESERVED11[3];
- __I uint8_t FIFOLVL;
-} LPC_UART1_TypeDef;
-
-/*------------- Serial Peripheral Interface (SPI) ----------------------------*/
-/** @brief Serial Peripheral Interface (SPI) register structure definition */
-typedef struct
-{
- __IO uint32_t SPCR;
- __I uint32_t SPSR;
- __IO uint32_t SPDR;
- __IO uint32_t SPCCR;
- uint32_t RESERVED0[3];
- __IO uint32_t SPINT;
-} LPC_SPI_TypeDef;
-
-/*------------- Synchronous Serial Communication (SSP) -----------------------*/
-/** @brief Synchronous Serial Communication (SSP) register structure definition */
-typedef struct
-{
- __IO uint32_t CR0;
- __IO uint32_t CR1;
- __IO uint32_t DR;
- __I uint32_t SR;
- __IO uint32_t CPSR;
- __IO uint32_t IMSC;
- __IO uint32_t RIS;
- __IO uint32_t MIS;
- __IO uint32_t ICR;
- __IO uint32_t DMACR;
-} LPC_SSP_TypeDef;
-
-/*------------- Inter-Integrated Circuit (I2C) -------------------------------*/
-/** @brief Inter-Integrated Circuit (I2C) register structure definition */
-typedef struct
-{
- __IO uint32_t I2CONSET;
- __I uint32_t I2STAT;
- __IO uint32_t I2DAT;
- __IO uint32_t I2ADR0;
- __IO uint32_t I2SCLH;
- __IO uint32_t I2SCLL;
- __O uint32_t I2CONCLR;
- __IO uint32_t MMCTRL;
- __IO uint32_t I2ADR1;
- __IO uint32_t I2ADR2;
- __IO uint32_t I2ADR3;
- __I uint32_t I2DATA_BUFFER;
- __IO uint32_t I2MASK0;
- __IO uint32_t I2MASK1;
- __IO uint32_t I2MASK2;
- __IO uint32_t I2MASK3;
-} LPC_I2C_TypeDef;
-
-/*------------- Inter IC Sound (I2S) -----------------------------------------*/
-/** @brief Inter IC Sound (I2S) register structure definition */
-typedef struct
-{
- __IO uint32_t I2SDAO;
- __IO uint32_t I2SDAI;
- __O uint32_t I2STXFIFO;
- __I uint32_t I2SRXFIFO;
- __I uint32_t I2SSTATE;
- __IO uint32_t I2SDMA1;
- __IO uint32_t I2SDMA2;
- __IO uint32_t I2SIRQ;
- __IO uint32_t I2STXRATE;
- __IO uint32_t I2SRXRATE;
- __IO uint32_t I2STXBITRATE;
- __IO uint32_t I2SRXBITRATE;
- __IO uint32_t I2STXMODE;
- __IO uint32_t I2SRXMODE;
-} LPC_I2S_TypeDef;
-
-/*------------- Repetitive Interrupt Timer (RIT) -----------------------------*/
-/** @brief Repetitive Interrupt Timer (RIT) register structure definition */
-typedef struct
-{
- __IO uint32_t RICOMPVAL;
- __IO uint32_t RIMASK;
- __IO uint8_t RICTRL;
- uint8_t RESERVED0[3];
- __IO uint32_t RICOUNTER;
-} LPC_RIT_TypeDef;
-
-/*------------- Real-Time Clock (RTC) ----------------------------------------*/
-/** @brief Real-Time Clock (RTC) register structure definition */
-typedef struct
-{
- __IO uint8_t ILR;
- uint8_t RESERVED0[7];
- __IO uint8_t CCR;
- uint8_t RESERVED1[3];
- __IO uint8_t CIIR;
- uint8_t RESERVED2[3];
- __IO uint8_t AMR;
- uint8_t RESERVED3[3];
- __I uint32_t CTIME0;
- __I uint32_t CTIME1;
- __I uint32_t CTIME2;
- __IO uint8_t SEC;
- uint8_t RESERVED4[3];
- __IO uint8_t MIN;
- uint8_t RESERVED5[3];
- __IO uint8_t HOUR;
- uint8_t RESERVED6[3];
- __IO uint8_t DOM;
- uint8_t RESERVED7[3];
- __IO uint8_t DOW;
- uint8_t RESERVED8[3];
- __IO uint16_t DOY;
- uint16_t RESERVED9;
- __IO uint8_t MONTH;
- uint8_t RESERVED10[3];
- __IO uint16_t YEAR;
- uint16_t RESERVED11;
- __IO uint32_t CALIBRATION;
- __IO uint32_t GPREG0;
- __IO uint32_t GPREG1;
- __IO uint32_t GPREG2;
- __IO uint32_t GPREG3;
- __IO uint32_t GPREG4;
- __IO uint8_t RTC_AUXEN;
- uint8_t RESERVED12[3];
- __IO uint8_t RTC_AUX;
- uint8_t RESERVED13[3];
- __IO uint8_t ALSEC;
- uint8_t RESERVED14[3];
- __IO uint8_t ALMIN;
- uint8_t RESERVED15[3];
- __IO uint8_t ALHOUR;
- uint8_t RESERVED16[3];
- __IO uint8_t ALDOM;
- uint8_t RESERVED17[3];
- __IO uint8_t ALDOW;
- uint8_t RESERVED18[3];
- __IO uint16_t ALDOY;
- uint16_t RESERVED19;
- __IO uint8_t ALMON;
- uint8_t RESERVED20[3];
- __IO uint16_t ALYEAR;
- uint16_t RESERVED21;
-} LPC_RTC_TypeDef;
-
-/*------------- Watchdog Timer (WDT) -----------------------------------------*/
-/** @brief Watchdog Timer (WDT) register structure definition */
-typedef struct
-{
- __IO uint8_t WDMOD;
- uint8_t RESERVED0[3];
- __IO uint32_t WDTC;
- __O uint8_t WDFEED;
- uint8_t RESERVED1[3];
- __I uint32_t WDTV;
- __IO uint32_t WDCLKSEL;
-} LPC_WDT_TypeDef;
-
-/*------------- Analog-to-Digital Converter (ADC) ----------------------------*/
-/** @brief Analog-to-Digital Converter (ADC) register structure definition */
-typedef struct
-{
- __IO uint32_t ADCR;
- __IO uint32_t ADGDR;
- uint32_t RESERVED0;
- __IO uint32_t ADINTEN;
- __I uint32_t ADDR0;
- __I uint32_t ADDR1;
- __I uint32_t ADDR2;
- __I uint32_t ADDR3;
- __I uint32_t ADDR4;
- __I uint32_t ADDR5;
- __I uint32_t ADDR6;
- __I uint32_t ADDR7;
- __I uint32_t ADSTAT;
- __IO uint32_t ADTRM;
-} LPC_ADC_TypeDef;
-
-/*------------- Digital-to-Analog Converter (DAC) ----------------------------*/
-/** @brief Digital-to-Analog Converter (DAC) register structure definition */
-typedef struct
-{
- __IO uint32_t DACR;
- __IO uint32_t DACCTRL;
- __IO uint16_t DACCNTVAL;
-} LPC_DAC_TypeDef;
-
-/*------------- Motor Control Pulse-Width Modulation (MCPWM) -----------------*/
-/** @brief Motor Control Pulse-Width Modulation (MCPWM) register structure definition */
-typedef struct
-{
- __I uint32_t MCCON;
- __O uint32_t MCCON_SET;
- __O uint32_t MCCON_CLR;
- __I uint32_t MCCAPCON;
- __O uint32_t MCCAPCON_SET;
- __O uint32_t MCCAPCON_CLR;
- __IO uint32_t MCTIM0;
- __IO uint32_t MCTIM1;
- __IO uint32_t MCTIM2;
- __IO uint32_t MCPER0;
- __IO uint32_t MCPER1;
- __IO uint32_t MCPER2;
- __IO uint32_t MCPW0;
- __IO uint32_t MCPW1;
- __IO uint32_t MCPW2;
- __IO uint32_t MCDEADTIME;
- __IO uint32_t MCCCP;
- __IO uint32_t MCCR0;
- __IO uint32_t MCCR1;
- __IO uint32_t MCCR2;
- __I uint32_t MCINTEN;
- __O uint32_t MCINTEN_SET;
- __O uint32_t MCINTEN_CLR;
- __I uint32_t MCCNTCON;
- __O uint32_t MCCNTCON_SET;
- __O uint32_t MCCNTCON_CLR;
- __I uint32_t MCINTFLAG;
- __O uint32_t MCINTFLAG_SET;
- __O uint32_t MCINTFLAG_CLR;
- __O uint32_t MCCAP_CLR;
-} LPC_MCPWM_TypeDef;
-
-/*------------- Quadrature Encoder Interface (QEI) ---------------------------*/
-/** @brief Quadrature Encoder Interface (QEI) register structure definition */
-typedef struct
-{
- __O uint32_t QEICON;
- __I uint32_t QEISTAT;
- __IO uint32_t QEICONF;
- __I uint32_t QEIPOS;
- __IO uint32_t QEIMAXPOS;
- __IO uint32_t CMPOS0;
- __IO uint32_t CMPOS1;
- __IO uint32_t CMPOS2;
- __I uint32_t INXCNT;
- __IO uint32_t INXCMP;
- __IO uint32_t QEILOAD;
- __I uint32_t QEITIME;
- __I uint32_t QEIVEL;
- __I uint32_t QEICAP;
- __IO uint32_t VELCOMP;
- __IO uint32_t FILTER;
- uint32_t RESERVED0[998];
- __O uint32_t QEIIEC;
- __O uint32_t QEIIES;
- __I uint32_t QEIINTSTAT;
- __I uint32_t QEIIE;
- __O uint32_t QEICLR;
- __O uint32_t QEISET;
-} LPC_QEI_TypeDef;
-
-/*------------- Controller Area Network (CAN) --------------------------------*/
-/** @brief Controller Area Network Acceptance Filter RAM (CANAF_RAM)structure definition */
-typedef struct
-{
- __IO uint32_t mask[512]; /* ID Masks */
-} LPC_CANAF_RAM_TypeDef;
-
-/** @brief Controller Area Network Acceptance Filter(CANAF) register structure definition */
-typedef struct /* Acceptance Filter Registers */
-{
- __IO uint32_t AFMR;
- __IO uint32_t SFF_sa;
- __IO uint32_t SFF_GRP_sa;
- __IO uint32_t EFF_sa;
- __IO uint32_t EFF_GRP_sa;
- __IO uint32_t ENDofTable;
- __I uint32_t LUTerrAd;
- __I uint32_t LUTerr;
- __IO uint32_t FCANIE;
- __IO uint32_t FCANIC0;
- __IO uint32_t FCANIC1;
-} LPC_CANAF_TypeDef;
-
-/** @brief Controller Area Network Central (CANCR) register structure definition */
-typedef struct /* Central Registers */
-{
- __I uint32_t CANTxSR;
- __I uint32_t CANRxSR;
- __I uint32_t CANMSR;
-} LPC_CANCR_TypeDef;
-
-/** @brief Controller Area Network Controller (CAN) register structure definition */
-typedef struct /* Controller Registers */
-{
- __IO uint32_t MOD;
- __O uint32_t CMR;
- __IO uint32_t GSR;
- __I uint32_t ICR;
- __IO uint32_t IER;
- __IO uint32_t BTR;
- __IO uint32_t EWL;
- __I uint32_t SR;
- __IO uint32_t RFS;
- __IO uint32_t RID;
- __IO uint32_t RDA;
- __IO uint32_t RDB;
- __IO uint32_t TFI1;
- __IO uint32_t TID1;
- __IO uint32_t TDA1;
- __IO uint32_t TDB1;
- __IO uint32_t TFI2;
- __IO uint32_t TID2;
- __IO uint32_t TDA2;
- __IO uint32_t TDB2;
- __IO uint32_t TFI3;
- __IO uint32_t TID3;
- __IO uint32_t TDA3;
- __IO uint32_t TDB3;
-} LPC_CAN_TypeDef;
-
-/*------------- General Purpose Direct Memory Access (GPDMA) -----------------*/
-/** @brief General Purpose Direct Memory Access (GPDMA) register structure definition */
-typedef struct /* Common Registers */
-{
- __I uint32_t DMACIntStat;
- __I uint32_t DMACIntTCStat;
- __O uint32_t DMACIntTCClear;
- __I uint32_t DMACIntErrStat;
- __O uint32_t DMACIntErrClr;
- __I uint32_t DMACRawIntTCStat;
- __I uint32_t DMACRawIntErrStat;
- __I uint32_t DMACEnbldChns;
- __IO uint32_t DMACSoftBReq;
- __IO uint32_t DMACSoftSReq;
- __IO uint32_t DMACSoftLBReq;
- __IO uint32_t DMACSoftLSReq;
- __IO uint32_t DMACConfig;
- __IO uint32_t DMACSync;
-} LPC_GPDMA_TypeDef;
-
-/** @brief General Purpose Direct Memory Access Channel (GPDMACH) register structure definition */
-typedef struct /* Channel Registers */
-{
- __IO uint32_t DMACCSrcAddr;
- __IO uint32_t DMACCDestAddr;
- __IO uint32_t DMACCLLI;
- __IO uint32_t DMACCControl;
- __IO uint32_t DMACCConfig;
-} LPC_GPDMACH_TypeDef;
-
-/*------------- Universal Serial Bus (USB) -----------------------------------*/
-/** @brief Universal Serial Bus (USB) register structure definition */
-typedef struct
-{
- __I uint32_t HcRevision; /* USB Host Registers */
- __IO uint32_t HcControl;
- __IO uint32_t HcCommandStatus;
- __IO uint32_t HcInterruptStatus;
- __IO uint32_t HcInterruptEnable;
- __IO uint32_t HcInterruptDisable;
- __IO uint32_t HcHCCA;
- __I uint32_t HcPeriodCurrentED;
- __IO uint32_t HcControlHeadED;
- __IO uint32_t HcControlCurrentED;
- __IO uint32_t HcBulkHeadED;
- __IO uint32_t HcBulkCurrentED;
- __I uint32_t HcDoneHead;
- __IO uint32_t HcFmInterval;
- __I uint32_t HcFmRemaining;
- __I uint32_t HcFmNumber;
- __IO uint32_t HcPeriodicStart;
- __IO uint32_t HcLSTreshold;
- __IO uint32_t HcRhDescriptorA;
- __IO uint32_t HcRhDescriptorB;
- __IO uint32_t HcRhStatus;
- __IO uint32_t HcRhPortStatus1;
- __IO uint32_t HcRhPortStatus2;
- uint32_t RESERVED0[40];
- __I uint32_t Module_ID;
-
- __I uint32_t OTGIntSt; /* USB On-The-Go Registers */
- __IO uint32_t OTGIntEn;
- __O uint32_t OTGIntSet;
- __O uint32_t OTGIntClr;
- __IO uint32_t OTGStCtrl;
- __IO uint32_t OTGTmr;
- uint32_t RESERVED1[58];
-
- __I uint32_t USBDevIntSt; /* USB Device Interrupt Registers */
- __IO uint32_t USBDevIntEn;
- __O uint32_t USBDevIntClr;
- __O uint32_t USBDevIntSet;
-
- __O uint32_t USBCmdCode; /* USB Device SIE Command Registers */
- __I uint32_t USBCmdData;
-
- __I uint32_t USBRxData; /* USB Device Transfer Registers */
- __O uint32_t USBTxData;
- __I uint32_t USBRxPLen;
- __O uint32_t USBTxPLen;
- __IO uint32_t USBCtrl;
- __O uint32_t USBDevIntPri;
-
- __I uint32_t USBEpIntSt; /* USB Device Endpoint Interrupt Regs */
- __IO uint32_t USBEpIntEn;
- __O uint32_t USBEpIntClr;
- __O uint32_t USBEpIntSet;
- __O uint32_t USBEpIntPri;
-
- __IO uint32_t USBReEp; /* USB Device Endpoint Realization Reg*/
- __O uint32_t USBEpInd;
- __IO uint32_t USBMaxPSize;
-
- __I uint32_t USBDMARSt; /* USB Device DMA Registers */
- __O uint32_t USBDMARClr;
- __O uint32_t USBDMARSet;
- uint32_t RESERVED2[9];
- __IO uint32_t USBUDCAH;
- __I uint32_t USBEpDMASt;
- __O uint32_t USBEpDMAEn;
- __O uint32_t USBEpDMADis;
- __I uint32_t USBDMAIntSt;
- __IO uint32_t USBDMAIntEn;
- uint32_t RESERVED3[2];
- __I uint32_t USBEoTIntSt;
- __O uint32_t USBEoTIntClr;
- __O uint32_t USBEoTIntSet;
- __I uint32_t USBNDDRIntSt;
- __O uint32_t USBNDDRIntClr;
- __O uint32_t USBNDDRIntSet;
- __I uint32_t USBSysErrIntSt;
- __O uint32_t USBSysErrIntClr;
- __O uint32_t USBSysErrIntSet;
- uint32_t RESERVED4[15];
-
- union {
- __I uint32_t I2C_RX; /* USB OTG I2C Registers */
- __O uint32_t I2C_TX;
- };
- __I uint32_t I2C_STS;
- __IO uint32_t I2C_CTL;
- __IO uint32_t I2C_CLKHI;
- __O uint32_t I2C_CLKLO;
- uint32_t RESERVED5[824];
-
- union {
- __IO uint32_t USBClkCtrl; /* USB Clock Control Registers */
- __IO uint32_t OTGClkCtrl;
- };
- union {
- __I uint32_t USBClkSt;
- __I uint32_t OTGClkSt;
- };
-} LPC_USB_TypeDef;
-
-/*------------- Ethernet Media Access Controller (EMAC) ----------------------*/
-/** @brief Ethernet Media Access Controller (EMAC) register structure definition */
-typedef struct
-{
- __IO uint32_t MAC1; /* MAC Registers */
- __IO uint32_t MAC2;
- __IO uint32_t IPGT;
- __IO uint32_t IPGR;
- __IO uint32_t CLRT;
- __IO uint32_t MAXF;
- __IO uint32_t SUPP;
- __IO uint32_t TEST;
- __IO uint32_t MCFG;
- __IO uint32_t MCMD;
- __IO uint32_t MADR;
- __O uint32_t MWTD;
- __I uint32_t MRDD;
- __I uint32_t MIND;
- uint32_t RESERVED0[2];
- __IO uint32_t SA0;
- __IO uint32_t SA1;
- __IO uint32_t SA2;
- uint32_t RESERVED1[45];
- __IO uint32_t Command; /* Control Registers */
- __I uint32_t Status;
- __IO uint32_t RxDescriptor;
- __IO uint32_t RxStatus;
- __IO uint32_t RxDescriptorNumber;
- __I uint32_t RxProduceIndex;
- __IO uint32_t RxConsumeIndex;
- __IO uint32_t TxDescriptor;
- __IO uint32_t TxStatus;
- __IO uint32_t TxDescriptorNumber;
- __IO uint32_t TxProduceIndex;
- __I uint32_t TxConsumeIndex;
- uint32_t RESERVED2[10];
- __I uint32_t TSV0;
- __I uint32_t TSV1;
- __I uint32_t RSV;
- uint32_t RESERVED3[3];
- __IO uint32_t FlowControlCounter;
- __I uint32_t FlowControlStatus;
- uint32_t RESERVED4[34];
- __IO uint32_t RxFilterCtrl; /* Rx Filter Registers */
- __IO uint32_t RxFilterWoLStatus;
- __IO uint32_t RxFilterWoLClear;
- uint32_t RESERVED5;
- __IO uint32_t HashFilterL;
- __IO uint32_t HashFilterH;
- uint32_t RESERVED6[882];
- __I uint32_t IntStatus; /* Module Control Registers */
- __IO uint32_t IntEnable;
- __O uint32_t IntClear;
- __O uint32_t IntSet;
- uint32_t RESERVED7;
- __IO uint32_t PowerDown;
- uint32_t RESERVED8;
- __IO uint32_t Module_ID;
-} LPC_EMAC_TypeDef;
-
-
-#if defined ( __CC_ARM )
-#pragma no_anon_unions
-#elif defined ( __ICCARM__ )
-#pragma language=restore
-#endif
-
-
-/******************************************************************************/
-/* Peripheral memory map */
-/******************************************************************************/
-/* Base addresses */
-#define LPC_FLASH_BASE (0x00000000UL)
-#define LPC_RAM_BASE (0x10000000UL)
-#ifdef __LPC17XX_REV00
-#define LPC_AHBRAM0_BASE (0x20000000UL)
-#define LPC_AHBRAM1_BASE (0x20004000UL)
-#else
-#define LPC_AHBRAM0_BASE (0x2007C000UL)
-#define LPC_AHBRAM1_BASE (0x20080000UL)
-#endif
-#define LPC_GPIO_BASE (0x2009C000UL)
-#define LPC_APB0_BASE (0x40000000UL)
-#define LPC_APB1_BASE (0x40080000UL)
-#define LPC_AHB_BASE (0x50000000UL)
-#define LPC_CM3_BASE (0xE0000000UL)
-
-/* APB0 peripherals */
-#define LPC_WDT_BASE (LPC_APB0_BASE + 0x00000)
-#define LPC_TIM0_BASE (LPC_APB0_BASE + 0x04000)
-#define LPC_TIM1_BASE (LPC_APB0_BASE + 0x08000)
-#define LPC_UART0_BASE (LPC_APB0_BASE + 0x0C000)
-#define LPC_UART1_BASE (LPC_APB0_BASE + 0x10000)
-#define LPC_PWM1_BASE (LPC_APB0_BASE + 0x18000)
-#define LPC_I2C0_BASE (LPC_APB0_BASE + 0x1C000)
-#define LPC_SPI_BASE (LPC_APB0_BASE + 0x20000)
-#define LPC_RTC_BASE (LPC_APB0_BASE + 0x24000)
-#define LPC_GPIOINT_BASE (LPC_APB0_BASE + 0x28080)
-#define LPC_PINCON_BASE (LPC_APB0_BASE + 0x2C000)
-#define LPC_SSP1_BASE (LPC_APB0_BASE + 0x30000)
-#define LPC_ADC_BASE (LPC_APB0_BASE + 0x34000)
-#define LPC_CANAF_RAM_BASE (LPC_APB0_BASE + 0x38000)
-#define LPC_CANAF_BASE (LPC_APB0_BASE + 0x3C000)
-#define LPC_CANCR_BASE (LPC_APB0_BASE + 0x40000)
-#define LPC_CAN1_BASE (LPC_APB0_BASE + 0x44000)
-#define LPC_CAN2_BASE (LPC_APB0_BASE + 0x48000)
-#define LPC_I2C1_BASE (LPC_APB0_BASE + 0x5C000)
-
-/* APB1 peripherals */
-#define LPC_SSP0_BASE (LPC_APB1_BASE + 0x08000)
-#define LPC_DAC_BASE (LPC_APB1_BASE + 0x0C000)
-#define LPC_TIM2_BASE (LPC_APB1_BASE + 0x10000)
-#define LPC_TIM3_BASE (LPC_APB1_BASE + 0x14000)
-#define LPC_UART2_BASE (LPC_APB1_BASE + 0x18000)
-#define LPC_UART3_BASE (LPC_APB1_BASE + 0x1C000)
-#define LPC_I2C2_BASE (LPC_APB1_BASE + 0x20000)
-#define LPC_I2S_BASE (LPC_APB1_BASE + 0x28000)
-#define LPC_RIT_BASE (LPC_APB1_BASE + 0x30000)
-#define LPC_MCPWM_BASE (LPC_APB1_BASE + 0x38000)
-#define LPC_QEI_BASE (LPC_APB1_BASE + 0x3C000)
-#define LPC_SC_BASE (LPC_APB1_BASE + 0x7C000)
-
-/* AHB peripherals */
-#define LPC_EMAC_BASE (LPC_AHB_BASE + 0x00000)
-#define LPC_GPDMA_BASE (LPC_AHB_BASE + 0x04000)
-#define LPC_GPDMACH0_BASE (LPC_AHB_BASE + 0x04100)
-#define LPC_GPDMACH1_BASE (LPC_AHB_BASE + 0x04120)
-#define LPC_GPDMACH2_BASE (LPC_AHB_BASE + 0x04140)
-#define LPC_GPDMACH3_BASE (LPC_AHB_BASE + 0x04160)
-#define LPC_GPDMACH4_BASE (LPC_AHB_BASE + 0x04180)
-#define LPC_GPDMACH5_BASE (LPC_AHB_BASE + 0x041A0)
-#define LPC_GPDMACH6_BASE (LPC_AHB_BASE + 0x041C0)
-#define LPC_GPDMACH7_BASE (LPC_AHB_BASE + 0x041E0)
-#define LPC_USB_BASE (LPC_AHB_BASE + 0x0C000)
-
-/* GPIOs */
-#define LPC_GPIO0_BASE (LPC_GPIO_BASE + 0x00000)
-#define LPC_GPIO1_BASE (LPC_GPIO_BASE + 0x00020)
-#define LPC_GPIO2_BASE (LPC_GPIO_BASE + 0x00040)
-#define LPC_GPIO3_BASE (LPC_GPIO_BASE + 0x00060)
-#define LPC_GPIO4_BASE (LPC_GPIO_BASE + 0x00080)
-
-/******************************************************************************/
-/* Peripheral declaration */
-/******************************************************************************/
-#define LPC_SC ((LPC_SC_TypeDef *) LPC_SC_BASE )
-#define LPC_GPIO0 ((LPC_GPIO_TypeDef *) LPC_GPIO0_BASE )
-#define LPC_GPIO1 ((LPC_GPIO_TypeDef *) LPC_GPIO1_BASE )
-#define LPC_GPIO2 ((LPC_GPIO_TypeDef *) LPC_GPIO2_BASE )
-#define LPC_GPIO3 ((LPC_GPIO_TypeDef *) LPC_GPIO3_BASE )
-#define LPC_GPIO4 ((LPC_GPIO_TypeDef *) LPC_GPIO4_BASE )
-#define LPC_WDT ((LPC_WDT_TypeDef *) LPC_WDT_BASE )
-#define LPC_TIM0 ((LPC_TIM_TypeDef *) LPC_TIM0_BASE )
-#define LPC_TIM1 ((LPC_TIM_TypeDef *) LPC_TIM1_BASE )
-#define LPC_TIM2 ((LPC_TIM_TypeDef *) LPC_TIM2_BASE )
-#define LPC_TIM3 ((LPC_TIM_TypeDef *) LPC_TIM3_BASE )
-#define LPC_RIT ((LPC_RIT_TypeDef *) LPC_RIT_BASE )
-#define LPC_UART0 ((LPC_UART_TypeDef *) LPC_UART0_BASE )
-#define LPC_UART1 ((LPC_UART1_TypeDef *) LPC_UART1_BASE )
-#define LPC_UART2 ((LPC_UART_TypeDef *) LPC_UART2_BASE )
-#define LPC_UART3 ((LPC_UART_TypeDef *) LPC_UART3_BASE )
-#define LPC_PWM1 ((LPC_PWM_TypeDef *) LPC_PWM1_BASE )
-#define LPC_I2C0 ((LPC_I2C_TypeDef *) LPC_I2C0_BASE )
-#define LPC_I2C1 ((LPC_I2C_TypeDef *) LPC_I2C1_BASE )
-#define LPC_I2C2 ((LPC_I2C_TypeDef *) LPC_I2C2_BASE )
-#define LPC_I2S ((LPC_I2S_TypeDef *) LPC_I2S_BASE )
-#define LPC_SPI ((LPC_SPI_TypeDef *) LPC_SPI_BASE )
-#define LPC_RTC ((LPC_RTC_TypeDef *) LPC_RTC_BASE )
-#define LPC_GPIOINT ((LPC_GPIOINT_TypeDef *) LPC_GPIOINT_BASE )
-#define LPC_PINCON ((LPC_PINCON_TypeDef *) LPC_PINCON_BASE )
-#define LPC_SSP0 ((LPC_SSP_TypeDef *) LPC_SSP0_BASE )
-#define LPC_SSP1 ((LPC_SSP_TypeDef *) LPC_SSP1_BASE )
-#define LPC_ADC ((LPC_ADC_TypeDef *) LPC_ADC_BASE )
-#define LPC_DAC ((LPC_DAC_TypeDef *) LPC_DAC_BASE )
-#define LPC_CANAF_RAM ((LPC_CANAF_RAM_TypeDef *) LPC_CANAF_RAM_BASE)
-#define LPC_CANAF ((LPC_CANAF_TypeDef *) LPC_CANAF_BASE )
-#define LPC_CANCR ((LPC_CANCR_TypeDef *) LPC_CANCR_BASE )
-#define LPC_CAN1 ((LPC_CAN_TypeDef *) LPC_CAN1_BASE )
-#define LPC_CAN2 ((LPC_CAN_TypeDef *) LPC_CAN2_BASE )
-#define LPC_MCPWM ((LPC_MCPWM_TypeDef *) LPC_MCPWM_BASE )
-#define LPC_QEI ((LPC_QEI_TypeDef *) LPC_QEI_BASE )
-#define LPC_EMAC ((LPC_EMAC_TypeDef *) LPC_EMAC_BASE )
-#define LPC_GPDMA ((LPC_GPDMA_TypeDef *) LPC_GPDMA_BASE )
-#define LPC_GPDMACH0 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH0_BASE )
-#define LPC_GPDMACH1 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH1_BASE )
-#define LPC_GPDMACH2 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH2_BASE )
-#define LPC_GPDMACH3 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH3_BASE )
-#define LPC_GPDMACH4 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH4_BASE )
-#define LPC_GPDMACH5 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH5_BASE )
-#define LPC_GPDMACH6 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH6_BASE )
-#define LPC_GPDMACH7 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH7_BASE )
-#define LPC_USB ((LPC_USB_TypeDef *) LPC_USB_BASE )
-
-/**
- * @}
- */
-
-#endif // __LPC17xx_H__
diff --git a/platforms_startup/armcc/LPC1768/README b/platforms_startup/armcc/LPC1768/README
deleted file mode 100644
index dd736eaa7..000000000
--- a/platforms_startup/armcc/LPC1768/README
+++ /dev/null
@@ -1,19 +0,0 @@
-Startup library for ARM C/C++ compiler and LPC1768 chip.
-Semihosting is in use, so you may use standard printf() or std::cout << "Hello!"
-
-Requirements:
-1. CYGWIN (rm.exe, mkdir.exe, make.exe, echo.exe)
-2. Keil MDK-ARM
-
-Library libStartup_LPC1768.a is placed in ./lib/armcc_Cortex-M3_thumb
- directory of home CppUTest directory.
-
-Time measure is done using LPC_TIM3.
-Because of calling _clock_init() before main() by startup code, value of
- SystemCoreClock is 0, and it is need to manually call _clock_init() in main()
- or other place after updating SystemCoreClock.
- It come from two quartz selection in system_LPC17xx.c, non-standard solution
- of startup initialization.
- To remove _clock_init() call from main(), you need to remove two quartz
- configuration in system_LPC17xx.c and declare SystemCoreClock variable as
- "const" with value of real clock frequency.
diff --git a/platforms_startup/armcc/LPC1768/Retarget.c b/platforms_startup/armcc/LPC1768/Retarget.c
deleted file mode 100644
index 03060a890..000000000
--- a/platforms_startup/armcc/LPC1768/Retarget.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*----------------------------------------------------------------------------
- * Name: Retarget.c
- * Purpose: 'Retarget' layer for target-dependent low level functions
- * Note(s):
- *----------------------------------------------------------------------------
- * This file is part of the uVision/ARM development tools.
- * This software may only be used under the terms of a valid, current,
- * end user licence from KEIL for a compatible version of KEIL software
- * development tools. Nothing else gives you the right to use this software.
- *
- * This software is supplied "AS IS" without warranties of any kind.
- *
- * Copyright (c) 2011 Keil - An ARM Company. All rights reserved.
- *----------------------------------------------------------------------------*/
-
-#include
-#include
-#include
-#include "Serial.h"
-#include "lpc17xx_timer.h"
-
-/* Standard IO device handles. */
-#define STDIN 0x8001
-#define STDOUT 0x8002
-#define STDERR 0x8003
-
-
-#pragma import(__use_no_semihosting_swi)
-
-const char __stdin_name[] = "STDIN";
-const char __stdout_name[] = "STDOUT";
-const char __stderr_name[] = "STDERR";
-
-
-FILEHANDLE _sys_open(const char *name, int openmode)
-{
- FILEHANDLE rc;
- /* Register standard Input Output devices. */
- if (strcmp(name, "STDIN") == 0) rc = STDIN;
- else if (strcmp(name, "STDOUT") == 0) rc = STDOUT;
- else if (strcmp(name, "STDERR") == 0) rc = STDERR;
- else rc = 1;
- return (rc);
-}
-
-int _sys_close(FILEHANDLE fh)
-{
- return 0;
-}
-
-int _sys_write(FILEHANDLE fh, const unsigned char *buf,
- unsigned len, int mode)
-{
- while (len) {
- SER_PutChar(*buf);
- buf++;
- len--;
- }
- return len;
-}
-
-int _sys_read(FILEHANDLE fh, unsigned char *buf,
- unsigned len, int mode)
-{
- return -1; /* not supported */
-}
-
-void _ttywrch(int ch)
-{
- SER_PutChar(ch);
-}
-
-int _sys_istty(FILEHANDLE fh)
-{
- return 0; /* buffered output */
-}
-
-int _sys_seek(FILEHANDLE fh, long pos)
-{
- return -1; /* not supported */
-}
-
-long _sys_flen(FILEHANDLE fh)
-{
- return -1; /* not supported */
-}
-
-void _sys_exit(int return_code) {
- while(1);
-}
-
-char *_sys_command_string(char *cmd, int len)
-{
- const char * const arg[] = {
- "tst.axf",
- "-v",
- "-gSimpleStringBuffer",
- "-ojunit"};
- int i, j;
- char *rc = cmd;
- if (len) {
- /* Specify commandline arguments here as needed */
- len = sizeof(arg) / sizeof(char *);
- for (i = 0; i < len; i++) {
- j = strlen(arg[i])+1;
- if (cmd - rc + j > len) {
- rc = NULL;
- break;
- }
- memcpy(cmd, arg[i], j);
- cmd += j;
- }
- if (rc) rc = cmd;
- } else rc = NULL;
- return rc;
-}
-
-void _clock_init(void)
-{
- const TIM_TIMERCFG_Type config_us_timer = {TIM_PRESCALE_USVAL, {0,0,0}, 1000}; /* 1000 us for one timer tick */
- TIM_Init(LPC_TIM3, TIM_TIMER_MODE, (void *)&config_us_timer); /* TIMER3 for counting 1 ms */
- TIM_Cmd(LPC_TIM3, ENABLE);
-}
-
-clock_t clock(void)
-{
- return LPC_TIM3->TC;
-}
-
-time_t time(time_t *timer)
-{
- return 0;
-}
-
-
-
-/*
- * Замена вÑтроенной в Keil MDK-ARM функции, ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ Ñоздаёт ÑвÑзанный ÑпиÑок
- * адреÑов деÑтрукторов глобальных или ÑтатичеÑких объектов в "куче" при
- * инициализации окружениÑ.
- * Так как не планируетÑÑ Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð¸Ðµ программы, то ни один такой деÑтруктор не
- * должен вызыватьÑÑ, и можно подменить Ñтандартную верÑию __aeabi_atexit на
- * другую, ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ Ð½Ðµ будет Ñоздавать такой ÑпиÑок в "куче".
- * Ð˜Ð´ÐµÑ Ð²Ð·Ñта отÑюда
- * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka3951.html
- * Пример реализации взÑÑ‚ отÑюда
- * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0041d/IHI0041D_cppabi.pdf
- */
-int __aeabi_atexit(void* object, void (*destroyer)(void*), void* dso_handle)
-{
- return 1; // 0: failed; non-0: OK
-// return __cxa_atexit(destroyer, object, dso_handle); /* ÑÑ‚Ð°Ð½Ð´Ð°Ñ€Ñ‚Ð½Ð°Ñ Ð²ÐµÑ€ÑÐ¸Ñ Ð¸Ð· Keil MDK-ARM */
-}
diff --git a/platforms_startup/armcc/LPC1768/Serial.c b/platforms_startup/armcc/LPC1768/Serial.c
deleted file mode 100644
index 96d99826b..000000000
--- a/platforms_startup/armcc/LPC1768/Serial.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*------------------------------------------------------------------------------
- * RL-ARM
- *------------------------------------------------------------------------------
- * Name: Serial.c
- * Purpose: Serial Input Output for NXP LPC17xx
- * Note(s): Possible defines to select the used communication interface:
- * __UART0 - COM0 (UART0) interface
- * - COM1 (UART1) interface (default)
- *------------------------------------------------------------------------------
- * This code is part of the RealView Run-Time Library.
- * Copyright (c) 2004-2012 KEIL - An ARM Company. All rights reserved.
- *----------------------------------------------------------------------------*/
-
-#include
-#include "Serial.h"
-
-#ifdef __UART0
- #define UART LPC_UART0
-#else
- #define UART LPC_UART1
-#endif
-
-static int init_UART_done = 0;
-
-
-/*------------------------------------------------------------------------------
- * SER_Init: Initialize Serial Interface
- *----------------------------------------------------------------------------*/
-
-void SER_Init (void) {
-
-#ifdef __UART0 /* UART0 */
- LPC_SC->PCONP |= ((1 << 3) | (1 << 15)); /* enable power to UART0 & IOCON */
-
- LPC_PINCON->PINSEL0 |= (1 << 4); /* Pin P0.2 used as TXD0 */
- LPC_PINCON->PINSEL0 |= (1 << 6); /* Pin P0.3 used as RXD0 */
-#else /* UART1 */
- LPC_SC->PCONP |= ((1 << 4) | (1 << 15)); /* enable power to UART1 & IOCON */
-
- LPC_PINCON->PINSEL4 |= (2 << 0); /* Pin P2.0 used as TXD1 */
- LPC_PINCON->PINSEL4 |= (2 << 2); /* Pin P2.1 used as RXD1 */
-#endif
-
- UART->LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
- UART->DLL = 9; /* 115200 Baud Rate @ 25.0 MHZ PCLK*/
- UART->FDR = 0x21; /* FR 1,507, DIVADDVAL=1, MULVAL=2 */
- UART->DLM = 0; /* High divisor latch = 0 */
- UART->LCR = 0x03; /* DLAB = 0 */
-}
-
-
-/*------------------------------------------------------------------------------
- * SER_PutChar: Write a character to the Serial Port
- *----------------------------------------------------------------------------*/
-
-int32_t SER_PutChar (int32_t ch) {
-
- if (init_UART_done == 0) {
- SER_Init();
- init_UART_done++;
- }
- while (!(UART->LSR & 0x20));
- UART->THR = ch;
- return (ch);
-}
-
-
-/*------------------------------------------------------------------------------
- * SER_GetChar: Read a character from the Serial Port (non-blocking)
- *----------------------------------------------------------------------------*/
-
-int32_t SER_GetChar (void) {
-
- if (UART->LSR & 0x01)
- return (UART->RBR);
- return (-1);
-}
-
-
-/*------------------------------------------------------------------------------
- * End of file
- *----------------------------------------------------------------------------*/
diff --git a/platforms_startup/armcc/LPC1768/Serial.h b/platforms_startup/armcc/LPC1768/Serial.h
deleted file mode 100644
index 2176f5009..000000000
--- a/platforms_startup/armcc/LPC1768/Serial.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*-----------------------------------------------------------------------------
- * Name: Serial.h
- * Purpose: Serial I/O definitions
- *-----------------------------------------------------------------------------
- * This file is part of the uVision/ARM development tools.
- * This software may only be used under the terms of a valid, current,
- * end user licence from KEIL for a compatible version of KEIL software
- * development tools. Nothing else gives you the right to use this software.
- *
- * This software is supplied "AS IS" without warranties of any kind.
- *
- * Copyright (c) 2004-2012 Keil - An ARM Company. All rights reserved.
- *----------------------------------------------------------------------------*/
-
-#ifndef __SERIAL_H
-#define __SERIAL_H
-
-#include
-
-extern void SER_Init (void);
-extern int32_t SER_GetChar (void);
-extern int32_t SER_PutChar (int32_t ch);
-
-#endif /* __SERIAL_H */
diff --git a/platforms_startup/armcc/LPC1768/core_cm3.h b/platforms_startup/armcc/LPC1768/core_cm3.h
deleted file mode 100644
index 76bf26f6e..000000000
--- a/platforms_startup/armcc/LPC1768/core_cm3.h
+++ /dev/null
@@ -1,1227 +0,0 @@
-/**************************************************************************//**
- * @file core_cm3.h
- * @brief CMSIS Cortex-M3 Core Peripheral Access Layer Header File
- * @version V2.10
- * @date 19. July 2011
- *
- * @note
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M
- * processor based microcontrollers. This file can be freely distributed
- * within development tools that are supporting such ARM based processors.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-#if defined ( __ICCARM__ )
- #pragma system_include /* treat file as system include file for MISRA check */
-#endif
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-#ifndef __CORE_CM3_H_GENERIC
-#define __CORE_CM3_H_GENERIC
-
-
-/** \ingroup CMSIS_Core
- \defgroup CMSIS_MISRA_Exceptions CMSIS MISRA-C:2004 Compliance Exceptions
- CMSIS violates following MISRA-C2004 Rules:
-
- - Violates MISRA 2004 Required Rule 8.5, object/function definition in header file.
- Function definitions in header files are used to allow 'inlining'.
-
- - Violates MISRA 2004 Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers.
-
- - Violates MISRA 2004 Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code.
-
- */
-
-
-/*******************************************************************************
- * CMSIS definitions
- ******************************************************************************/
-/** \ingroup CMSIS_Core
- \defgroup CMSIS_core_definitions CMSIS Core Definitions
- This file defines all structures and symbols for CMSIS core:
- - CMSIS version number
- - Cortex-M core
- - Cortex-M core Revision Number
- @{
- */
-
-/* CMSIS CM3 definitions */
-#define __CM3_CMSIS_VERSION_MAIN (0x02) /*!< [31:16] CMSIS HAL main version */
-#define __CM3_CMSIS_VERSION_SUB (0x10) /*!< [15:0] CMSIS HAL sub version */
-#define __CM3_CMSIS_VERSION ((__CM3_CMSIS_VERSION_MAIN << 16) | __CM3_CMSIS_VERSION_SUB) /*!< CMSIS HAL version number */
-
-#define __CORTEX_M (0x03) /*!< Cortex core */
-
-
-#if defined ( __CC_ARM )
- #define __ASM __asm /*!< asm keyword for ARM Compiler */
- #define __INLINE __inline /*!< inline keyword for ARM Compiler */
-
-#elif defined ( __ICCARM__ )
- #define __ASM __asm /*!< asm keyword for IAR Compiler */
- #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
-
-#elif defined ( __GNUC__ )
- #define __ASM __asm /*!< asm keyword for GNU Compiler */
- #define __INLINE inline /*!< inline keyword for GNU Compiler */
-
-#elif defined ( __TASKING__ )
- #define __ASM __asm /*!< asm keyword for TASKING Compiler */
- #define __INLINE inline /*!< inline keyword for TASKING Compiler */
-
-#endif
-
-/*!< __FPU_USED to be checked prior to making use of FPU specific registers and functions */
-#define __FPU_USED 0
-
-#if defined ( __CC_ARM )
- #if defined __TARGET_FPU_VFP
- #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
- #endif
-#elif defined ( __ICCARM__ )
- #if defined __ARMVFP__
- #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
- #endif
-
-#elif defined ( __GNUC__ )
- #if defined (__VFP_FP__) && !defined(__SOFTFP__)
- #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
- #endif
-
-#elif defined ( __TASKING__ )
- /* add preprocessor checks */
-#endif
-
-#include /*!< standard types definitions */
-#include "core_cmInstr.h" /*!< Core Instruction Access */
-#include "core_cmFunc.h" /*!< Core Function Access */
-
-#endif /* __CORE_CM3_H_GENERIC */
-
-#ifndef __CMSIS_GENERIC
-
-#ifndef __CORE_CM3_H_DEPENDANT
-#define __CORE_CM3_H_DEPENDANT
-
-/* check device defines and use defaults */
-#if defined __CHECK_DEVICE_DEFINES
- #ifndef __CM3_REV
- #define __CM3_REV 0x0200
- #warning "__CM3_REV not defined in device header file; using default!"
- #endif
-
- #ifndef __MPU_PRESENT
- #define __MPU_PRESENT 0
- #warning "__MPU_PRESENT not defined in device header file; using default!"
- #endif
-
- #ifndef __NVIC_PRIO_BITS
- #define __NVIC_PRIO_BITS 4
- #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
- #endif
-
- #ifndef __Vendor_SysTickConfig
- #define __Vendor_SysTickConfig 0
- #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
- #endif
-#endif
-
-/* IO definitions (access restrictions to peripheral registers) */
-#ifdef __cplusplus
- #define __I volatile /*!< defines 'read only' permissions */
-#else
- #define __I volatile const /*!< defines 'read only' permissions */
-#endif
-#define __O volatile /*!< defines 'write only' permissions */
-#define __IO volatile /*!< defines 'read / write' permissions */
-
-/*@} end of group CMSIS_core_definitions */
-
-
-
-/*******************************************************************************
- * Register Abstraction
- ******************************************************************************/
-/** \ingroup CMSIS_Core
- \defgroup CMSIS_core_register CMSIS Core Register
- Core Register contain:
- - Core Register
- - Core NVIC Register
- - Core SCB Register
- - Core SysTick Register
- - Core Debug Register
- - Core MPU Register
-*/
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_CORE CMSIS Core
- Type definitions for the Cortex-M Core Registers
- @{
- */
-
-/** \brief Union type to access the Application Program Status Register (APSR).
- */
-typedef union
-{
- struct
- {
-#if (__CORTEX_M != 0x04)
- uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */
-#else
- uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
- uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
- uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */
-#endif
- uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
- uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
- uint32_t C:1; /*!< bit: 29 Carry condition code flag */
- uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
- uint32_t N:1; /*!< bit: 31 Negative condition code flag */
- } b; /*!< Structure used for bit access */
- uint32_t w; /*!< Type used for word access */
-} APSR_Type;
-
-
-/** \brief Union type to access the Interrupt Program Status Register (IPSR).
- */
-typedef union
-{
- struct
- {
- uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
- uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
- } b; /*!< Structure used for bit access */
- uint32_t w; /*!< Type used for word access */
-} IPSR_Type;
-
-
-/** \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
- */
-typedef union
-{
- struct
- {
- uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
-#if (__CORTEX_M != 0x04)
- uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
-#else
- uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */
- uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
- uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
-#endif
- uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
- uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
- uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
- uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
- uint32_t C:1; /*!< bit: 29 Carry condition code flag */
- uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
- uint32_t N:1; /*!< bit: 31 Negative condition code flag */
- } b; /*!< Structure used for bit access */
- uint32_t w; /*!< Type used for word access */
-} xPSR_Type;
-
-
-/** \brief Union type to access the Control Registers (CONTROL).
- */
-typedef union
-{
- struct
- {
- uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
- uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
- uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */
- uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */
- } b; /*!< Structure used for bit access */
- uint32_t w; /*!< Type used for word access */
-} CONTROL_Type;
-
-/*@} end of group CMSIS_CORE */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_NVIC CMSIS NVIC
- Type definitions for the Cortex-M NVIC Registers
- @{
- */
-
-/** \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
- */
-typedef struct
-{
- __IO uint32_t ISER[8]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
- uint32_t RESERVED0[24];
- __IO uint32_t ICER[8]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
- uint32_t RSERVED1[24];
- __IO uint32_t ISPR[8]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
- uint32_t RESERVED2[24];
- __IO uint32_t ICPR[8]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
- uint32_t RESERVED3[24];
- __IO uint32_t IABR[8]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
- uint32_t RESERVED4[56];
- __IO uint8_t IP[240]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
- uint32_t RESERVED5[644];
- __O uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
-} NVIC_Type;
-
-/* Software Triggered Interrupt Register Definitions */
-#define NVIC_STIR_INTID_Pos 0 /*!< STIR: INTLINESNUM Position */
-#define NVIC_STIR_INTID_Msk (0x1FFUL << NVIC_STIR_INTID_Pos) /*!< STIR: INTLINESNUM Mask */
-
-/*@} end of group CMSIS_NVIC */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_SCB CMSIS SCB
- Type definitions for the Cortex-M System Control Block Registers
- @{
- */
-
-/** \brief Structure type to access the System Control Block (SCB).
- */
-typedef struct
-{
- __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
- __IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
- __IO uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
- __IO uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
- __IO uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
- __IO uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
- __IO uint8_t SHP[12]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
- __IO uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
- __IO uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
- __IO uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
- __IO uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
- __IO uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
- __IO uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
- __IO uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
- __I uint32_t PFR[2]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
- __I uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
- __I uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
- __I uint32_t MMFR[4]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
- __I uint32_t ISAR[5]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
- uint32_t RESERVED0[5];
- __IO uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
-} SCB_Type;
-
-/* SCB CPUID Register Definitions */
-#define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */
-#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
-
-#define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */
-#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
-
-#define SCB_CPUID_ARCHITECTURE_Pos 16 /*!< SCB CPUID: ARCHITECTURE Position */
-#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
-
-#define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */
-#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
-
-#define SCB_CPUID_REVISION_Pos 0 /*!< SCB CPUID: REVISION Position */
-#define SCB_CPUID_REVISION_Msk (0xFUL << SCB_CPUID_REVISION_Pos) /*!< SCB CPUID: REVISION Mask */
-
-/* SCB Interrupt Control State Register Definitions */
-#define SCB_ICSR_NMIPENDSET_Pos 31 /*!< SCB ICSR: NMIPENDSET Position */
-#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
-
-#define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */
-#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
-
-#define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */
-#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
-
-#define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */
-#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
-
-#define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */
-#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
-
-#define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */
-#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
-
-#define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */
-#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
-
-#define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */
-#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
-
-#define SCB_ICSR_RETTOBASE_Pos 11 /*!< SCB ICSR: RETTOBASE Position */
-#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
-
-#define SCB_ICSR_VECTACTIVE_Pos 0 /*!< SCB ICSR: VECTACTIVE Position */
-#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos) /*!< SCB ICSR: VECTACTIVE Mask */
-
-/* SCB Vector Table Offset Register Definitions */
-#define SCB_VTOR_TBLOFF_Pos 7 /*!< SCB VTOR: TBLOFF Position */
-#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
-
-/* SCB Application Interrupt and Reset Control Register Definitions */
-#define SCB_AIRCR_VECTKEY_Pos 16 /*!< SCB AIRCR: VECTKEY Position */
-#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
-
-#define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */
-#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
-
-#define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */
-#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
-
-#define SCB_AIRCR_PRIGROUP_Pos 8 /*!< SCB AIRCR: PRIGROUP Position */
-#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
-
-#define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */
-#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
-
-#define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< SCB AIRCR: VECTCLRACTIVE Position */
-#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
-
-#define SCB_AIRCR_VECTRESET_Pos 0 /*!< SCB AIRCR: VECTRESET Position */
-#define SCB_AIRCR_VECTRESET_Msk (1UL << SCB_AIRCR_VECTRESET_Pos) /*!< SCB AIRCR: VECTRESET Mask */
-
-/* SCB System Control Register Definitions */
-#define SCB_SCR_SEVONPEND_Pos 4 /*!< SCB SCR: SEVONPEND Position */
-#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
-
-#define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */
-#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
-
-#define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< SCB SCR: SLEEPONEXIT Position */
-#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
-
-/* SCB Configuration Control Register Definitions */
-#define SCB_CCR_STKALIGN_Pos 9 /*!< SCB CCR: STKALIGN Position */
-#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
-
-#define SCB_CCR_BFHFNMIGN_Pos 8 /*!< SCB CCR: BFHFNMIGN Position */
-#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
-
-#define SCB_CCR_DIV_0_TRP_Pos 4 /*!< SCB CCR: DIV_0_TRP Position */
-#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
-
-#define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< SCB CCR: UNALIGN_TRP Position */
-#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
-
-#define SCB_CCR_USERSETMPEND_Pos 1 /*!< SCB CCR: USERSETMPEND Position */
-#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
-
-#define SCB_CCR_NONBASETHRDENA_Pos 0 /*!< SCB CCR: NONBASETHRDENA Position */
-#define SCB_CCR_NONBASETHRDENA_Msk (1UL << SCB_CCR_NONBASETHRDENA_Pos) /*!< SCB CCR: NONBASETHRDENA Mask */
-
-/* SCB System Handler Control and State Register Definitions */
-#define SCB_SHCSR_USGFAULTENA_Pos 18 /*!< SCB SHCSR: USGFAULTENA Position */
-#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
-
-#define SCB_SHCSR_BUSFAULTENA_Pos 17 /*!< SCB SHCSR: BUSFAULTENA Position */
-#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
-
-#define SCB_SHCSR_MEMFAULTENA_Pos 16 /*!< SCB SHCSR: MEMFAULTENA Position */
-#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
-
-#define SCB_SHCSR_SVCALLPENDED_Pos 15 /*!< SCB SHCSR: SVCALLPENDED Position */
-#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
-
-#define SCB_SHCSR_BUSFAULTPENDED_Pos 14 /*!< SCB SHCSR: BUSFAULTPENDED Position */
-#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
-
-#define SCB_SHCSR_MEMFAULTPENDED_Pos 13 /*!< SCB SHCSR: MEMFAULTPENDED Position */
-#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
-
-#define SCB_SHCSR_USGFAULTPENDED_Pos 12 /*!< SCB SHCSR: USGFAULTPENDED Position */
-#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
-
-#define SCB_SHCSR_SYSTICKACT_Pos 11 /*!< SCB SHCSR: SYSTICKACT Position */
-#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
-
-#define SCB_SHCSR_PENDSVACT_Pos 10 /*!< SCB SHCSR: PENDSVACT Position */
-#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
-
-#define SCB_SHCSR_MONITORACT_Pos 8 /*!< SCB SHCSR: MONITORACT Position */
-#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
-
-#define SCB_SHCSR_SVCALLACT_Pos 7 /*!< SCB SHCSR: SVCALLACT Position */
-#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
-
-#define SCB_SHCSR_USGFAULTACT_Pos 3 /*!< SCB SHCSR: USGFAULTACT Position */
-#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
-
-#define SCB_SHCSR_BUSFAULTACT_Pos 1 /*!< SCB SHCSR: BUSFAULTACT Position */
-#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
-
-#define SCB_SHCSR_MEMFAULTACT_Pos 0 /*!< SCB SHCSR: MEMFAULTACT Position */
-#define SCB_SHCSR_MEMFAULTACT_Msk (1UL << SCB_SHCSR_MEMFAULTACT_Pos) /*!< SCB SHCSR: MEMFAULTACT Mask */
-
-/* SCB Configurable Fault Status Registers Definitions */
-#define SCB_CFSR_USGFAULTSR_Pos 16 /*!< SCB CFSR: Usage Fault Status Register Position */
-#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
-
-#define SCB_CFSR_BUSFAULTSR_Pos 8 /*!< SCB CFSR: Bus Fault Status Register Position */
-#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
-
-#define SCB_CFSR_MEMFAULTSR_Pos 0 /*!< SCB CFSR: Memory Manage Fault Status Register Position */
-#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL << SCB_CFSR_MEMFAULTSR_Pos) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
-
-/* SCB Hard Fault Status Registers Definitions */
-#define SCB_HFSR_DEBUGEVT_Pos 31 /*!< SCB HFSR: DEBUGEVT Position */
-#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
-
-#define SCB_HFSR_FORCED_Pos 30 /*!< SCB HFSR: FORCED Position */
-#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
-
-#define SCB_HFSR_VECTTBL_Pos 1 /*!< SCB HFSR: VECTTBL Position */
-#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
-
-/* SCB Debug Fault Status Register Definitions */
-#define SCB_DFSR_EXTERNAL_Pos 4 /*!< SCB DFSR: EXTERNAL Position */
-#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
-
-#define SCB_DFSR_VCATCH_Pos 3 /*!< SCB DFSR: VCATCH Position */
-#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
-
-#define SCB_DFSR_DWTTRAP_Pos 2 /*!< SCB DFSR: DWTTRAP Position */
-#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
-
-#define SCB_DFSR_BKPT_Pos 1 /*!< SCB DFSR: BKPT Position */
-#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
-
-#define SCB_DFSR_HALTED_Pos 0 /*!< SCB DFSR: HALTED Position */
-#define SCB_DFSR_HALTED_Msk (1UL << SCB_DFSR_HALTED_Pos) /*!< SCB DFSR: HALTED Mask */
-
-/*@} end of group CMSIS_SCB */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_SCnSCB CMSIS System Control and ID Register not in the SCB
- Type definitions for the Cortex-M System Control and ID Register not in the SCB
- @{
- */
-
-/** \brief Structure type to access the System Control and ID Register not in the SCB.
- */
-typedef struct
-{
- uint32_t RESERVED0[1];
- __I uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
-#if ((defined __CM3_REV) && (__CM3_REV >= 0x200))
- __IO uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
-#else
- uint32_t RESERVED1[1];
-#endif
-} SCnSCB_Type;
-
-/* Interrupt Controller Type Register Definitions */
-#define SCnSCB_ICTR_INTLINESNUM_Pos 0 /*!< ICTR: INTLINESNUM Position */
-#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL << SCnSCB_ICTR_INTLINESNUM_Pos) /*!< ICTR: INTLINESNUM Mask */
-
-/* Auxiliary Control Register Definitions */
-
-#define SCnSCB_ACTLR_DISFOLD_Pos 2 /*!< ACTLR: DISFOLD Position */
-#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */
-
-#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1 /*!< ACTLR: DISDEFWBUF Position */
-#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */
-
-#define SCnSCB_ACTLR_DISMCYCINT_Pos 0 /*!< ACTLR: DISMCYCINT Position */
-#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL << SCnSCB_ACTLR_DISMCYCINT_Pos) /*!< ACTLR: DISMCYCINT Mask */
-
-/*@} end of group CMSIS_SCnotSCB */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_SysTick CMSIS SysTick
- Type definitions for the Cortex-M System Timer Registers
- @{
- */
-
-/** \brief Structure type to access the System Timer (SysTick).
- */
-typedef struct
-{
- __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
- __IO uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
- __IO uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
- __I uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
-} SysTick_Type;
-
-/* SysTick Control / Status Register Definitions */
-#define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */
-#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
-
-#define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */
-#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
-
-#define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */
-#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
-
-#define SysTick_CTRL_ENABLE_Pos 0 /*!< SysTick CTRL: ENABLE Position */
-#define SysTick_CTRL_ENABLE_Msk (1UL << SysTick_CTRL_ENABLE_Pos) /*!< SysTick CTRL: ENABLE Mask */
-
-/* SysTick Reload Register Definitions */
-#define SysTick_LOAD_RELOAD_Pos 0 /*!< SysTick LOAD: RELOAD Position */
-#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos) /*!< SysTick LOAD: RELOAD Mask */
-
-/* SysTick Current Register Definitions */
-#define SysTick_VAL_CURRENT_Pos 0 /*!< SysTick VAL: CURRENT Position */
-#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick VAL: CURRENT Mask */
-
-/* SysTick Calibration Register Definitions */
-#define SysTick_CALIB_NOREF_Pos 31 /*!< SysTick CALIB: NOREF Position */
-#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
-
-#define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */
-#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
-
-#define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */
-#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick CALIB: TENMS Mask */
-
-/*@} end of group CMSIS_SysTick */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_ITM CMSIS ITM
- Type definitions for the Cortex-M Instrumentation Trace Macrocell (ITM)
- @{
- */
-
-/** \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
- */
-typedef struct
-{
- __O union
- {
- __O uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
- __O uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
- __O uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
- } PORT [32]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
- uint32_t RESERVED0[864];
- __IO uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
- uint32_t RESERVED1[15];
- __IO uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
- uint32_t RESERVED2[15];
- __IO uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
-} ITM_Type;
-
-/* ITM Trace Privilege Register Definitions */
-#define ITM_TPR_PRIVMASK_Pos 0 /*!< ITM TPR: PRIVMASK Position */
-#define ITM_TPR_PRIVMASK_Msk (0xFUL << ITM_TPR_PRIVMASK_Pos) /*!< ITM TPR: PRIVMASK Mask */
-
-/* ITM Trace Control Register Definitions */
-#define ITM_TCR_BUSY_Pos 23 /*!< ITM TCR: BUSY Position */
-#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
-
-#define ITM_TCR_TraceBusID_Pos 16 /*!< ITM TCR: ATBID Position */
-#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */
-
-#define ITM_TCR_GTSFREQ_Pos 10 /*!< ITM TCR: Global timestamp frequency Position */
-#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
-
-#define ITM_TCR_TSPrescale_Pos 8 /*!< ITM TCR: TSPrescale Position */
-#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */
-
-#define ITM_TCR_SWOENA_Pos 4 /*!< ITM TCR: SWOENA Position */
-#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
-
-#define ITM_TCR_TXENA_Pos 3 /*!< ITM TCR: TXENA Position */
-#define ITM_TCR_TXENA_Msk (1UL << ITM_TCR_TXENA_Pos) /*!< ITM TCR: TXENA Mask */
-
-#define ITM_TCR_SYNCENA_Pos 2 /*!< ITM TCR: SYNCENA Position */
-#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
-
-#define ITM_TCR_TSENA_Pos 1 /*!< ITM TCR: TSENA Position */
-#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
-
-#define ITM_TCR_ITMENA_Pos 0 /*!< ITM TCR: ITM Enable bit Position */
-#define ITM_TCR_ITMENA_Msk (1UL << ITM_TCR_ITMENA_Pos) /*!< ITM TCR: ITM Enable bit Mask */
-
-/*@}*/ /* end of group CMSIS_ITM */
-
-
-#if (__MPU_PRESENT == 1)
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_MPU CMSIS MPU
- Type definitions for the Cortex-M Memory Protection Unit (MPU)
- @{
- */
-
-/** \brief Structure type to access the Memory Protection Unit (MPU).
- */
-typedef struct
-{
- __I uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
- __IO uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
- __IO uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
- __IO uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
- __IO uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
- __IO uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */
- __IO uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */
- __IO uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */
- __IO uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */
- __IO uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */
- __IO uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */
-} MPU_Type;
-
-/* MPU Type Register */
-#define MPU_TYPE_IREGION_Pos 16 /*!< MPU TYPE: IREGION Position */
-#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
-
-#define MPU_TYPE_DREGION_Pos 8 /*!< MPU TYPE: DREGION Position */
-#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
-
-#define MPU_TYPE_SEPARATE_Pos 0 /*!< MPU TYPE: SEPARATE Position */
-#define MPU_TYPE_SEPARATE_Msk (1UL << MPU_TYPE_SEPARATE_Pos) /*!< MPU TYPE: SEPARATE Mask */
-
-/* MPU Control Register */
-#define MPU_CTRL_PRIVDEFENA_Pos 2 /*!< MPU CTRL: PRIVDEFENA Position */
-#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
-
-#define MPU_CTRL_HFNMIENA_Pos 1 /*!< MPU CTRL: HFNMIENA Position */
-#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
-
-#define MPU_CTRL_ENABLE_Pos 0 /*!< MPU CTRL: ENABLE Position */
-#define MPU_CTRL_ENABLE_Msk (1UL << MPU_CTRL_ENABLE_Pos) /*!< MPU CTRL: ENABLE Mask */
-
-/* MPU Region Number Register */
-#define MPU_RNR_REGION_Pos 0 /*!< MPU RNR: REGION Position */
-#define MPU_RNR_REGION_Msk (0xFFUL << MPU_RNR_REGION_Pos) /*!< MPU RNR: REGION Mask */
-
-/* MPU Region Base Address Register */
-#define MPU_RBAR_ADDR_Pos 5 /*!< MPU RBAR: ADDR Position */
-#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
-
-#define MPU_RBAR_VALID_Pos 4 /*!< MPU RBAR: VALID Position */
-#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
-
-#define MPU_RBAR_REGION_Pos 0 /*!< MPU RBAR: REGION Position */
-#define MPU_RBAR_REGION_Msk (0xFUL << MPU_RBAR_REGION_Pos) /*!< MPU RBAR: REGION Mask */
-
-/* MPU Region Attribute and Size Register */
-#define MPU_RASR_ATTRS_Pos 16 /*!< MPU RASR: MPU Region Attribute field Position */
-#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
-
-#define MPU_RASR_SRD_Pos 8 /*!< MPU RASR: Sub-Region Disable Position */
-#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
-
-#define MPU_RASR_SIZE_Pos 1 /*!< MPU RASR: Region Size Field Position */
-#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
-
-#define MPU_RASR_ENABLE_Pos 0 /*!< MPU RASR: Region enable bit Position */
-#define MPU_RASR_ENABLE_Msk (1UL << MPU_RASR_ENABLE_Pos) /*!< MPU RASR: Region enable bit Disable Mask */
-
-/*@} end of group CMSIS_MPU */
-#endif
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_CoreDebug CMSIS Core Debug
- Type definitions for the Cortex-M Core Debug Registers
- @{
- */
-
-/** \brief Structure type to access the Core Debug Register (CoreDebug).
- */
-typedef struct
-{
- __IO uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
- __O uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
- __IO uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
- __IO uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
-} CoreDebug_Type;
-
-/* Debug Halting Control and Status Register */
-#define CoreDebug_DHCSR_DBGKEY_Pos 16 /*!< CoreDebug DHCSR: DBGKEY Position */
-#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
-
-#define CoreDebug_DHCSR_S_RESET_ST_Pos 25 /*!< CoreDebug DHCSR: S_RESET_ST Position */
-#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
-
-#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24 /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
-#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
-
-#define CoreDebug_DHCSR_S_LOCKUP_Pos 19 /*!< CoreDebug DHCSR: S_LOCKUP Position */
-#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
-
-#define CoreDebug_DHCSR_S_SLEEP_Pos 18 /*!< CoreDebug DHCSR: S_SLEEP Position */
-#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
-
-#define CoreDebug_DHCSR_S_HALT_Pos 17 /*!< CoreDebug DHCSR: S_HALT Position */
-#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
-
-#define CoreDebug_DHCSR_S_REGRDY_Pos 16 /*!< CoreDebug DHCSR: S_REGRDY Position */
-#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
-
-#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5 /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
-#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
-
-#define CoreDebug_DHCSR_C_MASKINTS_Pos 3 /*!< CoreDebug DHCSR: C_MASKINTS Position */
-#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
-
-#define CoreDebug_DHCSR_C_STEP_Pos 2 /*!< CoreDebug DHCSR: C_STEP Position */
-#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
-
-#define CoreDebug_DHCSR_C_HALT_Pos 1 /*!< CoreDebug DHCSR: C_HALT Position */
-#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
-
-#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0 /*!< CoreDebug DHCSR: C_DEBUGEN Position */
-#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL << CoreDebug_DHCSR_C_DEBUGEN_Pos) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
-
-/* Debug Core Register Selector Register */
-#define CoreDebug_DCRSR_REGWnR_Pos 16 /*!< CoreDebug DCRSR: REGWnR Position */
-#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
-
-#define CoreDebug_DCRSR_REGSEL_Pos 0 /*!< CoreDebug DCRSR: REGSEL Position */
-#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL << CoreDebug_DCRSR_REGSEL_Pos) /*!< CoreDebug DCRSR: REGSEL Mask */
-
-/* Debug Exception and Monitor Control Register */
-#define CoreDebug_DEMCR_TRCENA_Pos 24 /*!< CoreDebug DEMCR: TRCENA Position */
-#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
-
-#define CoreDebug_DEMCR_MON_REQ_Pos 19 /*!< CoreDebug DEMCR: MON_REQ Position */
-#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
-
-#define CoreDebug_DEMCR_MON_STEP_Pos 18 /*!< CoreDebug DEMCR: MON_STEP Position */
-#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
-
-#define CoreDebug_DEMCR_MON_PEND_Pos 17 /*!< CoreDebug DEMCR: MON_PEND Position */
-#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
-
-#define CoreDebug_DEMCR_MON_EN_Pos 16 /*!< CoreDebug DEMCR: MON_EN Position */
-#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
-
-#define CoreDebug_DEMCR_VC_HARDERR_Pos 10 /*!< CoreDebug DEMCR: VC_HARDERR Position */
-#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
-
-#define CoreDebug_DEMCR_VC_INTERR_Pos 9 /*!< CoreDebug DEMCR: VC_INTERR Position */
-#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
-
-#define CoreDebug_DEMCR_VC_BUSERR_Pos 8 /*!< CoreDebug DEMCR: VC_BUSERR Position */
-#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
-
-#define CoreDebug_DEMCR_VC_STATERR_Pos 7 /*!< CoreDebug DEMCR: VC_STATERR Position */
-#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
-
-#define CoreDebug_DEMCR_VC_CHKERR_Pos 6 /*!< CoreDebug DEMCR: VC_CHKERR Position */
-#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
-
-#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5 /*!< CoreDebug DEMCR: VC_NOCPERR Position */
-#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
-
-#define CoreDebug_DEMCR_VC_MMERR_Pos 4 /*!< CoreDebug DEMCR: VC_MMERR Position */
-#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
-
-#define CoreDebug_DEMCR_VC_CORERESET_Pos 0 /*!< CoreDebug DEMCR: VC_CORERESET Position */
-#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL << CoreDebug_DEMCR_VC_CORERESET_Pos) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
-
-/*@} end of group CMSIS_CoreDebug */
-
-
-/** \ingroup CMSIS_core_register
- @{
- */
-
-/* Memory mapping of Cortex-M3 Hardware */
-#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
-#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
-#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
-#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
-#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
-#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
-
-#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
-#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
-#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
-#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
-#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
-#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */
-
-#if (__MPU_PRESENT == 1)
- #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
- #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
-#endif
-
-/*@} */
-
-
-
-/*******************************************************************************
- * Hardware Abstraction Layer
- ******************************************************************************/
-/** \ingroup CMSIS_Core
- \defgroup CMSIS_Core_FunctionInterface CMSIS Core Function Interface
- Core Function Interface contains:
- - Core NVIC Functions
- - Core SysTick Functions
- - Core Debug Functions
- - Core Register Access Functions
-*/
-
-
-
-/* ########################## NVIC functions #################################### */
-/** \ingroup CMSIS_Core_FunctionInterface
- \defgroup CMSIS_Core_NVICFunctions CMSIS Core NVIC Functions
- @{
- */
-
-/** \brief Set Priority Grouping
-
- This function sets the priority grouping field using the required unlock sequence.
- The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
- Only values from 0..7 are used.
- In case of a conflict between priority grouping and available
- priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
-
- \param [in] PriorityGroup Priority grouping field
- */
-static __INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
-{
- uint32_t reg_value;
- uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07); /* only values 0..7 are used */
-
- reg_value = SCB->AIRCR; /* read old register configuration */
- reg_value &= ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk); /* clear bits to change */
- reg_value = (reg_value |
- ((uint32_t)0x5FA << SCB_AIRCR_VECTKEY_Pos) |
- (PriorityGroupTmp << 8)); /* Insert write key and priorty group */
- SCB->AIRCR = reg_value;
-}
-
-
-/** \brief Get Priority Grouping
-
- This function gets the priority grouping from NVIC Interrupt Controller.
- Priority grouping is SCB->AIRCR [10:8] PRIGROUP field.
-
- \return Priority grouping field
- */
-static __INLINE uint32_t NVIC_GetPriorityGrouping(void)
-{
- return ((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos); /* read priority grouping field */
-}
-
-
-/** \brief Enable External Interrupt
-
- This function enables a device specific interrupt in the NVIC interrupt controller.
- The interrupt number cannot be a negative value.
-
- \param [in] IRQn Number of the external interrupt to enable
- */
-static __INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
-{
- NVIC->ISER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* enable interrupt */
-}
-
-
-/** \brief Disable External Interrupt
-
- This function disables a device specific interrupt in the NVIC interrupt controller.
- The interrupt number cannot be a negative value.
-
- \param [in] IRQn Number of the external interrupt to disable
- */
-static __INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
-{
- NVIC->ICER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* disable interrupt */
-}
-
-
-/** \brief Get Pending Interrupt
-
- This function reads the pending register in the NVIC and returns the pending bit
- for the specified interrupt.
-
- \param [in] IRQn Number of the interrupt for get pending
- \return 0 Interrupt status is not pending
- \return 1 Interrupt status is pending
- */
-static __INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
-{
- return((uint32_t) ((NVIC->ISPR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if pending else 0 */
-}
-
-
-/** \brief Set Pending Interrupt
-
- This function sets the pending bit for the specified interrupt.
- The interrupt number cannot be a negative value.
-
- \param [in] IRQn Number of the interrupt for set pending
- */
-static __INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
-{
- NVIC->ISPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* set interrupt pending */
-}
-
-
-/** \brief Clear Pending Interrupt
-
- This function clears the pending bit for the specified interrupt.
- The interrupt number cannot be a negative value.
-
- \param [in] IRQn Number of the interrupt for clear pending
- */
-static __INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
-{
- NVIC->ICPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */
-}
-
-
-/** \brief Get Active Interrupt
-
- This function reads the active register in NVIC and returns the active bit.
- \param [in] IRQn Number of the interrupt for get active
- \return 0 Interrupt status is not active
- \return 1 Interrupt status is active
- */
-static __INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
-{
- return((uint32_t)((NVIC->IABR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if active else 0 */
-}
-
-
-/** \brief Set Interrupt Priority
-
- This function sets the priority for the specified interrupt. The interrupt
- number can be positive to specify an external (device specific)
- interrupt, or negative to specify an internal (core) interrupt.
-
- Note: The priority cannot be set for every core interrupt.
-
- \param [in] IRQn Number of the interrupt for set priority
- \param [in] priority Priority to set
- */
-static __INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
-{
- if(IRQn < 0) {
- SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for Cortex-M System Interrupts */
- else {
- NVIC->IP[(uint32_t)(IRQn)] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for device specific Interrupts */
-}
-
-
-/** \brief Get Interrupt Priority
-
- This function reads the priority for the specified interrupt. The interrupt
- number can be positive to specify an external (device specific)
- interrupt, or negative to specify an internal (core) interrupt.
-
- The returned priority value is automatically aligned to the implemented
- priority bits of the microcontroller.
-
- \param [in] IRQn Number of the interrupt for get priority
- \return Interrupt Priority
- */
-static __INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
-{
-
- if(IRQn < 0) {
- return((uint32_t)(SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] >> (8 - __NVIC_PRIO_BITS))); } /* get priority for Cortex-M system interrupts */
- else {
- return((uint32_t)(NVIC->IP[(uint32_t)(IRQn)] >> (8 - __NVIC_PRIO_BITS))); } /* get priority for device specific interrupts */
-}
-
-
-/** \brief Encode Priority
-
- This function encodes the priority for an interrupt with the given priority group,
- preemptive priority value and sub priority value.
- In case of a conflict between priority grouping and available
- priority bits (__NVIC_PRIO_BITS) the samllest possible priority group is set.
-
- The returned priority value can be used for NVIC_SetPriority(...) function
-
- \param [in] PriorityGroup Used priority group
- \param [in] PreemptPriority Preemptive priority value (starting from 0)
- \param [in] SubPriority Sub priority value (starting from 0)
- \return Encoded priority for the interrupt
- */
-static __INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
-{
- uint32_t PriorityGroupTmp = (PriorityGroup & 0x07); /* only values 0..7 are used */
- uint32_t PreemptPriorityBits;
- uint32_t SubPriorityBits;
-
- PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
- SubPriorityBits = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;
-
- return (
- ((PreemptPriority & ((1 << (PreemptPriorityBits)) - 1)) << SubPriorityBits) |
- ((SubPriority & ((1 << (SubPriorityBits )) - 1)))
- );
-}
-
-
-/** \brief Decode Priority
-
- This function decodes an interrupt priority value with the given priority group to
- preemptive priority value and sub priority value.
- In case of a conflict between priority grouping and available
- priority bits (__NVIC_PRIO_BITS) the samllest possible priority group is set.
-
- The priority value can be retrieved with NVIC_GetPriority(...) function
-
- \param [in] Priority Priority value
- \param [in] PriorityGroup Used priority group
- \param [out] pPreemptPriority Preemptive priority value (starting from 0)
- \param [out] pSubPriority Sub priority value (starting from 0)
- */
-static __INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority)
-{
- uint32_t PriorityGroupTmp = (PriorityGroup & 0x07); /* only values 0..7 are used */
- uint32_t PreemptPriorityBits;
- uint32_t SubPriorityBits;
-
- PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
- SubPriorityBits = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;
-
- *pPreemptPriority = (Priority >> SubPriorityBits) & ((1 << (PreemptPriorityBits)) - 1);
- *pSubPriority = (Priority ) & ((1 << (SubPriorityBits )) - 1);
-}
-
-
-/** \brief System Reset
-
- This function initiate a system reset request to reset the MCU.
- */
-static __INLINE void NVIC_SystemReset(void)
-{
- __DSB(); /* Ensure all outstanding memory accesses included
- buffered write are completed before reset */
- SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) |
- (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
- SCB_AIRCR_SYSRESETREQ_Msk); /* Keep priority group unchanged */
- __DSB(); /* Ensure completion of memory access */
- while(1); /* wait until reset */
-}
-
-/*@} end of CMSIS_Core_NVICFunctions */
-
-
-
-/* ################################## SysTick function ############################################ */
-/** \ingroup CMSIS_Core_FunctionInterface
- \defgroup CMSIS_Core_SysTickFunctions CMSIS Core SysTick Functions
- @{
- */
-
-#if (__Vendor_SysTickConfig == 0)
-
-/** \brief System Tick Configuration
-
- This function initialises the system tick timer and its interrupt and start the system tick timer.
- Counter is in free running mode to generate periodical interrupts.
-
- \param [in] ticks Number of ticks between two interrupts
- \return 0 Function succeeded
- \return 1 Function failed
- */
-static __INLINE uint32_t SysTick_Config(uint32_t ticks)
-{
- if (ticks > SysTick_LOAD_RELOAD_Msk) return (1); /* Reload value impossible */
-
- SysTick->LOAD = (ticks & SysTick_LOAD_RELOAD_Msk) - 1; /* set reload register */
- NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority for Cortex-M0 System Interrupts */
- SysTick->VAL = 0; /* Load the SysTick Counter Value */
- SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
- SysTick_CTRL_TICKINT_Msk |
- SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
- return (0); /* Function successful */
-}
-
-#endif
-
-/*@} end of CMSIS_Core_SysTickFunctions */
-
-
-
-/* ##################################### Debug In/Output function ########################################### */
-/** \ingroup CMSIS_Core_FunctionInterface
- \defgroup CMSIS_core_DebugFunctions CMSIS Core Debug Functions
- @{
- */
-
-extern volatile int32_t ITM_RxBuffer; /*!< external variable to receive characters */
-#define ITM_RXBUFFER_EMPTY 0x5AA55AA5 /*!< value identifying ITM_RxBuffer is ready for next character */
-
-
-/** \brief ITM Send Character
-
- This function transmits a character via the ITM channel 0.
- It just returns when no debugger is connected that has booked the output.
- It is blocking when a debugger is connected, but the previous character send is not transmitted.
-
- \param [in] ch Character to transmit
- \return Character to transmit
- */
-static __INLINE uint32_t ITM_SendChar (uint32_t ch)
-{
- if ((CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA_Msk) && /* Trace enabled */
- (ITM->TCR & ITM_TCR_ITMENA_Msk) && /* ITM enabled */
- (ITM->TER & (1UL << 0) ) ) /* ITM Port #0 enabled */
- {
- while (ITM->PORT[0].u32 == 0);
- ITM->PORT[0].u8 = (uint8_t) ch;
- }
- return (ch);
-}
-
-
-/** \brief ITM Receive Character
-
- This function inputs a character via external variable ITM_RxBuffer.
- It just returns when no debugger is connected that has booked the output.
- It is blocking when a debugger is connected, but the previous character send is not transmitted.
-
- \return Received character
- \return -1 No character received
- */
-static __INLINE int32_t ITM_ReceiveChar (void) {
- int32_t ch = -1; /* no character available */
-
- if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) {
- ch = ITM_RxBuffer;
- ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
- }
-
- return (ch);
-}
-
-
-/** \brief ITM Check Character
-
- This function checks external variable ITM_RxBuffer whether a character is available or not.
- It returns '1' if a character is available and '0' if no character is available.
-
- \return 0 No character available
- \return 1 Character available
- */
-static __INLINE int32_t ITM_CheckChar (void) {
-
- if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) {
- return (0); /* no character available */
- } else {
- return (1); /* character available */
- }
-}
-
-/*@} end of CMSIS_core_DebugFunctions */
-
-#endif /* __CORE_CM3_H_DEPENDANT */
-
-#endif /* __CMSIS_GENERIC */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/platforms_startup/armcc/LPC1768/core_cmFunc.h b/platforms_startup/armcc/LPC1768/core_cmFunc.h
deleted file mode 100644
index 88819f9dd..000000000
--- a/platforms_startup/armcc/LPC1768/core_cmFunc.h
+++ /dev/null
@@ -1,609 +0,0 @@
-/**************************************************************************//**
- * @file core_cmFunc.h
- * @brief CMSIS Cortex-M Core Function Access Header File
- * @version V2.10
- * @date 26. July 2011
- *
- * @note
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M
- * processor based microcontrollers. This file can be freely distributed
- * within development tools that are supporting such ARM based processors.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-#ifndef __CORE_CMFUNC_H
-#define __CORE_CMFUNC_H
-
-
-/* ########################### Core Function Access ########################### */
-/** \ingroup CMSIS_Core_FunctionInterface
- \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
- @{
- */
-
-#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
-/* ARM armcc specific functions */
-
-#if (__ARMCC_VERSION < 400677)
- #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
-#endif
-
-/* intrinsic void __enable_irq(); */
-/* intrinsic void __disable_irq(); */
-
-/** \brief Get Control Register
-
- This function returns the content of the Control Register.
-
- \return Control Register value
- */
-static __INLINE uint32_t __get_CONTROL(void)
-{
- register uint32_t __regControl __ASM("control");
- return(__regControl);
-}
-
-
-/** \brief Set Control Register
-
- This function writes the given value to the Control Register.
-
- \param [in] control Control Register value to set
- */
-static __INLINE void __set_CONTROL(uint32_t control)
-{
- register uint32_t __regControl __ASM("control");
- __regControl = control;
-}
-
-
-/** \brief Get ISPR Register
-
- This function returns the content of the ISPR Register.
-
- \return ISPR Register value
- */
-static __INLINE uint32_t __get_IPSR(void)
-{
- register uint32_t __regIPSR __ASM("ipsr");
- return(__regIPSR);
-}
-
-
-/** \brief Get APSR Register
-
- This function returns the content of the APSR Register.
-
- \return APSR Register value
- */
-static __INLINE uint32_t __get_APSR(void)
-{
- register uint32_t __regAPSR __ASM("apsr");
- return(__regAPSR);
-}
-
-
-/** \brief Get xPSR Register
-
- This function returns the content of the xPSR Register.
-
- \return xPSR Register value
- */
-static __INLINE uint32_t __get_xPSR(void)
-{
- register uint32_t __regXPSR __ASM("xpsr");
- return(__regXPSR);
-}
-
-
-/** \brief Get Process Stack Pointer
-
- This function returns the current value of the Process Stack Pointer (PSP).
-
- \return PSP Register value
- */
-static __INLINE uint32_t __get_PSP(void)
-{
- register uint32_t __regProcessStackPointer __ASM("psp");
- return(__regProcessStackPointer);
-}
-
-
-/** \brief Set Process Stack Pointer
-
- This function assigns the given value to the Process Stack Pointer (PSP).
-
- \param [in] topOfProcStack Process Stack Pointer value to set
- */
-static __INLINE void __set_PSP(uint32_t topOfProcStack)
-{
- register uint32_t __regProcessStackPointer __ASM("psp");
- __regProcessStackPointer = topOfProcStack;
-}
-
-
-/** \brief Get Main Stack Pointer
-
- This function returns the current value of the Main Stack Pointer (MSP).
-
- \return MSP Register value
- */
-static __INLINE uint32_t __get_MSP(void)
-{
- register uint32_t __regMainStackPointer __ASM("msp");
- return(__regMainStackPointer);
-}
-
-
-/** \brief Set Main Stack Pointer
-
- This function assigns the given value to the Main Stack Pointer (MSP).
-
- \param [in] topOfMainStack Main Stack Pointer value to set
- */
-static __INLINE void __set_MSP(uint32_t topOfMainStack)
-{
- register uint32_t __regMainStackPointer __ASM("msp");
- __regMainStackPointer = topOfMainStack;
-}
-
-
-/** \brief Get Priority Mask
-
- This function returns the current state of the priority mask bit from the Priority Mask Register.
-
- \return Priority Mask value
- */
-static __INLINE uint32_t __get_PRIMASK(void)
-{
- register uint32_t __regPriMask __ASM("primask");
- return(__regPriMask);
-}
-
-
-/** \brief Set Priority Mask
-
- This function assigns the given value to the Priority Mask Register.
-
- \param [in] priMask Priority Mask
- */
-static __INLINE void __set_PRIMASK(uint32_t priMask)
-{
- register uint32_t __regPriMask __ASM("primask");
- __regPriMask = (priMask);
-}
-
-
-#if (__CORTEX_M >= 0x03)
-
-/** \brief Enable FIQ
-
- This function enables FIQ interrupts by clearing the F-bit in the CPSR.
- Can only be executed in Privileged modes.
- */
-#define __enable_fault_irq __enable_fiq
-
-
-/** \brief Disable FIQ
-
- This function disables FIQ interrupts by setting the F-bit in the CPSR.
- Can only be executed in Privileged modes.
- */
-#define __disable_fault_irq __disable_fiq
-
-
-/** \brief Get Base Priority
-
- This function returns the current value of the Base Priority register.
-
- \return Base Priority register value
- */
-static __INLINE uint32_t __get_BASEPRI(void)
-{
- register uint32_t __regBasePri __ASM("basepri");
- return(__regBasePri);
-}
-
-
-/** \brief Set Base Priority
-
- This function assigns the given value to the Base Priority register.
-
- \param [in] basePri Base Priority value to set
- */
-static __INLINE void __set_BASEPRI(uint32_t basePri)
-{
- register uint32_t __regBasePri __ASM("basepri");
- __regBasePri = (basePri & 0xff);
-}
-
-
-/** \brief Get Fault Mask
-
- This function returns the current value of the Fault Mask register.
-
- \return Fault Mask register value
- */
-static __INLINE uint32_t __get_FAULTMASK(void)
-{
- register uint32_t __regFaultMask __ASM("faultmask");
- return(__regFaultMask);
-}
-
-
-/** \brief Set Fault Mask
-
- This function assigns the given value to the Fault Mask register.
-
- \param [in] faultMask Fault Mask value to set
- */
-static __INLINE void __set_FAULTMASK(uint32_t faultMask)
-{
- register uint32_t __regFaultMask __ASM("faultmask");
- __regFaultMask = (faultMask & (uint32_t)1);
-}
-
-#endif /* (__CORTEX_M >= 0x03) */
-
-
-#if (__CORTEX_M == 0x04)
-
-/** \brief Get FPSCR
-
- This function returns the current value of the Floating Point Status/Control register.
-
- \return Floating Point Status/Control register value
- */
-static __INLINE uint32_t __get_FPSCR(void)
-{
-#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
- register uint32_t __regfpscr __ASM("fpscr");
- return(__regfpscr);
-#else
- return(0);
-#endif
-}
-
-
-/** \brief Set FPSCR
-
- This function assigns the given value to the Floating Point Status/Control register.
-
- \param [in] fpscr Floating Point Status/Control value to set
- */
-static __INLINE void __set_FPSCR(uint32_t fpscr)
-{
-#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
- register uint32_t __regfpscr __ASM("fpscr");
- __regfpscr = (fpscr);
-#endif
-}
-
-#endif /* (__CORTEX_M == 0x04) */
-
-
-#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
-/* IAR iccarm specific functions */
-
-#include
-
-#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
-/* GNU gcc specific functions */
-
-/** \brief Enable IRQ Interrupts
-
- This function enables IRQ interrupts by clearing the I-bit in the CPSR.
- Can only be executed in Privileged modes.
- */
-__attribute__( ( always_inline ) ) static __INLINE void __enable_irq(void)
-{
- __ASM volatile ("cpsie i");
-}
-
-
-/** \brief Disable IRQ Interrupts
-
- This function disables IRQ interrupts by setting the I-bit in the CPSR.
- Can only be executed in Privileged modes.
- */
-__attribute__( ( always_inline ) ) static __INLINE void __disable_irq(void)
-{
- __ASM volatile ("cpsid i");
-}
-
-
-/** \brief Get Control Register
-
- This function returns the content of the Control Register.
-
- \return Control Register value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_CONTROL(void)
-{
- uint32_t result;
-
- __ASM volatile ("MRS %0, control" : "=r" (result) );
- return(result);
-}
-
-
-/** \brief Set Control Register
-
- This function writes the given value to the Control Register.
-
- \param [in] control Control Register value to set
- */
-__attribute__( ( always_inline ) ) static __INLINE void __set_CONTROL(uint32_t control)
-{
- __ASM volatile ("MSR control, %0" : : "r" (control) );
-}
-
-
-/** \brief Get ISPR Register
-
- This function returns the content of the ISPR Register.
-
- \return ISPR Register value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_IPSR(void)
-{
- uint32_t result;
-
- __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
- return(result);
-}
-
-
-/** \brief Get APSR Register
-
- This function returns the content of the APSR Register.
-
- \return APSR Register value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_APSR(void)
-{
- uint32_t result;
-
- __ASM volatile ("MRS %0, apsr" : "=r" (result) );
- return(result);
-}
-
-
-/** \brief Get xPSR Register
-
- This function returns the content of the xPSR Register.
-
- \return xPSR Register value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_xPSR(void)
-{
- uint32_t result;
-
- __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
- return(result);
-}
-
-
-/** \brief Get Process Stack Pointer
-
- This function returns the current value of the Process Stack Pointer (PSP).
-
- \return PSP Register value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_PSP(void)
-{
- register uint32_t result;
-
- __ASM volatile ("MRS %0, psp\n" : "=r" (result) );
- return(result);
-}
-
-
-/** \brief Set Process Stack Pointer
-
- This function assigns the given value to the Process Stack Pointer (PSP).
-
- \param [in] topOfProcStack Process Stack Pointer value to set
- */
-__attribute__( ( always_inline ) ) static __INLINE void __set_PSP(uint32_t topOfProcStack)
-{
- __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) );
-}
-
-
-/** \brief Get Main Stack Pointer
-
- This function returns the current value of the Main Stack Pointer (MSP).
-
- \return MSP Register value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_MSP(void)
-{
- register uint32_t result;
-
- __ASM volatile ("MRS %0, msp\n" : "=r" (result) );
- return(result);
-}
-
-
-/** \brief Set Main Stack Pointer
-
- This function assigns the given value to the Main Stack Pointer (MSP).
-
- \param [in] topOfMainStack Main Stack Pointer value to set
- */
-__attribute__( ( always_inline ) ) static __INLINE void __set_MSP(uint32_t topOfMainStack)
-{
- __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) );
-}
-
-
-/** \brief Get Priority Mask
-
- This function returns the current state of the priority mask bit from the Priority Mask Register.
-
- \return Priority Mask value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_PRIMASK(void)
-{
- uint32_t result;
-
- __ASM volatile ("MRS %0, primask" : "=r" (result) );
- return(result);
-}
-
-
-/** \brief Set Priority Mask
-
- This function assigns the given value to the Priority Mask Register.
-
- \param [in] priMask Priority Mask
- */
-__attribute__( ( always_inline ) ) static __INLINE void __set_PRIMASK(uint32_t priMask)
-{
- __ASM volatile ("MSR primask, %0" : : "r" (priMask) );
-}
-
-
-#if (__CORTEX_M >= 0x03)
-
-/** \brief Enable FIQ
-
- This function enables FIQ interrupts by clearing the F-bit in the CPSR.
- Can only be executed in Privileged modes.
- */
-__attribute__( ( always_inline ) ) static __INLINE void __enable_fault_irq(void)
-{
- __ASM volatile ("cpsie f");
-}
-
-
-/** \brief Disable FIQ
-
- This function disables FIQ interrupts by setting the F-bit in the CPSR.
- Can only be executed in Privileged modes.
- */
-__attribute__( ( always_inline ) ) static __INLINE void __disable_fault_irq(void)
-{
- __ASM volatile ("cpsid f");
-}
-
-
-/** \brief Get Base Priority
-
- This function returns the current value of the Base Priority register.
-
- \return Base Priority register value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_BASEPRI(void)
-{
- uint32_t result;
-
- __ASM volatile ("MRS %0, basepri_max" : "=r" (result) );
- return(result);
-}
-
-
-/** \brief Set Base Priority
-
- This function assigns the given value to the Base Priority register.
-
- \param [in] basePri Base Priority value to set
- */
-__attribute__( ( always_inline ) ) static __INLINE void __set_BASEPRI(uint32_t value)
-{
- __ASM volatile ("MSR basepri, %0" : : "r" (value) );
-}
-
-
-/** \brief Get Fault Mask
-
- This function returns the current value of the Fault Mask register.
-
- \return Fault Mask register value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_FAULTMASK(void)
-{
- uint32_t result;
-
- __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
- return(result);
-}
-
-
-/** \brief Set Fault Mask
-
- This function assigns the given value to the Fault Mask register.
-
- \param [in] faultMask Fault Mask value to set
- */
-__attribute__( ( always_inline ) ) static __INLINE void __set_FAULTMASK(uint32_t faultMask)
-{
- __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) );
-}
-
-#endif /* (__CORTEX_M >= 0x03) */
-
-
-#if (__CORTEX_M == 0x04)
-
-/** \brief Get FPSCR
-
- This function returns the current value of the Floating Point Status/Control register.
-
- \return Floating Point Status/Control register value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_FPSCR(void)
-{
-#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
- uint32_t result;
-
- __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
- return(result);
-#else
- return(0);
-#endif
-}
-
-
-/** \brief Set FPSCR
-
- This function assigns the given value to the Floating Point Status/Control register.
-
- \param [in] fpscr Floating Point Status/Control value to set
- */
-__attribute__( ( always_inline ) ) static __INLINE void __set_FPSCR(uint32_t fpscr)
-{
-#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
- __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) );
-#endif
-}
-
-#endif /* (__CORTEX_M == 0x04) */
-
-
-#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
-/* TASKING carm specific functions */
-
-/*
- * The CMSIS functions have been implemented as intrinsics in the compiler.
- * Please use "carm -?i" to get an up to date list of all instrinsics,
- * Including the CMSIS ones.
- */
-
-#endif
-
-/*@} end of CMSIS_Core_RegAccFunctions */
-
-
-#endif /* __CORE_CMFUNC_H */
diff --git a/platforms_startup/armcc/LPC1768/core_cmInstr.h b/platforms_startup/armcc/LPC1768/core_cmInstr.h
deleted file mode 100644
index 8ccd4fef1..000000000
--- a/platforms_startup/armcc/LPC1768/core_cmInstr.h
+++ /dev/null
@@ -1,586 +0,0 @@
-/**************************************************************************//**
- * @file core_cmInstr.h
- * @brief CMSIS Cortex-M Core Instruction Access Header File
- * @version V2.10
- * @date 19. July 2011
- *
- * @note
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M
- * processor based microcontrollers. This file can be freely distributed
- * within development tools that are supporting such ARM based processors.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-#ifndef __CORE_CMINSTR_H
-#define __CORE_CMINSTR_H
-
-
-/* ########################## Core Instruction Access ######################### */
-/** \ingroup CMSIS_Core
- \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
- Access to dedicated instructions
- @{
-*/
-
-#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
-/* ARM armcc specific functions */
-
-#if (__ARMCC_VERSION < 400677)
- #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
-#endif
-
-
-/** \brief No Operation
-
- No Operation does nothing. This instruction can be used for code alignment purposes.
- */
-#define __NOP __nop
-
-
-/** \brief Wait For Interrupt
-
- Wait For Interrupt is a hint instruction that suspends execution
- until one of a number of events occurs.
- */
-#define __WFI __wfi
-
-
-/** \brief Wait For Event
-
- Wait For Event is a hint instruction that permits the processor to enter
- a low-power state until one of a number of events occurs.
- */
-#define __WFE __wfe
-
-
-/** \brief Send Event
-
- Send Event is a hint instruction. It causes an event to be signaled to the CPU.
- */
-#define __SEV __sev
-
-
-/** \brief Instruction Synchronization Barrier
-
- Instruction Synchronization Barrier flushes the pipeline in the processor,
- so that all instructions following the ISB are fetched from cache or
- memory, after the instruction has been completed.
- */
-#define __ISB() __isb(0xF)
-
-
-/** \brief Data Synchronization Barrier
-
- This function acts as a special kind of Data Memory Barrier.
- It completes when all explicit memory accesses before this instruction complete.
- */
-#define __DSB() __dsb(0xF)
-
-
-/** \brief Data Memory Barrier
-
- This function ensures the apparent order of the explicit memory operations before
- and after the instruction, without ensuring their completion.
- */
-#define __DMB() __dmb(0xF)
-
-
-/** \brief Reverse byte order (32 bit)
-
- This function reverses the byte order in integer value.
-
- \param [in] value Value to reverse
- \return Reversed value
- */
-#define __REV __rev
-
-
-/** \brief Reverse byte order (16 bit)
-
- This function reverses the byte order in two unsigned short values.
-
- \param [in] value Value to reverse
- \return Reversed value
- */
-static __INLINE __ASM uint32_t __REV16(uint32_t value)
-{
- rev16 r0, r0
- bx lr
-}
-
-
-/** \brief Reverse byte order in signed short value
-
- This function reverses the byte order in a signed short value with sign extension to integer.
-
- \param [in] value Value to reverse
- \return Reversed value
- */
-static __INLINE __ASM int32_t __REVSH(int32_t value)
-{
- revsh r0, r0
- bx lr
-}
-
-
-#if (__CORTEX_M >= 0x03)
-
-/** \brief Reverse bit order of value
-
- This function reverses the bit order of the given value.
-
- \param [in] value Value to reverse
- \return Reversed value
- */
-#define __RBIT __rbit
-
-
-/** \brief LDR Exclusive (8 bit)
-
- This function performs a exclusive LDR command for 8 bit value.
-
- \param [in] ptr Pointer to data
- \return value of type uint8_t at (*ptr)
- */
-#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
-
-
-/** \brief LDR Exclusive (16 bit)
-
- This function performs a exclusive LDR command for 16 bit values.
-
- \param [in] ptr Pointer to data
- \return value of type uint16_t at (*ptr)
- */
-#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
-
-
-/** \brief LDR Exclusive (32 bit)
-
- This function performs a exclusive LDR command for 32 bit values.
-
- \param [in] ptr Pointer to data
- \return value of type uint32_t at (*ptr)
- */
-#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
-
-
-/** \brief STR Exclusive (8 bit)
-
- This function performs a exclusive STR command for 8 bit values.
-
- \param [in] value Value to store
- \param [in] ptr Pointer to location
- \return 0 Function succeeded
- \return 1 Function failed
- */
-#define __STREXB(value, ptr) __strex(value, ptr)
-
-
-/** \brief STR Exclusive (16 bit)
-
- This function performs a exclusive STR command for 16 bit values.
-
- \param [in] value Value to store
- \param [in] ptr Pointer to location
- \return 0 Function succeeded
- \return 1 Function failed
- */
-#define __STREXH(value, ptr) __strex(value, ptr)
-
-
-/** \brief STR Exclusive (32 bit)
-
- This function performs a exclusive STR command for 32 bit values.
-
- \param [in] value Value to store
- \param [in] ptr Pointer to location
- \return 0 Function succeeded
- \return 1 Function failed
- */
-#define __STREXW(value, ptr) __strex(value, ptr)
-
-
-/** \brief Remove the exclusive lock
-
- This function removes the exclusive lock which is created by LDREX.
-
- */
-#define __CLREX __clrex
-
-
-/** \brief Signed Saturate
-
- This function saturates a signed value.
-
- \param [in] value Value to be saturated
- \param [in] sat Bit position to saturate to (1..32)
- \return Saturated value
- */
-#define __SSAT __ssat
-
-
-/** \brief Unsigned Saturate
-
- This function saturates an unsigned value.
-
- \param [in] value Value to be saturated
- \param [in] sat Bit position to saturate to (0..31)
- \return Saturated value
- */
-#define __USAT __usat
-
-
-/** \brief Count leading zeros
-
- This function counts the number of leading zeros of a data value.
-
- \param [in] value Value to count the leading zeros
- \return number of leading zeros in value
- */
-#define __CLZ __clz
-
-#endif /* (__CORTEX_M >= 0x03) */
-
-
-
-#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
-/* IAR iccarm specific functions */
-
-#include
-
-
-#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
-/* GNU gcc specific functions */
-
-/** \brief No Operation
-
- No Operation does nothing. This instruction can be used for code alignment purposes.
- */
-__attribute__( ( always_inline ) ) static __INLINE void __NOP(void)
-{
- __ASM volatile ("nop");
-}
-
-
-/** \brief Wait For Interrupt
-
- Wait For Interrupt is a hint instruction that suspends execution
- until one of a number of events occurs.
- */
-__attribute__( ( always_inline ) ) static __INLINE void __WFI(void)
-{
- __ASM volatile ("wfi");
-}
-
-
-/** \brief Wait For Event
-
- Wait For Event is a hint instruction that permits the processor to enter
- a low-power state until one of a number of events occurs.
- */
-__attribute__( ( always_inline ) ) static __INLINE void __WFE(void)
-{
- __ASM volatile ("wfe");
-}
-
-
-/** \brief Send Event
-
- Send Event is a hint instruction. It causes an event to be signaled to the CPU.
- */
-__attribute__( ( always_inline ) ) static __INLINE void __SEV(void)
-{
- __ASM volatile ("sev");
-}
-
-
-/** \brief Instruction Synchronization Barrier
-
- Instruction Synchronization Barrier flushes the pipeline in the processor,
- so that all instructions following the ISB are fetched from cache or
- memory, after the instruction has been completed.
- */
-__attribute__( ( always_inline ) ) static __INLINE void __ISB(void)
-{
- __ASM volatile ("isb");
-}
-
-
-/** \brief Data Synchronization Barrier
-
- This function acts as a special kind of Data Memory Barrier.
- It completes when all explicit memory accesses before this instruction complete.
- */
-__attribute__( ( always_inline ) ) static __INLINE void __DSB(void)
-{
- __ASM volatile ("dsb");
-}
-
-
-/** \brief Data Memory Barrier
-
- This function ensures the apparent order of the explicit memory operations before
- and after the instruction, without ensuring their completion.
- */
-__attribute__( ( always_inline ) ) static __INLINE void __DMB(void)
-{
- __ASM volatile ("dmb");
-}
-
-
-/** \brief Reverse byte order (32 bit)
-
- This function reverses the byte order in integer value.
-
- \param [in] value Value to reverse
- \return Reversed value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __REV(uint32_t value)
-{
- uint32_t result;
-
- __ASM volatile ("rev %0, %1" : "=r" (result) : "r" (value) );
- return(result);
-}
-
-
-/** \brief Reverse byte order (16 bit)
-
- This function reverses the byte order in two unsigned short values.
-
- \param [in] value Value to reverse
- \return Reversed value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __REV16(uint32_t value)
-{
- uint32_t result;
-
- __ASM volatile ("rev16 %0, %1" : "=r" (result) : "r" (value) );
- return(result);
-}
-
-
-/** \brief Reverse byte order in signed short value
-
- This function reverses the byte order in a signed short value with sign extension to integer.
-
- \param [in] value Value to reverse
- \return Reversed value
- */
-__attribute__( ( always_inline ) ) static __INLINE int32_t __REVSH(int32_t value)
-{
- uint32_t result;
-
- __ASM volatile ("revsh %0, %1" : "=r" (result) : "r" (value) );
- return(result);
-}
-
-
-#if (__CORTEX_M >= 0x03)
-
-/** \brief Reverse bit order of value
-
- This function reverses the bit order of the given value.
-
- \param [in] value Value to reverse
- \return Reversed value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __RBIT(uint32_t value)
-{
- uint32_t result;
-
- __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
- return(result);
-}
-
-
-/** \brief LDR Exclusive (8 bit)
-
- This function performs a exclusive LDR command for 8 bit value.
-
- \param [in] ptr Pointer to data
- \return value of type uint8_t at (*ptr)
- */
-__attribute__( ( always_inline ) ) static __INLINE uint8_t __LDREXB(volatile uint8_t *addr)
-{
- uint8_t result;
-
- __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) );
- return(result);
-}
-
-
-/** \brief LDR Exclusive (16 bit)
-
- This function performs a exclusive LDR command for 16 bit values.
-
- \param [in] ptr Pointer to data
- \return value of type uint16_t at (*ptr)
- */
-__attribute__( ( always_inline ) ) static __INLINE uint16_t __LDREXH(volatile uint16_t *addr)
-{
- uint16_t result;
-
- __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) );
- return(result);
-}
-
-
-/** \brief LDR Exclusive (32 bit)
-
- This function performs a exclusive LDR command for 32 bit values.
-
- \param [in] ptr Pointer to data
- \return value of type uint32_t at (*ptr)
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __LDREXW(volatile uint32_t *addr)
-{
- uint32_t result;
-
- __ASM volatile ("ldrex %0, [%1]" : "=r" (result) : "r" (addr) );
- return(result);
-}
-
-
-/** \brief STR Exclusive (8 bit)
-
- This function performs a exclusive STR command for 8 bit values.
-
- \param [in] value Value to store
- \param [in] ptr Pointer to location
- \return 0 Function succeeded
- \return 1 Function failed
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
-{
- uint32_t result;
-
- __ASM volatile ("strexb %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );
- return(result);
-}
-
-
-/** \brief STR Exclusive (16 bit)
-
- This function performs a exclusive STR command for 16 bit values.
-
- \param [in] value Value to store
- \param [in] ptr Pointer to location
- \return 0 Function succeeded
- \return 1 Function failed
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)
-{
- uint32_t result;
-
- __ASM volatile ("strexh %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );
- return(result);
-}
-
-
-/** \brief STR Exclusive (32 bit)
-
- This function performs a exclusive STR command for 32 bit values.
-
- \param [in] value Value to store
- \param [in] ptr Pointer to location
- \return 0 Function succeeded
- \return 1 Function failed
- */
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)
-{
- uint32_t result;
-
- __ASM volatile ("strex %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );
- return(result);
-}
-
-
-/** \brief Remove the exclusive lock
-
- This function removes the exclusive lock which is created by LDREX.
-
- */
-__attribute__( ( always_inline ) ) static __INLINE void __CLREX(void)
-{
- __ASM volatile ("clrex");
-}
-
-
-/** \brief Signed Saturate
-
- This function saturates a signed value.
-
- \param [in] value Value to be saturated
- \param [in] sat Bit position to saturate to (1..32)
- \return Saturated value
- */
-#define __SSAT(ARG1,ARG2) \
-({ \
- uint32_t __RES, __ARG1 = (ARG1); \
- __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
- __RES; \
- })
-
-
-/** \brief Unsigned Saturate
-
- This function saturates an unsigned value.
-
- \param [in] value Value to be saturated
- \param [in] sat Bit position to saturate to (0..31)
- \return Saturated value
- */
-#define __USAT(ARG1,ARG2) \
-({ \
- uint32_t __RES, __ARG1 = (ARG1); \
- __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
- __RES; \
- })
-
-
-/** \brief Count leading zeros
-
- This function counts the number of leading zeros of a data value.
-
- \param [in] value Value to count the leading zeros
- \return number of leading zeros in value
- */
-__attribute__( ( always_inline ) ) static __INLINE uint8_t __CLZ(uint32_t value)
-{
- uint8_t result;
-
- __ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value) );
- return(result);
-}
-
-#endif /* (__CORTEX_M >= 0x03) */
-
-
-
-
-#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
-/* TASKING carm specific functions */
-
-/*
- * The CMSIS functions have been implemented as intrinsics in the compiler.
- * Please use "carm -?i" to get an up to date list of all intrinsics,
- * Including the CMSIS ones.
- */
-
-#endif
-
-/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
-
-#endif /* __CORE_CMINSTR_H */
diff --git a/platforms_startup/armcc/LPC1768/lpc17xx_clkpwr.c b/platforms_startup/armcc/LPC1768/lpc17xx_clkpwr.c
deleted file mode 100644
index f6663d91b..000000000
--- a/platforms_startup/armcc/LPC1768/lpc17xx_clkpwr.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/**********************************************************************
-* $Id$ lpc17xx_clkpwr.c 2010-06-18
-*//**
-* @file lpc17xx_clkpwr.c
-* @brief Contains all functions support for Clock and Power Control
-* firmware library on LPC17xx
-* @version 3.0
-* @date 18. June. 2010
-* @author NXP MCU SW Application Team
-*
-* Copyright(C) 2010, NXP Semiconductor
-* All rights reserved.
-*
-***********************************************************************
-* Software that is described herein is for illustrative purposes only
-* which provides customers with programming information regarding the
-* products. This software is supplied "AS IS" without any warranties.
-* NXP Semiconductors assumes no responsibility or liability for the
-* use of the software, conveys no license or title under any patent,
-* copyright, or mask work right to the product. NXP Semiconductors
-* reserves the right to make changes in the software without
-* notification. NXP Semiconductors also make no representation or
-* warranty that such application will be suitable for the specified
-* use without further testing or modification.
-* Permission to use, copy, modify, and distribute this software and its
-* documentation is hereby granted, under NXP Semiconductors'
-* relevant copyright in the software, without fee, provided that it
-* is used in conjunction with NXP Semiconductors microcontrollers. This
-* copyright, permission, and disclaimer notice must appear in all copies of
-* this code.
-**********************************************************************/
-
-/* Peripheral group ----------------------------------------------------------- */
-/** @addtogroup CLKPWR
- * @{
- */
-
-/* Includes ------------------------------------------------------------------- */
-#include "lpc17xx_clkpwr.h"
-
-
-/* Public Functions ----------------------------------------------------------- */
-/** @addtogroup CLKPWR_Public_Functions
- * @{
- */
-
-/*********************************************************************//**
- * @brief Set value of each Peripheral Clock Selection
- * @param[in] ClkType Peripheral Clock Selection of each type,
- * should be one of the following:
- * - CLKPWR_PCLKSEL_WDT : WDT
- - CLKPWR_PCLKSEL_TIMER0 : Timer 0
- - CLKPWR_PCLKSEL_TIMER1 : Timer 1
- - CLKPWR_PCLKSEL_UART0 : UART 0
- - CLKPWR_PCLKSEL_UART1 : UART 1
- - CLKPWR_PCLKSEL_PWM1 : PWM 1
- - CLKPWR_PCLKSEL_I2C0 : I2C 0
- - CLKPWR_PCLKSEL_SPI : SPI
- - CLKPWR_PCLKSEL_SSP1 : SSP 1
- - CLKPWR_PCLKSEL_DAC : DAC
- - CLKPWR_PCLKSEL_ADC : ADC
- - CLKPWR_PCLKSEL_CAN1 : CAN 1
- - CLKPWR_PCLKSEL_CAN2 : CAN 2
- - CLKPWR_PCLKSEL_ACF : ACF
- - CLKPWR_PCLKSEL_QEI : QEI
- - CLKPWR_PCLKSEL_PCB : PCB
- - CLKPWR_PCLKSEL_I2C1 : I2C 1
- - CLKPWR_PCLKSEL_SSP0 : SSP 0
- - CLKPWR_PCLKSEL_TIMER2 : Timer 2
- - CLKPWR_PCLKSEL_TIMER3 : Timer 3
- - CLKPWR_PCLKSEL_UART2 : UART 2
- - CLKPWR_PCLKSEL_UART3 : UART 3
- - CLKPWR_PCLKSEL_I2C2 : I2C 2
- - CLKPWR_PCLKSEL_I2S : I2S
- - CLKPWR_PCLKSEL_RIT : RIT
- - CLKPWR_PCLKSEL_SYSCON : SYSCON
- - CLKPWR_PCLKSEL_MC : MC
-
- * @param[in] DivVal Value of divider, should be:
- * - CLKPWR_PCLKSEL_CCLK_DIV_4 : PCLK_peripheral = CCLK/4
- * - CLKPWR_PCLKSEL_CCLK_DIV_1 : PCLK_peripheral = CCLK/1
- * - CLKPWR_PCLKSEL_CCLK_DIV_2 : PCLK_peripheral = CCLK/2
- *
- * @return none
- **********************************************************************/
-void CLKPWR_SetPCLKDiv (uint32_t ClkType, uint32_t DivVal)
-{
- uint32_t bitpos;
-
- bitpos = (ClkType < 32) ? (ClkType) : (ClkType - 32);
-
- /* PCLKSEL0 selected */
- if (ClkType < 32)
- {
- /* Clear two bit at bit position */
- LPC_SC->PCLKSEL0 &= (~(CLKPWR_PCLKSEL_BITMASK(bitpos)));
-
- /* Set two selected bit */
- LPC_SC->PCLKSEL0 |= (CLKPWR_PCLKSEL_SET(bitpos, DivVal));
- }
- /* PCLKSEL1 selected */
- else
- {
- /* Clear two bit at bit position */
- LPC_SC->PCLKSEL1 &= ~(CLKPWR_PCLKSEL_BITMASK(bitpos));
-
- /* Set two selected bit */
- LPC_SC->PCLKSEL1 |= (CLKPWR_PCLKSEL_SET(bitpos, DivVal));
- }
-}
-
-
-/*********************************************************************//**
- * @brief Get current value of each Peripheral Clock Selection
- * @param[in] ClkType Peripheral Clock Selection of each type,
- * should be one of the following:
- * - CLKPWR_PCLKSEL_WDT : WDT
- - CLKPWR_PCLKSEL_TIMER0 : Timer 0
- - CLKPWR_PCLKSEL_TIMER1 : Timer 1
- - CLKPWR_PCLKSEL_UART0 : UART 0
- - CLKPWR_PCLKSEL_UART1 : UART 1
- - CLKPWR_PCLKSEL_PWM1 : PWM 1
- - CLKPWR_PCLKSEL_I2C0 : I2C 0
- - CLKPWR_PCLKSEL_SPI : SPI
- - CLKPWR_PCLKSEL_SSP1 : SSP 1
- - CLKPWR_PCLKSEL_DAC : DAC
- - CLKPWR_PCLKSEL_ADC : ADC
- - CLKPWR_PCLKSEL_CAN1 : CAN 1
- - CLKPWR_PCLKSEL_CAN2 : CAN 2
- - CLKPWR_PCLKSEL_ACF : ACF
- - CLKPWR_PCLKSEL_QEI : QEI
- - CLKPWR_PCLKSEL_PCB : PCB
- - CLKPWR_PCLKSEL_I2C1 : I2C 1
- - CLKPWR_PCLKSEL_SSP0 : SSP 0
- - CLKPWR_PCLKSEL_TIMER2 : Timer 2
- - CLKPWR_PCLKSEL_TIMER3 : Timer 3
- - CLKPWR_PCLKSEL_UART2 : UART 2
- - CLKPWR_PCLKSEL_UART3 : UART 3
- - CLKPWR_PCLKSEL_I2C2 : I2C 2
- - CLKPWR_PCLKSEL_I2S : I2S
- - CLKPWR_PCLKSEL_RIT : RIT
- - CLKPWR_PCLKSEL_SYSCON : SYSCON
- - CLKPWR_PCLKSEL_MC : MC
-
- * @return Value of Selected Peripheral Clock Selection
- **********************************************************************/
-uint32_t CLKPWR_GetPCLKSEL (uint32_t ClkType)
-{
- uint32_t bitpos, retval;
-
- if (ClkType < 32)
- {
- bitpos = ClkType;
- retval = LPC_SC->PCLKSEL0;
- }
- else
- {
- bitpos = ClkType - 32;
- retval = LPC_SC->PCLKSEL1;
- }
-
- retval = CLKPWR_PCLKSEL_GET(bitpos, retval);
- return retval;
-}
-
-
-
-/*********************************************************************//**
- * @brief Get current value of each Peripheral Clock
- * @param[in] ClkType Peripheral Clock Selection of each type,
- * should be one of the following:
- * - CLKPWR_PCLKSEL_WDT : WDT
- - CLKPWR_PCLKSEL_TIMER0 : Timer 0
- - CLKPWR_PCLKSEL_TIMER1 : Timer 1
- - CLKPWR_PCLKSEL_UART0 : UART 0
- - CLKPWR_PCLKSEL_UART1 : UART 1
- - CLKPWR_PCLKSEL_PWM1 : PWM 1
- - CLKPWR_PCLKSEL_I2C0 : I2C 0
- - CLKPWR_PCLKSEL_SPI : SPI
- - CLKPWR_PCLKSEL_SSP1 : SSP 1
- - CLKPWR_PCLKSEL_DAC : DAC
- - CLKPWR_PCLKSEL_ADC : ADC
- - CLKPWR_PCLKSEL_CAN1 : CAN 1
- - CLKPWR_PCLKSEL_CAN2 : CAN 2
- - CLKPWR_PCLKSEL_ACF : ACF
- - CLKPWR_PCLKSEL_QEI : QEI
- - CLKPWR_PCLKSEL_PCB : PCB
- - CLKPWR_PCLKSEL_I2C1 : I2C 1
- - CLKPWR_PCLKSEL_SSP0 : SSP 0
- - CLKPWR_PCLKSEL_TIMER2 : Timer 2
- - CLKPWR_PCLKSEL_TIMER3 : Timer 3
- - CLKPWR_PCLKSEL_UART2 : UART 2
- - CLKPWR_PCLKSEL_UART3 : UART 3
- - CLKPWR_PCLKSEL_I2C2 : I2C 2
- - CLKPWR_PCLKSEL_I2S : I2S
- - CLKPWR_PCLKSEL_RIT : RIT
- - CLKPWR_PCLKSEL_SYSCON : SYSCON
- - CLKPWR_PCLKSEL_MC : MC
-
- * @return Value of Selected Peripheral Clock
- **********************************************************************/
-uint32_t CLKPWR_GetPCLK (uint32_t ClkType)
-{
- uint32_t retval, div;
-
- retval = SystemCoreClock;
- div = CLKPWR_GetPCLKSEL(ClkType);
-
- switch (div)
- {
- case 0:
- div = 4;
- break;
-
- case 1:
- div = 1;
- break;
-
- case 2:
- div = 2;
- break;
-
- case 3:
- div = 8;
- break;
- }
- retval /= div;
-
- return retval;
-}
-
-
-
-/*********************************************************************//**
- * @brief Configure power supply for each peripheral according to NewState
- * @param[in] PPType Type of peripheral used to enable power,
- * should be one of the following:
- * - CLKPWR_PCONP_PCTIM0 : Timer 0
- - CLKPWR_PCONP_PCTIM1 : Timer 1
- - CLKPWR_PCONP_PCUART0 : UART 0
- - CLKPWR_PCONP_PCUART1 : UART 1
- - CLKPWR_PCONP_PCPWM1 : PWM 1
- - CLKPWR_PCONP_PCI2C0 : I2C 0
- - CLKPWR_PCONP_PCSPI : SPI
- - CLKPWR_PCONP_PCRTC : RTC
- - CLKPWR_PCONP_PCSSP1 : SSP 1
- - CLKPWR_PCONP_PCAD : ADC
- - CLKPWR_PCONP_PCAN1 : CAN 1
- - CLKPWR_PCONP_PCAN2 : CAN 2
- - CLKPWR_PCONP_PCGPIO : GPIO
- - CLKPWR_PCONP_PCRIT : RIT
- - CLKPWR_PCONP_PCMC : MC
- - CLKPWR_PCONP_PCQEI : QEI
- - CLKPWR_PCONP_PCI2C1 : I2C 1
- - CLKPWR_PCONP_PCSSP0 : SSP 0
- - CLKPWR_PCONP_PCTIM2 : Timer 2
- - CLKPWR_PCONP_PCTIM3 : Timer 3
- - CLKPWR_PCONP_PCUART2 : UART 2
- - CLKPWR_PCONP_PCUART3 : UART 3
- - CLKPWR_PCONP_PCI2C2 : I2C 2
- - CLKPWR_PCONP_PCI2S : I2S
- - CLKPWR_PCONP_PCGPDMA : GPDMA
- - CLKPWR_PCONP_PCENET : Ethernet
- - CLKPWR_PCONP_PCUSB : USB
- *
- * @param[in] NewState New state of Peripheral Power, should be:
- * - ENABLE : Enable power for this peripheral
- * - DISABLE : Disable power for this peripheral
- *
- * @return none
- **********************************************************************/
-void CLKPWR_ConfigPPWR (uint32_t PPType, FunctionalState NewState)
-{
- if (NewState == ENABLE)
- {
- LPC_SC->PCONP |= PPType & CLKPWR_PCONP_BITMASK;
- }
- else if (NewState == DISABLE)
- {
- LPC_SC->PCONP &= (~PPType) & CLKPWR_PCONP_BITMASK;
- }
-}
-
-
-/*********************************************************************//**
- * @brief Enter Sleep mode with co-operated instruction by the Cortex-M3.
- * @param[in] None
- * @return None
- **********************************************************************/
-void CLKPWR_Sleep(void)
-{
- LPC_SC->PCON = 0x00;
- /* Sleep Mode*/
- __WFI();
-}
-
-
-/*********************************************************************//**
- * @brief Enter Deep Sleep mode with co-operated instruction by the Cortex-M3.
- * @param[in] None
- * @return None
- **********************************************************************/
-void CLKPWR_DeepSleep(void)
-{
- /* Deep-Sleep Mode, set SLEEPDEEP bit */
- SCB->SCR = 0x4;
- LPC_SC->PCON = 0x00;
- /* Deep Sleep Mode*/
- __WFI();
-}
-
-
-/*********************************************************************//**
- * @brief Enter Power Down mode with co-operated instruction by the Cortex-M3.
- * @param[in] None
- * @return None
- **********************************************************************/
-void CLKPWR_PowerDown(void)
-{
- /* Deep-Sleep Mode, set SLEEPDEEP bit */
- SCB->SCR = 0x4;
- LPC_SC->PCON = 0x01;
- /* Power Down Mode*/
- __WFI();
-}
-
-
-/*********************************************************************//**
- * @brief Enter Deep Power Down mode with co-operated instruction by the Cortex-M3.
- * @param[in] None
- * @return None
- **********************************************************************/
-void CLKPWR_DeepPowerDown(void)
-{
- /* Deep-Sleep Mode, set SLEEPDEEP bit */
- SCB->SCR = 0x4;
- LPC_SC->PCON = 0x03;
- /* Deep Power Down Mode*/
- __WFI();
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/* --------------------------------- End Of File ------------------------------ */
diff --git a/platforms_startup/armcc/LPC1768/lpc17xx_clkpwr.h b/platforms_startup/armcc/LPC1768/lpc17xx_clkpwr.h
deleted file mode 100644
index 4574a6bc1..000000000
--- a/platforms_startup/armcc/LPC1768/lpc17xx_clkpwr.h
+++ /dev/null
@@ -1,406 +0,0 @@
-/**********************************************************************
-* $Id$ lpc17xx_clkpwr.h 2010-05-21
-*//**
-* @file lpc17xx_clkpwr.h
-* @brief Contains all macro definitions and function prototypes
-* support for Clock and Power Control firmware library on LPC17xx
-* @version 2.0
-* @date 21. May. 2010
-* @author NXP MCU SW Application Team
-*
-* Copyright(C) 2010, NXP Semiconductor
-* All rights reserved.
-*
-***********************************************************************
-* Software that is described herein is for illustrative purposes only
-* which provides customers with programming information regarding the
-* products. This software is supplied "AS IS" without any warranties.
-* NXP Semiconductors assumes no responsibility or liability for the
-* use of the software, conveys no license or title under any patent,
-* copyright, or mask work right to the product. NXP Semiconductors
-* reserves the right to make changes in the software without
-* notification. NXP Semiconductors also make no representation or
-* warranty that such application will be suitable for the specified
-* use without further testing or modification.
-* Permission to use, copy, modify, and distribute this software and its
-* documentation is hereby granted, under NXP Semiconductors'
-* relevant copyright in the software, without fee, provided that it
-* is used in conjunction with NXP Semiconductors microcontrollers. This
-* copyright, permission, and disclaimer notice must appear in all copies of
-* this code.
-**********************************************************************/
-
-/* Peripheral group ----------------------------------------------------------- */
-/** @defgroup CLKPWR CLKPWR (Clock Power)
- * @ingroup LPC1700CMSIS_FwLib_Drivers
- * @{
- */
-
-#ifndef LPC17XX_CLKPWR_H_
-#define LPC17XX_CLKPWR_H_
-
-/* Includes ------------------------------------------------------------------- */
-#include "LPC17xx.h"
-#include "lpc_types.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/* Public Macros -------------------------------------------------------------- */
-/** @defgroup CLKPWR_Public_Macros CLKPWR Public Macros
- * @{
- */
-
-/**********************************************************************
- * Peripheral Clock Selection Definitions
- **********************************************************************/
-/** Peripheral clock divider bit position for WDT */
-#define CLKPWR_PCLKSEL_WDT ((uint32_t)(0))
-/** Peripheral clock divider bit position for TIMER0 */
-#define CLKPWR_PCLKSEL_TIMER0 ((uint32_t)(2))
-/** Peripheral clock divider bit position for TIMER1 */
-#define CLKPWR_PCLKSEL_TIMER1 ((uint32_t)(4))
-/** Peripheral clock divider bit position for UART0 */
-#define CLKPWR_PCLKSEL_UART0 ((uint32_t)(6))
-/** Peripheral clock divider bit position for UART1 */
-#define CLKPWR_PCLKSEL_UART1 ((uint32_t)(8))
-/** Peripheral clock divider bit position for PWM1 */
-#define CLKPWR_PCLKSEL_PWM1 ((uint32_t)(12))
-/** Peripheral clock divider bit position for I2C0 */
-#define CLKPWR_PCLKSEL_I2C0 ((uint32_t)(14))
-/** Peripheral clock divider bit position for SPI */
-#define CLKPWR_PCLKSEL_SPI ((uint32_t)(16))
-/** Peripheral clock divider bit position for SSP1 */
-#define CLKPWR_PCLKSEL_SSP1 ((uint32_t)(20))
-/** Peripheral clock divider bit position for DAC */
-#define CLKPWR_PCLKSEL_DAC ((uint32_t)(22))
-/** Peripheral clock divider bit position for ADC */
-#define CLKPWR_PCLKSEL_ADC ((uint32_t)(24))
-/** Peripheral clock divider bit position for CAN1 */
-#define CLKPWR_PCLKSEL_CAN1 ((uint32_t)(26))
-/** Peripheral clock divider bit position for CAN2 */
-#define CLKPWR_PCLKSEL_CAN2 ((uint32_t)(28))
-/** Peripheral clock divider bit position for ACF */
-#define CLKPWR_PCLKSEL_ACF ((uint32_t)(30))
-/** Peripheral clock divider bit position for QEI */
-#define CLKPWR_PCLKSEL_QEI ((uint32_t)(32))
-/** Peripheral clock divider bit position for PCB */
-#define CLKPWR_PCLKSEL_PCB ((uint32_t)(36))
-/** Peripheral clock divider bit position for I2C1 */
-#define CLKPWR_PCLKSEL_I2C1 ((uint32_t)(38))
-/** Peripheral clock divider bit position for SSP0 */
-#define CLKPWR_PCLKSEL_SSP0 ((uint32_t)(42))
-/** Peripheral clock divider bit position for TIMER2 */
-#define CLKPWR_PCLKSEL_TIMER2 ((uint32_t)(44))
-/** Peripheral clock divider bit position for TIMER3 */
-#define CLKPWR_PCLKSEL_TIMER3 ((uint32_t)(46))
-/** Peripheral clock divider bit position for UART2 */
-#define CLKPWR_PCLKSEL_UART2 ((uint32_t)(48))
-/** Peripheral clock divider bit position for UART3 */
-#define CLKPWR_PCLKSEL_UART3 ((uint32_t)(50))
-/** Peripheral clock divider bit position for I2C2 */
-#define CLKPWR_PCLKSEL_I2C2 ((uint32_t)(52))
-/** Peripheral clock divider bit position for I2S */
-#define CLKPWR_PCLKSEL_I2S ((uint32_t)(54))
-/** Peripheral clock divider bit position for RIT */
-#define CLKPWR_PCLKSEL_RIT ((uint32_t)(58))
-/** Peripheral clock divider bit position for SYSCON */
-#define CLKPWR_PCLKSEL_SYSCON ((uint32_t)(60))
-/** Peripheral clock divider bit position for MC */
-#define CLKPWR_PCLKSEL_MC ((uint32_t)(62))
-
-/** Macro for Peripheral Clock Selection register bit values
- * Note: When CCLK_DIV_8, Peripheral’s clock is selected to
- * PCLK_xyz = CCLK/8 except for CAN1, CAN2, and CAN filtering
- * when ’11’selects PCLK_xyz = CCLK/6 */
-/* Peripheral clock divider is set to 4 from CCLK */
-#define CLKPWR_PCLKSEL_CCLK_DIV_4 ((uint32_t)(0))
-/** Peripheral clock divider is the same with CCLK */
-#define CLKPWR_PCLKSEL_CCLK_DIV_1 ((uint32_t)(1))
-/** Peripheral clock divider is set to 2 from CCLK */
-#define CLKPWR_PCLKSEL_CCLK_DIV_2 ((uint32_t)(2))
-
-
-/********************************************************************
-* Power Control for Peripherals Definitions
-**********************************************************************/
-/** Timer/Counter 0 power/clock control bit */
-#define CLKPWR_PCONP_PCTIM0 ((uint32_t)(1<<1))
-/* Timer/Counter 1 power/clock control bit */
-#define CLKPWR_PCONP_PCTIM1 ((uint32_t)(1<<2))
-/** UART0 power/clock control bit */
-#define CLKPWR_PCONP_PCUART0 ((uint32_t)(1<<3))
-/** UART1 power/clock control bit */
-#define CLKPWR_PCONP_PCUART1 ((uint32_t)(1<<4))
-/** PWM1 power/clock control bit */
-#define CLKPWR_PCONP_PCPWM1 ((uint32_t)(1<<6))
-/** The I2C0 interface power/clock control bit */
-#define CLKPWR_PCONP_PCI2C0 ((uint32_t)(1<<7))
-/** The SPI interface power/clock control bit */
-#define CLKPWR_PCONP_PCSPI ((uint32_t)(1<<8))
-/** The RTC power/clock control bit */
-#define CLKPWR_PCONP_PCRTC ((uint32_t)(1<<9))
-/** The SSP1 interface power/clock control bit */
-#define CLKPWR_PCONP_PCSSP1 ((uint32_t)(1<<10))
-/** A/D converter 0 (ADC0) power/clock control bit */
-#define CLKPWR_PCONP_PCAD ((uint32_t)(1<<12))
-/** CAN Controller 1 power/clock control bit */
-#define CLKPWR_PCONP_PCAN1 ((uint32_t)(1<<13))
-/** CAN Controller 2 power/clock control bit */
-#define CLKPWR_PCONP_PCAN2 ((uint32_t)(1<<14))
-/** GPIO power/clock control bit */
-#define CLKPWR_PCONP_PCGPIO ((uint32_t)(1<<15))
-/** Repetitive Interrupt Timer power/clock control bit */
-#define CLKPWR_PCONP_PCRIT ((uint32_t)(1<<16))
-/** Motor Control PWM */
-#define CLKPWR_PCONP_PCMC ((uint32_t)(1<<17))
-/** Quadrature Encoder Interface power/clock control bit */
-#define CLKPWR_PCONP_PCQEI ((uint32_t)(1<<18))
-/** The I2C1 interface power/clock control bit */
-#define CLKPWR_PCONP_PCI2C1 ((uint32_t)(1<<19))
-/** The SSP0 interface power/clock control bit */
-#define CLKPWR_PCONP_PCSSP0 ((uint32_t)(1<<21))
-/** Timer 2 power/clock control bit */
-#define CLKPWR_PCONP_PCTIM2 ((uint32_t)(1<<22))
-/** Timer 3 power/clock control bit */
-#define CLKPWR_PCONP_PCTIM3 ((uint32_t)(1<<23))
-/** UART 2 power/clock control bit */
-#define CLKPWR_PCONP_PCUART2 ((uint32_t)(1<<24))
-/** UART 3 power/clock control bit */
-#define CLKPWR_PCONP_PCUART3 ((uint32_t)(1<<25))
-/** I2C interface 2 power/clock control bit */
-#define CLKPWR_PCONP_PCI2C2 ((uint32_t)(1<<26))
-/** I2S interface power/clock control bit*/
-#define CLKPWR_PCONP_PCI2S ((uint32_t)(1<<27))
-/** GP DMA function power/clock control bit*/
-#define CLKPWR_PCONP_PCGPDMA ((uint32_t)(1<<29))
-/** Ethernet block power/clock control bit*/
-#define CLKPWR_PCONP_PCENET ((uint32_t)(1<<30))
-/** USB interface power/clock control bit*/
-#define CLKPWR_PCONP_PCUSB ((uint32_t)(1<<31))
-
-
-/**
- * @}
- */
-/* Private Macros ------------------------------------------------------------- */
-/** @defgroup CLKPWR_Private_Macros CLKPWR Private Macros
- * @{
- */
-
-/* --------------------- BIT DEFINITIONS -------------------------------------- */
-/*********************************************************************//**
- * Macro defines for Clock Source Select Register
- **********************************************************************/
-/** Internal RC oscillator */
-#define CLKPWR_CLKSRCSEL_CLKSRC_IRC ((uint32_t)(0x00))
-/** Main oscillator */
-#define CLKPWR_CLKSRCSEL_CLKSRC_MAINOSC ((uint32_t)(0x01))
-/** RTC oscillator */
-#define CLKPWR_CLKSRCSEL_CLKSRC_RTC ((uint32_t)(0x02))
-/** Clock source selection bit mask */
-#define CLKPWR_CLKSRCSEL_BITMASK ((uint32_t)(0x03))
-
-/*********************************************************************//**
- * Macro defines for Clock Output Configuration Register
- **********************************************************************/
-/* Clock Output Configuration register definition */
-/** Selects the CPU clock as the CLKOUT source */
-#define CLKPWR_CLKOUTCFG_CLKOUTSEL_CPU ((uint32_t)(0x00))
-/** Selects the main oscillator as the CLKOUT source */
-#define CLKPWR_CLKOUTCFG_CLKOUTSEL_MAINOSC ((uint32_t)(0x01))
-/** Selects the Internal RC oscillator as the CLKOUT source */
-#define CLKPWR_CLKOUTCFG_CLKOUTSEL_RC ((uint32_t)(0x02))
-/** Selects the USB clock as the CLKOUT source */
-#define CLKPWR_CLKOUTCFG_CLKOUTSEL_USB ((uint32_t)(0x03))
-/** Selects the RTC oscillator as the CLKOUT source */
-#define CLKPWR_CLKOUTCFG_CLKOUTSEL_RTC ((uint32_t)(0x04))
-/** Integer value to divide the output clock by, minus one */
-#define CLKPWR_CLKOUTCFG_CLKOUTDIV(n) ((uint32_t)((n&0x0F)<<4))
-/** CLKOUT enable control */
-#define CLKPWR_CLKOUTCFG_CLKOUT_EN ((uint32_t)(1<<8))
-/** CLKOUT activity indication */
-#define CLKPWR_CLKOUTCFG_CLKOUT_ACT ((uint32_t)(1<<9))
-/** Clock source selection bit mask */
-#define CLKPWR_CLKOUTCFG_BITMASK ((uint32_t)(0x3FF))
-
-/*********************************************************************//**
- * Macro defines for PPL0 Control Register
- **********************************************************************/
-/** PLL 0 control enable */
-#define CLKPWR_PLL0CON_ENABLE ((uint32_t)(0x01))
-/** PLL 0 control connect */
-#define CLKPWR_PLL0CON_CONNECT ((uint32_t)(0x02))
-/** PLL 0 control bit mask */
-#define CLKPWR_PLL0CON_BITMASK ((uint32_t)(0x03))
-
-/*********************************************************************//**
- * Macro defines for PPL0 Configuration Register
- **********************************************************************/
-/** PLL 0 Configuration MSEL field */
-#define CLKPWR_PLL0CFG_MSEL(n) ((uint32_t)(n&0x7FFF))
-/** PLL 0 Configuration NSEL field */
-#define CLKPWR_PLL0CFG_NSEL(n) ((uint32_t)((n<<16)&0xFF0000))
-/** PLL 0 Configuration bit mask */
-#define CLKPWR_PLL0CFG_BITMASK ((uint32_t)(0xFF7FFF))
-
-
-/*********************************************************************//**
- * Macro defines for PPL0 Status Register
- **********************************************************************/
-/** PLL 0 MSEL value */
-#define CLKPWR_PLL0STAT_MSEL(n) ((uint32_t)(n&0x7FFF))
-/** PLL NSEL get value */
-#define CLKPWR_PLL0STAT_NSEL(n) ((uint32_t)((n>>16)&0xFF))
-/** PLL status enable bit */
-#define CLKPWR_PLL0STAT_PLLE ((uint32_t)(1<<24))
-/** PLL status Connect bit */
-#define CLKPWR_PLL0STAT_PLLC ((uint32_t)(1<<25))
-/** PLL status lock */
-#define CLKPWR_PLL0STAT_PLOCK ((uint32_t)(1<<26))
-
-/*********************************************************************//**
- * Macro defines for PPL0 Feed Register
- **********************************************************************/
-/** PLL0 Feed bit mask */
-#define CLKPWR_PLL0FEED_BITMASK ((uint32_t)0xFF)
-
-/*********************************************************************//**
- * Macro defines for PLL1 Control Register
- **********************************************************************/
-/** USB PLL control enable */
-#define CLKPWR_PLL1CON_ENABLE ((uint32_t)(0x01))
-/** USB PLL control connect */
-#define CLKPWR_PLL1CON_CONNECT ((uint32_t)(0x02))
-/** USB PLL control bit mask */
-#define CLKPWR_PLL1CON_BITMASK ((uint32_t)(0x03))
-
-/*********************************************************************//**
- * Macro defines for PLL1 Configuration Register
- **********************************************************************/
-/** USB PLL MSEL set value */
-#define CLKPWR_PLL1CFG_MSEL(n) ((uint32_t)(n&0x1F))
-/** USB PLL PSEL set value */
-#define CLKPWR_PLL1CFG_PSEL(n) ((uint32_t)((n&0x03)<<5))
-/** USB PLL configuration bit mask */
-#define CLKPWR_PLL1CFG_BITMASK ((uint32_t)(0x7F))
-
-/*********************************************************************//**
- * Macro defines for PLL1 Status Register
- **********************************************************************/
-/** USB PLL MSEL get value */
-#define CLKPWR_PLL1STAT_MSEL(n) ((uint32_t)(n&0x1F))
-/** USB PLL PSEL get value */
-#define CLKPWR_PLL1STAT_PSEL(n) ((uint32_t)((n>>5)&0x03))
-/** USB PLL status enable bit */
-#define CLKPWR_PLL1STAT_PLLE ((uint32_t)(1<<8))
-/** USB PLL status Connect bit */
-#define CLKPWR_PLL1STAT_PLLC ((uint32_t)(1<<9))
-/** USB PLL status lock */
-#define CLKPWR_PLL1STAT_PLOCK ((uint32_t)(1<<10))
-
-/*********************************************************************//**
- * Macro defines for PLL1 Feed Register
- **********************************************************************/
-/** PLL1 Feed bit mask */
-#define CLKPWR_PLL1FEED_BITMASK ((uint32_t)0xFF)
-
-/*********************************************************************//**
- * Macro defines for CPU Clock Configuration Register
- **********************************************************************/
-/** CPU Clock configuration bit mask */
-#define CLKPWR_CCLKCFG_BITMASK ((uint32_t)(0xFF))
-
-/*********************************************************************//**
- * Macro defines for USB Clock Configuration Register
- **********************************************************************/
-/** USB Clock Configuration bit mask */
-#define CLKPWR_USBCLKCFG_BITMASK ((uint32_t)(0x0F))
-
-/*********************************************************************//**
- * Macro defines for IRC Trim Register
- **********************************************************************/
-/** IRC Trim bit mask */
-#define CLKPWR_IRCTRIM_BITMASK ((uint32_t)(0x0F))
-
-/*********************************************************************//**
- * Macro defines for Peripheral Clock Selection Register 0 and 1
- **********************************************************************/
-/** Peripheral Clock Selection 0 mask bit */
-#define CLKPWR_PCLKSEL0_BITMASK ((uint32_t)(0xFFF3F3FF))
-/** Peripheral Clock Selection 1 mask bit */
-#define CLKPWR_PCLKSEL1_BITMASK ((uint32_t)(0xFCF3F0F3))
-/** Macro to set peripheral clock of each type
- * p: position of two bits that hold divider of peripheral clock
- * n: value of divider of peripheral clock to be set */
-#define CLKPWR_PCLKSEL_SET(p,n) _SBF(p,n)
-/** Macro to mask peripheral clock of each type */
-#define CLKPWR_PCLKSEL_BITMASK(p) _SBF(p,0x03)
-/** Macro to get peripheral clock of each type */
-#define CLKPWR_PCLKSEL_GET(p, n) ((uint32_t)((n>>p)&0x03))
-
-/*********************************************************************//**
- * Macro defines for Power Mode Control Register
- **********************************************************************/
-/** Power mode control bit 0 */
-#define CLKPWR_PCON_PM0 ((uint32_t)(1<<0))
-/** Power mode control bit 1 */
-#define CLKPWR_PCON_PM1 ((uint32_t)(1<<1))
-/** Brown-Out Reduced Power Mode */
-#define CLKPWR_PCON_BODPDM ((uint32_t)(1<<2))
-/** Brown-Out Global Disable */
-#define CLKPWR_PCON_BOGD ((uint32_t)(1<<3))
-/** Brown Out Reset Disable */
-#define CLKPWR_PCON_BORD ((uint32_t)(1<<4))
-/** Sleep Mode entry flag */
-#define CLKPWR_PCON_SMFLAG ((uint32_t)(1<<8))
-/** Deep Sleep entry flag */
-#define CLKPWR_PCON_DSFLAG ((uint32_t)(1<<9))
-/** Power-down entry flag */
-#define CLKPWR_PCON_PDFLAG ((uint32_t)(1<<10))
-/** Deep Power-down entry flag */
-#define CLKPWR_PCON_DPDFLAG ((uint32_t)(1<<11))
-
-/*********************************************************************//**
- * Macro defines for Power Control for Peripheral Register
- **********************************************************************/
-/** Power Control for Peripherals bit mask */
-#define CLKPWR_PCONP_BITMASK 0xEFEFF7DE
-
-/**
- * @}
- */
-
-
-/* Public Functions ----------------------------------------------------------- */
-/** @defgroup CLKPWR_Public_Functions CLKPWR Public Functions
- * @{
- */
-
-void CLKPWR_SetPCLKDiv (uint32_t ClkType, uint32_t DivVal);
-uint32_t CLKPWR_GetPCLKSEL (uint32_t ClkType);
-uint32_t CLKPWR_GetPCLK (uint32_t ClkType);
-void CLKPWR_ConfigPPWR (uint32_t PPType, FunctionalState NewState);
-void CLKPWR_Sleep(void);
-void CLKPWR_DeepSleep(void);
-void CLKPWR_PowerDown(void);
-void CLKPWR_DeepPowerDown(void);
-
-/**
- * @}
- */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LPC17XX_CLKPWR_H_ */
-
-/**
- * @}
- */
-
-/* --------------------------------- End Of File ------------------------------ */
diff --git a/platforms_startup/armcc/LPC1768/lpc17xx_libcfg_default.c b/platforms_startup/armcc/LPC1768/lpc17xx_libcfg_default.c
deleted file mode 100644
index 83f5a9e16..000000000
--- a/platforms_startup/armcc/LPC1768/lpc17xx_libcfg_default.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/**********************************************************************
-* $Id$ lpc17xx_libcfg_default.c 2010-05-21
-*//**
-* @file lpc17xx_libcfg_default.c
-* @brief Library configuration source file (default), used to build
-* library without examples
-* @version 2.0
-* @date 21. May. 2010
-* @author NXP MCU SW Application Team
-*
-* Copyright(C) 2010, NXP Semiconductor
-* All rights reserved.
-*
-***********************************************************************
-* Software that is described herein is for illustrative purposes only
-* which provides customers with programming information regarding the
-* products. This software is supplied "AS IS" without any warranties.
-* NXP Semiconductors assumes no responsibility or liability for the
-* use of the software, conveys no license or title under any patent,
-* copyright, or mask work right to the product. NXP Semiconductors
-* reserves the right to make changes in the software without
-* notification. NXP Semiconductors also make no representation or
-* warranty that such application will be suitable for the specified
-* use without further testing or modification.
-* Permission to use, copy, modify, and distribute this software and its
-* documentation is hereby granted, under NXP Semiconductors'
-* relevant copyright in the software, without fee, provided that it
-* is used in conjunction with NXP Semiconductors microcontrollers. This
-* copyright, permission, and disclaimer notice must appear in all copies of
-* this code.
-**********************************************************************/
-
-/* Library group ----------------------------------------------------------- */
-/** @addtogroup LIBCFG_DEFAULT
- * @{
- */
-
-/* Includes ------------------------------------------------------------------- */
-#include "lpc17xx_libcfg_default.h"
-
-/* Public Functions ----------------------------------------------------------- */
-/** @addtogroup LIBCFG_DEFAULT_Public_Functions
- * @{
- */
-
-#ifndef __BUILD_WITH_EXAMPLE__
-
-#ifdef DEBUG
-/*******************************************************************************
-* @brief Reports the name of the source file and the source line number
-* where the CHECK_PARAM error has occurred.
-* @param[in] file Pointer to the source file name
-* @param[in] line assert_param error line source number
-* @return None
-*******************************************************************************/
-void check_failed(uint8_t *file, uint32_t line)
-{
- /* User can add his own implementation to report the file name and line number,
- ex: printf("Wrong parameters value: file %s on line %d\n", file, line) */
-
- /* Infinite loop */
- while(1);
-}
-#endif /* DEBUG */
-
-#endif /* __BUILD_WITH_EXAMPLE__ */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/* --------------------------------- End Of File ------------------------------ */
diff --git a/platforms_startup/armcc/LPC1768/lpc17xx_libcfg_default.h b/platforms_startup/armcc/LPC1768/lpc17xx_libcfg_default.h
deleted file mode 100644
index b4e3f4d49..000000000
--- a/platforms_startup/armcc/LPC1768/lpc17xx_libcfg_default.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/**********************************************************************
-* $Id$ lpc17xx_libcfg_default.h 2010-05-21
-*//**
-* @file lpc17xx_libcfg_default.h
-* @brief Default Library configuration header file
-* @version 2.0
-* @date 21. May. 2010
-* @author NXP MCU SW Application Team
-*
-* Copyright(C) 2010, NXP Semiconductor
-* All rights reserved.
-*
-***********************************************************************
-* Software that is described herein is for illustrative purposes only
-* which provides customers with programming information regarding the
-* products. This software is supplied "AS IS" without any warranties.
-* NXP Semiconductors assumes no responsibility or liability for the
-* use of the software, conveys no license or title under any patent,
-* copyright, or mask work right to the product. NXP Semiconductors
-* reserves the right to make changes in the software without
-* notification. NXP Semiconductors also make no representation or
-* warranty that such application will be suitable for the specified
-* use without further testing or modification.
-* Permission to use, copy, modify, and distribute this software and its
-* documentation is hereby granted, under NXP Semiconductors'
-* relevant copyright in the software, without fee, provided that it
-* is used in conjunction with NXP Semiconductors microcontrollers. This
-* copyright, permission, and disclaimer notice must appear in all copies of
-* this code.
-**********************************************************************/
-
-/* Library Configuration group ----------------------------------------------------------- */
-/** @defgroup LIBCFG_DEFAULT LIBCFG_DEFAULT (Default Library Configuration)
- * @ingroup LPC1700CMSIS_FwLib_Drivers
- * @{
- */
-
-#ifndef LPC17XX_LIBCFG_DEFAULT_H_
-#define LPC17XX_LIBCFG_DEFAULT_H_
-
-/* Includes ------------------------------------------------------------------- */
-#include "lpc_types.h"
-
-
-/* Public Macros -------------------------------------------------------------- */
-/** @defgroup LIBCFG_DEFAULT_Public_Macros LIBCFG_DEFAULT Public Macros
- * @{
- */
-
-/************************** DEBUG MODE DEFINITIONS *********************************/
-/* Un-comment the line below to compile the library in DEBUG mode, this will expanse
- the "CHECK_PARAM" macro in the FW library code */
-
-#define DEBUG
-
-
-/******************* PERIPHERAL FW LIBRARY CONFIGURATION DEFINITIONS ***********************/
-/* Comment the line below to disable the specific peripheral inclusion */
-
-/* DEBUG_FRAMWORK ------------------------------ */
-#define _DBGFWK
-
-/* GPIO ------------------------------- */
-#define _GPIO
-
-/* EXTI ------------------------------- */
-#define _EXTI
-
-/* UART ------------------------------- */
-#define _UART
-#define _UART0
-#define _UART1
-#define _UART2
-#define _UART3
-
-/* SPI ------------------------------- */
-#define _SPI
-
-/* SYSTICK --------------------------- */
-#define _SYSTICK
-
-/* SSP ------------------------------- */
-#define _SSP
-#define _SSP0
-#define _SSP1
-
-
-/* I2C ------------------------------- */
-#define _I2C
-#define _I2C0
-#define _I2C1
-#define _I2C2
-
-/* TIMER ------------------------------- */
-#define _TIM
-
-/* WDT ------------------------------- */
-#define _WDT
-
-
-/* GPDMA ------------------------------- */
-#define _GPDMA
-
-
-/* DAC ------------------------------- */
-#define _DAC
-
-/* DAC ------------------------------- */
-#define _ADC
-
-
-/* PWM ------------------------------- */
-#define _PWM
-#define _PWM1
-
-/* RTC ------------------------------- */
-#define _RTC
-
-/* I2S ------------------------------- */
-#define _I2S
-
-/* USB device ------------------------------- */
-#define _USBDEV
-#define _USB_DMA
-
-/* QEI ------------------------------- */
-#define _QEI
-
-/* MCPWM ------------------------------- */
-#define _MCPWM
-
-/* CAN--------------------------------*/
-#define _CAN
-
-/* RIT ------------------------------- */
-#define _RIT
-
-/* EMAC ------------------------------ */
-#define _EMAC
-
-/************************** GLOBAL/PUBLIC MACRO DEFINITIONS *********************************/
-
-#ifdef DEBUG
-/*******************************************************************************
-* @brief The CHECK_PARAM macro is used for function's parameters check.
-* It is used only if the library is compiled in DEBUG mode.
-* @param[in] expr - If expr is false, it calls check_failed() function
-* which reports the name of the source file and the source
-* line number of the call that failed.
-* - If expr is true, it returns no value.
-* @return None
-*******************************************************************************/
-#define CHECK_PARAM(expr) ((expr) ? (void)0 : check_failed((uint8_t *)__FILE__, __LINE__))
-#else
-#define CHECK_PARAM(expr)
-#endif /* DEBUG */
-
-/**
- * @}
- */
-
-
-/* Public Functions ----------------------------------------------------------- */
-/** @defgroup LIBCFG_DEFAULT_Public_Functions LIBCFG_DEFAULT Public Functions
- * @{
- */
-
-#ifdef DEBUG
-void check_failed(uint8_t *file, uint32_t line);
-#endif
-
-/**
- * @}
- */
-
-#endif /* LPC17XX_LIBCFG_DEFAULT_H_ */
-
-/**
- * @}
- */
-
-/* --------------------------------- End Of File ------------------------------ */
diff --git a/platforms_startup/armcc/LPC1768/lpc17xx_pinsel.h b/platforms_startup/armcc/LPC1768/lpc17xx_pinsel.h
deleted file mode 100644
index d2ad1f00e..000000000
--- a/platforms_startup/armcc/LPC1768/lpc17xx_pinsel.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/**********************************************************************
-* $Id$ lpc17xx_pinsel.h 2010-05-21
-*//**
-* @file lpc17xx_pinsel.h
-* @brief Contains all macro definitions and function prototypes
-* support for Pin connect block firmware library on LPC17xx
-* @version 2.0
-* @date 21. May. 2010
-* @author NXP MCU SW Application Team
-*
-* Copyright(C) 2010, NXP Semiconductor
-* All rights reserved.
-*
-***********************************************************************
-* Software that is described herein is for illustrative purposes only
-* which provides customers with programming information regarding the
-* products. This software is supplied "AS IS" without any warranties.
-* NXP Semiconductors assumes no responsibility or liability for the
-* use of the software, conveys no license or title under any patent,
-* copyright, or mask work right to the product. NXP Semiconductors
-* reserves the right to make changes in the software without
-* notification. NXP Semiconductors also make no representation or
-* warranty that such application will be suitable for the specified
-* use without further testing or modification.
-* Permission to use, copy, modify, and distribute this software and its
-* documentation is hereby granted, under NXP Semiconductors'
-* relevant copyright in the software, without fee, provided that it
-* is used in conjunction with NXP Semiconductors microcontrollers. This
-* copyright, permission, and disclaimer notice must appear in all copies of
-* this code.
-**********************************************************************/
-
-/* Peripheral group ----------------------------------------------------------- */
-/** @defgroup PINSEL PINSEL (Pin Selection)
- * @ingroup LPC1700CMSIS_FwLib_Drivers
- * @{
- */
-
-#ifndef LPC17XX_PINSEL_H_
-#define LPC17XX_PINSEL_H_
-
-/* Includes ------------------------------------------------------------------- */
-#include "LPC17xx.h"
-#include "lpc_types.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/* Public Macros -------------------------------------------------------------- */
-/** @defgroup PINSEL_Public_Macros PINSEL Public Macros
- * @{
- */
-
-/*********************************************************************//**
- *!< Macros define for PORT Selection
- ***********************************************************************/
-#define PINSEL_PORT_0 ((0)) /**< PORT 0*/
-#define PINSEL_PORT_1 ((1)) /**< PORT 1*/
-#define PINSEL_PORT_2 ((2)) /**< PORT 2*/
-#define PINSEL_PORT_3 ((3)) /**< PORT 3*/
-#define PINSEL_PORT_4 ((4)) /**< PORT 4*/
-
-/***********************************************************************
- * Macros define for Pin Function selection
- **********************************************************************/
-#define PINSEL_FUNC_0 ((0)) /**< default function*/
-#define PINSEL_FUNC_1 ((1)) /**< first alternate function*/
-#define PINSEL_FUNC_2 ((2)) /**< second alternate function*/
-#define PINSEL_FUNC_3 ((3)) /**< third or reserved alternate function*/
-
-/***********************************************************************
- * Macros define for Pin Number of Port
- **********************************************************************/
-#define PINSEL_PIN_0 ((0)) /**< Pin 0 */
-#define PINSEL_PIN_1 ((1)) /**< Pin 1 */
-#define PINSEL_PIN_2 ((2)) /**< Pin 2 */
-#define PINSEL_PIN_3 ((3)) /**< Pin 3 */
-#define PINSEL_PIN_4 ((4)) /**< Pin 4 */
-#define PINSEL_PIN_5 ((5)) /**< Pin 5 */
-#define PINSEL_PIN_6 ((6)) /**< Pin 6 */
-#define PINSEL_PIN_7 ((7)) /**< Pin 7 */
-#define PINSEL_PIN_8 ((8)) /**< Pin 8 */
-#define PINSEL_PIN_9 ((9)) /**< Pin 9 */
-#define PINSEL_PIN_10 ((10)) /**< Pin 10 */
-#define PINSEL_PIN_11 ((11)) /**< Pin 11 */
-#define PINSEL_PIN_12 ((12)) /**< Pin 12 */
-#define PINSEL_PIN_13 ((13)) /**< Pin 13 */
-#define PINSEL_PIN_14 ((14)) /**< Pin 14 */
-#define PINSEL_PIN_15 ((15)) /**< Pin 15 */
-#define PINSEL_PIN_16 ((16)) /**< Pin 16 */
-#define PINSEL_PIN_17 ((17)) /**< Pin 17 */
-#define PINSEL_PIN_18 ((18)) /**< Pin 18 */
-#define PINSEL_PIN_19 ((19)) /**< Pin 19 */
-#define PINSEL_PIN_20 ((20)) /**< Pin 20 */
-#define PINSEL_PIN_21 ((21)) /**< Pin 21 */
-#define PINSEL_PIN_22 ((22)) /**< Pin 22 */
-#define PINSEL_PIN_23 ((23)) /**< Pin 23 */
-#define PINSEL_PIN_24 ((24)) /**< Pin 24 */
-#define PINSEL_PIN_25 ((25)) /**< Pin 25 */
-#define PINSEL_PIN_26 ((26)) /**< Pin 26 */
-#define PINSEL_PIN_27 ((27)) /**< Pin 27 */
-#define PINSEL_PIN_28 ((28)) /**< Pin 28 */
-#define PINSEL_PIN_29 ((29)) /**< Pin 29 */
-#define PINSEL_PIN_30 ((30)) /**< Pin 30 */
-#define PINSEL_PIN_31 ((31)) /**< Pin 31 */
-
-/***********************************************************************
- * Macros define for Pin mode
- **********************************************************************/
-#define PINSEL_PINMODE_PULLUP ((0)) /**< Internal pull-up resistor*/
-#define PINSEL_PINMODE_TRISTATE ((2)) /**< Tri-state */
-#define PINSEL_PINMODE_PULLDOWN ((3)) /**< Internal pull-down resistor */
-
-/***********************************************************************
- * Macros define for Pin mode (normal/open drain)
- **********************************************************************/
-#define PINSEL_PINMODE_NORMAL ((0)) /**< Pin is in the normal (not open drain) mode.*/
-#define PINSEL_PINMODE_OPENDRAIN ((1)) /**< Pin is in the open drain mode */
-
-/***********************************************************************
- * Macros define for I2C mode
- ***********************************************************************/
-#define PINSEL_I2C_Normal_Mode ((0)) /**< The standard drive mode */
-#define PINSEL_I2C_Fast_Mode ((1)) /**< Fast Mode Plus drive mode */
-
-/**
- * @}
- */
-
-/* Private Macros ------------------------------------------------------------- */
-/** @defgroup PINSEL_Private_Macros PINSEL Private Macros
- * @{
- */
-
-/* Pin selection define */
-/* I2C Pin Configuration register bit description */
-#define PINSEL_I2CPADCFG_SDADRV0 _BIT(0) /**< Drive mode control for the SDA0 pin, P0.27 */
-#define PINSEL_I2CPADCFG_SDAI2C0 _BIT(1) /**< I2C mode control for the SDA0 pin, P0.27 */
-#define PINSEL_I2CPADCFG_SCLDRV0 _BIT(2) /**< Drive mode control for the SCL0 pin, P0.28 */
-#define PINSEL_I2CPADCFG_SCLI2C0 _BIT(3) /**< I2C mode control for the SCL0 pin, P0.28 */
-
-/**
- * @}
- */
-
-
-/* Public Types --------------------------------------------------------------- */
-/** @defgroup PINSEL_Public_Types PINSEL Public Types
- * @{
- */
-
-/** @brief Pin configuration structure */
-typedef struct
-{
- uint8_t Portnum; /**< Port Number, should be PINSEL_PORT_x,
- where x should be in range from 0 to 4 */
- uint8_t Pinnum; /**< Pin Number, should be PINSEL_PIN_x,
- where x should be in range from 0 to 31 */
- uint8_t Funcnum; /**< Function Number, should be PINSEL_FUNC_x,
- where x should be in range from 0 to 3 */
- uint8_t Pinmode; /**< Pin Mode, should be:
- - PINSEL_PINMODE_PULLUP: Internal pull-up resistor
- - PINSEL_PINMODE_TRISTATE: Tri-state
- - PINSEL_PINMODE_PULLDOWN: Internal pull-down resistor */
- uint8_t OpenDrain; /**< OpenDrain mode, should be:
- - PINSEL_PINMODE_NORMAL: Pin is in the normal (not open drain) mode
- - PINSEL_PINMODE_OPENDRAIN: Pin is in the open drain mode */
-} PINSEL_CFG_Type;
-
-/**
- * @}
- */
-
-
-/* Public Functions ----------------------------------------------------------- */
-/** @defgroup PINSEL_Public_Functions PINSEL Public Functions
- * @{
- */
-
-void PINSEL_ConfigPin(PINSEL_CFG_Type *PinCfg);
-void PINSEL_ConfigTraceFunc (FunctionalState NewState);
-void PINSEL_SetI2C0Pins(uint8_t i2cPinMode, FunctionalState filterSlewRateEnable);
-
-
-/**
- * @}
- */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LPC17XX_PINSEL_H_ */
-
-/**
- * @}
- */
-
-/* --------------------------------- End Of File ------------------------------ */
-
diff --git a/platforms_startup/armcc/LPC1768/lpc17xx_timer.c b/platforms_startup/armcc/LPC1768/lpc17xx_timer.c
deleted file mode 100644
index 17184aaf5..000000000
--- a/platforms_startup/armcc/LPC1768/lpc17xx_timer.c
+++ /dev/null
@@ -1,609 +0,0 @@
-/**********************************************************************
-* $Id$ lpc17xx_timer.c 2011-03-10
-*//**
-* @file lpc17xx_timer.c
-* @brief Contains all functions support for Timer firmware library
-* on LPC17xx
-* @version 3.1
-* @date 10. March. 2011
-* @author NXP MCU SW Application Team
-*
-* Copyright(C) 2011, NXP Semiconductor
-* All rights reserved.
-*
-***********************************************************************
-* Software that is described herein is for illustrative purposes only
-* which provides customers with programming information regarding the
-* products. This software is supplied "AS IS" without any warranties.
-* NXP Semiconductors assumes no responsibility or liability for the
-* use of the software, conveys no license or title under any patent,
-* copyright, or mask work right to the product. NXP Semiconductors
-* reserves the right to make changes in the software without
-* notification. NXP Semiconductors also make no representation or
-* warranty that such application will be suitable for the specified
-* use without further testing or modification.
-* Permission to use, copy, modify, and distribute this software and its
-* documentation is hereby granted, under NXP Semiconductors'
-* relevant copyright in the software, without fee, provided that it
-* is used in conjunction with NXP Semiconductors microcontrollers. This
-* copyright, permission, and disclaimer notice must appear in all copies of
-* this code.
-**********************************************************************/
-
-/* Peripheral group ----------------------------------------------------------- */
-/** @addtogroup TIM
- * @{
- */
-
-/* Includes ------------------------------------------------------------------- */
-#include "lpc17xx_timer.h"
-#include "lpc17xx_clkpwr.h"
-#include "lpc17xx_pinsel.h"
-
-/* If this source file built with example, the LPC17xx FW library configuration
- * file in each example directory ("lpc17xx_libcfg.h") must be included,
- * otherwise the default FW library configuration file must be included instead
- */
-#ifdef __BUILD_WITH_EXAMPLE__
-#include "lpc17xx_libcfg.h"
-#else
-#include "lpc17xx_libcfg_default.h"
-#endif /* __BUILD_WITH_EXAMPLE__ */
-
-#ifdef _TIM
-
-/* Private Functions ---------------------------------------------------------- */
-
-static uint32_t getPClock (uint32_t timernum);
-static uint32_t converUSecToVal (uint32_t timernum, uint32_t usec);
-static uint32_t converPtrToTimeNum (LPC_TIM_TypeDef *TIMx);
-
-
-/*********************************************************************//**
- * @brief Get peripheral clock of each timer controller
- * @param[in] timernum Timer number
- * @return Peripheral clock of timer
- **********************************************************************/
-static uint32_t getPClock (uint32_t timernum)
-{
- uint32_t clkdlycnt;
- switch (timernum)
- {
- case 0:
- clkdlycnt = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_TIMER0);
- break;
-
- case 1:
- clkdlycnt = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_TIMER1);
- break;
-
- case 2:
- clkdlycnt = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_TIMER2);
- break;
-
- case 3:
- clkdlycnt = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_TIMER3);
- break;
- }
- return clkdlycnt;
-}
-
-
-/*********************************************************************//**
- * @brief Convert a time to a timer count value
- * @param[in] timernum Timer number
- * @param[in] usec Time in microseconds
- * @return The number of required clock ticks to give the time delay
- **********************************************************************/
-uint32_t converUSecToVal (uint32_t timernum, uint32_t usec)
-{
- uint64_t clkdlycnt;
-
- // Get Pclock of timer
- clkdlycnt = (uint64_t) getPClock(timernum);
-
- clkdlycnt = (clkdlycnt * usec) / 1000000;
- return (uint32_t) clkdlycnt;
-}
-
-
-/*********************************************************************//**
- * @brief Convert a timer register pointer to a timer number
- * @param[in] TIMx Pointer to LPC_TIM_TypeDef, should be:
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * @return The timer number (0 to 3) or 0xFFFF FFFF if register pointer is bad
- **********************************************************************/
-uint32_t converPtrToTimeNum (LPC_TIM_TypeDef *TIMx)
-{
- uint32_t tnum = 0xFFFFFFFF;
-
- if (TIMx == LPC_TIM0)
- {
- tnum = 0;
- }
- else if (TIMx == LPC_TIM1)
- {
- tnum = 1;
- }
- else if (TIMx == LPC_TIM2)
- {
- tnum = 2;
- }
- else if (TIMx == LPC_TIM3)
- {
- tnum = 3;
- }
-
- return tnum;
-}
-
-/* End of Private Functions ---------------------------------------------------- */
-
-
-/* Public Functions ----------------------------------------------------------- */
-/** @addtogroup TIM_Public_Functions
- * @{
- */
-
-/*********************************************************************//**
- * @brief Get Interrupt Status
- * @param[in] TIMx Timer selection, should be:
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * @param[in] IntFlag: interrupt type, should be:
- * - TIM_MR0_INT: Interrupt for Match channel 0
- * - TIM_MR1_INT: Interrupt for Match channel 1
- * - TIM_MR2_INT: Interrupt for Match channel 2
- * - TIM_MR3_INT: Interrupt for Match channel 3
- * - TIM_CR0_INT: Interrupt for Capture channel 0
- * - TIM_CR1_INT: Interrupt for Capture channel 1
- * @return FlagStatus
- * - SET : interrupt
- * - RESET : no interrupt
- **********************************************************************/
-FlagStatus TIM_GetIntStatus(LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag)
-{
- uint8_t temp;
- CHECK_PARAM(PARAM_TIMx(TIMx));
- CHECK_PARAM(PARAM_TIM_INT_TYPE(IntFlag));
- temp = (TIMx->IR)& TIM_IR_CLR(IntFlag);
- if (temp)
- return SET;
-
- return RESET;
-
-}
-/*********************************************************************//**
- * @brief Get Capture Interrupt Status
- * @param[in] TIMx Timer selection, should be:
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * @param[in] IntFlag: interrupt type, should be:
- * - TIM_MR0_INT: Interrupt for Match channel 0
- * - TIM_MR1_INT: Interrupt for Match channel 1
- * - TIM_MR2_INT: Interrupt for Match channel 2
- * - TIM_MR3_INT: Interrupt for Match channel 3
- * - TIM_CR0_INT: Interrupt for Capture channel 0
- * - TIM_CR1_INT: Interrupt for Capture channel 1
- * @return FlagStatus
- * - SET : interrupt
- * - RESET : no interrupt
- **********************************************************************/
-FlagStatus TIM_GetIntCaptureStatus(LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag)
-{
- uint8_t temp;
- CHECK_PARAM(PARAM_TIMx(TIMx));
- CHECK_PARAM(PARAM_TIM_INT_TYPE(IntFlag));
- temp = (TIMx->IR) & (1<<(4+IntFlag));
- if(temp)
- return SET;
- return RESET;
-}
-/*********************************************************************//**
- * @brief Clear Interrupt pending
- * @param[in] TIMx Timer selection, should be:
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * @param[in] IntFlag: interrupt type, should be:
- * - TIM_MR0_INT: Interrupt for Match channel 0
- * - TIM_MR1_INT: Interrupt for Match channel 1
- * - TIM_MR2_INT: Interrupt for Match channel 2
- * - TIM_MR3_INT: Interrupt for Match channel 3
- * - TIM_CR0_INT: Interrupt for Capture channel 0
- * - TIM_CR1_INT: Interrupt for Capture channel 1
- * @return None
- **********************************************************************/
-void TIM_ClearIntPending(LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag)
-{
- CHECK_PARAM(PARAM_TIMx(TIMx));
- CHECK_PARAM(PARAM_TIM_INT_TYPE(IntFlag));
- TIMx->IR = TIM_IR_CLR(IntFlag);
-}
-
-/*********************************************************************//**
- * @brief Clear Capture Interrupt pending
- * @param[in] TIMx Timer selection, should be
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * @param[in] IntFlag interrupt type, should be:
- * - TIM_MR0_INT: Interrupt for Match channel 0
- * - TIM_MR1_INT: Interrupt for Match channel 1
- * - TIM_MR2_INT: Interrupt for Match channel 2
- * - TIM_MR3_INT: Interrupt for Match channel 3
- * - TIM_CR0_INT: Interrupt for Capture channel 0
- * - TIM_CR1_INT: Interrupt for Capture channel 1
- * @return None
- **********************************************************************/
-void TIM_ClearIntCapturePending(LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag)
-{
- CHECK_PARAM(PARAM_TIMx(TIMx));
- CHECK_PARAM(PARAM_TIM_INT_TYPE(IntFlag));
- TIMx->IR = (1<<(4+IntFlag));
-}
-
-/*********************************************************************//**
- * @brief Configuration for Timer at initial time
- * @param[in] TimerCounterMode timer counter mode, should be:
- * - TIM_TIMER_MODE: Timer mode
- * - TIM_COUNTER_RISING_MODE: Counter rising mode
- * - TIM_COUNTER_FALLING_MODE: Counter falling mode
- * - TIM_COUNTER_ANY_MODE:Counter on both edges
- * @param[in] TIM_ConfigStruct pointer to TIM_TIMERCFG_Type or
- * TIM_COUNTERCFG_Type
- * @return None
- **********************************************************************/
-void TIM_ConfigStructInit(TIM_MODE_OPT TimerCounterMode, void *TIM_ConfigStruct)
-{
- if (TimerCounterMode == TIM_TIMER_MODE )
- {
- TIM_TIMERCFG_Type * pTimeCfg = (TIM_TIMERCFG_Type *)TIM_ConfigStruct;
- pTimeCfg->PrescaleOption = TIM_PRESCALE_USVAL;
- pTimeCfg->PrescaleValue = 1;
- }
- else
- {
- TIM_COUNTERCFG_Type * pCounterCfg = (TIM_COUNTERCFG_Type *)TIM_ConfigStruct;
- pCounterCfg->CountInputSelect = TIM_COUNTER_INCAP0;
- }
-}
-
-/*********************************************************************//**
- * @brief Initial Timer/Counter device
- * Set Clock frequency for Timer
- * Set initial configuration for Timer
- * @param[in] TIMx Timer selection, should be:
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * @param[in] TimerCounterMode Timer counter mode, should be:
- * - TIM_TIMER_MODE: Timer mode
- * - TIM_COUNTER_RISING_MODE: Counter rising mode
- * - TIM_COUNTER_FALLING_MODE: Counter falling mode
- * - TIM_COUNTER_ANY_MODE:Counter on both edges
- * @param[in] TIM_ConfigStruct pointer to TIM_TIMERCFG_Type
- * that contains the configuration information for the
- * specified Timer peripheral.
- * @return None
- **********************************************************************/
-void TIM_Init(LPC_TIM_TypeDef *TIMx, TIM_MODE_OPT TimerCounterMode, void *TIM_ConfigStruct)
-{
- TIM_TIMERCFG_Type *pTimeCfg;
- TIM_COUNTERCFG_Type *pCounterCfg;
-
- CHECK_PARAM(PARAM_TIMx(TIMx));
- CHECK_PARAM(PARAM_TIM_MODE_OPT(TimerCounterMode));
-
- //set power
-
- if (TIMx== LPC_TIM0)
- {
- CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCTIM0, ENABLE);
- //PCLK_Timer0 = CCLK/4
- CLKPWR_SetPCLKDiv (CLKPWR_PCLKSEL_TIMER0, CLKPWR_PCLKSEL_CCLK_DIV_4);
- }
- else if (TIMx== LPC_TIM1)
- {
- CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCTIM1, ENABLE);
- //PCLK_Timer1 = CCLK/4
- CLKPWR_SetPCLKDiv (CLKPWR_PCLKSEL_TIMER1, CLKPWR_PCLKSEL_CCLK_DIV_4);
-
- }
-
- else if (TIMx== LPC_TIM2)
- {
- CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCTIM2, ENABLE);
- //PCLK_Timer2= CCLK/4
- CLKPWR_SetPCLKDiv (CLKPWR_PCLKSEL_TIMER2, CLKPWR_PCLKSEL_CCLK_DIV_4);
- }
- else if (TIMx== LPC_TIM3)
- {
- CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCTIM3, ENABLE);
- //PCLK_Timer3= CCLK/4
- CLKPWR_SetPCLKDiv (CLKPWR_PCLKSEL_TIMER3, CLKPWR_PCLKSEL_CCLK_DIV_4);
-
- }
-
- TIMx->CCR &= ~TIM_CTCR_MODE_MASK;
- TIMx->CCR |= TIM_TIMER_MODE;
-
- TIMx->TC =0;
- TIMx->PC =0;
- TIMx->PR =0;
- TIMx->TCR |= (1<<1); //Reset Counter
- TIMx->TCR &= ~(1<<1); //release reset
- if (TimerCounterMode == TIM_TIMER_MODE )
- {
- pTimeCfg = (TIM_TIMERCFG_Type *)TIM_ConfigStruct;
- if (pTimeCfg->PrescaleOption == TIM_PRESCALE_TICKVAL)
- {
- TIMx->PR = pTimeCfg->PrescaleValue -1 ;
- }
- else
- {
- TIMx->PR = converUSecToVal (converPtrToTimeNum(TIMx),pTimeCfg->PrescaleValue)-1;
- }
- }
- else
- {
-
- pCounterCfg = (TIM_COUNTERCFG_Type *)TIM_ConfigStruct;
- TIMx->CCR &= ~TIM_CTCR_INPUT_MASK;
- if (pCounterCfg->CountInputSelect == TIM_COUNTER_INCAP1)
- TIMx->CCR |= _BIT(2);
- }
-
- // Clear interrupt pending
- TIMx->IR = 0xFFFFFFFF;
-
-}
-
-/*********************************************************************//**
- * @brief Close Timer/Counter device
- * @param[in] TIMx Pointer to timer device, should be:
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * @return None
- **********************************************************************/
-void TIM_DeInit (LPC_TIM_TypeDef *TIMx)
-{
- CHECK_PARAM(PARAM_TIMx(TIMx));
- // Disable timer/counter
- TIMx->TCR = 0x00;
-
- // Disable power
- if (TIMx== LPC_TIM0)
- CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCTIM0, DISABLE);
-
- else if (TIMx== LPC_TIM1)
- CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCTIM1, DISABLE);
-
- else if (TIMx== LPC_TIM2)
- CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCTIM2, DISABLE);
-
- else if (TIMx== LPC_TIM3)
- CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCTIM2, DISABLE);
-
-}
-
-/*********************************************************************//**
- * @brief Start/Stop Timer/Counter device
- * @param[in] TIMx Pointer to timer device, should be:
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * @param[in] NewState
- * - ENABLE : set timer enable
- * - DISABLE : disable timer
- * @return None
- **********************************************************************/
-void TIM_Cmd(LPC_TIM_TypeDef *TIMx, FunctionalState NewState)
-{
- CHECK_PARAM(PARAM_TIMx(TIMx));
- if (NewState == ENABLE)
- {
- TIMx->TCR |= TIM_ENABLE;
- }
- else
- {
- TIMx->TCR &= ~TIM_ENABLE;
- }
-}
-
-/*********************************************************************//**
- * @brief Reset Timer/Counter device,
- * Make TC and PC are synchronously reset on the next
- * positive edge of PCLK
- * @param[in] TIMx Pointer to timer device, should be:
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * @return None
- **********************************************************************/
-void TIM_ResetCounter(LPC_TIM_TypeDef *TIMx)
-{
- CHECK_PARAM(PARAM_TIMx(TIMx));
- TIMx->TCR |= TIM_RESET;
- TIMx->TCR &= ~TIM_RESET;
-}
-
-/*********************************************************************//**
- * @brief Configuration for Match register
- * @param[in] TIMx Pointer to timer device, should be:
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * @param[in] TIM_MatchConfigStruct Pointer to TIM_MATCHCFG_Type
- * - MatchChannel : choose channel 0 or 1
- * - IntOnMatch : if SET, interrupt will be generated when MRxx match
- * the value in TC
- * - StopOnMatch : if SET, TC and PC will be stopped whenM Rxx match
- * the value in TC
- * - ResetOnMatch : if SET, Reset on MR0 when MRxx match
- * the value in TC
- * -ExtMatchOutputType: Select output for external match
- * + 0: Do nothing for external output pin if match
- * + 1: Force external output pin to low if match
- * + 2: Force external output pin to high if match
- * + 3: Toggle external output pin if match
- * MatchValue: Set the value to be compared with TC value
- * @return None
- **********************************************************************/
-void TIM_ConfigMatch(LPC_TIM_TypeDef *TIMx, TIM_MATCHCFG_Type *TIM_MatchConfigStruct)
-{
-
- CHECK_PARAM(PARAM_TIMx(TIMx));
- CHECK_PARAM(PARAM_TIM_EXTMATCH_OPT(TIM_MatchConfigStruct->ExtMatchOutputType));
-
- switch(TIM_MatchConfigStruct->MatchChannel)
- {
- case 0:
- TIMx->MR0 = TIM_MatchConfigStruct->MatchValue;
- break;
- case 1:
- TIMx->MR1 = TIM_MatchConfigStruct->MatchValue;
- break;
- case 2:
- TIMx->MR2 = TIM_MatchConfigStruct->MatchValue;
- break;
- case 3:
- TIMx->MR3 = TIM_MatchConfigStruct->MatchValue;
- break;
- default:
- //Error match value
- //Error loop
- while(1);
- }
- //interrupt on MRn
- TIMx->MCR &=~TIM_MCR_CHANNEL_MASKBIT(TIM_MatchConfigStruct->MatchChannel);
-
- if (TIM_MatchConfigStruct->IntOnMatch)
- TIMx->MCR |= TIM_INT_ON_MATCH(TIM_MatchConfigStruct->MatchChannel);
-
- //reset on MRn
- if (TIM_MatchConfigStruct->ResetOnMatch)
- TIMx->MCR |= TIM_RESET_ON_MATCH(TIM_MatchConfigStruct->MatchChannel);
-
- //stop on MRn
- if (TIM_MatchConfigStruct->StopOnMatch)
- TIMx->MCR |= TIM_STOP_ON_MATCH(TIM_MatchConfigStruct->MatchChannel);
-
- // match output type
-
- TIMx->EMR &= ~TIM_EM_MASK(TIM_MatchConfigStruct->MatchChannel);
- TIMx->EMR |= TIM_EM_SET(TIM_MatchConfigStruct->MatchChannel,TIM_MatchConfigStruct->ExtMatchOutputType);
-}
-/*********************************************************************//**
- * @brief Update Match value
- * @param[in] TIMx Pointer to timer device, should be:
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * @param[in] MatchChannel Match channel, should be: 0..3
- * @param[in] MatchValue updated match value
- * @return None
- **********************************************************************/
-void TIM_UpdateMatchValue(LPC_TIM_TypeDef *TIMx,uint8_t MatchChannel, uint32_t MatchValue)
-{
- CHECK_PARAM(PARAM_TIMx(TIMx));
- switch(MatchChannel)
- {
- case 0:
- TIMx->MR0 = MatchValue;
- break;
- case 1:
- TIMx->MR1 = MatchValue;
- break;
- case 2:
- TIMx->MR2 = MatchValue;
- break;
- case 3:
- TIMx->MR3 = MatchValue;
- break;
- default:
- //Error Loop
- while(1);
- }
-
-}
-/*********************************************************************//**
- * @brief Configuration for Capture register
- * @param[in] TIMx Pointer to timer device, should be:
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * - CaptureChannel: set the channel to capture data
- * - RisingEdge : if SET, Capture at rising edge
- * - FallingEdge : if SET, Capture at falling edge
- * - IntOnCaption : if SET, Capture generate interrupt
- * @param[in] TIM_CaptureConfigStruct Pointer to TIM_CAPTURECFG_Type
- * @return None
- **********************************************************************/
-void TIM_ConfigCapture(LPC_TIM_TypeDef *TIMx, TIM_CAPTURECFG_Type *TIM_CaptureConfigStruct)
-{
-
- CHECK_PARAM(PARAM_TIMx(TIMx));
- TIMx->CCR &= ~TIM_CCR_CHANNEL_MASKBIT(TIM_CaptureConfigStruct->CaptureChannel);
-
- if (TIM_CaptureConfigStruct->RisingEdge)
- TIMx->CCR |= TIM_CAP_RISING(TIM_CaptureConfigStruct->CaptureChannel);
-
- if (TIM_CaptureConfigStruct->FallingEdge)
- TIMx->CCR |= TIM_CAP_FALLING(TIM_CaptureConfigStruct->CaptureChannel);
-
- if (TIM_CaptureConfigStruct->IntOnCaption)
- TIMx->CCR |= TIM_INT_ON_CAP(TIM_CaptureConfigStruct->CaptureChannel);
-}
-
-/*********************************************************************//**
- * @brief Read value of capture register in timer/counter device
- * @param[in] TIMx Pointer to timer/counter device, should be:
- * - LPC_TIM0: TIMER0 peripheral
- * - LPC_TIM1: TIMER1 peripheral
- * - LPC_TIM2: TIMER2 peripheral
- * - LPC_TIM3: TIMER3 peripheral
- * @param[in] CaptureChannel: capture channel number, should be:
- * - TIM_COUNTER_INCAP0: CAPn.0 input pin for TIMERn
- * - TIM_COUNTER_INCAP1: CAPn.1 input pin for TIMERn
- * @return Value of capture register
- **********************************************************************/
-uint32_t TIM_GetCaptureValue(LPC_TIM_TypeDef *TIMx, TIM_COUNTER_INPUT_OPT CaptureChannel)
-{
- CHECK_PARAM(PARAM_TIMx(TIMx));
- CHECK_PARAM(PARAM_TIM_COUNTER_INPUT_OPT(CaptureChannel));
-
- if(CaptureChannel==0)
- return TIMx->CR0;
- else
- return TIMx->CR1;
-}
-
-/**
- * @}
- */
-
-#endif /* _TIMER */
-
-/**
- * @}
- */
-
-/* --------------------------------- End Of File ------------------------------ */
diff --git a/platforms_startup/armcc/LPC1768/lpc17xx_timer.h b/platforms_startup/armcc/LPC1768/lpc17xx_timer.h
deleted file mode 100644
index 314610bc4..000000000
--- a/platforms_startup/armcc/LPC1768/lpc17xx_timer.h
+++ /dev/null
@@ -1,348 +0,0 @@
-/**********************************************************************
-* $Id$ lpc17xx_timer.h 2010-05-21
-*//**
-* @file lpc17xx_timer.h
-* @brief Contains all macro definitions and function prototypes
-* support for Timer firmware library on LPC17xx
-* @version 2.0
-* @date 21. May. 2010
-* @author NXP MCU SW Application Team
-*
-* Copyright(C) 2010, NXP Semiconductor
-* All rights reserved.
-*
-***********************************************************************
-* Software that is described herein is for illustrative purposes only
-* which provides customers with programming information regarding the
-* products. This software is supplied "AS IS" without any warranties.
-* NXP Semiconductors assumes no responsibility or liability for the
-* use of the software, conveys no license or title under any patent,
-* copyright, or mask work right to the product. NXP Semiconductors
-* reserves the right to make changes in the software without
-* notification. NXP Semiconductors also make no representation or
-* warranty that such application will be suitable for the specified
-* use without further testing or modification.
-* Permission to use, copy, modify, and distribute this software and its
-* documentation is hereby granted, under NXP Semiconductors'
-* relevant copyright in the software, without fee, provided that it
-* is used in conjunction with NXP Semiconductors microcontrollers. This
-* copyright, permission, and disclaimer notice must appear in all copies of
-* this code.
-**********************************************************************/
-
-/* Peripheral group ----------------------------------------------------------- */
-/** @defgroup TIM TIM (Timer)
- * @ingroup LPC1700CMSIS_FwLib_Drivers
- * @{
- */
-
-#ifndef __LPC17XX_TIMER_H_
-#define __LPC17XX_TIMER_H_
-
-/* Includes ------------------------------------------------------------------- */
-#include "LPC17xx.h"
-#include "lpc_types.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/* Private Macros ------------------------------------------------------------- */
-/** @defgroup TIM_Private_Macros TIM Private Macros
- * @{
- */
-
-/* --------------------- BIT DEFINITIONS -------------------------------------- */
-/**********************************************************************
-** Interrupt information
-**********************************************************************/
-/** Macro to clean interrupt pending */
-#define TIM_IR_CLR(n) _BIT(n)
-
-/**********************************************************************
-** Timer interrupt register definitions
-**********************************************************************/
-/** Macro for getting a timer match interrupt bit */
-#define TIM_MATCH_INT(n) (_BIT(n & 0x0F))
-/** Macro for getting a capture event interrupt bit */
-#define TIM_CAP_INT(n) (_BIT(((n & 0x0F) + 4)))
-
-/**********************************************************************
-* Timer control register definitions
-**********************************************************************/
-/** Timer/counter enable bit */
-#define TIM_ENABLE ((uint32_t)(1<<0))
-/** Timer/counter reset bit */
-#define TIM_RESET ((uint32_t)(1<<1))
-/** Timer control bit mask */
-#define TIM_TCR_MASKBIT ((uint32_t)(3))
-
-/**********************************************************************
-* Timer match control register definitions
-**********************************************************************/
-/** Bit location for interrupt on MRx match, n = 0 to 3 */
-#define TIM_INT_ON_MATCH(n) (_BIT((n * 3)))
-/** Bit location for reset on MRx match, n = 0 to 3 */
-#define TIM_RESET_ON_MATCH(n) (_BIT(((n * 3) + 1)))
-/** Bit location for stop on MRx match, n = 0 to 3 */
-#define TIM_STOP_ON_MATCH(n) (_BIT(((n * 3) + 2)))
-/** Timer Match control bit mask */
-#define TIM_MCR_MASKBIT ((uint32_t)(0x0FFF))
-/** Timer Match control bit mask for specific channel*/
-#define TIM_MCR_CHANNEL_MASKBIT(n) ((uint32_t)(7<<(n*3)))
-
-/**********************************************************************
-* Timer capture control register definitions
-**********************************************************************/
-/** Bit location for CAP.n on CRx rising edge, n = 0 to 3 */
-#define TIM_CAP_RISING(n) (_BIT((n * 3)))
-/** Bit location for CAP.n on CRx falling edge, n = 0 to 3 */
-#define TIM_CAP_FALLING(n) (_BIT(((n * 3) + 1)))
-/** Bit location for CAP.n on CRx interrupt enable, n = 0 to 3 */
-#define TIM_INT_ON_CAP(n) (_BIT(((n * 3) + 2)))
-/** Mask bit for rising and falling edge bit */
-#define TIM_EDGE_MASK(n) (_SBF((n * 3), 0x03))
-/** Timer capture control bit mask */
-#define TIM_CCR_MASKBIT ((uint32_t)(0x3F))
-/** Timer Capture control bit mask for specific channel*/
-#define TIM_CCR_CHANNEL_MASKBIT(n) ((uint32_t)(7<<(n*3)))
-
-/**********************************************************************
-* Timer external match register definitions
-**********************************************************************/
-/** Bit location for output state change of MAT.n when external match
- happens, n = 0 to 3 */
-#define TIM_EM(n) _BIT(n)
-/** Output state change of MAT.n when external match happens: no change */
-#define TIM_EM_NOTHING ((uint8_t)(0x0))
-/** Output state change of MAT.n when external match happens: low */
-#define TIM_EM_LOW ((uint8_t)(0x1))
-/** Output state change of MAT.n when external match happens: high */
-#define TIM_EM_HIGH ((uint8_t)(0x2))
-/** Output state change of MAT.n when external match happens: toggle */
-#define TIM_EM_TOGGLE ((uint8_t)(0x3))
-/** Macro for setting for the MAT.n change state bits */
-#define TIM_EM_SET(n,s) (_SBF(((n << 1) + 4), (s & 0x03)))
-/** Mask for the MAT.n change state bits */
-#define TIM_EM_MASK(n) (_SBF(((n << 1) + 4), 0x03))
-/** Timer external match bit mask */
-#define TIM_EMR_MASKBIT 0x0FFF
-
-/**********************************************************************
-* Timer Count Control Register definitions
-**********************************************************************/
-/** Mask to get the Counter/timer mode bits */
-#define TIM_CTCR_MODE_MASK 0x3
-/** Mask to get the count input select bits */
-#define TIM_CTCR_INPUT_MASK 0xC
-/** Timer Count control bit mask */
-#define TIM_CTCR_MASKBIT 0xF
-#define TIM_COUNTER_MODE ((uint8_t)(1))
-
-
-/* ---------------- CHECK PARAMETER DEFINITIONS ---------------------------- */
-/** Macro to determine if it is valid TIMER peripheral */
-#define PARAM_TIMx(n) ((((uint32_t *)n)==((uint32_t *)LPC_TIM0)) || (((uint32_t *)n)==((uint32_t *)LPC_TIM1)) \
-|| (((uint32_t *)n)==((uint32_t *)LPC_TIM2)) || (((uint32_t *)n)==((uint32_t *)LPC_TIM3)))
-
-/* Macro check interrupt type */
-#define PARAM_TIM_INT_TYPE(TYPE) ((TYPE ==TIM_MR0_INT)||(TYPE ==TIM_MR1_INT)\
-||(TYPE ==TIM_MR2_INT)||(TYPE ==TIM_MR3_INT)\
-||(TYPE ==TIM_CR0_INT)||(TYPE ==TIM_CR1_INT))
-
-/* Macro check TIMER mode */
-#define PARAM_TIM_MODE_OPT(MODE) ((MODE == TIM_TIMER_MODE)||(MODE == TIM_COUNTER_RISING_MODE)\
-|| (MODE == TIM_COUNTER_RISING_MODE)||(MODE == TIM_COUNTER_RISING_MODE))
-
-/* Macro check TIMER prescale value */
-#define PARAM_TIM_PRESCALE_OPT(OPT) ((OPT == TIM_PRESCALE_TICKVAL)||(OPT == TIM_PRESCALE_USVAL))
-
-/* Macro check TIMER counter intput mode */
-#define PARAM_TIM_COUNTER_INPUT_OPT(OPT) ((OPT == TIM_COUNTER_INCAP0)||(OPT == TIM_COUNTER_INCAP1))
-
-/* Macro check TIMER external match mode */
-#define PARAM_TIM_EXTMATCH_OPT(OPT) ((OPT == TIM_EXTMATCH_NOTHING)||(OPT == TIM_EXTMATCH_LOW)\
-||(OPT == TIM_EXTMATCH_HIGH)||(OPT == TIM_EXTMATCH_TOGGLE))
-
-/* Macro check TIMER external match mode */
-#define PARAM_TIM_CAP_MODE_OPT(OPT) ((OPT == TIM_CAPTURE_NONE)||(OPT == TIM_CAPTURE_RISING) \
-||(OPT == TIM_CAPTURE_FALLING)||(OPT == TIM_CAPTURE_ANY))
-
-/**
- * @}
- */
-
-
-/* Public Types --------------------------------------------------------------- */
-/** @defgroup TIM_Public_Types TIM Public Types
- * @{
- */
-
-/***********************************************************************
- * Timer device enumeration
-**********************************************************************/
-/** @brief interrupt type */
-typedef enum
-{
- TIM_MR0_INT =0, /*!< interrupt for Match channel 0*/
- TIM_MR1_INT =1, /*!< interrupt for Match channel 1*/
- TIM_MR2_INT =2, /*!< interrupt for Match channel 2*/
- TIM_MR3_INT =3, /*!< interrupt for Match channel 3*/
- TIM_CR0_INT =4, /*!< interrupt for Capture channel 0*/
- TIM_CR1_INT =5 /*!< interrupt for Capture channel 1*/
-}TIM_INT_TYPE;
-
-/** @brief Timer/counter operating mode */
-typedef enum
-{
- TIM_TIMER_MODE = 0, /*!< Timer mode */
- TIM_COUNTER_RISING_MODE, /*!< Counter rising mode */
- TIM_COUNTER_FALLING_MODE, /*!< Counter falling mode */
- TIM_COUNTER_ANY_MODE /*!< Counter on both edges */
-} TIM_MODE_OPT;
-
-/** @brief Timer/Counter prescale option */
-typedef enum
-{
- TIM_PRESCALE_TICKVAL = 0, /*!< Prescale in absolute value */
- TIM_PRESCALE_USVAL /*!< Prescale in microsecond value */
-} TIM_PRESCALE_OPT;
-
-/** @brief Counter input option */
-typedef enum
-{
- TIM_COUNTER_INCAP0 = 0, /*!< CAPn.0 input pin for TIMERn */
- TIM_COUNTER_INCAP1, /*!< CAPn.1 input pin for TIMERn */
-} TIM_COUNTER_INPUT_OPT;
-
-/** @brief Timer/Counter external match option */
-typedef enum
-{
- TIM_EXTMATCH_NOTHING = 0, /*!< Do nothing for external output pin if match */
- TIM_EXTMATCH_LOW, /*!< Force external output pin to low if match */
- TIM_EXTMATCH_HIGH, /*!< Force external output pin to high if match */
- TIM_EXTMATCH_TOGGLE /*!< Toggle external output pin if match */
-}TIM_EXTMATCH_OPT;
-
-/** @brief Timer/counter capture mode options */
-typedef enum {
- TIM_CAPTURE_NONE = 0, /*!< No Capture */
- TIM_CAPTURE_RISING, /*!< Rising capture mode */
- TIM_CAPTURE_FALLING, /*!< Falling capture mode */
- TIM_CAPTURE_ANY /*!< On both edges */
-} TIM_CAP_MODE_OPT;
-
-/** @brief Configuration structure in TIMER mode */
-typedef struct
-{
-
- uint8_t PrescaleOption; /**< Timer Prescale option, should be:
- - TIM_PRESCALE_TICKVAL: Prescale in absolute value
- - TIM_PRESCALE_USVAL: Prescale in microsecond value
- */
- uint8_t Reserved[3]; /**< Reserved */
- uint32_t PrescaleValue; /**< Prescale value */
-} TIM_TIMERCFG_Type;
-
-/** @brief Configuration structure in COUNTER mode */
-typedef struct {
-
- uint8_t CounterOption; /**< Counter Option, should be:
- - TIM_COUNTER_INCAP0: CAPn.0 input pin for TIMERn
- - TIM_COUNTER_INCAP1: CAPn.1 input pin for TIMERn
- */
- uint8_t CountInputSelect;
- uint8_t Reserved[2];
-} TIM_COUNTERCFG_Type;
-
-/** @brief Match channel configuration structure */
-typedef struct {
- uint8_t MatchChannel; /**< Match channel, should be in range
- from 0..3 */
- uint8_t IntOnMatch; /**< Interrupt On match, should be:
- - ENABLE: Enable this function.
- - DISABLE: Disable this function.
- */
- uint8_t StopOnMatch; /**< Stop On match, should be:
- - ENABLE: Enable this function.
- - DISABLE: Disable this function.
- */
- uint8_t ResetOnMatch; /**< Reset On match, should be:
- - ENABLE: Enable this function.
- - DISABLE: Disable this function.
- */
-
- uint8_t ExtMatchOutputType; /**< External Match Output type, should be:
- - TIM_EXTMATCH_NOTHING: Do nothing for external output pin if match
- - TIM_EXTMATCH_LOW: Force external output pin to low if match
- - TIM_EXTMATCH_HIGH: Force external output pin to high if match
- - TIM_EXTMATCH_TOGGLE: Toggle external output pin if match.
- */
- uint8_t Reserved[3]; /** Reserved */
- uint32_t MatchValue; /** Match value */
-} TIM_MATCHCFG_Type;
-
-/** @brief Capture Input configuration structure */
-typedef struct {
- uint8_t CaptureChannel; /**< Capture channel, should be in range
- from 0..1 */
- uint8_t RisingEdge; /**< caption rising edge, should be:
- - ENABLE: Enable rising edge.
- - DISABLE: Disable this function.
- */
- uint8_t FallingEdge; /**< caption falling edge, should be:
- - ENABLE: Enable falling edge.
- - DISABLE: Disable this function.
- */
- uint8_t IntOnCaption; /**< Interrupt On caption, should be:
- - ENABLE: Enable interrupt function.
- - DISABLE: Disable this function.
- */
-
-} TIM_CAPTURECFG_Type;
-
-/**
- * @}
- */
-
-
-/* Public Functions ----------------------------------------------------------- */
-/** @defgroup TIM_Public_Functions TIM Public Functions
- * @{
- */
-/* Init/DeInit TIM functions -----------*/
-void TIM_Init(LPC_TIM_TypeDef *TIMx, TIM_MODE_OPT TimerCounterMode, void *TIM_ConfigStruct);
-void TIM_DeInit(LPC_TIM_TypeDef *TIMx);
-
-/* TIM interrupt functions -------------*/
-void TIM_ClearIntPending(LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag);
-void TIM_ClearIntCapturePending(LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag);
-FlagStatus TIM_GetIntStatus(LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag);
-FlagStatus TIM_GetIntCaptureStatus(LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag);
-
-/* TIM configuration functions --------*/
-void TIM_ConfigStructInit(TIM_MODE_OPT TimerCounterMode, void *TIM_ConfigStruct);
-void TIM_ConfigMatch(LPC_TIM_TypeDef *TIMx, TIM_MATCHCFG_Type *TIM_MatchConfigStruct);
-void TIM_UpdateMatchValue(LPC_TIM_TypeDef *TIMx,uint8_t MatchChannel, uint32_t MatchValue);
-void TIM_SetMatchExt(LPC_TIM_TypeDef *TIMx,TIM_EXTMATCH_OPT ext_match );
-void TIM_ConfigCapture(LPC_TIM_TypeDef *TIMx, TIM_CAPTURECFG_Type *TIM_CaptureConfigStruct);
-void TIM_Cmd(LPC_TIM_TypeDef *TIMx, FunctionalState NewState);
-
-uint32_t TIM_GetCaptureValue(LPC_TIM_TypeDef *TIMx, TIM_COUNTER_INPUT_OPT CaptureChannel);
-void TIM_ResetCounter(LPC_TIM_TypeDef *TIMx);
-
-/**
- * @}
- */
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LPC17XX_TIMER_H_ */
-
-/**
- * @}
- */
-
-/* --------------------------------- End Of File ------------------------------ */
diff --git a/platforms_startup/armcc/LPC1768/lpc_types.h b/platforms_startup/armcc/LPC1768/lpc_types.h
deleted file mode 100644
index a67229664..000000000
--- a/platforms_startup/armcc/LPC1768/lpc_types.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/**********************************************************************
-* $Id$ lpc_types.h 2008-07-27
-*//**
-* @file lpc_types.h
-* @brief Contains the NXP ABL typedefs for C standard types.
-* It is intended to be used in ISO C conforming development
-* environments and checks for this insofar as it is possible
-* to do so.
-* @version 2.0
-* @date 27 July. 2008
-* @author NXP MCU SW Application Team
-*
-* Copyright(C) 2008, NXP Semiconductor
-* All rights reserved.
-*
-***********************************************************************
-* Software that is described herein is for illustrative purposes only
-* which provides customers with programming information regarding the
-* products. This software is supplied "AS IS" without any warranties.
-* NXP Semiconductors assumes no responsibility or liability for the
-* use of the software, conveys no license or title under any patent,
-* copyright, or mask work right to the product. NXP Semiconductors
-* reserves the right to make changes in the software without
-* notification. NXP Semiconductors also make no representation or
-* warranty that such application will be suitable for the specified
-* use without further testing or modification.
-* Permission to use, copy, modify, and distribute this software and its
-* documentation is hereby granted, under NXP Semiconductors'
-* relevant copyright in the software, without fee, provided that it
-* is used in conjunction with NXP Semiconductors microcontrollers. This
-* copyright, permission, and disclaimer notice must appear in all copies of
-* this code.
-**********************************************************************/
-
-/* Type group ----------------------------------------------------------- */
-/** @defgroup LPC_Types LPC_Types
- * @ingroup LPC1700CMSIS_FwLib_Drivers
- * @{
- */
-
-#ifndef LPC_TYPES_H
-#define LPC_TYPES_H
-
-/* Includes ------------------------------------------------------------------- */
-#include
-
-
-/* Public Types --------------------------------------------------------------- */
-/** @defgroup LPC_Types_Public_Types LPC_Types Public Types
- * @{
- */
-
-/**
- * @brief Boolean Type definition
- */
-typedef enum {FALSE = 0, TRUE = !FALSE} Bool;
-
-/**
- * @brief Flag Status and Interrupt Flag Status type definition
- */
-typedef enum {RESET = 0, SET = !RESET} FlagStatus, IntStatus, SetState;
-#define PARAM_SETSTATE(State) ((State==RESET) || (State==SET))
-
-/**
- * @brief Functional State Definition
- */
-typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
-#define PARAM_FUNCTIONALSTATE(State) ((State==DISABLE) || (State==ENABLE))
-
-/**
- * @ Status type definition
- */
-typedef enum {ERROR = 0, SUCCESS = !ERROR} Status;
-
-
-/**
- * Read/Write transfer type mode (Block or non-block)
- */
-typedef enum
-{
- NONE_BLOCKING = 0, /**< None Blocking type */
- BLOCKING /**< Blocking type */
-} TRANSFER_BLOCK_Type;
-
-
-/** Pointer to Function returning Void (any number of parameters) */
-typedef void (*PFV)();
-
-/** Pointer to Function returning int32_t (any number of parameters) */
-typedef int32_t(*PFI)();
-
-/**
- * @}
- */
-
-
-/* Public Macros -------------------------------------------------------------- */
-/** @defgroup LPC_Types_Public_Macros LPC_Types Public Macros
- * @{
- */
-
-/* _BIT(n) sets the bit at position "n"
- * _BIT(n) is intended to be used in "OR" and "AND" expressions:
- * e.g., "(_BIT(3) | _BIT(7))".
- */
-#undef _BIT
-/* Set bit macro */
-#define _BIT(n) (1< = (any_expression) & _BITMASK(x), where 0 < x <= 32.
- * If "any_expression" results in a value that is larger than can be
- * contained in 'x' bits, the bits above 'x - 1' are masked off. When
- * used with the _SBF example above, the example would be written:
- * a_reg = ((_SBF(5,7) | _SBF(12,0xF)) & _BITMASK(16))
- * This ensures that the value written to a_reg is no wider than
- * 16 bits, and makes the code easier to read and understand.
- */
-#undef _BITMASK
-/* Bitmask creation macro */
-#define _BITMASK(field_width) ( _BIT(field_width) - 1)
-
-/* NULL pointer */
-#ifndef NULL
-#define NULL ((void*) 0)
-#endif
-
-/* Number of elements in an array */
-#define NELEMENTS(array) (sizeof (array) / sizeof (array[0]))
-
-/* Static data/function define */
-#define STATIC static
-/* External data/function define */
-#define EXTERN extern
-
-#if !defined(MAX)
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif
-#if !defined(MIN)
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
-
-/**
- * @}
- */
-
-
-/* Old Type Definition compatibility ------------------------------------------ */
-/** @addtogroup LPC_Types_Public_Types LPC_Types Public Types
- * @{
- */
-
-/** SMA type for character type */
-typedef char CHAR;
-
-/** SMA type for 8 bit unsigned value */
-typedef uint8_t UNS_8;
-
-/** SMA type for 8 bit signed value */
-typedef int8_t INT_8;
-
-/** SMA type for 16 bit unsigned value */
-typedef uint16_t UNS_16;
-
-/** SMA type for 16 bit signed value */
-typedef int16_t INT_16;
-
-/** SMA type for 32 bit unsigned value */
-typedef uint32_t UNS_32;
-
-/** SMA type for 32 bit signed value */
-typedef int32_t INT_32;
-
-/** SMA type for 64 bit signed value */
-typedef int64_t INT_64;
-
-/** SMA type for 64 bit unsigned value */
-typedef uint64_t UNS_64;
-
-/** 32 bit boolean type */
-typedef Bool BOOL_32;
-
-/** 16 bit boolean type */
-typedef Bool BOOL_16;
-
-/** 8 bit boolean type */
-typedef Bool BOOL_8;
-
-/**
- * @}
- */
-
-
-#endif /* LPC_TYPES_H */
-
-/**
- * @}
- */
-
-/* --------------------------------- End Of File ------------------------------ */
diff --git a/platforms_startup/armcc/LPC1768/startup_LPC17xx.asm b/platforms_startup/armcc/LPC1768/startup_LPC17xx.asm
deleted file mode 100644
index c0a32bc01..000000000
--- a/platforms_startup/armcc/LPC1768/startup_LPC17xx.asm
+++ /dev/null
@@ -1,281 +0,0 @@
-;/*****************************************************************************
-; * @file: startup_LPC17xx.s
-; * @purpose: CMSIS Cortex-M3 Core Device Startup File
-; * for the NXP LPC17xx Device Series
-; * @version: V1.20
-; * @date: 07. October 2010
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2010 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M3
-; * processor based microcontrollers. This file can be freely distributed
-; * within development tools that are supporting such ARM based processors.
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-
-; Stack Configuration
-; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
-;
-
-Stack_Size EQU 0x00002000
-
- AREA STACK, NOINIT, READWRITE, ALIGN=3
-Stack_Mem SPACE Stack_Size
-__initial_sp
-
-
-; Heap Configuration
-; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
-;
-
-Heap_Size EQU 0x00006000
-
- AREA HEAP, NOINIT, READWRITE, ALIGN=3
-__heap_base
-Heap_Mem SPACE Heap_Size
-__heap_limit
-
-
- PRESERVE8
- THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
- AREA RESET, CODE, READONLY
- EXPORT __Vectors
-
-__Vectors DCD __initial_sp ; Top of Stack
- DCD Reset_Handler ; Reset Handler
- DCD NMI_Handler ; NMI Handler
- DCD HardFault_Handler ; Hard Fault Handler
- DCD MemManage_Handler ; MPU Fault Handler
- DCD BusFault_Handler ; Bus Fault Handler
- DCD UsageFault_Handler ; Usage Fault Handler
- DCD 0 ; Reserved
- DCD 0 ; Reserved
- DCD 0 ; Reserved
- DCD 0 ; Reserved
- DCD SVC_Handler ; SVCall Handler
- DCD DebugMon_Handler ; Debug Monitor Handler
- DCD 0 ; Reserved
- DCD PendSV_Handler ; PendSV Handler
- DCD SysTick_Handler ; SysTick Handler
-
-; External Interrupts
- DCD WDT_IRQHandler ; 16: Watchdog Timer
- DCD TIMER0_IRQHandler ; 17: Timer0
- DCD TIMER1_IRQHandler ; 18: Timer1
- DCD TIMER2_IRQHandler ; 19: Timer2
- DCD TIMER3_IRQHandler ; 20: Timer3
- DCD UART0_IRQHandler ; 21: UART0
- DCD UART1_IRQHandler ; 22: UART1
- DCD UART2_IRQHandler ; 23: UART2
- DCD UART3_IRQHandler ; 24: UART3
- DCD PWM1_IRQHandler ; 25: PWM1
- DCD I2C0_IRQHandler ; 26: I2C0
- DCD I2C1_IRQHandler ; 27: I2C1
- DCD I2C2_IRQHandler ; 28: I2C2
- DCD SPI_IRQHandler ; 29: SPI
- DCD SSP0_IRQHandler ; 30: SSP0
- DCD SSP1_IRQHandler ; 31: SSP1
- DCD PLL0_IRQHandler ; 32: PLL0 Lock (Main PLL)
- DCD RTC_IRQHandler ; 33: Real Time Clock
- DCD EINT0_IRQHandler ; 34: External Interrupt 0
- DCD EINT1_IRQHandler ; 35: External Interrupt 1
- DCD EINT2_IRQHandler ; 36: External Interrupt 2
- DCD EINT3_IRQHandler ; 37: External Interrupt 3
- DCD ADC_IRQHandler ; 38: A/D Converter
- DCD BOD_IRQHandler ; 39: Brown-Out Detect
- DCD USB_IRQHandler ; 40: USB
- DCD CAN_IRQHandler ; 41: CAN
- DCD DMA_IRQHandler ; 42: General Purpose DMA
- DCD I2S_IRQHandler ; 43: I2S
- DCD ENET_IRQHandler ; 44: Ethernet
- DCD RIT_IRQHandler ; 45: Repetitive Interrupt Timer
- DCD MCPWM_IRQHandler ; 46: Motor Control PWM
- DCD QEI_IRQHandler ; 47: Quadrature Encoder Interface
- DCD PLL1_IRQHandler ; 48: PLL1 Lock (USB PLL)
- DCD USBActivity_IRQHandler ; 49: USB Activity interrupt to wakeup
- DCD CANActivity_IRQHandler ; 50: CAN Activity interrupt to wakeup
-
-
- IF :LNOT::DEF:NO_CRP
- AREA |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key DCD 0xFFFFFFFF
- ENDIF
-
-
- AREA |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler PROC
- EXPORT Reset_Handler [WEAK]
- IMPORT SystemInit
- IMPORT __main
- LDR R0, =SystemInit
- BLX R0
- LDR R0, =__main
- BX R0
- ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-
-NMI_Handler PROC
- EXPORT NMI_Handler [WEAK]
- B .
- ENDP
-HardFault_Handler\
- PROC
- EXPORT HardFault_Handler [WEAK]
- B .
- ENDP
-MemManage_Handler\
- PROC
- EXPORT MemManage_Handler [WEAK]
- B .
- ENDP
-BusFault_Handler\
- PROC
- EXPORT BusFault_Handler [WEAK]
- B .
- ENDP
-UsageFault_Handler\
- PROC
- EXPORT UsageFault_Handler [WEAK]
- B .
- ENDP
-SVC_Handler PROC
- EXPORT SVC_Handler [WEAK]
- B .
- ENDP
-DebugMon_Handler\
- PROC
- EXPORT DebugMon_Handler [WEAK]
- B .
- ENDP
-PendSV_Handler PROC
- EXPORT PendSV_Handler [WEAK]
- B .
- ENDP
-SysTick_Handler PROC
- EXPORT SysTick_Handler [WEAK]
- B .
- ENDP
-
-Default_Handler PROC
-
- EXPORT WDT_IRQHandler [WEAK]
- EXPORT TIMER0_IRQHandler [WEAK]
- EXPORT TIMER1_IRQHandler [WEAK]
- EXPORT TIMER2_IRQHandler [WEAK]
- EXPORT TIMER3_IRQHandler [WEAK]
- EXPORT UART0_IRQHandler [WEAK]
- EXPORT UART1_IRQHandler [WEAK]
- EXPORT UART2_IRQHandler [WEAK]
- EXPORT UART3_IRQHandler [WEAK]
- EXPORT PWM1_IRQHandler [WEAK]
- EXPORT I2C0_IRQHandler [WEAK]
- EXPORT I2C1_IRQHandler [WEAK]
- EXPORT I2C2_IRQHandler [WEAK]
- EXPORT SPI_IRQHandler [WEAK]
- EXPORT SSP0_IRQHandler [WEAK]
- EXPORT SSP1_IRQHandler [WEAK]
- EXPORT PLL0_IRQHandler [WEAK]
- EXPORT RTC_IRQHandler [WEAK]
- EXPORT EINT0_IRQHandler [WEAK]
- EXPORT EINT1_IRQHandler [WEAK]
- EXPORT EINT2_IRQHandler [WEAK]
- EXPORT EINT3_IRQHandler [WEAK]
- EXPORT ADC_IRQHandler [WEAK]
- EXPORT BOD_IRQHandler [WEAK]
- EXPORT USB_IRQHandler [WEAK]
- EXPORT CAN_IRQHandler [WEAK]
- EXPORT DMA_IRQHandler [WEAK]
- EXPORT I2S_IRQHandler [WEAK]
- EXPORT ENET_IRQHandler [WEAK]
- EXPORT RIT_IRQHandler [WEAK]
- EXPORT MCPWM_IRQHandler [WEAK]
- EXPORT QEI_IRQHandler [WEAK]
- EXPORT PLL1_IRQHandler [WEAK]
- EXPORT USBActivity_IRQHandler [WEAK]
- EXPORT CANActivity_IRQHandler [WEAK]
-
-WDT_IRQHandler
-TIMER0_IRQHandler
-TIMER1_IRQHandler
-TIMER2_IRQHandler
-TIMER3_IRQHandler
-UART0_IRQHandler
-UART1_IRQHandler
-UART2_IRQHandler
-UART3_IRQHandler
-PWM1_IRQHandler
-I2C0_IRQHandler
-I2C1_IRQHandler
-I2C2_IRQHandler
-SPI_IRQHandler
-SSP0_IRQHandler
-SSP1_IRQHandler
-PLL0_IRQHandler
-RTC_IRQHandler
-EINT0_IRQHandler
-EINT1_IRQHandler
-EINT2_IRQHandler
-EINT3_IRQHandler
-ADC_IRQHandler
-BOD_IRQHandler
-USB_IRQHandler
-DMA_IRQHandler
-CAN_IRQHandler
-I2S_IRQHandler
-ENET_IRQHandler
-RIT_IRQHandler
-MCPWM_IRQHandler
-QEI_IRQHandler
-PLL1_IRQHandler
-USBActivity_IRQHandler
-CANActivity_IRQHandler
-
- B .
-
- ENDP
-
-
- ALIGN
-
-
-; User Initial Stack & Heap
-
- IF :DEF:__MICROLIB
-
- EXPORT __initial_sp
- EXPORT __heap_base
- EXPORT __heap_limit
-
- ELSE
-
- IMPORT __use_two_region_memory
- EXPORT __user_setup_stackheap
-__user_setup_stackheap
-
- LDR R0, = Heap_Mem
- LDR R2, = (Heap_Mem + Heap_Size)
- LDR SP, =(Stack_Mem + Stack_Size)
- BX LR
-
- ALIGN
-
- ENDIF
-
-
- END
diff --git a/platforms_startup/armcc/LPC1768/system_LPC17xx.c b/platforms_startup/armcc/LPC1768/system_LPC17xx.c
deleted file mode 100644
index 9a3447a50..000000000
--- a/platforms_startup/armcc/LPC1768/system_LPC17xx.c
+++ /dev/null
@@ -1,642 +0,0 @@
-/**************************************************************************//**
- * @file system_LPC17xx.c
- * @brief CMSIS Cortex-M3 Device System Source File for
- * NXP LPC17xx Device Series
- * @version V1.13
- * @date 18. April 2012
- *
- * @note
- * Copyright (C) 2009-2012 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M
- * processor based microcontrollers. This file can be freely distributed
- * within development tools that are supporting such ARM based processors.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#include
-#include "LPC17xx.h"
-
-/** @addtogroup LPC17xx_System
- * @{
- */
-
-/*
-//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-*/
-
-/*--------------------- Clock Configuration----------------
-//
-// Clock Configuration
-// System Controls and Status Register (SCS) with quartz 24 MHz
-// OSCRANGE: Main Oscillator Range Select
-// <0=> 1 MHz to 20 MHz
-// <1=> 15 MHz to 25 MHz
-// OSCEN: Main Oscillator Enable
-//
-//
-//
-// System Controls and Status Register (SCS) with quartz 12 MHz
-// OSCRANGE: Main Oscillator Range Select
-// <0=> 1 MHz to 20 MHz
-// <1=> 15 MHz to 25 MHz
-// OSCEN: Main Oscillator Enable
-//
-//
-
-// PLL0 Configuration (Main PLL)
-// PLL0 Configuration Register (PLL0CFG) with quartz 24 MHz
-// F_cco0 = (2 * M * F_in) / N
-// F_in must be in the range of 32 kHz to 50 MHz
-// F_cco0 must be in the range of 275 MHz to 550 MHz
-// MSEL: PLL Multiplier Selection
-// <6-32768><#-1>
-// M Value
-// NSEL: PLL Divider Selection
-// <1-256><#-1>
-// N Value
-//
-// PLL0 Configuration Register (PLL0CFG) with quartz 12 MHz
-// F_cco0 = (2 * M * F_in) / N
-// F_in must be in the range of 32 kHz to 50 MHz
-// F_cco0 must be in the range of 275 MHz to 550 MHz
-// MSEL: PLL Multiplier Selection
-// <6-32768><#-1>
-// M Value
-// NSEL: PLL Divider Selection
-// <1-256><#-1>
-// N Value
-//
-//
-//
-// PLL1 Configuration (USB PLL)
-// PLL1 Configuration Register (PLL1CFG) with quartz 24 MHz
-// F_usb = M * F_osc or F_usb = F_cco1 / (2 * P)
-// F_cco1 = F_osc * M * 2 * P
-// F_cco1 must be in the range of 156 MHz to 320 MHz
-// MSEL: PLL Multiplier Selection
-// <1-32><#-1>
-// M Value (for USB maximum value is 4)
-// PSEL: PLL Divider Selection
-// <0=> 1
-// <1=> 2
-// <2=> 4
-// <3=> 8
-// P Value
-//
-// PLL1 Configuration Register (PLL1CFG) with quartz 12 MHz
-// F_usb = M * F_osc or F_usb = F_cco1 / (2 * P)
-// F_cco1 = F_osc * M * 2 * P
-// F_cco1 must be in the range of 156 MHz to 320 MHz
-// MSEL: PLL Multiplier Selection
-// <1-32><#-1>
-// M Value (for USB maximum value is 4)
-// PSEL: PLL Divider Selection
-// <0=> 1
-// <1=> 2
-// <2=> 4
-// <3=> 8
-// P Value
-//
-//
-//
-// CPU Clock Configuration Register (CCLKCFG)
-// CCLKSEL: Divide Value for CPU Clock from PLL0
-// <1-256><#-1>
-//
-//
-// USB Clock Configuration Register (USBCLKCFG)
-// USBSEL: Divide Value for USB Clock from PLL0
-// <0-15>
-// Divide is USBSEL + 1
-//
-//
-// Clock Source Select Register (CLKSRCSEL)
-// CLKSRC: PLL Clock Source Selection
-// <0=> Internal RC oscillator
-// <1=> Main oscillator
-// <2=> RTC oscillator
-//
-//
-// Peripheral Clock Selection Register 0 (PCLKSEL0)
-// PCLK_WDT: Peripheral Clock Selection for WDT
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_TIMER0: Peripheral Clock Selection for TIMER0
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_TIMER1: Peripheral Clock Selection for TIMER1
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_UART0: Peripheral Clock Selection for UART0
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_UART1: Peripheral Clock Selection for UART1
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_PWM1: Peripheral Clock Selection for PWM1
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_I2C0: Peripheral Clock Selection for I2C0
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_SPI: Peripheral Clock Selection for SPI
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_SSP1: Peripheral Clock Selection for SSP1
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_DAC: Peripheral Clock Selection for DAC
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_ADC: Peripheral Clock Selection for ADC
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_CAN1: Peripheral Clock Selection for CAN1
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 6
-// PCLK_CAN2: Peripheral Clock Selection for CAN2
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 6
-// PCLK_ACF: Peripheral Clock Selection for ACF
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 6
-//
-//
-// Peripheral Clock Selection Register 1 (PCLKSEL1)
-// PCLK_QEI: Peripheral Clock Selection for the Quadrature Encoder Interface
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_GPIO: Peripheral Clock Selection for GPIOs
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_PCB: Peripheral Clock Selection for the Pin Connect Block
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_I2C1: Peripheral Clock Selection for I2C1
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_SSP0: Peripheral Clock Selection for SSP0
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_TIMER2: Peripheral Clock Selection for TIMER2
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_TIMER3: Peripheral Clock Selection for TIMER3
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_UART2: Peripheral Clock Selection for UART2
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_UART3: Peripheral Clock Selection for UART3
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_I2C2: Peripheral Clock Selection for I2C2
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_I2S: Peripheral Clock Selection for I2S
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_RIT: Peripheral Clock Selection for the Repetitive Interrupt Timer
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_SYSCON: Peripheral Clock Selection for the System Control Block
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-// PCLK_MC: Peripheral Clock Selection for the Motor Control PWM
-// <0=> Pclk = Cclk / 4
-// <1=> Pclk = Cclk
-// <2=> Pclk = Cclk / 2
-// <3=> Pclk = Cclk / 8
-//
-//
-// Power Control for Peripherals Register (PCONP)
-// PCTIM0: Timer/Counter 0 power/clock enable
-// PCTIM1: Timer/Counter 1 power/clock enable
-// PCUART0: UART 0 power/clock enable
-// PCUART1: UART 1 power/clock enable
-// PCPWM1: PWM 1 power/clock enable
-// PCI2C0: I2C interface 0 power/clock enable
-// PCSPI: SPI interface power/clock enable
-// PCRTC: RTC power/clock enable
-// PCSSP1: SSP interface 1 power/clock enable
-// PCAD: A/D converter power/clock enable
-// PCCAN1: CAN controller 1 power/clock enable
-// PCCAN2: CAN controller 2 power/clock enable
-// PCGPIO: GPIOs power/clock enable
-// PCRIT: Repetitive interrupt timer power/clock enable
-// PCMC: Motor control PWM power/clock enable
-// PCQEI: Quadrature encoder interface power/clock enable
-// PCI2C1: I2C interface 1 power/clock enable
-// PCSSP0: SSP interface 0 power/clock enable
-// PCTIM2: Timer 2 power/clock enable
-// PCTIM3: Timer 3 power/clock enable
-// PCUART2: UART 2 power/clock enable
-// PCUART3: UART 3 power/clock enable
-// PCI2C2: I2C interface 2 power/clock enable
-// PCI2S: I2S interface power/clock enable
-// PCGPDMA: GP DMA function power/clock enable
-// PCENET: Ethernet block power/clock enable
-// PCUSB: USB interface power/clock enable
-//
-//
-// Clock Output Configuration Register (CLKOUTCFG)
-// CLKOUTSEL: Selects clock source for CLKOUT
-// <0=> CPU clock
-// <1=> Main oscillator
-// <2=> Internal RC oscillator
-// <3=> USB clock
-// <4=> RTC oscillator
-// CLKOUTDIV: Selects clock divider for CLKOUT
-// <1-16><#-1>
-// CLKOUT_EN: CLKOUT enable control
-//
-//
-//
-*/
-
-
-
-/** @addtogroup LPC17xx_System_Defines LPC17xx System Defines
- @{
- */
-
-#define CLOCK_SETUP 1
-#define SCS_24_Val 0x00000030
-#define SCS_12_Val 0x00000020
-#define PLL0_SETUP 1
-#define PLL0CFG_24_Val 0x00030018
-#define PLL0CFG_12_Val 0x00010018
-#define PLL1_SETUP 1
-#define PLL1CFG_24_Val 0x00000021
-#define PLL1CFG_12_Val 0x00000023
-#define CCLKCFG_Val 0x00000002
-#define USBCLKCFG_Val 0x00000001
-#define CLKSRCSEL_Val 0x00000001
-#define PCLKSEL0_Val 0x08000000
-#define PCLKSEL1_Val 0x00000000
-#define PCONP_Val 0x4000A00E
-#define CLKOUTCFG_Val 0x00000110
-
-
-/*--------------------- Flash Accelerator Configuration ----------------------
-//
-// Flash Accelerator Configuration
-// FLASHTIM: Flash Access Time
-// <0=> 1 CPU clock (for CPU clock up to 20 MHz)
-// <1=> 2 CPU clocks (for CPU clock up to 40 MHz)
-// <2=> 3 CPU clocks (for CPU clock up to 60 MHz)
-// <3=> 4 CPU clocks (for CPU clock up to 80 MHz)
-// <4=> 5 CPU clocks (for CPU clock up to 100 MHz)
-// <5=> 6 CPU clocks (for any CPU clock)
-//
-*/
-#define FLASH_SETUP 1
-#define FLASHCFG_Val 0x00004000
-
-/*
-//-------- <<< end of configuration section >>> ------------------------------
-*/
-
-/*----------------------------------------------------------------------------
- Check the register settings
- *----------------------------------------------------------------------------*/
-#define CHECK_RANGE(val, min, max) ((val < min) || (val > max))
-#define CHECK_RSVD(val, mask) (val & mask)
-
-/* Clock Configuration -------------------------------------------------------*/
-#if (CHECK_RSVD((SCS_12_Val), ~0x00000030))
- #error "SCS_12: Invalid values of reserved bits!"
-#endif
-#if (CHECK_RSVD((SCS_24_Val), ~0x00000030))
- #error "SCS_24: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((CLKSRCSEL_Val), 0, 2))
- #error "CLKSRCSEL: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((PLL0CFG_12_Val), ~0x00FF7FFF))
- #error "PLL0CFG_12: Invalid values of reserved bits!"
-#endif
-#if (CHECK_RSVD((PLL0CFG_24_Val), ~0x00FF7FFF))
- #error "PLL0CFG_24: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((PLL1CFG_12_Val), ~0x0000007F))
- #error "PLL1CFG_12: Invalid values of reserved bits!"
-#endif
-#if (CHECK_RSVD((PLL1CFG_24_Val), ~0x0000007F))
- #error "PLL1CFG_24: Invalid values of reserved bits!"
-#endif
-
-#if (PLL0_SETUP) /* if PLL0 is used */
- #if (CCLKCFG_Val < 2) /* CCLKSEL must be greater then 1 */
- #error "CCLKCFG_24: CCLKSEL must be greater then 1 if PLL0 is used!"
- #endif
-#endif
-
-#if (CHECK_RANGE((CCLKCFG_Val), 0, 255))
- #error "CCLKCFG_24: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((USBCLKCFG_Val), ~0x0000000F))
- #error "USBCLKCFG_24: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((PCLKSEL0_Val), 0x000C0C00))
- #error "PCLKSEL0: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((PCLKSEL1_Val), 0x03000300))
- #error "PCLKSEL1: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((PCONP_Val), 0x10100821))
- #error "PCONP: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((CLKOUTCFG_Val), ~0x000001FF))
- #error "CLKOUTCFG: Invalid values of reserved bits!"
-#endif
-
-/* Flash Accelerator Configuration -------------------------------------------*/
-#if (CHECK_RSVD((FLASHCFG_Val), ~0x0000F000))
- #error "FLASHCFG: Invalid values of reserved bits!"
-#endif
-
-
-/*----------------------------------------------------------------------------
- DEFINES
- *----------------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------------
- Define clocks
- *----------------------------------------------------------------------------*/
-#define XTAL_24 (24000000UL) /* Oscillator frequency */
-#define XTAL_12 (12000000UL) /* Oscillator frequency */
-#define OSC_CLK_24 ( XTAL_24) /* Main oscillator frequency */
-#define OSC_CLK_12 ( XTAL_12) /* Main oscillator frequency */
-#define RTC_CLK ( 32768UL) /* RTC oscillator frequency */
-#define IRC_OSC ( 4000000UL) /* Internal RC oscillator frequency */
-
-
-/* F_cco0 = (2 * M * F_in) / N */
-#define __M_24 (((PLL0CFG_24_Val ) & 0x7FFF) + 1)
-#define __M_12 (((PLL0CFG_12_Val ) & 0x7FFF) + 1)
-#define __N_24 (((PLL0CFG_24_Val >> 16) & 0x00FF) + 1)
-#define __N_12 (((PLL0CFG_12_Val >> 16) & 0x00FF) + 1)
-#define __FCCO_24(__F_IN) ((2ULL * __M_24 * __F_IN) / __N_24)
-#define __FCCO_12(__F_IN) ((2ULL * __M_12 * __F_IN) / __N_12)
-#define __CCLK_DIV_24 (((CCLKCFG_Val ) & 0x00FF) + 1)
-#define __CCLK_DIV_12 (((CCLKCFG_Val ) & 0x00FF) + 1)
-
-/* Determine core clock frequency according to settings */
- #if (PLL0_SETUP)
- #if ((CLKSRCSEL_Val & 0x03) == 1)
- #define __CORE_CLK_24 (__FCCO_24(OSC_CLK_24) / __CCLK_DIV_24)
- #elif ((CLKSRCSEL_Val & 0x03) == 2)
- #define __CORE_CLK_24 (__FCCO_24(RTC_CLK) / __CCLK_DIV_24)
- #else
- #define __CORE_CLK_24 (__FCCO_24(IRC_OSC) / __CCLK_DIV_24)
- #endif
- #if ((CLKSRCSEL_Val & 0x03) == 1)
- #define __CORE_CLK_12 (__FCCO_12(OSC_CLK_12) / __CCLK_DIV_12)
- #elif ((CLKSRCSEL_Val & 0x03) == 2)
- #define __CORE_CLK_12 (__FCCO_12(RTC_CLK) / __CCLK_DIV_12)
- #else
- #define __CORE_CLK_12 (__FCCO_12(IRC_OSC) / __CCLK_DIV_12)
- #endif
- #else
- #if ((CLKSRCSEL_Val & 0x03) == 1)
- #define __CORE_CLK_24 (OSC_CLK_24 / __CCLK_DIV_24)
- #elif ((CLKSRCSEL_Val & 0x03) == 2)
- #define __CORE_CLK_24 (RTC_CLK / __CCLK_DIV_24)
- #else
- #define __CORE_CLK_24 (IRC_OSC / __CCLK_DIV_24)
- #endif
- #if ((CLKSRCSEL_Val & 0x03) == 1)
- #define __CORE_CLK_12 (OSC_CLK_12 / __CCLK_DIV_12)
- #elif ((CLKSRCSEL_Val & 0x03) == 2)
- #define __CORE_CLK_12 (RTC_CLK / __CCLK_DIV_12)
- #else
- #define __CORE_CLK_12 (IRC_OSC / __CCLK_DIV_12)
- #endif
- #endif
-
- /**
- * @}
- */
-
-
-/** @addtogroup LPC17xx_System_Public_Variables LPC17xx System Public Variables
- @{
- */
-/*----------------------------------------------------------------------------
- Clock Variable definitions
- *----------------------------------------------------------------------------*/
-uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock)*/
-const uint32_t SystemCoreClock12 = __CORE_CLK_12; /*!< System Clock Frequency (Core Clock)*/
-const uint32_t SystemCoreClock24 = __CORE_CLK_24; /*!< System Clock Frequency (Core Clock)*/
-
-/**
- * @}
- */
-
-
-/** @addtogroup LPC17xx_System_Public_Functions LPC17xx System Public Functions
- @{
- */
-
-
-/**
- * Initialize the system
- *
- * @param none
- * @return none
- *
- * @brief Setup the microcontroller system.
- * Initialize the System.
- * Запрещено иÑпользовать любые вызовы, иÑпользующие указатель Ñтека (Ñ‚.к. Ñтек ещё не проинициализирован)
- */
-void SystemInit (void)
-{
- if (1) { /* for 12 MHz Quartz */
-#if (CLOCK_SETUP) /* Clock Setup */
- LPC_SC->SCS = SCS_12_Val;
- if (LPC_SC->SCS & (1 << 5)) { /* If Main Oscillator is enabled */
- while ((LPC_SC->SCS & (1<<6)) == 0);/* Wait for Oscillator to be ready */
- }
-
- LPC_SC->CCLKCFG = CCLKCFG_Val; /* Setup Clock Divider */
- /* Periphral clock must be selected before PLL0 enabling and connecting
- * - according errata.lpc1768-16.March.2010 -
- */
- LPC_SC->PCLKSEL0 = PCLKSEL0_Val; /* Peripheral Clock Selection */
- LPC_SC->PCLKSEL1 = PCLKSEL1_Val;
-
- LPC_SC->CLKSRCSEL = CLKSRCSEL_Val; /* Select Clock Source sysclk / PLL0 */
-
-#if (PLL0_SETUP)
- LPC_SC->PLL0CFG = PLL0CFG_12_Val; /* configure PLL0 */
- LPC_SC->PLL0FEED = 0xAA;
- LPC_SC->PLL0FEED = 0x55;
-
- LPC_SC->PLL0CON = 0x01; /* PLL0 Enable */
- LPC_SC->PLL0FEED = 0xAA;
- LPC_SC->PLL0FEED = 0x55;
- while (!(LPC_SC->PLL0STAT & (1<<26)));/* Wait for PLOCK0 */
-
- LPC_SC->PLL0CON = 0x03; /* PLL0 Enable & Connect */
- LPC_SC->PLL0FEED = 0xAA;
- LPC_SC->PLL0FEED = 0x55;
- while ((LPC_SC->PLL0STAT & ((1<<25) | (1<<24))) != ((1<<25) | (1<<24))); /* Wait for PLLC0_STAT & PLLE0_STAT */
-#endif
-
-#if (PLL1_SETUP)
- LPC_SC->PLL1CFG = PLL1CFG_12_Val;
- LPC_SC->PLL1FEED = 0xAA;
- LPC_SC->PLL1FEED = 0x55;
-
- LPC_SC->PLL1CON = 0x01; /* PLL1 Enable */
- LPC_SC->PLL1FEED = 0xAA;
- LPC_SC->PLL1FEED = 0x55;
- while (!(LPC_SC->PLL1STAT & (1<<10)));/* Wait for PLOCK1 */
-
- LPC_SC->PLL1CON = 0x03; /* PLL1 Enable & Connect */
- LPC_SC->PLL1FEED = 0xAA;
- LPC_SC->PLL1FEED = 0x55;
- while ((LPC_SC->PLL1STAT & ((1<< 9) | (1<< 8))) != ((1<< 9) | (1<< 8))); /* Wait for PLLC1_STAT & PLLE1_STAT */
-#else
- LPC_SC->USBCLKCFG = USBCLKCFG_12_Val; /* Setup USB Clock Divider */
-#endif
- LPC_SC->PCONP = PCONP_Val; /* Power Control for Peripherals */
-
- LPC_SC->CLKOUTCFG = CLKOUTCFG_Val; /* Clock Output Configuration */
-#endif
-
-#if (FLASH_SETUP == 1) /* Flash Accelerator Setup */
- LPC_SC->FLASHCFG = (LPC_SC->FLASHCFG & ~0x0000F000) | FLASHCFG_Val;
-#endif
- } else { /* for 24 MGz Quartz */
-#if (CLOCK_SETUP) /* Clock Setup */
- LPC_SC->SCS = SCS_24_Val;
- if (LPC_SC->SCS & (1 << 5)) { /* If Main Oscillator is enabled */
- while ((LPC_SC->SCS & (1<<6)) == 0);/* Wait for Oscillator to be ready */
- }
-
- LPC_SC->CCLKCFG = CCLKCFG_Val; /* Setup Clock Divider */
- /* Periphral clock must be selected before PLL0 enabling and connecting
- * - according errata.lpc1768-16.March.2010 -
- */
- LPC_SC->PCLKSEL0 = PCLKSEL0_Val; /* Peripheral Clock Selection */
- LPC_SC->PCLKSEL1 = PCLKSEL1_Val;
-
- LPC_SC->CLKSRCSEL = CLKSRCSEL_Val; /* Select Clock Source sysclk / PLL0 */
-
-#if (PLL0_SETUP)
- LPC_SC->PLL0CFG = PLL0CFG_24_Val; /* configure PLL0 */
- LPC_SC->PLL0FEED = 0xAA;
- LPC_SC->PLL0FEED = 0x55;
-
- LPC_SC->PLL0CON = 0x01; /* PLL0 Enable */
- LPC_SC->PLL0FEED = 0xAA;
- LPC_SC->PLL0FEED = 0x55;
- while (!(LPC_SC->PLL0STAT & (1<<26)));/* Wait for PLOCK0 */
-
- LPC_SC->PLL0CON = 0x03; /* PLL0 Enable & Connect */
- LPC_SC->PLL0FEED = 0xAA;
- LPC_SC->PLL0FEED = 0x55;
- while ((LPC_SC->PLL0STAT & ((1<<25) | (1<<24))) != ((1<<25) | (1<<24))); /* Wait for PLLC0_STAT & PLLE0_STAT */
-#endif
-
-#if (PLL1_SETUP)
- LPC_SC->PLL1CFG = PLL1CFG_24_Val;
- LPC_SC->PLL1FEED = 0xAA;
- LPC_SC->PLL1FEED = 0x55;
-
- LPC_SC->PLL1CON = 0x01; /* PLL1 Enable */
- LPC_SC->PLL1FEED = 0xAA;
- LPC_SC->PLL1FEED = 0x55;
- while (!(LPC_SC->PLL1STAT & (1<<10)));/* Wait for PLOCK1 */
-
- LPC_SC->PLL1CON = 0x03; /* PLL1 Enable & Connect */
- LPC_SC->PLL1FEED = 0xAA;
- LPC_SC->PLL1FEED = 0x55;
- while ((LPC_SC->PLL1STAT & ((1<< 9) | (1<< 8))) != ((1<< 9) | (1<< 8))); /* Wait for PLLC1_STAT & PLLE1_STAT */
-#else
- LPC_SC->USBCLKCFG = USBCLKCFG_24_Val; /* Setup USB Clock Divider */
-#endif
- LPC_SC->PCONP = PCONP_Val; /* Power Control for Peripherals */
-
- LPC_SC->CLKOUTCFG = CLKOUTCFG_Val; /* Clock Output Configuration */
-#endif
-
-#if (FLASH_SETUP == 1) /* Flash Accelerator Setup */
- LPC_SC->FLASHCFG = (LPC_SC->FLASHCFG & ~0x0000F000) | FLASHCFG_Val;
-#endif
- }
-}
diff --git a/platforms_startup/armcc/LPC1768/system_LPC17xx.h b/platforms_startup/armcc/LPC1768/system_LPC17xx.h
deleted file mode 100644
index 1bcc97f35..000000000
--- a/platforms_startup/armcc/LPC1768/system_LPC17xx.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/**************************************************************************//**
- * @file system_LPC17xx.h
- * @brief CMSIS Cortex-M3 Device Peripheral Access Layer Header File
- * for the NXP LPC17xx Device Series
- * @version V1.02
- * @date 08. September 2009
- *
- * @note
- * Copyright (C) 2009 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M
- * processor based microcontrollers. This file can be freely distributed
- * within development tools that are supporting such ARM based processors.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#ifndef __SYSTEM_LPC17xx_H
-#define __SYSTEM_LPC17xx_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-
-/** @addtogroup LPC17xx_System
- * @{
- */
-
-
-extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
-
-
-/**
- * Initialize the system
- *
- * @param none
- * @return none
- *
- * @brief Setup the microcontroller system.
- * Initialize the System and update the SystemCoreClock variable.
- */
-extern void SystemInit (void);
-
-/**
- * Update SystemCoreClock variable
- *
- * @param none
- * @return none
- *
- * @brief Updates the SystemCoreClock with current core Clock
- * retrieved from cpu registers.
- */
-extern void SystemCoreClockUpdate (void);
-#ifdef __cplusplus
-}
-#endif
-
-/**
- * @}
- */
-
-#endif /* __SYSTEM_LPC17xx_H */
diff --git a/platforms_startup/armcc/LPC1833/README b/platforms_startup/armcc/LPC1833/README
deleted file mode 100644
index 68e7ff413..000000000
--- a/platforms_startup/armcc/LPC1833/README
+++ /dev/null
@@ -1,10 +0,0 @@
-Project for LPC1833 is based on LPCOpen. Unused functions is removed to make
-a small code instead of a fat one.
-
-Semihosting is in use. For time measurement, SystemTimer in Cortex-M3 core is
-used. Any pin is not initialized.
-
-Debug output is done using SWO (ITM channel 0).
-
-Working frequency is getting from Internal RC (12 MHz), so no PLL setup is used,
-no quartz is required.
diff --git a/platforms_startup/armcc/LPC1833/cmsis_18xx.h b/platforms_startup/armcc/LPC1833/cmsis_18xx.h
deleted file mode 100644
index a4d610fda..000000000
--- a/platforms_startup/armcc/LPC1833/cmsis_18xx.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * @brief Basic CMSIS include file for LPC18XX
- *
- * @note
- * Copyright(C) NXP Semiconductors, 2013
- * All rights reserved.
- *
- * @par
- * Software that is described herein is for illustrative purposes only
- * which provides customers with programming information regarding the
- * LPC products. This software is supplied "AS IS" without any warranties of
- * any kind, and NXP Semiconductors and its licensor disclaim any and
- * all warranties, express or implied, including all implied warranties of
- * merchantability, fitness for a particular purpose and non-infringement of
- * intellectual property rights. NXP Semiconductors assumes no responsibility
- * or liability for the use of the software, conveys no license or rights under any
- * patent, copyright, mask work right, or any other intellectual property rights in
- * or to any products. NXP Semiconductors reserves the right to make changes
- * in the software without notification. NXP Semiconductors also makes no
- * representation or warranty that such application will be suitable for the
- * specified use without further testing or modification.
- *
- * @par
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, under NXP Semiconductors' and its
- * licensor's relevant copyrights in the software, without fee, provided that it
- * is used in conjunction with NXP Semiconductors microcontrollers. This
- * copyright, permission, and disclaimer notice must appear in all copies of
- * this code.
- */
-
-#ifndef __CMSIS_18XX_H_
-#define __CMSIS_18XX_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** @defgroup CMSIS_18XX CHIP: LPC18xx CMSIS include file
- * @ingroup CHIP_18XX_43XX_Drivers
- * @{
- */
-
- #pragma diag_suppress 2525
- #pragma push
- #pragma anon_unions
-
-/** @defgroup CMSIS_18XX_COMMON CHIP: LPC18xx Cortex CMSIS definitions
- * @{
- */
-
-#define __CM3_REV 0x0201
-#define __MPU_PRESENT 1 /*!< MPU present or not */
-#define __NVIC_PRIO_BITS 3 /*!< Number of Bits used for Priority Levels */
-#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
-#define __FPU_PRESENT 0 /*!< FPU present or not */
-
-/**
- * @}
- */
-
-/** @defgroup CMSIS_18XX_IRQ CHIP: LPC18xx peripheral interrupt numbers
- * @{
- */
-
-typedef enum {
- /* ------------------------- Cortex-M3 Processor Exceptions Numbers ----------------------------- */
- Reset_IRQn = -15,/*!< 1 Reset Vector, invoked on Power up and warm reset */
- NonMaskableInt_IRQn = -14,/*!< 2 Non maskable Interrupt, cannot be stopped or preempted */
- HardFault_IRQn = -13,/*!< 3 Hard Fault, all classes of Fault */
- MemoryManagement_IRQn = -12,/*!< 4 Memory Management, MPU mismatch, including Access Violation and No Match */
- BusFault_IRQn = -11,/*!< 5 Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory related Fault */
- UsageFault_IRQn = -10,/*!< 6 Usage Fault, i.e. Undef Instruction, Illegal State Transition */
- SVCall_IRQn = -5, /*!< 11 System Service Call via SVC instruction */
- DebugMonitor_IRQn = -4, /*!< 12 Debug Monitor */
- PendSV_IRQn = -2, /*!< 14 Pendable request for system service */
- SysTick_IRQn = -1, /*!< 15 System Tick Timer */
-
- /* --------------------------- LPC18xx/43xx Specific Interrupt Numbers ------------------------------- */
- DAC_IRQn = 0,/*!< 0 DAC */
- RESERVED0_IRQn = 1,
- DMA_IRQn = 2,/*!< 2 DMA */
- RESERVED1_IRQn = 3,/*!< 3 EZH/EDM */
- RESERVED2_IRQn = 4,
- ETHERNET_IRQn = 5,/*!< 5 ETHERNET */
- SDIO_IRQn = 6,/*!< 6 SDIO */
- LCD_IRQn = 7,/*!< 7 LCD */
- USB0_IRQn = 8,/*!< 8 USB0 */
- USB1_IRQn = 9,/*!< 9 USB1 */
- SCT_IRQn = 10,/*!< 10 SCT */
- RITIMER_IRQn = 11,/*!< 11 RITIMER */
- TIMER0_IRQn = 12,/*!< 12 TIMER0 */
- TIMER1_IRQn = 13,/*!< 13 TIMER1 */
- TIMER2_IRQn = 14,/*!< 14 TIMER2 */
- TIMER3_IRQn = 15,/*!< 15 TIMER3 */
- MCPWM_IRQn = 16,/*!< 16 MCPWM */
- ADC0_IRQn = 17,/*!< 17 ADC0 */
- I2C0_IRQn = 18,/*!< 18 I2C0 */
- I2C1_IRQn = 19,/*!< 19 I2C1 */
- RESERVED3_IRQn = 20,
- ADC1_IRQn = 21,/*!< 21 ADC1 */
- SSP0_IRQn = 22,/*!< 22 SSP0 */
- SSP1_IRQn = 23,/*!< 23 SSP1 */
- USART0_IRQn = 24,/*!< 24 USART0 */
- UART1_IRQn = 25,/*!< 25 UART1 */
- USART2_IRQn = 26,/*!< 26 USART2 */
- USART3_IRQn = 27,/*!< 27 USART3 */
- I2S0_IRQn = 28,/*!< 28 I2S0 */
- I2S1_IRQn = 29,/*!< 29 I2S1 */
- RESERVED4_IRQn = 30,
- RESERVED5_IRQn = 31,
- PIN_INT0_IRQn = 32,/*!< 32 PIN_INT0 */
- PIN_INT1_IRQn = 33,/*!< 33 PIN_INT1 */
- PIN_INT2_IRQn = 34,/*!< 34 PIN_INT2 */
- PIN_INT3_IRQn = 35,/*!< 35 PIN_INT3 */
- PIN_INT4_IRQn = 36,/*!< 36 PIN_INT4 */
- PIN_INT5_IRQn = 37,/*!< 37 PIN_INT5 */
- PIN_INT6_IRQn = 38,/*!< 38 PIN_INT6 */
- PIN_INT7_IRQn = 39,/*!< 39 PIN_INT7 */
- GINT0_IRQn = 40,/*!< 40 GINT0 */
- GINT1_IRQn = 41,/*!< 41 GINT1 */
- EVENTROUTER_IRQn = 42,/*!< 42 EVENTROUTER */
- C_CAN1_IRQn = 43,/*!< 43 C_CAN1 */
- RESERVED6_IRQn = 44,
- RESERVED7_IRQn = 45,/*!< */
- ATIMER_IRQn = 46,/*!< 46 ATIMER */
- RTC_IRQn = 47,/*!< 47 RTC */
- RESERVED8_IRQn = 48,
- WWDT_IRQn = 49,/*!< 49 WWDT */
- RESERVED9_IRQn = 50,
- C_CAN0_IRQn = 51,/*!< 51 C_CAN0 */
- QEI_IRQn = 52 /*!< 52 QEI */
-} LPC18XX_IRQn_Type;
-
-/**
- * @}
- */
-
-typedef LPC18XX_IRQn_Type IRQn_Type;
-
-/* Cortex-M3 processor and core peripherals */
-#include "core_cm3.h"
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ifndef __CMSIS_18XX_H_ */
diff --git a/platforms_startup/armcc/LPC1833/core_cm3.h b/platforms_startup/armcc/LPC1833/core_cm3.h
deleted file mode 100644
index 956a86b3e..000000000
--- a/platforms_startup/armcc/LPC1833/core_cm3.h
+++ /dev/null
@@ -1,1550 +0,0 @@
-/**************************************************************************//**
- * @file core_cm3.h
- * @brief CMSIS Cortex-M3 Core Peripheral Access Layer Header File
- * @version V3.20
- * @date 25. February 2013
- *
- * @note
- *
- ******************************************************************************/
-/* Copyright (c) 2009 - 2013 ARM LIMITED
-
- All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- - 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.
- - Neither the name of ARM nor the names of its contributors may be used
- to endorse or promote products derived from this software without
- specific prior written permission.
- *
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS 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.
- ---------------------------------------------------------------------------*/
-
-
-
-#ifndef __CORE_CM3_H_GENERIC
-#define __CORE_CM3_H_GENERIC
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
- /** \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
- CMSIS violates the following MISRA-C:2004 rules:
-
- \li Required Rule 8.5, object/function definition in header file.
- Function definitions in header files are used to allow 'inlining'.
-
- \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers.
-
- \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code.
- */
-
-
-/*******************************************************************************
- * CMSIS definitions
- ******************************************************************************/
-/** \ingroup Cortex_M3
- @{
- */
-
-/* CMSIS CM3 definitions */
-#define __CM3_CMSIS_VERSION_MAIN (0x03) /*!< [31:16] CMSIS HAL main version */
-#define __CM3_CMSIS_VERSION_SUB (0x20) /*!< [15:0] CMSIS HAL sub version */
-#define __CM3_CMSIS_VERSION ((__CM3_CMSIS_VERSION_MAIN << 16) | \
- __CM3_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
-
-#define __CORTEX_M (0x03) /*!< Cortex-M Core */
-
-/** __FPU_USED indicates whether an FPU is used or not. This core does not support an FPU at all
-*/
-#define __FPU_USED 0
-
-#include /* standard types definitions */
-#include "core_cmInstr.h" /* Core Instruction Access */
-#include "core_cmFunc.h" /* Core Function Access */
-
-#endif /* __CORE_CM3_H_GENERIC */
-
-#ifndef __CMSIS_GENERIC
-
-#ifndef __CORE_CM3_H_DEPENDANT
-#define __CORE_CM3_H_DEPENDANT
-
-
-/* IO definitions (access restrictions to peripheral registers) */
-/**
- \defgroup CMSIS_glob_defs CMSIS Global Defines
-
- IO Type Qualifiers are used
- \li to specify the access to peripheral variables.
- \li for automatic generation of peripheral register debug information.
-*/
-#ifdef __cplusplus
- #define __I volatile /*!< Defines 'read only' permissions */
-#else
- #define __I volatile const /*!< Defines 'read only' permissions */
-#endif
-#define __O volatile /*!< Defines 'write only' permissions */
-#define __IO volatile /*!< Defines 'read / write' permissions */
-
-/*@} end of group Cortex_M3 */
-
-
-
-/*******************************************************************************
- * Register Abstraction
- Core Register contain:
- - Core Register
- - Core NVIC Register
- - Core SCB Register
- - Core SysTick Register
- - Core Debug Register
- - Core MPU Register
- ******************************************************************************/
-/** \defgroup CMSIS_core_register Defines and Type Definitions
- \brief Type definitions and defines for Cortex-M processor based devices.
-*/
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_CORE Status and Control Registers
- \brief Core Register type definitions.
- @{
- */
-
-/** \brief Union type to access the Application Program Status Register (APSR).
- */
-typedef union
-{
- struct
- {
-#if (__CORTEX_M != 0x04)
- uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */
-#else
- uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
- uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
- uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */
-#endif
- uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
- uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
- uint32_t C:1; /*!< bit: 29 Carry condition code flag */
- uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
- uint32_t N:1; /*!< bit: 31 Negative condition code flag */
- } b; /*!< Structure used for bit access */
- uint32_t w; /*!< Type used for word access */
-} APSR_Type;
-
-
-/** \brief Union type to access the Interrupt Program Status Register (IPSR).
- */
-typedef union
-{
- struct
- {
- uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
- uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
- } b; /*!< Structure used for bit access */
- uint32_t w; /*!< Type used for word access */
-} IPSR_Type;
-
-
-/** \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
- */
-typedef union
-{
- struct
- {
- uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
-#if (__CORTEX_M != 0x04)
- uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
-#else
- uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */
- uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
- uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
-#endif
- uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
- uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
- uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
- uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
- uint32_t C:1; /*!< bit: 29 Carry condition code flag */
- uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
- uint32_t N:1; /*!< bit: 31 Negative condition code flag */
- } b; /*!< Structure used for bit access */
- uint32_t w; /*!< Type used for word access */
-} xPSR_Type;
-
-
-/** \brief Union type to access the Control Registers (CONTROL).
- */
-typedef union
-{
- struct
- {
- uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
- uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
- uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */
- uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */
- } b; /*!< Structure used for bit access */
- uint32_t w; /*!< Type used for word access */
-} CONTROL_Type;
-
-/*@} end of group CMSIS_CORE */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
- \brief Type definitions for the NVIC Registers
- @{
- */
-
-/** \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
- */
-typedef struct
-{
- __IO uint32_t ISER[8]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
- uint32_t RESERVED0[24];
- __IO uint32_t ICER[8]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
- uint32_t RSERVED1[24];
- __IO uint32_t ISPR[8]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
- uint32_t RESERVED2[24];
- __IO uint32_t ICPR[8]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
- uint32_t RESERVED3[24];
- __IO uint32_t IABR[8]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
- uint32_t RESERVED4[56];
- __IO uint8_t IP[240]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
- uint32_t RESERVED5[644];
- __O uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
-} NVIC_Type;
-
-/* Software Triggered Interrupt Register Definitions */
-#define NVIC_STIR_INTID_Pos 0 /*!< STIR: INTLINESNUM Position */
-#define NVIC_STIR_INTID_Msk (0x1FFUL << NVIC_STIR_INTID_Pos) /*!< STIR: INTLINESNUM Mask */
-
-/*@} end of group CMSIS_NVIC */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_SCB System Control Block (SCB)
- \brief Type definitions for the System Control Block Registers
- @{
- */
-
-/** \brief Structure type to access the System Control Block (SCB).
- */
-typedef struct
-{
- __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
- __IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
- __IO uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
- __IO uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
- __IO uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
- __IO uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
- __IO uint8_t SHP[12]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
- __IO uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
- __IO uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
- __IO uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
- __IO uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
- __IO uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
- __IO uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
- __IO uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
- __I uint32_t PFR[2]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
- __I uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
- __I uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
- __I uint32_t MMFR[4]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
- __I uint32_t ISAR[5]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
- uint32_t RESERVED0[5];
- __IO uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
-} SCB_Type;
-
-/* SCB CPUID Register Definitions */
-#define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */
-#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
-
-#define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */
-#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
-
-#define SCB_CPUID_ARCHITECTURE_Pos 16 /*!< SCB CPUID: ARCHITECTURE Position */
-#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
-
-#define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */
-#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
-
-#define SCB_CPUID_REVISION_Pos 0 /*!< SCB CPUID: REVISION Position */
-#define SCB_CPUID_REVISION_Msk (0xFUL << SCB_CPUID_REVISION_Pos) /*!< SCB CPUID: REVISION Mask */
-
-/* SCB Interrupt Control State Register Definitions */
-#define SCB_ICSR_NMIPENDSET_Pos 31 /*!< SCB ICSR: NMIPENDSET Position */
-#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
-
-#define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */
-#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
-
-#define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */
-#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
-
-#define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */
-#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
-
-#define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */
-#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
-
-#define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */
-#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
-
-#define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */
-#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
-
-#define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */
-#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
-
-#define SCB_ICSR_RETTOBASE_Pos 11 /*!< SCB ICSR: RETTOBASE Position */
-#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
-
-#define SCB_ICSR_VECTACTIVE_Pos 0 /*!< SCB ICSR: VECTACTIVE Position */
-#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos) /*!< SCB ICSR: VECTACTIVE Mask */
-
-/* SCB Vector Table Offset Register Definitions */
-#if (__CM3_REV < 0x0201) /* core r2p1 */
-#define SCB_VTOR_TBLBASE_Pos 29 /*!< SCB VTOR: TBLBASE Position */
-#define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */
-
-#define SCB_VTOR_TBLOFF_Pos 7 /*!< SCB VTOR: TBLOFF Position */
-#define SCB_VTOR_TBLOFF_Msk (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
-#else
-#define SCB_VTOR_TBLOFF_Pos 7 /*!< SCB VTOR: TBLOFF Position */
-#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
-#endif
-
-/* SCB Application Interrupt and Reset Control Register Definitions */
-#define SCB_AIRCR_VECTKEY_Pos 16 /*!< SCB AIRCR: VECTKEY Position */
-#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
-
-#define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */
-#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
-
-#define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */
-#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
-
-#define SCB_AIRCR_PRIGROUP_Pos 8 /*!< SCB AIRCR: PRIGROUP Position */
-#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
-
-#define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */
-#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
-
-#define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< SCB AIRCR: VECTCLRACTIVE Position */
-#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
-
-#define SCB_AIRCR_VECTRESET_Pos 0 /*!< SCB AIRCR: VECTRESET Position */
-#define SCB_AIRCR_VECTRESET_Msk (1UL << SCB_AIRCR_VECTRESET_Pos) /*!< SCB AIRCR: VECTRESET Mask */
-
-/* SCB System Control Register Definitions */
-#define SCB_SCR_SEVONPEND_Pos 4 /*!< SCB SCR: SEVONPEND Position */
-#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
-
-#define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */
-#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
-
-#define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< SCB SCR: SLEEPONEXIT Position */
-#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
-
-/* SCB Configuration Control Register Definitions */
-#define SCB_CCR_STKALIGN_Pos 9 /*!< SCB CCR: STKALIGN Position */
-#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
-
-#define SCB_CCR_BFHFNMIGN_Pos 8 /*!< SCB CCR: BFHFNMIGN Position */
-#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
-
-#define SCB_CCR_DIV_0_TRP_Pos 4 /*!< SCB CCR: DIV_0_TRP Position */
-#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
-
-#define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< SCB CCR: UNALIGN_TRP Position */
-#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
-
-#define SCB_CCR_USERSETMPEND_Pos 1 /*!< SCB CCR: USERSETMPEND Position */
-#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
-
-#define SCB_CCR_NONBASETHRDENA_Pos 0 /*!< SCB CCR: NONBASETHRDENA Position */
-#define SCB_CCR_NONBASETHRDENA_Msk (1UL << SCB_CCR_NONBASETHRDENA_Pos) /*!< SCB CCR: NONBASETHRDENA Mask */
-
-/* SCB System Handler Control and State Register Definitions */
-#define SCB_SHCSR_USGFAULTENA_Pos 18 /*!< SCB SHCSR: USGFAULTENA Position */
-#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
-
-#define SCB_SHCSR_BUSFAULTENA_Pos 17 /*!< SCB SHCSR: BUSFAULTENA Position */
-#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
-
-#define SCB_SHCSR_MEMFAULTENA_Pos 16 /*!< SCB SHCSR: MEMFAULTENA Position */
-#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
-
-#define SCB_SHCSR_SVCALLPENDED_Pos 15 /*!< SCB SHCSR: SVCALLPENDED Position */
-#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
-
-#define SCB_SHCSR_BUSFAULTPENDED_Pos 14 /*!< SCB SHCSR: BUSFAULTPENDED Position */
-#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
-
-#define SCB_SHCSR_MEMFAULTPENDED_Pos 13 /*!< SCB SHCSR: MEMFAULTPENDED Position */
-#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
-
-#define SCB_SHCSR_USGFAULTPENDED_Pos 12 /*!< SCB SHCSR: USGFAULTPENDED Position */
-#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
-
-#define SCB_SHCSR_SYSTICKACT_Pos 11 /*!< SCB SHCSR: SYSTICKACT Position */
-#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
-
-#define SCB_SHCSR_PENDSVACT_Pos 10 /*!< SCB SHCSR: PENDSVACT Position */
-#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
-
-#define SCB_SHCSR_MONITORACT_Pos 8 /*!< SCB SHCSR: MONITORACT Position */
-#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
-
-#define SCB_SHCSR_SVCALLACT_Pos 7 /*!< SCB SHCSR: SVCALLACT Position */
-#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
-
-#define SCB_SHCSR_USGFAULTACT_Pos 3 /*!< SCB SHCSR: USGFAULTACT Position */
-#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
-
-#define SCB_SHCSR_BUSFAULTACT_Pos 1 /*!< SCB SHCSR: BUSFAULTACT Position */
-#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
-
-#define SCB_SHCSR_MEMFAULTACT_Pos 0 /*!< SCB SHCSR: MEMFAULTACT Position */
-#define SCB_SHCSR_MEMFAULTACT_Msk (1UL << SCB_SHCSR_MEMFAULTACT_Pos) /*!< SCB SHCSR: MEMFAULTACT Mask */
-
-/* SCB Configurable Fault Status Registers Definitions */
-#define SCB_CFSR_USGFAULTSR_Pos 16 /*!< SCB CFSR: Usage Fault Status Register Position */
-#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
-
-#define SCB_CFSR_BUSFAULTSR_Pos 8 /*!< SCB CFSR: Bus Fault Status Register Position */
-#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
-
-#define SCB_CFSR_MEMFAULTSR_Pos 0 /*!< SCB CFSR: Memory Manage Fault Status Register Position */
-#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL << SCB_CFSR_MEMFAULTSR_Pos) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
-
-/* SCB Hard Fault Status Registers Definitions */
-#define SCB_HFSR_DEBUGEVT_Pos 31 /*!< SCB HFSR: DEBUGEVT Position */
-#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
-
-#define SCB_HFSR_FORCED_Pos 30 /*!< SCB HFSR: FORCED Position */
-#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
-
-#define SCB_HFSR_VECTTBL_Pos 1 /*!< SCB HFSR: VECTTBL Position */
-#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
-
-/* SCB Debug Fault Status Register Definitions */
-#define SCB_DFSR_EXTERNAL_Pos 4 /*!< SCB DFSR: EXTERNAL Position */
-#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
-
-#define SCB_DFSR_VCATCH_Pos 3 /*!< SCB DFSR: VCATCH Position */
-#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
-
-#define SCB_DFSR_DWTTRAP_Pos 2 /*!< SCB DFSR: DWTTRAP Position */
-#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
-
-#define SCB_DFSR_BKPT_Pos 1 /*!< SCB DFSR: BKPT Position */
-#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
-
-#define SCB_DFSR_HALTED_Pos 0 /*!< SCB DFSR: HALTED Position */
-#define SCB_DFSR_HALTED_Msk (1UL << SCB_DFSR_HALTED_Pos) /*!< SCB DFSR: HALTED Mask */
-
-/*@} end of group CMSIS_SCB */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
- \brief Type definitions for the System Control and ID Register not in the SCB
- @{
- */
-
-/** \brief Structure type to access the System Control and ID Register not in the SCB.
- */
-typedef struct
-{
- uint32_t RESERVED0[1];
- __I uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
-#if ((defined __CM3_REV) && (__CM3_REV >= 0x200))
- __IO uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
-#else
- uint32_t RESERVED1[1];
-#endif
-} SCnSCB_Type;
-
-/* Interrupt Controller Type Register Definitions */
-#define SCnSCB_ICTR_INTLINESNUM_Pos 0 /*!< ICTR: INTLINESNUM Position */
-#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL << SCnSCB_ICTR_INTLINESNUM_Pos) /*!< ICTR: INTLINESNUM Mask */
-
-/* Auxiliary Control Register Definitions */
-
-#define SCnSCB_ACTLR_DISFOLD_Pos 2 /*!< ACTLR: DISFOLD Position */
-#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */
-
-#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1 /*!< ACTLR: DISDEFWBUF Position */
-#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */
-
-#define SCnSCB_ACTLR_DISMCYCINT_Pos 0 /*!< ACTLR: DISMCYCINT Position */
-#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL << SCnSCB_ACTLR_DISMCYCINT_Pos) /*!< ACTLR: DISMCYCINT Mask */
-
-/*@} end of group CMSIS_SCnotSCB */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_SysTick System Tick Timer (SysTick)
- \brief Type definitions for the System Timer Registers.
- @{
- */
-
-/** \brief Structure type to access the System Timer (SysTick).
- */
-typedef struct
-{
- __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
- __IO uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
- __IO uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
- __I uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
-} SysTick_Type;
-
-/* SysTick Control / Status Register Definitions */
-#define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */
-#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
-
-#define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */
-#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
-
-#define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */
-#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
-
-#define SysTick_CTRL_ENABLE_Pos 0 /*!< SysTick CTRL: ENABLE Position */
-#define SysTick_CTRL_ENABLE_Msk (1UL << SysTick_CTRL_ENABLE_Pos) /*!< SysTick CTRL: ENABLE Mask */
-
-/* SysTick Reload Register Definitions */
-#define SysTick_LOAD_RELOAD_Pos 0 /*!< SysTick LOAD: RELOAD Position */
-#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos) /*!< SysTick LOAD: RELOAD Mask */
-
-/* SysTick Current Register Definitions */
-#define SysTick_VAL_CURRENT_Pos 0 /*!< SysTick VAL: CURRENT Position */
-#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick VAL: CURRENT Mask */
-
-/* SysTick Calibration Register Definitions */
-#define SysTick_CALIB_NOREF_Pos 31 /*!< SysTick CALIB: NOREF Position */
-#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
-
-#define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */
-#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
-
-#define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */
-#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick CALIB: TENMS Mask */
-
-/*@} end of group CMSIS_SysTick */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
- \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
- @{
- */
-
-/** \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
- */
-typedef struct
-{
- __O union
- {
- __O uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
- __O uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
- __O uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
- } PORT [32]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
- uint32_t RESERVED0[864];
- __IO uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
- uint32_t RESERVED1[15];
- __IO uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
- uint32_t RESERVED2[15];
- __IO uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
- uint32_t RESERVED3[29];
- __O uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */
- __I uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */
- __IO uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */
- uint32_t RESERVED4[43];
- __O uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
- __I uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
- uint32_t RESERVED5[6];
- __I uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
- __I uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
- __I uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
- __I uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
- __I uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
- __I uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
- __I uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
- __I uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
- __I uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
- __I uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
- __I uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
- __I uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
-} ITM_Type;
-
-/* ITM Trace Privilege Register Definitions */
-#define ITM_TPR_PRIVMASK_Pos 0 /*!< ITM TPR: PRIVMASK Position */
-#define ITM_TPR_PRIVMASK_Msk (0xFUL << ITM_TPR_PRIVMASK_Pos) /*!< ITM TPR: PRIVMASK Mask */
-
-/* ITM Trace Control Register Definitions */
-#define ITM_TCR_BUSY_Pos 23 /*!< ITM TCR: BUSY Position */
-#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
-
-#define ITM_TCR_TraceBusID_Pos 16 /*!< ITM TCR: ATBID Position */
-#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */
-
-#define ITM_TCR_GTSFREQ_Pos 10 /*!< ITM TCR: Global timestamp frequency Position */
-#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
-
-#define ITM_TCR_TSPrescale_Pos 8 /*!< ITM TCR: TSPrescale Position */
-#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */
-
-#define ITM_TCR_SWOENA_Pos 4 /*!< ITM TCR: SWOENA Position */
-#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
-
-#define ITM_TCR_DWTENA_Pos 3 /*!< ITM TCR: DWTENA Position */
-#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
-
-#define ITM_TCR_SYNCENA_Pos 2 /*!< ITM TCR: SYNCENA Position */
-#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
-
-#define ITM_TCR_TSENA_Pos 1 /*!< ITM TCR: TSENA Position */
-#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
-
-#define ITM_TCR_ITMENA_Pos 0 /*!< ITM TCR: ITM Enable bit Position */
-#define ITM_TCR_ITMENA_Msk (1UL << ITM_TCR_ITMENA_Pos) /*!< ITM TCR: ITM Enable bit Mask */
-
-/* ITM Integration Write Register Definitions */
-#define ITM_IWR_ATVALIDM_Pos 0 /*!< ITM IWR: ATVALIDM Position */
-#define ITM_IWR_ATVALIDM_Msk (1UL << ITM_IWR_ATVALIDM_Pos) /*!< ITM IWR: ATVALIDM Mask */
-
-/* ITM Integration Read Register Definitions */
-#define ITM_IRR_ATREADYM_Pos 0 /*!< ITM IRR: ATREADYM Position */
-#define ITM_IRR_ATREADYM_Msk (1UL << ITM_IRR_ATREADYM_Pos) /*!< ITM IRR: ATREADYM Mask */
-
-/* ITM Integration Mode Control Register Definitions */
-#define ITM_IMCR_INTEGRATION_Pos 0 /*!< ITM IMCR: INTEGRATION Position */
-#define ITM_IMCR_INTEGRATION_Msk (1UL << ITM_IMCR_INTEGRATION_Pos) /*!< ITM IMCR: INTEGRATION Mask */
-
-/* ITM Lock Status Register Definitions */
-#define ITM_LSR_ByteAcc_Pos 2 /*!< ITM LSR: ByteAcc Position */
-#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
-
-#define ITM_LSR_Access_Pos 1 /*!< ITM LSR: Access Position */
-#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
-
-#define ITM_LSR_Present_Pos 0 /*!< ITM LSR: Present Position */
-#define ITM_LSR_Present_Msk (1UL << ITM_LSR_Present_Pos) /*!< ITM LSR: Present Mask */
-
-/*@}*/ /* end of group CMSIS_ITM */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
- \brief Type definitions for the Data Watchpoint and Trace (DWT)
- @{
- */
-
-/** \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
- */
-typedef struct
-{
- __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
- __IO uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
- __IO uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
- __IO uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
- __IO uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
- __IO uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
- __IO uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
- __I uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
- __IO uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
- __IO uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */
- __IO uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
- uint32_t RESERVED0[1];
- __IO uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
- __IO uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */
- __IO uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
- uint32_t RESERVED1[1];
- __IO uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
- __IO uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */
- __IO uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
- uint32_t RESERVED2[1];
- __IO uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
- __IO uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */
- __IO uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
-} DWT_Type;
-
-/* DWT Control Register Definitions */
-#define DWT_CTRL_NUMCOMP_Pos 28 /*!< DWT CTRL: NUMCOMP Position */
-#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
-
-#define DWT_CTRL_NOTRCPKT_Pos 27 /*!< DWT CTRL: NOTRCPKT Position */
-#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
-
-#define DWT_CTRL_NOEXTTRIG_Pos 26 /*!< DWT CTRL: NOEXTTRIG Position */
-#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
-
-#define DWT_CTRL_NOCYCCNT_Pos 25 /*!< DWT CTRL: NOCYCCNT Position */
-#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
-
-#define DWT_CTRL_NOPRFCNT_Pos 24 /*!< DWT CTRL: NOPRFCNT Position */
-#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
-
-#define DWT_CTRL_CYCEVTENA_Pos 22 /*!< DWT CTRL: CYCEVTENA Position */
-#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
-
-#define DWT_CTRL_FOLDEVTENA_Pos 21 /*!< DWT CTRL: FOLDEVTENA Position */
-#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
-
-#define DWT_CTRL_LSUEVTENA_Pos 20 /*!< DWT CTRL: LSUEVTENA Position */
-#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
-
-#define DWT_CTRL_SLEEPEVTENA_Pos 19 /*!< DWT CTRL: SLEEPEVTENA Position */
-#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
-
-#define DWT_CTRL_EXCEVTENA_Pos 18 /*!< DWT CTRL: EXCEVTENA Position */
-#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
-
-#define DWT_CTRL_CPIEVTENA_Pos 17 /*!< DWT CTRL: CPIEVTENA Position */
-#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
-
-#define DWT_CTRL_EXCTRCENA_Pos 16 /*!< DWT CTRL: EXCTRCENA Position */
-#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
-
-#define DWT_CTRL_PCSAMPLENA_Pos 12 /*!< DWT CTRL: PCSAMPLENA Position */
-#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
-
-#define DWT_CTRL_SYNCTAP_Pos 10 /*!< DWT CTRL: SYNCTAP Position */
-#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
-
-#define DWT_CTRL_CYCTAP_Pos 9 /*!< DWT CTRL: CYCTAP Position */
-#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
-
-#define DWT_CTRL_POSTINIT_Pos 5 /*!< DWT CTRL: POSTINIT Position */
-#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
-
-#define DWT_CTRL_POSTPRESET_Pos 1 /*!< DWT CTRL: POSTPRESET Position */
-#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
-
-#define DWT_CTRL_CYCCNTENA_Pos 0 /*!< DWT CTRL: CYCCNTENA Position */
-#define DWT_CTRL_CYCCNTENA_Msk (0x1UL << DWT_CTRL_CYCCNTENA_Pos) /*!< DWT CTRL: CYCCNTENA Mask */
-
-/* DWT CPI Count Register Definitions */
-#define DWT_CPICNT_CPICNT_Pos 0 /*!< DWT CPICNT: CPICNT Position */
-#define DWT_CPICNT_CPICNT_Msk (0xFFUL << DWT_CPICNT_CPICNT_Pos) /*!< DWT CPICNT: CPICNT Mask */
-
-/* DWT Exception Overhead Count Register Definitions */
-#define DWT_EXCCNT_EXCCNT_Pos 0 /*!< DWT EXCCNT: EXCCNT Position */
-#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL << DWT_EXCCNT_EXCCNT_Pos) /*!< DWT EXCCNT: EXCCNT Mask */
-
-/* DWT Sleep Count Register Definitions */
-#define DWT_SLEEPCNT_SLEEPCNT_Pos 0 /*!< DWT SLEEPCNT: SLEEPCNT Position */
-#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL << DWT_SLEEPCNT_SLEEPCNT_Pos) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
-
-/* DWT LSU Count Register Definitions */
-#define DWT_LSUCNT_LSUCNT_Pos 0 /*!< DWT LSUCNT: LSUCNT Position */
-#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL << DWT_LSUCNT_LSUCNT_Pos) /*!< DWT LSUCNT: LSUCNT Mask */
-
-/* DWT Folded-instruction Count Register Definitions */
-#define DWT_FOLDCNT_FOLDCNT_Pos 0 /*!< DWT FOLDCNT: FOLDCNT Position */
-#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL << DWT_FOLDCNT_FOLDCNT_Pos) /*!< DWT FOLDCNT: FOLDCNT Mask */
-
-/* DWT Comparator Mask Register Definitions */
-#define DWT_MASK_MASK_Pos 0 /*!< DWT MASK: MASK Position */
-#define DWT_MASK_MASK_Msk (0x1FUL << DWT_MASK_MASK_Pos) /*!< DWT MASK: MASK Mask */
-
-/* DWT Comparator Function Register Definitions */
-#define DWT_FUNCTION_MATCHED_Pos 24 /*!< DWT FUNCTION: MATCHED Position */
-#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
-
-#define DWT_FUNCTION_DATAVADDR1_Pos 16 /*!< DWT FUNCTION: DATAVADDR1 Position */
-#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */
-
-#define DWT_FUNCTION_DATAVADDR0_Pos 12 /*!< DWT FUNCTION: DATAVADDR0 Position */
-#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */
-
-#define DWT_FUNCTION_DATAVSIZE_Pos 10 /*!< DWT FUNCTION: DATAVSIZE Position */
-#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
-
-#define DWT_FUNCTION_LNK1ENA_Pos 9 /*!< DWT FUNCTION: LNK1ENA Position */
-#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */
-
-#define DWT_FUNCTION_DATAVMATCH_Pos 8 /*!< DWT FUNCTION: DATAVMATCH Position */
-#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */
-
-#define DWT_FUNCTION_CYCMATCH_Pos 7 /*!< DWT FUNCTION: CYCMATCH Position */
-#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */
-
-#define DWT_FUNCTION_EMITRANGE_Pos 5 /*!< DWT FUNCTION: EMITRANGE Position */
-#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */
-
-#define DWT_FUNCTION_FUNCTION_Pos 0 /*!< DWT FUNCTION: FUNCTION Position */
-#define DWT_FUNCTION_FUNCTION_Msk (0xFUL << DWT_FUNCTION_FUNCTION_Pos) /*!< DWT FUNCTION: FUNCTION Mask */
-
-/*@}*/ /* end of group CMSIS_DWT */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_TPI Trace Port Interface (TPI)
- \brief Type definitions for the Trace Port Interface (TPI)
- @{
- */
-
-/** \brief Structure type to access the Trace Port Interface Register (TPI).
- */
-typedef struct
-{
- __IO uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
- __IO uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
- uint32_t RESERVED0[2];
- __IO uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
- uint32_t RESERVED1[55];
- __IO uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
- uint32_t RESERVED2[131];
- __I uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
- __IO uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
- __I uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
- uint32_t RESERVED3[759];
- __I uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */
- __I uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
- __I uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
- uint32_t RESERVED4[1];
- __I uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
- __I uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
- __IO uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
- uint32_t RESERVED5[39];
- __IO uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
- __IO uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
- uint32_t RESERVED7[8];
- __I uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
- __I uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
-} TPI_Type;
-
-/* TPI Asynchronous Clock Prescaler Register Definitions */
-#define TPI_ACPR_PRESCALER_Pos 0 /*!< TPI ACPR: PRESCALER Position */
-#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL << TPI_ACPR_PRESCALER_Pos) /*!< TPI ACPR: PRESCALER Mask */
-
-/* TPI Selected Pin Protocol Register Definitions */
-#define TPI_SPPR_TXMODE_Pos 0 /*!< TPI SPPR: TXMODE Position */
-#define TPI_SPPR_TXMODE_Msk (0x3UL << TPI_SPPR_TXMODE_Pos) /*!< TPI SPPR: TXMODE Mask */
-
-/* TPI Formatter and Flush Status Register Definitions */
-#define TPI_FFSR_FtNonStop_Pos 3 /*!< TPI FFSR: FtNonStop Position */
-#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
-
-#define TPI_FFSR_TCPresent_Pos 2 /*!< TPI FFSR: TCPresent Position */
-#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
-
-#define TPI_FFSR_FtStopped_Pos 1 /*!< TPI FFSR: FtStopped Position */
-#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
-
-#define TPI_FFSR_FlInProg_Pos 0 /*!< TPI FFSR: FlInProg Position */
-#define TPI_FFSR_FlInProg_Msk (0x1UL << TPI_FFSR_FlInProg_Pos) /*!< TPI FFSR: FlInProg Mask */
-
-/* TPI Formatter and Flush Control Register Definitions */
-#define TPI_FFCR_TrigIn_Pos 8 /*!< TPI FFCR: TrigIn Position */
-#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
-
-#define TPI_FFCR_EnFCont_Pos 1 /*!< TPI FFCR: EnFCont Position */
-#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
-
-/* TPI TRIGGER Register Definitions */
-#define TPI_TRIGGER_TRIGGER_Pos 0 /*!< TPI TRIGGER: TRIGGER Position */
-#define TPI_TRIGGER_TRIGGER_Msk (0x1UL << TPI_TRIGGER_TRIGGER_Pos) /*!< TPI TRIGGER: TRIGGER Mask */
-
-/* TPI Integration ETM Data Register Definitions (FIFO0) */
-#define TPI_FIFO0_ITM_ATVALID_Pos 29 /*!< TPI FIFO0: ITM_ATVALID Position */
-#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
-
-#define TPI_FIFO0_ITM_bytecount_Pos 27 /*!< TPI FIFO0: ITM_bytecount Position */
-#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
-
-#define TPI_FIFO0_ETM_ATVALID_Pos 26 /*!< TPI FIFO0: ETM_ATVALID Position */
-#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
-
-#define TPI_FIFO0_ETM_bytecount_Pos 24 /*!< TPI FIFO0: ETM_bytecount Position */
-#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
-
-#define TPI_FIFO0_ETM2_Pos 16 /*!< TPI FIFO0: ETM2 Position */
-#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
-
-#define TPI_FIFO0_ETM1_Pos 8 /*!< TPI FIFO0: ETM1 Position */
-#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
-
-#define TPI_FIFO0_ETM0_Pos 0 /*!< TPI FIFO0: ETM0 Position */
-#define TPI_FIFO0_ETM0_Msk (0xFFUL << TPI_FIFO0_ETM0_Pos) /*!< TPI FIFO0: ETM0 Mask */
-
-/* TPI ITATBCTR2 Register Definitions */
-#define TPI_ITATBCTR2_ATREADY_Pos 0 /*!< TPI ITATBCTR2: ATREADY Position */
-#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL << TPI_ITATBCTR2_ATREADY_Pos) /*!< TPI ITATBCTR2: ATREADY Mask */
-
-/* TPI Integration ITM Data Register Definitions (FIFO1) */
-#define TPI_FIFO1_ITM_ATVALID_Pos 29 /*!< TPI FIFO1: ITM_ATVALID Position */
-#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
-
-#define TPI_FIFO1_ITM_bytecount_Pos 27 /*!< TPI FIFO1: ITM_bytecount Position */
-#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
-
-#define TPI_FIFO1_ETM_ATVALID_Pos 26 /*!< TPI FIFO1: ETM_ATVALID Position */
-#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
-
-#define TPI_FIFO1_ETM_bytecount_Pos 24 /*!< TPI FIFO1: ETM_bytecount Position */
-#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
-
-#define TPI_FIFO1_ITM2_Pos 16 /*!< TPI FIFO1: ITM2 Position */
-#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
-
-#define TPI_FIFO1_ITM1_Pos 8 /*!< TPI FIFO1: ITM1 Position */
-#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
-
-#define TPI_FIFO1_ITM0_Pos 0 /*!< TPI FIFO1: ITM0 Position */
-#define TPI_FIFO1_ITM0_Msk (0xFFUL << TPI_FIFO1_ITM0_Pos) /*!< TPI FIFO1: ITM0 Mask */
-
-/* TPI ITATBCTR0 Register Definitions */
-#define TPI_ITATBCTR0_ATREADY_Pos 0 /*!< TPI ITATBCTR0: ATREADY Position */
-#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL << TPI_ITATBCTR0_ATREADY_Pos) /*!< TPI ITATBCTR0: ATREADY Mask */
-
-/* TPI Integration Mode Control Register Definitions */
-#define TPI_ITCTRL_Mode_Pos 0 /*!< TPI ITCTRL: Mode Position */
-#define TPI_ITCTRL_Mode_Msk (0x1UL << TPI_ITCTRL_Mode_Pos) /*!< TPI ITCTRL: Mode Mask */
-
-/* TPI DEVID Register Definitions */
-#define TPI_DEVID_NRZVALID_Pos 11 /*!< TPI DEVID: NRZVALID Position */
-#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
-
-#define TPI_DEVID_MANCVALID_Pos 10 /*!< TPI DEVID: MANCVALID Position */
-#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
-
-#define TPI_DEVID_PTINVALID_Pos 9 /*!< TPI DEVID: PTINVALID Position */
-#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
-
-#define TPI_DEVID_MinBufSz_Pos 6 /*!< TPI DEVID: MinBufSz Position */
-#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
-
-#define TPI_DEVID_AsynClkIn_Pos 5 /*!< TPI DEVID: AsynClkIn Position */
-#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
-
-#define TPI_DEVID_NrTraceInput_Pos 0 /*!< TPI DEVID: NrTraceInput Position */
-#define TPI_DEVID_NrTraceInput_Msk (0x1FUL << TPI_DEVID_NrTraceInput_Pos) /*!< TPI DEVID: NrTraceInput Mask */
-
-/* TPI DEVTYPE Register Definitions */
-#define TPI_DEVTYPE_SubType_Pos 0 /*!< TPI DEVTYPE: SubType Position */
-#define TPI_DEVTYPE_SubType_Msk (0xFUL << TPI_DEVTYPE_SubType_Pos) /*!< TPI DEVTYPE: SubType Mask */
-
-#define TPI_DEVTYPE_MajorType_Pos 4 /*!< TPI DEVTYPE: MajorType Position */
-#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
-
-/*@}*/ /* end of group CMSIS_TPI */
-
-
-#if (__MPU_PRESENT == 1)
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_MPU Memory Protection Unit (MPU)
- \brief Type definitions for the Memory Protection Unit (MPU)
- @{
- */
-
-/** \brief Structure type to access the Memory Protection Unit (MPU).
- */
-typedef struct
-{
- __I uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
- __IO uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
- __IO uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
- __IO uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
- __IO uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
- __IO uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */
- __IO uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */
- __IO uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */
- __IO uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */
- __IO uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */
- __IO uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */
-} MPU_Type;
-
-/* MPU Type Register */
-#define MPU_TYPE_IREGION_Pos 16 /*!< MPU TYPE: IREGION Position */
-#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
-
-#define MPU_TYPE_DREGION_Pos 8 /*!< MPU TYPE: DREGION Position */
-#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
-
-#define MPU_TYPE_SEPARATE_Pos 0 /*!< MPU TYPE: SEPARATE Position */
-#define MPU_TYPE_SEPARATE_Msk (1UL << MPU_TYPE_SEPARATE_Pos) /*!< MPU TYPE: SEPARATE Mask */
-
-/* MPU Control Register */
-#define MPU_CTRL_PRIVDEFENA_Pos 2 /*!< MPU CTRL: PRIVDEFENA Position */
-#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
-
-#define MPU_CTRL_HFNMIENA_Pos 1 /*!< MPU CTRL: HFNMIENA Position */
-#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
-
-#define MPU_CTRL_ENABLE_Pos 0 /*!< MPU CTRL: ENABLE Position */
-#define MPU_CTRL_ENABLE_Msk (1UL << MPU_CTRL_ENABLE_Pos) /*!< MPU CTRL: ENABLE Mask */
-
-/* MPU Region Number Register */
-#define MPU_RNR_REGION_Pos 0 /*!< MPU RNR: REGION Position */
-#define MPU_RNR_REGION_Msk (0xFFUL << MPU_RNR_REGION_Pos) /*!< MPU RNR: REGION Mask */
-
-/* MPU Region Base Address Register */
-#define MPU_RBAR_ADDR_Pos 5 /*!< MPU RBAR: ADDR Position */
-#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
-
-#define MPU_RBAR_VALID_Pos 4 /*!< MPU RBAR: VALID Position */
-#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
-
-#define MPU_RBAR_REGION_Pos 0 /*!< MPU RBAR: REGION Position */
-#define MPU_RBAR_REGION_Msk (0xFUL << MPU_RBAR_REGION_Pos) /*!< MPU RBAR: REGION Mask */
-
-/* MPU Region Attribute and Size Register */
-#define MPU_RASR_ATTRS_Pos 16 /*!< MPU RASR: MPU Region Attribute field Position */
-#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
-
-#define MPU_RASR_XN_Pos 28 /*!< MPU RASR: ATTRS.XN Position */
-#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
-
-#define MPU_RASR_AP_Pos 24 /*!< MPU RASR: ATTRS.AP Position */
-#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
-
-#define MPU_RASR_TEX_Pos 19 /*!< MPU RASR: ATTRS.TEX Position */
-#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
-
-#define MPU_RASR_S_Pos 18 /*!< MPU RASR: ATTRS.S Position */
-#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
-
-#define MPU_RASR_C_Pos 17 /*!< MPU RASR: ATTRS.C Position */
-#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
-
-#define MPU_RASR_B_Pos 16 /*!< MPU RASR: ATTRS.B Position */
-#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
-
-#define MPU_RASR_SRD_Pos 8 /*!< MPU RASR: Sub-Region Disable Position */
-#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
-
-#define MPU_RASR_SIZE_Pos 1 /*!< MPU RASR: Region Size Field Position */
-#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
-
-#define MPU_RASR_ENABLE_Pos 0 /*!< MPU RASR: Region enable bit Position */
-#define MPU_RASR_ENABLE_Msk (1UL << MPU_RASR_ENABLE_Pos) /*!< MPU RASR: Region enable bit Disable Mask */
-
-/*@} end of group CMSIS_MPU */
-#endif
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
- \brief Type definitions for the Core Debug Registers
- @{
- */
-
-/** \brief Structure type to access the Core Debug Register (CoreDebug).
- */
-typedef struct
-{
- __IO uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
- __O uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
- __IO uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
- __IO uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
-} CoreDebug_Type;
-
-/* Debug Halting Control and Status Register */
-#define CoreDebug_DHCSR_DBGKEY_Pos 16 /*!< CoreDebug DHCSR: DBGKEY Position */
-#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
-
-#define CoreDebug_DHCSR_S_RESET_ST_Pos 25 /*!< CoreDebug DHCSR: S_RESET_ST Position */
-#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
-
-#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24 /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
-#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
-
-#define CoreDebug_DHCSR_S_LOCKUP_Pos 19 /*!< CoreDebug DHCSR: S_LOCKUP Position */
-#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
-
-#define CoreDebug_DHCSR_S_SLEEP_Pos 18 /*!< CoreDebug DHCSR: S_SLEEP Position */
-#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
-
-#define CoreDebug_DHCSR_S_HALT_Pos 17 /*!< CoreDebug DHCSR: S_HALT Position */
-#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
-
-#define CoreDebug_DHCSR_S_REGRDY_Pos 16 /*!< CoreDebug DHCSR: S_REGRDY Position */
-#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
-
-#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5 /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
-#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
-
-#define CoreDebug_DHCSR_C_MASKINTS_Pos 3 /*!< CoreDebug DHCSR: C_MASKINTS Position */
-#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
-
-#define CoreDebug_DHCSR_C_STEP_Pos 2 /*!< CoreDebug DHCSR: C_STEP Position */
-#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
-
-#define CoreDebug_DHCSR_C_HALT_Pos 1 /*!< CoreDebug DHCSR: C_HALT Position */
-#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
-
-#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0 /*!< CoreDebug DHCSR: C_DEBUGEN Position */
-#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL << CoreDebug_DHCSR_C_DEBUGEN_Pos) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
-
-/* Debug Core Register Selector Register */
-#define CoreDebug_DCRSR_REGWnR_Pos 16 /*!< CoreDebug DCRSR: REGWnR Position */
-#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
-
-#define CoreDebug_DCRSR_REGSEL_Pos 0 /*!< CoreDebug DCRSR: REGSEL Position */
-#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL << CoreDebug_DCRSR_REGSEL_Pos) /*!< CoreDebug DCRSR: REGSEL Mask */
-
-/* Debug Exception and Monitor Control Register */
-#define CoreDebug_DEMCR_TRCENA_Pos 24 /*!< CoreDebug DEMCR: TRCENA Position */
-#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
-
-#define CoreDebug_DEMCR_MON_REQ_Pos 19 /*!< CoreDebug DEMCR: MON_REQ Position */
-#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
-
-#define CoreDebug_DEMCR_MON_STEP_Pos 18 /*!< CoreDebug DEMCR: MON_STEP Position */
-#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
-
-#define CoreDebug_DEMCR_MON_PEND_Pos 17 /*!< CoreDebug DEMCR: MON_PEND Position */
-#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
-
-#define CoreDebug_DEMCR_MON_EN_Pos 16 /*!< CoreDebug DEMCR: MON_EN Position */
-#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
-
-#define CoreDebug_DEMCR_VC_HARDERR_Pos 10 /*!< CoreDebug DEMCR: VC_HARDERR Position */
-#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
-
-#define CoreDebug_DEMCR_VC_INTERR_Pos 9 /*!< CoreDebug DEMCR: VC_INTERR Position */
-#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
-
-#define CoreDebug_DEMCR_VC_BUSERR_Pos 8 /*!< CoreDebug DEMCR: VC_BUSERR Position */
-#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
-
-#define CoreDebug_DEMCR_VC_STATERR_Pos 7 /*!< CoreDebug DEMCR: VC_STATERR Position */
-#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
-
-#define CoreDebug_DEMCR_VC_CHKERR_Pos 6 /*!< CoreDebug DEMCR: VC_CHKERR Position */
-#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
-
-#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5 /*!< CoreDebug DEMCR: VC_NOCPERR Position */
-#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
-
-#define CoreDebug_DEMCR_VC_MMERR_Pos 4 /*!< CoreDebug DEMCR: VC_MMERR Position */
-#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
-
-#define CoreDebug_DEMCR_VC_CORERESET_Pos 0 /*!< CoreDebug DEMCR: VC_CORERESET Position */
-#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL << CoreDebug_DEMCR_VC_CORERESET_Pos) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
-
-/*@} end of group CMSIS_CoreDebug */
-
-
-/** \ingroup CMSIS_core_register
- \defgroup CMSIS_core_base Core Definitions
- \brief Definitions for base addresses, unions, and structures.
- @{
- */
-
-/* Memory mapping of Cortex-M3 Hardware */
-#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
-#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
-#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
-#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
-#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
-#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
-#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
-#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
-
-#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
-#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
-#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
-#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
-#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
-#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
-#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
-#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */
-
-#if (__MPU_PRESENT == 1)
- #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
- #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
-#endif
-
-/*@} */
-
-
-
-/*******************************************************************************
- * Hardware Abstraction Layer
- Core Function Interface contains:
- - Core NVIC Functions
- - Core SysTick Functions
- - Core Debug Functions
- - Core Register Access Functions
- ******************************************************************************/
-/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
-*/
-
-
-
-/* ########################## NVIC functions #################################### */
-/** \ingroup CMSIS_Core_FunctionInterface
- \defgroup CMSIS_Core_NVICFunctions NVIC Functions
- \brief Functions that manage interrupts and exceptions via the NVIC.
- @{
- */
-
-/** \brief Set Priority Grouping
-
- The function sets the priority grouping field using the required unlock sequence.
- The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
- Only values from 0..7 are used.
- In case of a conflict between priority grouping and available
- priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
-
- \param [in] PriorityGroup Priority grouping field.
- */
-static inline void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
-{
- uint32_t reg_value;
- uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07); /* only values 0..7 are used */
-
- reg_value = SCB->AIRCR; /* read old register configuration */
- reg_value &= ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk); /* clear bits to change */
- reg_value = (reg_value |
- ((uint32_t)0x5FA << SCB_AIRCR_VECTKEY_Pos) |
- (PriorityGroupTmp << 8)); /* Insert write key and priorty group */
- SCB->AIRCR = reg_value;
-}
-
-
-/** \brief Get Priority Grouping
-
- The function reads the priority grouping field from the NVIC Interrupt Controller.
-
- \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
- */
-static inline uint32_t NVIC_GetPriorityGrouping(void)
-{
- return ((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos); /* read priority grouping field */
-}
-
-
-/** \brief Enable External Interrupt
-
- The function enables a device-specific interrupt in the NVIC interrupt controller.
-
- \param [in] IRQn External interrupt number. Value cannot be negative.
- */
-static inline void NVIC_EnableIRQ(IRQn_Type IRQn)
-{
- NVIC->ISER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* enable interrupt */
-}
-
-
-/** \brief Disable External Interrupt
-
- The function disables a device-specific interrupt in the NVIC interrupt controller.
-
- \param [in] IRQn External interrupt number. Value cannot be negative.
- */
-static inline void NVIC_DisableIRQ(IRQn_Type IRQn)
-{
- NVIC->ICER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* disable interrupt */
-}
-
-
-/** \brief Get Pending Interrupt
-
- The function reads the pending register in the NVIC and returns the pending bit
- for the specified interrupt.
-
- \param [in] IRQn Interrupt number.
-
- \return 0 Interrupt status is not pending.
- \return 1 Interrupt status is pending.
- */
-static inline uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
-{
- return((uint32_t) ((NVIC->ISPR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if pending else 0 */
-}
-
-
-/** \brief Set Pending Interrupt
-
- The function sets the pending bit of an external interrupt.
-
- \param [in] IRQn Interrupt number. Value cannot be negative.
- */
-static inline void NVIC_SetPendingIRQ(IRQn_Type IRQn)
-{
- NVIC->ISPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* set interrupt pending */
-}
-
-
-/** \brief Clear Pending Interrupt
-
- The function clears the pending bit of an external interrupt.
-
- \param [in] IRQn External interrupt number. Value cannot be negative.
- */
-static inline void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
-{
- NVIC->ICPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */
-}
-
-
-/** \brief Get Active Interrupt
-
- The function reads the active register in NVIC and returns the active bit.
-
- \param [in] IRQn Interrupt number.
-
- \return 0 Interrupt status is not active.
- \return 1 Interrupt status is active.
- */
-static inline uint32_t NVIC_GetActive(IRQn_Type IRQn)
-{
- return((uint32_t)((NVIC->IABR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if active else 0 */
-}
-
-
-/** \brief Set Interrupt Priority
-
- The function sets the priority of an interrupt.
-
- \note The priority cannot be set for every core interrupt.
-
- \param [in] IRQn Interrupt number.
- \param [in] priority Priority to set.
- */
-static inline void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
-{
- if(IRQn < 0) {
- SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for Cortex-M System Interrupts */
- else {
- NVIC->IP[(uint32_t)(IRQn)] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for device specific Interrupts */
-}
-
-
-/** \brief Get Interrupt Priority
-
- The function reads the priority of an interrupt. The interrupt
- number can be positive to specify an external (device specific)
- interrupt, or negative to specify an internal (core) interrupt.
-
-
- \param [in] IRQn Interrupt number.
- \return Interrupt Priority. Value is aligned automatically to the implemented
- priority bits of the microcontroller.
- */
-static inline uint32_t NVIC_GetPriority(IRQn_Type IRQn)
-{
-
- if(IRQn < 0) {
- return((uint32_t)(SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] >> (8 - __NVIC_PRIO_BITS))); } /* get priority for Cortex-M system interrupts */
- else {
- return((uint32_t)(NVIC->IP[(uint32_t)(IRQn)] >> (8 - __NVIC_PRIO_BITS))); } /* get priority for device specific interrupts */
-}
-
-
-/** \brief Encode Priority
-
- The function encodes the priority for an interrupt with the given priority group,
- preemptive priority value, and subpriority value.
- In case of a conflict between priority grouping and available
- priority bits (__NVIC_PRIO_BITS), the samllest possible priority group is set.
-
- \param [in] PriorityGroup Used priority group.
- \param [in] PreemptPriority Preemptive priority value (starting from 0).
- \param [in] SubPriority Subpriority value (starting from 0).
- \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
- */
-static inline uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
-{
- uint32_t PriorityGroupTmp = (PriorityGroup & 0x07); /* only values 0..7 are used */
- uint32_t PreemptPriorityBits;
- uint32_t SubPriorityBits;
-
- PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
- SubPriorityBits = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;
-
- return (
- ((PreemptPriority & ((1 << (PreemptPriorityBits)) - 1)) << SubPriorityBits) |
- ((SubPriority & ((1 << (SubPriorityBits )) - 1)))
- );
-}
-
-
-/** \brief Decode Priority
-
- The function decodes an interrupt priority value with a given priority group to
- preemptive priority value and subpriority value.
- In case of a conflict between priority grouping and available
- priority bits (__NVIC_PRIO_BITS) the samllest possible priority group is set.
-
- \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
- \param [in] PriorityGroup Used priority group.
- \param [out] pPreemptPriority Preemptive priority value (starting from 0).
- \param [out] pSubPriority Subpriority value (starting from 0).
- */
-static inline void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority)
-{
- uint32_t PriorityGroupTmp = (PriorityGroup & 0x07); /* only values 0..7 are used */
- uint32_t PreemptPriorityBits;
- uint32_t SubPriorityBits;
-
- PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
- SubPriorityBits = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;
-
- *pPreemptPriority = (Priority >> SubPriorityBits) & ((1 << (PreemptPriorityBits)) - 1);
- *pSubPriority = (Priority ) & ((1 << (SubPriorityBits )) - 1);
-}
-
-
-/** \brief System Reset
-
- The function initiates a system reset request to reset the MCU.
- */
-static inline void NVIC_SystemReset(void)
-{
- __DSB(); /* Ensure all outstanding memory accesses included
- buffered write are completed before reset */
- SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) |
- (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
- SCB_AIRCR_SYSRESETREQ_Msk); /* Keep priority group unchanged */
- __DSB(); /* Ensure completion of memory access */
- while(1); /* wait until reset */
-}
-
-/*@} end of CMSIS_Core_NVICFunctions */
-
-
-
-/* ################################## SysTick function ############################################ */
-/** \ingroup CMSIS_Core_FunctionInterface
- \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
- \brief Functions that configure the System.
- @{
- */
-
-#if (__Vendor_SysTickConfig == 0)
-
-/** \brief System Tick Configuration
-
- The function initializes the System Timer and its interrupt, and starts the System Tick Timer.
- Counter is in free running mode to generate periodic interrupts.
-
- \param [in] ticks Number of ticks between two interrupts.
-
- \return 0 Function succeeded.
- \return 1 Function failed.
-
- \note When the variable __Vendor_SysTickConfig is set to 1, then the
- function SysTick_Config is not included. In this case, the file device.h
- must contain a vendor-specific implementation of this function.
-
- */
-static inline uint32_t SysTick_Config(uint32_t ticks)
-{
- if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk) return (1); /* Reload value impossible */
-
- SysTick->LOAD = ticks - 1; /* set reload register */
- NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority for Systick Interrupt */
- SysTick->VAL = 0; /* Load the SysTick Counter Value */
- SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
- SysTick_CTRL_TICKINT_Msk |
- SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
- return (0); /* Function successful */
-}
-
-#endif
-
-/*@} end of CMSIS_Core_SysTickFunctions */
-
-
-
-/* ##################################### Debug In/Output function ########################################### */
-/** \ingroup CMSIS_Core_FunctionInterface
- \defgroup CMSIS_core_DebugFunctions ITM Functions
- \brief Functions that access the ITM debug interface.
- @{
- */
-
-extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
-#define ITM_RXBUFFER_EMPTY 0x5AA55AA5 /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
-
-
-/** \brief ITM Send Character
-
- The function transmits a character via the ITM channel 0, and
- \li Just returns when no debugger is connected that has booked the output.
- \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
-
- \param [in] ch Character to transmit.
-
- \returns Character to transmit.
- */
-static inline uint32_t ITM_SendChar (uint32_t ch)
-{
- if ((ITM->TCR & ITM_TCR_ITMENA_Msk) && /* ITM enabled */
- (ITM->TER & (1UL << 0) ) ) /* ITM Port #0 enabled */
- {
- while (ITM->PORT[0].u32 == 0) __nop();
- ITM->PORT[0].u8 = (uint8_t) ch;
- }
- return (ch);
-}
-
-
-/** \brief ITM Receive Character
-
- The function inputs a character via the external variable \ref ITM_RxBuffer.
-
- \return Received character.
- \return -1 No character pending.
- */
-static inline int32_t ITM_ReceiveChar (void) {
- int32_t ch = -1; /* no character available */
-
- if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) {
- ch = ITM_RxBuffer;
- ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
- }
-
- return (ch);
-}
-
-
-/** \brief ITM Check Character
-
- The function checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
-
- \return 0 No character available.
- \return 1 Character available.
- */
-static inline int32_t ITM_CheckChar (void) {
-
- if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) {
- return (0); /* no character available */
- } else {
- return (1); /* character available */
- }
-}
-
-/*@} end of CMSIS_core_DebugFunctions */
-
-#endif /* __CORE_CM3_H_DEPENDANT */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CMSIS_GENERIC */
-
diff --git a/platforms_startup/armcc/LPC1833/core_cmFunc.h b/platforms_startup/armcc/LPC1833/core_cmFunc.h
deleted file mode 100644
index 526e1ef07..000000000
--- a/platforms_startup/armcc/LPC1833/core_cmFunc.h
+++ /dev/null
@@ -1,312 +0,0 @@
-/**************************************************************************//**
- * @file core_cmFunc.h
- * @brief CMSIS Cortex-M Core Function Access Header File
- * @version V3.20
- * @date 25. February 2013
- *
- * @note
- *
- ******************************************************************************/
-/* Copyright (c) 2009 - 2013 ARM LIMITED
-
- All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- - 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.
- - Neither the name of ARM nor the names of its contributors may be used
- to endorse or promote products derived from this software without
- specific prior written permission.
- *
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS 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.
- ---------------------------------------------------------------------------*/
-
-
-#ifndef __CORE_CMFUNC_H
-#define __CORE_CMFUNC_H
-
-
-/* ########################### Core Function Access ########################### */
-/** \ingroup CMSIS_Core_FunctionInterface
- \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
- @{
- */
-
-/* ARM armcc specific functions */
-
-#if (__ARMCC_VERSION < 400677)
- #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
-#endif
-
-/* intrinsic void __enable_irq(); */
-/* intrinsic void __disable_irq(); */
-
-/** \brief Get Control Register
-
- This function returns the content of the Control Register.
-
- \return Control Register value
- */
-static inline uint32_t __get_CONTROL(void)
-{
- register uint32_t __regControl __asm("control");
- return(__regControl);
-}
-
-
-/** \brief Set Control Register
-
- This function writes the given value to the Control Register.
-
- \param [in] control Control Register value to set
- */
-static inline void __set_CONTROL(uint32_t control)
-{
- register uint32_t __regControl __asm("control");
- __regControl = control;
-}
-
-
-/** \brief Get IPSR Register
-
- This function returns the content of the IPSR Register.
-
- \return IPSR Register value
- */
-static inline uint32_t __get_IPSR(void)
-{
- register uint32_t __regIPSR __asm("ipsr");
- return(__regIPSR);
-}
-
-
-/** \brief Get APSR Register
-
- This function returns the content of the APSR Register.
-
- \return APSR Register value
- */
-static inline uint32_t __get_APSR(void)
-{
- register uint32_t __regAPSR __asm("apsr");
- return(__regAPSR);
-}
-
-
-/** \brief Get xPSR Register
-
- This function returns the content of the xPSR Register.
-
- \return xPSR Register value
- */
-static inline uint32_t __get_xPSR(void)
-{
- register uint32_t __regXPSR __asm("xpsr");
- return(__regXPSR);
-}
-
-
-/** \brief Get Process Stack Pointer
-
- This function returns the current value of the Process Stack Pointer (PSP).
-
- \return PSP Register value
- */
-static inline uint32_t __get_PSP(void)
-{
- register uint32_t __regProcessStackPointer __asm("psp");
- return(__regProcessStackPointer);
-}
-
-
-/** \brief Set Process Stack Pointer
-
- This function assigns the given value to the Process Stack Pointer (PSP).
-
- \param [in] topOfProcStack Process Stack Pointer value to set
- */
-static inline void __set_PSP(uint32_t topOfProcStack)
-{
- register uint32_t __regProcessStackPointer __asm("psp");
- __regProcessStackPointer = topOfProcStack;
-}
-
-
-/** \brief Get Main Stack Pointer
-
- This function returns the current value of the Main Stack Pointer (MSP).
-
- \return MSP Register value
- */
-static inline uint32_t __get_MSP(void)
-{
- register uint32_t __regMainStackPointer __asm("msp");
- return(__regMainStackPointer);
-}
-
-
-/** \brief Set Main Stack Pointer
-
- This function assigns the given value to the Main Stack Pointer (MSP).
-
- \param [in] topOfMainStack Main Stack Pointer value to set
- */
-static inline void __set_MSP(uint32_t topOfMainStack)
-{
- register uint32_t __regMainStackPointer __asm("msp");
- __regMainStackPointer = topOfMainStack;
-}
-
-
-/** \brief Get Priority Mask
-
- This function returns the current state of the priority mask bit from the Priority Mask Register.
-
- \return Priority Mask value
- */
-static inline uint32_t __get_PRIMASK(void)
-{
- register uint32_t __regPriMask __asm("primask");
- return(__regPriMask);
-}
-
-
-/** \brief Set Priority Mask
-
- This function assigns the given value to the Priority Mask Register.
-
- \param [in] priMask Priority Mask
- */
-static inline void __set_PRIMASK(uint32_t priMask)
-{
- register uint32_t __regPriMask __asm("primask");
- __regPriMask = (priMask);
-}
-
-
-#if (__CORTEX_M >= 0x03)
-
-/** \brief Enable FIQ
-
- This function enables FIQ interrupts by clearing the F-bit in the CPSR.
- Can only be executed in Privileged modes.
- */
-#define __enable_fault_irq __enable_fiq
-
-
-/** \brief Disable FIQ
-
- This function disables FIQ interrupts by setting the F-bit in the CPSR.
- Can only be executed in Privileged modes.
- */
-#define __disable_fault_irq __disable_fiq
-
-
-/** \brief Get Base Priority
-
- This function returns the current value of the Base Priority register.
-
- \return Base Priority register value
- */
-static inline uint32_t __get_BASEPRI(void)
-{
- register uint32_t __regBasePri __asm("basepri");
- return(__regBasePri);
-}
-
-
-/** \brief Set Base Priority
-
- This function assigns the given value to the Base Priority register.
-
- \param [in] basePri Base Priority value to set
- */
-static inline void __set_BASEPRI(uint32_t basePri)
-{
- register uint32_t __regBasePri __asm("basepri");
- __regBasePri = (basePri & 0xff);
-}
-
-
-/** \brief Get Fault Mask
-
- This function returns the current value of the Fault Mask register.
-
- \return Fault Mask register value
- */
-static inline uint32_t __get_FAULTMASK(void)
-{
- register uint32_t __regFaultMask __asm("faultmask");
- return(__regFaultMask);
-}
-
-
-/** \brief Set Fault Mask
-
- This function assigns the given value to the Fault Mask register.
-
- \param [in] faultMask Fault Mask value to set
- */
-static inline void __set_FAULTMASK(uint32_t faultMask)
-{
- register uint32_t __regFaultMask __asm("faultmask");
- __regFaultMask = (faultMask & (uint32_t)1);
-}
-
-#endif /* (__CORTEX_M >= 0x03) */
-
-
-#if (__CORTEX_M == 0x04)
-
-/** \brief Get FPSCR
-
- This function returns the current value of the Floating Point Status/Control register.
-
- \return Floating Point Status/Control register value
- */
-static inline uint32_t __get_FPSCR(void)
-{
-#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
- register uint32_t __regfpscr __asm("fpscr");
- return(__regfpscr);
-#else
- return(0);
-#endif
-}
-
-
-/** \brief Set FPSCR
-
- This function assigns the given value to the Floating Point Status/Control register.
-
- \param [in] fpscr Floating Point Status/Control value to set
- */
-static inline void __set_FPSCR(uint32_t fpscr)
-{
-#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
- register uint32_t __regfpscr __asm("fpscr");
- __regfpscr = (fpscr);
-#endif
-}
-
-#endif /* (__CORTEX_M == 0x04) */
-
-
-
-/*@} end of CMSIS_Core_RegAccFunctions */
-
-
-#endif /* __CORE_CMFUNC_H */
diff --git a/platforms_startup/armcc/LPC1833/core_cmInstr.h b/platforms_startup/armcc/LPC1833/core_cmInstr.h
deleted file mode 100644
index a3043476b..000000000
--- a/platforms_startup/armcc/LPC1833/core_cmInstr.h
+++ /dev/null
@@ -1,303 +0,0 @@
-/**************************************************************************//**
- * @file core_cmInstr.h
- * @brief CMSIS Cortex-M Core Instruction Access Header File
- * @version V3.20
- * @date 05. March 2013
- *
- * @note
- *
- ******************************************************************************/
-/* Copyright (c) 2009 - 2013 ARM LIMITED
-
- All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- - 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.
- - Neither the name of ARM nor the names of its contributors may be used
- to endorse or promote products derived from this software without
- specific prior written permission.
- *
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS 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.
- ---------------------------------------------------------------------------*/
-
-
-#ifndef __CORE_CMINSTR_H
-#define __CORE_CMINSTR_H
-
-
-#pragma push
-#pragma diag_suppress 667
-
-
-/* ########################## Core Instruction Access ######################### */
-/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
- Access to dedicated instructions
- @{
-*/
-
-/* ARM armcc specific functions */
-
-#if (__ARMCC_VERSION < 400677)
- #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
-#endif
-
-
-/** \brief No Operation
-
- No Operation does nothing. This instruction can be used for code alignment purposes.
- */
-#define __NOP __nop
-
-
-/** \brief Wait For Interrupt
-
- Wait For Interrupt is a hint instruction that suspends execution
- until one of a number of events occurs.
- */
-#define __WFI __wfi
-
-
-/** \brief Wait For Event
-
- Wait For Event is a hint instruction that permits the processor to enter
- a low-power state until one of a number of events occurs.
- */
-#define __WFE __wfe
-
-
-/** \brief Send Event
-
- Send Event is a hint instruction. It causes an event to be signaled to the CPU.
- */
-#define __SEV __sev
-
-
-/** \brief Instruction Synchronization Barrier
-
- Instruction Synchronization Barrier flushes the pipeline in the processor,
- so that all instructions following the ISB are fetched from cache or
- memory, after the instruction has been completed.
- */
-#define __ISB() __isb(0xF)
-
-
-/** \brief Data Synchronization Barrier
-
- This function acts as a special kind of Data Memory Barrier.
- It completes when all explicit memory accesses before this instruction complete.
- */
-#define __DSB() __dsb(0xF)
-
-
-/** \brief Data Memory Barrier
-
- This function ensures the apparent order of the explicit memory operations before
- and after the instruction, without ensuring their completion.
- */
-#define __DMB() __dmb(0xF)
-
-
-/** \brief Reverse byte order (32 bit)
-
- This function reverses the byte order in integer value.
-
- \param [in] value Value to reverse
- \return Reversed value
- */
-#define __REV __rev
-
-
-/** \brief Reverse byte order (16 bit)
-
- This function reverses the byte order in two unsigned short values.
-
- \param [in] value Value to reverse
- \return Reversed value
- */
-#ifndef __NO_EMBEDDED_ASM
-__attribute__((section(".rev16_text"))) static inline __asm uint32_t __REV16(uint32_t value)
-{
- rev16 r0, r0
- bx lr
-}
-#endif
-
-/** \brief Reverse byte order in signed short value
-
- This function reverses the byte order in a signed short value with sign extension to integer.
-
- \param [in] value Value to reverse
- \return Reversed value
- */
-#ifndef __NO_EMBEDDED_ASM
-__attribute__((section(".revsh_text"))) static inline __asm int32_t __REVSH(int32_t value)
-{
- revsh r0, r0
- bx lr
-}
-#endif
-
-
-/** \brief Rotate Right in unsigned value (32 bit)
-
- This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
-
- \param [in] value Value to rotate
- \param [in] value Number of Bits to rotate
- \return Rotated value
- */
-#define __ROR __ror
-
-
-/** \brief Breakpoint
-
- This function causes the processor to enter Debug state.
- Debug tools can use this to investigate system state when the instruction at a particular address is reached.
-
- \param [in] value is ignored by the processor.
- If required, a debugger can use it to store additional information about the breakpoint.
- */
-#define __BKPT(value) __breakpoint(value)
-
-
-#if (__CORTEX_M >= 0x03)
-
-/** \brief Reverse bit order of value
-
- This function reverses the bit order of the given value.
-
- \param [in] value Value to reverse
- \return Reversed value
- */
-#define __RBIT __rbit
-
-
-/** \brief LDR Exclusive (8 bit)
-
- This function performs a exclusive LDR command for 8 bit value.
-
- \param [in] ptr Pointer to data
- \return value of type uint8_t at (*ptr)
- */
-#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
-
-
-/** \brief LDR Exclusive (16 bit)
-
- This function performs a exclusive LDR command for 16 bit values.
-
- \param [in] ptr Pointer to data
- \return value of type uint16_t at (*ptr)
- */
-#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
-
-
-/** \brief LDR Exclusive (32 bit)
-
- This function performs a exclusive LDR command for 32 bit values.
-
- \param [in] ptr Pointer to data
- \return value of type uint32_t at (*ptr)
- */
-#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
-
-
-/** \brief STR Exclusive (8 bit)
-
- This function performs a exclusive STR command for 8 bit values.
-
- \param [in] value Value to store
- \param [in] ptr Pointer to location
- \return 0 Function succeeded
- \return 1 Function failed
- */
-#define __STREXB(value, ptr) __strex(value, ptr)
-
-
-/** \brief STR Exclusive (16 bit)
-
- This function performs a exclusive STR command for 16 bit values.
-
- \param [in] value Value to store
- \param [in] ptr Pointer to location
- \return 0 Function succeeded
- \return 1 Function failed
- */
-#define __STREXH(value, ptr) __strex(value, ptr)
-
-
-/** \brief STR Exclusive (32 bit)
-
- This function performs a exclusive STR command for 32 bit values.
-
- \param [in] value Value to store
- \param [in] ptr Pointer to location
- \return 0 Function succeeded
- \return 1 Function failed
- */
-#define __STREXW(value, ptr) __strex(value, ptr)
-
-
-/** \brief Remove the exclusive lock
-
- This function removes the exclusive lock which is created by LDREX.
-
- */
-#define __CLREX __clrex
-
-
-/** \brief Signed Saturate
-
- This function saturates a signed value.
-
- \param [in] value Value to be saturated
- \param [in] sat Bit position to saturate to (1..32)
- \return Saturated value
- */
-#define __SSAT __ssat
-
-
-/** \brief Unsigned Saturate
-
- This function saturates an unsigned value.
-
- \param [in] value Value to be saturated
- \param [in] sat Bit position to saturate to (0..31)
- \return Saturated value
- */
-#define __USAT __usat
-
-
-/** \brief Count leading zeros
-
- This function counts the number of leading zeros of a data value.
-
- \param [in] value Value to count the leading zeros
- \return number of leading zeros in value
- */
-#define __CLZ __clz
-
-#endif /* (__CORTEX_M >= 0x03) */
-
-
-
-
-/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
-
-#pragma pop
-
-#endif /* __CORE_CMINSTR_H */
diff --git a/platforms_startup/armcc/LPC1833/retarget.c b/platforms_startup/armcc/LPC1833/retarget.c
deleted file mode 100644
index 5be075edd..000000000
--- a/platforms_startup/armcc/LPC1833/retarget.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * @brief IO redirection support
- *
- * This file adds re-direction support to the library for various
- * projects. It can be configured in one of 3 ways - no redirection,
- * redirection via a UART, or redirection via semihosting. If DEBUG
- * is not defined, all printf statements will do nothing with the
- * output being throw away. If DEBUG is defined, then the choice of
- * output is selected by the DEBUG_SEMIHOSTING define. If the
- * DEBUG_SEMIHOSTING is not defined, then output is redirected via
- * the UART. If DEBUG_SEMIHOSTING is defined, then output will be
- * attempted to be redirected via semihosting. If the UART method
- * is used, then the Board_UARTPutChar and Board_UARTGetChar
- * functions must be defined to be used by this driver and the UART
- * must already be initialized to the correct settings.
- *
- * @note
- * Copyright(C) NXP Semiconductors, 2012
- * All rights reserved.
- *
- * @par
- * Software that is described herein is for illustrative purposes only
- * which provides customers with programming information regarding the
- * LPC products. This software is supplied "AS IS" without any warranties of
- * any kind, and NXP Semiconductors and its licensor disclaim any and
- * all warranties, express or implied, including all implied warranties of
- * merchantability, fitness for a particular purpose and non-infringement of
- * intellectual property rights. NXP Semiconductors assumes no responsibility
- * or liability for the use of the software, conveys no license or rights under any
- * patent, copyright, mask work right, or any other intellectual property rights in
- * or to any products. NXP Semiconductors reserves the right to make changes
- * in the software without notification. NXP Semiconductors also makes no
- * representation or warranty that such application will be suitable for the
- * specified use without further testing or modification.
- *
- * @par
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, under NXP Semiconductors' and its
- * licensor's relevant copyrights in the software, without fee, provided that it
- * is used in conjunction with NXP Semiconductors microcontrollers. This
- * copyright, permission, and disclaimer notice must appear in all copies of
- * this code.
- */
-
-
-/* Keil (Realview) support */
-#include
-#include
-#include
-#include
-
-#include "cmsis_18xx.h"
-
-
-#pragma import(__use_no_semihosting_swi)
-
-/* Standard IO device handles. */
-const FILEHANDLE STDIN = 0x8001;
-const FILEHANDLE STDOUT = 0x8002;
-const FILEHANDLE STDERR = 0x8003;
-
-const char __stdin_name[] = "STDIN";
-const char __stdout_name[] = "STDOUT";
-const char __stderr_name[] = "STDERR";
-
-struct __FILE { int handle; /* Add whatever you need here */ };
-
-
-
-/* number of system timer ticks */
-static time_t timer_ticks = 0;
-
-
-FILEHANDLE _sys_open(const char *name, int openmode)
-{
- FILEHANDLE rc;
- /* Register standard Input Output devices. */
- if (strcmp(name, "STDIN") == 0) rc = STDIN;
- else if (strcmp(name, "STDOUT") == 0) rc = STDOUT;
- else if (strcmp(name, "STDERR") == 0) rc = STDERR;
- else rc = -1;
- return (rc);
-}
-
-
-int _sys_close(FILEHANDLE fh)
-{
- return fh > 0x8000 ? 0 : 0;
-}
-
-
-/* Write to SWO */
-void _ttywrch(int ch)
-{
- ITM_SendChar(ch);
-}
-
-
-int _sys_istty(FILEHANDLE fh)
-{
- return fh > 0x8000 ? 1 : 0;
-}
-
-
-int _sys_seek(FILEHANDLE fh, long pos)
-{
- return fh > 0x8000 ? -1 : 0;
-}
-
-
-long _sys_flen(FILEHANDLE fh)
-{
- return fh > 0x8000 ? 0 : -1;
-}
-
-/*--------------------------- _sys_tmpnam ------------------------------------*/
-int _sys_tmpnam (char *name, int sig, unsigned maxlen)
-{
- return (1);
-}
-
-
-int _sys_write(FILEHANDLE fh, const unsigned char *buf,
- unsigned len, int mode)
-{
- int rc;
- if (fh == STDOUT) {
- while (len) {
- _ttywrch(*buf);
- buf++;
- len--;
- rc = 0;
- }
- } else if (fh > 0x8000) rc = -1;
- else rc = -1;
- return rc;
-}
-
-int _sys_read(FILEHANDLE fh, unsigned char *buf,
- unsigned len, int mode)
-{
- return -1;
-}
-
-
-void _sys_exit(int return_code)
-{
-label:
- __WFI();
- goto label; /* endless loop */
-}
-
-
-char *_sys_command_string(char *cmd, int len)
-{
- const char * const arg[] = {
- "tst.axf",
- "-v",
- "-gSimpleStringBuffer",
- "-ojunit"};
- int i, j;
- char *rc = cmd;
- if (len) {
- /* Specify commandline arguments here as needed */
- len = sizeof(arg) / sizeof(char *);
- for (i = 0; i < len; i++) {
- j = strlen(arg[i])+1;
- if (cmd - rc + j > len) {
- rc = NULL;
- break;
- }
- memcpy(cmd, arg[i], j);
- cmd += j;
- }
- if (rc) rc = cmd;
- } else rc = NULL;
- return rc;
-}
-
-
-void _clock_init(void)
-{
- SysTick_Config(CGU_IRC_FREQ / 1000); /* 1 ms system ticks interrupt period */
-}
-
-
-clock_t clock(void)
-{
- return timer_ticks;
-}
-
-
-time_t time(time_t *timer)
-{
- time_t rc = timer_ticks / CLOCKS_PER_SEC;
- if (timer) *timer = rc;
- return rc;
-}
-
-
-/* IRQ handler for Sys Tick timer */
-__irq void SysTick_Handler(void)
-{
- timer_ticks++;
-}
-
-
-/*
- * Замена вÑтроенной в Keil MDK-ARM функции, ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ Ñоздаёт ÑвÑзанный ÑпиÑок
- * адреÑов деÑтрукторов глобальных или ÑтатичеÑких объектов в "куче" при
- * инициализации окружениÑ.
- * Так как не планируетÑÑ Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð¸Ðµ программы, то ни один такой деÑтруктор не
- * должен вызыватьÑÑ, и можно подменить Ñтандартную верÑию __aeabi_atexit на
- * другую, ÐºÐ¾Ñ‚Ð¾Ñ€Ð°Ñ Ð½Ðµ будет Ñоздавать такой ÑпиÑок в "куче".
- * Ð˜Ð´ÐµÑ Ð²Ð·Ñта отÑюда
- * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka3951.html
- * Пример реализации взÑÑ‚ отÑюда
- * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0041d/IHI0041D_cppabi.pdf
- */
-int __aeabi_atexit(void* object, void (*destroyer)(void*), void* dso_handle)
-{
- return 1; // 0: failed; non-0: OK
-// return __cxa_atexit(destroyer, object, dso_handle); /* ÑÑ‚Ð°Ð½Ð´Ð°Ñ€Ñ‚Ð½Ð°Ñ Ð²ÐµÑ€ÑÐ¸Ñ Ð¸Ð· Keil MDK-ARM */
-}
diff --git a/platforms_startup/armcc/LPC1833/startup_LPC18xx.asm b/platforms_startup/armcc/LPC1833/startup_LPC18xx.asm
deleted file mode 100644
index b730ee5bc..000000000
--- a/platforms_startup/armcc/LPC1833/startup_LPC18xx.asm
+++ /dev/null
@@ -1,337 +0,0 @@
-;/***********************************************************************
-; * @brief: LPC18xx/43xx M3/M4 startup code
-; *
-; * @note
-; * Copyright(C) NXP Semiconductors, 2012
-; * All rights reserved.
-; *
-; * @par
-; * Software that is described herein is for illustrative purposes only
-; * which provides customers with programming information regarding the
-; * LPC products. This software is supplied "AS IS" without any warranties of
-; * any kind, and NXP Semiconductors and its licensor disclaim any and
-; * all warranties, express or implied, including all implied warranties of
-; * merchantability, fitness for a particular purpose and non-infringement of
-; * intellectual property rights. NXP Semiconductors assumes no responsibility
-; * or liability for the use of the software, conveys no license or rights under any
-; * patent, copyright, mask work right, or any other intellectual property rights in
-; * or to any products. NXP Semiconductors reserves the right to make changes
-; * in the software without notification. NXP Semiconductors also makes no
-; * representation or warranty that such application will be suitable for the
-; * specified use without further testing or modification.
-; *
-; * @par
-; * Permission to use, copy, modify, and distribute this software and its
-; * documentation is hereby granted, under NXP Semiconductors' and its
-; * licensor's relevant copyrights in the software, without fee, provided that it
-; * is used in conjunction with NXP Semiconductors microcontrollers. This
-; * copyright, permission, and disclaimer notice must appear in all copies of
-; * this code.
-; */
-
-; Stack Configuration
-; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
-;
-
-Stack_Size EQU 0x00002000
-
- AREA STACK, NOINIT, READWRITE, ALIGN=3
-Stack_Mem SPACE Stack_Size
-__initial_sp
-
-; Heap Configuration
-; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
-;
-
-Heap_Size EQU 0x00004000
-
- AREA HEAP, NOINIT, READWRITE, ALIGN=3
-__heap_base
-Heap_Mem SPACE Heap_Size
-__heap_limit
-
- PRESERVE8
- THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
- AREA RESET, CODE, READONLY
- EXPORT __Vectors
-
-Sign_Value EQU 0x5A5A5A5A
-
-__Vectors DCD __initial_sp ; 0 Top of Stack
- DCD Reset_Handler ; 1 Reset Handler
- DCD NMI_Handler ; 2 NMI Handler
- DCD HardFault_Handler ; 3 Hard Fault Handler
- DCD MemManage_Handler ; 4 MPU Fault Handler
- DCD BusFault_Handler ; 5 Bus Fault Handler
- DCD UsageFault_Handler ; 6 Usage Fault Handler
- DCD Sign_Value ; 7 Reserved
- DCD UnHandled_Vector ; 8 Reserved
- DCD UnHandled_Vector ; 9 Reserved
- DCD UnHandled_Vector ; 10 Reserved
- DCD SVC_Handler ; 11 SVCall Handler
- DCD DebugMon_Handler ; 12 Debug Monitor Handler
- DCD UnHandled_Vector ; 13 Reserved
- DCD PendSV_Handler ; 14 PendSV Handler
- DCD SysTick_Handler ; 15 SysTick Handler
-
- ; External Interrupts
- DCD DAC_IRQHandler ; 16 D/A Converter
- DCD M0APP_IRQHandler ; 17 M0APP IRQ handler (LPC43XX ONLY)
- DCD DMA_IRQHandler ; 18 General Purpose DMA
- DCD UnHandled_Vector ; 19 Reserved
- DCD FLASH_EEPROM_IRQHandler ; 20 ORed flash bank A, flash bank B, EEPROM interrupts
- DCD ETH_IRQHandler ; 21 Ethernet
- DCD SDIO_IRQHandler ; 22 SD/MMC
- DCD LCD_IRQHandler ; 23 LCD
- DCD USB0_IRQHandler ; 24 USB0
- DCD USB1_IRQHandler ; 25 USB1
- DCD SCT_IRQHandler ; 26 State Configurable Timer
- DCD RIT_IRQHandler ; 27 Repetitive Interrupt Timer
- DCD TIMER0_IRQHandler ; 28 Timer0
- DCD TIMER1_IRQHandler ; 29 Timer1
- DCD TIMER2_IRQHandler ; 30 Timer2
- DCD TIMER3_IRQHandler ; 31 Timer3
- DCD MCPWM_IRQHandler ; 32 Motor Control PWM
- DCD ADC0_IRQHandler ; 33 A/D Converter 0
- DCD I2C0_IRQHandler ; 34 I2C0
- DCD I2C1_IRQHandler ; 35 I2C1
- DCD SPI_IRQHandler ; 36 SPI (LPC43XX ONLY)
- DCD ADC1_IRQHandler ; 37 A/D Converter 1
- DCD SSP0_IRQHandler ; 38 SSP0
- DCD SSP1_IRQHandler ; 39 SSP1
- DCD UART0_IRQHandler ; 40 UART0
- DCD UART1_IRQHandler ; 41 UART1
- DCD UART2_IRQHandler ; 42 UART2
- DCD UART3_IRQHandler ; 43 UART3
- DCD I2S0_IRQHandler ; 44 I2S0
- DCD I2S1_IRQHandler ; 45 I2S1
- DCD SPIFI_IRQHandler ; 46 SPI Flash Interface
- DCD SGPIO_IRQHandler ; 47 SGPIO (LPC43XX ONLY)
- DCD GPIO0_IRQHandler ; 48 GPIO0
- DCD GPIO1_IRQHandler ; 49 GPIO1
- DCD GPIO2_IRQHandler ; 50 GPIO2
- DCD GPIO3_IRQHandler ; 51 GPIO3
- DCD GPIO4_IRQHandler ; 52 GPIO4
- DCD GPIO5_IRQHandler ; 53 GPIO5
- DCD GPIO6_IRQHandler ; 54 GPIO6
- DCD GPIO7_IRQHandler ; 55 GPIO7
- DCD GINT0_IRQHandler ; 56 GINT0
- DCD GINT1_IRQHandler ; 57 GINT1
- DCD EVRT_IRQHandler ; 58 Event Router
- DCD CAN1_IRQHandler ; 59 C_CAN1
- DCD UnHandled_Vector ; 60 Reserved
- DCD ADCHS_IRQHandler ; 61 ADCHS combined interrupt
- DCD ATIMER_IRQHandler ; 62 ATIMER
- DCD RTC_IRQHandler ; 63 RTC
- DCD UnHandled_Vector ; 64 Reserved
- DCD WDT_IRQHandler ; 65 WDT
- DCD M0SUB_IRQHandler ; 66 M0SUB IRQ handler (LPC43XX ONLY)
- DCD CAN0_IRQHandler ; 67 C_CAN0
- DCD QEI_IRQHandler ; 68 QEI
-
-
-; IF :LNOT::DEF:NO_CRP
-; AREA |.ARM.__at_0x02FC|, CODE, READONLY
-;CRP_Key DCD 0xFFFFFFFF
-; ENDIF
-
- AREA |.text|, CODE, READONLY
-
-; Reset Handler
-
-Reset_Handler PROC
- EXPORT Reset_Handler [WEAK]
- IMPORT __main
- IMPORT SystemInit
- LDR R0, =SystemInit
- BLX R0
- LDR R0, =__main
- BX R0
- ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-
-NMI_Handler PROC
- EXPORT NMI_Handler [WEAK]
- B .
- ENDP
-HardFault_Handler\
- PROC
- EXPORT HardFault_Handler [WEAK]
- B .
- ENDP
-MemManage_Handler\
- PROC
- EXPORT MemManage_Handler [WEAK]
- B .
- ENDP
-BusFault_Handler\
- PROC
- EXPORT BusFault_Handler [WEAK]
- B .
- ENDP
-UsageFault_Handler\
- PROC
- EXPORT UsageFault_Handler [WEAK]
- B .
- ENDP
-SVC_Handler PROC
- EXPORT SVC_Handler [WEAK]
- B .
- ENDP
-DebugMon_Handler\
- PROC
- EXPORT DebugMon_Handler [WEAK]
- B .
- ENDP
-PendSV_Handler PROC
- EXPORT PendSV_Handler [WEAK]
- B .
- ENDP
-SysTick_Handler PROC
- EXPORT SysTick_Handler [WEAK]
- B .
- ENDP
-UnHandled_Vector PROC
- EXPORT UnHandled_Vector [WEAK]
- B .
- ENDP
-
-Default_Handler PROC
-
- EXPORT DAC_IRQHandler [WEAK]
- EXPORT M0APP_IRQHandler [WEAK]
- EXPORT DMA_IRQHandler [WEAK]
- EXPORT FLASH_EEPROM_IRQHandler [WEAK]
- EXPORT ETH_IRQHandler [WEAK]
- EXPORT SDIO_IRQHandler [WEAK]
- EXPORT LCD_IRQHandler [WEAK]
- EXPORT USB0_IRQHandler [WEAK]
- EXPORT USB1_IRQHandler [WEAK]
- EXPORT SCT_IRQHandler [WEAK]
- EXPORT RIT_IRQHandler [WEAK]
- EXPORT TIMER0_IRQHandler [WEAK]
- EXPORT TIMER1_IRQHandler [WEAK]
- EXPORT TIMER2_IRQHandler [WEAK]
- EXPORT TIMER3_IRQHandler [WEAK]
- EXPORT MCPWM_IRQHandler [WEAK]
- EXPORT ADC0_IRQHandler [WEAK]
- EXPORT I2C0_IRQHandler [WEAK]
- EXPORT I2C1_IRQHandler [WEAK]
- EXPORT SPI_IRQHandler [WEAK]
- EXPORT ADC1_IRQHandler [WEAK]
- EXPORT SSP0_IRQHandler [WEAK]
- EXPORT SSP1_IRQHandler [WEAK]
- EXPORT UART0_IRQHandler [WEAK]
- EXPORT UART1_IRQHandler [WEAK]
- EXPORT UART2_IRQHandler [WEAK]
- EXPORT UART3_IRQHandler [WEAK]
- EXPORT I2S0_IRQHandler [WEAK]
- EXPORT I2S1_IRQHandler [WEAK]
- EXPORT SPIFI_IRQHandler [WEAK]
- EXPORT SGPIO_IRQHandler [WEAK]
- EXPORT GPIO0_IRQHandler [WEAK]
- EXPORT GPIO1_IRQHandler [WEAK]
- EXPORT GPIO2_IRQHandler [WEAK]
- EXPORT GPIO3_IRQHandler [WEAK]
- EXPORT GPIO4_IRQHandler [WEAK]
- EXPORT GPIO5_IRQHandler [WEAK]
- EXPORT GPIO6_IRQHandler [WEAK]
- EXPORT GPIO7_IRQHandler [WEAK]
- EXPORT GINT0_IRQHandler [WEAK]
- EXPORT GINT1_IRQHandler [WEAK]
- EXPORT EVRT_IRQHandler [WEAK]
- EXPORT CAN1_IRQHandler [WEAK]
- EXPORT ADCHS_IRQHandler [WEAK]
- EXPORT ATIMER_IRQHandler [WEAK]
- EXPORT RTC_IRQHandler [WEAK]
- EXPORT WDT_IRQHandler [WEAK]
- EXPORT M0SUB_IRQHandler [WEAK]
- EXPORT CAN0_IRQHandler [WEAK]
- EXPORT QEI_IRQHandler [WEAK]
-
-DAC_IRQHandler
-M0APP_IRQHandler
-DMA_IRQHandler
-FLASH_EEPROM_IRQHandler
-ETH_IRQHandler
-SDIO_IRQHandler
-LCD_IRQHandler
-USB0_IRQHandler
-USB1_IRQHandler
-SCT_IRQHandler
-RIT_IRQHandler
-TIMER0_IRQHandler
-TIMER1_IRQHandler
-TIMER2_IRQHandler
-TIMER3_IRQHandler
-MCPWM_IRQHandler
-ADC0_IRQHandler
-I2C0_IRQHandler
-I2C1_IRQHandler
-SPI_IRQHandler
-ADC1_IRQHandler
-SSP0_IRQHandler
-SSP1_IRQHandler
-UART0_IRQHandler
-UART1_IRQHandler
-UART2_IRQHandler
-UART3_IRQHandler
-I2S0_IRQHandler
-I2S1_IRQHandler
-SPIFI_IRQHandler
-SGPIO_IRQHandler
-GPIO0_IRQHandler
-GPIO1_IRQHandler
-GPIO2_IRQHandler
-GPIO3_IRQHandler
-GPIO4_IRQHandler
-GPIO5_IRQHandler
-GPIO6_IRQHandler
-GPIO7_IRQHandler
-GINT0_IRQHandler
-GINT1_IRQHandler
-EVRT_IRQHandler
-CAN1_IRQHandler
-ADCHS_IRQHandler
-ATIMER_IRQHandler
-RTC_IRQHandler
-WDT_IRQHandler
-M0SUB_IRQHandler
-CAN0_IRQHandler
-QEI_IRQHandler
-
- B .
-
- ENDP
-
- ALIGN
-
-; User Initial Stack & Heap
-
- IF :DEF:__MICROLIB
-
- EXPORT __initial_sp
- EXPORT __heap_base
- EXPORT __heap_limit
-
- ELSE
-
- IMPORT __use_two_region_memory
- EXPORT __user_setup_stackheap
-__user_setup_stackheap
-
- LDR R0, = Heap_Mem
- LDR R2, = (Heap_Mem + Heap_Size)
- LDR SP, =(Stack_Mem + Stack_Size)
- BX LR
-
- ALIGN
-
- ENDIF
-
- END
-
diff --git a/platforms_startup/armcc/LPC1833/sysinit.c b/platforms_startup/armcc/LPC1833/sysinit.c
deleted file mode 100644
index 9f732581c..000000000
--- a/platforms_startup/armcc/LPC1833/sysinit.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "cmsis_18xx.h"
-
-typedef struct { /*!< CREG Structure */
- __I uint32_t RESERVED0;
- __IO uint32_t CREG0; /*!< Chip configuration register 32 kHz oscillator output and BOD control register. */
- __I uint32_t RESERVED1[62];
- __IO uint32_t MXMEMMAP; /*!< ARM Cortex-M3/M4 memory mapping */
- __I uint32_t RESERVED2[5];
- __IO uint32_t CREG5; /*!< Chip configuration register 5. Controls JTAG access. */
- __IO uint32_t DMAMUX; /*!< DMA muxing control */
- __IO uint32_t FLASHCFGA; /*!< Flash accelerator configuration register for flash bank A */
- __IO uint32_t FLASHCFGB; /*!< Flash accelerator configuration register for flash bank B */
- __IO uint32_t ETBCFG; /*!< ETB RAM configuration */
- __IO uint32_t CREG6; /*!< Chip configuration register 6. */
- __I uint32_t RESERVED4[52];
- __I uint32_t CHIPID; /*!< Part ID */
- __I uint32_t RESERVED5[191];
- __IO uint32_t USB0FLADJ; /*!< USB0 frame length adjust register */
- __I uint32_t RESERVED9[63];
- __IO uint32_t USB1FLADJ; /*!< USB1 frame length adjust register */
-} LPC_CREG_T;
-
-#define LPC_CREG_BASE 0x40043000
-#define LPC_CREG ((LPC_CREG_T *) LPC_CREG_BASE)
-
-static inline void Chip_CREG_SetFlashAcceleration(uint32_t Hz)
-{
- uint32_t FAValue = Hz / 21510000;
-
- LPC_CREG->FLASHCFGA = (LPC_CREG->FLASHCFGA & (~(0xF << 12))) | (FAValue << 12);
- LPC_CREG->FLASHCFGB = (LPC_CREG->FLASHCFGB & (~(0xF << 12))) | (FAValue << 12);
-}
-
-
-/* Set up and initialize hardware prior to call to main */
-void SystemInit(void)
-{
- unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08;
-
- extern void *__Vectors;
- *pSCB_VTOR = (unsigned int) &__Vectors;
-
- Chip_CREG_SetFlashAcceleration(CGU_IRC_FREQ);
-}
-
diff --git a/scripts/InstallScripts.sh b/scripts/InstallScripts.sh
index a4e4809b0..1c632e718 100755
--- a/scripts/InstallScripts.sh
+++ b/scripts/InstallScripts.sh
@@ -1,5 +1,11 @@
#!/bin/bash -x
-CPPUTEST_HOME=$(pwd)/..
+FirstLetter=${0:0:1}
+if [[ $FirstLetter == "/" ]] ; then
+ CPPUTEST_HOME=${0%/scripts/*}
+else
+ file=$(pwd)/${0}
+ CPPUTEST_HOME="${file%/scripts/*}"
+fi
EXE_DIR=${EXE_DIR:-/usr/local/bin}
test -f ${EXE_DIR} || mkdir -p ${EXE_DIR}
diff --git a/scripts/README.txt b/scripts/README.txt
index 83301d737..c6adab6f0 100644
--- a/scripts/README.txt
+++ b/scripts/README.txt
@@ -1,5 +1,5 @@
The New*.sh scripts are helpful for creating the initial files for a new class...
- NewClass.sh - for TTDing a new C++ class
+ NewClass.sh - for TDDing a new C++ class
NewInterface.sh - for TDDing a new interface along with its Mock
NewCModule.sh - for TDDing a C module
NewCmiModule.sh - for TDDing a C module where there will be multiple
@@ -10,11 +10,11 @@ Run InstallScripts.sh to
2) Define symbolic links for each of the scripts
Like this:
- ./InstallScripts.sh
+ ./scripts/InstallScripts.sh
You might have to add the execute privilege to the shell scripts.
Like this:
- chmod *.sh
+ chmod +x *.sh
Using NewClass for example:
cd to the directory where you want the files located
diff --git a/scripts/VS2010Templates/CppUTest_VS2010.props b/scripts/VS2010Templates/CppUTest_VS2010.props
index fad877723..7655261a1 100644
--- a/scripts/VS2010Templates/CppUTest_VS2010.props
+++ b/scripts/VS2010Templates/CppUTest_VS2010.props
@@ -2,9 +2,9 @@
- $(CPPUTEST_HOME)\include;$(CPPUTEST_HOME)\include\CppUTestExt\CppUTestGTest;$(CPPUTEST_HOME)\include\CppUTestExt\CppUTestGMock;$(CPPUTEST_HOME)\include\Platforms\VisualCpp
+ $(CPPUTEST_HOME)\include;$(CPPUTEST_HOME)\include\CppUTestExt\CppUTestGTest;$(CPPUTEST_HOME)\include\CppUTestExt\CppUTestGMock
$(CPPUTEST_HOME)\lib
- $(CPPUTEST_HOME)\include\Platforms\VisualCpp\Platform.h;$(CPPUTEST_HOME)\include\CppUTest\MemoryLeakDetectorMallocMacros.h;
+ $(CPPUTEST_HOME)\include\CppUTest\MemoryLeakDetectorMallocMacros.h;
CppUTest.lib
diff --git a/scripts/appveyor_ci_build.ps1 b/scripts/appveyor_ci_build.ps1
new file mode 100644
index 000000000..5f33eacd6
--- /dev/null
+++ b/scripts/appveyor_ci_build.ps1
@@ -0,0 +1,118 @@
+
+# Load functions from the helper file
+. (Join-Path (Split-Path $MyInvocation.MyCommand.Path) 'appveyor_helpers.ps1')
+
+mkdir cpputest_build
+
+function Invoke-BuildCommand($command, $directory = '.')
+{
+ $command_wrapped = "$command;`$err = `$?"
+ Write-Host $command
+
+ Push-Location $directory
+ Invoke-Expression $command_wrapped
+
+ if ($LASTEXITCODE -ne 0)
+ {
+ Pop-Location
+ Write-Host "Command Returned error: $LASTEXITCODE"
+ Exit $LASTEXITCODE
+ }
+
+ Pop-Location
+}
+
+function Invoke-CygwinCommand($command, $directory = '.')
+{
+ # Assume cygwin is located at C:\cygwin on x86 and C:\cygwin64 on x64 for now
+ $cygwin_bin = Get-CygwinBin
+
+ $cygwin_directory = (. "${cygwin_bin}\cygpath.exe" (Resolve-Path $directory))
+ $command_wrapped = "${cygwin_bin}\bash.exe --login -c 'cd $cygwin_directory ; $command'"
+
+ Write-Host "Executing <$command> in <$cygwin_directory>"
+ Invoke-Expression $command_wrapped
+
+ if ($LASTEXITCODE -ne 0)
+ {
+ Write-Host "Command Returned error: $LASTEXITCODE"
+ Exit $LASTEXITCODE
+ }
+}
+
+# The project files that will get built
+$VS2008ProjectFiles = @( 'CppUTest.vcproj' , 'tests\AllTests.vcproj' )
+$VS2010ProjectFiles = @( 'CppUTest.vcxproj', 'tests\AllTests.vcxproj' )
+
+if ($env:APPVEYOR)
+{
+ $logger_arg = '/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"'
+}
+else
+{
+ $logger_arg = ''
+}
+
+# Clean up some paths for any configuration
+Remove-PathFolder "C:\MinGW\bin"
+Remove-PathFolder "C:\Program Files\Git\bin"
+Remove-PathFolder "C:\Program Files\Git\cmd"
+Remove-PathFolder "C:\Program Files\Git\usr\bin"
+Remove-PathFolder "C:\Program Files (x86)\Git\bin"
+Remove-PathFolder "C:\Program Files (x86)\Git\cmd"
+Remove-PathFolder "C:\Program Files (x86)\Git\usr\bin"
+
+switch -Wildcard ($env:Platform)
+{
+ 'Cygwin*'
+ {
+ Invoke-CygwinCommand "autoreconf -i .." "cpputest_build"
+ Invoke-CygwinCommand "../configure" "cpputest_build"
+ Invoke-CygwinCommand "make CppUTestTests.exe CppUTestExtTests.exe" "cpputest_build"
+ }
+
+ 'MinGW*'
+ {
+ $mingw_path = Get-MinGWBin
+
+ if ($env:Platform -like 'MinGWClang*')
+ {
+ $toolchain_filename = Get-ClangToolchainFilename
+ $toolchain_path = (Join-Path (Split-Path $MyInvocation.MyCommand.Path) "..\cmake\Toolchains\$toolchain_filename")
+ $toolchain = "-DCMAKE_TOOLCHAIN_FILE=$toolchain_path -DCPPUTEST_WERROR=OFF"
+ }
+
+ # Add mingw to the path
+ Add-PathFolder $mingw_path
+
+ Invoke-BuildCommand "cmake --version"
+ Invoke-BuildCommand "cmake -G 'MinGW Makefiles' -DCMAKE_CXX_STANDARD=17 $toolchain .." 'cpputest_build'
+ Invoke-BuildCommand "mingw32-make all" 'cpputest_build'
+
+ Remove-PathFolder $mingw_path
+ }
+
+ default # Assume that anything else uses Visual C++
+ {
+ if ($env:PlatformToolset -eq 'v90')
+ {
+ # Load environment variables from vsvars32.bat
+ $vsvarspath = Join-Path $env:VS90COMNTOOLS vsvars32.bat
+ Get-BatchFile($vsvarspath)
+
+ $VS2008ProjectFiles | foreach {
+ Invoke-BuildCommand "vcbuild /upgrade $_"
+ }
+
+ $VS2008ProjectFiles | foreach {
+ Invoke-BuildCommand "vcbuild $_ $env:CONFIGURATION"
+ }
+ }
+ else
+ {
+ $VS2010ProjectFiles | foreach {
+ Invoke-BuildCommand "msbuild /ToolsVersion:14.0 $logger_arg $_"
+ }
+ }
+ }
+}
diff --git a/scripts/appveyor_ci_test.ps1 b/scripts/appveyor_ci_test.ps1
new file mode 100644
index 000000000..830542932
--- /dev/null
+++ b/scripts/appveyor_ci_test.ps1
@@ -0,0 +1,118 @@
+
+# Load functions from the helper file
+. (Join-Path (Split-Path $MyInvocation.MyCommand.Path) 'appveyor_helpers.ps1')
+
+function Publish-TestResults($files)
+{
+ $anyFailures = $FALSE
+
+ # Upload results to AppVeyor one by one
+ $files | foreach {
+ $testsuite = ([xml](get-content $_.Name)).testsuite
+
+ foreach ($testcase in $testsuite.testcase) {
+ if ($testcase.failure) {
+ Add-AppveyorTest $testcase.name -Outcome Failed -FileName $testsuite.name -ErrorMessage $testcase.failure.message
+ Add-AppveyorMessage "$($testcase.name) failed" -Category Error
+ $anyFailures = $TRUE
+ }
+ elseif ($testcase.skipped) {
+ Add-AppveyorTest $testcase.name -Outcome Ignored -Filename $testsuite.name
+ }
+ else {
+ Add-AppveyorTest $testcase.name -Outcome Passed -FileName $testsuite.name
+ }
+ }
+
+ Remove-Item $_.Name
+ }
+
+ if ($anyFailures -eq $TRUE){
+ write-host "Failing build as there are broken tests"
+ $host.SetShouldExit(1)
+ }
+}
+
+function Invoke-Tests($executable)
+{
+ # Run tests and output the results using junit
+ $TestCommand = "$executable -ojunit"
+ Write-Host $TestCommand -NoNewline
+ Invoke-Expression $TestCommand
+ Write-Host " - return code: $LASTEXITCODE"
+ if ($LASTEXITCODE -lt 0) {
+ Write-Error "Runtime Exception during test execution"
+ }
+}
+
+function Invoke-CygwinTests($executable)
+{
+ # Assume cygwin is located at C:\cygwin for now
+ $cygwin_bin = Get-CygwinBin
+
+ # Get the full path to the executable
+ $cygwin_folder = . "${cygwin_bin}\cygpath.exe" (Resolve-Path ".")
+ $cygwin_exe = . "${cygwin_bin}\cygpath.exe" $executable
+
+ # Run tests from the cygwin prompt
+ $test_command = "${cygwin_exe} -ojunit"
+ $cygwin_command = "${cygwin_bin}\bash.exe --login -c 'cd ${cygwin_folder} ; ${test_command}'"
+
+ Write-Host $test_command
+ Invoke-Expression $cygwin_command
+}
+
+$TestCount = 0
+
+if (-not $env:APPVEYOR)
+{
+ function Add-AppVeyorTest()
+ {
+ # Wacky way to access a script variable, but it works
+ $count = Get-Variable -Name TestCount -Scope script
+ Set-Variable -Name TestCount -Scope script -Value ($count.Value + 1)
+ }
+
+ function Add-AppVeyorMessage($Message, $Category)
+ {
+ if ($Category -eq 'Error')
+ {
+ Write-Error $Message
+ }
+ else
+ {
+ Write-Host $Message
+ }
+ }
+}
+
+switch -Wildcard ($env:Platform)
+{
+ 'Cygwin*'
+ {
+ Invoke-CygwinTests 'cpputest_build\CppUTestTests.exe'
+ Invoke-CygwinTests 'cpputest_build\CppUTestExtTests.exe'
+ }
+
+ 'MinGW*'
+ {
+ $mingw_path = Get-MinGWBin
+
+ Set-Path "$mingw_path;C:\Windows;C:\Windows\System32"
+ Invoke-Tests '.\cpputest_build\tests\CppUTest\CppUTestTests.exe'
+ Invoke-Tests '.\cpputest_build\tests\CppUTestExt\CppUTestExtTests.exe'
+ Restore-Path
+ }
+
+ default
+ {
+ Invoke-Tests '.\cpputest_build\AllTests.exe'
+ }
+}
+
+Publish-TestResults (Get-ChildItem 'cpputest_*.xml')
+
+if (-not $env:APPVEYOR)
+{
+ Write-Host "Tests Ran: $TestCount"
+}
diff --git a/scripts/appveyor_helpers.ps1 b/scripts/appveyor_helpers.ps1
new file mode 100644
index 000000000..af08f21ca
--- /dev/null
+++ b/scripts/appveyor_helpers.ps1
@@ -0,0 +1,96 @@
+
+# Helper function to extract vars out of the vsvars batch file
+function Get-Batchfile ($file) {
+ $cmd = "`"$file`" & set"
+ cmd /c $cmd | Foreach-Object {
+ $p, $v = $_.split('=')
+ Set-Item -path env:$p -value $v
+ }
+}
+
+# Helper function to provide the bin-folder path to mingw
+function Get-MinGWBin() {
+ if ($env:Platform -like '*64') {
+ Write-Output 'C:\Tools\mingw64\bin'
+ }
+ else {
+ Write-Output 'C:\Tools\mingw32\bin'
+ }
+}
+
+# Helper function to provide the toolchain file for clang
+function Get-ClangToolchainFilename() {
+ if ($env:Platform -like '*64') {
+ Write-Output 'clang+mingw-win64.toolchain.cmake'
+ }
+ else {
+ Write-Output 'clang+mingw-win32.toolchain.cmake'
+ }
+}
+
+# Helper function to provide the bin-folder path to cygwin
+function Get-CygwinBin() {
+ if ($env:Platform -like '*64') {
+ Write-Output 'C:\cygwin64\bin'
+ }
+ else {
+ Write-Output 'C:\cygwin\bin'
+ }
+}
+
+function Add-PathFolder($folder)
+{
+ if (-not (Test-Path $folder))
+ {
+ Write-Host "Not adding $folder to the PATH, it does not exist"
+ }
+
+ [bool]$alreadyInPath = $false
+ [System.Collections.ArrayList]$pathFolders = New-Object System.Collections.ArrayList
+ $env:Path -split ";" | foreach { $pathFolders.Add($_) | Out-Null }
+
+ for ([int]$i = 0; $i -lt $pathFolders.Count; $i++)
+ {
+ if ([string]::Compare($pathFolders[$i], $folder, $true) -eq 0)
+ {
+ $alreadyInPath = $true
+ break
+ }
+ }
+
+ if (-not $alreadyInPath)
+ {
+ Write-Host "Adding $folder to the PATH"
+ $pathFolders.Insert(0, $folder)
+ $env:Path = $pathFolders -join ";"
+ }
+}
+
+function Remove-PathFolder($folder)
+{
+ [System.Collections.ArrayList]$pathFolders = New-Object System.Collections.ArrayList
+ $env:Path -split ";" | foreach { $pathFolders.Add($_) | Out-Null }
+
+ for ([int]$i = 0; $i -lt $pathFolders.Count; $i++)
+ {
+ if ([string]::Compare($pathFolders[$i], $folder, $true) -eq 0)
+ {
+ Write-Host "Removing $folder from the PATH"
+ $pathFolders.RemoveAt($i)
+ $i--
+ }
+ }
+
+ $env:Path = $pathFolders -join ";"
+}
+
+function Set-Path($newPath)
+{
+ $env:RestorePath = $env:Path
+ $env:Path = $newPath
+}
+
+function Restore-Path()
+{
+ $env:Path = $env:RestorePath
+}
diff --git a/scripts/create_docker_images_and_containers b/scripts/create_docker_images_and_containers
new file mode 100755
index 000000000..ab4ec05b6
--- /dev/null
+++ b/scripts/create_docker_images_and_containers
@@ -0,0 +1,37 @@
+#!/bin/bash
+#$1 is the container name
+
+checkForCppUTestToolsEnvVariable() {
+ if [ -z "$CPPUTEST_HOME" ] ; then
+ echo "CPPUTEST_HOME not set. You must set CPPUTEST_HOME to the top level CppUTest directory"
+ exit 1
+ fi
+ if [ ! -d "$CPPUTEST_HOME" ] ; then
+ echo "CPPUTEST_HOME not set to a directory. You must set CPPUTEST_HOME to the top level CppUTest directory"
+ exit 2
+ fi
+}
+
+checkForImageNameParameter() {
+ if [ -z "$container" ] ; then
+ echo "Container name parameter not set. Check the docker directory. It should be the extension of the Dockerfile. e.g. ubuntu"
+ exit 1
+ fi
+ if [ ! -f "$CPPUTEST_HOME/docker/Dockerfile.$container" ] ; then
+ echo "The Dockerfile docker/Dockerfile.$container doesn't exist. Typo?"
+ exit 2
+ fi
+}
+
+
+container=$1
+checkForCppUTestToolsEnvVariable
+checkForImageNameParameter
+
+docker build -f $CPPUTEST_HOME/docker/Dockerfile.$container --tag cpputest/$container:latest .
+docker container rm cpputest_$container
+docker create -it -v$CPPUTEST_HOME:/cpputest -e "CPPUTEST_HOME=/cpputest" --name cpputest_$container cpputest/$container:latest
+
+echo "You can run your container through: docker start -i cpputest_. E.g. docker start -i cpputest_$container"
+
+
diff --git a/scripts/filterGcov.sh b/scripts/filterGcov.sh
index 2f6ec1d41..b3ff67fee 100755
--- a/scripts/filterGcov.sh
+++ b/scripts/filterGcov.sh
@@ -22,7 +22,7 @@ getRidOfCruft() {
sed '-e s/^Lines.*://g' \
'-e s/^[0-9]\./ &/g' \
'-e s/^[0-9][0-9]\./ &/g' \
- '-e s/of.*File/ /g' \
+ '-e s/of.\w[^'File']*File/ /g' \
"-e s/'//g" \
'-e s/^.*\/usr\/.*$//g' \
'-e s/^.*\.$//g'
diff --git a/scripts/templates/ProjectTemplate/Project.cproject b/scripts/templates/ProjectTemplate/Project.cproject
index df56e1665..a3fb56605 100644
--- a/scripts/templates/ProjectTemplate/Project.cproject
+++ b/scripts/templates/ProjectTemplate/Project.cproject
@@ -30,6 +30,7 @@
@@ -37,12 +38,14 @@
diff --git a/scripts/templates/ProjectTemplate/ProjectMakefile b/scripts/templates/ProjectTemplate/ProjectMakefile
index 68747610f..f426016c8 100644
--- a/scripts/templates/ProjectTemplate/ProjectMakefile
+++ b/scripts/templates/ProjectTemplate/ProjectMakefile
@@ -32,7 +32,6 @@ INCLUDE_DIRS =\
include \
include/* \
$(CPPUTEST_HOME)/include/ \
- $(CPPUTEST_HOME)/include/Platforms/Gcc\
mocks
CPPUTEST_WARNINGFLAGS = -Wall -Werror -Wswitch-default
diff --git a/scripts/travis_ci_after.sh b/scripts/travis_ci_after.sh
new file mode 100755
index 000000000..b28cb2d96
--- /dev/null
+++ b/scripts/travis_ci_after.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# Script run in the travis CI
+set -ex
+
+FILE="./test-suite.log"
+
+if [ -f $FILE ]; then
+ cat $FILE
+else
+ echo "$FILE not found."
+fi
diff --git a/scripts/travis_ci_build.sh b/scripts/travis_ci_build.sh
index 2e24f05ba..c2682431f 100755
--- a/scripts/travis_ci_build.sh
+++ b/scripts/travis_ci_build.sh
@@ -1,53 +1,178 @@
#!/bin/bash
# Script run in the travis CI
-set -e
+set -ex
-if [ "x$BUILDTOOL" = "xautotools" ]; then
+if [ "x$CPPUTEST_HOME" = "x" ] ; then
+ export CPPUTEST_HOME=$TRAVIS_BUILD_DIR
+fi
+
+if [ "x$BUILD" = "xautotools" ]; then
autoreconf -i ..
../configure
- echo "CONFIGURATION DONE. Compiling now."
- make check_all
+ make tdd
+fi
+
+if [ "x$BUILD" = "xmakefileworker" ]; then
+ make -C $CPPUTEST_HOME -f Makefile_using_MakefileWorker test_all
+fi
+
+if [ "x$BUILD" = "xcmake" ]; then
+ BUILD_ARGS=("-DWERROR=ON")
- # Special check for all the gtest versions.
+ if [ -n "$CPP_STD" ]; then
+ BUILD_ARGS+=("-DCMAKE_CXX_STANDARD=$CPP_STD")
+ fi
+
+ cmake --version
+ cmake "${BUILD_ARGS[@]}" ..
+ make
+ ctest -V
+fi
+
+if [ "x$BUILD" = "xautotools_gtest" ]; then
+ autoreconf -i ..
+ ../configure
make check_gtest
+fi
- # One more normal build for generating test reports
+if [ "x$BUILD" = "xcmake_gtest" ]; then
+ pwd
+ wget https://github.com/google/googletest/archive/release-1.6.0.zip -O gtest-1.6.0.zip && unzip gtest-1.6.0.zip;
+ wget https://github.com/google/googlemock/archive/release-1.6.0.zip -O gmock-1.6.0.zip && unzip gmock-1.6.0.zip;
+ unzip gtest-1.6.0.zip -d $TRAVIS_BUILD_DIR
+ unzip gmock-1.6.0.zip -d $TRAVIS_BUILD_DIR
+ cd $TRAVIS_BUILD_DIR
+ mv googletest-release-1.6.0 googlemock-release-1.6.0/gtest
+ cd googlemock-release-1.6.0
+ autoreconf -i; ./configure CXXFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1 && make
+ cd -
+ export GMOCK_HOME=$TRAVIS_BUILD_DIR/googlemock-release-1.6.0
+ export GTEST_HOME=$TRAVIS_BUILD_DIR/googlemock-release-1.6.0/gtest
+ cmake . -DGMOCK=ON
+ make
+ ctest -V
+fi
+
+if [ "x$BUILD" = "xtest_report" ]; then
+ autoreconf -i ..
../configure
make check
./CppUTestTests -ojunit
./CppUTestExtTests -ojunit
cp ../scripts/generate_junit_report_ant.xml .
ant -f generate_junit_report_ant.xml
+fi
+
+if [ "x$BUILD" = "xcmake_coverage" ]; then
+ pip install --user cpp-coveralls gcovr
- make dist
- make dist-zip
+ cmake .. -DCMAKE_BUILD_TYPE=Debug -DC++11=ON -DCOVERAGE=ON -DLONGLONG=ON
+ make
+ ctest
- if [ "x$CXX" = "xg++" ]; then
- cd .. && travis_github_deployer -v || exit 1
- fi;
+ coveralls -b . -r .. -i "src" -i "include" --gcov-options="-lbc" || true
fi
-if [ "x$BUILDTOOL" = "xcmake" ]; then
- cmake .. -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE
- make || exit 1
- ctest -V || exit 1
+if [ "x$BUILD" = "xautotools_cmake_install_test" ]; then
+ autoreconf -i ..
+ ../configure
+ rm -rf install_autotools
+ mkdir -p install_autotools
+ make DESTDIR=install_autotools install
+
+ cmake ..
+ rm -rf install_cmake
+ mkdir -p install_cmake
+ make DESTDIR=install_cmake install
- if [ "x$CXX" != "xg++" ]; then
- cmake .. -DC++11=ON -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE
- make || exit 1
- ctest -V || exit 1
+ # Hack: autotools cannot make CMake package. We cached and copied them. Here we check they are still the same
+ for cmakefile in CppUTestConfig.cmake CppUTestConfigVersion.cmake CppUTestTargets-relwithdebinfo.cmake CppUTestTargets.cmake; do
+ cat install_autotools/usr/local/lib/CppUTest/cmake/$cmakefile
+ cat install_cmake/usr/local/lib/CppUTest/cmake/$cmakefile
+ diff -Bw install_autotools/usr/local/lib/CppUTest/cmake/$cmakefile install_cmake/usr/local/lib/CppUTest/cmake/$cmakefile || exit 1
+ done
+
+ export INSTALL_DIFF=`diff -rwBq install_autotools install_cmake -X CppUTestGeneratedConfig.h -X libCppUTest.a -X libCppUTestExt.a`
+ if [ "x$INSTALL_DIFF" != "x" ]; then
+ echo "FAILED: CMake install and Autotools install is not the same!\n"
+ echo "Difference\n"
+ echo "-------------------------------\n"
+ echo "$INSTALL_DIFF"
+ echo "-------------------------------\n"
+ exit 1;
fi
+fi
- wget https://googlemock.googlecode.com/files/gmock-1.6.0.zip
- unzip gmock-1.6.0.zip -d $TRAVIS_BUILD_DIR
- cd $TRAVIS_BUILD_DIR/gmock-1.6.0
- ./configure && make
- cd -
+if [ "x$BUILD" = "xdocker_ubuntu_autotools" ]; then
+ $CPPUTEST_HOME/scripts/create_docker_images_and_containers ubuntu
+ docker start -i cpputest_ubuntu
+fi
+
+if [ "x$BUILD" = "xdocker_ubuntu_dos" ]; then
+ $CPPUTEST_HOME/scripts/create_docker_images_and_containers dos
+ docker start -i cpputest_dos
+fi
+
+if [ "x$BUILD" = "xmake_dos" ]; then
+ if [ ! -d watcom ]; then
+ git clone https://github.com/cpputest/watcom-compiler.git watcom
+ fi
+ export PATH=$PATH:$PWD/watcom/binl
+ export WATCOM=$PWD/watcom
+ export CC=wcl
+ export CXX=wcl
+ $CC --version
+ make -f $CPPUTEST_HOME/platforms/Dos/Makefile clean
+ make -f $CPPUTEST_HOME/platforms/Dos/Makefile
+ $CPPUTEST_HOME/platforms/Dos/alltests.sh
+fi
- export GMOCK_HOME=$TRAVIS_BUILD_DIR/gmock-1.6.0
- export GTEST_HOME=$TRAVIS_BUILD_DIR/gmock-1.6.0/gtest
- cmake .. -DGMOCK=ON || exit 1
- make || exit 1
- ctest -V || exit 1
+if [ "x$BUILD" = "xextensive_check" ]; then
+ autoreconf -i ..
+ ../configure
+ make check_all
fi
+if [ "x$BUILD" = "xautotools_dist" ]; then
+ autoreconf -i ..
+ ../configure
+
+ if [ "x$TRAVIS_OS_NAME" = "xosx" ]; then
+ COPYFILE_DISABLE=1 make dist VERSION=latest
+ COPYFILE_DISABLE=1 make dist-zip VERSION=latest
+ else
+ make dist VERSION=latest
+ make dist-zip VERSION=latest
+ fi
+fi
+
+if [ "x$BUILD" = "xautotools_install_and_test_examples" ]; then
+ autoreconf -i ..
+ ../configure
+
+ make tdd
+ sudo make install
+ make -C $CPPUTEST_HOME/examples -f $CPPUTEST_HOME/examples/Makefile_ExamplesWithCppUTestInstalled.mk
+fi
+
+if [ "x$BUILD" = "xvc_windows" ]; then
+ export PATH=$MSBUILD_PATH:$PATH
+ cmake ..
+ MSBuild.exe ALL_BUILD.vcxproj
+ ./tests/CppUTest/CppUTestTests.exe
+ ./tests/CppUTestExt/CppUTestExtTests.exe
+fi
+
+if [ "x$BUILD" = "xcmake_windows" ]; then
+ choco install make
+ BUILD_ARGS=("-DWERROR=ON")
+
+ if [ -n "$CPP_STD" ]; then
+ BUILD_ARGS+=("-DCMAKE_CXX_STANDARD=$CPP_STD")
+ fi
+
+ cmake --version
+ cmake -G 'Unix Makefiles' "${BUILD_ARGS[@]}" ..
+ make
+ ctest -V
+fi
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 000000000..8bee1d9b8
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_subdirectory(CppUTest)
+if (CPPUTEST_EXTENSIONS)
+ add_subdirectory(CppUTestExt)
+endif ()
diff --git a/src/CppUTest/CMakeIntegration-README.md b/src/CppUTest/CMakeIntegration-README.md
new file mode 100644
index 000000000..74ec44aaa
--- /dev/null
+++ b/src/CppUTest/CMakeIntegration-README.md
@@ -0,0 +1,110 @@
+# CMake Integration
+
+## FetchContent
+
+CMake can automatically download and integrate CppUTest with
+[`FetchContent`](https://cmake.org/cmake/help/latest/module/FetchContent.html).
+This is the recommended strategy for CMake integration.
+
+```cmake
+cmake_minimum_required(VERSION 3.11)
+project(trying_CppUtest)
+
+include(FetchContent)
+FetchContent_Declare(
+ CppUTest
+ GIT_REPOSITORY https://github.com/cpputest/cpputest.git
+ GIT_TAG master # or use release tag, eg. v4.0
+ # FIND_PACKAGE_ARGS # Recent CMake versions can integrate FetchContent with find_package
+ # https://cmake.org/cmake/help/latest/module/FetchContent.html#integrating-with-find-package
+)
+
+# Either set CPPUTEST_PLATFORM to off and # provide a project-specific
+# platform.cpp, assign # one of the provided platforms under
+# src/Platforms/ # (as shown below), or let CppUTest
+# select an appropriate default.
+set(CPPUTEST_PLATFORM Gcc STRING BOOL "Platform implementation")
+
+FetchContent_MakeAvailable(CppUTest)
+
+add_executable(trying_CppUtest main.cpp)
+
+target_link_libraries(trying_CppUtest
+ PRIVATE
+ CppUTest::CppUTest
+ #or CppUTest::CppUTestExt
+)
+
+include(CTest) # Enable testing
+
+# automatically discover CppUTest tests
+include(CppUTest)
+cpputest_discover_tests(trying_CppUtest)
+```
+
+## System install
+
+If CppUTest has been installed on the system, it can be integrated with
+[`find_package`](https://cmake.org/cmake/help/latest/command/find_package.html).
+The target platform will be the same as the development host.
+This is useful for managing a common
+CppUTest installation with the system's package manager.
+
+```cmake
+cmake_minimum_required(VERSION 3.10)
+project(trying_CppUtest)
+
+find_package(CppUTest REQUIRED)
+
+add_executable(trying_CppUtest main.cpp)
+
+target_link_libraries(trying_CppUtest
+ PRIVATE
+ CppUTest
+ #or CppUTestExt
+)
+
+include(CTest) # Enable testing
+
+# automatically discover CppUTest tests
+include(CppUTest)
+cpputest_discover_tests(trying_CppUtest)
+```
+
+## Shared directory
+
+It is possible to integrate CppUTest from a local directory. This may be useful
+if CppUTest is being built for a target platform other than that of the
+development host and CMake 3.11 is not available. The following is an example
+how an external project can refer to this CMakeLists.txt to build CppUTest as a
+library and include it as a target dependency.
+
+```cmake
+cmake_minimum_required(VERSION 3.10)
+project(trying_CppUtest)
+
+SET(CppUTestRootDirectory /path/to/cpputest)
+
+# Either set CPPUTEST_PLATFORM to one of the provided platforms under
+# /src/Platforms/, or provide a project-specific
+# platform.cpp (as shown below)
+set(CPPUTEST_PLATFORM OFF CACHE BOOL "Platform implementation")
+add_subdirectory(${CppUTestRootDirectory} CppUTest)
+target_sources(CppUTest
+ PRIVATE
+ ${PROJECT_SOURCE_DIR}/UtestPlatform.cpp
+)
+
+add_executable(trying_CppUtest main.cpp)
+target_link_libraries(trying_CppUtest
+ PRIVATE
+ CppUTest::CppUTest
+ #or CppUTest::CppUTestExt
+)
+
+include(CTest) # Enable testing
+
+# automatically discover CppUTest tests
+include(CppUTest)
+cpputest_discover_tests(trying_CppUtest)
+```
diff --git a/src/CppUTest/CMakeLists.txt b/src/CppUTest/CMakeLists.txt
index 449b76571..f7c737b0c 100644
--- a/src/CppUTest/CMakeLists.txt
+++ b/src/CppUTest/CMakeLists.txt
@@ -1,56 +1,127 @@
-set(CppUTest_src
+add_library(CppUTest
CommandLineArguments.cpp
MemoryLeakWarningPlugin.cpp
TestHarness_c.cpp
TestRegistry.cpp
CommandLineTestRunner.cpp
SimpleString.cpp
+ SimpleStringInternalCache.cpp
TestMemoryAllocator.cpp
TestResult.cpp
JUnitTestOutput.cpp
+ TeamCityTestOutput.cpp
TestFailure.cpp
TestOutput.cpp
MemoryLeakDetector.cpp
TestFilter.cpp
TestPlugin.cpp
+ TestTestingFixture.cpp
SimpleMutex.cpp
Utest.cpp
- ../Platforms/${CPP_PLATFORM}/UtestPlatform.cpp
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/CommandLineArguments.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/PlatformSpecificFunctions.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/TestMemoryAllocator.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/CommandLineTestRunner.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/PlatformSpecificFunctions_c.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/TestOutput.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/CppUTestConfig.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/SimpleString.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/SimpleStringInternalCache.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/TestPlugin.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/JUnitTestOutput.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/TeamCityTestOutput.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/StandardCLibrary.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/TestRegistry.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/MemoryLeakDetector.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/TestFailure.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/TestResult.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/MemoryLeakDetectorMallocMacros.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/TestFilter.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/TestTestingFixture.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/MemoryLeakDetectorNewMacros.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/MemoryLeakDetectorForceInclude.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/TestHarness.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/Utest.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/MemoryLeakWarningPlugin.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/TestHarness_c.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/UtestMacros.h
+ ${PROJECT_SOURCE_DIR}/include/CppUTest/SimpleMutex.h
)
-set(CppUTest_headers
- ${CppUTestRootDirectory}/include/CppUTest/CommandLineArguments.h
- ${CppUTestRootDirectory}/include/CppUTest/PlatformSpecificFunctions.h
- ${CppUTestRootDirectory}/include/CppUTest/TestMemoryAllocator.h
- ${CppUTestRootDirectory}/include/CppUTest/CommandLineTestRunner.h
- ${CppUTestRootDirectory}/include/CppUTest/PlatformSpecificFunctions_c.h
- ${CppUTestRootDirectory}/include/CppUTest/TestOutput.h
- ${CppUTestRootDirectory}/include/CppUTest/CppUTestConfig.h
- ${CppUTestRootDirectory}/include/CppUTest/SimpleString.h
- ${CppUTestRootDirectory}/include/CppUTest/TestPlugin.h
- ${CppUTestRootDirectory}/include/CppUTest/JUnitTestOutput.h
- ${CppUTestRootDirectory}/include/CppUTest/StandardCLibrary.h
- ${CppUTestRootDirectory}/include/CppUTest/TestRegistry.h
- ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetector.h
- ${CppUTestRootDirectory}/include/CppUTest/TestFailure.h
- ${CppUTestRootDirectory}/include/CppUTest/TestResult.h
- ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h
- ${CppUTestRootDirectory}/include/CppUTest/TestFilter.h
- ${CppUTestRootDirectory}/include/CppUTest/TestTestingFixture.h
- ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorNewMacros.h
- ${CppUTestRootDirectory}/include/CppUTest/TestHarness.h
- ${CppUTestRootDirectory}/include/CppUTest/Utest.h
- ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakWarningPlugin.h
- ${CppUTestRootDirectory}/include/CppUTest/TestHarness_c.h
- ${CppUTestRootDirectory}/include/CppUTest/UtestMacros.h
+#[[Set CPPUTEST_PLATFORM in a parent CMakeLists.txt if reusing one of the provided platforms, else supply the missing definitions]]
+if(CPPUTEST_PLATFORM)
+ target_sources(CppUTest
+ PRIVATE
+ ${CMAKE_CURRENT_LIST_DIR}/../Platforms/${CPPUTEST_PLATFORM}/UtestPlatform.cpp
+ )
+endif()
+
+if(CPPUTEST_PLATFORM STREQUAL "c2000")
+ target_include_directories(CppUTest
+ PUBLIC
+ $
+ )
+elseif(CPPUTEST_PLATFORM STREQUAL "Iar")
+ target_compile_options(CppUTest
+ PRIVATE
+ --dlib_config full
+ )
+endif()
+
+if (MINGW)
+ include(CheckStructHasMember)
+ check_struct_has_member("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC LANGUAGE CXX)
+endif()
+
+#[[Arrange for the include directory to be added to the include paths of any CMake target depending on CppUTest.]]
+target_include_directories(CppUTest
+ PUBLIC
+ $
+ $
+)
+
+target_compile_definitions(CppUTest
+ PRIVATE
+ $<$:STDC_WANT_SECURE_LIB>
+ # Apply workaround for MinGW timespec redefinition (pthread.h / time.h).
+ $<$:_TIMESPEC_DEFINED>
)
-add_library(CppUTest STATIC ${CppUTest_src})
-if (WIN32)
- target_link_libraries(CppUTest winmm.lib)
-endif (WIN32)
-install(FILES ${CppUTest_headers} DESTINATION include/CppUTest)
-install(TARGETS CppUTest
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
+set(THREADS_PREFER_PTHREAD_FLAG ON)
+find_package(Threads)
+
+target_link_libraries(CppUTest
+ PRIVATE
+ $<$:winmm>
+ $<$:${CMAKE_THREAD_LIBS_INIT}>
+)
+
+add_library(CppUTest::CppUTest ALIAS CppUTest)
+
+if(NOT CPPUTEST_MEM_LEAK_DETECTION_DISABLED)
+ if(MSVC)
+ set(force_include "/FI")
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "IAR")
+ set(force_include "--preinclude=")
+ else()
+ set(force_include "-include")
+ endif()
+ target_compile_options(CppUTest
+ PUBLIC
+ ${force_include}CppUTest/MemoryLeakDetectorForceInclude.h
+ )
+endif()
+
+# Installation
+if(PROJECT_IS_TOP_LEVEL)
+ install(
+ TARGETS CppUTest
+ EXPORT CppUTestTargets
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ )
+ install(
+ DIRECTORY "${PROJECT_SOURCE_DIR}/include/CppUTest"
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+ )
+endif()
diff --git a/src/CppUTest/CommandLineArguments.cpp b/src/CppUTest/CommandLineArguments.cpp
index e7ea57dad..e3d1a8cbe 100644
--- a/src/CppUTest/CommandLineArguments.cpp
+++ b/src/CppUTest/CommandLineArguments.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -29,8 +29,11 @@
#include "CppUTest/CommandLineArguments.h"
#include "CppUTest/PlatformSpecificFunctions.h"
-CommandLineArguments::CommandLineArguments(int ac, const char** av) :
- ac_(ac), av_(av), verbose_(false), color_(false), runTestsAsSeperateProcess_(false), repeat_(1), groupFilters_(NULL), nameFilters_(NULL), outputType_(OUTPUT_ECLIPSE)
+CommandLineArguments::CommandLineArguments(int ac, const char *const *av) :
+ ac_(ac), av_(av), needHelp_(false), verbose_(false), veryVerbose_(false), color_(false), runTestsAsSeperateProcess_(false),
+ listTestGroupNames_(false), listTestGroupAndCaseNames_(false), listTestLocations_(false), runIgnored_(false), reversing_(false),
+ crashOnFail_(false), rethrowExceptions_(true), shuffling_(false), shufflingPreSeeded_(false), repeat_(1), shuffleSeed_(0),
+ groupFilters_(NULLPTR), nameFilters_(NULLPTR), outputType_(OUTPUT_ECLIPSE)
{
}
@@ -53,19 +56,41 @@ bool CommandLineArguments::parse(TestPlugin* plugin)
bool correctParameters = true;
for (int i = 1; i < ac_; i++) {
SimpleString argument = av_[i];
- if (argument == "-v") verbose_ = true;
+
+ if (argument == "-h") {
+ needHelp_ = true;
+ correctParameters = false;
+ }
+ else if (argument == "-v") verbose_ = true;
+ else if (argument == "-vv") veryVerbose_ = true;
else if (argument == "-c") color_ = true;
else if (argument == "-p") runTestsAsSeperateProcess_ = true;
- else if (argument.startsWith("-r")) SetRepeatCount(ac_, av_, i);
- else if (argument.startsWith("-g")) AddGroupFilter(ac_, av_, i);
- else if (argument.startsWith("-sg")) AddStrictGroupFilter(ac_, av_, i);
- else if (argument.startsWith("-n")) AddNameFilter(ac_, av_, i);
- else if (argument.startsWith("-sn")) AddStrictNameFilter(ac_, av_, i);
- else if (argument.startsWith("TEST(")) AddTestToRunBasedOnVerboseOutput(ac_, av_, i, "TEST(");
- else if (argument.startsWith("IGNORE_TEST(")) AddTestToRunBasedOnVerboseOutput(ac_, av_, i, "IGNORE_TEST(");
- else if (argument.startsWith("-o")) correctParameters = SetOutputType(ac_, av_, i);
+ else if (argument == "-b") reversing_ = true;
+ else if (argument == "-lg") listTestGroupNames_ = true;
+ else if (argument == "-ln") listTestGroupAndCaseNames_ = true;
+ else if (argument == "-ll") listTestLocations_ = true;
+ else if (argument == "-ri") runIgnored_ = true;
+ else if (argument == "-f") crashOnFail_ = true;
+ else if ((argument == "-e") || (argument == "-ci")) rethrowExceptions_ = false;
+ else if (argument.startsWith("-r")) setRepeatCount(ac_, av_, i);
+ else if (argument.startsWith("-g")) addGroupFilter(ac_, av_, i);
+ else if (argument.startsWith("-t")) correctParameters = addGroupDotNameFilter(ac_, av_, i, "-t", false, false);
+ else if (argument.startsWith("-st")) correctParameters = addGroupDotNameFilter(ac_, av_, i, "-st", true, false);
+ else if (argument.startsWith("-xt")) correctParameters = addGroupDotNameFilter(ac_, av_, i, "-xt", false, true);
+ else if (argument.startsWith("-xst")) correctParameters = addGroupDotNameFilter(ac_, av_, i, "-xst", true, true);
+ else if (argument.startsWith("-sg")) addStrictGroupFilter(ac_, av_, i);
+ else if (argument.startsWith("-xg")) addExcludeGroupFilter(ac_, av_, i);
+ else if (argument.startsWith("-xsg")) addExcludeStrictGroupFilter(ac_, av_, i);
+ else if (argument.startsWith("-n")) addNameFilter(ac_, av_, i);
+ else if (argument.startsWith("-sn")) addStrictNameFilter(ac_, av_, i);
+ else if (argument.startsWith("-xn")) addExcludeNameFilter(ac_, av_, i);
+ else if (argument.startsWith("-xsn")) addExcludeStrictNameFilter(ac_, av_, i);
+ else if (argument.startsWith("-s")) correctParameters = setShuffle(ac_, av_, i);
+ else if (argument.startsWith("TEST(")) addTestToRunBasedOnVerboseOutput(ac_, av_, i, "TEST(");
+ else if (argument.startsWith("IGNORE_TEST(")) addTestToRunBasedOnVerboseOutput(ac_, av_, i, "IGNORE_TEST(");
+ else if (argument.startsWith("-o")) correctParameters = setOutputType(ac_, av_, i);
else if (argument.startsWith("-p")) correctParameters = plugin->parseAllArguments(ac_, av_, i);
- else if (argument.startsWith("-k")) SetPackageName(ac_, av_, i);
+ else if (argument.startsWith("-k")) setPackageName(ac_, av_, i);
else correctParameters = false;
if (correctParameters == false) {
@@ -77,7 +102,67 @@ bool CommandLineArguments::parse(TestPlugin* plugin)
const char* CommandLineArguments::usage() const
{
- return "usage [-v] [-c] [-r#] [-g|sg groupName]... [-n|sn testName]... [\"TEST(groupName, testName)\"]... [-o{normal, junit}] [-k packageName]\n";
+ return "use -h for more extensive help\n"
+ "usage [-h] [-v] [-vv] [-c] [-p] [-lg] [-ln] [-ll] [-ri] [-r[<#>]] [-f] [-e] [-ci]\n"
+ " [-g|sg|xg|xsg ]... [-n|sn|xn|xsn ]... [-t|st|xt|xst .]...\n"
+ " [-b] [-s []] [\"[IGNORE_]TEST(, )\"]...\n"
+ " [-o{normal|eclipse|junit|teamcity}] [-k ]\n";
+}
+
+const char* CommandLineArguments::help() const
+{
+ return
+ "Thanks for using CppUTest.\n"
+ "\n"
+ "Options that do not run tests but query:\n"
+ " -h - this wonderful help screen. Joy!\n"
+ " -lg - print a list of group names, separated by spaces\n"
+ " -ln - print a list of test names in the form of group.name, separated by spaces\n"
+ " -ll - print a list of test names in the form of group.name.test_file_path.line\n"
+ "\n"
+ "Options that change the output format:\n"
+ " -c - colorize output, print green if OK, or red if failed\n"
+ " -v - verbose, print each test name as it runs\n"
+ " -vv - very verbose, print internal information during test run\n"
+ "\n"
+ "Options that change the output location:\n"
+ " -onormal - no output to files\n"
+ " -oeclipse - equivalent to -onormal\n"
+ " -oteamcity - output to xml files (as the name suggests, for TeamCity)\n"
+ " -ojunit - output to JUnit ant plugin style xml files (for CI systems)\n"
+ " -k - add a package name in JUnit output (for classification in CI systems)\n"
+ "\n"
+ "\n"
+ "Options that control which tests are run:\n"
+ " -g - only run tests whose group contains \n"
+ " -n - only run tests whose name contains \n"
+ " -t . - only run tests whose group and name contain and \n"
+ " -sg - only run tests whose group exactly matches \n"
+ " -sn - only run tests whose name exactly matches \n"
+ " -st . - only run tests whose group and name exactly match and \n"
+ " -xg - exclude tests whose group contains \n"
+ " -xn - exclude tests whose name contains \n"
+ " -xt . - exclude tests whose group and name contain and \n"
+ " -xsg - exclude tests whose group exactly matches \n"
+ " -xsn - exclude tests whose name exactly matches \n"
+ " -xst . - exclude tests whose group and name exactly match and \n"
+ " \"[IGNORE_]TEST(, )\"\n"
+ " - only run tests whose group and name exactly match and \n"
+ " (this can be used to copy-paste output from the -v option on the command line)\n"
+ "\n"
+ "Options that control how the tests are run:\n"
+ " -p - run tests in a separate process\n"
+ " -b - run the tests backwards, reversing the normal way\n"
+ " -s [] - shuffle tests randomly (randomization seed is optional, must be greater than 0)\n"
+ " -r[<#>] - repeat the tests <#> times (or twice if <#> is not specified)\n"
+ " -f - Cause the tests to crash on failure (to allow the test to be debugged if necessary)\n"
+ " -e - do not rethrow unexpected exceptions on failure\n"
+ " -ci - continuous integration mode (equivalent to -e)\n";
+}
+
+bool CommandLineArguments::needHelp() const
+{
+ return needHelp_;
}
bool CommandLineArguments::isVerbose() const
@@ -85,22 +170,72 @@ bool CommandLineArguments::isVerbose() const
return verbose_;
}
+bool CommandLineArguments::isVeryVerbose() const
+{
+ return veryVerbose_;
+}
+
bool CommandLineArguments::isColor() const
{
return color_;
}
+bool CommandLineArguments::isListingTestGroupNames() const
+{
+ return listTestGroupNames_;
+}
+
+bool CommandLineArguments::isListingTestGroupAndCaseNames() const
+{
+ return listTestGroupAndCaseNames_;
+}
+
+bool CommandLineArguments::isListingTestLocations() const
+{
+ return listTestLocations_;
+}
+
+bool CommandLineArguments::isRunIgnored() const
+{
+ return runIgnored_;
+}
+
bool CommandLineArguments::runTestsInSeperateProcess() const
{
return runTestsAsSeperateProcess_;
}
-int CommandLineArguments::getRepeatCount() const
+size_t CommandLineArguments::getRepeatCount() const
{
return repeat_;
}
+bool CommandLineArguments::isReversing() const
+{
+ return reversing_;
+}
+
+bool CommandLineArguments::isCrashingOnFail() const
+{
+ return crashOnFail_;
+}
+
+bool CommandLineArguments::isRethrowingExceptions() const
+{
+ return rethrowExceptions_;
+}
+
+bool CommandLineArguments::isShuffling() const
+{
+ return shuffling_;
+}
+
+size_t CommandLineArguments::getShuffleSeed() const
+{
+ return shuffleSeed_;
+}
+
const TestFilter* CommandLineArguments::getGroupFilters() const
{
return groupFilters_;
@@ -111,14 +246,14 @@ const TestFilter* CommandLineArguments::getNameFilters() const
return nameFilters_;
}
-void CommandLineArguments::SetRepeatCount(int ac, const char** av, int& i)
+void CommandLineArguments::setRepeatCount(int ac, const char *const *av, int& i)
{
repeat_ = 0;
SimpleString repeatParameter(av[i]);
- if (repeatParameter.size() > 2) repeat_ = SimpleString::AtoI(av[i] + 2);
+ if (repeatParameter.size() > 2) repeat_ = (size_t) (SimpleString::AtoI(av[i] + 2));
else if (i + 1 < ac) {
- repeat_ = SimpleString::AtoI(av[i + 1]);
+ repeat_ = (size_t) (SimpleString::AtoI(av[i + 1]));
if (repeat_ != 0) i++;
}
@@ -126,7 +261,29 @@ void CommandLineArguments::SetRepeatCount(int ac, const char** av, int& i)
}
-SimpleString CommandLineArguments::getParameterField(int ac, const char** av, int& i, const SimpleString& parameterName)
+bool CommandLineArguments::setShuffle(int ac, const char * const *av, int& i)
+{
+ shuffling_ = true;
+ shuffleSeed_ = (unsigned int)GetPlatformSpecificTimeInMillis();
+ if (shuffleSeed_ == 0) shuffleSeed_++;
+
+ SimpleString shuffleParameter = av[i];
+ if (shuffleParameter.size() > 2) {
+ shufflingPreSeeded_ = true;
+ shuffleSeed_ = SimpleString::AtoU(av[i] + 2);
+ } else if (i + 1 < ac) {
+ unsigned int parsedParameter = SimpleString::AtoU(av[i + 1]);
+ if (parsedParameter != 0)
+ {
+ shufflingPreSeeded_ = true;
+ shuffleSeed_ = parsedParameter;
+ i++;
+ }
+ }
+ return (shuffleSeed_ != 0);
+}
+
+SimpleString CommandLineArguments::getParameterField(int ac, const char * const *av, int& i, const SimpleString& parameterName)
{
size_t parameterLength = parameterName.size();
SimpleString parameter(av[i]);
@@ -135,37 +292,93 @@ SimpleString CommandLineArguments::getParameterField(int ac, const char** av, in
return "";
}
-void CommandLineArguments::AddGroupFilter(int ac, const char** av, int& i)
+void CommandLineArguments::addGroupFilter(int ac, const char *const *av, int& i)
{
TestFilter* groupFilter = new TestFilter(getParameterField(ac, av, i, "-g"));
groupFilters_ = groupFilter->add(groupFilters_);
}
-void CommandLineArguments::AddStrictGroupFilter(int ac, const char** av, int& i)
+bool CommandLineArguments::addGroupDotNameFilter(int ac, const char *const *av, int& i, const SimpleString& parameterName,
+ bool strict, bool exclude)
+{
+ SimpleString groupDotName = getParameterField(ac, av, i, parameterName);
+ SimpleStringCollection collection;
+ groupDotName.split(".", collection);
+
+ if (collection.size() != 2) return false;
+
+ TestFilter* groupFilter = new TestFilter(collection[0].subString(0, collection[0].size()-1));
+ TestFilter* nameFilter = new TestFilter(collection[1]);
+ if (strict)
+ {
+ groupFilter->strictMatching();
+ nameFilter->strictMatching();
+ }
+ if (exclude)
+ {
+ groupFilter->invertMatching();
+ nameFilter->invertMatching();
+ }
+ groupFilters_ = groupFilter->add(groupFilters_);
+ nameFilters_ = nameFilter->add(nameFilters_);
+ return true;
+}
+
+void CommandLineArguments::addStrictGroupFilter(int ac, const char *const *av, int& i)
{
TestFilter* groupFilter = new TestFilter(getParameterField(ac, av, i, "-sg"));
groupFilter->strictMatching();
groupFilters_ = groupFilter->add(groupFilters_);
}
-void CommandLineArguments::AddNameFilter(int ac, const char** av, int& i)
+void CommandLineArguments::addExcludeGroupFilter(int ac, const char *const *av, int& i)
+{
+ TestFilter* groupFilter = new TestFilter(getParameterField(ac, av, i, "-xg"));
+ groupFilter->invertMatching();
+ groupFilters_ = groupFilter->add(groupFilters_);
+}
+
+void CommandLineArguments::addExcludeStrictGroupFilter(int ac, const char *const *av, int& i)
+{
+ TestFilter* groupFilter = new TestFilter(getParameterField(ac, av, i, "-xsg"));
+ groupFilter->strictMatching();
+ groupFilter->invertMatching();
+ groupFilters_ = groupFilter->add(groupFilters_);
+}
+
+void CommandLineArguments::addNameFilter(int ac, const char *const *av, int& i)
{
TestFilter* nameFilter = new TestFilter(getParameterField(ac, av, i, "-n"));
nameFilters_ = nameFilter->add(nameFilters_);
}
-void CommandLineArguments::AddStrictNameFilter(int ac, const char** av, int& index)
+void CommandLineArguments::addStrictNameFilter(int ac, const char *const *av, int& index)
{
TestFilter* nameFilter = new TestFilter(getParameterField(ac, av, index, "-sn"));
nameFilter->strictMatching();
nameFilters_= nameFilter->add(nameFilters_);
}
-void CommandLineArguments::AddTestToRunBasedOnVerboseOutput(int ac, const char** av, int& index, const char* parameterName)
+void CommandLineArguments::addExcludeNameFilter(int ac, const char *const *av, int& index)
+{
+ TestFilter* nameFilter = new TestFilter(getParameterField(ac, av, index, "-xn"));
+ nameFilter->invertMatching();
+ nameFilters_= nameFilter->add(nameFilters_);
+}
+
+void CommandLineArguments::addExcludeStrictNameFilter(int ac, const char *const *av, int& index)
+{
+ TestFilter* nameFilter = new TestFilter(getParameterField(ac, av, index, "-xsn"));
+ nameFilter->invertMatching();
+ nameFilter->strictMatching();
+ nameFilters_= nameFilter->add(nameFilters_);
+}
+
+void CommandLineArguments::addTestToRunBasedOnVerboseOutput(int ac, const char *const *av, int& index, const char* parameterName)
{
SimpleString wholename = getParameterField(ac, av, index, parameterName);
SimpleString testname = wholename.subStringFromTill(',', ')');
- testname = testname.subString(2, testname.size());
+ testname = testname.subString(2);
TestFilter* namefilter = new TestFilter(testname);
TestFilter* groupfilter = new TestFilter(wholename.subStringFromTill(wholename.at(0), ','));
namefilter->strictMatching();
@@ -174,7 +387,7 @@ void CommandLineArguments::AddTestToRunBasedOnVerboseOutput(int ac, const char**
nameFilters_ = namefilter->add(nameFilters_);
}
-void CommandLineArguments::SetPackageName(int ac, const char** av, int& i)
+void CommandLineArguments::setPackageName(int ac, const char *const *av, int& i)
{
SimpleString packageName = getParameterField(ac, av, i, "-k");
if (packageName.size() == 0) return;
@@ -182,7 +395,7 @@ void CommandLineArguments::SetPackageName(int ac, const char** av, int& i)
packageName_ = packageName;
}
-bool CommandLineArguments::SetOutputType(int ac, const char** av, int& i)
+bool CommandLineArguments::setOutputType(int ac, const char *const *av, int& i)
{
SimpleString outputType = getParameterField(ac, av, i, "-o");
if (outputType.size() == 0) return false;
@@ -195,6 +408,11 @@ bool CommandLineArguments::SetOutputType(int ac, const char** av, int& i)
outputType_ = OUTPUT_JUNIT;
return true;
}
+ if (outputType == "teamcity") {
+ outputType_ = OUTPUT_TEAMCITY;
+ return true;
+ }
+
return false;
}
@@ -208,6 +426,11 @@ bool CommandLineArguments::isJUnitOutput() const
return outputType_ == OUTPUT_JUNIT;
}
+bool CommandLineArguments::isTeamCityOutput() const
+{
+ return outputType_ == OUTPUT_TEAMCITY;
+}
+
const SimpleString& CommandLineArguments::getPackageName() const
{
return packageName_;
diff --git a/src/CppUTest/CommandLineTestRunner.cpp b/src/CppUTest/CommandLineTestRunner.cpp
index 61db7feca..b50e897e7 100644
--- a/src/CppUTest/CommandLineTestRunner.cpp
+++ b/src/CppUTest/CommandLineTestRunner.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -29,49 +29,50 @@
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTest/TestOutput.h"
#include "CppUTest/JUnitTestOutput.h"
+#include "CppUTest/TeamCityTestOutput.h"
#include "CppUTest/TestRegistry.h"
-CommandLineTestRunner::CommandLineTestRunner(int ac, const char** av, TestOutput* output, TestRegistry* registry) :
- output_(output), jUnitOutput_(NULL), arguments_(NULL), registry_(registry)
-{
- arguments_ = new CommandLineArguments(ac, av);
-}
-
-CommandLineTestRunner::~CommandLineTestRunner()
-{
- delete arguments_;
- delete jUnitOutput_;
-}
-
int CommandLineTestRunner::RunAllTests(int ac, char** av)
{
- return RunAllTests(ac, const_cast (av));
+ return RunAllTests(ac, (const char *const *) av);
}
-int CommandLineTestRunner::RunAllTests(int ac, const char** av)
+int CommandLineTestRunner::RunAllTests(int ac, const char *const *av)
{
int result = 0;
- ConsoleTestOutput output;
+ ConsoleTestOutput backupOutput;
MemoryLeakWarningPlugin memLeakWarn(DEF_PLUGIN_MEM_LEAK);
memLeakWarn.destroyGlobalDetectorAndTurnOffMemoryLeakDetectionInDestructor(true);
TestRegistry::getCurrentRegistry()->installPlugin(&memLeakWarn);
{
- CommandLineTestRunner runner(ac, av, &output, TestRegistry::getCurrentRegistry());
+ CommandLineTestRunner runner(ac, av, TestRegistry::getCurrentRegistry());
result = runner.runAllTestsMain();
}
if (result == 0) {
- output << memLeakWarn.FinalReport(0);
+ backupOutput << memLeakWarn.FinalReport(0);
}
TestRegistry::getCurrentRegistry()->removePluginByName(DEF_PLUGIN_MEM_LEAK);
return result;
}
+CommandLineTestRunner::CommandLineTestRunner(int ac, const char *const *av, TestRegistry* registry) :
+ output_(NULLPTR), arguments_(NULLPTR), registry_(registry)
+{
+ arguments_ = new CommandLineArguments(ac, av);
+}
+
+CommandLineTestRunner::~CommandLineTestRunner()
+{
+ delete arguments_;
+ delete output_;
+}
+
int CommandLineTestRunner::runAllTestsMain()
{
- int testResult = 0;
+ int testResult = 1;
SetPointerPlugin pPlugin(DEF_PLUGIN_SET_POINTER);
registry_->installPlugin(&pPlugin);
@@ -87,56 +88,114 @@ void CommandLineTestRunner::initializeTestRun()
{
registry_->setGroupFilters(arguments_->getGroupFilters());
registry_->setNameFilters(arguments_->getNameFilters());
- if (arguments_->isVerbose()) output_->verbose();
+
+ if (arguments_->isVerbose()) output_->verbose(TestOutput::level_verbose);
+ if (arguments_->isVeryVerbose()) output_->verbose(TestOutput::level_veryVerbose);
if (arguments_->isColor()) output_->color();
if (arguments_->runTestsInSeperateProcess()) registry_->setRunTestsInSeperateProcess();
+ if (arguments_->isRunIgnored()) registry_->setRunIgnored();
+ if (arguments_->isCrashingOnFail()) UtestShell::setCrashOnFail();
+
+ UtestShell::setRethrowExceptions( arguments_->isRethrowingExceptions() );
}
int CommandLineTestRunner::runAllTests()
{
initializeTestRun();
- int loopCount = 0;
- int failureCount = 0;
- int repeat_ = arguments_->getRepeatCount();
+ size_t loopCount = 0;
+ size_t failedTestCount = 0;
+ size_t failedExecutionCount = 0;
+ size_t repeatCount = arguments_->getRepeatCount();
- while (loopCount++ < repeat_) {
- output_->printTestRun(loopCount, repeat_);
+ if (arguments_->isListingTestGroupNames())
+ {
+ TestResult tr(*output_);
+ registry_->listTestGroupNames(tr);
+ return 0;
+ }
+
+ if (arguments_->isListingTestGroupAndCaseNames())
+ {
+ TestResult tr(*output_);
+ registry_->listTestGroupAndCaseNames(tr);
+ return 0;
+ }
+
+ if (arguments_->isListingTestLocations())
+ {
+ TestResult tr(*output_);
+ registry_->listTestLocations(tr);
+ return 0;
+ }
+
+ if (arguments_->isReversing())
+ registry_->reverseTests();
+
+ if (arguments_->isShuffling())
+ {
+ output_->print("Test order shuffling enabled with seed: ");
+ output_->print(arguments_->getShuffleSeed());
+ output_->print("\n");
+ }
+ while (loopCount++ < repeatCount) {
+
+ if (arguments_->isShuffling())
+ registry_->shuffleTests(arguments_->getShuffleSeed());
+
+ output_->printTestRun(loopCount, repeatCount);
TestResult tr(*output_);
registry_->runAllTests(tr);
- failureCount += tr.getFailureCount();
+ failedTestCount += tr.getFailureCount();
+ if (tr.isFailure()) {
+ failedExecutionCount++;
+ }
}
+ return (int) (failedTestCount != 0 ? failedTestCount : failedExecutionCount);
+}
- return failureCount;
+TestOutput* CommandLineTestRunner::createTeamCityOutput()
+{
+ return new TeamCityTestOutput;
}
-bool CommandLineTestRunner::parseArguments(TestPlugin* plugin)
+TestOutput* CommandLineTestRunner::createJUnitOutput(const SimpleString& packageName)
{
- if (arguments_->parse(plugin)) {
- if (arguments_->isJUnitOutput()) {
- output_ = jUnitOutput_ = new JUnitTestOutput;
- if (jUnitOutput_ != NULL) {
- jUnitOutput_->setPackageName(arguments_->getPackageName());
- }
- }
- return true;
- }
- else {
- output_->print(arguments_->usage());
- return false;
+ JUnitTestOutput* junitOutput = new JUnitTestOutput;
+ if (junitOutput != NULLPTR) {
+ junitOutput->setPackageName(packageName);
}
+ return junitOutput;
}
-bool CommandLineTestRunner::isVerbose()
+TestOutput* CommandLineTestRunner::createConsoleOutput()
{
- return arguments_->isVerbose();
+ return new ConsoleTestOutput;
}
-bool CommandLineTestRunner::isColor()
+TestOutput* CommandLineTestRunner::createCompositeOutput(TestOutput* outputOne, TestOutput* outputTwo)
{
- return arguments_->isColor();
+ CompositeTestOutput* composite = new CompositeTestOutput;
+ composite->setOutputOne(outputOne);
+ composite->setOutputTwo(outputTwo);
+ return composite;
}
-int CommandLineTestRunner::getRepeatCount()
+bool CommandLineTestRunner::parseArguments(TestPlugin* plugin)
{
- return arguments_->getRepeatCount();
+ if (!arguments_->parse(plugin)) {
+ output_ = createConsoleOutput();
+ output_->print((arguments_->needHelp()) ? arguments_->help() : arguments_->usage());
+ return false;
+ }
+
+ if (arguments_->isJUnitOutput()) {
+ output_= createJUnitOutput(arguments_->getPackageName());
+ if (arguments_->isVerbose() || arguments_->isVeryVerbose())
+ output_ = createCompositeOutput(output_, createConsoleOutput());
+ } else if (arguments_->isTeamCityOutput()) {
+ output_ = createTeamCityOutput();
+ } else
+ output_ = createConsoleOutput();
+ return true;
}
+
diff --git a/src/CppUTest/JUnitTestOutput.cpp b/src/CppUTest/JUnitTestOutput.cpp
index 0a444d68b..f509d9b72 100644
--- a/src/CppUTest/JUnitTestOutput.cpp
+++ b/src/CppUTest/JUnitTestOutput.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -34,27 +34,32 @@
struct JUnitTestCaseResultNode
{
JUnitTestCaseResultNode() :
- execTime_(0), failure_(0), next_(0)
+ execTime_(0), failure_(NULLPTR), ignored_(false), lineNumber_ (0), checkCount_ (0), next_(NULLPTR)
{
}
SimpleString name_;
- long execTime_;
+ size_t execTime_;
TestFailure* failure_;
+ bool ignored_;
+ SimpleString file_;
+ size_t lineNumber_;
+ size_t checkCount_;
JUnitTestCaseResultNode* next_;
};
struct JUnitTestGroupResult
{
JUnitTestGroupResult() :
- testCount_(0), failureCount_(0), startTime_(0), groupExecTime_(0), head_(0), tail_(0)
+ testCount_(0), failureCount_(0), totalCheckCount_(0), startTime_(0), groupExecTime_(0), head_(NULLPTR), tail_(NULLPTR)
{
}
- int testCount_;
- int failureCount_;
- long startTime_;
- long groupExecTime_;
+ size_t testCount_;
+ size_t failureCount_;
+ size_t totalCheckCount_;
+ size_t startTime_;
+ size_t groupExecTime_;
SimpleString group_;
JUnitTestCaseResultNode* head_;
JUnitTestCaseResultNode* tail_;
@@ -65,6 +70,7 @@ struct JUnitTestOutputImpl
JUnitTestGroupResult results_;
PlatformSpecificFile file_;
SimpleString package_;
+ SimpleString stdOutput_;
};
JUnitTestOutput::JUnitTestOutput() :
@@ -86,13 +92,12 @@ void JUnitTestOutput::resetTestGroupResult()
JUnitTestCaseResultNode* cur = impl_->results_.head_;
while (cur) {
JUnitTestCaseResultNode* tmp = cur->next_;
- ;
delete cur->failure_;
delete cur;
cur = tmp;
}
- impl_->results_.head_ = 0;
- impl_->results_.tail_ = 0;
+ impl_->results_.head_ = NULLPTR;
+ impl_->results_.tail_ = NULLPTR;
}
void JUnitTestOutput::printTestsStarted()
@@ -105,8 +110,8 @@ void JUnitTestOutput::printCurrentGroupStarted(const UtestShell& /*test*/)
void JUnitTestOutput::printCurrentTestEnded(const TestResult& result)
{
- impl_->results_.tail_->execTime_
- = result.getCurrentTestTotalExecutionTime();
+ impl_->results_.tail_->execTime_ = result.getCurrentTestTotalExecutionTime();
+ impl_->results_.tail_->checkCount_ = result.getCheckCount();
}
void JUnitTestOutput::printTestsEnded(const TestResult& /*result*/)
@@ -124,9 +129,9 @@ void JUnitTestOutput::printCurrentTestStarted(const UtestShell& test)
{
impl_->results_.testCount_++;
impl_->results_.group_ = test.getGroup();
- impl_->results_.startTime_ = GetPlatformSpecificTimeInMillis();
+ impl_->results_.startTime_ = (size_t) GetPlatformSpecificTimeInMillis();
- if (impl_->results_.tail_ == 0) {
+ if (impl_->results_.tail_ == NULLPTR) {
impl_->results_.head_ = impl_->results_.tail_
= new JUnitTestCaseResultNode;
}
@@ -135,20 +140,39 @@ void JUnitTestOutput::printCurrentTestStarted(const UtestShell& test)
impl_->results_.tail_ = impl_->results_.tail_->next_;
}
impl_->results_.tail_->name_ = test.getName();
+ impl_->results_.tail_->file_ = test.getFile();
+ impl_->results_.tail_->lineNumber_ = test.getLineNumber();
+ if (!test.willRun()) {
+ impl_->results_.tail_->ignored_ = true;
+ }
}
SimpleString JUnitTestOutput::createFileName(const SimpleString& group)
{
SimpleString fileName = "cpputest_";
+ if (!impl_->package_.isEmpty()) {
+ fileName += impl_->package_;
+ fileName += "_";
+ }
fileName += group;
- fileName.replace('/', '_');
- fileName += ".xml";
- return fileName;
+ return encodeFileName(fileName) + ".xml";
+}
+
+SimpleString JUnitTestOutput::encodeFileName(const SimpleString& fileName)
+{
+ // special character list based on: https://en.wikipedia.org/wiki/Filename
+ static const char* const forbiddenCharacters = "/\\?%*:|\"<>";
+
+ SimpleString result = fileName;
+ for (const char* sym = forbiddenCharacters; *sym; ++sym) {
+ result.replace(*sym, '_');
+ }
+ return result;
}
void JUnitTestOutput::setPackageName(const SimpleString& package)
{
- if (impl_ != NULL) {
+ if (impl_ != NULLPTR) {
impl_->package_ = package;
}
}
@@ -158,15 +182,15 @@ void JUnitTestOutput::writeXmlHeader()
writeToFile("\n");
}
-void JUnitTestOutput::writeTestSuiteSummery()
+void JUnitTestOutput::writeTestSuiteSummary()
{
SimpleString
buf =
StringFromFormat(
"\n",
- impl_->results_.failureCount_,
+ (int)impl_->results_.failureCount_,
impl_->results_.group_.asCharString(),
- impl_->results_.testCount_,
+ (int) impl_->results_.testCount_,
(int) (impl_->results_.groupExecTime_ / 1000), (int) (impl_->results_.groupExecTime_ % 1000),
GetPlatformSpecificTimeString());
writeToFile(buf.asCharString());
@@ -178,21 +202,43 @@ void JUnitTestOutput::writeProperties()
writeToFile("\n");
}
+SimpleString JUnitTestOutput::encodeXmlText(const SimpleString& textbody)
+{
+ SimpleString buf = textbody.asCharString();
+ buf.replace("&", "&");
+ buf.replace("\"", """);
+ buf.replace("<", "<");
+ buf.replace(">", ">");
+ buf.replace("\r", "
");
+ buf.replace("\n", "
");
+ return buf;
+}
+
void JUnitTestOutput::writeTestCases()
{
JUnitTestCaseResultNode* cur = impl_->results_.head_;
+
while (cur) {
SimpleString buf = StringFromFormat(
- "\n",
+ "\n",
impl_->package_.asCharString(),
- impl_->package_.isEmpty() == true ? "" : ".",
+ impl_->package_.isEmpty() ? "" : ".",
impl_->results_.group_.asCharString(),
- cur->name_.asCharString(), (int) (cur->execTime_ / 1000), (int)(cur->execTime_ % 1000));
+ cur->name_.asCharString(),
+ (int) (cur->checkCount_ - impl_->results_.totalCheckCount_),
+ (int) (cur->execTime_ / 1000), (int)(cur->execTime_ % 1000),
+ cur->file_.asCharString(),
+ (int) cur->lineNumber_);
writeToFile(buf.asCharString());
+ impl_->results_.totalCheckCount_ = cur->checkCount_;
+
if (cur->failure_) {
writeFailure(cur);
}
+ else if (cur->ignored_) {
+ writeToFile("\n");
+ }
writeToFile("\n");
cur = cur->next_;
}
@@ -200,68 +246,67 @@ void JUnitTestOutput::writeTestCases()
void JUnitTestOutput::writeFailure(JUnitTestCaseResultNode* node)
{
- SimpleString message = node->failure_->getMessage().asCharString();
- message.replace('"', '\'');
- message.replace('<', '[');
- message.replace('>', ']');
- message.replace("&", "&");
- message.replace("\n", "{newline}");
SimpleString buf = StringFromFormat(
"\n",
node->failure_->getFileName().asCharString(),
- node->failure_->getFailureLineNumber(), message.asCharString());
+ (int) node->failure_->getFailureLineNumber(),
+ encodeXmlText(node->failure_->getMessage()).asCharString());
writeToFile(buf.asCharString());
writeToFile("\n");
}
+
void JUnitTestOutput::writeFileEnding()
{
- writeToFile("\n");
+ writeToFile("");
+ writeToFile(encodeXmlText(impl_->stdOutput_));
+ writeToFile("\n");
writeToFile("\n");
- writeToFile("");
+ writeToFile("\n");
}
void JUnitTestOutput::writeTestGroupToFile()
{
openFileForWrite(createFileName(impl_->results_.group_));
writeXmlHeader();
- writeTestSuiteSummery();
+ writeTestSuiteSummary();
writeProperties();
writeTestCases();
writeFileEnding();
closeFile();
}
-void JUnitTestOutput::verbose()
-{
-}
+// LCOV_EXCL_START
void JUnitTestOutput::printBuffer(const char*)
{
}
-void JUnitTestOutput::print(const char*)
+void JUnitTestOutput::print(const char *output)
{
+ impl_->stdOutput_ += output;
}
void JUnitTestOutput::print(long)
{
}
-void JUnitTestOutput::print(const TestFailure& failure)
+void JUnitTestOutput::print(size_t)
{
- if (impl_->results_.tail_->failure_ == 0) {
- impl_->results_.failureCount_++;
- impl_->results_.tail_->failure_ = new TestFailure(failure);
- }
}
-void JUnitTestOutput::printTestRun(int /*number*/, int /*total*/)
+void JUnitTestOutput::flush()
{
}
-void JUnitTestOutput::flush()
+// LCOV_EXCL_STOP
+
+void JUnitTestOutput::printFailure(const TestFailure& failure)
{
+ if (impl_->results_.tail_->failure_ == NULLPTR) {
+ impl_->results_.failureCount_++;
+ impl_->results_.tail_->failure_ = new TestFailure(failure);
+ }
}
void JUnitTestOutput::openFileForWrite(const SimpleString& fileName)
diff --git a/src/CppUTest/MemoryLeakDetector.cpp b/src/CppUTest/MemoryLeakDetector.cpp
index 7e303f7e4..89e45908e 100644
--- a/src/CppUTest/MemoryLeakDetector.cpp
+++ b/src/CppUTest/MemoryLeakDetector.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -28,8 +28,11 @@
#include "CppUTest/MemoryLeakDetector.h"
#include "CppUTest/TestMemoryAllocator.h"
#include "CppUTest/PlatformSpecificFunctions.h"
+#include "CppUTest/SimpleMutex.h"
-#define UNKNOWN ((char*)(""))
+static const char* UNKNOWN = "";
+
+static const char GuardBytes[] = {'B','A','S'};
SimpleStringBuffer::SimpleStringBuffer() :
positions_filled_(0), write_limit_(SIMPLE_STRING_BUFFER_LEN-1)
@@ -45,13 +48,12 @@ void SimpleStringBuffer::clear()
void SimpleStringBuffer::add(const char* format, ...)
{
- int count = 0;
- size_t positions_left = write_limit_ - positions_filled_;
- if (positions_left <= 0) return;
+ const size_t positions_left = write_limit_ - positions_filled_;
+ if (positions_left == 0) return;
va_list arguments;
va_start(arguments, format);
- count = PlatformSpecificVSNprintf(buffer_ + positions_filled_, positions_left+1, format, arguments);
+ const int count = PlatformSpecificVSNprintf(buffer_ + positions_filled_, positions_left+1, format, arguments);
if (count > 0) positions_filled_ += (size_t) count;
if (positions_filled_ > write_limit_) positions_filled_ = write_limit_;
va_end(arguments);
@@ -62,22 +64,23 @@ void SimpleStringBuffer::addMemoryDump(const void* memory, size_t memorySize)
const unsigned char* byteMemory = (const unsigned char*)memory;
const size_t maxLineBytes = 16;
size_t currentPos = 0;
+ size_t p;
while (currentPos < memorySize) {
- add(" %04lx: ", currentPos);
+ add(" %04lx: ", (unsigned long) currentPos);
size_t bytesInLine = memorySize - currentPos;
if (bytesInLine > maxLineBytes) {
bytesInLine = maxLineBytes;
}
const size_t leftoverBytes = maxLineBytes - bytesInLine;
- for (size_t p = 0; p < bytesInLine; p++) {
- add("%02hhx ", byteMemory[currentPos + p]);
+ for (p = 0; p < bytesInLine; p++) {
+ add("%02hx ", (unsigned short) byteMemory[currentPos + p]);
if (p == ((maxLineBytes / 2) - 1)) {
add(" ");
}
}
- for (size_t p = 0; p < leftoverBytes; p++) {
+ for (p = 0; p < leftoverBytes; p++) {
add(" ");
}
if (leftoverBytes > (maxLineBytes/2)) {
@@ -85,7 +88,7 @@ void SimpleStringBuffer::addMemoryDump(const void* memory, size_t memorySize)
}
add("|");
- for (size_t p = 0; p < bytesInLine; p++) {
+ for (p = 0; p < bytesInLine; p++) {
char toAdd = (char)byteMemory[currentPos + p];
if (toAdd < ' ' || toAdd > '~') {
toAdd = '.';
@@ -120,7 +123,7 @@ bool SimpleStringBuffer::reachedItsCapacity()
////////////////////////
-#define MEM_LEAK_TOO_MUCH "\netc etc etc etc. !!!! Too much memory leaks to report. Bailing out\n"
+#define MEM_LEAK_TOO_MUCH "\netc etc etc etc. !!!! Too many memory leaks to report. Bailing out\n"
#define MEM_LEAK_FOOTER "Total number of leaks: "
#define MEM_LEAK_ADDITION_MALLOC_WARNING "NOTE:\n" \
"\tMemory leak reports about malloc and free can be caused by allocating using the cpputest version of malloc,\n" \
@@ -132,14 +135,14 @@ MemoryLeakOutputStringBuffer::MemoryLeakOutputStringBuffer()
{
}
-void MemoryLeakOutputStringBuffer::addAllocationLocation(const char* allocationFile, int allocationLineNumber, size_t allocationSize, TestMemoryAllocator* allocator)
+void MemoryLeakOutputStringBuffer::addAllocationLocation(const char* allocationFile, size_t allocationLineNumber, size_t allocationSize, TestMemoryAllocator* allocator)
{
- outputBuffer_.add(" allocated at file: %s line: %d size: %lu type: %s\n", allocationFile, allocationLineNumber, (unsigned long) allocationSize, allocator->alloc_name());
+ outputBuffer_.add(" allocated at file: %s line: %d size: %lu type: %s\n", allocationFile, (int) allocationLineNumber, (unsigned long) allocationSize, allocator->alloc_name());
}
-void MemoryLeakOutputStringBuffer::addDeallocationLocation(const char* freeFile, int freeLineNumber, TestMemoryAllocator* allocator)
+void MemoryLeakOutputStringBuffer::addDeallocationLocation(const char* freeFile, size_t freeLineNumber, TestMemoryAllocator* allocator)
{
- outputBuffer_.add(" deallocated at file: %s line: %d type: %s\n", freeFile, freeLineNumber, allocator->free_name());
+ outputBuffer_.add(" deallocated at file: %s line: %d type: %s\n", freeFile, (int) freeLineNumber, allocator->free_name());
}
void MemoryLeakOutputStringBuffer::addNoMemoryLeaksMessage()
@@ -166,7 +169,7 @@ void MemoryLeakOutputStringBuffer::reportMemoryLeak(MemoryLeakDetectorNode* leak
total_leaks_++;
outputBuffer_.add("Alloc num (%u) Leak size: %lu Allocated at: %s and line: %d. Type: \"%s\"\n\tMemory: <%p> Content:\n",
- leak->number_, (unsigned long) leak->size_, leak->file_, leak->line_, leak->allocator_->alloc_name(), leak->memory_);
+ leak->number_, (unsigned long) leak->size_, leak->file_, (int) leak->line_, leak->allocator_->alloc_name(), (void*) leak->memory_);
outputBuffer_.addMemoryDump(leak->memory_, leak->size_);
if (SimpleString::StrCmp(leak->allocator_->alloc_name(), (const char*) "malloc") == 0)
@@ -203,9 +206,9 @@ void MemoryLeakOutputStringBuffer::addErrorMessageForTooMuchLeaks()
outputBuffer_.add(MEM_LEAK_TOO_MUCH);
}
-void MemoryLeakOutputStringBuffer::addMemoryLeakFooter(int amountOfLeaks)
+void MemoryLeakOutputStringBuffer::addMemoryLeakFooter(size_t amountOfLeaks)
{
- outputBuffer_.add("%s %d\n", MEM_LEAK_FOOTER, amountOfLeaks);
+ outputBuffer_.add("%s %d\n", MEM_LEAK_FOOTER, (int) amountOfLeaks);
}
void MemoryLeakOutputStringBuffer::addWarningForUsingMalloc()
@@ -213,22 +216,22 @@ void MemoryLeakOutputStringBuffer::addWarningForUsingMalloc()
outputBuffer_.add(MEM_LEAK_ADDITION_MALLOC_WARNING);
}
-void MemoryLeakOutputStringBuffer::reportDeallocateNonAllocatedMemoryFailure(const char* freeFile, int freeLine, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter)
+void MemoryLeakOutputStringBuffer::reportDeallocateNonAllocatedMemoryFailure(const char* freeFile, size_t freeLine, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter)
{
reportFailure("Deallocating non-allocated memory\n", "", 0, 0, NullUnknownAllocator::defaultAllocator(), freeFile, freeLine, freeAllocator, reporter);
}
-void MemoryLeakOutputStringBuffer::reportAllocationDeallocationMismatchFailure(MemoryLeakDetectorNode* node, const char* freeFile, int freeLineNumber, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter)
+void MemoryLeakOutputStringBuffer::reportAllocationDeallocationMismatchFailure(MemoryLeakDetectorNode* node, const char* freeFile, size_t freeLineNumber, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter)
{
reportFailure("Allocation/deallocation type mismatch\n", node->file_, node->line_, node->size_, node->allocator_, freeFile, freeLineNumber, freeAllocator, reporter);
}
-void MemoryLeakOutputStringBuffer::reportMemoryCorruptionFailure(MemoryLeakDetectorNode* node, const char* freeFile, int freeLineNumber, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter)
+void MemoryLeakOutputStringBuffer::reportMemoryCorruptionFailure(MemoryLeakDetectorNode* node, const char* freeFile, size_t freeLineNumber, TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter)
{
reportFailure("Memory corruption (written out of bounds?)\n", node->file_, node->line_, node->size_, node->allocator_, freeFile, freeLineNumber, freeAllocator, reporter);
}
-void MemoryLeakOutputStringBuffer::reportFailure(const char* message, const char* allocFile, int allocLine, size_t allocSize, TestMemoryAllocator* allocAllocator, const char* freeFile, int freeLine,
+void MemoryLeakOutputStringBuffer::reportFailure(const char* message, const char* allocFile, size_t allocLine, size_t allocSize, TestMemoryAllocator* allocAllocator, const char* freeFile, size_t freeLine,
TestMemoryAllocator* freeAllocator, MemoryLeakFailure* reporter)
{
outputBuffer_.add("%s", message);
@@ -250,13 +253,14 @@ void MemoryLeakOutputStringBuffer::clear()
////////////////////////
-void MemoryLeakDetectorNode::init(char* memory, unsigned number, size_t size, TestMemoryAllocator* allocator, MemLeakPeriod period, const char* file, int line)
+void MemoryLeakDetectorNode::init(char* memory, unsigned number, size_t size, TestMemoryAllocator* allocator, MemLeakPeriod period, unsigned char allocation_stage, const char* file, size_t line)
{
number_ = number;
memory_ = memory;
size_ = size;
allocator_ = allocator;
period_ = period;
+ allocation_stage_ = allocation_stage;
file_ = file;
line_ = line;
}
@@ -268,10 +272,15 @@ bool MemoryLeakDetectorList::isInPeriod(MemoryLeakDetectorNode* node, MemLeakPer
return period == mem_leak_period_all || node->period_ == period || (node->period_ != mem_leak_period_disabled && period == mem_leak_period_enabled);
}
+bool MemoryLeakDetectorList::isInAllocationStage(MemoryLeakDetectorNode* node, unsigned char allocation_stage)
+{
+ return node->allocation_stage_ == allocation_stage;
+}
+
void MemoryLeakDetectorList::clearAllAccounting(MemLeakPeriod period)
{
MemoryLeakDetectorNode* cur = head_;
- MemoryLeakDetectorNode* prev = 0;
+ MemoryLeakDetectorNode* prev = NULLPTR;
while (cur) {
if (isInPeriod(cur, period)) {
@@ -299,7 +308,7 @@ void MemoryLeakDetectorList::addNewNode(MemoryLeakDetectorNode* node)
MemoryLeakDetectorNode* MemoryLeakDetectorList::removeNode(char* memory)
{
MemoryLeakDetectorNode* cur = head_;
- MemoryLeakDetectorNode* prev = 0;
+ MemoryLeakDetectorNode* prev = NULLPTR;
while (cur) {
if (cur->memory_ == memory) {
if (prev) {
@@ -314,7 +323,7 @@ MemoryLeakDetectorNode* MemoryLeakDetectorList::removeNode(char* memory)
prev = cur;
cur = cur->next_;
}
- return 0;
+ return NULLPTR;
}
MemoryLeakDetectorNode* MemoryLeakDetectorList::retrieveNode(char* memory)
@@ -325,14 +334,21 @@ MemoryLeakDetectorNode* MemoryLeakDetectorList::retrieveNode(char* memory)
return cur;
cur = cur->next_;
}
- return NULL;
+ return NULLPTR;
}
MemoryLeakDetectorNode* MemoryLeakDetectorList::getLeakFrom(MemoryLeakDetectorNode* node, MemLeakPeriod period)
{
for (MemoryLeakDetectorNode* cur = node; cur; cur = cur->next_)
if (isInPeriod(cur, period)) return cur;
- return 0;
+ return NULLPTR;
+}
+
+MemoryLeakDetectorNode* MemoryLeakDetectorList::getLeakForAllocationStageFrom(MemoryLeakDetectorNode* node, unsigned char allocation_stage)
+{
+ for (MemoryLeakDetectorNode* cur = node; cur; cur = cur->next_)
+ if (isInAllocationStage(cur, allocation_stage)) return cur;
+ return NULLPTR;
}
MemoryLeakDetectorNode* MemoryLeakDetectorList::getFirstLeak(MemLeakPeriod period)
@@ -340,27 +356,32 @@ MemoryLeakDetectorNode* MemoryLeakDetectorList::getFirstLeak(MemLeakPeriod perio
return getLeakFrom(head_, period);
}
+MemoryLeakDetectorNode* MemoryLeakDetectorList::getFirstLeakForAllocationStage(unsigned char allocation_stage)
+{
+ return getLeakForAllocationStageFrom(head_, allocation_stage);
+}
+
MemoryLeakDetectorNode* MemoryLeakDetectorList::getNextLeak(MemoryLeakDetectorNode* node, MemLeakPeriod period)
{
return getLeakFrom(node->next_, period);
}
-int MemoryLeakDetectorList::getTotalLeaks(MemLeakPeriod period)
+MemoryLeakDetectorNode* MemoryLeakDetectorList::getNextLeakForAllocationStage(MemoryLeakDetectorNode* node, unsigned char allocation_stage)
+{
+ return getLeakForAllocationStageFrom(node->next_, allocation_stage);
+}
+
+
+
+size_t MemoryLeakDetectorList::getTotalLeaks(MemLeakPeriod period)
{
- int total_leaks = 0;
+ size_t total_leaks = 0;
for (MemoryLeakDetectorNode* node = head_; node; node = node->next_) {
if (isInPeriod(node, period)) total_leaks++;
}
return total_leaks;
}
-bool MemoryLeakDetectorList::hasLeaks(MemLeakPeriod period)
-{
- for (MemoryLeakDetectorNode* node = head_; node; node = node->next_)
- if (isInPeriod(node, period)) return true;
- return false;
-}
-
/////////////////////////////////////////////////////////////
unsigned long MemoryLeakDetectorTable::hash(char* memory)
@@ -389,16 +410,9 @@ MemoryLeakDetectorNode* MemoryLeakDetectorTable::retrieveNode(char* memory)
return table_[hash(memory)].retrieveNode(memory);
}
-bool MemoryLeakDetectorTable::hasLeaks(MemLeakPeriod period)
-{
- for (int i = 0; i < hash_prime; i++)
- if (table_[i].hasLeaks(period)) return true;
- return false;
-}
-
-int MemoryLeakDetectorTable::getTotalLeaks(MemLeakPeriod period)
+size_t MemoryLeakDetectorTable::getTotalLeaks(MemLeakPeriod period)
{
- int total_leaks = 0;
+ size_t total_leaks = 0;
for (int i = 0; i < hash_prime; i++)
total_leaks += table_[i].getTotalLeaks(period);
return total_leaks;
@@ -410,7 +424,16 @@ MemoryLeakDetectorNode* MemoryLeakDetectorTable::getFirstLeak(MemLeakPeriod peri
MemoryLeakDetectorNode* node = table_[i].getFirstLeak(period);
if (node) return node;
}
- return 0;
+ return NULLPTR;
+}
+
+MemoryLeakDetectorNode* MemoryLeakDetectorTable::getFirstLeakForAllocationStage(unsigned char allocation_stage)
+{
+ for (int i = 0; i < hash_prime; i++) {
+ MemoryLeakDetectorNode* node = table_[i].getFirstLeakForAllocationStage(allocation_stage);
+ if (node) return node;
+ }
+ return NULLPTR;
}
MemoryLeakDetectorNode* MemoryLeakDetectorTable::getNextLeak(MemoryLeakDetectorNode* leak, MemLeakPeriod period)
@@ -423,7 +446,20 @@ MemoryLeakDetectorNode* MemoryLeakDetectorTable::getNextLeak(MemoryLeakDetectorN
node = table_[i].getFirstLeak(period);
if (node) return node;
}
- return 0;
+ return NULLPTR;
+}
+
+MemoryLeakDetectorNode* MemoryLeakDetectorTable::getNextLeakForAllocationStage(MemoryLeakDetectorNode* leak, unsigned char allocation_stage)
+{
+ unsigned long i = hash(leak->memory_);
+ MemoryLeakDetectorNode* node = table_[i].getNextLeakForAllocationStage(leak, allocation_stage);
+ if (node) return node;
+
+ for (++i; i < hash_prime; i++) {
+ node = table_[i].getFirstLeakForAllocationStage(allocation_stage);
+ if (node) return node;
+ }
+ return NULLPTR;
}
/////////////////////////////////////////////////////////////
@@ -433,9 +469,17 @@ MemoryLeakDetector::MemoryLeakDetector(MemoryLeakFailure* reporter)
doAllocationTypeChecking_ = true;
allocationSequenceNumber_ = 1;
current_period_ = mem_leak_period_disabled;
+ current_allocation_stage_ = 0;
reporter_ = reporter;
- outputBuffer_ = MemoryLeakOutputStringBuffer();
- memoryTable_ = MemoryLeakDetectorTable();
+ mutex_ = new SimpleMutex;
+}
+
+MemoryLeakDetector::~MemoryLeakDetector()
+{
+ if (mutex_)
+ {
+ delete mutex_;
+ }
}
void MemoryLeakDetector::clearAllAccounting(MemLeakPeriod period)
@@ -454,6 +498,11 @@ void MemoryLeakDetector::stopChecking()
current_period_ = mem_leak_period_enabled;
}
+unsigned char MemoryLeakDetector::getCurrentAllocationStage() const
+{
+ return current_allocation_stage_;
+}
+
void MemoryLeakDetector::enable()
{
current_period_ = mem_leak_period_enabled;
@@ -479,9 +528,28 @@ unsigned MemoryLeakDetector::getCurrentAllocationNumber()
return allocationSequenceNumber_;
}
+void MemoryLeakDetector::increaseAllocationStage()
+{
+ current_allocation_stage_++;
+}
+
+void MemoryLeakDetector::decreaseAllocationStage()
+{
+ current_allocation_stage_--;
+}
+
+SimpleMutex *MemoryLeakDetector::getMutex()
+{
+ return mutex_;
+}
+
static size_t calculateVoidPointerAlignedSize(size_t size)
{
+#ifndef CPPUTEST_DISABLE_MEM_CORRUPTION_CHECK
return (sizeof(void*) - (size % sizeof(void*))) + size;
+#else
+ return size;
+#endif
}
size_t MemoryLeakDetector::sizeOfMemoryWithCorruptionInfo(size_t size)
@@ -494,17 +562,17 @@ MemoryLeakDetectorNode* MemoryLeakDetector::getNodeFromMemoryPointer(char* memor
return (MemoryLeakDetectorNode*) (void*) (memory + sizeOfMemoryWithCorruptionInfo(memory_size));
}
-void MemoryLeakDetector::storeLeakInformation(MemoryLeakDetectorNode * node, char *new_memory, size_t size, TestMemoryAllocator *allocator, const char *file, int line)
+void MemoryLeakDetector::storeLeakInformation(MemoryLeakDetectorNode * node, char *new_memory, size_t size, TestMemoryAllocator *allocator, const char *file, size_t line)
{
- node->init(new_memory, allocationSequenceNumber_++, size, allocator, current_period_, file, line);
+ node->init(new_memory, allocationSequenceNumber_++, size, allocator, current_period_, current_allocation_stage_, file, line);
addMemoryCorruptionInformation(node->memory_ + node->size_);
memoryTable_.addNewNode(node);
}
-char* MemoryLeakDetector::reallocateMemoryAndLeakInformation(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, bool allocatNodesSeperately)
+char* MemoryLeakDetector::reallocateMemoryAndLeakInformation(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, size_t line, bool allocatNodesSeperately)
{
char* new_memory = reallocateMemoryWithAccountingInformation(allocator, memory, size, file, line, allocatNodesSeperately);
- if (new_memory == NULL) return NULL;
+ if (new_memory == NULLPTR) return NULLPTR;
MemoryLeakDetectorNode *node = createMemoryLeakAccountingInformation(allocator, size, new_memory, allocatNodesSeperately);
storeLeakInformation(node, new_memory, size, allocator, file, line);
@@ -513,21 +581,25 @@ char* MemoryLeakDetector::reallocateMemoryAndLeakInformation(TestMemoryAllocator
void MemoryLeakDetector::invalidateMemory(char* memory)
{
+#ifndef CPPUTEST_DISABLE_HEAP_POISON
MemoryLeakDetectorNode* node = memoryTable_.retrieveNode(memory);
if (node)
PlatformSpecificMemset(memory, 0xCD, node->size_);
+#endif
}
void MemoryLeakDetector::addMemoryCorruptionInformation(char* memory)
{
- memory[0] = 'B';
- memory[1] = 'A';
- memory[2] = 'S';
+ for (size_t i=0; iisOfEqualType(alloc_allocator);
}
-void MemoryLeakDetector::checkForCorruption(MemoryLeakDetectorNode* node, const char* file, int line, TestMemoryAllocator* allocator, bool allocateNodesSeperately)
+void MemoryLeakDetector::checkForCorruption(MemoryLeakDetectorNode* node, const char* file, size_t line, TestMemoryAllocator* allocator, bool allocateNodesSeperately)
{
- if (!matchingAllocation(node->allocator_, allocator))
- outputBuffer_.reportAllocationDeallocationMismatchFailure(node, file, line, allocator, reporter_);
+ if (!matchingAllocation(node->allocator_->actualAllocator(), allocator->actualAllocator()))
+ outputBuffer_.reportAllocationDeallocationMismatchFailure(node, file, line, allocator->actualAllocator(), reporter_);
else if (!validMemoryCorruptionInformation(node->memory_ + node->size_))
- outputBuffer_.reportMemoryCorruptionFailure(node, file, line, allocator, reporter_);
+ outputBuffer_.reportMemoryCorruptionFailure(node, file, line, allocator->actualAllocator(), reporter_);
else if (allocateNodesSeperately)
allocator->freeMemoryLeakNode((char*) node);
}
@@ -552,13 +624,13 @@ char* MemoryLeakDetector::allocMemory(TestMemoryAllocator* allocator, size_t siz
return allocMemory(allocator, size, UNKNOWN, 0, allocatNodesSeperately);
}
-char* MemoryLeakDetector::allocateMemoryWithAccountingInformation(TestMemoryAllocator* allocator, size_t size, const char* file, int line, bool allocatNodesSeperately)
+char* MemoryLeakDetector::allocateMemoryWithAccountingInformation(TestMemoryAllocator* allocator, size_t size, const char* file, size_t line, bool allocatNodesSeperately)
{
if (allocatNodesSeperately) return allocator->alloc_memory(sizeOfMemoryWithCorruptionInfo(size), file, line);
else return allocator->alloc_memory(sizeOfMemoryWithCorruptionInfo(size) + sizeof(MemoryLeakDetectorNode), file, line);
}
-char* MemoryLeakDetector::reallocateMemoryWithAccountingInformation(TestMemoryAllocator* /*allocator*/, char* memory, size_t size, const char* /*file*/, int /*line*/, bool allocatNodesSeperately)
+char* MemoryLeakDetector::reallocateMemoryWithAccountingInformation(TestMemoryAllocator* /*allocator*/, char* memory, size_t size, const char* /*file*/, size_t /*line*/, bool allocatNodesSeperately)
{
if (allocatNodesSeperately) return (char*) PlatformSpecificRealloc(memory, sizeOfMemoryWithCorruptionInfo(size));
else return (char*) PlatformSpecificRealloc(memory, sizeOfMemoryWithCorruptionInfo(size) + sizeof(MemoryLeakDetectorNode));
@@ -570,8 +642,11 @@ MemoryLeakDetectorNode* MemoryLeakDetector::createMemoryLeakAccountingInformatio
else return getNodeFromMemoryPointer(memory, size);
}
-char* MemoryLeakDetector::allocMemory(TestMemoryAllocator* allocator, size_t size, const char* file, int line, bool allocatNodesSeperately)
+char* MemoryLeakDetector::allocMemory(TestMemoryAllocator* allocator, size_t size, const char* file, size_t line, bool allocatNodesSeperately)
{
+#ifdef CPPUTEST_DISABLE_MEM_CORRUPTION_CHECK
+ allocatNodesSeperately = true;
+#endif
/* With malloc, it is harder to guarantee that the allocator free is called.
* This is because operator new is overloaded via linker symbols, but malloc just via #defines.
* If the same allocation is used and the wrong free is called, it will deallocate the memory leak information
@@ -580,7 +655,7 @@ char* MemoryLeakDetector::allocMemory(TestMemoryAllocator* allocator, size_t siz
*/
char* memory = allocateMemoryWithAccountingInformation(allocator, size, file, line, allocatNodesSeperately);
- if (memory == NULL) return NULL;
+ if (memory == NULLPTR) return NULLPTR;
MemoryLeakDetectorNode* node = createMemoryLeakAccountingInformation(allocator, size, memory, allocatNodesSeperately);
storeLeakInformation(node, memory, size, allocator, file, line);
@@ -593,18 +668,22 @@ void MemoryLeakDetector::removeMemoryLeakInformationWithoutCheckingOrDeallocatin
if (allocatNodesSeperately) allocator->freeMemoryLeakNode( (char*) node);
}
-void MemoryLeakDetector::deallocMemory(TestMemoryAllocator* allocator, void* memory, const char* file, int line, bool allocatNodesSeperately)
+void MemoryLeakDetector::deallocMemory(TestMemoryAllocator* allocator, void* memory, const char* file, size_t line, bool allocatNodesSeperately)
{
- if (memory == 0) return;
+ if (memory == NULLPTR) return;
MemoryLeakDetectorNode* node = memoryTable_.removeNode((char*) memory);
- if (node == NULL) {
+ if (node == NULLPTR) {
outputBuffer_.reportDeallocateNonAllocatedMemoryFailure(file, line, allocator, reporter_);
return;
}
+#ifdef CPPUTEST_DISABLE_MEM_CORRUPTION_CHECK
+ allocatNodesSeperately = true;
+#endif
if (!allocator->hasBeenDestroyed()) {
+ size_t size = node->size_;
checkForCorruption(node, file, line, allocator, allocatNodesSeperately);
- allocator->free_memory((char*) memory, file, line);
+ allocator->free_memory((char*) memory, size, file, line);
}
}
@@ -613,13 +692,28 @@ void MemoryLeakDetector::deallocMemory(TestMemoryAllocator* allocator, void* mem
deallocMemory(allocator, (char*) memory, UNKNOWN, 0, allocatNodesSeperately);
}
-char* MemoryLeakDetector::reallocMemory(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, bool allocatNodesSeperately)
+void MemoryLeakDetector::deallocAllMemoryInCurrentAllocationStage()
{
+ char* memory = NULLPTR;
+ MemoryLeakDetectorNode* node = memoryTable_.getFirstLeakForAllocationStage(current_allocation_stage_);
+ while (node) {
+ memory = node->memory_;
+ TestMemoryAllocator* allocator = node->allocator_;
+ node = memoryTable_.getNextLeakForAllocationStage(node, current_allocation_stage_);
+ deallocMemory(allocator, memory, __FILE__, __LINE__);
+ }
+}
+
+char* MemoryLeakDetector::reallocMemory(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, size_t line, bool allocatNodesSeperately)
+{
+#ifdef CPPUTEST_DISABLE_MEM_CORRUPTION_CHECK
+ allocatNodesSeperately = true;
+#endif
if (memory) {
MemoryLeakDetectorNode* node = memoryTable_.removeNode(memory);
- if (node == NULL) {
+ if (node == NULLPTR) {
outputBuffer_.reportDeallocateNonAllocatedMemoryFailure(file, line, allocator, reporter_);
- return NULL;
+ return NULLPTR;
}
checkForCorruption(node, file, line, allocator, allocatNodesSeperately);
}
@@ -642,7 +736,6 @@ void MemoryLeakDetector::ConstructMemoryLeakReport(MemLeakPeriod period)
const char* MemoryLeakDetector::report(MemLeakPeriod period)
{
- outputBuffer_.clear();
ConstructMemoryLeakReport(period);
return outputBuffer_.toString();
@@ -657,7 +750,7 @@ void MemoryLeakDetector::markCheckingPeriodLeaksAsNonCheckingPeriod()
}
}
-int MemoryLeakDetector::totalMemoryLeaks(MemLeakPeriod period)
+size_t MemoryLeakDetector::totalMemoryLeaks(MemLeakPeriod period)
{
return memoryTable_.getTotalLeaks(period);
}
diff --git a/src/CppUTest/MemoryLeakWarningPlugin.cpp b/src/CppUTest/MemoryLeakWarningPlugin.cpp
index 03b556fd8..e954d6338 100644
--- a/src/CppUTest/MemoryLeakWarningPlugin.cpp
+++ b/src/CppUTest/MemoryLeakWarningPlugin.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -30,65 +30,97 @@
#include "CppUTest/MemoryLeakDetector.h"
#include "CppUTest/TestMemoryAllocator.h"
#include "CppUTest/PlatformSpecificFunctions.h"
+#include "CppUTest/SimpleMutex.h"
/********** Enabling and disabling for C also *********/
#if CPPUTEST_USE_MEM_LEAK_DETECTION
-static void* mem_leak_malloc(size_t size, const char* file, int line)
+class MemLeakScopedMutex
{
+public:
+ MemLeakScopedMutex() : lock(MemoryLeakWarningPlugin::getGlobalDetector()->getMutex()) { }
+private:
+ ScopedMutexLock lock;
+};
+
+static void* threadsafe_mem_leak_malloc(size_t size, const char* file, size_t line)
+{
+ MemLeakScopedMutex lock;
return MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentMallocAllocator(), size, file, line, true);
}
-static void mem_leak_free(void* buffer, const char* file, int line)
+static void threadsafe_mem_leak_free(void* buffer, const char* file, size_t line)
{
+ MemLeakScopedMutex lock;
MemoryLeakWarningPlugin::getGlobalDetector()->invalidateMemory((char*) buffer);
MemoryLeakWarningPlugin::getGlobalDetector()->deallocMemory(getCurrentMallocAllocator(), (char*) buffer, file, line, true);
}
-static void* mem_leak_realloc(void* memory, size_t size, const char* file, int line)
+static void* threadsafe_mem_leak_realloc(void* memory, size_t size, const char* file, size_t line)
+{
+ MemLeakScopedMutex lock;
+ return MemoryLeakWarningPlugin::getGlobalDetector()->reallocMemory(getCurrentMallocAllocator(), (char*) memory, size, file, line, true);
+}
+
+
+static void* mem_leak_malloc(size_t size, const char* file, size_t line)
+{
+ return MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentMallocAllocator(), size, file, line, true);
+}
+
+static void mem_leak_free(void* buffer, const char* file, size_t line)
+{
+ MemoryLeakWarningPlugin::getGlobalDetector()->invalidateMemory((char*) buffer);
+ MemoryLeakWarningPlugin::getGlobalDetector()->deallocMemory(getCurrentMallocAllocator(), (char*) buffer, file, line, true);
+}
+
+static void* mem_leak_realloc(void* memory, size_t size, const char* file, size_t line)
{
return MemoryLeakWarningPlugin::getGlobalDetector()->reallocMemory(getCurrentMallocAllocator(), (char*) memory, size, file, line, true);
}
#endif
-static void* normal_malloc(size_t size, const char*, int)
+static void* normal_malloc(size_t size, const char*, size_t)
{
return PlatformSpecificMalloc(size);
}
-static void* normal_realloc(void* memory, size_t size, const char*, int)
+static void* normal_realloc(void* memory, size_t size, const char*, size_t)
{
return PlatformSpecificRealloc(memory, size);
}
-static void normal_free(void* buffer, const char*, int)
+static void normal_free(void* buffer, const char*, size_t)
{
PlatformSpecificFree(buffer);
}
#if CPPUTEST_USE_MEM_LEAK_DETECTION
-static void *(*malloc_fptr)(size_t size, const char* file, int line) = mem_leak_malloc;
-static void (*free_fptr)(void* mem, const char* file, int line) = mem_leak_free;
-static void*(*realloc_fptr)(void* memory, size_t size, const char* file, int line) = mem_leak_realloc;
+static void *(*malloc_fptr)(size_t size, const char* file, size_t line) = mem_leak_malloc;
+static void (*free_fptr)(void* mem, const char* file, size_t line) = mem_leak_free;
+static void*(*realloc_fptr)(void* memory, size_t size, const char* file, size_t line) = mem_leak_realloc;
+static void *(*saved_malloc_fptr)(size_t size, const char* file, size_t line) = mem_leak_malloc;
+static void (*saved_free_fptr)(void* mem, const char* file, size_t line) = mem_leak_free;
+static void*(*saved_realloc_fptr)(void* memory, size_t size, const char* file, size_t line) = mem_leak_realloc;
#else
-static void *(*malloc_fptr)(size_t size, const char* file, int line) = normal_malloc;
-static void (*free_fptr)(void* mem, const char* file, int line) = normal_free;
-static void*(*realloc_fptr)(void* memory, size_t size, const char* file, int line) = normal_realloc;
+static void *(*malloc_fptr)(size_t size, const char* file, size_t line) = normal_malloc;
+static void (*free_fptr)(void* mem, const char* file, size_t line) = normal_free;
+static void*(*realloc_fptr)(void* memory, size_t size, const char* file, size_t line) = normal_realloc;
#endif
-void* cpputest_malloc_location_with_leak_detection(size_t size, const char* file, int line)
+void* cpputest_malloc_location_with_leak_detection(size_t size, const char* file, size_t line)
{
return malloc_fptr(size, file, line);
}
-void* cpputest_realloc_location_with_leak_detection(void* memory, size_t size, const char* file, int line)
+void* cpputest_realloc_location_with_leak_detection(void* memory, size_t size, const char* file, size_t line)
{
return realloc_fptr(memory, size, file, line);
}
-void cpputest_free_location_with_leak_detection(void* buffer, const char* file, int line)
+void cpputest_free_location_with_leak_detection(void* buffer, const char* file, size_t line)
{
free_fptr(buffer, file, line);
}
@@ -98,13 +130,72 @@ void cpputest_free_location_with_leak_detection(void* buffer, const char* file,
#if CPPUTEST_USE_MEM_LEAK_DETECTION
#undef new
-#if CPPUTEST_USE_STD_CPP_LIB
-#define UT_THROW_BAD_ALLOC_WHEN_NULL(memory) if (memory == NULL) throw std::bad_alloc();
+#if CPPUTEST_HAVE_EXCEPTIONS
+#define UT_THROW_BAD_ALLOC_WHEN_NULL(memory) if ((memory) == NULLPTR) throw CPPUTEST_BAD_ALLOC()
#else
#define UT_THROW_BAD_ALLOC_WHEN_NULL(memory)
#endif
-static void* mem_leak_operator_new (size_t size) UT_THROW(std::bad_alloc)
+static void* threadsafe_mem_leak_operator_new (size_t size) UT_THROW(CPPUTEST_BAD_ALLOC)
+{
+ MemLeakScopedMutex lock;
+ void* memory = MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewAllocator(), size);
+ UT_THROW_BAD_ALLOC_WHEN_NULL(memory);
+ return memory;
+}
+
+static void* threadsafe_mem_leak_operator_new_nothrow (size_t size) UT_NOTHROW
+{
+ MemLeakScopedMutex lock;
+ return MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewAllocator(), size);
+}
+
+static void* threadsafe_mem_leak_operator_new_debug (size_t size, const char* file, size_t line) UT_THROW(CPPUTEST_BAD_ALLOC)
+{
+ MemLeakScopedMutex lock;
+ void *memory = MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewAllocator(), size, file, line);
+ UT_THROW_BAD_ALLOC_WHEN_NULL(memory);
+ return memory;
+}
+
+static void* threadsafe_mem_leak_operator_new_array (size_t size) UT_THROW(CPPUTEST_BAD_ALLOC)
+{
+ MemLeakScopedMutex lock;
+ void* memory = MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewArrayAllocator(), size);
+ UT_THROW_BAD_ALLOC_WHEN_NULL(memory);
+ return memory;
+}
+
+static void* threadsafe_mem_leak_operator_new_array_nothrow (size_t size) UT_NOTHROW
+{
+ MemLeakScopedMutex lock;
+ return MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewArrayAllocator(), size);
+}
+
+static void* threadsafe_mem_leak_operator_new_array_debug (size_t size, const char* file, size_t line) UT_THROW(CPPUTEST_BAD_ALLOC)
+{
+ MemLeakScopedMutex lock;
+ void* memory = MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewArrayAllocator(), size, file, line);
+ UT_THROW_BAD_ALLOC_WHEN_NULL(memory);
+ return memory;
+}
+
+static void threadsafe_mem_leak_operator_delete (void* mem) UT_NOTHROW
+{
+ MemLeakScopedMutex lock;
+ MemoryLeakWarningPlugin::getGlobalDetector()->invalidateMemory((char*) mem);
+ MemoryLeakWarningPlugin::getGlobalDetector()->deallocMemory(getCurrentNewAllocator(), (char*) mem);
+}
+
+static void threadsafe_mem_leak_operator_delete_array (void* mem) UT_NOTHROW
+{
+ MemLeakScopedMutex lock;
+ MemoryLeakWarningPlugin::getGlobalDetector()->invalidateMemory((char*) mem);
+ MemoryLeakWarningPlugin::getGlobalDetector()->deallocMemory(getCurrentNewArrayAllocator(), (char*) mem);
+}
+
+
+static void* mem_leak_operator_new (size_t size) UT_THROW(CPPUTEST_BAD_ALLOC)
{
void* memory = MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewAllocator(), size);
UT_THROW_BAD_ALLOC_WHEN_NULL(memory);
@@ -116,14 +207,14 @@ static void* mem_leak_operator_new_nothrow (size_t size) UT_NOTHROW
return MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewAllocator(), size);
}
-static void* mem_leak_operator_new_debug (size_t size, const char* file, int line) UT_THROW(std::bad_alloc)
+static void* mem_leak_operator_new_debug (size_t size, const char* file, size_t line) UT_THROW(CPPUTEST_BAD_ALLOC)
{
- void *memory = MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewAllocator(), size, (char*) file, line);
+ void *memory = MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewAllocator(), size, file, line);
UT_THROW_BAD_ALLOC_WHEN_NULL(memory);
return memory;
}
-static void* mem_leak_operator_new_array (size_t size) UT_THROW(std::bad_alloc)
+static void* mem_leak_operator_new_array (size_t size) UT_THROW(CPPUTEST_BAD_ALLOC)
{
void* memory = MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewArrayAllocator(), size);
UT_THROW_BAD_ALLOC_WHEN_NULL(memory);
@@ -135,9 +226,9 @@ static void* mem_leak_operator_new_array_nothrow (size_t size) UT_NOTHROW
return MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewArrayAllocator(), size);
}
-static void* mem_leak_operator_new_array_debug (size_t size, const char* file, int line) UT_THROW(std::bad_alloc)
+static void* mem_leak_operator_new_array_debug (size_t size, const char* file, size_t line) UT_THROW(CPPUTEST_BAD_ALLOC)
{
- void* memory = MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewArrayAllocator(), size, (char*) file, line);
+ void* memory = MemoryLeakWarningPlugin::getGlobalDetector()->allocMemory(getCurrentNewArrayAllocator(), size, file, line);
UT_THROW_BAD_ALLOC_WHEN_NULL(memory);
return memory;
}
@@ -154,7 +245,7 @@ static void mem_leak_operator_delete_array (void* mem) UT_NOTHROW
MemoryLeakWarningPlugin::getGlobalDetector()->deallocMemory(getCurrentNewArrayAllocator(), (char*) mem);
}
-static void* normal_operator_new (size_t size) UT_THROW(std::bad_alloc)
+static void* normal_operator_new (size_t size) UT_THROW(CPPUTEST_BAD_ALLOC)
{
void* memory = PlatformSpecificMalloc(size);
UT_THROW_BAD_ALLOC_WHEN_NULL(memory);
@@ -166,14 +257,14 @@ static void* normal_operator_new_nothrow (size_t size) UT_NOTHROW
return PlatformSpecificMalloc(size);
}
-static void* normal_operator_new_debug (size_t size, const char* /*file*/, int /*line*/) UT_THROW(std::bad_alloc)
+static void* normal_operator_new_debug (size_t size, const char* /*file*/, size_t /*line*/) UT_THROW(CPPUTEST_BAD_ALLOC)
{
void* memory = PlatformSpecificMalloc(size);
UT_THROW_BAD_ALLOC_WHEN_NULL(memory);
return memory;
}
-static void* normal_operator_new_array (size_t size) UT_THROW(std::bad_alloc)
+static void* normal_operator_new_array (size_t size) UT_THROW(CPPUTEST_BAD_ALLOC)
{
void* memory = PlatformSpecificMalloc(size);
UT_THROW_BAD_ALLOC_WHEN_NULL(memory);
@@ -185,7 +276,7 @@ static void* normal_operator_new_array_nothrow (size_t size) UT_NOTHROW
return PlatformSpecificMalloc(size);
}
-static void* normal_operator_new_array_debug (size_t size, const char* /*file*/, int /*line*/) UT_THROW(std::bad_alloc)
+static void* normal_operator_new_array_debug (size_t size, const char* /*file*/, size_t /*line*/) UT_THROW(CPPUTEST_BAD_ALLOC)
{
void* memory = PlatformSpecificMalloc(size);
UT_THROW_BAD_ALLOC_WHEN_NULL(memory);
@@ -202,21 +293,36 @@ static void normal_operator_delete_array (void* mem) UT_NOTHROW
PlatformSpecificFree(mem);
}
-static void *(*operator_new_fptr)(size_t size) UT_THROW(std::bad_alloc) = mem_leak_operator_new;
+static void *(*operator_new_fptr)(size_t size) UT_THROW(CPPUTEST_BAD_ALLOC) = mem_leak_operator_new;
static void *(*operator_new_nothrow_fptr)(size_t size) UT_NOTHROW = mem_leak_operator_new_nothrow;
-static void *(*operator_new_debug_fptr)(size_t size, const char* file, int line) UT_THROW(std::bad_alloc) = mem_leak_operator_new_debug;
-static void *(*operator_new_array_fptr)(size_t size) UT_THROW(std::bad_alloc) = mem_leak_operator_new_array;
+static void *(*operator_new_debug_fptr)(size_t size, const char* file, size_t line) UT_THROW(CPPUTEST_BAD_ALLOC) = mem_leak_operator_new_debug;
+static void *(*operator_new_array_fptr)(size_t size) UT_THROW(CPPUTEST_BAD_ALLOC) = mem_leak_operator_new_array;
static void *(*operator_new_array_nothrow_fptr)(size_t size) UT_NOTHROW = mem_leak_operator_new_array_nothrow;
-static void *(*operator_new_array_debug_fptr)(size_t size, const char* file, int line) UT_THROW(std::bad_alloc) = mem_leak_operator_new_array_debug;
+static void *(*operator_new_array_debug_fptr)(size_t size, const char* file, size_t line) UT_THROW(CPPUTEST_BAD_ALLOC) = mem_leak_operator_new_array_debug;
static void (*operator_delete_fptr)(void* mem) UT_NOTHROW = mem_leak_operator_delete;
static void (*operator_delete_array_fptr)(void* mem) UT_NOTHROW = mem_leak_operator_delete_array;
-void* operator new(size_t size) UT_THROW(std::bad_alloc)
+static void *(*saved_operator_new_fptr)(size_t size) UT_THROW(CPPUTEST_BAD_ALLOC) = mem_leak_operator_new;
+static void *(*saved_operator_new_nothrow_fptr)(size_t size) UT_NOTHROW = mem_leak_operator_new_nothrow;
+static void *(*saved_operator_new_debug_fptr)(size_t size, const char* file, size_t line) UT_THROW(CPPUTEST_BAD_ALLOC) = mem_leak_operator_new_debug;
+static void *(*saved_operator_new_array_fptr)(size_t size) UT_THROW(CPPUTEST_BAD_ALLOC) = mem_leak_operator_new_array;
+static void *(*saved_operator_new_array_nothrow_fptr)(size_t size) UT_NOTHROW = mem_leak_operator_new_array_nothrow;
+static void *(*saved_operator_new_array_debug_fptr)(size_t size, const char* file, size_t line) UT_THROW(CPPUTEST_BAD_ALLOC) = mem_leak_operator_new_array_debug;
+static void (*saved_operator_delete_fptr)(void* mem) UT_NOTHROW = mem_leak_operator_delete;
+static void (*saved_operator_delete_array_fptr)(void* mem) UT_NOTHROW = mem_leak_operator_delete_array;
+static int save_counter = 0;
+
+void* operator new(size_t size) UT_THROW(CPPUTEST_BAD_ALLOC)
{
return operator_new_fptr(size);
}
-void* operator new(size_t size, const char* file, int line) UT_THROW(std::bad_alloc)
+void* operator new(size_t size, const char* file, int line) UT_THROW(CPPUTEST_BAD_ALLOC)
+{
+ return operator_new_debug_fptr(size, file, (size_t)line);
+}
+
+void* operator new(size_t size, const char* file, size_t line) UT_THROW(CPPUTEST_BAD_ALLOC)
{
return operator_new_debug_fptr(size, file, line);
}
@@ -231,12 +337,29 @@ void operator delete(void* mem, const char*, int) UT_NOTHROW
operator_delete_fptr(mem);
}
-void* operator new[](size_t size) UT_THROW(std::bad_alloc)
+void operator delete(void* mem, const char*, size_t) UT_NOTHROW
+{
+ operator_delete_fptr(mem);
+}
+
+#if __cplusplus >= 201402L
+void operator delete (void* mem, size_t) UT_NOTHROW
+{
+ operator_delete_fptr(mem);
+}
+#endif
+
+void* operator new[](size_t size) UT_THROW(CPPUTEST_BAD_ALLOC)
{
return operator_new_array_fptr(size);
}
-void* operator new [](size_t size, const char* file, int line) UT_THROW(std::bad_alloc)
+void* operator new [](size_t size, const char* file, int line) UT_THROW(CPPUTEST_BAD_ALLOC)
+{
+ return operator_new_array_debug_fptr(size, file, (size_t)line);
+}
+
+void* operator new [](size_t size, const char* file, size_t line) UT_THROW(CPPUTEST_BAD_ALLOC)
{
return operator_new_array_debug_fptr(size, file, line);
}
@@ -251,6 +374,17 @@ void operator delete[](void* mem, const char*, int) UT_NOTHROW
operator_delete_array_fptr(mem);
}
+void operator delete[](void* mem, const char*, size_t) UT_NOTHROW
+{
+ operator_delete_array_fptr(mem);
+}
+
+#if __cplusplus >= 201402L
+void operator delete[] (void* mem, size_t) UT_NOTHROW
+{
+ operator_delete_array_fptr(mem);
+}
+#endif
#if CPPUTEST_USE_STD_CPP_LIB
@@ -259,11 +393,21 @@ void* operator new(size_t size, const std::nothrow_t&) UT_NOTHROW
return operator_new_nothrow_fptr(size);
}
+void operator delete(void* mem, const std::nothrow_t&) UT_NOTHROW
+{
+ operator_delete_fptr(mem);
+}
+
void* operator new[](size_t size, const std::nothrow_t&) UT_NOTHROW
{
return operator_new_array_nothrow_fptr(size);
}
+void operator delete[](void* mem, const std::nothrow_t&) UT_NOTHROW
+{
+ operator_delete_array_fptr(mem);
+}
+
#else
/* Have a similar method. This avoid unused operator_new_nothrow_fptr warning */
@@ -302,7 +446,7 @@ void MemoryLeakWarningPlugin::turnOffNewDeleteOverloads()
#endif
}
-void MemoryLeakWarningPlugin::turnOnNewDeleteOverloads()
+void MemoryLeakWarningPlugin::turnOnDefaultNotThreadSafeNewDeleteOverloads()
{
#if CPPUTEST_USE_MEM_LEAK_DETECTION
operator_new_fptr = mem_leak_operator_new;
@@ -319,15 +463,69 @@ void MemoryLeakWarningPlugin::turnOnNewDeleteOverloads()
#endif
}
+void MemoryLeakWarningPlugin::turnOnThreadSafeNewDeleteOverloads()
+{
+#if CPPUTEST_USE_MEM_LEAK_DETECTION
+ operator_new_fptr = threadsafe_mem_leak_operator_new;
+ operator_new_nothrow_fptr = threadsafe_mem_leak_operator_new_nothrow;
+ operator_new_debug_fptr = threadsafe_mem_leak_operator_new_debug;
+ operator_new_array_fptr = threadsafe_mem_leak_operator_new_array;
+ operator_new_array_nothrow_fptr = threadsafe_mem_leak_operator_new_array_nothrow;
+ operator_new_array_debug_fptr = threadsafe_mem_leak_operator_new_array_debug;
+ operator_delete_fptr = threadsafe_mem_leak_operator_delete;
+ operator_delete_array_fptr = threadsafe_mem_leak_operator_delete_array;
+ malloc_fptr = threadsafe_mem_leak_malloc;
+ realloc_fptr = threadsafe_mem_leak_realloc;
+ free_fptr = threadsafe_mem_leak_free;
+#endif
+}
+
bool MemoryLeakWarningPlugin::areNewDeleteOverloaded()
{
#if CPPUTEST_USE_MEM_LEAK_DETECTION
- return operator_new_fptr == mem_leak_operator_new;
+ return operator_new_fptr == mem_leak_operator_new || operator_new_fptr == threadsafe_mem_leak_operator_new;
#else
return false;
#endif
}
+void MemoryLeakWarningPlugin::saveAndDisableNewDeleteOverloads()
+{
+#if CPPUTEST_USE_MEM_LEAK_DETECTION
+ if (++save_counter > 1) return;
+ saved_operator_new_fptr = operator_new_fptr;
+ saved_operator_new_nothrow_fptr = operator_new_nothrow_fptr;
+ saved_operator_new_debug_fptr = operator_new_debug_fptr;
+ saved_operator_new_array_fptr = operator_new_array_fptr;
+ saved_operator_new_array_nothrow_fptr = operator_new_array_nothrow_fptr;
+ saved_operator_new_array_debug_fptr = operator_new_array_debug_fptr;
+ saved_operator_delete_fptr = operator_delete_fptr;
+ saved_operator_delete_array_fptr = operator_delete_array_fptr;
+ saved_malloc_fptr = malloc_fptr;
+ saved_realloc_fptr = realloc_fptr;
+ saved_free_fptr = free_fptr;
+ turnOffNewDeleteOverloads();
+#endif
+}
+
+void MemoryLeakWarningPlugin::restoreNewDeleteOverloads()
+{
+#if CPPUTEST_USE_MEM_LEAK_DETECTION
+ if (--save_counter > 0) return;
+ operator_new_fptr = saved_operator_new_fptr;
+ operator_new_nothrow_fptr = saved_operator_new_nothrow_fptr;
+ operator_new_debug_fptr = saved_operator_new_debug_fptr;
+ operator_new_array_fptr = saved_operator_new_array_fptr;
+ operator_new_array_nothrow_fptr = saved_operator_new_array_nothrow_fptr;
+ operator_new_array_debug_fptr = saved_operator_new_array_debug_fptr;
+ operator_delete_fptr = saved_operator_delete_fptr;
+ operator_delete_array_fptr = saved_operator_delete_array_fptr;
+ malloc_fptr = saved_malloc_fptr;
+ realloc_fptr = saved_realloc_fptr;
+ free_fptr = saved_free_fptr;
+#endif
+}
+
void crash_on_allocation_number(unsigned alloc_number)
{
static CrashOnAllocationAllocator crashAllocator;
@@ -340,30 +538,29 @@ void crash_on_allocation_number(unsigned alloc_number)
class MemoryLeakWarningReporter: public MemoryLeakFailure
{
public:
- virtual ~MemoryLeakWarningReporter()
+ virtual ~MemoryLeakWarningReporter() CPPUTEST_DESTRUCTOR_OVERRIDE
{
}
- virtual void fail(char* fail_string)
+ virtual void fail(char* fail_string) CPPUTEST_OVERRIDE
{
UtestShell* currentTest = UtestShell::getCurrent();
- currentTest->failWith(FailFailure(currentTest, currentTest->getName().asCharString(), currentTest->getLineNumber(), fail_string), TestTerminatorWithoutExceptions());
- }
+ currentTest->failWith(FailFailure(currentTest, currentTest->getName().asCharString(), currentTest->getLineNumber(), fail_string), UtestShell::getCurrentTestTerminatorWithoutExceptions());
+ } // LCOV_EXCL_LINE
};
-static MemoryLeakFailure* globalReporter = 0;
-static MemoryLeakDetector* globalDetector = 0;
+static MemoryLeakFailure* globalReporter = NULLPTR;
+static MemoryLeakDetector* globalDetector = NULLPTR;
MemoryLeakDetector* MemoryLeakWarningPlugin::getGlobalDetector()
{
- if (globalDetector == 0) {
- bool newDeleteOverloaded = areNewDeleteOverloaded();
- turnOffNewDeleteOverloads();
+ if (globalDetector == NULLPTR) {
+ saveAndDisableNewDeleteOverloads();
globalReporter = new MemoryLeakWarningReporter;
globalDetector = new MemoryLeakDetector(globalReporter);
- if (newDeleteOverloaded) turnOnNewDeleteOverloads();
+ restoreNewDeleteOverloads();
}
return globalDetector;
}
@@ -389,11 +586,11 @@ void MemoryLeakWarningPlugin::destroyGlobalDetector()
turnOffNewDeleteOverloads();
delete globalDetector;
delete globalReporter;
- globalDetector = NULL;
+ globalDetector = NULLPTR;
}
-MemoryLeakWarningPlugin* MemoryLeakWarningPlugin::firstPlugin_ = 0;
+MemoryLeakWarningPlugin* MemoryLeakWarningPlugin::firstPlugin_ = NULLPTR;
MemoryLeakWarningPlugin* MemoryLeakWarningPlugin::getFirstPlugin()
{
@@ -410,7 +607,7 @@ void MemoryLeakWarningPlugin::ignoreAllLeaksInTest()
ignoreAllWarnings_ = true;
}
-void MemoryLeakWarningPlugin::expectLeaksInTest(int n)
+void MemoryLeakWarningPlugin::expectLeaksInTest(size_t n)
{
expectedLeaks_ = n;
}
@@ -418,7 +615,7 @@ void MemoryLeakWarningPlugin::expectLeaksInTest(int n)
MemoryLeakWarningPlugin::MemoryLeakWarningPlugin(const SimpleString& name, MemoryLeakDetector* localDetector) :
TestPlugin(name), ignoreAllWarnings_(false), destroyGlobalDetectorAndTurnOfMemoryLeakDetectionInDestructor_(false), expectedLeaks_(0)
{
- if (firstPlugin_ == 0) firstPlugin_ = this;
+ if (firstPlugin_ == NULLPTR) firstPlugin_ = this;
if (localDetector) memLeakDetector_ = localDetector;
else memLeakDetector_ = getGlobalDetector();
@@ -443,20 +640,24 @@ void MemoryLeakWarningPlugin::preTestAction(UtestShell& /*test*/, TestResult& re
void MemoryLeakWarningPlugin::postTestAction(UtestShell& test, TestResult& result)
{
memLeakDetector_->stopChecking();
- int leaks = memLeakDetector_->totalMemoryLeaks(mem_leak_period_checking);
+ size_t leaks = memLeakDetector_->totalMemoryLeaks(mem_leak_period_checking);
if (!ignoreAllWarnings_ && expectedLeaks_ != leaks && failureCount_ == result.getFailureCount()) {
- TestFailure f(&test, memLeakDetector_->report(mem_leak_period_checking));
- result.addFailure(f);
+ if(MemoryLeakWarningPlugin::areNewDeleteOverloaded()) {
+ TestFailure f(&test, memLeakDetector_->report(mem_leak_period_checking));
+ result.addFailure(f);
+ } else if(expectedLeaks_ > 0) {
+ result.print(StringFromFormat("Warning: Expected %d leak(s), but leak detection was disabled", (int) expectedLeaks_).asCharString());
+ }
}
memLeakDetector_->markCheckingPeriodLeaksAsNonCheckingPeriod();
ignoreAllWarnings_ = false;
expectedLeaks_ = 0;
}
-const char* MemoryLeakWarningPlugin::FinalReport(int toBeDeletedLeaks)
+const char* MemoryLeakWarningPlugin::FinalReport(size_t toBeDeletedLeaks)
{
- int leaks = memLeakDetector_->totalMemoryLeaks(mem_leak_period_enabled);
+ size_t leaks = memLeakDetector_->totalMemoryLeaks(mem_leak_period_enabled);
if (leaks != toBeDeletedLeaks) return memLeakDetector_->report(mem_leak_period_enabled);
return "";
}
diff --git a/src/CppUTest/SimpleMutex.cpp b/src/CppUTest/SimpleMutex.cpp
index 9a4ba42f9..8fd9c887f 100644
--- a/src/CppUTest/SimpleMutex.cpp
+++ b/src/CppUTest/SimpleMutex.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -42,11 +42,22 @@ void SimpleMutex::Lock(void)
{
PlatformSpecificMutexLock(psMtx);
}
-
+
void SimpleMutex::Unlock(void)
{
PlatformSpecificMutexUnlock(psMtx);
}
+ScopedMutexLock::ScopedMutexLock(SimpleMutex *mtx) :
+ mutex(mtx)
+{
+ mutex->Lock();
+}
+
+ScopedMutexLock::~ScopedMutexLock()
+{
+ mutex->Unlock();
+}
+
diff --git a/src/CppUTest/SimpleString.cpp b/src/CppUTest/SimpleString.cpp
index c05d9db67..a62491e32 100644
--- a/src/CppUTest/SimpleString.cpp
+++ b/src/CppUTest/SimpleString.cpp
@@ -13,7 +13,7 @@
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
@@ -30,11 +30,83 @@
#include "CppUTest/PlatformSpecificFunctions.h"
#include "CppUTest/TestMemoryAllocator.h"
-TestMemoryAllocator* SimpleString::stringAllocator_ = NULL;
+GlobalSimpleStringAllocatorStash::GlobalSimpleStringAllocatorStash()
+ : originalAllocator_(NULLPTR)
+{
+}
+
+void GlobalSimpleStringAllocatorStash::save()
+{
+ originalAllocator_ = SimpleString::getStringAllocator();
+}
+
+void GlobalSimpleStringAllocatorStash::restore()
+{
+ SimpleString::setStringAllocator(originalAllocator_);
+}
+
+
+GlobalSimpleStringMemoryAccountant::GlobalSimpleStringMemoryAccountant()
+ : allocator_(NULLPTR)
+{
+ accountant_ = new MemoryAccountant();
+}
+
+GlobalSimpleStringMemoryAccountant::~GlobalSimpleStringMemoryAccountant()
+{
+ restoreAllocator();
+
+ delete accountant_;
+ delete allocator_;
+}
+
+void GlobalSimpleStringMemoryAccountant::restoreAllocator()
+{
+ if (allocator_ && (SimpleString::getStringAllocator() == allocator_))
+ SimpleString::setStringAllocator(allocator_->originalAllocator());
+}
+
+void GlobalSimpleStringMemoryAccountant::useCacheSizes(size_t cacheSizes[], size_t length)
+{
+ accountant_->useCacheSizes(cacheSizes, length);
+}
+
+void GlobalSimpleStringMemoryAccountant::start()
+{
+ if (allocator_ != NULLPTR)
+ return;
+
+ allocator_ = new AccountingTestMemoryAllocator(*accountant_, SimpleString::getStringAllocator());
+
+ SimpleString::setStringAllocator(allocator_);
+}
+
+void GlobalSimpleStringMemoryAccountant::stop()
+{
+ if (allocator_ == NULLPTR)
+ FAIL("Global SimpleString allocator stopped without starting");
+
+ if (SimpleString::getStringAllocator() != allocator_)
+ FAIL("GlobalStrimpleStringMemoryAccountant: allocator has changed between start and stop!");
+
+ restoreAllocator();
+}
+
+SimpleString GlobalSimpleStringMemoryAccountant::report()
+{
+ return accountant_->report();
+}
+
+AccountingTestMemoryAllocator* GlobalSimpleStringMemoryAccountant::getAllocator()
+{
+ return allocator_;
+}
+
+TestMemoryAllocator* SimpleString::stringAllocator_ = NULLPTR;
TestMemoryAllocator* SimpleString::getStringAllocator()
{
- if (stringAllocator_ == NULL)
+ if (stringAllocator_ == NULLPTR)
return defaultNewArrayAllocator();
return stringAllocator_;
}
@@ -45,23 +117,37 @@ void SimpleString::setStringAllocator(TestMemoryAllocator* allocator)
}
/* Avoid using the memory leak detector INSIDE SimpleString as its used inside the detector */
-char* SimpleString::allocStringBuffer(size_t _size)
+char* SimpleString::allocStringBuffer(size_t _size, const char* file, size_t line)
{
- return getStringAllocator()->alloc_memory(_size, __FILE__, __LINE__);
+ return getStringAllocator()->alloc_memory(_size, file, line);
}
-void SimpleString::deallocStringBuffer(char* str)
+void SimpleString::deallocStringBuffer(char* str, size_t size, const char* file, size_t line)
{
- getStringAllocator()->free_memory(str, __FILE__, __LINE__);
+ getStringAllocator()->free_memory(str, size, file, line);
}
char* SimpleString::getEmptyString() const
{
- char* empty = allocStringBuffer(1);
+ char* empty = allocStringBuffer(1, __FILE__, __LINE__);
empty[0] = '\0';
return empty;
}
+// does not support + or - prefixes
+unsigned SimpleString::AtoU(const char* str)
+{
+ while (isSpace(*str)) str++;
+
+ unsigned result = 0;
+ for(; isDigit(*str) && *str >= '0'; str++)
+ {
+ result *= 10;
+ result += static_cast