mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-13 16:27:43 -04:00
Use CI-CD-Github-Actions for spelling and formatting, add in the bot formatting action, update the CI-CD workflow files. Fix incorrect spelling and formatting on files. (#1083)
* Use new version of CI-CD Actions, checkout@v3 instead of checkout@v2 on all jobs * Use cSpell spell check, and use ubuntu-20.04 for formatting check * Add in bot formatting action * Update freertos_demo.yml and freertos_plus_demo.yml files to increase github log readability * Add in a Qemu demo onto the workflows.
This commit is contained in:
parent
537007d96c
commit
3a2f6646f0
1036 changed files with 134568 additions and 127281 deletions
6150
.github/.cSpellWords.txt
vendored
Normal file
6150
.github/.cSpellWords.txt
vendored
Normal file
File diff suppressed because it is too large
Load diff
24
.github/scripts/common/requirements.txt
vendored
24
.github/scripts/common/requirements.txt
vendored
|
@ -1,14 +1,14 @@
|
|||
certifi==2023.7.22
|
||||
chardet==4.0.0
|
||||
Deprecated
|
||||
GitPython
|
||||
PyGithub
|
||||
PyJWT
|
||||
PyYAML
|
||||
certifi
|
||||
chardet
|
||||
colorama
|
||||
Deprecated==1.2.10
|
||||
gitdb==4.0.5
|
||||
GitPython==3.1.32
|
||||
idna==2.10
|
||||
PyGithub==1.55
|
||||
PyJWT==2.4.0
|
||||
PyYAML==5.4
|
||||
gitdb
|
||||
idna
|
||||
requests
|
||||
smmap==3.0.4
|
||||
urllib3==1.26.5
|
||||
wrapt==1.12.1
|
||||
smmap
|
||||
urllib3
|
||||
wrapt
|
||||
|
|
58
.github/scripts/core_checker.py
vendored
58
.github/scripts/core_checker.py
vendored
|
@ -119,6 +119,7 @@ FREERTOS_IGNORED_EXTENSIONS = [
|
|||
'.ipcf',
|
||||
'.ise',
|
||||
'.jlink',
|
||||
'.js',
|
||||
'.json',
|
||||
'.la',
|
||||
'.launch',
|
||||
|
@ -172,6 +173,7 @@ FREERTOS_IGNORED_EXTENSIONS = [
|
|||
'.pl',
|
||||
'.plg',
|
||||
'.png',
|
||||
'.props',
|
||||
'.prc',
|
||||
'.pref',
|
||||
'.prefs',
|
||||
|
@ -216,6 +218,7 @@ FREERTOS_IGNORED_EXTENSIONS = [
|
|||
'.tags',
|
||||
'.tcl',
|
||||
'.tdt',
|
||||
'.templ',
|
||||
'.template',
|
||||
'.tgt',
|
||||
'.tps',
|
||||
|
@ -250,14 +253,12 @@ FREERTOS_IGNORED_EXTENSIONS = [
|
|||
'.xmsgs',
|
||||
'.xsl',
|
||||
'.yml',
|
||||
'.md',
|
||||
'.zip'
|
||||
]
|
||||
|
||||
FREERTOS_IGNORED_PATTERNS = [
|
||||
r'.*\.git.*',
|
||||
r'.*mbedtls_config\.h.*',
|
||||
r'.*mbedtls_config\.h.*',
|
||||
r'.*CMSIS.*',
|
||||
r'.*/Nordic_Code/*',
|
||||
r'.*/Nuvoton_Code/*',
|
||||
|
@ -275,8 +276,40 @@ FREERTOS_IGNORED_PATTERNS = [
|
|||
r'.*/trcKernelPortSnapshotConfig\.h.*',
|
||||
r'.*/MicroZed_hw_platform.*',
|
||||
r'.*/ThirdParty/.*',
|
||||
r'FreeRTOS\-Plus/Demo/Common/WinPCap/.*',
|
||||
r'FreeRTOS\-Plus/Source/FreeRTOS-Plus-Trace/.*',
|
||||
r'.*/WinPCap/.*',
|
||||
r'.*/DRIVERS/.*',
|
||||
r'.*/FreeRTOS-Plus-Trace/.*',
|
||||
r'.*/Reliance-Edge/.*',
|
||||
r'.*/HCS12_CodeWarrior_banked/.*',
|
||||
r'.*/ARM7_STR75x_GCC/.*',
|
||||
r'.*/ARM7_STR75x_IAR/.*',
|
||||
r'.*/lwip-1.4.0/.*',
|
||||
r'.*/lwip-1.1.0/.*',
|
||||
r'.*/MSP430X_MSP430F5438_CCS/.*',
|
||||
r'.*/Atmel/.*',
|
||||
r'.*/drivers/.*',
|
||||
r'.*/lwIP/.*',
|
||||
r'.*/ARM7_AT91FR40008_GCC/.*',
|
||||
r'.*/ARM7_AT91SAM7S64_IAR/.*',
|
||||
r'.*/ARM7_LPC2106_GCC/.*',
|
||||
r'.*/CORTEX_A9_Cyclone_V_SoC_DK/.*',
|
||||
r'.*/CORTEX_A9_Zynq_ZC702/.*',
|
||||
r'.*/FreeRTOS-Plus/Demo/FreeRTOS_Plus_Reliance_Edge_and_CLI_Windows_Simulator/ConfigurationFiles//.*',
|
||||
r'.*/ARM7_AT91FR40008_GCC/.*',
|
||||
r'.*/ARM7_STR71x_IAR/.*',
|
||||
r'FreeRTOS/Demo/HCS12_GCC_banked/.*',
|
||||
r'FreeRTOS/Demo/CORTEX_LM3S102_GCC/hw_include/.*',
|
||||
r'FreeRTOS/Demo/CORTEX_LM3S102_GCC/hw_include/.*',
|
||||
r'FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/include/.*',
|
||||
r'FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/.*',
|
||||
r'FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/.*',
|
||||
r'FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/.*',
|
||||
r'FreeRTOS/Demo/AVR32_UC3/.*',
|
||||
r'FreeRTOS/Demo/ARM7_STR75x_GCC/STLibrary/inc/.*',
|
||||
r'FreeRTOS/Demo/ARM7_STR75x_IAR/STLibrary/inc/.*',
|
||||
r'FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/System/GCC/inc/.*',
|
||||
r'FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/AtmelFiles/drivers/misc/.*',
|
||||
r'FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/.*',
|
||||
r'FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/Trace_Recorder_Configuration/.*',
|
||||
r'FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/WinPCap/.*',
|
||||
r'FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/WinPCap/pcap/.*',
|
||||
|
@ -291,6 +324,7 @@ FREERTOS_IGNORED_PATTERNS = [
|
|||
]
|
||||
|
||||
FREERTOS_IGNORED_FILES = [
|
||||
'cspell.config.yaml',
|
||||
'.cproject',
|
||||
'.project',
|
||||
'fyi-another-way-to-ignore-file.txt',
|
||||
|
@ -310,6 +344,22 @@ FREERTOS_IGNORED_FILES = [
|
|||
'reg_test.S',
|
||||
'gdbinit',
|
||||
'libslirp-version.h',
|
||||
'LPC21xx.h',
|
||||
'lpc221x.h',
|
||||
'winbase.h',
|
||||
'windows.h',
|
||||
'direct.h',
|
||||
'stm32f10x_conf.h',
|
||||
'lwipopts.h',
|
||||
'lwipopts.h',
|
||||
'xil_assert.h',
|
||||
'alt_i2c.h',
|
||||
'alt_clkmgr.h',
|
||||
'hal_lcd.c',
|
||||
'adc.h',
|
||||
'redconf.c',
|
||||
'redconf.h',
|
||||
'redtypes.h',
|
||||
]
|
||||
|
||||
FREERTOS_HEADER = [
|
||||
|
|
38
.github/scripts/qemu_reader.c
vendored
Normal file
38
.github/scripts/qemu_reader.c
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main( int argc, char * argv[] )
|
||||
{
|
||||
setvbuf( stdout, NULL, _IONBF, 0 );
|
||||
FILE * fp;
|
||||
char path[ 256 ];
|
||||
char cmd[ 256 ];
|
||||
|
||||
/* Open the command for reading. */
|
||||
fp = popen("find . -name RTOSDemo.out", "r");
|
||||
/* Read the output a line at a time - output it. */
|
||||
while( fgets( path, sizeof( path ), fp ) != NULL )
|
||||
{
|
||||
printf( "Path: %s\n", path );
|
||||
}
|
||||
|
||||
sprintf(cmd, "qemu-system-arm -machine mps2-an385 -monitor null -semihosting --semihosting-config enable=on,target=native -serial stdio -nographic -kernel %s", path);
|
||||
printf("cmd= %s\n", cmd);
|
||||
fp = popen( cmd, "r" );
|
||||
if( fp == NULL )
|
||||
{
|
||||
printf( "Failed to run command\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
/* Read the output a line at a time - output it. */
|
||||
while( fgets( path, sizeof( path ), fp ) != NULL )
|
||||
{
|
||||
printf( "%s", path );
|
||||
}
|
||||
|
||||
/* close */
|
||||
pclose( fp );
|
||||
|
||||
return 0;
|
||||
}
|
27
.github/scripts/release-requirements.txt
vendored
27
.github/scripts/release-requirements.txt
vendored
|
@ -1,13 +1,14 @@
|
|||
certifi>=2020.12.5
|
||||
chardet>=3.0.4
|
||||
Deprecated>=1.2.10
|
||||
gitdb>=4.0.5
|
||||
GitPython>=3.1.11
|
||||
idna>=2.10
|
||||
PyGithub>=1.54
|
||||
PyJWT>=1.7.1
|
||||
PyYAML>=5.3.1
|
||||
requests>=2.24.0
|
||||
smmap>=3.0.4
|
||||
urllib3>=1.25.11
|
||||
wrapt>=1.12.1
|
||||
Deprecated
|
||||
GitPython
|
||||
PyGithub
|
||||
PyJWT
|
||||
PyYAML
|
||||
certifi
|
||||
chardet
|
||||
colorama
|
||||
gitdb
|
||||
idna
|
||||
requests
|
||||
smmap
|
||||
urllib3
|
||||
wrapt
|
||||
|
|
4
.github/workflows/auto-release.yml
vendored
4
.github/workflows/auto-release.yml
vendored
|
@ -26,13 +26,13 @@ jobs:
|
|||
|
||||
# Source the release tools from FreeRTOS/FreeRTOS
|
||||
- name: Checkout FreeRTOS Release Tools
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: tools
|
||||
|
||||
# Simpler git auth if we use checkout action and forward the repo to release script
|
||||
- name: Checkout FreeRTOS
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: local_core
|
||||
fetch-depth: 0
|
||||
|
|
178
.github/workflows/ci.yml
vendored
178
.github/workflows/ci.yml
vendored
|
@ -1,5 +1,11 @@
|
|||
name: CI Checks
|
||||
|
||||
env:
|
||||
bashPass: \033[32;1mPASSED -
|
||||
bashWarn: \033[33;1mWARNING -
|
||||
bashFail: \033[31;1mFAILED -
|
||||
bashEnd: \033[0m
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
@ -7,13 +13,13 @@ on:
|
|||
|
||||
jobs:
|
||||
git-secrets:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Checkout awslabs/git-secrets
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: awslabs/git-secrets
|
||||
ref: master
|
||||
|
@ -28,66 +34,47 @@ jobs:
|
|||
formatting:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Uncrustify
|
||||
run: sudo apt-get install uncrustify=0.69.0+dfsg1-1build1
|
||||
- name: Run Uncrustify
|
||||
run: |
|
||||
# Uncrustify on C files while ignoring symlinks.
|
||||
# Make a collapsible section in the log to run uncrustify
|
||||
echo "::group::Uncrustify Check"
|
||||
# GitHub automtically use "set -e" which causes scripts to fail on the first exit code
|
||||
# This would mean the first time a file fails the check that we exit without formatting all files.
|
||||
set +e
|
||||
uncrustify --version
|
||||
find FreeRTOS/Demo/Common FreeRTOS/Test \( -name ethernet -o -name drivers -o -path 'FreeRTOS/Test/CMock/CMock' \) -prune -false -o -name "*.[hc]" | xargs uncrustify --no-backup --replace --if-changed -c tools/uncrustify.cfg -l C
|
||||
echo "::endgroup::"
|
||||
# Run a git diff to print the differences if any exist, return an error code if there are any
|
||||
git diff --exit-code
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mUncrustify check passed\033[0m"
|
||||
exit 0
|
||||
else
|
||||
echo -e "\033[32;31mFormatting check (using Uncrustify) failed...\033[0m"
|
||||
# If there is an error, set this flag high again so the exit 1 fails the run
|
||||
set -e
|
||||
exit 1
|
||||
fi
|
||||
- name: Check For Trailing Whitespace
|
||||
run: |
|
||||
# Trailing Whitespace Check
|
||||
set +e
|
||||
ERROR=0
|
||||
find . \( -name '.git' -o -path "./FreeRTOS/Test/CBMC/patches" -o -path "./FreeRTOS-Plus" -o -path "./FreeRTOS/Source" -o -path "./FreeRTOS/Test/CMock/CMock" -o -path "./FreeRTOS/Demo" \) -prune -false -o -type f -a -name "*" -exec grep -In -e "[[:blank:]]$" {} +
|
||||
if [ "$?" = "0" ]; then
|
||||
ERROR=1
|
||||
fi
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
find FreeRTOS/Demo/Common \( -name "ethernet" \) -prune -o -false -o -type f -a -name "*" -exec grep --color=yes -In -e "[[:blank:]]$" {} +
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;31mFiles have trailing whitespace.\033[0m"
|
||||
exit 1
|
||||
else
|
||||
if [ "$ERROR" -eq "1" ]; then
|
||||
echo -e "\033[32;31mFiles have trailing whitespace.\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "\033[32;3mTrailing whitespace check passed\033[0m"
|
||||
exit 0
|
||||
fi
|
||||
- name: Check Formatting of Common Demo Files
|
||||
uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
|
||||
with:
|
||||
path: FreeRTOS/Demo/Common
|
||||
exclude-dirs: ethernet, drivers
|
||||
|
||||
- name: Check Formatting
|
||||
uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
|
||||
with:
|
||||
exclude-dirs: ethernet, drivers, FreeRTOS/Demo
|
||||
|
||||
spell-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Parent Repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check Spelling of Common Demo Files
|
||||
uses: FreeRTOS/CI-CD-GitHub-Actions/spellings@main
|
||||
with:
|
||||
path: FreeRTOS/Demo/Common
|
||||
exclude-dirs: ethernet, drivers
|
||||
|
||||
- name: Check Spelling
|
||||
uses: FreeRTOS/CI-CD-GitHub-Actions/spellings@main
|
||||
with:
|
||||
exclude-dirs: ethernet, drivers, FreeRTOS/Demo
|
||||
|
||||
doxygen:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
path: freertos
|
||||
- name: Install Python3
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.8'
|
||||
uses: actions/setup-python@v3
|
||||
|
||||
- name: Download tag dependency of coreMQTT-Agent
|
||||
run: |
|
||||
# We don't need to generate the coreMQTT docs, we only need the tag file.
|
||||
|
@ -95,8 +82,9 @@ jobs:
|
|||
mkdir -p freertos/FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent/source/dependency/coreMQTT/docs/doxygen/output
|
||||
wget -O freertos/FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent/source/dependency/coreMQTT/docs/doxygen/output/mqtt.tag \
|
||||
"https://freertos.org/Documentation/api-ref/coreMQTT/docs/doxygen/output/mqtt.tag"
|
||||
|
||||
- name: Generate doxygen ZIP
|
||||
uses: FreeRTOS/CI-CD-GitHub-Actions/doxygen@main
|
||||
uses: FreeRTOS/CI-CD-Github-Actions/doxygen@main
|
||||
with:
|
||||
path: ./freertos
|
||||
# List of directories containing libraries whose doxygen output will be generated.
|
||||
|
@ -112,77 +100,49 @@ jobs:
|
|||
path: ./freertos/doxygen.zip
|
||||
retention-days: 2
|
||||
|
||||
spell-check:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout Parent Repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: main
|
||||
repository: FreeRTOS/CI-CD-Github-Actions
|
||||
path: commonCI
|
||||
- name: Clone This Repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: ./FreeRTOS
|
||||
- name: Install spell
|
||||
run: |
|
||||
sudo apt-get install spell
|
||||
sudo apt-get install util-linux
|
||||
- name: Check spelling
|
||||
run: |
|
||||
# Add path to the tool to the environment variable.
|
||||
PATH=$PATH:commonCI/spellings/tools
|
||||
# Make sure that only Amazon licenced files are checked.
|
||||
sed -i 's/`find $DIRNAME \\( -iname \\\*\.\[ch\] -o -iname \\\*\.dox \\) -type f`/`grep -ril "copyright \(c\) \[0-9\]\[0-9\]\[0-9\]\[0-9\] amazon.com" | grep "\\.\[ch\]" | grep -v "FreeRTOS\/FreeRTOS\/Test\/VeriFast"`/g' commonCI/spellings/tools/find-unknown-comment-words
|
||||
# Run the spell check script.
|
||||
find-unknown-comment-words --directory FreeRTOS/ --lexicon FreeRTOS/lexicon.txt
|
||||
# Check the exit status.
|
||||
if [ "$?" = "0" ]; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
verify-manifest:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
- name: Install Python3
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Run manifest verifier
|
||||
uses: FreeRTOS/CI-CD-Github-Actions/manifest-verifier@main
|
||||
uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@v2
|
||||
with:
|
||||
path: ./
|
||||
exclude-submodules: FreeRTOS-Plus/Test/CMock,FreeRTOS/Test/CMock/CMock,FreeRTOS/Test/litani
|
||||
fail-on-incorrect-version: true
|
||||
|
||||
memory-statistics:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ARM_GCC_TOOLCHAIN_URL: "https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2?revision=05382cca-1721-44e1-ae19-1e7c3dc96118&la=en&hash=D7C9D18FCA2DD9F894FD9F3C3DC9228498FA281A"
|
||||
steps:
|
||||
- name: Install ARM GCC
|
||||
run: wget -qO- "${{ env.ARM_GCC_TOOLCHAIN_URL }}" | sudo tar --strip-components=1 -xj -C /usr/local
|
||||
run:
|
||||
wget -qO- "${{ env.ARM_GCC_TOOLCHAIN_URL }}" | sudo tar
|
||||
--strip-components=1 -xj -C /usr/local
|
||||
- name: Clone FreeRTOS Repository with submodules
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Clone mbedTLS submodule from corePKCS11
|
||||
run: git submodule update --init --recursive --checkout -- FreeRTOS-Plus/Source/corePKCS11
|
||||
run:
|
||||
git submodule update --init --recursive --checkout --
|
||||
FreeRTOS-Plus/Source/corePKCS11
|
||||
- name: Clone CI-CD-Github-Actions repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: FreeRTOS/CI-CD-Github-Actions
|
||||
repository: FreeRTOS/CI-CD-GitHub-Actions
|
||||
path: tools
|
||||
- name: Run script to generate JSON memory statistics
|
||||
run: tools/memory_statistics/memory_statistics.py --json_report --config tools/memory_statistics/paths.json --output freertos_lts_memory_estimates.json
|
||||
- name: Upload memory size report as artifact (for main and release-candidate ONLY)
|
||||
run:
|
||||
tools/memory_statistics/memory_statistics.py --json_report
|
||||
--config tools/memory_statistics/paths.json --output
|
||||
freertos_lts_memory_estimates.json
|
||||
- name:
|
||||
Upload memory size report as artifact (for main and
|
||||
release-candidate ONLY)
|
||||
if: success() && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release-candidate' )
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
@ -191,15 +151,23 @@ jobs:
|
|||
retention-days: 2
|
||||
|
||||
proof_ci:
|
||||
if: ${{ github.event.pull_request }}
|
||||
runs-on: cbmc_ubuntu-latest_16-core
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: |
|
||||
- uses: actions/checkout@v3
|
||||
- env:
|
||||
stepName: Install Dependencies
|
||||
run: |
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
git submodule update --init --checkout --recursive --depth 1
|
||||
sudo apt-get update
|
||||
sudo apt-get install --yes --no-install-recommends gcc-multilib
|
||||
echo -e "::endgroup::"
|
||||
echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}"
|
||||
|
||||
- name: Set up CBMC runner
|
||||
uses: FreeRTOS/CI-CD-Github-Actions/set_up_cbmc_runner@main
|
||||
|
||||
- name: Run CBMC
|
||||
uses: FreeRTOS/CI-CD-Github-Actions/run_cbmc@main
|
||||
with:
|
||||
|
|
4
.github/workflows/core-checks.yml
vendored
4
.github/workflows/core-checks.yml
vendored
|
@ -18,14 +18,14 @@ jobs:
|
|||
|
||||
# Use the checks as defined by the user, so they can locally adjust as needed
|
||||
- name: Checkout FreeRTOS Tools
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
path: tools
|
||||
|
||||
# Checkout user pull request changes
|
||||
- name: Checkout Pull Request
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
path: inspect
|
||||
|
|
23
.github/workflows/formatting.yml
vendored
Normal file
23
.github/workflows/formatting.yml
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
name: Format Pull Request Files
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
env:
|
||||
bashPass: \033[32;1mPASSED -
|
||||
bashInfo: \033[33;1mINFO -
|
||||
bashFail: \033[31;1mFAILED -
|
||||
bashEnd: \033[0m
|
||||
|
||||
jobs:
|
||||
Formatting:
|
||||
name: Run Formatting Check
|
||||
if: ${{ github.event.issue.pull_request }} &&
|
||||
( ( github.event.comment.body == '/bot run uncrustify' ) ||
|
||||
( github.event.comment.body == '/bot run formatting' ) )
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Apply Formatting Fix
|
||||
uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main
|
||||
id: check-formatting
|
586
.github/workflows/freertos_demos.yml
vendored
586
.github/workflows/freertos_demos.yml
vendored
|
@ -4,192 +4,227 @@ on:
|
|||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
bashPass: \033[32;1mPASSED -
|
||||
bashWarn: \033[33;1mWARNING -
|
||||
bashFail: \033[31;1mFAILED -
|
||||
bashEnd: \033[0m
|
||||
|
||||
pwshPass: "`e[32;1mPASSED -"
|
||||
pwshWarn: "`e[33;1mWARNING -"
|
||||
pwshFail: "`e[31;1mFAILED -"
|
||||
pwshEnd: "`e[0m"
|
||||
|
||||
jobs:
|
||||
WIN32-MSVC:
|
||||
name: WIN32 MSVC
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
- env:
|
||||
stepName: Checkout Repository
|
||||
name: ${{ env.stepName }}
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Fetch Kernel Submodule
|
||||
- env:
|
||||
stepName: Fetch Kernel Submodule
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
run: |
|
||||
# Fetch Kernel Submodule
|
||||
echo "::group::Fetch Kernel Submodule"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
git submodule update --checkout --init --depth 1 FreeRTOS/Source
|
||||
echo "::endgroup::"
|
||||
if [[ "$?" = "0" ]]
|
||||
then
|
||||
echo -e "\033[32;3mCloned the Kernel\033[0m"
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mKernel Clone Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{env.stepName}} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
- env:
|
||||
stepName: Add msbuild to PATH
|
||||
name: ${{ env.stepName }}
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
|
||||
- name: Build WIN32-MSVC Full Demo
|
||||
- env:
|
||||
stepName: Build WIN32-MSVC Full Demo
|
||||
name: ${{ env.stepName }}
|
||||
id: build-win32-msvs-full-demo
|
||||
working-directory: FreeRTOS/Demo/WIN32-MSVC
|
||||
run: |
|
||||
# Build WIN32-MSVC Full Demo
|
||||
echo "::group::Build WIN32-MSVC Full Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo "::group::${{ env.stepName }}"
|
||||
$content = Get-Content -Path 'main.c' -Raw
|
||||
$newContent = $content -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
|
||||
$newContent | Set-Content -Path 'main.c'
|
||||
msbuild WIN32.sln -t:rebuild
|
||||
$exitStatus = $?
|
||||
echo "::endgroup::"
|
||||
if($? -eq 1) {
|
||||
Write-Host -ForegroundColor green "Built the WIN32-MSVC Full Demo"
|
||||
if($exitStatus -eq 1) {
|
||||
echo "${{ env.pwshPass }} ${{env.stepName}} ${{ env.pwshEnd }}"
|
||||
}else {
|
||||
Write-Host -ForegroundColor red "Build WIN32-MSVC Full Demo Failed..."
|
||||
echo "${{ env.pwshFail }} ${{env.stepName}} ${{ env.pwshEnd }}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Run and monitor WIN32-MSVC Full Demo
|
||||
if: success() || failure() && steps.build-win32-msvs-full-demo.outcome == 'success'
|
||||
- env:
|
||||
stepName: Run and monitor WIN32-MSVC Full Demo
|
||||
name: ${{ env.stepName }}
|
||||
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
|
||||
with:
|
||||
exe-path: FreeRTOS/Demo/WIN32-MSVC/Debug/RTOSDemo.exe
|
||||
log-dir: demo_run_logs
|
||||
timeout-seconds: 60
|
||||
success-line: "No errors - tick count"
|
||||
retry-attempts: 3
|
||||
|
||||
- name: Build WIN32-MSVC Blinky Demo
|
||||
- env:
|
||||
stepName: Build WIN32-MSVC Blinky Demo
|
||||
name: ${{ env.stepName }}
|
||||
id: build-win32-msvs-blinky-demo
|
||||
working-directory: FreeRTOS/Demo/WIN32-MSVC
|
||||
run: |
|
||||
# Build WIN32-MSVC Blinky Demo
|
||||
echo "::group::MSBuild of WIN32-MSVC Blinky Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo "::group::${{ env.stepName }}"
|
||||
$content = Get-Content -Path 'main.c' -Raw
|
||||
$newContent = $content -replace '#define\s+mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\s+0', '#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1'
|
||||
$newContent | Set-Content -Path 'main.c'
|
||||
# Perform MSBuild of WIN32-MSVC Blinky Demo
|
||||
msbuild WIN32.sln -t:rebuild
|
||||
echo "::endgroup::"
|
||||
if($? -eq 1) {
|
||||
Write-Host -ForegroundColor green "Built the WIN32-MSVC Blinky Demo"
|
||||
$exitStatus = $?
|
||||
if($exitStatus -eq 1) {
|
||||
echo "${{ env.pwshPass }} ${{ env.stepName }} ${{ env.pwshEnd }}"
|
||||
}else {
|
||||
Write-Host -ForegroundColor red "Build WIN32-MSVC Blinky Demo Failed..."
|
||||
echo "${{ env.pwshFail }} ${{ env.stepName }} ${{ env.pwshEnd }}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Run and monitor WIN32-MSVC Blinky Demo
|
||||
if: success() || failure() && steps.build-win32-msvs-blinky-demo.outcome == 'success'
|
||||
- env:
|
||||
stepName: Run and monitor WIN32-MSVC Blinky Demo
|
||||
name: ${{ env.stepName }}
|
||||
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
|
||||
with:
|
||||
exe-path: FreeRTOS/Demo/WIN32-MSVC/Debug/RTOSDemo.exe
|
||||
log-dir: demo_run_logs
|
||||
timeout-seconds: 60
|
||||
success-line: "Message received from software timer"
|
||||
retry-attempts: 3
|
||||
|
||||
- name: Build WIN32-MSVC-Static-Allocation-Only Demo
|
||||
- env:
|
||||
stepName: Build WIN32-MSVC-Static-Allocation-Only Demo
|
||||
name: ${{ env.stepName }}
|
||||
id: build-win32-msvs-static-allocation-only-demo
|
||||
working-directory: FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only
|
||||
run: |
|
||||
# Build WIN32-MSVC-Static-Allocation-Only Demo
|
||||
echo "::group::Build WIN32-MSVC-Static-Allocation-Only Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo "::group::${{ env.stepName }}"
|
||||
$content = Get-Content -Path 'main.c' -Raw
|
||||
$newContent = $content -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
|
||||
$newContent | Set-Content -Path 'main.c'
|
||||
msbuild WIN32.sln -t:rebuild
|
||||
$exitStatus = $?
|
||||
echo "::endgroup::"
|
||||
if($? -eq 1) {
|
||||
Write-Host -ForegroundColor green "Built the WIN32-MSVC-Static-Allocation-Only Demo"
|
||||
if($exitStatus -eq 1) {
|
||||
echo "${{ env.pwshPass }} ${{ env.stepName }} ${{ env.pwshEnd }}"
|
||||
}else {
|
||||
Write-Host -ForegroundColor red "Build WIN32-MSVC-Static-Allocation-Only Demo Failed..."
|
||||
echo "${{ env.pwshFail }} ${{ env.stepName }} ${{ env.pwshEnd }}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Run and monitor WIN32-MSVC-Static-Allocation-Only Demo
|
||||
if: success() || failure() && steps.build-win32-msvs-static-allocation-only-demo.outcome == 'success'
|
||||
- env:
|
||||
stepName:
|
||||
Run and monitor WIN32-MSVC-Static-Allocation-Only Demo
|
||||
name: ${{ env.stepName }}
|
||||
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
|
||||
with:
|
||||
exe-path: FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only/Debug/RTOSDemo.exe
|
||||
log-dir: demo_run_logs
|
||||
timeout-seconds: 60
|
||||
success-line: "No errors - tick count"
|
||||
retry-attempts: 3
|
||||
|
||||
WIN32-MingW:
|
||||
name: WIN32 MingW
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
- env:
|
||||
stepName: Checkout Repository
|
||||
name: ${{ env.stepName }}
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Fetch Kernel Submodule
|
||||
- env:
|
||||
stepName: Fetch Kernel Submodule
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
run: |
|
||||
# Fetch Kernel Submodule
|
||||
echo "::group::Fetch Kernel Submodule"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
git submodule update --checkout --init --depth 1 FreeRTOS/Source
|
||||
echo "::endgroup::"
|
||||
if [[ "$?" = "0" ]]
|
||||
then
|
||||
echo -e "\033[32;3mCloned the Kernel\033[0m"
|
||||
else
|
||||
echo -e "\033[32;31mKernel Clone Failed...\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "::endgroup::"
|
||||
echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}"
|
||||
|
||||
|
||||
- name: Build WIN32-MingW Full Demo
|
||||
- env:
|
||||
stepName: Build WIN32-MingW Full Demo
|
||||
name: ${{ env.stepName }}
|
||||
id: build-win32-mingw-full-demo
|
||||
working-directory: FreeRTOS/Demo/WIN32-MingW
|
||||
run: |
|
||||
# Build WIN32-MingW Full Demo
|
||||
echo "::group::Build WIN32-MingW Full Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo "::group::${{ env.stepName }}"
|
||||
$content = Get-Content -Path 'main.c' -Raw
|
||||
$newContent = $content -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
|
||||
$newContent | Set-Content -Path 'main.c'
|
||||
gcc --version
|
||||
make --version
|
||||
make
|
||||
$exitStatus = $?
|
||||
echo "::endgroup::"
|
||||
if($? -eq 1) {
|
||||
Write-Host -ForegroundColor green "Built the WIN32-MingW Full Demo"
|
||||
if($exitStatus -eq 1) {
|
||||
echo "${{ env.pwshPass }} ${{ env.stepName }} ${{env.pwshEnd}}"
|
||||
}else {
|
||||
Write-Host -ForegroundColor red "Build WIN32-MingW Full Demo Failed..."
|
||||
echo "${{ env.pwshFail }} ${{ env.stepName }} ${{env.pwshEnd}}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Run and monitor WIN32-MingW Full Demo
|
||||
if: success() || failure() && steps.build-win32-mingw-full-demo.outcome == 'success'
|
||||
- env:
|
||||
stepName: Run and monitor WIN32-MingW Full Demo
|
||||
name: ${{ env.stepName }}
|
||||
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
|
||||
with:
|
||||
exe-path: FreeRTOS/Demo/WIN32-MingW/build/RTOSDemo.exe
|
||||
log-dir: demo_run_logs
|
||||
timeout-seconds: 60
|
||||
success-line: "No errors - tick count"
|
||||
|
||||
- name: Build WIN32-MingW Blinky Demo
|
||||
- env:
|
||||
stepName: Build WIN32-MingW Blinky Demo
|
||||
name: ${{ env.stepName }}
|
||||
id: build-win32-mingw-blinky-demo
|
||||
working-directory: FreeRTOS/Demo/WIN32-MingW
|
||||
run: |
|
||||
# Build WIN32-MingW Blinky Demo
|
||||
echo "::group::Build WIN32-MingW Blinky Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo "::group::${{ env.stepName }}"
|
||||
$content = Get-Content -Path 'main.c' -Raw
|
||||
$newContent = $content -replace '#define\s+mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\s+0', '#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1'
|
||||
$newContent = $newContent -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
|
||||
$newContent | Set-Content -Path 'main.c'
|
||||
gcc --version
|
||||
make --version
|
||||
make
|
||||
$exitStatus = $?
|
||||
echo "::endgroup::"
|
||||
if($? -eq 1) {
|
||||
Write-Host -ForegroundColor green "Built the WIN32-MingW Blinky Demo"
|
||||
if($exitStatus -eq 1) {
|
||||
echo "${{ env.pwshPass }} ${{ env.stepName }} ${{ env.pwshEnd }}"
|
||||
}else {
|
||||
Write-Host -ForegroundColor red "Build WIN32-MingW Blinky Demo Failed..."
|
||||
echo "${{ env.pwshFail }} ${{ env.stepName }} ${{ env.pwshEnd }}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Run and monitor WIN32-MingW Blinky Demo
|
||||
if: success() || failure() && steps.build-win32-mingw-blinky-demo.outcome == 'success'
|
||||
- env:
|
||||
stepName: Run and monitor WIN32-MingW Blinky Demo
|
||||
name: ${{ env.stepName }}
|
||||
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
|
||||
with:
|
||||
exe-path: FreeRTOS/Demo/WIN32-MingW/build/RTOSDemo.exe
|
||||
log-dir: demo_run_logs
|
||||
timeout-seconds: 60
|
||||
success-line: "Message received from software timer"
|
||||
|
||||
|
@ -197,96 +232,111 @@ jobs:
|
|||
name: Posix GCC
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
- env:
|
||||
stepName: Checkout Repository
|
||||
name: ${{ env.stepName }}
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Fetch Kernel Submodule
|
||||
- env:
|
||||
stepName: Fetch Kernel Submodule
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
run: |
|
||||
# Fetch Kernel Submodule
|
||||
echo "::group::Fetch Kernel Submodule"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
git submodule update --checkout --init --depth 1 FreeRTOS/Source
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mCloned the Kernel\033[0m"
|
||||
set -e
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mKernel Clone Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Install GCC
|
||||
- env:
|
||||
stepName: Install GCC
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
run: |
|
||||
# Install GCC
|
||||
echo "::group::Install GCC"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install build-essential
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\e[0;32mInstall GCC Passed\e[0m"
|
||||
else
|
||||
echo -e "\e[0;32mInstall GCC Failed\e[0m"
|
||||
# If there is an error, set this flag high again so the exit 1 fails the run
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build Posix_GCC Demo for Coverage Test
|
||||
shell: bash
|
||||
working-directory: FreeRTOS/Demo/Posix_GCC
|
||||
run: make -j COVERAGE_TEST=1
|
||||
|
||||
- name: Build Posix_GCC Full Demo
|
||||
- env:
|
||||
stepName: Build Posix_GCC Full Demo
|
||||
name: ${{ env.stepName }}
|
||||
id: build-posix-gcc-full-demo
|
||||
shell: bash
|
||||
working-directory: FreeRTOS/Demo/Posix_GCC
|
||||
run: |
|
||||
# Build Posix_GCC Full Demo
|
||||
echo "::group::Build Posix_GCC Full Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
sed -i -z "s/int[[:space:]]*main[[:space:]]*([[:space:]]*void[[:space:]]*)\n{/int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );/g" main.c
|
||||
make clean
|
||||
make -j
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mBuild Posix_GCC Full Demo Passed\033[0m"
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mBuild Posix_GCC Full Demo Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Run and monitor Posix_GCC Full Demo
|
||||
if: success() || failure() && steps.build-posix-gcc-full-demo.outcome == 'success'
|
||||
- env:
|
||||
stepName: Run and monitor Posix_GCC Full Demo
|
||||
name: ${{ env.stepName }}
|
||||
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
|
||||
with:
|
||||
exe-path: FreeRTOS/Demo/Posix_GCC/build/posix_demo
|
||||
log-dir: demo_run_logs
|
||||
timeout-seconds: 60
|
||||
success-line: "OK: No errors"
|
||||
retry-attempts: 3
|
||||
|
||||
- name: Build Posix_GCC Blinky Demo
|
||||
- env:
|
||||
stepName: Build Posix_GCC Blinky Demo
|
||||
name: ${{ env.stepName }}
|
||||
id: build-posix-gcc-blinky-demo
|
||||
if: success() || failure()
|
||||
shell: bash
|
||||
working-directory: FreeRTOS/Demo/Posix_GCC
|
||||
run: |
|
||||
# Build Posix_GCC Blinky Demo
|
||||
echo "::group::Build Posix_GCC Blinky Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
rm -rf build
|
||||
set +e
|
||||
make -j USER_DEMO=BLINKY_DEMO
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mBuilt the Posix_GCC Blinky Demo\033[0m"
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mBuild Posix_GCC Blinky Demo Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{env.stepName}} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Run and monitor Posix_GCC Blinky Demo
|
||||
if: success() || failure() && steps.build-posix-gcc-blinky-demo.outcome == 'success'
|
||||
- env:
|
||||
stepName: Run and monitor Posix_GCC Blinky Demo
|
||||
name: ${{ env.stepName }}
|
||||
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
|
||||
with:
|
||||
exe-path: FreeRTOS/Demo/Posix_GCC/build/posix_demo
|
||||
log-dir: demo_run_logs
|
||||
timeout-seconds: 60
|
||||
success-line: "Message received from software timer"
|
||||
|
||||
|
@ -294,50 +344,69 @@ jobs:
|
|||
name: GNU MSP430 Toolchain
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
- env:
|
||||
stepName: Checkout Repository
|
||||
name: ${{ env.stepName }}
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Fetch Kernel Submodule
|
||||
- env:
|
||||
stepName: Fetch Kernel Submodule
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
run: |
|
||||
# Fetch Kernel Submodule
|
||||
echo "::group::Fetch Kernel Submodule"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
git submodule update --checkout --init --depth 1 FreeRTOS/Source
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mCloned the Kernel\033[0m"
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mKernel Clone Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Install MSP430 Toolchain
|
||||
- env:
|
||||
stepName: Install MSP430 Toolchain
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
run: |
|
||||
# Install MSP430 Toolchain
|
||||
echo "::group::Install MSP430 Toolchain"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install gcc-msp430 build-essential
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mInstalled the MSP430 Toolchain\033[0m"
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mInstalling the MSP430 ToolchainFailed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build msp430_GCC Demo
|
||||
- env:
|
||||
stepName: Build msp430_GCC Demo
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
working-directory: FreeRTOS/Demo/msp430_GCC
|
||||
run: |
|
||||
# Build msp430_GCC Demo
|
||||
echo "::group::Build msp430_GCC Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
make -j
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mBuilt the msp430_GCC Demo\033[0m"
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mBuilding the msp430_GCC Demo Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -345,157 +414,220 @@ jobs:
|
|||
name: GNU ARM Toolchain
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
- env:
|
||||
stepName: Checkout Repository
|
||||
name: ${{ env.stepName }}
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Fetch Kernel Submodule
|
||||
- env:
|
||||
stepName: Fetch Kernel Submodule
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
run: |
|
||||
# Fetch Kernel Submodule
|
||||
echo "::group::Fetch Kernel Submodule"
|
||||
git submodule update --checkout --init --depth 1 FreeRTOS/Source
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mCloned the Kernel\033[0m"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
git submodule update --checkout --init --depth 1 FreeRTOS/Source FreeRTOS/Demo/ThirdParty/Community-Supported-Demos
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mKernel Clone Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Fetch Community-Supported-Demos Submodule
|
||||
- env:
|
||||
stepName: Install GNU ARM Toolchain
|
||||
name: Install GNU ARM Toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
# Fetch Community-Supported-Demos Submodule
|
||||
echo "::group::Fetch Community-Supported-Demos Submodule"
|
||||
git submodule update --checkout --init --depth 1 FreeRTOS/Demo/ThirdParty/Community-Supported-Demos
|
||||
echo "::engdroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mCloned the Community-Supported-Demos\033[0m"
|
||||
else
|
||||
echo -e "\033[32;31mCommunity-Supported-Demos Clone Failed...\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Install GNU ARM Toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
# Install GNU ARM Toolchain
|
||||
echo "::group::Install GNU ARM Toolchain"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install gcc-arm-none-eabi build-essential cmake git ninja-build python3-minimal
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mInstalled the GNU ARM Toolchain\033[0m"
|
||||
sudo apt-get -y install qemu-system-arm qemu-efi
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mInstalling GNU ARM Toolchain Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build CORTEX_MPU_M3_MPS2_QEMU_GCC Demo
|
||||
- env:
|
||||
stepName: Build CORTEX_MPU_M3_MPS2_QEMU_GCC Demo
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
working-directory: FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC
|
||||
run: |
|
||||
# Build CORTEX_MPU_M3_MPS2_QEMU_GCC Demo
|
||||
echo "::group::Build CORTEX_MPU_M3_MPS2_QEMU_GCC Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
make -j
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mBuild CORTEX_MPU_M3_MPS2_QEMU_GCC Demo\033[0m"
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mBuild CORTEX_MPU_M3_MPS2_QEMU_GCC Demo Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build CORTEX_LM3S102_GCC Demo
|
||||
- env:
|
||||
stepName: Build CORTEX_LM3S102_GCC Demo
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
working-directory: FreeRTOS/Demo/CORTEX_LM3S102_GCC
|
||||
run: |
|
||||
# Build CORTEX_LM3S102_GCC Demo
|
||||
echo "::group::Build CORTEX_LM3S102_GCC Demo"
|
||||
make -j
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mBuilt the CORTEX_LM3S102_GCC Demo Kernel\033[0m"
|
||||
else
|
||||
echo -e "\033[32;31mBuild CORTEX_LM3S102_GCC Demo Failed...\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build CORTEX_M3_MPS2_QEMU_GCC Demo
|
||||
shell: bash
|
||||
working-directory: FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC
|
||||
run: |
|
||||
# Build CORTEX_M3_MPS2_QEMU_GCC Demo
|
||||
echo "::group::Build CORTEX_M3_MPS2_QEMU_GCC Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
make clean
|
||||
make -j
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mBuilt the CORTEX_M3_MPS2_QEMU_GCC Demo\033[0m"
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mBuild CORTEX_M3_MPS2_QEMU_GCC Demo Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build CORTEX_M3_MPS2_QEMU_GCC Full Demo
|
||||
- env:
|
||||
stepName: Build CORTEX_M3_MPS2_QEMU_GCC Demo
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
working-directory: FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC
|
||||
run: |
|
||||
# Build CORTEX_M3_MPS2_QEMU_GCC Full Demo
|
||||
echo "::group::Build CORTEX_M3_MPS2_QEMU_GCC Full Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
make clean
|
||||
make -j
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- env:
|
||||
stepName: Build CORTEX_M3_MPS2_QEMU_GCC Full Demo
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
working-directory: FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC
|
||||
run: |
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
make clean
|
||||
make FULL_DEMO=1 -j
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mBuilt the CORTEX_M3_MPS2_QEMU_GCC Full Demo\033[0m"
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mBuild CORTEX_M3_MPS2_QEMU_GCC Full Demo Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build CORTEX_LM3S811_GCC Demo
|
||||
- env:
|
||||
stepName: Build CORTEX_LM3S811_GCC Demo
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
working-directory: FreeRTOS/Demo/CORTEX_LM3S811_GCC
|
||||
run: |
|
||||
# Build CORTEX_LM3S811_GCC Demo
|
||||
echo "::group::Build CORTEX_LM3S811_GCC Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
make -j
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mBuilt the CORTEX_LM3S811_GCC Demo\033[0m"
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mBuild CORTEX_LM3S811_GCC Demo Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build CORTEX_M0+_RP2040 Demos
|
||||
- env:
|
||||
stepName: Build CORTEX_M0+_RP2040 Demos
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
working-directory: FreeRTOS/Demo/ThirdParty/Community-Supported-Demos/CORTEX_M0+_RP2040
|
||||
run: |
|
||||
# Build CORTEX_M0+_RP2040 Demos
|
||||
echo "::group::Build CORTEX_M0+_RP2040 Demos"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
git clone https://github.com/raspberrypi/pico-sdk.git
|
||||
cmake -B build -DPICO_SDK_PATH=pico-sdk -GNinja
|
||||
ninja -C build --verbose
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mBuilt CORTEX_M0+_RP2040 Demos\033[0m"
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mBuild CORTEX_M0+_RP2040 Demos Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build CORTEX_MPS2_QEMU_IAR_GCC Demo
|
||||
- env:
|
||||
stepName: Build Qemu Runner File
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
working-directory: .github/scripts
|
||||
run: |
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
gcc qemu_reader.c -o ../../FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/qemu_reader.out
|
||||
exitStatus=$?
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- env:
|
||||
stepName: Build CORTEX_MPS2_QEMU_IAR_GCC Demo
|
||||
name: ${{ env.stepName }}
|
||||
shell: bash
|
||||
working-directory: FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC
|
||||
run: |
|
||||
# Build CORTEX_MPS2_QEMU_IAR_GCC Demo
|
||||
echo "::group::Build CORTEX_MPS2_QEMU_IAR_GCC Demo"
|
||||
# ${{ env.stepName }}
|
||||
echo -e "::group::${{ env.stepName }}"
|
||||
set +e
|
||||
make -C build/gcc -j
|
||||
echo "::endgroup::"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo -e "\033[32;3mBuilt the CORTEX_MPS2_QEMU_IAR_GCC Demo\033[0m"
|
||||
exitStatus=$?
|
||||
set -e
|
||||
echo -e "::endgroup::"
|
||||
if [ $exitStatus -eq 0 ]; then
|
||||
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
else
|
||||
echo -e "\033[32;31mBuild CORTEX_MPS2_QEMU_IAR_GCC Demo Failed...\033[0m"
|
||||
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- env:
|
||||
stepName: Run and monitor CORTEX_MPS2_QEMU_IAR_GCC Demo
|
||||
name: ${{ env.stepName }}
|
||||
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
|
||||
with:
|
||||
exe-path: FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/qemu_reader.out
|
||||
timeout-seconds: 20
|
||||
success-line: "Message received from software timer"
|
||||
retry-attempts: 1
|
||||
|
|
849
.github/workflows/freertos_plus_demos.yml
vendored
849
.github/workflows/freertos_plus_demos.yml
vendored
File diff suppressed because it is too large
Load diff
6
.github/workflows/kernel-unit-tests.yml
vendored
6
.github/workflows/kernel-unit-tests.yml
vendored
|
@ -7,7 +7,7 @@ jobs:
|
|||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
fetch-depth: 5
|
||||
|
@ -42,12 +42,12 @@ jobs:
|
|||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
fetch-depth: 5
|
||||
- name: Checkout the main branch from the FreeRTOS-Kernel repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: ./FreeRTOS/Source
|
||||
ref: main
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31205.134
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CORE_MQTT_CONFIG_H
|
||||
#define CORE_MQTT_CONFIG_H
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* AWS IoT Device SDK for Embedded C V202009.00
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
@ -18,6 +18,10 @@
|
|||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SHADOW_CONFIG_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31205.134
|
||||
|
|
|
@ -804,7 +804,7 @@ int prvFleetProvisioningTask( void * pvParameters )
|
|||
}
|
||||
else
|
||||
{
|
||||
LogInfo( ( "Sucessfully established connection with provisioned credentials." ) );
|
||||
LogInfo( ( "Successfully established connection with provisioned credentials." ) );
|
||||
xConnectionEstablished = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.33027.164
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CORE_MQTT_CONFIG_H
|
||||
#define CORE_MQTT_CONFIG_H
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31205.134
|
||||
|
|
|
@ -379,6 +379,7 @@ static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkContext
|
|||
uint16_t usNextRetryBackOff = 0U;
|
||||
|
||||
#if defined( democonfigCLIENT_USERNAME )
|
||||
|
||||
/*
|
||||
* When democonfigCLIENT_USERNAME is defined, use the "mqtt" alpn to connect
|
||||
* to AWS IoT Core with Custom Authentication on port 443.
|
||||
|
@ -394,6 +395,7 @@ static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkContext
|
|||
#error "Connections to AWS IoT Core with custom authentication must connect to TCP port 443 with the \"mqtt\" alpn."
|
||||
#endif /* democonfigMQTT_BROKER_PORT != 443U */
|
||||
#else /* if !defined( democonfigCLIENT_USERNAME ) */
|
||||
|
||||
/*
|
||||
* Otherwise, use the "x-amzn-mqtt-ca" alpn to connect to AWS IoT Core using
|
||||
* x509 Certificate Authentication.
|
||||
|
|
|
@ -377,6 +377,7 @@ static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkContext
|
|||
uint16_t usNextRetryBackOff = 0U;
|
||||
|
||||
#if defined( democonfigCLIENT_USERNAME )
|
||||
|
||||
/*
|
||||
* When democonfigCLIENT_USERNAME is defined, use the "mqtt" alpn to connect
|
||||
* to AWS IoT Core with Custom Authentication on port 443.
|
||||
|
@ -392,6 +393,7 @@ static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkContext
|
|||
#error "Connections to AWS IoT Core with custom authentication must connect to TCP port 443 with the \"mqtt\" alpn."
|
||||
#endif /* democonfigMQTT_BROKER_PORT != 443U */
|
||||
#else /* if !defined( democonfigCLIENT_USERNAME ) */
|
||||
|
||||
/*
|
||||
* Otherwise, use the "x-amzn-mqtt-ca" alpn to connect to AWS IoT Core using
|
||||
* x509 Certificate Authentication.
|
||||
|
|
|
@ -332,7 +332,6 @@ static void prvSignatureVerificationUpdate(void* pvContext,
|
|||
* Add the data to the hash of the requested type
|
||||
*/
|
||||
( void ) mbedtls_sha256_update( &pxCtx->xSHA256Context, pucData, xDataLength );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -436,6 +435,7 @@ OtaPalMainStatus_t xValidateImageSignature(OtaFileContext_t* const C)
|
|||
{
|
||||
eResult = OtaPalSignatureCheckFailed;
|
||||
}
|
||||
|
||||
pvSigVerifyContext = NULL; /* The context has been freed by prvSignatureVerificationFinal(). */
|
||||
}
|
||||
else
|
||||
|
|
|
@ -237,7 +237,6 @@ OtaPalStatus_t otaPal_CloseFile( OtaFileContext_t * const C )
|
|||
|
||||
/* If we fail to verify the file signature that means the image is not valid. We need to set the image state to aborted. */
|
||||
otaPal_SetPlatformImageState( C, OtaImageStateAborted );
|
||||
|
||||
}
|
||||
}
|
||||
else /* Invalid OTA Context. */
|
||||
|
@ -293,10 +292,11 @@ OtaPalStatus_t otaPal_ActivateNewImage( OtaFileContext_t* const pFileContext )
|
|||
|
||||
/*
|
||||
* Set the final state of the last transferred (final) OTA file (or bundle).
|
||||
* On Windows, the state of the OTA image is stored in PlaformImageState.txt.
|
||||
* On Windows, the state of the OTA image is stored in PlatformImageState.txt.
|
||||
*/
|
||||
|
||||
OtaPalStatus_t otaPal_SetPlatformImageState( OtaFileContext_t * const pFileContext, OtaImageState_t eState )
|
||||
OtaPalStatus_t otaPal_SetPlatformImageState( OtaFileContext_t * const pFileContext,
|
||||
OtaImageState_t eState )
|
||||
{
|
||||
( void ) pFileContext;
|
||||
|
||||
|
@ -304,7 +304,7 @@ OtaPalStatus_t otaPal_SetPlatformImageState( OtaFileContext_t * const pFileConte
|
|||
OtaPalSubStatus_t subErr = 0;
|
||||
FILE * pstPlatformImageState;
|
||||
|
||||
if( eState != OtaImageStateUnknown && eState <= OtaLastImageState )
|
||||
if( ( eState != OtaImageStateUnknown ) && ( eState <= OtaLastImageState ) )
|
||||
{
|
||||
pstPlatformImageState = fopen( "PlatformImageState.txt", "w+b" ); /*lint !e586
|
||||
* C standard library call is being used for portability. */
|
||||
|
@ -383,9 +383,11 @@ OtaPalImageState_t otaPal_GetPlatformImageState( OtaFileContext_t * const pFileC
|
|||
case OtaImageStateTesting:
|
||||
ePalState = OtaPalImageStatePendingCommit;
|
||||
break;
|
||||
|
||||
case OtaImageStateAccepted:
|
||||
ePalState = OtaPalImageStateValid;
|
||||
break;
|
||||
|
||||
case OtaImageStateRejected:
|
||||
case OtaImageStateAborted:
|
||||
default:
|
||||
|
@ -394,7 +396,6 @@ OtaPalImageState_t otaPal_GetPlatformImageState( OtaFileContext_t * const pFileC
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if( 0 != fclose( pstPlatformImageState ) ) /*lint !e586
|
||||
* C standard library call is being used for portability. */
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
/**
|
||||
* @file ota_pal.h
|
||||
* @brief Function declarations for ota_ptal.c.
|
||||
* @brief Function declarations for ota_pal.c.
|
||||
*/
|
||||
|
||||
#ifndef _OTA_PAL_H_
|
||||
|
|
|
@ -672,7 +672,7 @@ static void prvMQTTAgentTask( void * pParam );
|
|||
*
|
||||
* The implementation uses MQTT agent to queue a publish request. It then waits
|
||||
* for the request complete notification from the agent. The notification along with result of the
|
||||
* operation is sent back to the caller task using xTaksNotify API. For publishes involving QOS 1 and
|
||||
* operation is sent back to the caller task using xTaskNotify API. For publishes involving QOS 1 and
|
||||
* QOS2 the operation is complete once an acknowledgment (PUBACK) is received. OTA agent uses this function
|
||||
* to fetch new job, provide status update and send other control related messages to the MQTT broker.
|
||||
*
|
||||
|
@ -808,7 +808,7 @@ static void prvMqttDataCallback( void * pContext,
|
|||
*
|
||||
* The callback is not subscribed with MQTT broker, but only with local subscription manager.
|
||||
* A wildcard OTA job topic is used for subscription so that all unsolicited messages related to OTA is
|
||||
* forwarded to this callback for filteration. Right now the callback is used to filter responses to job requests
|
||||
* forwarded to this callback for filtration. Right now the callback is used to filter responses to job requests
|
||||
* from the OTA service.
|
||||
*
|
||||
* @param[in] pvIncomingPublishCallbackContext MQTT context which stores the connection.
|
||||
|
@ -1186,12 +1186,12 @@ static void prvCommandCallback( MQTTAgentCommandContext_t * pxCommandContext,
|
|||
static void prvMQTTSubscribeCompleteCallback( MQTTAgentCommandContext_t * pxCommandContext,
|
||||
MQTTAgentReturnInfo_t * pxReturnInfo )
|
||||
{
|
||||
MQTTAgentSubscribeArgs_t * pSubsribeArgs;
|
||||
MQTTAgentSubscribeArgs_t * pSubscribeArgs;
|
||||
|
||||
if( pxReturnInfo->returnCode == MQTTSuccess )
|
||||
{
|
||||
pSubsribeArgs = ( MQTTAgentSubscribeArgs_t * ) ( pxCommandContext->pArgs );
|
||||
prvRegisterOTACallback( pSubsribeArgs->pSubscribeInfo->pTopicFilter, pSubsribeArgs->pSubscribeInfo->topicFilterLength );
|
||||
pSubscribeArgs = ( MQTTAgentSubscribeArgs_t * ) ( pxCommandContext->pArgs );
|
||||
prvRegisterOTACallback( pSubscribeArgs->pSubscribeInfo->pTopicFilter, pSubscribeArgs->pSubscribeInfo->topicFilterLength );
|
||||
}
|
||||
|
||||
/* Store the result in the application defined context so the task that
|
||||
|
@ -1432,6 +1432,7 @@ static BaseType_t prvSocketConnect( NetworkContext_t * pxNetworkContext )
|
|||
|
||||
#if defined( democonfigUSE_AWS_IOT_CORE_BROKER )
|
||||
#if defined( democonfigCLIENT_USERNAME )
|
||||
|
||||
/*
|
||||
* When democonfigCLIENT_USERNAME is defined, use the "mqtt" alpn to connect
|
||||
* to AWS IoT Core with Custom Authentication on port 443.
|
||||
|
@ -1447,6 +1448,7 @@ static BaseType_t prvSocketConnect( NetworkContext_t * pxNetworkContext )
|
|||
#error "Connections to AWS IoT Core with custom authentication must connect to TCP port 443 with the \"mqtt\" alpn."
|
||||
#endif /* democonfigMQTT_BROKER_PORT != 443U */
|
||||
#else /* if !defined( democonfigCLIENT_USERNAME ) */
|
||||
|
||||
/*
|
||||
* Otherwise, use the "x-amzn-mqtt-ca" alpn to connect to AWS IoT Core using
|
||||
* x509 Certificate Authentication.
|
||||
|
@ -2501,7 +2503,7 @@ static BaseType_t prvRunOTADemo( void )
|
|||
}
|
||||
|
||||
/**
|
||||
* Remvove callback for receiving messages intended for OTA agent from broker,
|
||||
* Remove callback for receiving messages intended for OTA agent from broker,
|
||||
* for which the topic has not been subscribed for.
|
||||
*/
|
||||
removeSubscription( ( SubscriptionElement_t * ) xGlobalMqttAgentContext.pIncomingCallbackContext,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
|
|
@ -77,6 +77,7 @@ extern void vLoggingPrintf( const char * pcFormatString,
|
|||
#define MQTT_STATE_ARRAY_MAX_COUNT 10U
|
||||
|
||||
/*********************** coreMQTT Agent Configurations **********************/
|
||||
|
||||
/**
|
||||
* @brief The maximum number of pending acknowledgments to track for a single
|
||||
* connection.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31205.134
|
||||
|
|
|
@ -529,7 +529,7 @@ static void prvMQTTAgentTask( void * pParam );
|
|||
*
|
||||
* The implementation uses MQTT agent to queue a publish request. It then waits
|
||||
* for the request complete notification from the agent. The notification along with result of the
|
||||
* operation is sent back to the caller task using xTaksNotify API. For publishes involving QOS 1 and
|
||||
* operation is sent back to the caller task using xTaskNotify API. For publishes involving QOS 1 and
|
||||
* QOS2 the operation is complete once an acknowledgment (PUBACK) is received. OTA agent uses this function
|
||||
* to fetch new job, provide status update and send other control related messages to the MQTT broker.
|
||||
*
|
||||
|
@ -593,7 +593,7 @@ static OtaMqttStatus_t prvMQTTUnsubscribe( const char * pTopicFilter,
|
|||
* within ota_config.h. This function is used to fetch a free buffer from the pool for processing
|
||||
* by the OTA agent task. It uses a mutex for thread safe access to the pool.
|
||||
*
|
||||
* @return A pointer to an unusued buffer. NULL if there are no buffers available.
|
||||
* @return A pointer to an unused buffer. NULL if there are no buffers available.
|
||||
*/
|
||||
static OtaEventData_t * prvOTAEventBufferGet( void );
|
||||
|
||||
|
@ -667,7 +667,7 @@ static void prvMqttDataCallback( void * pContext,
|
|||
*
|
||||
* The callback is not subscribed with MQTT broker, but only with local subscription manager.
|
||||
* A wildcard OTA job topic is used for subscription so that all unsolicited messages related to OTA is
|
||||
* forwarded to this callback for filteration. Right now the callback is used to filter responses to job requests
|
||||
* forwarded to this callback for filtration. Right now the callback is used to filter responses to job requests
|
||||
* from the OTA service.
|
||||
*
|
||||
* @param[in] pvIncomingPublishCallbackContext MQTT context which stores the connection.
|
||||
|
@ -1043,12 +1043,12 @@ static void prvCommandCallback( MQTTAgentCommandContext_t * pxCommandContext,
|
|||
static void prvMQTTSubscribeCompleteCallback( MQTTAgentCommandContext_t * pxCommandContext,
|
||||
MQTTAgentReturnInfo_t * pxReturnInfo )
|
||||
{
|
||||
MQTTAgentSubscribeArgs_t * pSubsribeArgs;
|
||||
MQTTAgentSubscribeArgs_t * pSubscribeArgs;
|
||||
|
||||
if( pxReturnInfo->returnCode == MQTTSuccess )
|
||||
{
|
||||
pSubsribeArgs = ( MQTTAgentSubscribeArgs_t * ) ( pxCommandContext->pArgs );
|
||||
prvRegisterOTACallback( pSubsribeArgs->pSubscribeInfo->pTopicFilter, pSubsribeArgs->pSubscribeInfo->topicFilterLength );
|
||||
pSubscribeArgs = ( MQTTAgentSubscribeArgs_t * ) ( pxCommandContext->pArgs );
|
||||
prvRegisterOTACallback( pSubscribeArgs->pSubscribeInfo->pTopicFilter, pSubscribeArgs->pSubscribeInfo->topicFilterLength );
|
||||
}
|
||||
|
||||
/* Store the result in the application defined context so the task that
|
||||
|
@ -1289,6 +1289,7 @@ static BaseType_t prvSocketConnect( NetworkContext_t * pxNetworkContext )
|
|||
|
||||
#if defined( democonfigUSE_AWS_IOT_CORE_BROKER )
|
||||
#if defined( democonfigCLIENT_USERNAME )
|
||||
|
||||
/*
|
||||
* When democonfigCLIENT_USERNAME is defined, use the "mqtt" alpn to connect
|
||||
* to AWS IoT Core with Custom Authentication on port 443.
|
||||
|
@ -1304,12 +1305,12 @@ static BaseType_t prvSocketConnect( NetworkContext_t * pxNetworkContext )
|
|||
#error "Connections to AWS IoT Core with custom authentication must connect to TCP port 443 with the \"mqtt\" alpn."
|
||||
#endif /* democonfigMQTT_BROKER_PORT != 443U */
|
||||
#else /* if !defined( democonfigCLIENT_USERNAME ) */
|
||||
|
||||
/*
|
||||
* Otherwise, use the "x-amzn-mqtt-ca" alpn to connect to AWS IoT Core using
|
||||
* x509 Certificate Authentication.
|
||||
*/
|
||||
static const char * ppcAlpnProtocols[] = { "x-amzn-mqtt-ca", NULL };
|
||||
|
||||
#endif /* !defined( democonfigCLIENT_USERNAME ) */
|
||||
|
||||
/*
|
||||
|
@ -2037,7 +2038,7 @@ static BaseType_t prvRunOTADemo( void )
|
|||
}
|
||||
|
||||
/**
|
||||
* Remvove callback for receiving messages intended for OTA agent from broker,
|
||||
* Remove callback for receiving messages intended for OTA agent from broker,
|
||||
* for which the topic has not been subscribed for.
|
||||
*/
|
||||
removeSubscription( ( SubscriptionElement_t * ) xGlobalMqttAgentContext.pIncomingCallbackContext,
|
||||
|
@ -2086,6 +2087,7 @@ void vOtaDemoTask( void * pvParam )
|
|||
if( xPlatformIsNetworkUp() == pdFALSE )
|
||||
{
|
||||
LogInfo( ( "Waiting for the network link up event..." ) );
|
||||
|
||||
while( xPlatformIsNetworkUp() == pdFALSE )
|
||||
{
|
||||
vTaskDelay( pdMS_TO_TICKS( 1000U ) );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
|
|
@ -77,6 +77,7 @@ extern void vLoggingPrintf( const char * pcFormatString,
|
|||
#define MQTT_STATE_ARRAY_MAX_COUNT 10U
|
||||
|
||||
/*********************** coreMQTT Agent Configurations **********************/
|
||||
|
||||
/**
|
||||
* @brief The maximum number of pending acknowledgments to track for a single
|
||||
* connection.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31205.134
|
||||
|
|
|
@ -48,18 +48,21 @@
|
|||
#endif
|
||||
|
||||
|
||||
static void prvReceiveNewClient( TCPServer_t *pxServer, BaseType_t xIndex, Socket_t xNexSocket );
|
||||
static void prvReceiveNewClient( TCPServer_t * pxServer,
|
||||
BaseType_t xIndex,
|
||||
Socket_t xNexSocket );
|
||||
static char * strnew( const char * pcString );
|
||||
/* Remove slashes at the end of a path. */
|
||||
static void prvRemoveSlash( char * pcDir );
|
||||
|
||||
TCPServer_t *FreeRTOS_CreateTCPServer( const struct xSERVER_CONFIG *pxConfigs, BaseType_t xCount )
|
||||
TCPServer_t * FreeRTOS_CreateTCPServer( const struct xSERVER_CONFIG * pxConfigs,
|
||||
BaseType_t xCount )
|
||||
{
|
||||
TCPServer_t * pxServer;
|
||||
SocketSet_t xSocketSet;
|
||||
|
||||
/* Create a new server.
|
||||
xPort / xPortAlt : Make the service available on 1 or 2 public port numbers. */
|
||||
* xPort / xPortAlt : Make the service available on 1 or 2 public port numbers. */
|
||||
xSocketSet = FreeRTOS_CreateSocketSet();
|
||||
|
||||
if( xSocketSet != NULL )
|
||||
|
@ -69,6 +72,7 @@ SocketSet_t xSocketSet;
|
|||
xSize = sizeof( *pxServer ) - sizeof( pxServer->xServers ) + xCount * sizeof( pxServer->xServers[ 0 ] );
|
||||
|
||||
pxServer = ( TCPServer_t * ) pvPortMallocLarge( xSize );
|
||||
|
||||
if( pxServer != NULL )
|
||||
{
|
||||
struct freertos_sockaddr xAddress;
|
||||
|
@ -118,8 +122,9 @@ SocketSet_t xSocketSet;
|
|||
WinProperties_t xWinProps;
|
||||
|
||||
memset( &xWinProps, '\0', sizeof( xWinProps ) );
|
||||
|
||||
/* The parent socket itself won't get connected. The properties below
|
||||
will be inherited by each new child socket. */
|
||||
* will be inherited by each new child socket. */
|
||||
xWinProps.lTxBufSize = ipconfigHTTP_TX_BUFSIZE;
|
||||
xWinProps.lTxWinSize = ipconfigHTTP_TX_WINSIZE;
|
||||
xWinProps.lRxBufSize = ipconfigHTTP_RX_BUFSIZE;
|
||||
|
@ -129,7 +134,7 @@ SocketSet_t xSocketSet;
|
|||
FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* if ( ipconfigHTTP_RX_BUFSIZE > 0 ) */
|
||||
|
||||
FreeRTOS_FD_SET( xSocket, xSocketSet, eSELECT_READ | eSELECT_EXCEPT );
|
||||
pxServer->xServers[ xIndex ].xSocket = xSocket;
|
||||
|
@ -156,7 +161,9 @@ SocketSet_t xSocketSet;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvReceiveNewClient( TCPServer_t *pxServer, BaseType_t xIndex, Socket_t xNexSocket )
|
||||
static void prvReceiveNewClient( TCPServer_t * pxServer,
|
||||
BaseType_t xIndex,
|
||||
Socket_t xNexSocket )
|
||||
{
|
||||
TCPClient_t * pxClient = NULL;
|
||||
BaseType_t xSize = 0;
|
||||
|
@ -165,7 +172,7 @@ FTCPDeleteFunction fDeleteFunc = NULL;
|
|||
const char * pcType = "Unknown";
|
||||
|
||||
/*_RB_ Can the work and delete functions be part of the xSERVER_CONFIG structure
|
||||
becomes generic, with no pre-processing required? */
|
||||
* becomes generic, with no pre-processing required? */
|
||||
#if ( ipconfigUSE_HTTP != 0 )
|
||||
{
|
||||
if( pxServer->xServers[ xIndex ].eType == eSERVER_HTTP )
|
||||
|
@ -217,6 +224,7 @@ const char *pcType = "Unknown";
|
|||
pcType = "closed";
|
||||
FreeRTOS_closesocket( xNexSocket );
|
||||
}
|
||||
|
||||
{
|
||||
struct freertos_sockaddr xRemoteAddress;
|
||||
FreeRTOS_GetRemoteAddress( pxClient->xSocket, &xRemoteAddress );
|
||||
|
@ -236,7 +244,8 @@ const char *pcType = "Unknown";
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void FreeRTOS_TCPServerWork( TCPServer_t *pxServer, TickType_t xBlockingTime )
|
||||
void FreeRTOS_TCPServerWork( TCPServer_t * pxServer,
|
||||
TickType_t xBlockingTime )
|
||||
{
|
||||
TCPClient_t ** ppxClient;
|
||||
BaseType_t xIndex;
|
||||
|
@ -300,6 +309,7 @@ char *pxBuffer;
|
|||
|
||||
xLength = strlen( pcString ) + 1;
|
||||
pxBuffer = ( char * ) pvPortMalloc( xLength );
|
||||
|
||||
if( pxBuffer != NULL )
|
||||
{
|
||||
memcpy( pxBuffer, pcString, xLength );
|
||||
|
@ -323,13 +333,14 @@ BaseType_t xLength = strlen( pcDir );
|
|||
#if ( ipconfigSUPPORT_SIGNALS != 0 )
|
||||
|
||||
/* FreeRTOS_TCPServerWork() calls select().
|
||||
The two functions below provide a possibility to interrupt
|
||||
the call to select(). After the interruption, resume
|
||||
by calling FreeRTOS_TCPServerWork() again. */
|
||||
* The two functions below provide a possibility to interrupt
|
||||
* the call to select(). After the interruption, resume
|
||||
* by calling FreeRTOS_TCPServerWork() again. */
|
||||
BaseType_t FreeRTOS_TCPServerSignal( TCPServer_t * pxServer )
|
||||
{
|
||||
BaseType_t xIndex;
|
||||
BaseType_t xResult = pdFALSE;
|
||||
|
||||
for( xIndex = 0; xIndex < pxServer->xServerCount; xIndex++ )
|
||||
{
|
||||
if( pxServer->xServers[ xIndex ].xSocket != FREERTOS_NO_SOCKET )
|
||||
|
@ -349,11 +360,13 @@ BaseType_t xLength = strlen( pcDir );
|
|||
#if ( ipconfigSUPPORT_SIGNALS != 0 )
|
||||
|
||||
/* Same as above: this function may be called from an ISR,
|
||||
for instance a GPIO interrupt. */
|
||||
BaseType_t FreeRTOS_TCPServerSignalFromISR( TCPServer_t *pxServer, BaseType_t *pxHigherPriorityTaskWoken )
|
||||
* for instance a GPIO interrupt. */
|
||||
BaseType_t FreeRTOS_TCPServerSignalFromISR( TCPServer_t * pxServer,
|
||||
BaseType_t * pxHigherPriorityTaskWoken )
|
||||
{
|
||||
BaseType_t xIndex;
|
||||
BaseType_t xResult = pdFALSE;
|
||||
|
||||
for( xIndex = 0; xIndex < pxServer->xServerCount; xIndex++ )
|
||||
{
|
||||
if( pxServer->xServers[ xIndex ].xSocket != FREERTOS_NO_SOCKET )
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS+TCP V2.0.3
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -19,8 +19,9 @@
|
|||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,11 +1,6 @@
|
|||
/*
|
||||
*!
|
||||
*! The protocols implemented in this file are intended to be demo quality only,
|
||||
*! and not for production devices.
|
||||
*!
|
||||
*
|
||||
* FreeRTOS+TCP V2.0.3
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -24,10 +19,17 @@
|
|||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*!
|
||||
*! The protocols implemented in this file are intended to be demo quality only,
|
||||
*! and not for production devices.
|
||||
*!
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
|
@ -54,23 +56,32 @@ const struct xWEB_COMMAND xWebCommands[ WEB_CMD_COUNT ] =
|
|||
|
||||
const char * webCodename( int aCode )
|
||||
{
|
||||
switch (aCode) {
|
||||
case WEB_REPLY_OK: // = 200,
|
||||
switch( aCode )
|
||||
{
|
||||
case WEB_REPLY_OK: /* = 200, */
|
||||
return "OK";
|
||||
case WEB_NO_CONTENT: // 204
|
||||
|
||||
case WEB_NO_CONTENT: /* 204 */
|
||||
return "No content";
|
||||
case WEB_BAD_REQUEST: // = 400,
|
||||
|
||||
case WEB_BAD_REQUEST: /* = 400, */
|
||||
return "Bad request";
|
||||
case WEB_UNAUTHORIZED: // = 401,
|
||||
|
||||
case WEB_UNAUTHORIZED: /* = 401, */
|
||||
return "Authorization Required";
|
||||
case WEB_NOT_FOUND: // = 404,
|
||||
|
||||
case WEB_NOT_FOUND: /* = 404, */
|
||||
return "Not Found";
|
||||
case WEB_GONE: // = 410,
|
||||
|
||||
case WEB_GONE: /* = 410, */
|
||||
return "Done";
|
||||
case WEB_PRECONDITION_FAILED: // = 412,
|
||||
|
||||
case WEB_PRECONDITION_FAILED: /* = 412, */
|
||||
return "Precondition Failed";
|
||||
case WEB_INTERNAL_SERVER_ERROR: // = 500,
|
||||
|
||||
case WEB_INTERNAL_SERVER_ERROR: /* = 500, */
|
||||
return "Internal Server Error";
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
/*
|
||||
*!
|
||||
*! The protocols implemented in this file are intended to be demo quality only,
|
||||
*! and not for production devices.
|
||||
*!
|
||||
*
|
||||
* FreeRTOS+TCP V2.0.3
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -24,8 +19,16 @@
|
|||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*!
|
||||
*! The protocols implemented in this file are intended to be demo quality only,
|
||||
*! and not for production devices.
|
||||
*!
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
|
@ -74,11 +77,13 @@
|
|||
|
||||
/*_RB_ Need comment block, although fairly self evident. */
|
||||
static void prvFileClose( HTTPClient_t * pxClient );
|
||||
static BaseType_t prvProcessCmd( HTTPClient_t *pxClient, BaseType_t xIndex );
|
||||
static BaseType_t prvProcessCmd( HTTPClient_t * pxClient,
|
||||
BaseType_t xIndex );
|
||||
static const char * pcGetContentsType( const char * apFname );
|
||||
static BaseType_t prvOpenURL( HTTPClient_t * pxClient );
|
||||
static BaseType_t prvSendFile( HTTPClient_t * pxClient );
|
||||
static BaseType_t prvSendReply( HTTPClient_t *pxClient, BaseType_t xCode );
|
||||
static BaseType_t prvSendReply( HTTPClient_t * pxClient,
|
||||
BaseType_t xCode );
|
||||
|
||||
static const char pcEmptyString[ 1 ] = { '\0' };
|
||||
|
||||
|
@ -116,6 +121,7 @@ HTTPClient_t *pxClient = ( HTTPClient_t * ) pxTCPClient;
|
|||
FreeRTOS_closesocket( pxClient->xSocket );
|
||||
pxClient->xSocket = FREERTOS_NO_SOCKET;
|
||||
}
|
||||
|
||||
prvFileClose( pxClient );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -131,7 +137,8 @@ static void prvFileClose( HTTPClient_t *pxClient )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvSendReply( HTTPClient_t *pxClient, BaseType_t xCode )
|
||||
static BaseType_t prvSendReply( HTTPClient_t * pxClient,
|
||||
BaseType_t xCode )
|
||||
{
|
||||
struct xTCP_SERVER * pxParent = pxClient->pxParent;
|
||||
BaseType_t xRc;
|
||||
|
@ -180,7 +187,9 @@ BaseType_t xRc = 0;
|
|||
xRc = prvSendReply( pxClient, WEB_REPLY_OK );
|
||||
}
|
||||
|
||||
if( xRc >= 0 ) do
|
||||
if( xRc >= 0 )
|
||||
{
|
||||
do
|
||||
{
|
||||
uxSpace = FreeRTOS_tx_space( pxClient->xSocket );
|
||||
|
||||
|
@ -199,16 +208,19 @@ BaseType_t xRc = 0;
|
|||
{
|
||||
uxCount = sizeof( pxClient->pxParent->pcFileBuffer );
|
||||
}
|
||||
|
||||
ff_fread( pxClient->pxParent->pcFileBuffer, 1, uxCount, pxClient->pxFileHandle );
|
||||
pxClient->uxBytesLeft -= uxCount;
|
||||
|
||||
xRc = FreeRTOS_send( pxClient->xSocket, pxClient->pxParent->pcFileBuffer, uxCount, 0 );
|
||||
|
||||
if( xRc < 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while( uxCount > 0u );
|
||||
}
|
||||
|
||||
if( pxClient->uxBytesLeft == 0u )
|
||||
{
|
||||
|
@ -240,18 +252,21 @@ char pcSlash[ 2 ];
|
|||
size_t xResult;
|
||||
|
||||
xResult = uxApplicationHTTPHandleRequestHook( pxClient->pcUrlData, pxClient->pcCurrentFilename, sizeof( pxClient->pcCurrentFilename ) );
|
||||
|
||||
if( xResult > 0 )
|
||||
{
|
||||
strcpy( pxClient->pxParent->pcContentsType, "text/html" );
|
||||
snprintf( pxClient->pxParent->pcExtraContents, sizeof( pxClient->pxParent->pcExtraContents ),
|
||||
"Content-Length: %d\r\n", ( int ) xResult );
|
||||
xRc = prvSendReply( pxClient, WEB_REPLY_OK ); /* "Requested file action OK" */
|
||||
|
||||
if( xRc > 0 )
|
||||
{
|
||||
xRc = FreeRTOS_send( pxClient->xSocket, pxClient->pcCurrentFilename, xResult, 0 );
|
||||
}
|
||||
|
||||
/* Although against the coding standard of FreeRTOS, a return is
|
||||
done here to simplify this conditional code. */
|
||||
* done here to simplify this conditional code. */
|
||||
return xRc;
|
||||
}
|
||||
}
|
||||
|
@ -269,6 +284,7 @@ char pcSlash[ 2 ];
|
|||
/* The browser provided a starting '/' already. */
|
||||
pcSlash[ 0 ] = '\0';
|
||||
}
|
||||
|
||||
snprintf( pxClient->pcCurrentFilename, sizeof( pxClient->pcCurrentFilename ), "%s%s%s",
|
||||
pxClient->pcRootDir,
|
||||
pcSlash,
|
||||
|
@ -294,7 +310,8 @@ char pcSlash[ 2 ];
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvProcessCmd( HTTPClient_t *pxClient, BaseType_t xIndex )
|
||||
static BaseType_t prvProcessCmd( HTTPClient_t * pxClient,
|
||||
BaseType_t xIndex )
|
||||
{
|
||||
BaseType_t xResult = 0;
|
||||
|
||||
|
@ -314,10 +331,8 @@ BaseType_t xResult = 0;
|
|||
case ECMD_CONNECT:
|
||||
case ECMD_PATCH:
|
||||
case ECMD_UNK:
|
||||
{
|
||||
FreeRTOS_printf( ( "prvProcessCmd: Not implemented: %s\n",
|
||||
xWebCommands[ xIndex ].pcCommandName ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -348,10 +363,12 @@ HTTPClient_t *pxClient = ( HTTPClient_t * ) pxTCPClient;
|
|||
{
|
||||
pcBuffer[ xRc ] = '\0';
|
||||
}
|
||||
|
||||
while( xRc && ( pcBuffer[ xRc - 1 ] == 13 || pcBuffer[ xRc - 1 ] == 10 ) )
|
||||
{
|
||||
pcBuffer[ --xRc ] = '\0';
|
||||
}
|
||||
|
||||
pcEndOfCmd = pcBuffer + xRc;
|
||||
|
||||
curCmd = xWebCommands;
|
||||
|
@ -368,14 +385,17 @@ HTTPClient_t *pxClient = ( HTTPClient_t * ) pxTCPClient;
|
|||
BaseType_t xLength;
|
||||
|
||||
xLength = curCmd->xCommandLength;
|
||||
|
||||
if( ( xRc >= xLength ) && ( memcmp( curCmd->pcCommandName, pcBuffer, xLength ) == 0 ) )
|
||||
{
|
||||
char * pcLastPtr;
|
||||
|
||||
pxClient->pcUrlData += xLength + 1;
|
||||
|
||||
for( pcLastPtr = ( char * ) pxClient->pcUrlData; pcLastPtr < pcEndOfCmd; pcLastPtr++ )
|
||||
{
|
||||
char ch = *pcLastPtr;
|
||||
|
||||
if( ( ch == '\0' ) || ( strchr( "\n\r \t", ch ) != NULL ) )
|
||||
{
|
||||
*pcLastPtr = '\0';
|
||||
|
@ -383,6 +403,7 @@ HTTPClient_t *pxClient = ( HTTPClient_t * ) pxTCPClient;
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -397,6 +418,7 @@ HTTPClient_t *pxClient = ( HTTPClient_t * ) pxTCPClient;
|
|||
/* The connection will be closed and the client will be deleted. */
|
||||
FreeRTOS_printf( ( "xHTTPClientWork: rc = %ld\n", xRc ) );
|
||||
}
|
||||
|
||||
return xRc;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -411,12 +433,21 @@ static const char *pcGetContentsType (const char *apFname)
|
|||
|
||||
for( ptr = apFname; *ptr; ptr++ )
|
||||
{
|
||||
if (*ptr == '.') dot = ptr;
|
||||
if (*ptr == '/') slash = ptr;
|
||||
if( *ptr == '.' )
|
||||
{
|
||||
dot = ptr;
|
||||
}
|
||||
|
||||
if( *ptr == '/' )
|
||||
{
|
||||
slash = ptr;
|
||||
}
|
||||
}
|
||||
|
||||
if( dot > slash )
|
||||
{
|
||||
dot++;
|
||||
|
||||
for( x = 0; x < ARRAY_SIZE( pxTypeCouples ); x++ )
|
||||
{
|
||||
if( strcasecmp( dot, pxTypeCouples[ x ].pcExtension ) == 0 )
|
||||
|
@ -426,8 +457,8 @@ static const char *pcGetContentsType (const char *apFname)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pcResult;
|
||||
}
|
||||
|
||||
#endif /* ipconfigUSE_HTTP */
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@
|
|||
|
||||
#include "date_and_time.h"
|
||||
|
||||
enum EStatus {
|
||||
enum EStatus
|
||||
{
|
||||
EStatusLookup,
|
||||
EStatusAsking,
|
||||
EStatusPause,
|
||||
|
@ -77,7 +78,8 @@ static struct SNtpPacket xNTPPacket;
|
|||
|
||||
static enum EStatus xStatus = EStatusLookup;
|
||||
|
||||
static const char *pcTimeServers[] = {
|
||||
static const char * pcTimeServers[] =
|
||||
{
|
||||
"0.asia.pool.ntp.org",
|
||||
"0.europe.pool.ntp.org",
|
||||
"0.id.pool.ntp.org",
|
||||
|
@ -100,21 +102,23 @@ static void vSignalTask( void )
|
|||
if( xUDPSocket != NULL )
|
||||
{
|
||||
/* Send a signal to the socket so that the
|
||||
FreeRTOS_recvfrom will get interrupted. */
|
||||
* FreeRTOS_recvfrom will get interrupted. */
|
||||
FreeRTOS_SignalSocket( xUDPSocket );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
if( xNTPWakeupSem != NULL )
|
||||
{
|
||||
xSemaphoreGive( xNTPWakeupSem );
|
||||
}
|
||||
}
|
||||
|
||||
void vStartNTPTask( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority )
|
||||
void vStartNTPTask( uint16_t usTaskStackSize,
|
||||
UBaseType_t uxTaskPriority )
|
||||
{
|
||||
/* The only public function in this module: start a task to contact
|
||||
some NTP server. */
|
||||
* some NTP server. */
|
||||
|
||||
if( xNTPTaskhandle != NULL )
|
||||
{
|
||||
|
@ -124,12 +128,15 @@ void vStartNTPTask( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority )
|
|||
xStatus = EStatusAsking;
|
||||
vSignalTask();
|
||||
break;
|
||||
|
||||
case EStatusLookup:
|
||||
FreeRTOS_printf( ( "NTP looking up server\n" ) );
|
||||
break;
|
||||
|
||||
case EStatusAsking:
|
||||
FreeRTOS_printf( ( "NTP still asking\n" ) );
|
||||
break;
|
||||
|
||||
case EStatusFailed:
|
||||
FreeRTOS_printf( ( "NTP failed somehow\n" ) );
|
||||
ulIPAddressFound = 0ul;
|
||||
|
@ -141,6 +148,7 @@ void vStartNTPTask( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority )
|
|||
else
|
||||
{
|
||||
xUDPSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_DGRAM, FREERTOS_IPPROTO_UDP );
|
||||
|
||||
if( xUDPSocket != FREERTOS_INVALID_SOCKET )
|
||||
{
|
||||
struct freertos_sockaddr xAddress;
|
||||
|
@ -180,24 +188,29 @@ void vStartNTPTask( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void vDNS_callback( const char *pcName, void *pvSearchID, uint32_t ulIPAddress )
|
||||
static void vDNS_callback( const char * pcName,
|
||||
void * pvSearchID,
|
||||
uint32_t ulIPAddress )
|
||||
{
|
||||
char pcBuf[ 16 ];
|
||||
|
||||
/* The DNS lookup has a result, or it has reached the time-out. */
|
||||
FreeRTOS_inet_ntoa( ulIPAddress, pcBuf );
|
||||
FreeRTOS_printf( ( "IP address of %s found: %s\n", pcName, pcBuf ) );
|
||||
|
||||
if( ulIPAddressFound == 0ul )
|
||||
{
|
||||
ulIPAddressFound = ulIPAddress;
|
||||
}
|
||||
/* For testing: in case DNS doen't respond, still try some NTP server
|
||||
with a known IP-address. */
|
||||
|
||||
/* For testing: in case DNS doesn't respond, still try some NTP server
|
||||
* with a known IP-address. */
|
||||
if( ulIPAddressFound == 0ul )
|
||||
{
|
||||
ulIPAddressFound = FreeRTOS_inet_addr_quick( 184, 105, 182, 7 );
|
||||
/* ulIPAddressFound = FreeRTOS_inet_addr_quick( 103, 242, 70, 4 ); */
|
||||
}
|
||||
|
||||
xStatus = EStatusAsking;
|
||||
|
||||
vSignalTask();
|
||||
|
@ -268,10 +281,10 @@ static void prvReadTime( struct SNtpPacket * pxPacket )
|
|||
uxCurrentSeconds += uxCurrentMS / 1000;
|
||||
uxCurrentMS = uxCurrentMS % 1000;
|
||||
|
||||
// Get the last time recorded
|
||||
/* Get the last time recorded */
|
||||
uxPreviousSeconds = FreeRTOS_get_secs_msec( &uxPreviousMS );
|
||||
|
||||
// Set the new time with precision in msec. */
|
||||
/* Set the new time with precision in msec. * / */
|
||||
FreeRTOS_set_secs_msec( &uxCurrentSeconds, &uxCurrentMS );
|
||||
|
||||
if( uxCurrentSeconds >= uxPreviousSeconds )
|
||||
|
@ -297,13 +310,14 @@ static void prvReadTime( struct SNtpPacket * pxPacket )
|
|||
int32_t iPrevMS = 1000 * ( uxPreviousSeconds - ulLowest ) + uxPreviousMS;
|
||||
ilDiff = iCurMS - iPrevMS;
|
||||
}
|
||||
|
||||
uxCurrentSeconds -= iTimeZone;
|
||||
|
||||
FreeRTOS_gmtime_r( &uxCurrentSeconds, &xTimeStruct );
|
||||
|
||||
/*
|
||||
378.067 [NTP client] NTP time: 9/11/2015 16:11:19.559 Diff -20 ms (289 ms)
|
||||
379.441 [NTP client] NTP time: 9/11/2015 16:11:20.933 Diff 0 ms (263 ms)
|
||||
* 378.067 [NTP client] NTP time: 9/11/2015 16:11:19.559 Diff -20 ms (289 ms)
|
||||
* 379.441 [NTP client] NTP time: 9/11/2015 16:11:20.933 Diff 0 ms (263 ms)
|
||||
*/
|
||||
|
||||
FreeRTOS_printf( ( "NTP time: %d/%d/%02d %2d:%02d:%02d.%03u Diff %d %s (%lu ms)\n",
|
||||
|
@ -326,17 +340,22 @@ static void prvReadTime( struct SNtpPacket * pxPacket )
|
|||
|
||||
#if ( ipconfigUSE_CALLBACKS != 0 )
|
||||
|
||||
static BaseType_t xOnUDPReceive( Socket_t xSocket, void * pvData, size_t xLength,
|
||||
const struct freertos_sockaddr *pxFrom, const struct freertos_sockaddr *pxDest )
|
||||
static BaseType_t xOnUDPReceive( Socket_t xSocket,
|
||||
void * pvData,
|
||||
size_t xLength,
|
||||
const struct freertos_sockaddr * pxFrom,
|
||||
const struct freertos_sockaddr * pxDest )
|
||||
{
|
||||
if( xLength >= sizeof( xNTPPacket ) )
|
||||
{
|
||||
prvReadTime( ( struct SNtpPacket * ) pvData );
|
||||
|
||||
if( xStatus != EStatusPause )
|
||||
{
|
||||
xStatus = EStatusPause;
|
||||
}
|
||||
}
|
||||
|
||||
vSignalTask();
|
||||
/* Tell the driver not to store the RX data */
|
||||
return 1;
|
||||
|
@ -349,6 +368,7 @@ static void prvNTPTask( void *pvParameters )
|
|||
{
|
||||
BaseType_t xServerIndex = 3;
|
||||
struct freertos_sockaddr xAddress;
|
||||
|
||||
#if ( ipconfigUSE_CALLBACKS != 0 )
|
||||
F_TCP_UDP_Handler_t xHandler;
|
||||
#endif /* ipconfigUSE_CALLBACKS != 0 */
|
||||
|
@ -372,17 +392,20 @@ struct freertos_sockaddr xAddress;
|
|||
FreeRTOS_setsockopt( xUDPSocket, 0, FREERTOS_SO_SET_SEMAPHORE, ( void * ) &xNTPWakeupSem, sizeof( xNTPWakeupSem ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
switch( xStatus )
|
||||
{
|
||||
case EStatusLookup:
|
||||
|
||||
if( ( ulIPAddressFound == 0ul ) || ( ulIPAddressFound == ~0ul ) )
|
||||
{
|
||||
if( ++xServerIndex == sizeof( pcTimeServers ) / sizeof( pcTimeServers[ 0 ] ) )
|
||||
{
|
||||
xServerIndex = 0;
|
||||
}
|
||||
|
||||
FreeRTOS_printf( ( "Looking up server '%s'\n", pcTimeServers[ xServerIndex ] ) );
|
||||
FreeRTOS_gethostbyname_a( pcTimeServers[ xServerIndex ], vDNS_callback, ( void * ) NULL, 1200 );
|
||||
}
|
||||
|
@ -390,6 +413,7 @@ struct freertos_sockaddr xAddress;
|
|||
{
|
||||
xStatus = EStatusAsking;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case EStatusAsking:
|
||||
|
@ -441,13 +465,16 @@ struct freertos_sockaddr xAddress;
|
|||
|
||||
xAddressSize = sizeof( xAddress );
|
||||
xReturned = FreeRTOS_recvfrom( xUDPSocket, ( void * ) cRecvBuffer, sizeof( cRecvBuffer ), 0, &xAddress, &xAddressSize );
|
||||
|
||||
switch( xReturned )
|
||||
{
|
||||
case 0:
|
||||
case -pdFREERTOS_ERRNO_EAGAIN:
|
||||
case -pdFREERTOS_ERRNO_EINTR:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
if( xReturned < sizeof( xNTPPacket ) )
|
||||
{
|
||||
FreeRTOS_printf( ( "FreeRTOS_recvfrom: returns %ld\n", xReturned ) );
|
||||
|
@ -455,15 +482,17 @@ struct freertos_sockaddr xAddress;
|
|||
else
|
||||
{
|
||||
prvReadTime( ( struct SNtpPacket * ) cRecvBuffer );
|
||||
|
||||
if( xStatus != EStatusPause )
|
||||
{
|
||||
xStatus = EStatusPause;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* if ( ipconfigUSE_CALLBACKS != 0 ) */
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS+TCP V2.0.1
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -19,8 +19,9 @@
|
|||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __FTPCMD_H__
|
||||
|
@ -51,7 +52,7 @@
|
|||
#define REPL_230 "230 User logged in, proceed.\r\n"
|
||||
#define REPL_250 "250 Requested file action okay, completed.\r\n"
|
||||
#define REPL_257 "257 %s created.\r\n"
|
||||
// #define REPL_257_PWD "257 \"%s\" is current working dir.\r\n"
|
||||
/* #define REPL_257_PWD "257 \"%s\" is current working dir.\r\n" */
|
||||
#define REPL_257_PWD "257 \"%s\"\r\n"
|
||||
#define REPL_331 "331 Only anonymous user is accepted.\r\n"
|
||||
#define REPL_331_ANON "331 Anonymous login okay\r\n"
|
||||
|
@ -76,7 +77,8 @@
|
|||
#define REPL_553 "553 Requested action not taken.\r\n"
|
||||
#define REPL_553_READ_ONLY "553 Read-only file-system.\r\n"
|
||||
|
||||
enum EFTPCommand {
|
||||
enum EFTPCommand
|
||||
{
|
||||
ECMD_USER,
|
||||
ECMD_PASS,
|
||||
ECMD_ACCT,
|
||||
|
@ -118,7 +120,8 @@ enum EFTPCommand {
|
|||
ECMD_UNKNOWN,
|
||||
};
|
||||
|
||||
typedef struct xFTP_COMMAND {
|
||||
typedef struct xFTP_COMMAND
|
||||
{
|
||||
BaseType_t xCommandLength;
|
||||
const char pcCommandName[ 7 ];
|
||||
const unsigned char ucCommandType;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS+TCP V2.0.3
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -19,13 +19,15 @@
|
|||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
#ifndef FREERTOS_HTTP_COMMANDS_H
|
||||
#define FREERTOS_HTTP_COMMANDS_H
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
WEB_REPLY_OK = 200,
|
||||
WEB_NO_CONTENT = 204,
|
||||
WEB_BAD_REQUEST = 400,
|
||||
|
@ -36,7 +38,8 @@ enum {
|
|||
WEB_INTERNAL_SERVER_ERROR = 500,
|
||||
};
|
||||
|
||||
enum EWebCommand {
|
||||
enum EWebCommand
|
||||
{
|
||||
ECMD_GET,
|
||||
ECMD_HEAD,
|
||||
ECMD_POST,
|
||||
|
@ -63,5 +66,3 @@ extern const struct xWEB_COMMAND xWebCommands[WEB_CMD_COUNT];
|
|||
extern const char * webCodename( int aCode );
|
||||
|
||||
#endif /* FREERTOS_HTTP_COMMANDS_H */
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS+TCP V2.0.3
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -19,12 +19,13 @@
|
|||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
Some code which is common to TCP servers like HTTP en FTP
|
||||
* Some code which is common to TCP servers like HTTP en FTP
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_TCP_SERVER_H
|
||||
|
@ -48,11 +49,15 @@ enum eSERVER_TYPE
|
|||
struct xFTP_CLIENT;
|
||||
|
||||
#if ( ipconfigFTP_HAS_RECEIVED_HOOK != 0 )
|
||||
extern void vApplicationFTPReceivedHook( const char *pcFileName, uint32_t ulSize, struct xFTP_CLIENT *pxFTPClient );
|
||||
extern void vFTPReplyMessage( struct xFTP_CLIENT *pxFTPClient, const char *pcMessage );
|
||||
extern void vApplicationFTPReceivedHook( const char * pcFileName,
|
||||
uint32_t ulSize,
|
||||
struct xFTP_CLIENT * pxFTPClient );
|
||||
extern void vFTPReplyMessage( struct xFTP_CLIENT * pxFTPClient,
|
||||
const char * pcMessage );
|
||||
#endif /* ipconfigFTP_HAS_RECEIVED_HOOK != 0 */
|
||||
|
||||
#if ( ipconfigFTP_HAS_USER_PASSWORD_HOOK != 0 )
|
||||
|
||||
/*
|
||||
* Function is called when a user name has been submitted.
|
||||
* The function may return a string such as: "331 Please enter your password"
|
||||
|
@ -62,14 +67,17 @@ struct xFTP_CLIENT;
|
|||
#endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK */
|
||||
|
||||
#if ( ipconfigFTP_HAS_USER_PASSWORD_HOOK != 0 )
|
||||
|
||||
/*
|
||||
* Function is called when a password was received.
|
||||
* Return positive value to allow the user
|
||||
*/
|
||||
extern BaseType_t xApplicationFTPPasswordHook( const char *pcUserName, const char *pcPassword );
|
||||
extern BaseType_t xApplicationFTPPasswordHook( const char * pcUserName,
|
||||
const char * pcPassword );
|
||||
#endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK */
|
||||
|
||||
#if ( ipconfigFTP_HAS_USER_PROPERTIES_HOOK != 0 )
|
||||
|
||||
/*
|
||||
* The FTP server is asking for user-specific properties
|
||||
*/
|
||||
|
@ -80,10 +88,12 @@ struct xFTP_CLIENT;
|
|||
BaseType_t xReadOnly;
|
||||
}
|
||||
FTPUserProperties_t;
|
||||
extern void vApplicationFTPUserPropertiesHook( const char *pcUserName, FTPUserProperties_t *pxProperties );
|
||||
extern void vApplicationFTPUserPropertiesHook( const char * pcUserName,
|
||||
FTPUserProperties_t * pxProperties );
|
||||
#endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK */
|
||||
|
||||
#if ( ipconfigHTTP_HAS_HANDLE_REQUEST_HOOK != 0 )
|
||||
|
||||
/*
|
||||
* A GET request is received containing a special character,
|
||||
* usually a question mark.
|
||||
|
@ -92,7 +102,9 @@ struct xFTP_CLIENT;
|
|||
* size_t uxBufferLength; // Size of the buffer
|
||||
*
|
||||
*/
|
||||
extern size_t uxApplicationHTTPHandleRequestHook( const char *pcURLData, char *pcBuffer, size_t uxBufferLength );
|
||||
extern size_t uxApplicationHTTPHandleRequestHook( const char * pcURLData,
|
||||
char * pcBuffer,
|
||||
size_t uxBufferLength );
|
||||
#endif /* ipconfigHTTP_HAS_HANDLE_REQUEST_HOOK */
|
||||
|
||||
struct xSERVER_CONFIG
|
||||
|
@ -106,16 +118,20 @@ struct xSERVER_CONFIG
|
|||
struct xTCP_SERVER;
|
||||
typedef struct xTCP_SERVER TCPServer_t;
|
||||
|
||||
TCPServer_t *FreeRTOS_CreateTCPServer( const struct xSERVER_CONFIG *pxConfigs, BaseType_t xCount );
|
||||
void FreeRTOS_TCPServerWork( TCPServer_t *pxServer, TickType_t xBlockingTime );
|
||||
TCPServer_t * FreeRTOS_CreateTCPServer( const struct xSERVER_CONFIG * pxConfigs,
|
||||
BaseType_t xCount );
|
||||
void FreeRTOS_TCPServerWork( TCPServer_t * pxServer,
|
||||
TickType_t xBlockingTime );
|
||||
|
||||
#if ( ipconfigSUPPORT_SIGNALS != 0 )
|
||||
|
||||
/* FreeRTOS_TCPServerWork() calls select().
|
||||
The two functions below provide a possibility to interrupt
|
||||
the call to select(). After the interruption, resume
|
||||
by calling FreeRTOS_TCPServerWork() again. */
|
||||
* The two functions below provide a possibility to interrupt
|
||||
* the call to select(). After the interruption, resume
|
||||
* by calling FreeRTOS_TCPServerWork() again. */
|
||||
BaseType_t FreeRTOS_TCPServerSignal( TCPServer_t * pxServer );
|
||||
BaseType_t FreeRTOS_TCPServerSignalFromISR( TCPServer_t *pxServer, BaseType_t *pxHigherPriorityTaskWoken );
|
||||
BaseType_t FreeRTOS_TCPServerSignalFromISR( TCPServer_t * pxServer,
|
||||
BaseType_t * pxHigherPriorityTaskWoken );
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS+TCP V2.0.3
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -19,12 +19,13 @@
|
|||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
Some code which is common to TCP servers like HTTP and FTP
|
||||
* Some code which is common to TCP servers like HTTP and FTP
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_SERVER_PRIVATE_H
|
||||
|
@ -75,7 +76,6 @@ typedef struct xTCP_CLIENT
|
|||
/* This define contains fields which must come first within each of the client structs */
|
||||
TCP_CLIENT_FIELDS;
|
||||
/* --- Keep at the top --- */
|
||||
|
||||
} TCPClient_t;
|
||||
|
||||
struct xHTTP_CLIENT
|
||||
|
@ -89,13 +89,16 @@ struct xHTTP_CLIENT
|
|||
char pcCurrentFilename[ ffconfigMAX_FILENAME ];
|
||||
size_t uxBytesLeft;
|
||||
FF_FILE * pxFileHandle;
|
||||
union {
|
||||
struct {
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t
|
||||
bReplySent : 1;
|
||||
};
|
||||
uint32_t ulFlags;
|
||||
} bits;
|
||||
}
|
||||
bits;
|
||||
};
|
||||
|
||||
typedef struct xHTTP_CLIENT HTTPClient_t;
|
||||
|
@ -122,8 +125,10 @@ struct xFTP_CLIENT
|
|||
char pcFileName[ ffconfigMAX_FILENAME ];
|
||||
char pcConnectionAck[ 128 ];
|
||||
char pcClientAck[ 128 ];
|
||||
union {
|
||||
struct {
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t
|
||||
bHelloSent : 1,
|
||||
bLoggedIn : 1,
|
||||
|
@ -132,9 +137,12 @@ struct xFTP_CLIENT
|
|||
bReadOnly : 1;
|
||||
};
|
||||
uint32_t ulFTPFlags;
|
||||
} bits;
|
||||
union {
|
||||
struct {
|
||||
}
|
||||
bits;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t
|
||||
bIsListen : 1, /* pdTRUE for passive data connections (using list()). */
|
||||
bDirHasEntry : 1, /* pdTRUE if ff_findfirst() was successful. */
|
||||
|
@ -143,7 +151,8 @@ struct xFTP_CLIENT
|
|||
bHadError : 1; /* pdTRUE if a transfer got aborted because of an error. */
|
||||
};
|
||||
uint32_t ulConnFlags;
|
||||
} bits1;
|
||||
}
|
||||
bits1;
|
||||
};
|
||||
|
||||
typedef struct xFTP_CLIENT FTPClient_t;
|
||||
|
@ -154,8 +163,14 @@ BaseType_t xFTPClientWork( TCPClient_t *pxClient );
|
|||
void vHTTPClientDelete( TCPClient_t * pxClient );
|
||||
void vFTPClientDelete( TCPClient_t * pxClient );
|
||||
|
||||
BaseType_t xMakeAbsolute( struct xFTP_CLIENT *pxClient, char *pcBuffer, BaseType_t xBufferLength, const char *pcFileName );
|
||||
BaseType_t xMakeRelative( FTPClient_t *pxClient, char *pcBuffer, BaseType_t xBufferLength, const char *pcFileName );
|
||||
BaseType_t xMakeAbsolute( struct xFTP_CLIENT * pxClient,
|
||||
char * pcBuffer,
|
||||
BaseType_t xBufferLength,
|
||||
const char * pcFileName );
|
||||
BaseType_t xMakeRelative( FTPClient_t * pxClient,
|
||||
char * pcBuffer,
|
||||
BaseType_t xBufferLength,
|
||||
const char * pcFileName );
|
||||
|
||||
struct xTCP_SERVER
|
||||
{
|
||||
|
@ -179,7 +194,8 @@ struct xTCP_SERVER
|
|||
enum eSERVER_TYPE eType; /* eSERVER_HTTP | eSERVER_FTP */
|
||||
const char * pcRootDir;
|
||||
Socket_t xSocket;
|
||||
} xServers[ 1 ];
|
||||
}
|
||||
xServers[ 1 ];
|
||||
};
|
||||
|
||||
#endif /* FREERTOS_SERVER_PRIVATE_H */
|
||||
|
|
|
@ -1,6 +1,30 @@
|
|||
//
|
||||
// ntpClient.h
|
||||
//
|
||||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/* ntpClient.h */
|
||||
|
||||
#ifndef __NTPCLIENT_H__
|
||||
|
||||
|
@ -18,7 +42,8 @@ typedef union _SNtpFlags SNtpFlags;
|
|||
/**
|
||||
* 64-bit NTP timestamp.
|
||||
*/
|
||||
struct __attribute__ ((__packed__)) _SNtpTimestamp {
|
||||
struct __attribute__( ( __packed__ ) ) _SNtpTimestamp
|
||||
{
|
||||
/** Number of seconds passed since Jan 1 1900, in big-endian format. */
|
||||
quint32 seconds;
|
||||
|
||||
|
@ -27,39 +52,41 @@ struct __attribute__ ((__packed__)) _SNtpTimestamp {
|
|||
};
|
||||
|
||||
typedef struct _SNtpTimestamp SNtpTimestamp;
|
||||
|
||||
/**
|
||||
* Mandatory part of an NTP packet
|
||||
*/
|
||||
struct SNtpPacket {
|
||||
struct SNtpPacket
|
||||
{
|
||||
/** Flags. */
|
||||
unsigned char flags; // value 0xDB : mode 3 (client), version 3, leap indicator unknown 3
|
||||
unsigned char flags; /* value 0xDB : mode 3 (client), version 3, leap indicator unknown 3 */
|
||||
|
||||
/** Stratum of the clock. */
|
||||
quint8 stratum; // value 0 : unspecified
|
||||
quint8 stratum; /* value 0 : unspecified */
|
||||
|
||||
/** Maximum interval between successive messages, in log2 seconds. Note that the value is signed. */
|
||||
qint8 poll; // 10 means 1 << 10 = 1024 seconds
|
||||
qint8 poll; /* 10 means 1 << 10 = 1024 seconds */
|
||||
|
||||
/** Precision of the clock, in log2 seconds. Note that the value is signed. */
|
||||
qint8 precision; // 0xFA = 250 = 0.015625 seconds
|
||||
qint8 precision; /* 0xFA = 250 = 0.015625 seconds */
|
||||
|
||||
/** Round trip time to the primary reference source, in NTP short format. */
|
||||
qint32 rootDelay; // 0x5D2E = 23854 or (23854/65535)= 0.3640 sec
|
||||
qint32 rootDelay; /* 0x5D2E = 23854 or (23854/65535)= 0.3640 sec */
|
||||
|
||||
/** Nominal error relative to the primary reference source. */
|
||||
qint32 rootDispersion; // 0x0008 CAC8 = 8.7912 seconds
|
||||
qint32 rootDispersion; /* 0x0008 CAC8 = 8.7912 seconds */
|
||||
|
||||
/** Reference identifier (either a 4 character string or an IP address). */
|
||||
qint8 referenceID[4]; // or just 0000
|
||||
qint8 referenceID[ 4 ]; /* or just 0000 */
|
||||
|
||||
/** The time at which the clock was last set or corrected. */
|
||||
SNtpTimestamp referenceTimestamp; // Current time
|
||||
SNtpTimestamp referenceTimestamp; /* Current time */
|
||||
|
||||
/** The time at which the request departed the client for the server. */
|
||||
SNtpTimestamp originateTimestamp; // Keep 0
|
||||
SNtpTimestamp originateTimestamp; /* Keep 0 */
|
||||
|
||||
/** The time at which the request arrived at the server. */
|
||||
SNtpTimestamp receiveTimestamp; // Keep 0
|
||||
SNtpTimestamp receiveTimestamp; /* Keep 0 */
|
||||
|
||||
/** The time at which the reply departed the server for client. */
|
||||
SNtpTimestamp transmitTimestamp;
|
||||
|
|
|
@ -1,11 +1,34 @@
|
|||
/*
|
||||
* A simple demo for NTP using FreeRTOS+TCP
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NTPDEMO_H
|
||||
|
||||
#define NTPDEMO_H
|
||||
|
||||
void vStartNTPTask( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority );
|
||||
void vStartNTPTask( uint16_t usTaskStackSize,
|
||||
UBaseType_t uxTaskPriority );
|
||||
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -56,7 +56,8 @@
|
|||
/*
|
||||
* Print out information on a single file.
|
||||
*/
|
||||
static void prvCreateFileInfoString( char *pcBuffer, F_FIND *pxFindStruct );
|
||||
static void prvCreateFileInfoString( char * pcBuffer,
|
||||
F_FIND * pxFindStruct );
|
||||
|
||||
/*
|
||||
* Copies an existing file into a newly created file.
|
||||
|
@ -70,30 +71,40 @@ static BaseType_t prvPerformCopy( const char *pcSourceFile,
|
|||
/*
|
||||
* Implements the DIR command.
|
||||
*/
|
||||
static BaseType_t prvDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvDIRCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the CD command.
|
||||
*/
|
||||
static BaseType_t prvCDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvCDCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the DEL command.
|
||||
*/
|
||||
static BaseType_t prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvDELCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the TYPE command.
|
||||
*/
|
||||
static BaseType_t prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvTYPECommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the COPY command.
|
||||
*/
|
||||
static BaseType_t prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvCOPYCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/* Structure that defines the DIR command line command, which lists all the
|
||||
files in the current directory. */
|
||||
* files in the current directory. */
|
||||
static const CLI_Command_Definition_t xDIR =
|
||||
{
|
||||
"dir", /* The command string to type. */
|
||||
|
@ -103,7 +114,7 @@ static const CLI_Command_Definition_t xDIR =
|
|||
};
|
||||
|
||||
/* Structure that defines the CD command line command, which changes the
|
||||
working directory. */
|
||||
* working directory. */
|
||||
static const CLI_Command_Definition_t xCD =
|
||||
{
|
||||
"cd", /* The command string to type. */
|
||||
|
@ -113,7 +124,7 @@ static const CLI_Command_Definition_t xCD =
|
|||
};
|
||||
|
||||
/* Structure that defines the TYPE command line command, which prints the
|
||||
contents of a file to the console. */
|
||||
* contents of a file to the console. */
|
||||
static const CLI_Command_Definition_t xTYPE =
|
||||
{
|
||||
"type", /* The command string to type. */
|
||||
|
@ -154,7 +165,9 @@ void vRegisterFileSystemCLICommands( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvTYPECommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength, xReturn = pdTRUE;
|
||||
|
@ -173,7 +186,7 @@ size_t xColumns = 50U;
|
|||
if( xWriteBufferLen < xColumns )
|
||||
{
|
||||
/* Ensure the loop that uses xColumns as an end condition does not
|
||||
write off the end of the buffer. */
|
||||
* write off the end of the buffer. */
|
||||
xColumns = xWriteBufferLen;
|
||||
}
|
||||
|
||||
|
@ -218,7 +231,7 @@ size_t xColumns = 50U;
|
|||
if( pxFile == NULL )
|
||||
{
|
||||
/* Either the file was not opened, or all the data from the file has
|
||||
been returned and the file is now closed. */
|
||||
* been returned and the file is now closed. */
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
|
||||
|
@ -228,7 +241,9 @@ size_t xColumns = 50U;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvCDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvCDCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength;
|
||||
|
@ -266,7 +281,9 @@ size_t xStringLength;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvDIRCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
static F_FIND * pxFindStruct = NULL;
|
||||
unsigned char ucReturned;
|
||||
|
@ -282,7 +299,7 @@ BaseType_t xReturn = pdFALSE;
|
|||
if( pxFindStruct == NULL )
|
||||
{
|
||||
/* This is the first time this function has been executed since the Dir
|
||||
command was run. Create the find structure. */
|
||||
* command was run. Create the find structure. */
|
||||
pxFindStruct = ( F_FIND * ) pvPortMalloc( sizeof( F_FIND ) );
|
||||
|
||||
if( pxFindStruct != NULL )
|
||||
|
@ -307,7 +324,7 @@ BaseType_t xReturn = pdFALSE;
|
|||
else
|
||||
{
|
||||
/* The find struct has already been created. Find the next file in
|
||||
the directory. */
|
||||
* the directory. */
|
||||
ucReturned = f_findnext( pxFindStruct );
|
||||
|
||||
if( ucReturned == F_NO_ERROR )
|
||||
|
@ -332,7 +349,9 @@ BaseType_t xReturn = pdFALSE;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvDELCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength;
|
||||
|
@ -370,7 +389,9 @@ unsigned char ucReturned;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvCOPYCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
char * pcSourceFile, * pcDestinationFile;
|
||||
BaseType_t xParameterStringLength;
|
||||
|
@ -420,7 +441,7 @@ long lSourceLength, lDestinationLength = 0;
|
|||
}
|
||||
|
||||
/* Continue only if the source file exists and the destination file does
|
||||
not exist. */
|
||||
* not exist. */
|
||||
if( ( lSourceLength != 0 ) && ( lDestinationLength == 0 ) )
|
||||
{
|
||||
if( prvPerformCopy( pcSourceFile, lSourceLength, pcDestinationFile, pcWriteBuffer, xWriteBufferLen ) == pdPASS )
|
||||
|
@ -457,7 +478,7 @@ BaseType_t xReturn = pdPASS;
|
|||
lBytesRemaining = lSourceFileLength - lBytesRead;
|
||||
|
||||
/* How many bytes should be read this time around the loop. Can't
|
||||
read more bytes than will fit into the buffer. */
|
||||
* read more bytes than will fit into the buffer. */
|
||||
if( lBytesRemaining > ( long ) xWriteBufferLen )
|
||||
{
|
||||
lBytesToRead = ( long ) xWriteBufferLen;
|
||||
|
@ -468,9 +489,10 @@ BaseType_t xReturn = pdPASS;
|
|||
}
|
||||
|
||||
/* Open the source file, seek past the data that has already been
|
||||
read from the file, read the next block of data, then close the
|
||||
file again so the destination file can be opened. */
|
||||
* read from the file, read the next block of data, then close the
|
||||
* file again so the destination file can be opened. */
|
||||
pxFile = f_open( pcSourceFile, "r" );
|
||||
|
||||
if( pxFile != NULL )
|
||||
{
|
||||
f_seek( pxFile, lBytesRead, F_SEEK_SET );
|
||||
|
@ -484,8 +506,9 @@ BaseType_t xReturn = pdPASS;
|
|||
}
|
||||
|
||||
/* Open the destination file and write the block of data to the end of
|
||||
the file. */
|
||||
* the file. */
|
||||
pxFile = f_open( pcDestinationFile, "a" );
|
||||
|
||||
if( pxFile != NULL )
|
||||
{
|
||||
f_write( pxWriteBuffer, lBytesToRead, 1, pxFile );
|
||||
|
@ -504,7 +527,8 @@ BaseType_t xReturn = pdPASS;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvCreateFileInfoString( char *pcBuffer, F_FIND *pxFindStruct )
|
||||
static void prvCreateFileInfoString( char * pcBuffer,
|
||||
F_FIND * pxFindStruct )
|
||||
{
|
||||
const char * pcWritableFile = "writable file", * pcReadOnlyFile = "read only file", * pcDirectory = "directory";
|
||||
const char * pcAttrib;
|
||||
|
@ -524,6 +548,6 @@ const char * pcAttrib;
|
|||
}
|
||||
|
||||
/* Create a string that includes the file name, the file size and the
|
||||
attributes string. */
|
||||
* attributes string. */
|
||||
sprintf( pcBuffer, "%s [%s] [size=%d]", pxFindStruct->filename, pcAttrib, ( int ) pxFindStruct->filesize );
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -61,41 +61,53 @@ void vRegisterSampleCLICommands( void );
|
|||
/*
|
||||
* Implements the task-stats command.
|
||||
*/
|
||||
static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvTaskStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the run-time-stats command.
|
||||
*/
|
||||
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||
static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvRunTimeStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
#endif /* configGENERATE_RUN_TIME_STATS */
|
||||
|
||||
/*
|
||||
* Implements the echo-three-parameters command.
|
||||
*/
|
||||
static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvThreeParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the echo-parameters command.
|
||||
*/
|
||||
static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the "query heap" command.
|
||||
*/
|
||||
#if ( configINCLUDE_QUERY_HEAP_COMMAND == 1 )
|
||||
static BaseType_t prvQueryHeapCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvQueryHeapCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Implements the "trace start" and "trace stop" commands;
|
||||
*/
|
||||
#if ( configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1 )
|
||||
static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvStartStopTraceCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
#endif
|
||||
|
||||
/* Structure that defines the "task-stats" command line command. This generates
|
||||
a table that gives information on each task in the system. */
|
||||
* a table that gives information on each task in the system. */
|
||||
static const CLI_Command_Definition_t xTaskStats =
|
||||
{
|
||||
"task-stats", /* The command string to type. */
|
||||
|
@ -105,8 +117,8 @@ static const CLI_Command_Definition_t xTaskStats =
|
|||
};
|
||||
|
||||
/* Structure that defines the "echo_3_parameters" command line command. This
|
||||
takes exactly three parameters that the command simply echos back one at a
|
||||
time. */
|
||||
* takes exactly three parameters that the command simply echos back one at a
|
||||
* time. */
|
||||
static const CLI_Command_Definition_t xThreeParameterEcho =
|
||||
{
|
||||
"echo-3-parameters",
|
||||
|
@ -116,8 +128,8 @@ static const CLI_Command_Definition_t xThreeParameterEcho =
|
|||
};
|
||||
|
||||
/* Structure that defines the "echo_parameters" command line command. This
|
||||
takes a variable number of parameters that the command simply echos back one at
|
||||
a time. */
|
||||
* takes a variable number of parameters that the command simply echos back one at
|
||||
* a time. */
|
||||
static const CLI_Command_Definition_t xParameterEcho =
|
||||
{
|
||||
"echo-parameters",
|
||||
|
@ -127,8 +139,9 @@ static const CLI_Command_Definition_t xParameterEcho =
|
|||
};
|
||||
|
||||
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||
|
||||
/* Structure that defines the "run-time-stats" command line command. This
|
||||
generates a table that shows how much run time each task has */
|
||||
* generates a table that shows how much run time each task has */
|
||||
static const CLI_Command_Definition_t xRunTimeStats =
|
||||
{
|
||||
"run-time-stats", /* The command string to type. */
|
||||
|
@ -150,8 +163,9 @@ static const CLI_Command_Definition_t xParameterEcho =
|
|||
#endif /* configQUERY_HEAP_COMMAND */
|
||||
|
||||
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
|
||||
|
||||
/* Structure that defines the "trace" command line command. This takes a single
|
||||
parameter, which can be either "start" or "stop". */
|
||||
* parameter, which can be either "start" or "stop". */
|
||||
static const CLI_Command_Definition_t xStartStopTrace =
|
||||
{
|
||||
"trace",
|
||||
|
@ -190,14 +204,16 @@ void vRegisterSampleCLICommands( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvTaskStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * const pcHeader = " State Priority Stack #\r\n************************************************\r\n";
|
||||
BaseType_t xSpacePadding;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -207,8 +223,9 @@ BaseType_t xSpacePadding;
|
|||
pcWriteBuffer += strlen( pcWriteBuffer );
|
||||
|
||||
/* Minus three for the null terminator and half the number of characters in
|
||||
"Task" so the column lines up with the centre of the heading. */
|
||||
* "Task" so the column lines up with the centre of the heading. */
|
||||
configASSERT( configMAX_TASK_NAME_LEN > 3 );
|
||||
|
||||
for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ )
|
||||
{
|
||||
/* Add a space to align columns after the task's name. */
|
||||
|
@ -218,22 +235,25 @@ BaseType_t xSpacePadding;
|
|||
/* Ensure always terminated. */
|
||||
*pcWriteBuffer = 0x00;
|
||||
}
|
||||
|
||||
strcpy( pcWriteBuffer, pcHeader );
|
||||
vTaskList( pcWriteBuffer + strlen( pcHeader ) );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configINCLUDE_QUERY_HEAP_COMMAND == 1 )
|
||||
|
||||
static BaseType_t prvQueryHeapCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvQueryHeapCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -241,7 +261,7 @@ BaseType_t xSpacePadding;
|
|||
sprintf( pcWriteBuffer, "Current free heap %d bytes, minimum ever free heap %d bytes\r\n", ( int ) xPortGetFreeHeapSize(), ( int ) xPortGetMinimumEverFreeHeapSize() );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
|
||||
|
@ -250,14 +270,16 @@ BaseType_t xSpacePadding;
|
|||
|
||||
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||
|
||||
static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvRunTimeStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * const pcHeader = " Abs Time % Time\r\n****************************************\r\n";
|
||||
BaseType_t xSpacePadding;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -267,9 +289,9 @@ BaseType_t xSpacePadding;
|
|||
pcWriteBuffer += strlen( pcWriteBuffer );
|
||||
|
||||
/* Pad the string "task" with however many bytes necessary to make it the
|
||||
length of a task name. Minus three for the null terminator and half the
|
||||
number of characters in "Task" so the column lines up with the centre of
|
||||
the heading. */
|
||||
* length of a task name. Minus three for the null terminator and half the
|
||||
* number of characters in "Task" so the column lines up with the centre of
|
||||
* the heading. */
|
||||
for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ )
|
||||
{
|
||||
/* Add a space to align columns after the task's name. */
|
||||
|
@ -284,22 +306,24 @@ BaseType_t xSpacePadding;
|
|||
vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
|
||||
#endif /* configGENERATE_RUN_TIME_STATS */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvThreeParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength, xReturn;
|
||||
static UBaseType_t uxParameterNumber = 0;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -307,15 +331,15 @@ static UBaseType_t uxParameterNumber = 0;
|
|||
if( uxParameterNumber == 0 )
|
||||
{
|
||||
/* The first time the function is called after the command has been
|
||||
entered just a header string is returned. */
|
||||
* entered just a header string is returned. */
|
||||
sprintf( pcWriteBuffer, "The three parameters were:\r\n" );
|
||||
|
||||
/* Next time the function is called the first parameter will be echoed
|
||||
back. */
|
||||
* back. */
|
||||
uxParameterNumber = 1U;
|
||||
|
||||
/* There is more data to be returned as no parameters have been echoed
|
||||
back yet. */
|
||||
* back yet. */
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
|
@ -338,11 +362,11 @@ static UBaseType_t uxParameterNumber = 0;
|
|||
strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
|
||||
|
||||
/* If this is the last of the three parameters then there are no more
|
||||
strings to return after this one. */
|
||||
* strings to return after this one. */
|
||||
if( uxParameterNumber == 3U )
|
||||
{
|
||||
/* If this is the last of the three parameters then there are no more
|
||||
strings to return after this one. */
|
||||
* strings to return after this one. */
|
||||
xReturn = pdFALSE;
|
||||
uxParameterNumber = 0;
|
||||
}
|
||||
|
@ -358,15 +382,17 @@ static UBaseType_t uxParameterNumber = 0;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength, xReturn;
|
||||
static UBaseType_t uxParameterNumber = 0;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -374,15 +400,15 @@ static UBaseType_t uxParameterNumber = 0;
|
|||
if( uxParameterNumber == 0 )
|
||||
{
|
||||
/* The first time the function is called after the command has been
|
||||
entered just a header string is returned. */
|
||||
* entered just a header string is returned. */
|
||||
sprintf( pcWriteBuffer, "The parameters were:\r\n" );
|
||||
|
||||
/* Next time the function is called the first parameter will be echoed
|
||||
back. */
|
||||
* back. */
|
||||
uxParameterNumber = 1U;
|
||||
|
||||
/* There is more data to be returned as no parameters have been echoed
|
||||
back yet. */
|
||||
* back yet. */
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
|
@ -410,7 +436,7 @@ static UBaseType_t uxParameterNumber = 0;
|
|||
else
|
||||
{
|
||||
/* No more parameters were found. Make sure the write buffer does
|
||||
not contain a valid string. */
|
||||
* not contain a valid string. */
|
||||
pcWriteBuffer[ 0 ] = 0x00;
|
||||
|
||||
/* No more data to return. */
|
||||
|
@ -427,14 +453,16 @@ static UBaseType_t uxParameterNumber = 0;
|
|||
|
||||
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
|
||||
|
||||
static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvStartStopTraceCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t lParameterStringLength;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -472,7 +500,7 @@ static UBaseType_t uxParameterNumber = 0;
|
|||
}
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -46,15 +46,15 @@
|
|||
/* Dimensions the buffer into which input characters are placed. */
|
||||
#define cmdMAX_INPUT_SIZE 50
|
||||
|
||||
/* Dimentions a buffer to be used by the UART driver, if the UART driver uses a
|
||||
buffer at all. */
|
||||
/* Dimensions a buffer to be used by the UART driver, if the UART driver uses a
|
||||
* buffer at all. */
|
||||
#define cmdQUEUE_LENGTH 25
|
||||
|
||||
/* DEL acts as a backspace. */
|
||||
#define cmdASCII_DEL ( 0x7F )
|
||||
|
||||
/* The maximum time to wait for the mutex that guards the UART to become
|
||||
available. */
|
||||
* available. */
|
||||
#define cmdMAX_MUTEX_WAIT pdMS_TO_TICKS( 300 )
|
||||
|
||||
#ifndef configCLI_BAUD_RATE
|
||||
|
@ -67,7 +67,8 @@ available. */
|
|||
* The task that implements the command console processing.
|
||||
*/
|
||||
static void prvUARTCommandConsoleTask( void * pvParameters );
|
||||
void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );
|
||||
void vUARTCommandConsoleStart( uint16_t usStackSize,
|
||||
UBaseType_t uxPriority );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -77,7 +78,7 @@ static const char * const pcEndOfOutputMessage = "\r\n[Press ENTER to execute th
|
|||
static const char * const pcNewLine = "\r\n";
|
||||
|
||||
/* Used to guard access to the UART in case messages are sent to the UART from
|
||||
more than one task. */
|
||||
* more than one task. */
|
||||
static SemaphoreHandle_t xTxMutex = NULL;
|
||||
|
||||
/* The handle to the UART port, which is not used by all ports. */
|
||||
|
@ -85,7 +86,8 @@ static xComPortHandle xPort = 0;
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority )
|
||||
void vUARTCommandConsoleStart( uint16_t usStackSize,
|
||||
UBaseType_t uxPriority )
|
||||
{
|
||||
/* Create the semaphore used to access the UART Tx. */
|
||||
xTxMutex = xSemaphoreCreateMutex();
|
||||
|
@ -113,8 +115,8 @@ xComPortHandle xPort;
|
|||
( void ) pvParameters;
|
||||
|
||||
/* Obtain the address of the output buffer. Note there is no mutual
|
||||
exclusion on this buffer as it is assumed only one command console interface
|
||||
will be used at any one time. */
|
||||
* exclusion on this buffer as it is assumed only one command console interface
|
||||
* will be used at any one time. */
|
||||
pcOutputString = FreeRTOS_CLIGetOutputBuffer();
|
||||
|
||||
/* Initialise the UART. */
|
||||
|
@ -126,9 +128,11 @@ xComPortHandle xPort;
|
|||
for( ; ; )
|
||||
{
|
||||
/* Wait for the next character. The while loop is used in case
|
||||
INCLUDE_vTaskSuspend is not set to 1 - in which case portMAX_DELAY will
|
||||
be a genuine block time rather than an infinite block time. */
|
||||
while( xSerialGetChar( xPort, &cRxedChar, portMAX_DELAY ) != pdPASS );
|
||||
* INCLUDE_vTaskSuspend is not set to 1 - in which case portMAX_DELAY will
|
||||
* be a genuine block time rather than an infinite block time. */
|
||||
while( xSerialGetChar( xPort, &cRxedChar, portMAX_DELAY ) != pdPASS )
|
||||
{
|
||||
}
|
||||
|
||||
/* Ensure exclusive access to the UART Tx. */
|
||||
if( xSemaphoreTake( xTxMutex, cmdMAX_MUTEX_WAIT ) == pdPASS )
|
||||
|
@ -137,13 +141,13 @@ xComPortHandle xPort;
|
|||
xSerialPutChar( xPort, cRxedChar, portMAX_DELAY );
|
||||
|
||||
/* Was it the end of the line? */
|
||||
if( cRxedChar == '\n' || cRxedChar == '\r' )
|
||||
if( ( cRxedChar == '\n' ) || ( cRxedChar == '\r' ) )
|
||||
{
|
||||
/* Just to space the output from the input. */
|
||||
vSerialPutString( xPort, ( signed char * ) pcNewLine, ( unsigned short ) strlen( pcNewLine ) );
|
||||
|
||||
/* See if the command is empty, indicating that the last command
|
||||
is to be executed again. */
|
||||
* is to be executed again. */
|
||||
if( ucInputIndex == 0 )
|
||||
{
|
||||
/* Copy the last command back into the input string. */
|
||||
|
@ -151,9 +155,9 @@ xComPortHandle xPort;
|
|||
}
|
||||
|
||||
/* Pass the received command to the command interpreter. The
|
||||
command interpreter is called repeatedly until it returns
|
||||
pdFALSE (indicating there is no more output) as it might
|
||||
generate more than one string. */
|
||||
* command interpreter is called repeatedly until it returns
|
||||
* pdFALSE (indicating there is no more output) as it might
|
||||
* generate more than one string. */
|
||||
do
|
||||
{
|
||||
/* Get the next output string from the command interpreter. */
|
||||
|
@ -161,13 +165,12 @@ xComPortHandle xPort;
|
|||
|
||||
/* Write the generated string to the UART. */
|
||||
vSerialPutString( xPort, ( signed char * ) pcOutputString, ( unsigned short ) strlen( pcOutputString ) );
|
||||
|
||||
} while( xReturned != pdFALSE );
|
||||
|
||||
/* All the strings generated by the input command have been
|
||||
sent. Clear the input string ready to receive the next command.
|
||||
Remember the command that was just processed first in case it is
|
||||
to be processed again. */
|
||||
* sent. Clear the input string ready to receive the next command.
|
||||
* Remember the command that was just processed first in case it is
|
||||
* to be processed again. */
|
||||
strcpy( cLastInputString, cInputString );
|
||||
ucInputIndex = 0;
|
||||
memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );
|
||||
|
@ -183,7 +186,7 @@ xComPortHandle xPort;
|
|||
else if( ( cRxedChar == '\b' ) || ( cRxedChar == cmdASCII_DEL ) )
|
||||
{
|
||||
/* Backspace was pressed. Erase the last character in the
|
||||
string - if any. */
|
||||
* string - if any. */
|
||||
if( ucInputIndex > 0 )
|
||||
{
|
||||
ucInputIndex--;
|
||||
|
@ -193,8 +196,8 @@ xComPortHandle xPort;
|
|||
else
|
||||
{
|
||||
/* A character was entered. Add it to the string entered so
|
||||
far. When a \n is entered the complete string will be
|
||||
passed to the command interpreter. */
|
||||
* far. When a \n is entered the complete string will be
|
||||
* passed to the command interpreter. */
|
||||
if( ( cRxedChar >= ' ' ) && ( cRxedChar <= '~' ) )
|
||||
{
|
||||
if( ucInputIndex < cmdMAX_INPUT_SIZE )
|
||||
|
@ -222,4 +225,3 @@ void vOutputString( const char * const pcMessage )
|
|||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -45,24 +45,30 @@
|
|||
#include "FreeRTOS_CLI.h"
|
||||
|
||||
/* FreeRTOS+UDP includes, just to make the stats available to the CLI
|
||||
commands. */
|
||||
* commands. */
|
||||
#include "FreeRTOS_UDP_IP.h"
|
||||
#include "FreeRTOS_Sockets.h"
|
||||
|
||||
/*
|
||||
* Defines a command that prints out IP address information.
|
||||
*/
|
||||
static BaseType_t prvDisplayIPConfig( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvDisplayIPConfig( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that prints out the gathered demo debug stats.
|
||||
*/
|
||||
static BaseType_t prvDisplayIPDebugStats( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvDisplayIPDebugStats( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that sends an ICMP ping request to an IP address.
|
||||
*/
|
||||
static BaseType_t prvPingCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvPingCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/* Structure that defines the "ip-config" command line command. */
|
||||
static const CLI_Command_Definition_t xIPConfig =
|
||||
|
@ -87,8 +93,8 @@ static const CLI_Command_Definition_t xIPConfig =
|
|||
#if ipconfigSUPPORT_OUTGOING_PINGS == 1
|
||||
|
||||
/* Structure that defines the "ping" command line command. This takes an IP
|
||||
address or host name and (optionally) the number of bytes to ping as
|
||||
parameters. */
|
||||
* address or host name and (optionally) the number of bytes to ping as
|
||||
* parameters. */
|
||||
static const CLI_Command_Definition_t xPing =
|
||||
{
|
||||
"ping",
|
||||
|
@ -123,7 +129,9 @@ void vRegisterUDPCLICommands( void )
|
|||
|
||||
#if ipconfigSUPPORT_OUTGOING_PINGS == 1
|
||||
|
||||
static BaseType_t prvPingCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvPingCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
char * pcParameter;
|
||||
BaseType_t lParameterStringLength, xReturn;
|
||||
|
@ -132,8 +140,8 @@ void vRegisterUDPCLICommands( void )
|
|||
char cBuffer[ 16 ];
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -171,7 +179,7 @@ void vRegisterUDPCLICommands( void )
|
|||
configASSERT( pcParameter );
|
||||
|
||||
/* Attempt to obtain the IP address. If the first character is not a
|
||||
digit, assume the host name has been passed in. */
|
||||
* digit, assume the host name has been passed in. */
|
||||
if( ( *pcParameter >= '0' ) && ( *pcParameter <= '9' ) )
|
||||
{
|
||||
ulIPAddress = FreeRTOS_inet_addr( pcParameter );
|
||||
|
@ -214,15 +222,17 @@ void vRegisterUDPCLICommands( void )
|
|||
|
||||
#if configINCLUDE_DEMO_DEBUG_STATS != 0
|
||||
|
||||
static BaseType_t prvDisplayIPDebugStats( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvDisplayIPDebugStats( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
static BaseType_t xIndex = -1;
|
||||
extern xExampleDebugStatEntry_t xIPTraceValues[];
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -250,15 +260,17 @@ void vRegisterUDPCLICommands( void )
|
|||
|
||||
#endif /* configINCLUDE_DEMO_DEBUG_STATS */
|
||||
|
||||
static BaseType_t prvDisplayIPConfig( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvDisplayIPConfig( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
static BaseType_t xIndex = 0;
|
||||
BaseType_t xReturn;
|
||||
uint32_t ulAddress;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -325,4 +337,3 @@ uint32_t ulAddress;
|
|||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -83,7 +83,7 @@ static void prvVerifyDemoFileUsing_f_getc( void );
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* A buffer used to both create content to write to disk, and read content back
|
||||
from a disk. Note there is no mutual exclusion on this buffer. */
|
||||
* from a disk. Note there is no mutual exclusion on this buffer. */
|
||||
static char cRAMBuffer[ fsRAM_BUFFER_SIZE ];
|
||||
|
||||
/* Names of directories that are created. */
|
||||
|
@ -117,7 +117,7 @@ unsigned char ucStatus;
|
|||
prvCreateDemoFileUsing_f_putc();
|
||||
|
||||
/* Read back and verify the file created by
|
||||
prvCreateDemoFileUsing_f_putc(). */
|
||||
* prvCreateDemoFileUsing_f_putc(). */
|
||||
prvVerifyDemoFileUsing_f_getc();
|
||||
}
|
||||
}
|
||||
|
@ -132,15 +132,15 @@ long lItemsWritten;
|
|||
F_FILE * pxFile;
|
||||
|
||||
/* Create xMaxFiles files. Each created file will be
|
||||
( xFileNumber * fsRAM_BUFFER_SIZE ) bytes in length, and filled
|
||||
with a different repeating character. */
|
||||
* ( xFileNumber * fsRAM_BUFFER_SIZE ) bytes in length, and filled
|
||||
* with a different repeating character. */
|
||||
for( xFileNumber = 1; xFileNumber <= xMaxFiles; xFileNumber++ )
|
||||
{
|
||||
/* Generate a file name. */
|
||||
sprintf( cFileName, "root%03d.txt", ( int ) xFileNumber );
|
||||
|
||||
/* Obtain the current working directory and print out the file name and
|
||||
the directory into which the file is being written. */
|
||||
* the directory into which the file is being written. */
|
||||
f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE );
|
||||
|
||||
/* Open the file, creating the file if it does not already exist. */
|
||||
|
@ -148,12 +148,12 @@ F_FILE *pxFile;
|
|||
configASSERT( pxFile );
|
||||
|
||||
/* Fill the RAM buffer with data that will be written to the file. This
|
||||
is just a repeating ascii character that indicates the file number. */
|
||||
* is just a repeating ascii character that indicates the file number. */
|
||||
memset( cRAMBuffer, ( int ) ( '0' + xFileNumber ), fsRAM_BUFFER_SIZE );
|
||||
|
||||
/* Write the RAM buffer to the opened file a number of times. The
|
||||
number of times the RAM buffer is written to the file depends on the
|
||||
file number, so the length of each created file will be different. */
|
||||
* number of times the RAM buffer is written to the file depends on the
|
||||
* file number, so the length of each created file will be different. */
|
||||
for( xWriteNumber = 0; xWriteNumber < xFileNumber; xWriteNumber++ )
|
||||
{
|
||||
lItemsWritten = f_write( cRAMBuffer, fsRAM_BUFFER_SIZE, 1, pxFile );
|
||||
|
@ -175,14 +175,14 @@ long lItemsRead, lChar;
|
|||
F_FILE * pxFile;
|
||||
|
||||
/* Read back the files that were created by
|
||||
prvCreateDemoFilesUsing_f_write(). */
|
||||
* prvCreateDemoFilesUsing_f_write(). */
|
||||
for( xFileNumber = 1; xFileNumber <= xMaxFiles; xFileNumber++ )
|
||||
{
|
||||
/* Generate the file name. */
|
||||
sprintf( cFileName, "root%03d.txt", ( int ) xFileNumber );
|
||||
|
||||
/* Obtain the current working directory and print out the file name and
|
||||
the directory from which the file is being read. */
|
||||
* the directory from which the file is being read. */
|
||||
f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE );
|
||||
|
||||
/* Open the file for reading. */
|
||||
|
@ -190,7 +190,7 @@ F_FILE *pxFile;
|
|||
configASSERT( pxFile );
|
||||
|
||||
/* Read the file into the RAM buffer, checking the file contents are as
|
||||
expected. The size of the file depends on the file number. */
|
||||
* expected. The size of the file depends on the file number. */
|
||||
for( xReadNumber = 0; xReadNumber < xFileNumber; xReadNumber++ )
|
||||
{
|
||||
/* Start with the RAM buffer clear. */
|
||||
|
@ -200,8 +200,8 @@ F_FILE *pxFile;
|
|||
configASSERT( lItemsRead == 1 );
|
||||
|
||||
/* Check the RAM buffer is filled with the expected data. Each
|
||||
file contains a different repeating ascii character that indicates
|
||||
the number of the file. */
|
||||
* file contains a different repeating ascii character that indicates
|
||||
* the number of the file. */
|
||||
for( lChar = 0; lChar < fsRAM_BUFFER_SIZE; lChar++ )
|
||||
{
|
||||
configASSERT( cRAMBuffer[ lChar ] == ( '0' + ( char ) xFileNumber ) );
|
||||
|
@ -240,7 +240,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ];
|
|||
configASSERT( ucReturn == F_NO_ERROR );
|
||||
|
||||
/* Move into the directory just created - now two directories down from
|
||||
the root. */
|
||||
* the root. */
|
||||
ucReturn = f_chdir( pcDirectory2 );
|
||||
configASSERT( ucReturn == F_NO_ERROR );
|
||||
|
||||
|
@ -252,11 +252,11 @@ char cFileName[ fsMAX_FILE_NAME_LEN ];
|
|||
sprintf( cFileName, "%s.txt", pcDirectory2 );
|
||||
|
||||
/* Print out the file name and the directory into which the file is being
|
||||
written. */
|
||||
* written. */
|
||||
pxFile = f_open( cFileName, "w" );
|
||||
|
||||
/* Create a file 1 byte at a time. The file is filled with incrementing
|
||||
ascii characters starting from '0'. */
|
||||
* ascii characters starting from '0'. */
|
||||
for( iByte = 0; iByte < fsPUTC_FILE_SIZE; iByte++ )
|
||||
{
|
||||
iReturned = f_putc( ( ( int ) '0' + iByte ), pxFile );
|
||||
|
@ -314,7 +314,3 @@ char cFileName[ fsMAX_FILE_NAME_LEN ];
|
|||
/* Obtain and print out the working directory. */
|
||||
f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "FreeRTOS_CLI.h"
|
||||
|
||||
/* FreeRTOS+UDP includes, just to make the stats available to the CLI
|
||||
commands. */
|
||||
* commands. */
|
||||
#include "FreeRTOS_UDP_IP.h"
|
||||
#include "FreeRTOS_Sockets.h"
|
||||
|
||||
|
@ -57,43 +57,59 @@ commands. */
|
|||
/*
|
||||
* Implements the run-time-stats command.
|
||||
*/
|
||||
static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvTaskStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the task-stats command.
|
||||
*/
|
||||
static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvRunTimeStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the echo-three-parameters command.
|
||||
*/
|
||||
static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvThreeParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the echo-parameters command.
|
||||
*/
|
||||
static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that prints out IP address information.
|
||||
*/
|
||||
static BaseType_t prvDisplayIPConfig( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvDisplayIPConfig( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that prints out the gathered demo debug stats.
|
||||
*/
|
||||
static BaseType_t prvDisplayIPDebugStats( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvDisplayIPDebugStats( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that sends an ICMP ping request to an IP address.
|
||||
*/
|
||||
static BaseType_t prvPingCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvPingCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the "trace start" and "trace stop" commands;
|
||||
*/
|
||||
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
|
||||
static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvStartStopTraceCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
#endif
|
||||
|
||||
/* Structure that defines the "ip-config" command line command. */
|
||||
|
@ -117,7 +133,7 @@ static const CLI_Command_Definition_t xIPConfig =
|
|||
#endif /* configINCLUDE_DEMO_DEBUG_STATS */
|
||||
|
||||
/* Structure that defines the "run-time-stats" command line command. This
|
||||
generates a table that shows how much run time each task has */
|
||||
* generates a table that shows how much run time each task has */
|
||||
static const CLI_Command_Definition_t xRunTimeStats =
|
||||
{
|
||||
"run-time-stats", /* The command string to type. */
|
||||
|
@ -127,7 +143,7 @@ static const CLI_Command_Definition_t xRunTimeStats =
|
|||
};
|
||||
|
||||
/* Structure that defines the "task-stats" command line command. This generates
|
||||
a table that gives information on each task in the system. */
|
||||
* a table that gives information on each task in the system. */
|
||||
static const CLI_Command_Definition_t xTaskStats =
|
||||
{
|
||||
"task-stats", /* The command string to type. */
|
||||
|
@ -137,8 +153,8 @@ static const CLI_Command_Definition_t xTaskStats =
|
|||
};
|
||||
|
||||
/* Structure that defines the "echo_3_parameters" command line command. This
|
||||
takes exactly three parameters that the command simply echos back one at a
|
||||
time. */
|
||||
* takes exactly three parameters that the command simply echos back one at a
|
||||
* time. */
|
||||
static const CLI_Command_Definition_t xThreeParameterEcho =
|
||||
{
|
||||
"echo-3-parameters",
|
||||
|
@ -148,8 +164,8 @@ static const CLI_Command_Definition_t xThreeParameterEcho =
|
|||
};
|
||||
|
||||
/* Structure that defines the "echo_parameters" command line command. This
|
||||
takes a variable number of parameters that the command simply echos back one at
|
||||
a time. */
|
||||
* takes a variable number of parameters that the command simply echos back one at
|
||||
* a time. */
|
||||
static const CLI_Command_Definition_t xParameterEcho =
|
||||
{
|
||||
"echo-parameters",
|
||||
|
@ -161,8 +177,8 @@ static const CLI_Command_Definition_t xParameterEcho =
|
|||
#if ipconfigSUPPORT_OUTGOING_PINGS == 1
|
||||
|
||||
/* Structure that defines the "ping" command line command. This takes an IP
|
||||
address or host name and (optionally) the number of bytes to ping as
|
||||
parameters. */
|
||||
* address or host name and (optionally) the number of bytes to ping as
|
||||
* parameters. */
|
||||
static const CLI_Command_Definition_t xPing =
|
||||
{
|
||||
"ping",
|
||||
|
@ -174,8 +190,9 @@ static const CLI_Command_Definition_t xParameterEcho =
|
|||
#endif /* ipconfigSUPPORT_OUTGOING_PINGS */
|
||||
|
||||
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
|
||||
|
||||
/* Structure that defines the "trace" command line command. This takes a single
|
||||
parameter, which can be either "start" or "stop". */
|
||||
* parameter, which can be either "start" or "stop". */
|
||||
static const CLI_Command_Definition_t xStartStopTrace =
|
||||
{
|
||||
"trace",
|
||||
|
@ -209,14 +226,16 @@ void vRegisterCLICommands( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvTaskStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * const pcHeader = " State\tPriority\tStack\t#\r\n************************************************\r\n";
|
||||
BaseType_t xSpacePadding;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -226,9 +245,9 @@ BaseType_t xSpacePadding;
|
|||
pcWriteBuffer += strlen( pcWriteBuffer );
|
||||
|
||||
/* Pad the string "task" with however many bytes necessary to make it the
|
||||
length of a task name. Minus three for the null terminator and half the
|
||||
number of characters in "Task" so the column lines up with the centre of
|
||||
the heading. */
|
||||
* length of a task name. Minus three for the null terminator and half the
|
||||
* number of characters in "Task" so the column lines up with the centre of
|
||||
* the heading. */
|
||||
for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ )
|
||||
{
|
||||
/* Add a space to align columns after the task's name. */
|
||||
|
@ -238,23 +257,26 @@ BaseType_t xSpacePadding;
|
|||
/* Ensure always terminated. */
|
||||
*pcWriteBuffer = 0x00;
|
||||
}
|
||||
|
||||
strcpy( pcWriteBuffer, pcHeader );
|
||||
vTaskList( pcWriteBuffer + strlen( pcHeader ) );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvRunTimeStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * const pcHeader = " Abs Time % Time\r\n****************************************\r\n";
|
||||
BaseType_t xSpacePadding;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -264,9 +286,9 @@ BaseType_t xSpacePadding;
|
|||
pcWriteBuffer += strlen( pcWriteBuffer );
|
||||
|
||||
/* Pad the string "task" with however many bytes necessary to make it the
|
||||
length of a task name. Minus three for the null terminator and half the
|
||||
number of characters in "Task" so the column lines up with the centre of
|
||||
the heading. */
|
||||
* length of a task name. Minus three for the null terminator and half the
|
||||
* number of characters in "Task" so the column lines up with the centre of
|
||||
* the heading. */
|
||||
for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ )
|
||||
{
|
||||
/* Add a space to align columns after the task's name. */
|
||||
|
@ -281,20 +303,22 @@ BaseType_t xSpacePadding;
|
|||
vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvThreeParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength, xReturn;
|
||||
static BaseType_t lParameterNumber = 0;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -302,15 +326,15 @@ static BaseType_t lParameterNumber = 0;
|
|||
if( lParameterNumber == 0 )
|
||||
{
|
||||
/* The first time the function is called after the command has been
|
||||
entered just a header string is returned. */
|
||||
* entered just a header string is returned. */
|
||||
sprintf( pcWriteBuffer, "The three parameters were:\r\n" );
|
||||
|
||||
/* Next time the function is called the first parameter will be echoed
|
||||
back. */
|
||||
* back. */
|
||||
lParameterNumber = 1L;
|
||||
|
||||
/* There is more data to be returned as no parameters have been echoed
|
||||
back yet. */
|
||||
* back yet. */
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
|
@ -333,11 +357,11 @@ static BaseType_t lParameterNumber = 0;
|
|||
strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
|
||||
|
||||
/* If this is the last of the three parameters then there are no more
|
||||
strings to return after this one. */
|
||||
* strings to return after this one. */
|
||||
if( lParameterNumber == 3L )
|
||||
{
|
||||
/* If this is the last of the three parameters then there are no more
|
||||
strings to return after this one. */
|
||||
* strings to return after this one. */
|
||||
xReturn = pdFALSE;
|
||||
lParameterNumber = 0L;
|
||||
}
|
||||
|
@ -353,15 +377,17 @@ static BaseType_t lParameterNumber = 0;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength, xReturn;
|
||||
static BaseType_t lParameterNumber = 0;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -369,15 +395,15 @@ static BaseType_t lParameterNumber = 0;
|
|||
if( lParameterNumber == 0 )
|
||||
{
|
||||
/* The first time the function is called after the command has been
|
||||
entered just a header string is returned. */
|
||||
* entered just a header string is returned. */
|
||||
sprintf( pcWriteBuffer, "The parameters were:\r\n" );
|
||||
|
||||
/* Next time the function is called the first parameter will be echoed
|
||||
back. */
|
||||
* back. */
|
||||
lParameterNumber = 1L;
|
||||
|
||||
/* There is more data to be returned as no parameters have been echoed
|
||||
back yet. */
|
||||
* back yet. */
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
|
@ -405,7 +431,7 @@ static BaseType_t lParameterNumber = 0;
|
|||
else
|
||||
{
|
||||
/* No more parameters were found. Make sure the write buffer does
|
||||
not contain a valid string. */
|
||||
* not contain a valid string. */
|
||||
pcWriteBuffer[ 0 ] = 0x00;
|
||||
|
||||
/* No more data to return. */
|
||||
|
@ -422,7 +448,9 @@ static BaseType_t lParameterNumber = 0;
|
|||
|
||||
#if ipconfigSUPPORT_OUTGOING_PINGS == 1
|
||||
|
||||
static BaseType_t prvPingCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvPingCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
char * pcParameter;
|
||||
BaseType_t lParameterStringLength, xReturn;
|
||||
|
@ -431,8 +459,8 @@ static BaseType_t lParameterNumber = 0;
|
|||
char cBuffer[ 16 ];
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -470,7 +498,7 @@ static BaseType_t lParameterNumber = 0;
|
|||
configASSERT( pcParameter );
|
||||
|
||||
/* Attempt to obtain the IP address. If the first character is not a
|
||||
digit, assume the host name has been passed in. */
|
||||
* digit, assume the host name has been passed in. */
|
||||
if( ( *pcParameter >= '0' ) && ( *pcParameter <= '9' ) )
|
||||
{
|
||||
ulIPAddress = FreeRTOS_inet_addr( pcParameter );
|
||||
|
@ -513,15 +541,17 @@ static BaseType_t lParameterNumber = 0;
|
|||
|
||||
#if configINCLUDE_DEMO_DEBUG_STATS != 0
|
||||
|
||||
static BaseType_t prvDisplayIPDebugStats( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvDisplayIPDebugStats( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
static BaseType_t xIndex = -1;
|
||||
extern xExampleDebugStatEntry_t xIPTraceValues[];
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -549,15 +579,17 @@ static BaseType_t lParameterNumber = 0;
|
|||
|
||||
#endif /* configINCLUDE_DEMO_DEBUG_STATS */
|
||||
|
||||
static BaseType_t prvDisplayIPConfig( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvDisplayIPConfig( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
static BaseType_t xIndex = 0;
|
||||
BaseType_t xReturn;
|
||||
uint32_t ulAddress;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -627,14 +659,16 @@ uint32_t ulAddress;
|
|||
|
||||
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
|
||||
|
||||
static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvStartStopTraceCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t lParameterStringLength;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -672,7 +706,7 @@ uint32_t ulAddress;
|
|||
}
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,13 +20,15 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UDP_COMMAND_INTERPRETER_H
|
||||
#define UDP_COMMAND_INTERPRETER_H
|
||||
|
||||
void vStartUDPCommandInterpreterTask( uint16_t usStackSize, uint32_t ulPort, UBaseType_t uxPriority );
|
||||
void vStartUDPCommandInterpreterTask( uint16_t usStackSize,
|
||||
uint32_t ulPort,
|
||||
UBaseType_t uxPriority );
|
||||
|
||||
#endif /* UDP_COMMAND_INTERPRETER_H */
|
||||
|
|
|
@ -63,7 +63,9 @@ static xSocket_t prvOpenUDPServerSocket( uint16_t usPort );
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartUDPCommandInterpreterTask( uint16_t usStackSize, uint32_t ulPort, UBaseType_t uxPriority )
|
||||
void vStartUDPCommandInterpreterTask( uint16_t usStackSize,
|
||||
uint32_t ulPort,
|
||||
UBaseType_t uxPriority )
|
||||
{
|
||||
xTaskCreate( vUDPCommandInterpreterTask, "CLI", usStackSize, ( void * ) ulPort, uxPriority, NULL );
|
||||
}
|
||||
|
@ -88,8 +90,8 @@ xSocket_t xSocket;
|
|||
( void ) pvParameters;
|
||||
|
||||
/* Attempt to open the socket. The port number is passed in the task
|
||||
parameter. The strange casting is to remove compiler warnings on 32-bit
|
||||
machines. */
|
||||
* parameter. The strange casting is to remove compiler warnings on 32-bit
|
||||
* machines. */
|
||||
xSocket = prvOpenUDPServerSocket( ( uint16_t ) ( ( uint32_t ) pvParameters ) & 0xffffUL );
|
||||
|
||||
if( xSocket != FREERTOS_INVALID_SOCKET )
|
||||
|
@ -103,6 +105,7 @@ xSocket_t xSocket;
|
|||
{
|
||||
/* Process each received byte in turn. */
|
||||
lByte = 0;
|
||||
|
||||
while( lByte < lBytes )
|
||||
{
|
||||
/* The next character in the input buffer. */
|
||||
|
@ -110,30 +113,29 @@ xSocket_t xSocket;
|
|||
lByte++;
|
||||
|
||||
/* Newline characters are taken as the end of the command
|
||||
string. */
|
||||
* string. */
|
||||
if( cInChar == '\n' )
|
||||
{
|
||||
/* Process the input string received prior to the
|
||||
newline. */
|
||||
* newline. */
|
||||
do
|
||||
{
|
||||
/* Pass the string to FreeRTOS+CLI. */
|
||||
xMoreDataToFollow = FreeRTOS_CLIProcessCommand( cInputString, cOutputString, cmdMAX_OUTPUT_SIZE );
|
||||
|
||||
/* Send the output generated by the command's
|
||||
implementation. */
|
||||
* implementation. */
|
||||
FreeRTOS_sendto( xSocket, cOutputString, strlen( cOutputString ), 0, &xClient, xClientAddressLength );
|
||||
|
||||
} while( xMoreDataToFollow != pdFALSE ); /* Until the command does not generate any more output. */
|
||||
|
||||
/* All the strings generated by the command processing
|
||||
have been sent. Clear the input string ready to receive
|
||||
the next command. */
|
||||
* have been sent. Clear the input string ready to receive
|
||||
* the next command. */
|
||||
cInputIndex = 0;
|
||||
memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );
|
||||
|
||||
/* Transmit a spacer, just to make the command console
|
||||
easier to read. */
|
||||
* easier to read. */
|
||||
FreeRTOS_sendto( xSocket, "\r\n", strlen( "\r\n" ), 0, &xClient, xClientAddressLength );
|
||||
}
|
||||
else
|
||||
|
@ -141,12 +143,12 @@ xSocket_t xSocket;
|
|||
if( cInChar == '\r' )
|
||||
{
|
||||
/* Ignore the character. Newlines are used to
|
||||
detect the end of the input string. */
|
||||
* detect the end of the input string. */
|
||||
}
|
||||
else if( cInChar == '\b' )
|
||||
{
|
||||
/* Backspace was pressed. Erase the last character
|
||||
in the string - if any. */
|
||||
* in the string - if any. */
|
||||
if( cInputIndex > 0 )
|
||||
{
|
||||
cInputIndex--;
|
||||
|
@ -156,8 +158,8 @@ xSocket_t xSocket;
|
|||
else
|
||||
{
|
||||
/* A character was entered. Add it to the string
|
||||
entered so far. When a \n is entered the complete
|
||||
string will be passed to the command interpreter. */
|
||||
* entered so far. When a \n is entered the complete
|
||||
* string will be passed to the command interpreter. */
|
||||
if( cInputIndex < cmdMAX_INPUT_SIZE )
|
||||
{
|
||||
cInputString[ cInputIndex ] = cInChar;
|
||||
|
@ -183,6 +185,7 @@ struct freertos_sockaddr xServer;
|
|||
xSocket_t xSocket = FREERTOS_INVALID_SOCKET;
|
||||
|
||||
xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_DGRAM, FREERTOS_IPPROTO_UDP );
|
||||
|
||||
if( xSocket != FREERTOS_INVALID_SOCKET )
|
||||
{
|
||||
/* Zero out the server structure. */
|
||||
|
@ -202,5 +205,3 @@ xSocket_t xSocket = FREERTOS_INVALID_SOCKET;
|
|||
|
||||
return xSocket;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -51,28 +51,30 @@
|
|||
#define echoTINY_DELAY ( ( TickType_t ) 2 )
|
||||
|
||||
/* The echo tasks create a socket, send out a number of echo requests
|
||||
(listening for each echo reply), then close the socket again before
|
||||
starting over. This delay is used between each iteration to ensure the
|
||||
network does not get too congested. */
|
||||
* (listening for each echo reply), then close the socket again before
|
||||
* starting over. This delay is used between each iteration to ensure the
|
||||
* network does not get too congested. */
|
||||
#define echoLOOP_DELAY ( ( TickType_t ) 250 / portTICK_RATE_MS )
|
||||
|
||||
#if ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS == 1
|
||||
|
||||
/* When the trace recorder code is included user events are generated to
|
||||
mark the sending and receiving of the echoed data (only in the zero copy
|
||||
task. */
|
||||
* mark the sending and receiving of the echoed data (only in the zero copy
|
||||
* task. */
|
||||
#define echoMARK_SEND_IN_TRACE_BUFFER( x ) vTraceUserEvent( x )
|
||||
traceLabel xZeroCopySendEvent, xZeroCopyReceiveEvent;
|
||||
|
||||
#else
|
||||
|
||||
/* When the trace recorder code is not included just #define away the call
|
||||
to post the user event. */
|
||||
* to post the user event. */
|
||||
#define echoMARK_SEND_IN_TRACE_BUFFER( x )
|
||||
#define xZeroCopySendEvent 0
|
||||
#define xZeroCopyReceiveEvent 0
|
||||
#endif
|
||||
|
||||
/* The echo server is assumed to be on port 7, which is the standard echo
|
||||
protocol port. */
|
||||
* protocol port. */
|
||||
#define echoECHO_PORT ( 7 )
|
||||
|
||||
/*
|
||||
|
@ -84,7 +86,7 @@ static void prvEchoClientTask( void *pvParameters );
|
|||
static void prvZeroCopyEchoClientTask( void * pvParameters );
|
||||
|
||||
/* The receive timeout is set shorter when the windows simulator is used
|
||||
because simulated time is slower than real time. */
|
||||
* because simulated time is slower than real time. */
|
||||
#ifdef _WINDOWS_
|
||||
const TickType_t xReceiveTimeOut = 50 / portTICK_RATE_MS;
|
||||
#else
|
||||
|
@ -93,7 +95,8 @@ because simulated time is slower than real time. */
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartEchoClientTasks( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority )
|
||||
void vStartEchoClientTasks( uint16_t usTaskStackSize,
|
||||
UBaseType_t uxTaskPriority )
|
||||
{
|
||||
/* Create the echo client task that does not use the zero copy interface. */
|
||||
xTaskCreate( prvEchoClientTask, /* The function that implements the task. */
|
||||
|
@ -127,8 +130,8 @@ uint32_t xAddressLength = sizeof( xEchoServerAddress );
|
|||
( void ) pvParameters;
|
||||
|
||||
/* Echo requests are sent to the echo server. The address of the echo
|
||||
server is configured by the constants configECHO_SERVER_ADDR0 to
|
||||
configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
|
||||
* server is configured by the constants configECHO_SERVER_ADDR0 to
|
||||
* configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
|
||||
xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT );
|
||||
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
|
@ -156,7 +159,7 @@ uint32_t xAddressLength = sizeof( xEchoServerAddress );
|
|||
configASSERT( xSocket != FREERTOS_INVALID_SOCKET );
|
||||
|
||||
/* Set a time out so a missing reply does not cause the task to block
|
||||
indefinitely. */
|
||||
* indefinitely. */
|
||||
FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
|
||||
|
||||
/* Send a number of echo requests. */
|
||||
|
@ -166,10 +169,10 @@ uint32_t xAddressLength = sizeof( xEchoServerAddress );
|
|||
sprintf( cTxString, "Message number %u\r\n", ( unsigned int ) ulTxCount );
|
||||
|
||||
/* Send the string to the socket. ulFlags is set to 0, so the zero
|
||||
copy interface is not used. That means the data from cTxString is
|
||||
copied into a network buffer inside FreeRTOS_sendto(), and cTxString
|
||||
can be reused as soon as FreeRTOS_sendto() has returned. 1 is added
|
||||
to ensure the NULL string terminator is sent as part of the message. */
|
||||
* copy interface is not used. That means the data from cTxString is
|
||||
* copied into a network buffer inside FreeRTOS_sendto(), and cTxString
|
||||
* can be reused as soon as FreeRTOS_sendto() has returned. 1 is added
|
||||
* to ensure the NULL string terminator is sent as part of the message. */
|
||||
FreeRTOS_sendto( xSocket, /* The socket being sent to. */
|
||||
( void * ) cTxString, /* The data being sent. */
|
||||
strlen( cTxString ) + 1, /* The length of the data being sent. */
|
||||
|
@ -178,17 +181,17 @@ uint32_t xAddressLength = sizeof( xEchoServerAddress );
|
|||
sizeof( xEchoServerAddress ) );
|
||||
|
||||
/* Keep a count of how many echo requests have been transmitted so
|
||||
it can be compared to the number of echo replies received. It would
|
||||
be expected to loose at least one to an ARP message the first time
|
||||
the connection is created. */
|
||||
* it can be compared to the number of echo replies received. It would
|
||||
* be expected to loose at least one to an ARP message the first time
|
||||
* the connection is created. */
|
||||
ulTxCount++;
|
||||
|
||||
/* Receive data echoed back to the socket. ulFlags is zero, so the
|
||||
zero copy option is not being used and the received data will be
|
||||
copied into the buffer pointed to by cRxString. xAddressLength is
|
||||
not actually used (at the time of writing this comment, anyway) by
|
||||
FreeRTOS_recvfrom(), but is set appropriately in case future
|
||||
versions do use it. */
|
||||
* zero copy option is not being used and the received data will be
|
||||
* copied into the buffer pointed to by cRxString. xAddressLength is
|
||||
* not actually used (at the time of writing this comment, anyway) by
|
||||
* FreeRTOS_recvfrom(), but is set appropriately in case future
|
||||
* versions do use it. */
|
||||
memset( ( void * ) cRxString, 0x00, sizeof( cRxString ) );
|
||||
FreeRTOS_recvfrom( xSocket, /* The socket being received from. */
|
||||
cRxString, /* The buffer into which the received data will be written. */
|
||||
|
@ -203,10 +206,10 @@ uint32_t xAddressLength = sizeof( xEchoServerAddress );
|
|||
/* The echo reply was received without error. */
|
||||
ulRxCount++;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* Pause for a short while to ensure the network is not too
|
||||
congested. */
|
||||
* congested. */
|
||||
vTaskDelay( echoLOOP_DELAY );
|
||||
|
||||
/* Close this socket before looping back to create another. */
|
||||
|
@ -234,8 +237,8 @@ const size_t xBufferLength = strlen( pcStringToSend ) + 15;
|
|||
#if ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS == 1
|
||||
{
|
||||
/* When the trace recorder code is included user events are generated to
|
||||
mark the sending and receiving of the echoed data (only in the zero copy
|
||||
task). */
|
||||
* mark the sending and receiving of the echoed data (only in the zero copy
|
||||
* task). */
|
||||
xZeroCopySendEvent = xTraceOpenLabel( "ZeroCopyTx" );
|
||||
xZeroCopyReceiveEvent = xTraceOpenLabel( "ZeroCopyRx" );
|
||||
}
|
||||
|
@ -245,12 +248,12 @@ const size_t xBufferLength = strlen( pcStringToSend ) + 15;
|
|||
( void ) pvParameters;
|
||||
|
||||
/* Delay for a little while to ensure the task is out of synch with the
|
||||
other echo task implemented above. */
|
||||
* other echo task implemented above. */
|
||||
vTaskDelay( echoLOOP_DELAY >> 1 );
|
||||
|
||||
/* Echo requests are sent to the echo server. The address of the echo
|
||||
server is configured by the constants configECHO_SERVER_ADDR0 to
|
||||
configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
|
||||
* server is configured by the constants configECHO_SERVER_ADDR0 to
|
||||
* configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
|
||||
xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT );
|
||||
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
|
@ -278,35 +281,35 @@ const size_t xBufferLength = strlen( pcStringToSend ) + 15;
|
|||
configASSERT( xSocket != FREERTOS_INVALID_SOCKET );
|
||||
|
||||
/* Set a time out so a missing reply does not cause the task to block
|
||||
indefinitely. */
|
||||
* indefinitely. */
|
||||
FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
|
||||
|
||||
/* Send a number of echo requests. */
|
||||
for( lLoopCount = 0; lLoopCount < lMaxLoopCount; lLoopCount++ )
|
||||
{
|
||||
/* This task is going to send using the zero copy interface. The
|
||||
data being sent is therefore written directly into a buffer that is
|
||||
passed by reference into the FreeRTOS_sendto() function. First
|
||||
obtain a buffer of adequate size from the IP stack. Although a max
|
||||
delay is used, the actual delay will be capped to
|
||||
ipconfigMAX_SEND_BLOCK_TIME_TICKS, hence the test to ensure a buffer
|
||||
was actually obtained. */
|
||||
* data being sent is therefore written directly into a buffer that is
|
||||
* passed by reference into the FreeRTOS_sendto() function. First
|
||||
* obtain a buffer of adequate size from the IP stack. Although a max
|
||||
* delay is used, the actual delay will be capped to
|
||||
* ipconfigMAX_SEND_BLOCK_TIME_TICKS, hence the test to ensure a buffer
|
||||
* was actually obtained. */
|
||||
pucUDPPayloadBuffer = ( uint8_t * ) FreeRTOS_GetUDPPayloadBuffer( xBufferLength, portMAX_DELAY );
|
||||
|
||||
if( pucUDPPayloadBuffer != NULL )
|
||||
{
|
||||
/* A buffer was successfully obtained. Create the string that is
|
||||
sent to the echo server. Note the string is written directly
|
||||
into the buffer obtained from the IP stack. */
|
||||
* sent to the echo server. Note the string is written directly
|
||||
* into the buffer obtained from the IP stack. */
|
||||
sprintf( ( char * ) pucUDPPayloadBuffer, "%s %u\r\n", "Zero copy message number", ( unsigned int ) ulTxCount );
|
||||
|
||||
/* Also copy the string into a local buffer so it can be compared
|
||||
with the string that is later received back from the echo server. */
|
||||
* with the string that is later received back from the echo server. */
|
||||
strcpy( cTxString, ( char * ) pucUDPPayloadBuffer );
|
||||
|
||||
/* Pass the buffer into the send function. ulFlags has the
|
||||
FREERTOS_ZERO_COPY bit set so the IP stack will take control of
|
||||
the buffer, rather than copy data out of the buffer. */
|
||||
* FREERTOS_ZERO_COPY bit set so the IP stack will take control of
|
||||
* the buffer, rather than copy data out of the buffer. */
|
||||
echoMARK_SEND_IN_TRACE_BUFFER( xZeroCopySendEvent );
|
||||
lReturned = FreeRTOS_sendto( xSocket, /* The socket being sent to. */
|
||||
( void * ) pucUDPPayloadBuffer, /* The buffer being passed into the IP stack. */
|
||||
|
@ -318,37 +321,37 @@ const size_t xBufferLength = strlen( pcStringToSend ) + 15;
|
|||
if( lReturned == 0 )
|
||||
{
|
||||
/* The send operation failed, so this task is still
|
||||
responsible for the buffer obtained from the IP stack. To
|
||||
ensure the buffer is not lost it must either be used again,
|
||||
or, as in this case, returned to the IP stack using
|
||||
FreeRTOS_ReleaseUDPPayloadBuffer(). pucUDPPayloadBuffer can
|
||||
be safely re-used to receive from the socket below once the
|
||||
buffer has been returned to the stack. */
|
||||
* responsible for the buffer obtained from the IP stack. To
|
||||
* ensure the buffer is not lost it must either be used again,
|
||||
* or, as in this case, returned to the IP stack using
|
||||
* FreeRTOS_ReleaseUDPPayloadBuffer(). pucUDPPayloadBuffer can
|
||||
* be safely re-used to receive from the socket below once the
|
||||
* buffer has been returned to the stack. */
|
||||
FreeRTOS_ReleaseUDPPayloadBuffer( ( void * ) pucUDPPayloadBuffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The send was successful so the IP stack is now managing
|
||||
the buffer pointed to by pucUDPPayloadBuffer, and the IP
|
||||
stack will return the buffer once it has been sent.
|
||||
pucUDPPayloadBuffer can be safely re-used to receive from
|
||||
the socket below. */
|
||||
* the buffer pointed to by pucUDPPayloadBuffer, and the IP
|
||||
* stack will return the buffer once it has been sent.
|
||||
* pucUDPPayloadBuffer can be safely re-used to receive from
|
||||
* the socket below. */
|
||||
}
|
||||
|
||||
/* Keep a count of how many echo requests have been transmitted
|
||||
so it can be compared to the number of echo replies received.
|
||||
It would be expected to loose at least one to an ARP message the
|
||||
first time the connection is created. */
|
||||
* so it can be compared to the number of echo replies received.
|
||||
* It would be expected to loose at least one to an ARP message the
|
||||
* first time the connection is created. */
|
||||
ulTxCount++;
|
||||
|
||||
/* Receive data on the socket. ulFlags has the zero copy bit set
|
||||
(FREERTOS_ZERO_COPY) indicating to the stack that a reference to
|
||||
the received data should be passed out to this task using the
|
||||
second parameter to the FreeRTOS_recvfrom() call. When this is
|
||||
done the IP stack is no longer responsible for releasing the
|
||||
buffer, and the task *must* return the buffer to the stack when
|
||||
it is no longer needed. By default the receive block time is
|
||||
portMAX_DELAY. */
|
||||
* (FREERTOS_ZERO_COPY) indicating to the stack that a reference to
|
||||
* the received data should be passed out to this task using the
|
||||
* second parameter to the FreeRTOS_recvfrom() call. When this is
|
||||
* done the IP stack is no longer responsible for releasing the
|
||||
* buffer, and the task *must* return the buffer to the stack when
|
||||
* it is no longer needed. By default the receive block time is
|
||||
* portMAX_DELAY. */
|
||||
echoMARK_SEND_IN_TRACE_BUFFER( xZeroCopyReceiveEvent );
|
||||
lReturned = FreeRTOS_recvfrom( xSocket, /* The socket to receive from. */
|
||||
( void * ) &pucUDPPayloadBuffer, /* pucUDPPayloadBuffer will be set to point to the buffer that already contains the received data. */
|
||||
|
@ -360,7 +363,7 @@ const size_t xBufferLength = strlen( pcStringToSend ) + 15;
|
|||
if( lReturned > 0 )
|
||||
{
|
||||
/* Compare the string sent to the echo server with the string
|
||||
received back from the echo server. */
|
||||
* received back from the echo server. */
|
||||
if( strcmp( ( char * ) pucUDPPayloadBuffer, cTxString ) == 0 )
|
||||
{
|
||||
/* The strings matched. */
|
||||
|
@ -375,7 +378,7 @@ const size_t xBufferLength = strlen( pcStringToSend ) + 15;
|
|||
}
|
||||
|
||||
/* Pause for a short while to ensure the network is not too
|
||||
congested. */
|
||||
* congested. */
|
||||
vTaskDelay( echoLOOP_DELAY );
|
||||
|
||||
/* Close this socket before looping back to create another. */
|
||||
|
@ -383,4 +386,3 @@ const size_t xBufferLength = strlen( pcStringToSend ) + 15;
|
|||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
|||
* to send to and receive from an echo server. The other task uses the zero
|
||||
* copy interface to send to and receive from an echo server.
|
||||
*/
|
||||
void vStartEchoClientTasks( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority );
|
||||
void vStartEchoClientTasks( uint16_t usTaskStackSize,
|
||||
UBaseType_t uxTaskPriority );
|
||||
|
||||
#endif /* TWO_ECHO_CLIENTS_H */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
|||
#include "DemoIPTrace.h"
|
||||
|
||||
/* It is possible to remove the trace macros using the
|
||||
configINCLUDE_DEMO_DEBUG_STATS setting in FreeRTOSIPConfig.h. */
|
||||
* configINCLUDE_DEMO_DEBUG_STATS setting in FreeRTOSIPConfig.h. */
|
||||
#if configINCLUDE_DEMO_DEBUG_STATS == 1
|
||||
|
||||
/*
|
||||
|
@ -53,14 +53,16 @@ configINCLUDE_DEMO_DEBUG_STATS setting in FreeRTOSIPConfig.h. */
|
|||
* number of network buffers that were available during the execution of the
|
||||
* stack).
|
||||
*/
|
||||
static void prvStoreLowest( uint32_t *pulCurrentValue, uint32_t ulCount );
|
||||
static void prvStoreLowest( uint32_t * pulCurrentValue,
|
||||
uint32_t ulCount );
|
||||
|
||||
/*
|
||||
* Each row in the xIPTraceValues[] table contains a pointer to a function that
|
||||
* updates the value for that row. Rows that simply increment an event count
|
||||
* point to this function.
|
||||
*/
|
||||
static void prvIncrementEventCount( uint32_t *pulCurrentValue, uint32_t ulCount );
|
||||
static void prvIncrementEventCount( uint32_t * pulCurrentValue,
|
||||
uint32_t ulCount );
|
||||
|
||||
|
||||
xExampleDebugStatEntry_t xIPTraceValues[] =
|
||||
|
@ -76,7 +78,7 @@ xExampleDebugStatEntry_t xIPTraceValues[] =
|
|||
{ iptraceID_ARP_TABLE_ENTRY_EXPIRED, ( const uint8_t * const ) "Count of expired ARP entries", prvIncrementEventCount, 0 },
|
||||
{ iptraceID_FAILED_TO_CREATE_SOCKET, ( const uint8_t * const ) "Count of failures to create a socket", prvIncrementEventCount, 0 },
|
||||
{ iptraceID_RECVFROM_DISCARDING_BYTES, ( const uint8_t * const ) "Count of times recvfrom() has discarding bytes", prvIncrementEventCount, 0 },
|
||||
{ iptraceID_ETHERNET_RX_EVENT_LOST, ( const uint8_t * const ) "Count of lost Ethenret Rx events (event queue full?)",prvIncrementEventCount, 0 },
|
||||
{ iptraceID_ETHERNET_RX_EVENT_LOST, ( const uint8_t * const ) "Count of lost Ethernet Rx events (event queue full?)", prvIncrementEventCount, 0 },
|
||||
{ iptraceID_STACK_TX_EVENT_LOST, ( const uint8_t * const ) "Count of lost IP stack events (event queue full?)", prvIncrementEventCount, 0 },
|
||||
{ ipconfigID_BIND_FAILED, ( const uint8_t * const ) "Count of failed calls to bind()", prvIncrementEventCount, 0 },
|
||||
{ iptraceID_RECVFROM_TIMEOUT, ( const uint8_t * const ) "Count of receive timeouts", prvIncrementEventCount, 0 },
|
||||
|
@ -96,14 +98,15 @@ BaseType_t xExampleDebugStatEntries( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vExampleDebugStatUpdate( uint8_t ucIdentifier, uint32_t ulValue )
|
||||
void vExampleDebugStatUpdate( uint8_t ucIdentifier,
|
||||
uint32_t ulValue )
|
||||
{
|
||||
BaseType_t xIndex;
|
||||
const BaseType_t xEntries = sizeof( xIPTraceValues ) / sizeof( xExampleDebugStatEntry_t );
|
||||
|
||||
/* Update an entry in the xIPTraceValues[] table. Each row in the table
|
||||
includes a pointer to a function that performs the actual update. This
|
||||
function just executes the update function from that table row. */
|
||||
* includes a pointer to a function that performs the actual update. This
|
||||
* function just executes the update function from that table row. */
|
||||
for( xIndex = 0; xIndex < xEntries; xIndex++ )
|
||||
{
|
||||
if( xIPTraceValues[ xIndex ].ucIdentifier == ucIdentifier )
|
||||
|
@ -117,23 +120,25 @@ const BaseType_t xEntries = sizeof( xIPTraceValues ) / sizeof( xExampleDebugStat
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvIncrementEventCount( uint32_t *pulCurrentValue, uint32_t ulCount )
|
||||
static void prvIncrementEventCount( uint32_t * pulCurrentValue,
|
||||
uint32_t ulCount )
|
||||
{
|
||||
/* Each row in the xIPTraceValues[] table contains a pointer to a function
|
||||
that updates the value for that row. Rows that simply increment an event
|
||||
count point to this function. */
|
||||
* that updates the value for that row. Rows that simply increment an event
|
||||
* count point to this function. */
|
||||
( void ) ulCount;
|
||||
( *pulCurrentValue )++;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvStoreLowest( uint32_t *pulCurrentValue, uint32_t ulCount )
|
||||
static void prvStoreLowest( uint32_t * pulCurrentValue,
|
||||
uint32_t ulCount )
|
||||
{
|
||||
/* Each row in the xIPTraceValues[] table contains a pointer to a function
|
||||
that updates the value for that row. Rows that latch the lowest value
|
||||
point to this function (for example, this function can be used to latch
|
||||
the lowest number of network buffers that were available during the
|
||||
execution of the stack). */
|
||||
* that updates the value for that row. Rows that latch the lowest value
|
||||
* point to this function (for example, this function can be used to latch
|
||||
* the lowest number of network buffers that were available during the
|
||||
* execution of the stack). */
|
||||
if( ulCount < *pulCurrentValue )
|
||||
{
|
||||
*pulCurrentValue = ulCount;
|
||||
|
@ -143,7 +148,3 @@ static void prvStoreLowest( uint32_t *pulCurrentValue, uint32_t ulCount )
|
|||
|
||||
|
||||
#endif /* configINCLUDE_DEMO_DEBUG_STATS == 1 */
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -34,7 +34,8 @@
|
|||
#ifndef DEMO_IP_TRACE_MACROS_H
|
||||
#define DEMO_IP_TRACE_MACROS_H
|
||||
|
||||
typedef void ( *vTraceAction_t )( uint32_t *, uint32_t );
|
||||
typedef void ( * vTraceAction_t )( uint32_t *,
|
||||
uint32_t );
|
||||
|
||||
/* Type that defines each statistic being gathered. */
|
||||
typedef struct ExampleDebugStatEntry
|
||||
|
@ -46,12 +47,13 @@ typedef struct ExampleDebugStatEntry
|
|||
} xExampleDebugStatEntry_t;
|
||||
|
||||
/* Unique identifiers used to locate the entry for each trace macro in the
|
||||
xIPTraceValues[] table defined in DemoIPTrace.c. */
|
||||
* xIPTraceValues[] table defined in DemoIPTrace.c. */
|
||||
#define iptraceID_NETWORK_INTERFACE_RECEIVE 0
|
||||
#define iptraceID_NETWORK_INTERFACE_TRANSMIT 1
|
||||
#define iptraceID_PACKET_DROPPED_TO_GENERATE_ARP 2
|
||||
|
||||
/* Do not change IDs above this line as the ID is shared with a FreeRTOS+Nabto
|
||||
demo. */
|
||||
* demo. */
|
||||
#define iptraceID_NETWORK_BUFFER_OBTAINED 3
|
||||
#define iptraceID_NETWORK_BUFFER_OBTAINED_FROM_ISR 4
|
||||
#define iptraceID_NETWORK_EVENT_RECEIVED 5
|
||||
|
@ -70,15 +72,16 @@ demo. */
|
|||
#define iptraceID_FAILED_TO_NOTIFY_SELECT_GROUP 18
|
||||
|
||||
/* It is possible to remove the trace macros using the
|
||||
configINCLUDE_DEMO_DEBUG_STATS setting in FreeRTOSIPConfig.h. */
|
||||
* configINCLUDE_DEMO_DEBUG_STATS setting in FreeRTOSIPConfig.h. */
|
||||
#if configINCLUDE_DEMO_DEBUG_STATS == 1
|
||||
|
||||
/* The trace macro definitions themselves. Any trace macros left undefined
|
||||
will default to be empty macros. */
|
||||
* will default to be empty macros. */
|
||||
#define iptraceNETWORK_BUFFER_OBTAINED( pxBufferAddress ) vExampleDebugStatUpdate( iptraceID_NETWORK_BUFFER_OBTAINED, uxQueueMessagesWaiting( ( xQueueHandle ) xNetworkBufferSemaphore ) )
|
||||
#define iptraceNETWORK_BUFFER_OBTAINED_FROM_ISR( pxBufferAddress ) vExampleDebugStatUpdate( iptraceID_NETWORK_BUFFER_OBTAINED, uxQueueMessagesWaiting( ( xQueueHandle ) xNetworkBufferSemaphore ) )
|
||||
|
||||
#define iptraceNETWORK_EVENT_RECEIVED( eEvent ) { \
|
||||
#define iptraceNETWORK_EVENT_RECEIVED( eEvent ) \
|
||||
{ \
|
||||
uint16_t usSpace; \
|
||||
usSpace = ( uint16_t ) uxQueueMessagesWaiting( xNetworkEventQueue ); \
|
||||
/* Minus one as an event was removed before the space was queried. */ \
|
||||
|
@ -106,7 +109,8 @@ configINCLUDE_DEMO_DEBUG_STATS setting in FreeRTOSIPConfig.h. */
|
|||
/*
|
||||
* The function that updates a line in the xIPTraceValues table.
|
||||
*/
|
||||
void vExampleDebugStatUpdate( uint8_t ucIdentifier, uint32_t ulValue );
|
||||
void vExampleDebugStatUpdate( uint8_t ucIdentifier,
|
||||
uint32_t ulValue );
|
||||
|
||||
/*
|
||||
* Returns the number of entries in the xIPTraceValues table.
|
||||
|
@ -117,4 +121,3 @@ configINCLUDE_DEMO_DEBUG_STATS setting in FreeRTOSIPConfig.h. */
|
|||
|
||||
|
||||
#endif /* DEMO_IP_TRACE_MACROS_H */
|
||||
|
||||
|
|
|
@ -193,7 +193,6 @@ void vLoggingInit( BaseType_t xLogToStdout,
|
|||
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
|
||||
xPrintUDPAddress.sin_family = FREERTOS_AF_INET;
|
||||
|
||||
}
|
||||
|
||||
/* If a disk file or stdout are to be used then Win32 system calls will
|
||||
|
|
|
@ -636,6 +636,7 @@ static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkCredent
|
|||
|
||||
#ifdef democonfigUSE_AWS_IOT_CORE_BROKER
|
||||
#if defined( democonfigCLIENT_USERNAME )
|
||||
|
||||
/*
|
||||
* When democonfigCLIENT_USERNAME is defined, use the "mqtt" alpn to connect
|
||||
* to AWS IoT Core with Custom Authentication on port 443.
|
||||
|
@ -651,6 +652,7 @@ static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkCredent
|
|||
#error "Connections to AWS IoT Core with custom authentication must connect to TCP port 443 with the \"mqtt\" alpn."
|
||||
#endif /* democonfigMQTT_BROKER_PORT != 443U */
|
||||
#else /* if !defined( democonfigCLIENT_USERNAME ) */
|
||||
|
||||
/*
|
||||
* Otherwise, use the "x-amzn-mqtt-ca" alpn to connect to AWS IoT Core using
|
||||
* x509 Certificate Authentication.
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
* @brief Cellular library log configuration.
|
||||
*
|
||||
* Cellular library use CellularLogLevel macro for logging.
|
||||
* The prototye of these logging function is similar with printf with return type ignored.
|
||||
* The prototype of these logging function is similar with printf with return type ignored.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32929.386
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32929.386
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32929.386
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
|
|
@ -48,31 +48,41 @@ static void prvSaveTraceFile( void );
|
|||
* Defines a command that returns a table showing the state of each task at the
|
||||
* time the command is called.
|
||||
*/
|
||||
static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvTaskStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that returns a table showing how much time each task has
|
||||
* spent in the Running state.
|
||||
*/
|
||||
static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvRunTimeStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that expects exactly three parameters. Each of the three
|
||||
* parameter are echoed back one at a time.
|
||||
*/
|
||||
static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvThreeParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that can take a variable number of parameters. Each
|
||||
* parameter is echoes back one at a time.
|
||||
*/
|
||||
static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Defines a command that starts/stops events being recorded for offline viewing
|
||||
* in FreeRTOS+Trace.
|
||||
*/
|
||||
static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvStartStopTraceCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/* Structure that defines the "run-time-stats" command line command. */
|
||||
static const CLI_Command_Definition_t xRunTimeStats =
|
||||
|
@ -93,8 +103,8 @@ static const CLI_Command_Definition_t xTaskStats =
|
|||
};
|
||||
|
||||
/* Structure that defines the "echo_3_parameters" command line command. This
|
||||
takes exactly three parameters that the command simply echos back one at a
|
||||
time. */
|
||||
* takes exactly three parameters that the command simply echos back one at a
|
||||
* time. */
|
||||
static const CLI_Command_Definition_t xThreeParameterEcho =
|
||||
{
|
||||
"echo_3_parameters",
|
||||
|
@ -104,8 +114,8 @@ static const CLI_Command_Definition_t xThreeParameterEcho =
|
|||
};
|
||||
|
||||
/* Structure that defines the "echo_parameters" command line command. This
|
||||
takes a variable number of parameters that the command simply echos back one at
|
||||
a time. */
|
||||
* takes a variable number of parameters that the command simply echos back one at
|
||||
* a time. */
|
||||
static const CLI_Command_Definition_t xParameterEcho =
|
||||
{
|
||||
"echo_parameters",
|
||||
|
@ -115,7 +125,7 @@ static const CLI_Command_Definition_t xParameterEcho =
|
|||
};
|
||||
|
||||
/* Structure that defines the "trace" command line command. This takes a single
|
||||
parameter, which can be either "start" or "stop". */
|
||||
* parameter, which can be either "start" or "stop". */
|
||||
static const CLI_Command_Definition_t xStartTrace =
|
||||
{
|
||||
"trace",
|
||||
|
@ -137,13 +147,15 @@ void vRegisterCLICommands( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvTaskStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * const pcHeader = "Task State Priority Stack #\r\n************************************************\r\n";
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -153,18 +165,20 @@ const char *const pcHeader = "Task State Priority Stack #\r\n********
|
|||
vTaskList( pcWriteBuffer + strlen( pcHeader ) );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvRunTimeStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * const pcHeader = "Task Abs Time % Time\r\n****************************************\r\n";
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -174,20 +188,22 @@ const char * const pcHeader = "Task Abs Time % Time\r\n*********
|
|||
vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvThreeParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t lParameterStringLength, xReturn;
|
||||
static BaseType_t lParameterNumber = 0;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -195,15 +211,15 @@ static BaseType_t lParameterNumber = 0;
|
|||
if( lParameterNumber == 0 )
|
||||
{
|
||||
/* The first time the function is called after the command has been
|
||||
entered just a header string is returned. */
|
||||
* entered just a header string is returned. */
|
||||
sprintf( pcWriteBuffer, "The three parameters were:\r\n" );
|
||||
|
||||
/* Next time the function is called the first parameter will be echoed
|
||||
back. */
|
||||
* back. */
|
||||
lParameterNumber = 1L;
|
||||
|
||||
/* There is more data to be returned as no parameters have been echoed
|
||||
back yet. */
|
||||
* back yet. */
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
|
@ -226,11 +242,11 @@ static BaseType_t lParameterNumber = 0;
|
|||
strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
|
||||
|
||||
/* If this is the last of the three parameters then there are no more
|
||||
strings to return after this one. */
|
||||
* strings to return after this one. */
|
||||
if( lParameterNumber == 3L )
|
||||
{
|
||||
/* If this is the last of the three parameters then there are no more
|
||||
strings to return after this one. */
|
||||
* strings to return after this one. */
|
||||
xReturn = pdFALSE;
|
||||
lParameterNumber = 0L;
|
||||
}
|
||||
|
@ -246,15 +262,17 @@ static BaseType_t lParameterNumber = 0;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t lParameterStringLength, xReturn;
|
||||
static BaseType_t lParameterNumber = 0;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -262,15 +280,15 @@ static BaseType_t lParameterNumber = 0;
|
|||
if( lParameterNumber == 0 )
|
||||
{
|
||||
/* The first time the function is called after the command has been
|
||||
entered just a header string is returned. */
|
||||
* entered just a header string is returned. */
|
||||
sprintf( pcWriteBuffer, "The parameters were:\r\n" );
|
||||
|
||||
/* Next time the function is called the first parameter will be echoed
|
||||
back. */
|
||||
* back. */
|
||||
lParameterNumber = 1L;
|
||||
|
||||
/* There is more data to be returned as no parameters have been echoed
|
||||
back yet. */
|
||||
* back yet. */
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
|
@ -298,7 +316,7 @@ static BaseType_t lParameterNumber = 0;
|
|||
else
|
||||
{
|
||||
/* No more parameters were found. Make sure the write buffer does
|
||||
not contain a valid string. */
|
||||
* not contain a valid string. */
|
||||
pcWriteBuffer[ 0 ] = 0x00;
|
||||
|
||||
/* No more data to return. */
|
||||
|
@ -313,14 +331,16 @@ static BaseType_t lParameterNumber = 0;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvStartStopTraceCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t lParameterStringLength;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -361,7 +381,7 @@ BaseType_t lParameterStringLength;
|
|||
}
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -383,4 +403,3 @@ FILE* pxOutputFile;
|
|||
printf( "\r\nFailed to create trace dump file\r\n" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32929.386
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -40,8 +40,8 @@
|
|||
#include <FreeRTOS.h>
|
||||
|
||||
/* Variables used in the creation of the run time stats time base. Run time
|
||||
stats record how much time each task spends in the Running state. */
|
||||
static long long llInitialRunTimeCounterValue = 0LL, llTicksPerHundedthMillisecond = 0LL;
|
||||
* stats record how much time each task spends in the Running state. */
|
||||
static long long llInitialRunTimeCounterValue = 0LL, llTicksPerHundredthMillisecond = 0LL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -50,21 +50,21 @@ void vConfigureTimerForRunTimeStats( void )
|
|||
LARGE_INTEGER liPerformanceCounterFrequency, liInitialRunTimeValue;
|
||||
|
||||
/* Initialise the variables used to create the run time stats time base.
|
||||
Run time stats record how much time each task spends in the Running
|
||||
state. */
|
||||
* Run time stats record how much time each task spends in the Running
|
||||
* state. */
|
||||
|
||||
if( QueryPerformanceFrequency( &liPerformanceCounterFrequency ) == 0 )
|
||||
{
|
||||
llTicksPerHundedthMillisecond = 1;
|
||||
llTicksPerHundredthMillisecond = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* How many times does the performance counter increment in 1/100th
|
||||
millisecond. */
|
||||
llTicksPerHundedthMillisecond = liPerformanceCounterFrequency.QuadPart / 100000LL;
|
||||
* millisecond. */
|
||||
llTicksPerHundredthMillisecond = liPerformanceCounterFrequency.QuadPart / 100000LL;
|
||||
|
||||
/* What is the performance counter value now, this will be subtracted
|
||||
from readings taken at run time. */
|
||||
* from readings taken at run time. */
|
||||
QueryPerformanceCounter( &liInitialRunTimeValue );
|
||||
llInitialRunTimeCounterValue = liInitialRunTimeValue.QuadPart;
|
||||
}
|
||||
|
@ -80,18 +80,18 @@ unsigned long ulReturn;
|
|||
QueryPerformanceCounter( &liCurrentCount );
|
||||
|
||||
/* Subtract the performance counter value reading taken when the
|
||||
application started to get a count from that reference point, then
|
||||
scale to (simulated) 1/100ths of a millisecond. */
|
||||
if( llTicksPerHundedthMillisecond == 0 )
|
||||
* application started to get a count from that reference point, then
|
||||
* scale to (simulated) 1/100ths of a millisecond. */
|
||||
if( llTicksPerHundredthMillisecond == 0 )
|
||||
{
|
||||
/* The trace macros can call this function before the kernel has been
|
||||
started, in which case llTicksPerHundedthMillisecond will not have been
|
||||
initialised. */
|
||||
* started, in which case llTicksPerHundredthMillisecond will not have been
|
||||
* initialised. */
|
||||
ulReturn = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulReturn = ( unsigned long ) ( ( liCurrentCount.QuadPart - llInitialRunTimeCounterValue ) / llTicksPerHundedthMillisecond );
|
||||
ulReturn = ( unsigned long ) ( ( liCurrentCount.QuadPart - llInitialRunTimeCounterValue ) / llTicksPerHundredthMillisecond );
|
||||
}
|
||||
|
||||
return ulReturn;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*******************************************************************************
|
||||
/*******************************************************************************
|
||||
* Trace Recorder Library for Tracealyzer v4.1.4
|
||||
* Percepio AB, www.percepio.com
|
||||
*
|
||||
|
@ -61,7 +61,7 @@ extern "C" {
|
|||
* required at least for the ARM Cortex-M port, that uses the ARM CMSIS API.
|
||||
* Try that in case of build problems. Otherwise, remove the #error line below.
|
||||
*****************************************************************************/
|
||||
//#error "Trace Recorder: Please include your processor's header file here and remove this line."
|
||||
/*#error "Trace Recorder: Please include your processor's header file here and remove this line." */
|
||||
|
||||
/*******************************************************************************
|
||||
* Configuration Macro: TRC_CFG_HARDWARE_PORT
|
||||
|
|
|
@ -320,7 +320,7 @@
|
|||
*
|
||||
* // Finds the existing UB channel
|
||||
* vTracePrintF(chn2, "%Z: %d", value2);
|
||||
|
||||
*
|
||||
******************************************************************************/
|
||||
#define TRC_CFG_USE_SEPARATE_USER_EVENT_BUFFER 0
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -85,13 +85,14 @@ SOCKET xSocket;
|
|||
if( lBytes == SOCKET_ERROR )
|
||||
{
|
||||
/* Something went wrong, but it is not handled by this simple
|
||||
example. */
|
||||
* example. */
|
||||
iErrorCode = WSAGetLastError();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Process each received byte in turn. */
|
||||
lByte = 0;
|
||||
|
||||
while( lByte < lBytes )
|
||||
{
|
||||
/* The next character in the input buffer. */
|
||||
|
@ -99,30 +100,29 @@ SOCKET xSocket;
|
|||
lByte++;
|
||||
|
||||
/* Newline characters are taken as the end of the command
|
||||
string. */
|
||||
* string. */
|
||||
if( cInChar == '\n' )
|
||||
{
|
||||
/* Process the input string received prior to the
|
||||
newline. */
|
||||
* newline. */
|
||||
do
|
||||
{
|
||||
/* Pass the string to FreeRTOS+CLI. */
|
||||
xMoreDataToFollow = FreeRTOS_CLIProcessCommand( cInputString, cOutputString, cmdMAX_OUTPUT_SIZE );
|
||||
|
||||
/* Send the output generated by the command's
|
||||
implementation. */
|
||||
* implementation. */
|
||||
sendto( xSocket, cOutputString, strlen( cOutputString ), 0, ( SOCKADDR * ) &xClient, xClientAddressLength );
|
||||
|
||||
} while( xMoreDataToFollow != pdFALSE ); /* Until the command does not generate any more output. */
|
||||
|
||||
/* All the strings generated by the command processing
|
||||
have been sent. Clear the input string ready to receive
|
||||
the next command. */
|
||||
* have been sent. Clear the input string ready to receive
|
||||
* the next command. */
|
||||
cInputIndex = 0;
|
||||
memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );
|
||||
|
||||
/* Transmit a spacer, just to make the command console
|
||||
easier to read. */
|
||||
* easier to read. */
|
||||
sendto( xSocket, "\r\n", strlen( "\r\n" ), 0, ( SOCKADDR * ) &xClient, xClientAddressLength );
|
||||
}
|
||||
else
|
||||
|
@ -130,12 +130,12 @@ SOCKET xSocket;
|
|||
if( cInChar == '\r' )
|
||||
{
|
||||
/* Ignore the character. Newlines are used to
|
||||
detect the end of the input string. */
|
||||
* detect the end of the input string. */
|
||||
}
|
||||
else if( cInChar == '\b' )
|
||||
{
|
||||
/* Backspace was pressed. Erase the last character
|
||||
in the string - if any. */
|
||||
* in the string - if any. */
|
||||
if( cInputIndex > 0 )
|
||||
{
|
||||
cInputIndex--;
|
||||
|
@ -145,8 +145,8 @@ SOCKET xSocket;
|
|||
else
|
||||
{
|
||||
/* A character was entered. Add it to the string
|
||||
entered so far. When a \n is entered the complete
|
||||
string will be passed to the command interpreter. */
|
||||
* entered so far. When a \n is entered the complete
|
||||
* string will be passed to the command interpreter. */
|
||||
if( cInputIndex < cmdMAX_INPUT_SIZE )
|
||||
{
|
||||
cInputString[ cInputIndex ] = cInChar;
|
||||
|
@ -183,6 +183,7 @@ SOCKET xSocket = INVALID_SOCKET;
|
|||
else
|
||||
{
|
||||
xSocket = socket( AF_INET, SOCK_DGRAM, 0 );
|
||||
|
||||
if( xSocket == INVALID_SOCKET )
|
||||
{
|
||||
fprintf( stderr, "Could not create socket.\n" );
|
||||
|
@ -216,5 +217,3 @@ SOCKET xSocket = INVALID_SOCKET;
|
|||
|
||||
return xSocket;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Resource Files">
|
||||
|
|
|
@ -88,12 +88,12 @@
|
|||
#define mainUDP_CLI_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
|
||||
/* The rate at which data is sent to the queue. The (simulated) 250ms value is
|
||||
converted to ticks using the portTICK_RATE_MS constant. */
|
||||
* converted to ticks using the portTICK_RATE_MS constant. */
|
||||
#define mainQUEUE_SEND_FREQUENCY_MS ( 250 / portTICK_RATE_MS )
|
||||
|
||||
/* The number of items the queue can hold. This is 1 as the receive task
|
||||
will remove items as they are added, meaning the send task should always find
|
||||
the queue empty. */
|
||||
* will remove items as they are added, meaning the send task should always find
|
||||
* the queue empty. */
|
||||
#define mainQUEUE_LENGTH ( 1 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -126,18 +126,18 @@ int main( void )
|
|||
const uint32_t ulLongTime_ms = 250UL;
|
||||
|
||||
/* Initialise the trace recorder and create the label used to post user
|
||||
events to the trace recording on each tick interrupt. */
|
||||
* events to the trace recording on each tick interrupt. */
|
||||
vTraceEnable( TRC_START );
|
||||
|
||||
/* Create the queue used to pass messages from the queue send task to the
|
||||
queue receive task. */
|
||||
* queue receive task. */
|
||||
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );
|
||||
|
||||
/* Give the queue a name for the FreeRTOS+Trace log. */
|
||||
vTraceSetQueueName( xQueue, "DemoQ" );
|
||||
|
||||
/* Start the two tasks as described in the comments at the top of this
|
||||
file. */
|
||||
* file. */
|
||||
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
|
||||
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
|
||||
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. Not actually used as a stack in the Win32 simulator port. */
|
||||
|
@ -148,7 +148,7 @@ const uint32_t ulLongTime_ms = 250UL;
|
|||
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Create the task that handles the CLI on a UDP port. The port number
|
||||
is set using the configUDP_CLI_PORT_NUMBER setting in FreeRTOSConfig.h. */
|
||||
* is set using the configUDP_CLI_PORT_NUMBER setting in FreeRTOSConfig.h. */
|
||||
xTaskCreate( vUDPCommandInterpreterTask, "CLI", configMINIMAL_STACK_SIZE, NULL, mainUDP_CLI_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Register commands with the FreeRTOS+CLI command interpreter. */
|
||||
|
@ -158,11 +158,11 @@ const uint32_t ulLongTime_ms = 250UL;
|
|||
vTaskStartScheduler();
|
||||
|
||||
/* If all is well, the scheduler will now be running, and the following
|
||||
line will never be reached. If the following line does execute, then
|
||||
there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
timer tasks to be created. See the memory management section on the
|
||||
FreeRTOS web site for more details (this is standard text that is not
|
||||
really applicable to the Win32 simulator port). */
|
||||
* line will never be reached. If the following line does execute, then
|
||||
* there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
* timer tasks to be created. See the memory management section on the
|
||||
* FreeRTOS web site for more details (this is standard text that is not
|
||||
* really applicable to the Win32 simulator port). */
|
||||
for( ; ; )
|
||||
{
|
||||
Sleep( ulLongTime_ms );
|
||||
|
@ -184,14 +184,14 @@ const unsigned long ulValueToSend = 100UL;
|
|||
for( ; ; )
|
||||
{
|
||||
/* Place this task in the blocked state until it is time to run again.
|
||||
While in the Blocked state this task will not consume any CPU time. */
|
||||
* While in the Blocked state this task will not consume any CPU time. */
|
||||
vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );
|
||||
|
||||
/* Send to the queue - causing the queue receive task to unblock and
|
||||
write a message to the display. 0 is used as the block time so the
|
||||
sending operation will not block - it shouldn't need to block as the
|
||||
queue should always be empty at this point in the code, and it is an
|
||||
error if it is not. */
|
||||
* write a message to the display. 0 is used as the block time so the
|
||||
* sending operation will not block - it shouldn't need to block as the
|
||||
* queue should always be empty at this point in the code, and it is an
|
||||
* error if it is not. */
|
||||
xQueueSend( xQueue, &ulValueToSend, 0U );
|
||||
}
|
||||
}
|
||||
|
@ -207,13 +207,13 @@ unsigned long ulReceivedValue;
|
|||
for( ; ; )
|
||||
{
|
||||
/* Wait until something arrives in the queue - this task will block
|
||||
indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
|
||||
FreeRTOSConfig.h. */
|
||||
* indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
|
||||
* FreeRTOSConfig.h. */
|
||||
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
|
||||
|
||||
/* To get here something must have been received from the queue, but
|
||||
is it the expected value? If it is, write the message to the
|
||||
display before looping back to block on the queue again. */
|
||||
* is it the expected value? If it is, write the message to the
|
||||
* display before looping back to block on the queue again. */
|
||||
if( ulReceivedValue == 100UL )
|
||||
{
|
||||
printf( "Message received!\r\n" );
|
||||
|
@ -228,8 +228,8 @@ void vApplicationIdleHook( void )
|
|||
const unsigned long ulMSToSleep = 5;
|
||||
|
||||
/* This function is called on each cycle of the idle task if
|
||||
configUSE_IDLE_HOOK is set to 1 in FreeRTOSConfig.h. Sleep to reduce CPU
|
||||
load. */
|
||||
* configUSE_IDLE_HOOK is set to 1 in FreeRTOSConfig.h. Sleep to reduce CPU
|
||||
* load. */
|
||||
Sleep( ulMSToSleep );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/* THIS FILE WAS GENERATED BY THE DATALIGHT RELIANCE EDGE CONFIGURATION
|
||||
UTILITY. DO NOT MODIFY.
|
||||
|
||||
Generated by configuration utility version 2.0
|
||||
* UTILITY. DO NOT MODIFY.
|
||||
*
|
||||
* Generated by configuration utility version 2.0
|
||||
*/
|
||||
|
||||
/** @file
|
||||
*/
|
||||
#include <redconf.h>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/* THIS FILE WAS GENERATED BY THE DATALIGHT RELIANCE EDGE CONFIGURATION
|
||||
UTILITY. DO NOT MODIFY.
|
||||
|
||||
Generated by configuration utility version 2.0
|
||||
* UTILITY. DO NOT MODIFY.
|
||||
*
|
||||
* Generated by configuration utility version 2.0
|
||||
*/
|
||||
|
||||
/** @file
|
||||
*/
|
||||
#ifndef REDCONF_H
|
||||
|
@ -109,4 +110,4 @@
|
|||
|
||||
#define RED_CONFIG_MINCOMPAT_VER 0x1000200U
|
||||
|
||||
#endif
|
||||
#endif /* ifndef REDCONF_H */
|
||||
|
|
|
@ -1,83 +1,85 @@
|
|||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
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; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (c) 2014-2015 Datalight, Inc.
|
||||
* All Rights Reserved Worldwide.
|
||||
*
|
||||
* 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; use version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but "AS-IS," 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, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
* comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
* before incorporating Reliance Edge into proprietary software for
|
||||
* distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
* more information.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@brief Defines basic types used by Reliance Edge.
|
||||
|
||||
The following types *must* be defined by this header, either directly (using
|
||||
typedef) or indirectly (by including other headers, such as the C99 headers
|
||||
stdint.h and stdbool.h):
|
||||
|
||||
- bool: Boolean type, capable of storing true (1) or false (0)
|
||||
- uint8_t: Unsigned 8-bit integer
|
||||
- int8_t: Signed 8-bit integer
|
||||
- uint16_t: Unsigned 16-bit integer
|
||||
- int16_t: Signed 16-bit integer
|
||||
- uint32_t: Unsigned 32-bit integer
|
||||
- int32_t: Signed 32-bit integer
|
||||
- uint64_t: Unsigned 64-bit integer
|
||||
- int64_t: Signed 64-bit integer
|
||||
- uintptr_t: Unsigned integer capable of storing a pointer, preferably the
|
||||
same size as pointers themselves.
|
||||
|
||||
These types deliberately use the same names as the standard C99 types, so
|
||||
that if the C99 headers stdint.h and stdbool.h are available, they may be
|
||||
included here.
|
||||
|
||||
If the user application defines similar types, those may be reused. For
|
||||
example, suppose there is an application header apptypes.h which defines
|
||||
types with a similar purpose but different names. That header could be
|
||||
reused to define the types Reliance Edge needs:
|
||||
|
||||
~~~{.c}
|
||||
* @brief Defines basic types used by Reliance Edge.
|
||||
*
|
||||
* The following types *must* be defined by this header, either directly (using
|
||||
* typedef) or indirectly (by including other headers, such as the C99 headers
|
||||
* stdint.h and stdbool.h):
|
||||
*
|
||||
* - bool: Boolean type, capable of storing true (1) or false (0)
|
||||
* - uint8_t: Unsigned 8-bit integer
|
||||
* - int8_t: Signed 8-bit integer
|
||||
* - uint16_t: Unsigned 16-bit integer
|
||||
* - int16_t: Signed 16-bit integer
|
||||
* - uint32_t: Unsigned 32-bit integer
|
||||
* - int32_t: Signed 32-bit integer
|
||||
* - uint64_t: Unsigned 64-bit integer
|
||||
* - int64_t: Signed 64-bit integer
|
||||
* - uintptr_t: Unsigned integer capable of storing a pointer, preferably the
|
||||
* same size as pointers themselves.
|
||||
*
|
||||
* These types deliberately use the same names as the standard C99 types, so
|
||||
* that if the C99 headers stdint.h and stdbool.h are available, they may be
|
||||
* included here.
|
||||
*
|
||||
* If the user application defines similar types, those may be reused. For
|
||||
* example, suppose there is an application header apptypes.h which defines
|
||||
* types with a similar purpose but different names. That header could be
|
||||
* reused to define the types Reliance Edge needs:
|
||||
*
|
||||
* ~~~{.c}
|
||||
#include <apptypes.h>
|
||||
|
||||
typedef BOOL bool;
|
||||
typedef BYTE uint8_t;
|
||||
typedef INT8 int8_t;
|
||||
// And so on...
|
||||
~~~
|
||||
|
||||
If there are neither C99 headers nor suitable types in application headers,
|
||||
this header should be populated with typedefs that define the required types
|
||||
in terms of the standard C types. This requires knowledge of the size of
|
||||
the C types on the target hardware (e.g., how big is an "int" or a pointer).
|
||||
Below is an example which assumes the target has 8-bit chars, 16-bit shorts,
|
||||
32-bit ints, 32-bit pointers, and 64-bit long longs:
|
||||
|
||||
~~~{.c}
|
||||
typedef int bool;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef long long int64_t;
|
||||
typedef uint32_t uintptr_t;
|
||||
~~~
|
||||
*
|
||||
* typedef BOOL bool;
|
||||
* typedef BYTE uint8_t;
|
||||
* typedef INT8 int8_t;
|
||||
* // And so on...
|
||||
* ~~~
|
||||
*
|
||||
* If there are neither C99 headers nor suitable types in application headers,
|
||||
* this header should be populated with typedefs that define the required types
|
||||
* in terms of the standard C types. This requires knowledge of the size of
|
||||
* the C types on the target hardware (e.g., how big is an "int" or a pointer).
|
||||
* Below is an example which assumes the target has 8-bit chars, 16-bit shorts,
|
||||
* 32-bit ints, 32-bit pointers, and 64-bit long longs:
|
||||
*
|
||||
* ~~~{.c}
|
||||
* typedef int bool;
|
||||
* typedef unsigned char uint8_t;
|
||||
* typedef signed char int8_t;
|
||||
* typedef unsigned short uint16_t;
|
||||
* typedef short int16_t;
|
||||
* typedef unsigned int uint32_t;
|
||||
* typedef int int32_t;
|
||||
* typedef unsigned long long uint64_t;
|
||||
* typedef long long int64_t;
|
||||
* typedef uint32_t uintptr_t;
|
||||
* ~~~
|
||||
*/
|
||||
#ifndef REDTYPES_H
|
||||
#define REDTYPES_H
|
||||
|
@ -106,5 +108,4 @@ typedef uint32_t uintptr_t;
|
|||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ifndef REDTYPES_H */
|
||||
|
|
|
@ -54,7 +54,8 @@
|
|||
/*
|
||||
* Print out information on a single file.
|
||||
*/
|
||||
static void prvCreateFileInfoString( char *pcBuffer, REDDIRENT *pxDirent );
|
||||
static void prvCreateFileInfoString( char * pcBuffer,
|
||||
REDDIRENT * pxDirent );
|
||||
|
||||
/*
|
||||
* Copies an existing file into a newly created file.
|
||||
|
@ -67,91 +68,125 @@ static BaseType_t prvPerformCopy( int32_t lSourceFildes,
|
|||
/*
|
||||
* Implements the DIR command.
|
||||
*/
|
||||
static BaseType_t prvDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvDIRCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the DEL command.
|
||||
*/
|
||||
static BaseType_t prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvDELCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the TYPE command.
|
||||
*/
|
||||
static BaseType_t prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvTYPECommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the APPEND command.
|
||||
*/
|
||||
static BaseType_t prvAPPENDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvAPPENDCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the COPY command.
|
||||
*/
|
||||
static BaseType_t prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvCOPYCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the CREATE command.
|
||||
*/
|
||||
static BaseType_t prvCREATECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvCREATECommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the MKDIR command.
|
||||
*/
|
||||
static BaseType_t prvMKDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvMKDIRCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the RENAME command.
|
||||
*/
|
||||
static BaseType_t prvRENAMECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvRENAMECommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the LINK command.
|
||||
*/
|
||||
static BaseType_t prvLINKCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvLINKCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the STAT command.
|
||||
*/
|
||||
static BaseType_t prvSTATCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvSTATCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the STATFS command.
|
||||
*/
|
||||
static BaseType_t prvSTATFSCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvSTATFSCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the FORMAT command.
|
||||
*/
|
||||
static BaseType_t prvFORMATCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvFORMATCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the TRANSACT command.
|
||||
*/
|
||||
static BaseType_t prvTRANSACTCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvTRANSACTCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the TRANSMASKGET command.
|
||||
*/
|
||||
static BaseType_t prvTRANSMASKGETCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvTRANSMASKGETCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the TRANSMASKSET command.
|
||||
*/
|
||||
static BaseType_t prvTRANSMASKSETCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvTRANSMASKSETCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the ABORT command.
|
||||
*/
|
||||
static BaseType_t prvABORTCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvABORTCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the TEST command.
|
||||
*/
|
||||
static BaseType_t prvTESTFSCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvTESTFSCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
|
||||
/* Structure that defines the DIR command line command, which lists all the
|
||||
files in the current directory. */
|
||||
* files in the current directory. */
|
||||
static const CLI_Command_Definition_t xDIR =
|
||||
{
|
||||
"dir", /* The command string to type. */
|
||||
|
@ -161,7 +196,7 @@ static const CLI_Command_Definition_t xDIR =
|
|||
};
|
||||
|
||||
/* Structure that defines the TYPE command line command, which prints the
|
||||
contents of a file to the console. */
|
||||
* contents of a file to the console. */
|
||||
static const CLI_Command_Definition_t xTYPE =
|
||||
{
|
||||
"type", /* The command string to type. */
|
||||
|
@ -171,7 +206,7 @@ static const CLI_Command_Definition_t xTYPE =
|
|||
};
|
||||
|
||||
/* Structure that defines the APPEND command line command, which appends data
|
||||
to a file. */
|
||||
* to a file. */
|
||||
static const CLI_Command_Definition_t xAPPEND =
|
||||
{
|
||||
"append", /* The command string to type. */
|
||||
|
@ -199,7 +234,7 @@ static const CLI_Command_Definition_t xCOPY =
|
|||
};
|
||||
|
||||
/* Structure that defines the CREATE command line command, which creates an
|
||||
empty file. */
|
||||
* empty file. */
|
||||
static const CLI_Command_Definition_t xCREATE =
|
||||
{
|
||||
"create", /* The command string to type. */
|
||||
|
@ -209,7 +244,7 @@ static const CLI_Command_Definition_t xCREATE =
|
|||
};
|
||||
|
||||
/* Structure that defines the MKDIR command line command, which creates an
|
||||
empty directory. */
|
||||
* empty directory. */
|
||||
static const CLI_Command_Definition_t xMKDIR =
|
||||
{
|
||||
"mkdir", /* The command string to type. */
|
||||
|
@ -228,7 +263,7 @@ static const CLI_Command_Definition_t xRENAME =
|
|||
};
|
||||
|
||||
/* Structure that defines the LINK command line command, which creates a hard
|
||||
link. */
|
||||
* link. */
|
||||
static const CLI_Command_Definition_t xLINK =
|
||||
{
|
||||
"link", /* The command string to type. */
|
||||
|
@ -238,7 +273,7 @@ static const CLI_Command_Definition_t xLINK =
|
|||
};
|
||||
|
||||
/* Structure that defines the STAT command line command, which shows various
|
||||
information about a file. */
|
||||
* information about a file. */
|
||||
static const CLI_Command_Definition_t xSTAT =
|
||||
{
|
||||
"stat", /* The command string to type. */
|
||||
|
@ -248,7 +283,7 @@ static const CLI_Command_Definition_t xSTAT =
|
|||
};
|
||||
|
||||
/* Structure that defines the STATFS command line command, which shows various
|
||||
file system information. */
|
||||
* file system information. */
|
||||
static const CLI_Command_Definition_t xSTATFS =
|
||||
{
|
||||
"statfs", /* The command string to type. */
|
||||
|
@ -258,7 +293,7 @@ static const CLI_Command_Definition_t xSTATFS =
|
|||
};
|
||||
|
||||
/* Structure that defines the FORMAT command line command, which re-formats the
|
||||
file system. */
|
||||
* file system. */
|
||||
static const CLI_Command_Definition_t xFORMAT =
|
||||
{
|
||||
"format", /* The command string to type. */
|
||||
|
@ -268,7 +303,7 @@ static const CLI_Command_Definition_t xFORMAT =
|
|||
};
|
||||
|
||||
/* Structure that defines the TRANSACT command line command, which commits a
|
||||
transaction point. */
|
||||
* transaction point. */
|
||||
static const CLI_Command_Definition_t xTRANSACT =
|
||||
{
|
||||
"transact", /* The command string to type. */
|
||||
|
@ -278,7 +313,7 @@ static const CLI_Command_Definition_t xTRANSACT =
|
|||
};
|
||||
|
||||
/* Structure that defines the TRANSMASKGET command line command, which retrieves
|
||||
the current automatic transaction event mask. */
|
||||
* the current automatic transaction event mask. */
|
||||
static const CLI_Command_Definition_t xTRANSMASKGET =
|
||||
{
|
||||
"transmaskget", /* The command string to type. */
|
||||
|
@ -288,7 +323,7 @@ static const CLI_Command_Definition_t xTRANSMASKGET =
|
|||
};
|
||||
|
||||
/* Structure that defines the TRANSMASKSET command line command, which sets the
|
||||
automatic transaction event mask. */
|
||||
* automatic transaction event mask. */
|
||||
static const CLI_Command_Definition_t xTRANSMASKSET =
|
||||
{
|
||||
"transmaskset", /* The command string to type. */
|
||||
|
@ -298,7 +333,7 @@ static const CLI_Command_Definition_t xTRANSMASKSET =
|
|||
};
|
||||
|
||||
/* Structure that defines the ABORT command line command, which rolls back
|
||||
changes which have not been transacted. */
|
||||
* changes which have not been transacted. */
|
||||
static const CLI_Command_Definition_t xABORT =
|
||||
{
|
||||
"abort", /* The command string to type. */
|
||||
|
@ -308,7 +343,7 @@ static const CLI_Command_Definition_t xABORT =
|
|||
};
|
||||
|
||||
/* Structure that defines the TEST-FS command line command, which executes some
|
||||
file system driver tests. */
|
||||
* file system driver tests. */
|
||||
static const CLI_Command_Definition_t xTEST_FS =
|
||||
{
|
||||
"test-fs", /* The command string to type. */
|
||||
|
@ -342,7 +377,9 @@ void vRegisterFileSystemCLICommands( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvDIRCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
static REDDIR * pxDir = NULL;
|
||||
REDDIRENT * pxDirent;
|
||||
|
@ -370,15 +407,15 @@ BaseType_t xParameterStringLength, xReturn = pdFALSE;
|
|||
configASSERT( pcParameter );
|
||||
|
||||
/* This is the first time this function has been executed since the Dir
|
||||
command was run. Open the directory. */
|
||||
* command was run. Open the directory. */
|
||||
pxDir = red_opendir( pcParameter );
|
||||
}
|
||||
|
||||
if( pxDir )
|
||||
{
|
||||
/* red_readdir() returns NULL either on error or upon reaching the
|
||||
end of the directory. Clear errno so these conditions can be
|
||||
distinguished. */
|
||||
* end of the directory. Clear errno so these conditions can be
|
||||
* distinguished. */
|
||||
red_errno = 0;
|
||||
pxDirent = red_readdir( pxDir );
|
||||
|
||||
|
@ -426,7 +463,9 @@ BaseType_t xParameterStringLength, xReturn = pdFALSE;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvTYPECommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength, xReturn = pdTRUE;
|
||||
|
@ -445,7 +484,7 @@ size_t xColumns = 50U;
|
|||
if( xWriteBufferLen < xColumns )
|
||||
{
|
||||
/* Ensure the loop that uses xColumns as an end condition does not
|
||||
write off the end of the buffer. */
|
||||
* write off the end of the buffer. */
|
||||
xColumns = xWriteBufferLen;
|
||||
}
|
||||
|
||||
|
@ -464,6 +503,7 @@ size_t xColumns = 50U;
|
|||
|
||||
/* Attempt to open the requested file. */
|
||||
lFildes = red_open( pcParameter, RED_O_RDONLY );
|
||||
|
||||
if( lFildes == -1 )
|
||||
{
|
||||
/* User-friendly messages for common errors. */
|
||||
|
@ -483,6 +523,7 @@ size_t xColumns = 50U;
|
|||
{
|
||||
/* Make sure this is a file, not a directory. */
|
||||
lStatus = red_fstat( lFildes, &finfo );
|
||||
|
||||
if( lStatus == 0 )
|
||||
{
|
||||
if( RED_S_ISDIR( finfo.st_mode ) )
|
||||
|
@ -517,7 +558,7 @@ size_t xColumns = 50U;
|
|||
if( lFildes == -1 )
|
||||
{
|
||||
/* Either the file was not opened, or all the data from the file has
|
||||
been returned and the file is now closed. */
|
||||
* been returned and the file is now closed. */
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
|
||||
|
@ -527,7 +568,9 @@ size_t xColumns = 50U;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvAPPENDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvAPPENDCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
char * pcFileName = NULL;
|
||||
const char * pcCharacter = NULL, * pcLength;
|
||||
|
@ -548,6 +591,7 @@ int32_t lFildes, lAppendLength = -1, lThisWrite, lTotalWritten, lBytesWritten;
|
|||
|
||||
/* Convert the string into a number. */
|
||||
lAppendLength = RedAtoI( pcLength );
|
||||
|
||||
if( lAppendLength < 0 )
|
||||
{
|
||||
strcpy( pcWriteBuffer, "Third parameter cannot be a negative number." );
|
||||
|
@ -620,12 +664,14 @@ int32_t lFildes, lAppendLength = -1, lThisWrite, lTotalWritten, lBytesWritten;
|
|||
for( lTotalWritten = 0; lTotalWritten < lAppendLength; lTotalWritten += lThisWrite )
|
||||
{
|
||||
lThisWrite = lAppendLength - lTotalWritten;
|
||||
|
||||
if( lThisWrite > ( int32_t ) xWriteBufferLen )
|
||||
{
|
||||
lThisWrite = ( int32_t ) xWriteBufferLen;
|
||||
}
|
||||
|
||||
lBytesWritten = red_write( lFildes, pcWriteBuffer, lThisWrite );
|
||||
|
||||
if( lBytesWritten == -1 )
|
||||
{
|
||||
/* User-friendly messages for common errors. */
|
||||
|
@ -645,8 +691,8 @@ int32_t lFildes, lAppendLength = -1, lThisWrite, lTotalWritten, lBytesWritten;
|
|||
else if( lBytesWritten != lThisWrite )
|
||||
{
|
||||
/* Some data was written, but not all of it. This only
|
||||
happens when the disk is full or the file reached its
|
||||
maximum size. That latter is unlikely in this demo. */
|
||||
* happens when the disk is full or the file reached its
|
||||
* maximum size. That latter is unlikely in this demo. */
|
||||
strcpy( pcWriteBuffer, "Out of disk space." );
|
||||
break;
|
||||
}
|
||||
|
@ -667,7 +713,9 @@ int32_t lFildes, lAppendLength = -1, lThisWrite, lTotalWritten, lBytesWritten;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvDELCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength;
|
||||
|
@ -720,7 +768,9 @@ int32_t lStatus;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvCOPYCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
char * pcSourceFile;
|
||||
const char * pcDestinationFile;
|
||||
|
@ -752,7 +802,7 @@ int32_t lSourceFildes, lDestinationFildes;
|
|||
/* Terminate the string. */
|
||||
pcSourceFile[ xParameterStringLength ] = 0x00;
|
||||
|
||||
/* See if the source file exists, openm it if it does. */
|
||||
/* See if the source file exists, open it if it does. */
|
||||
lSourceFildes = red_open( pcSourceFile, RED_O_RDONLY );
|
||||
|
||||
if( lSourceFildes == -1 )
|
||||
|
@ -791,7 +841,9 @@ int32_t lSourceFildes, lDestinationFildes;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvCREATECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvCREATECommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength;
|
||||
|
@ -845,7 +897,9 @@ int32_t lFildes;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvMKDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvMKDIRCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength;
|
||||
|
@ -898,7 +952,9 @@ int32_t lStatus;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvRENAMECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvRENAMECommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcDestinationFile;
|
||||
char * pcSourceFile;
|
||||
|
@ -968,7 +1024,9 @@ int32_t lStatus;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvLINKCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvLINKCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcDestinationFile;
|
||||
char * pcSourceFile;
|
||||
|
@ -1040,7 +1098,9 @@ int32_t lStatus;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvSTATCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvSTATCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter, * pcModeString;
|
||||
BaseType_t xParameterStringLength;
|
||||
|
@ -1064,6 +1124,7 @@ int32_t lFildes, lStatus;
|
|||
|
||||
/* Attempt to open the requested file. */
|
||||
lFildes = red_open( pcParameter, RED_O_RDONLY );
|
||||
|
||||
if( lFildes == -1 )
|
||||
{
|
||||
/* User-friendly messages for common errors. */
|
||||
|
@ -1082,6 +1143,7 @@ int32_t lFildes, lStatus;
|
|||
else
|
||||
{
|
||||
lStatus = red_fstat( lFildes, &finfo );
|
||||
|
||||
if( lStatus == 0 )
|
||||
{
|
||||
if( RED_S_ISDIR( finfo.st_mode ) )
|
||||
|
@ -1111,7 +1173,9 @@ int32_t lFildes, lStatus;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvSTATFSCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvSTATFSCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
REDSTATFS fsinfo;
|
||||
int32_t lStatus;
|
||||
|
@ -1148,7 +1212,9 @@ int32_t lStatus;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvFORMATCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvFORMATCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
int32_t lStatus;
|
||||
|
||||
|
@ -1160,6 +1226,7 @@ int32_t lStatus;
|
|||
|
||||
/* File system volumes cannot be formatted while mounted. */
|
||||
lStatus = red_umount( "" );
|
||||
|
||||
if( lStatus == -1 )
|
||||
{
|
||||
sprintf( pcWriteBuffer, "Error %d during unmount.", ( int ) red_errno );
|
||||
|
@ -1195,7 +1262,9 @@ int32_t lStatus;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTRANSACTCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvTRANSACTCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
int32_t lStatus;
|
||||
|
||||
|
@ -1223,7 +1292,9 @@ int32_t lStatus;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTRANSMASKGETCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvTRANSMASKGETCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
uint32_t ulEventMask;
|
||||
int32_t lStatus;
|
||||
|
@ -1236,6 +1307,7 @@ int32_t lStatus;
|
|||
xWriteBufferLen -= strlen( cliNEW_LINE );
|
||||
|
||||
lStatus = red_gettransmask( "", &ulEventMask );
|
||||
|
||||
if( lStatus == -1 )
|
||||
{
|
||||
snprintf( pcWriteBuffer, xWriteBufferLen, "Error %d retrieving automatic transaction event mask.", ( int ) red_errno );
|
||||
|
@ -1275,7 +1347,9 @@ int32_t lStatus;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTRANSMASKSETCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvTRANSMASKSETCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength;
|
||||
|
@ -1307,6 +1381,7 @@ int32_t lStatus;
|
|||
|
||||
/* Set the new transaction mask. */
|
||||
lStatus = red_settransmask( "", ulEventMask );
|
||||
|
||||
if( lStatus == -1 )
|
||||
{
|
||||
/* User-friendly messages for common errors. */
|
||||
|
@ -1355,7 +1430,9 @@ int32_t lStatus;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvABORTCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvABORTCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
uint32_t ulEventMask;
|
||||
int32_t lStatus;
|
||||
|
@ -1376,7 +1453,7 @@ int32_t lStatus;
|
|||
else
|
||||
{
|
||||
/* Make it so that red_umount() will not automatically commit a new
|
||||
transaction point. */
|
||||
* transaction point. */
|
||||
lStatus = red_settransmask( "", ulEventMask & ~( ( uint32_t ) RED_TRANSACT_UMOUNT ) );
|
||||
|
||||
if( lStatus == -1 )
|
||||
|
@ -1386,7 +1463,7 @@ int32_t lStatus;
|
|||
else
|
||||
{
|
||||
/* Unmount. Since red_umount() will not transact, all changes which
|
||||
were not already transacted are rolled back. */
|
||||
* were not already transacted are rolled back. */
|
||||
lStatus = red_umount( "" );
|
||||
|
||||
if( lStatus == -1 )
|
||||
|
@ -1419,7 +1496,9 @@ int32_t lStatus;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTESTFSCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvTESTFSCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
UBaseType_t uxOriginalPriority;
|
||||
FSSTRESSPARAM param;
|
||||
|
@ -1429,10 +1508,10 @@ FSSTRESSPARAM param;
|
|||
( void ) pcCommandString;
|
||||
|
||||
/* Limitations in the interaction with the Windows TCP/IP stack require
|
||||
the command console to run at the idle priority. Raise the priority for
|
||||
the duration of the tests to ensure there are not multiple switches to the
|
||||
idle task as in the simulated environment the idle task hook function may
|
||||
include a (relatively) long delay. */
|
||||
* the command console to run at the idle priority. Raise the priority for
|
||||
* the duration of the tests to ensure there are not multiple switches to the
|
||||
* idle task as in the simulated environment the idle task hook function may
|
||||
* include a (relatively) long delay. */
|
||||
uxOriginalPriority = uxTaskPriorityGet( NULL );
|
||||
vTaskPrioritySet( NULL, configMAX_PRIORITIES - 1 );
|
||||
|
||||
|
@ -1476,6 +1555,7 @@ BaseType_t xReturn = pdPASS;
|
|||
{
|
||||
/* Read the next block of data. */
|
||||
lBytesRead = red_read( lSourceFildes, pxWriteBuffer, xWriteBufferLen );
|
||||
|
||||
if( lBytesRead <= 0 )
|
||||
{
|
||||
if( lBytesRead == -1 )
|
||||
|
@ -1503,7 +1583,8 @@ BaseType_t xReturn = pdPASS;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvCreateFileInfoString( char *pcBuffer, REDDIRENT *pxDirent )
|
||||
static void prvCreateFileInfoString( char * pcBuffer,
|
||||
REDDIRENT * pxDirent )
|
||||
{
|
||||
const char * pcFile = "file", * pcDirectory = "directory";
|
||||
const char * pcAttrib;
|
||||
|
@ -1519,6 +1600,6 @@ const char *pcAttrib;
|
|||
}
|
||||
|
||||
/* Create a string that includes the file name, the file size and the
|
||||
attributes string. */
|
||||
* attributes string. */
|
||||
sprintf( pcBuffer, "%s [%s] [size=%lld]", pxDirent->d_name, pcAttrib, pxDirent->d_stat.st_size );
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
|||
#define fsRAM_BUFFER_SIZE 200
|
||||
|
||||
/* The volume prefix is an empty string, for convenience since there is only one
|
||||
volume in this demo.
|
||||
* volume in this demo.
|
||||
*/
|
||||
#define fsVOLUME_NAME ""
|
||||
|
||||
|
@ -69,7 +69,7 @@ static void prvVerifyDemoFiles( void );
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* A buffer used to both create content to write to disk, and read content back
|
||||
from a disk. Note there is no mutual exclusion on this buffer. */
|
||||
* from a disk. Note there is no mutual exclusion on this buffer. */
|
||||
static char cRAMBuffer[ fsRAM_BUFFER_SIZE ];
|
||||
|
||||
/* Names of directories that are created. */
|
||||
|
@ -121,20 +121,20 @@ int iByte;
|
|||
configASSERT( lStatus == 0 );
|
||||
|
||||
/* Disable automatic transaction points so that all of the files can be
|
||||
created in one atomic operation. */
|
||||
* created in one atomic operation. */
|
||||
lStatus = red_settransmask( fsVOLUME_NAME, RED_TRANSACT_MANUAL );
|
||||
configASSERT( lStatus == 0 );
|
||||
|
||||
/* Create xMaxFiles files. Each created file will be
|
||||
( xFileNumber * fsRAM_BUFFER_SIZE ) bytes in length, and filled
|
||||
with a different repeating character. */
|
||||
* ( xFileNumber * fsRAM_BUFFER_SIZE ) bytes in length, and filled
|
||||
* with a different repeating character. */
|
||||
for( xFileNumber = 1; xFileNumber <= xMaxFiles; xFileNumber++ )
|
||||
{
|
||||
/* Generate a file name. */
|
||||
sprintf( cFilePath, "/root%03d.txt", xFileNumber );
|
||||
|
||||
/* Print out the file name and the directory into which the file is
|
||||
being written. */
|
||||
* being written. */
|
||||
printf( "Creating file %s\r\n", cFilePath );
|
||||
|
||||
/* Open the file, creating the file if it does not already exist. */
|
||||
|
@ -142,12 +142,12 @@ int iByte;
|
|||
configASSERT( lFildes != -1 );
|
||||
|
||||
/* Fill the RAM buffer with data that will be written to the file. This
|
||||
is just a repeating ascii character that indicates the file number. */
|
||||
* is just a repeating ascii character that indicates the file number. */
|
||||
memset( cRAMBuffer, ( int ) ( '0' + xFileNumber ), fsRAM_BUFFER_SIZE );
|
||||
|
||||
/* Write the RAM buffer to the opened file a number of times. The
|
||||
number of times the RAM buffer is written to the file depends on the
|
||||
file number, so the length of each created file will be different. */
|
||||
* number of times the RAM buffer is written to the file depends on the
|
||||
* file number, so the length of each created file will be different. */
|
||||
for( xWriteNumber = 0; xWriteNumber < xFileNumber; xWriteNumber++ )
|
||||
{
|
||||
lBytesWritten = red_write( lFildes, cRAMBuffer, fsRAM_BUFFER_SIZE );
|
||||
|
@ -160,7 +160,7 @@ int iByte;
|
|||
}
|
||||
|
||||
/* Commit a transaction point, atomically adding the set of files to the
|
||||
transacted state. */
|
||||
* transacted state. */
|
||||
lStatus = red_transact( fsVOLUME_NAME );
|
||||
configASSERT( lStatus == 0 );
|
||||
|
||||
|
@ -180,13 +180,13 @@ int iByte;
|
|||
sprintf( cFilePath, "%s/file.txt", pcDirectory2 );
|
||||
|
||||
/* Print out the file name and the directory into which the file is being
|
||||
written. */
|
||||
* written. */
|
||||
printf( "Writing file %s\r\n", cFilePath );
|
||||
|
||||
lFildes = red_open( cFilePath, RED_O_CREAT | RED_O_TRUNC | RED_O_WRONLY );
|
||||
|
||||
/* Write the file. It is filled with incrementing ascii characters starting
|
||||
from '0'. */
|
||||
* from '0'. */
|
||||
for( iByte = 0; iByte < fsRAM_BUFFER_SIZE; iByte++ )
|
||||
{
|
||||
cRAMBuffer[ iByte ] = ( char ) ( ( int ) '0' + iByte );
|
||||
|
@ -200,7 +200,7 @@ int iByte;
|
|||
configASSERT( lStatus == 0 );
|
||||
|
||||
/* Commit a transaction point, atomically adding the set of files and
|
||||
directories to the transacted state. */
|
||||
* directories to the transacted state. */
|
||||
lStatus = red_transact( fsVOLUME_NAME );
|
||||
configASSERT( lStatus == 0 );
|
||||
|
||||
|
@ -226,7 +226,7 @@ int iByte;
|
|||
sprintf( cFilePath, "/root%03d.txt", xFileNumber );
|
||||
|
||||
/* Print out the file name and the directory from which the file is
|
||||
being read. */
|
||||
* being read. */
|
||||
printf( "Reading file %s\r\n", cFilePath );
|
||||
|
||||
/* Open the file for reading. */
|
||||
|
@ -234,7 +234,7 @@ int iByte;
|
|||
configASSERT( lFildes != -1 );
|
||||
|
||||
/* Read the file into the RAM buffer, checking the file contents are as
|
||||
expected. The size of the file depends on the file number. */
|
||||
* expected. The size of the file depends on the file number. */
|
||||
for( xReadNumber = 0; xReadNumber < xFileNumber; xReadNumber++ )
|
||||
{
|
||||
/* Start with the RAM buffer clear. */
|
||||
|
@ -244,8 +244,8 @@ int iByte;
|
|||
configASSERT( lBytesRead == fsRAM_BUFFER_SIZE );
|
||||
|
||||
/* Check the RAM buffer is filled with the expected data. Each
|
||||
file contains a different repeating ascii character that indicates
|
||||
the number of the file. */
|
||||
* file contains a different repeating ascii character that indicates
|
||||
* the number of the file. */
|
||||
for( lChar = 0; lChar < fsRAM_BUFFER_SIZE; lChar++ )
|
||||
{
|
||||
configASSERT( cRAMBuffer[ lChar ] == ( '0' + ( char ) xFileNumber ) );
|
||||
|
@ -261,7 +261,7 @@ int iByte;
|
|||
sprintf( cFilePath, "%s/file.txt", pcDirectory2 );
|
||||
|
||||
/* Print out the file name and the directory from which the file is being
|
||||
read. */
|
||||
* read. */
|
||||
printf( "Reading file %s\r\n", cFilePath );
|
||||
|
||||
/* This time the file is opened for reading. */
|
||||
|
@ -282,7 +282,3 @@ int iByte;
|
|||
lStatus = red_close( lFildes );
|
||||
configASSERT( lStatus == 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32929.386
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -40,8 +40,8 @@
|
|||
#include <FreeRTOS.h>
|
||||
|
||||
/* Variables used in the creation of the run time stats time base. Run time
|
||||
stats record how much time each task spends in the Running state. */
|
||||
static long long llInitialRunTimeCounterValue = 0LL, llTicksPerHundedthMillisecond = 0LL;
|
||||
* stats record how much time each task spends in the Running state. */
|
||||
static long long llInitialRunTimeCounterValue = 0LL, llTicksPerHundredthMillisecond = 0LL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -50,21 +50,21 @@ void vConfigureTimerForRunTimeStats( void )
|
|||
LARGE_INTEGER liPerformanceCounterFrequency, liInitialRunTimeValue;
|
||||
|
||||
/* Initialise the variables used to create the run time stats time base.
|
||||
Run time stats record how much time each task spends in the Running
|
||||
state. */
|
||||
* Run time stats record how much time each task spends in the Running
|
||||
* state. */
|
||||
|
||||
if( QueryPerformanceFrequency( &liPerformanceCounterFrequency ) == 0 )
|
||||
{
|
||||
llTicksPerHundedthMillisecond = 1;
|
||||
llTicksPerHundredthMillisecond = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* How many times does the performance counter increment in 1/100th
|
||||
millisecond. */
|
||||
llTicksPerHundedthMillisecond = liPerformanceCounterFrequency.QuadPart / 100000LL;
|
||||
* millisecond. */
|
||||
llTicksPerHundredthMillisecond = liPerformanceCounterFrequency.QuadPart / 100000LL;
|
||||
|
||||
/* What is the performance counter value now, this will be subtracted
|
||||
from readings taken at run time. */
|
||||
* from readings taken at run time. */
|
||||
QueryPerformanceCounter( &liInitialRunTimeValue );
|
||||
llInitialRunTimeCounterValue = liInitialRunTimeValue.QuadPart;
|
||||
}
|
||||
|
@ -80,9 +80,9 @@ unsigned long ulReturn;
|
|||
QueryPerformanceCounter( &liCurrentCount );
|
||||
|
||||
/* Subtract the performance counter value reading taken when the
|
||||
application started to get a count from that reference point, then
|
||||
scale to (simulated) 1/100ths of a millisecond. */
|
||||
ulReturn = ( unsigned long ) ( ( liCurrentCount.QuadPart - llInitialRunTimeCounterValue ) / llTicksPerHundedthMillisecond );
|
||||
* application started to get a count from that reference point, then
|
||||
* scale to (simulated) 1/100ths of a millisecond. */
|
||||
ulReturn = ( unsigned long ) ( ( liCurrentCount.QuadPart - llInitialRunTimeCounterValue ) / llTicksPerHundredthMillisecond );
|
||||
|
||||
return ulReturn;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -52,32 +52,42 @@
|
|||
/*
|
||||
* Implements the run-time-stats command.
|
||||
*/
|
||||
static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvTaskStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the task-stats command.
|
||||
*/
|
||||
static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvRunTimeStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the echo-three-parameters command.
|
||||
*/
|
||||
static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvThreeParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the echo-parameters command.
|
||||
*/
|
||||
static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
|
||||
/*
|
||||
* Implements the "trace start" and "trace stop" commands;
|
||||
*/
|
||||
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
|
||||
static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
|
||||
static BaseType_t prvStartStopTraceCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString );
|
||||
#endif
|
||||
|
||||
/* Structure that defines the "run-time-stats" command line command. This
|
||||
generates a table that shows how much run time each task has */
|
||||
* generates a table that shows how much run time each task has */
|
||||
static const CLI_Command_Definition_t xRunTimeStats =
|
||||
{
|
||||
"run-time-stats", /* The command string to type. */
|
||||
|
@ -87,7 +97,7 @@ static const CLI_Command_Definition_t xRunTimeStats =
|
|||
};
|
||||
|
||||
/* Structure that defines the "task-stats" command line command. This generates
|
||||
a table that gives information on each task in the system. */
|
||||
* a table that gives information on each task in the system. */
|
||||
static const CLI_Command_Definition_t xTaskStats =
|
||||
{
|
||||
"task-stats", /* The command string to type. */
|
||||
|
@ -97,8 +107,8 @@ static const CLI_Command_Definition_t xTaskStats =
|
|||
};
|
||||
|
||||
/* Structure that defines the "echo_3_parameters" command line command. This
|
||||
takes exactly three parameters that the command simply echos back one at a
|
||||
time. */
|
||||
* takes exactly three parameters that the command simply echos back one at a
|
||||
* time. */
|
||||
static const CLI_Command_Definition_t xThreeParameterEcho =
|
||||
{
|
||||
"echo-3-parameters",
|
||||
|
@ -108,8 +118,8 @@ static const CLI_Command_Definition_t xThreeParameterEcho =
|
|||
};
|
||||
|
||||
/* Structure that defines the "echo_parameters" command line command. This
|
||||
takes a variable number of parameters that the command simply echos back one at
|
||||
a time. */
|
||||
* takes a variable number of parameters that the command simply echos back one at
|
||||
* a time. */
|
||||
static const CLI_Command_Definition_t xParameterEcho =
|
||||
{
|
||||
"echo-parameters",
|
||||
|
@ -119,8 +129,9 @@ static const CLI_Command_Definition_t xParameterEcho =
|
|||
};
|
||||
|
||||
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
|
||||
|
||||
/* Structure that defines the "trace" command line command. This takes a single
|
||||
parameter, which can be either "start" or "stop". */
|
||||
* parameter, which can be either "start" or "stop". */
|
||||
static const CLI_Command_Definition_t xStartStopTrace =
|
||||
{
|
||||
"trace",
|
||||
|
@ -148,13 +159,15 @@ void vRegisterSampleCLICommands( void )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvTaskStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * const pcHeader = "Task State Priority Stack #\r\n************************************************\r\n";
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -164,18 +177,20 @@ const char *const pcHeader = "Task State Priority Stack #\r\n********
|
|||
vTaskList( pcWriteBuffer + strlen( pcHeader ) );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvRunTimeStatsCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * const pcHeader = "Task Abs Time % Time\r\n****************************************\r\n";
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -185,20 +200,22 @@ const char * const pcHeader = "Task Abs Time % Time\r\n*********
|
|||
vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvThreeParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength, xReturn;
|
||||
static BaseType_t lParameterNumber = 0;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -206,15 +223,15 @@ static BaseType_t lParameterNumber = 0;
|
|||
if( lParameterNumber == 0 )
|
||||
{
|
||||
/* The first time the function is called after the command has been
|
||||
entered just a header string is returned. */
|
||||
* entered just a header string is returned. */
|
||||
sprintf( pcWriteBuffer, "The three parameters were:\r\n" );
|
||||
|
||||
/* Next time the function is called the first parameter will be echoed
|
||||
back. */
|
||||
* back. */
|
||||
lParameterNumber = 1L;
|
||||
|
||||
/* There is more data to be returned as no parameters have been echoed
|
||||
back yet. */
|
||||
* back yet. */
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
|
@ -237,11 +254,11 @@ static BaseType_t lParameterNumber = 0;
|
|||
strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
|
||||
|
||||
/* If this is the last of the three parameters then there are no more
|
||||
strings to return after this one. */
|
||||
* strings to return after this one. */
|
||||
if( lParameterNumber == 3L )
|
||||
{
|
||||
/* If this is the last of the three parameters then there are no more
|
||||
strings to return after this one. */
|
||||
* strings to return after this one. */
|
||||
xReturn = pdFALSE;
|
||||
lParameterNumber = 0L;
|
||||
}
|
||||
|
@ -257,15 +274,17 @@ static BaseType_t lParameterNumber = 0;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvParameterEchoCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t xParameterStringLength, xReturn;
|
||||
static BaseType_t lParameterNumber = 0;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -273,15 +292,15 @@ static BaseType_t lParameterNumber = 0;
|
|||
if( lParameterNumber == 0 )
|
||||
{
|
||||
/* The first time the function is called after the command has been
|
||||
entered just a header string is returned. */
|
||||
* entered just a header string is returned. */
|
||||
sprintf( pcWriteBuffer, "The parameters were:\r\n" );
|
||||
|
||||
/* Next time the function is called the first parameter will be echoed
|
||||
back. */
|
||||
* back. */
|
||||
lParameterNumber = 1L;
|
||||
|
||||
/* There is more data to be returned as no parameters have been echoed
|
||||
back yet. */
|
||||
* back yet. */
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
|
@ -309,7 +328,7 @@ static BaseType_t lParameterNumber = 0;
|
|||
else
|
||||
{
|
||||
/* No more parameters were found. Make sure the write buffer does
|
||||
not contain a valid string. */
|
||||
* not contain a valid string. */
|
||||
pcWriteBuffer[ 0 ] = 0x00;
|
||||
|
||||
/* No more data to return. */
|
||||
|
@ -326,14 +345,16 @@ static BaseType_t lParameterNumber = 0;
|
|||
|
||||
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
|
||||
|
||||
static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
static BaseType_t prvStartStopTraceCommand( char * pcWriteBuffer,
|
||||
size_t xWriteBufferLen,
|
||||
const char * pcCommandString )
|
||||
{
|
||||
const char * pcParameter;
|
||||
BaseType_t lParameterStringLength;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
write buffer length is adequate, so does not check for buffer overflows. */
|
||||
* write buffer is not NULL. NOTE - for simplicity, this example assumes the
|
||||
* write buffer length is adequate, so does not check for buffer overflows. */
|
||||
( void ) pcCommandString;
|
||||
( void ) xWriteBufferLen;
|
||||
configASSERT( pcWriteBuffer );
|
||||
|
@ -371,7 +392,7 @@ static BaseType_t lParameterNumber = 0;
|
|||
}
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
* pdFALSE. */
|
||||
return pdFALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -20,7 +20,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -93,13 +93,14 @@ SOCKET xSocket;
|
|||
if( lBytes == SOCKET_ERROR )
|
||||
{
|
||||
/* Something went wrong, but it is not handled by this simple
|
||||
example. */
|
||||
* example. */
|
||||
iErrorCode = WSAGetLastError();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Process each received byte in turn. */
|
||||
lByte = 0;
|
||||
|
||||
while( lByte < lBytes )
|
||||
{
|
||||
/* The next character in the input buffer. */
|
||||
|
@ -107,30 +108,29 @@ SOCKET xSocket;
|
|||
lByte++;
|
||||
|
||||
/* Newline characters are taken as the end of the command
|
||||
string. */
|
||||
* string. */
|
||||
if( cInChar == '\n' )
|
||||
{
|
||||
/* Process the input string received prior to the
|
||||
newline. */
|
||||
* newline. */
|
||||
do
|
||||
{
|
||||
/* Pass the string to FreeRTOS+CLI. */
|
||||
xMoreDataToFollow = FreeRTOS_CLIProcessCommand( cInputString, cOutputString, cmdMAX_OUTPUT_SIZE );
|
||||
|
||||
/* Send the output generated by the command's
|
||||
implementation. */
|
||||
* implementation. */
|
||||
sendto( xSocket, cOutputString, strlen( cOutputString ), 0, ( SOCKADDR * ) &xClient, xClientAddressLength );
|
||||
|
||||
} while( xMoreDataToFollow != pdFALSE ); /* Until the command does not generate any more output. */
|
||||
|
||||
/* All the strings generated by the command processing
|
||||
have been sent. Clear the input string ready to receive
|
||||
the next command. */
|
||||
* have been sent. Clear the input string ready to receive
|
||||
* the next command. */
|
||||
cInputIndex = 0;
|
||||
memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );
|
||||
|
||||
/* Transmit a spacer, just to make the command console
|
||||
easier to read. */
|
||||
* easier to read. */
|
||||
sendto( xSocket, "\r\n", strlen( "\r\n" ), 0, ( SOCKADDR * ) &xClient, xClientAddressLength );
|
||||
}
|
||||
else
|
||||
|
@ -138,12 +138,12 @@ SOCKET xSocket;
|
|||
if( cInChar == '\r' )
|
||||
{
|
||||
/* Ignore the character. Newlines are used to
|
||||
detect the end of the input string. */
|
||||
* detect the end of the input string. */
|
||||
}
|
||||
else if( ( cInChar == '\b' ) || ( cInChar == cmdASCII_DEL ) )
|
||||
{
|
||||
/* Backspace was pressed. Erase the last character
|
||||
in the string - if any. */
|
||||
* in the string - if any. */
|
||||
if( cInputIndex > 0 )
|
||||
{
|
||||
cInputIndex--;
|
||||
|
@ -153,8 +153,8 @@ SOCKET xSocket;
|
|||
else
|
||||
{
|
||||
/* A character was entered. Add it to the string
|
||||
entered so far. When a \n is entered the complete
|
||||
string will be passed to the command interpreter. */
|
||||
* entered so far. When a \n is entered the complete
|
||||
* string will be passed to the command interpreter. */
|
||||
if( cInputIndex < cmdMAX_INPUT_SIZE )
|
||||
{
|
||||
cInputString[ cInputIndex ] = cInChar;
|
||||
|
@ -191,6 +191,7 @@ SOCKET xSocket = INVALID_SOCKET;
|
|||
else
|
||||
{
|
||||
xSocket = socket( AF_INET, SOCK_DGRAM, 0 );
|
||||
|
||||
if( xSocket == INVALID_SOCKET )
|
||||
{
|
||||
fprintf( stderr, "Could not create socket.\n" );
|
||||
|
@ -224,5 +225,3 @@ SOCKET xSocket = INVALID_SOCKET;
|
|||
|
||||
return xSocket;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -71,27 +71,27 @@ extern void vCreateAndVerifySampleFiles( void );
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* See http://www.freertos.org/FreeRTOS-Plus/Fail_Safe_File_System/Fail_Safe_Embedded_File_System_demo.shtml
|
||||
for instructions. */
|
||||
* for instructions. */
|
||||
|
||||
int main( void )
|
||||
{
|
||||
const uint32_t ulLongTime_ms = 250UL;
|
||||
|
||||
/* Initialise the drive and file system, then create a few example
|
||||
files. The output from this function just goes to the stdout window,
|
||||
allowing the output to be viewed when the UDP command console is not
|
||||
connected. */
|
||||
* files. The output from this function just goes to the stdout window,
|
||||
* allowing the output to be viewed when the UDP command console is not
|
||||
* connected. */
|
||||
vCreateAndVerifySampleFiles();
|
||||
|
||||
/* Register generic commands with the FreeRTOS+CLI command interpreter. */
|
||||
vRegisterSampleCLICommands();
|
||||
|
||||
/* Register file system related commands with the FreeRTOS+CLI command
|
||||
interpreter. */
|
||||
* interpreter. */
|
||||
vRegisterFileSystemCLICommands();
|
||||
|
||||
/* Create the task that handles the CLI on a UDP port. The port number
|
||||
is set using the configUDP_CLI_PORT_NUMBER setting in FreeRTOSConfig.h. */
|
||||
* is set using the configUDP_CLI_PORT_NUMBER setting in FreeRTOSConfig.h. */
|
||||
xTaskCreate( vUDPCommandInterpreterTask, /* The function that implements the command interpreter IO handling. */
|
||||
"CLI", /* The name of the task - just to assist debugging. */
|
||||
configMINIMAL_STACK_SIZE, NULL, /* The size of the stack allocated to the task. */
|
||||
|
@ -102,11 +102,11 @@ const uint32_t ulLongTime_ms = 250UL;
|
|||
vTaskStartScheduler();
|
||||
|
||||
/* If all is well, the scheduler will now be running, and the following
|
||||
line will never be reached. If the following line does execute, then
|
||||
there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
timer tasks to be created. See the memory management section on the
|
||||
FreeRTOS web site for more details (this is standard text that is not
|
||||
really applicable to the Win32 simulator port). */
|
||||
* line will never be reached. If the following line does execute, then
|
||||
* there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
* timer tasks to be created. See the memory management section on the
|
||||
* FreeRTOS web site for more details (this is standard text that is not
|
||||
* really applicable to the Win32 simulator port). */
|
||||
for( ; ; )
|
||||
{
|
||||
Sleep( ulLongTime_ms );
|
||||
|
@ -119,8 +119,8 @@ void vApplicationIdleHook( void )
|
|||
const unsigned long ulMSToSleep = 5;
|
||||
|
||||
/* This function is called on each cycle of the idle task if
|
||||
configUSE_IDLE_HOOK is set to 1 in FreeRTOSConfig.h. Sleep to reduce CPU
|
||||
load. */
|
||||
* configUSE_IDLE_HOOK is set to 1 in FreeRTOSConfig.h. Sleep to reduce CPU
|
||||
* load. */
|
||||
Sleep( ulMSToSleep );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -128,19 +128,19 @@ const unsigned long ulMSToSleep = 5;
|
|||
void vApplicationMallocFailedHook( void )
|
||||
{
|
||||
/* vApplicationMallocFailedHook() will only be called if
|
||||
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
|
||||
function that will get called if a call to pvPortMalloc() fails.
|
||||
pvPortMalloc() is called internally by the kernel whenever a task, queue,
|
||||
timer or semaphore is created. It is also called by various parts of the
|
||||
demo application. If heap_1.c, heap_2.c or heap_4.c are used, then the
|
||||
size of the heap available to pvPortMalloc() is defined by
|
||||
configTOTAL_HEAP_SIZE in FreeRTOSConfig.h, and the xPortGetFreeHeapSize()
|
||||
API function can be used to query the size of free heap space that remains
|
||||
(although it does not provide information on how the remaining heap might
|
||||
be fragmented). */
|
||||
* configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
|
||||
* function that will get called if a call to pvPortMalloc() fails.
|
||||
* pvPortMalloc() is called internally by the kernel whenever a task, queue,
|
||||
* timer or semaphore is created. It is also called by various parts of the
|
||||
* demo application. If heap_1.c, heap_2.c or heap_4.c are used, then the
|
||||
* size of the heap available to pvPortMalloc() is defined by
|
||||
* configTOTAL_HEAP_SIZE in FreeRTOSConfig.h, and the xPortGetFreeHeapSize()
|
||||
* API function can be used to query the size of free heap space that remains
|
||||
* (although it does not provide information on how the remaining heap might
|
||||
* be fragmented). */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; );
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -416,5 +416,5 @@
|
|||
return eDHCPContinue;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* if ( ( ipconfigUSE_TCP == 1 ) && ( ipconfigUSE_DHCP_HOOK != 0 ) ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -31,9 +31,8 @@
|
|||
* Create the TCP echo client tasks. This is the version where an echo request
|
||||
* is made from the same task that listens for the echo reply.
|
||||
*/
|
||||
void vStartTCPEchoClientTasks_SingleTasks( size_t uxTaskStackSize, UBaseType_t uxTaskPriority );
|
||||
void vStartTCPEchoClientTasks_SingleTasks( size_t uxTaskStackSize,
|
||||
UBaseType_t uxTaskPriority );
|
||||
BaseType_t xAreSingleTaskTCPEchoClientsStillRunning( void );
|
||||
|
||||
#endif /* SINGLE_TASK_TCP_ECHO_CLIENTS_H */
|
||||
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ static BaseType_t prvTaskQueryFunctions( void )
|
|||
BaseType_t xReturn = pdPASS;
|
||||
UBaseType_t uxNumberOfTasks, uxReturned, ux;
|
||||
uint32_t ulTotalRunTime1, ulTotalRunTime2;
|
||||
const uint32_t ulRunTimeTollerance = ( uint32_t ) 0xfff;
|
||||
const uint32_t ulRunTimeTolerance = ( uint32_t ) 0xfff;
|
||||
|
||||
/* Obtain task status with the stack high water mark and without the
|
||||
* state. */
|
||||
|
@ -464,12 +464,12 @@ static BaseType_t prvTaskQueryFunctions( void )
|
|||
memset( ( void * ) pxStatusArray, 0xaa, uxNumberOfTasks * sizeof( TaskStatus_t ) );
|
||||
uxReturned = uxTaskGetSystemState( pxStatusArray, uxNumberOfTasks, &ulTotalRunTime2 );
|
||||
|
||||
if( ( ulTotalRunTime2 - ulTotalRunTime1 ) > ulRunTimeTollerance )
|
||||
if( ( ulTotalRunTime2 - ulTotalRunTime1 ) > ulRunTimeTolerance )
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
/* Basic santity check of array contents. */
|
||||
/* Basic sanity check of array contents. */
|
||||
for( ux = 0; ux < uxReturned; ux++ )
|
||||
{
|
||||
if( pxStatusArray[ ux ].eCurrentState >= ( UBaseType_t ) eInvalid )
|
||||
|
|
|
@ -35,7 +35,8 @@ extern "C" {
|
|||
*----------------------------------------------------------*/
|
||||
|
||||
void console_init( void );
|
||||
void console_print(const char *fmt, ...);
|
||||
void console_print( const char * fmt,
|
||||
... );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -160,7 +160,6 @@ void main_tcp_echo_client_tasks( void )
|
|||
memcpy( ipLOCAL_MAC_ADDRESS, ucMACAddress, sizeof( ucMACAddress ) );
|
||||
|
||||
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
|
||||
|
||||
extern NetworkInterface_t * pxLibslirp_FillInterfaceDescriptor( BaseType_t xEMACIndex,
|
||||
NetworkInterface_t * pxInterface );
|
||||
pxLibslirp_FillInterfaceDescriptor( 0, &( xInterfaces[ 0 ] ) );
|
||||
|
@ -175,7 +174,7 @@ void main_tcp_echo_client_tasks( void )
|
|||
#endif /* ( ipconfigUSE_DHCP != 0 ) */
|
||||
|
||||
FreeRTOS_IPInit_Multi();
|
||||
#else
|
||||
#else /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
/* Using the old /single /IPv4 library, or using backward compatible mode of the new /multi library. */
|
||||
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
|
||||
#endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
|
||||
|
|
20
FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/CMSIS/CMSDK_CM3.h
Executable file → Normal file
20
FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/CMSIS/CMSDK_CM3.h
Executable file → Normal file
|
@ -124,9 +124,9 @@ typedef enum IRQn
|
|||
/* anonymous unions are enabled by default */
|
||||
#elif defined( __TASKING__ )
|
||||
#pragma warning 586
|
||||
#else
|
||||
#else /* if defined( __CC_ARM ) */
|
||||
#warning Not supported compiler type
|
||||
#endif
|
||||
#endif /* if defined( __CC_ARM ) */
|
||||
|
||||
/*------------- Universal Asynchronous Receiver Transmitter (UART) -----------*/
|
||||
typedef struct
|
||||
|
@ -134,12 +134,12 @@ typedef struct
|
|||
__IO uint32_t DATA; /* Offset: 0x000 (R/W) Data Register */
|
||||
__IO uint32_t STATE; /* Offset: 0x004 (R/W) Status Register */
|
||||
__IO uint32_t CTRL; /* Offset: 0x008 (R/W) Control Register */
|
||||
union {
|
||||
union
|
||||
{
|
||||
__I uint32_t INTSTATUS; /* Offset: 0x00C (R/ ) Interrupt Status Register */
|
||||
__O uint32_t INTCLEAR; /* Offset: 0x00C ( /W) Interrupt Clear Register */
|
||||
};
|
||||
__IO uint32_t BAUDDIV; /* Offset: 0x010 (R/W) Baudrate Divider Register */
|
||||
|
||||
} CMSDK_UART_TypeDef;
|
||||
|
||||
/* CMSDK_UART DATA Register Definitions */
|
||||
|
@ -202,11 +202,11 @@ typedef struct
|
|||
__IO uint32_t CTRL; /* Offset: 0x000 (R/W) Control Register */
|
||||
__IO uint32_t VALUE; /* Offset: 0x004 (R/W) Current Value Register */
|
||||
__IO uint32_t RELOAD; /* Offset: 0x008 (R/W) Reload Value Register */
|
||||
union {
|
||||
union
|
||||
{
|
||||
__I uint32_t INTSTATUS; /* Offset: 0x00C (R/ ) Interrupt Status Register */
|
||||
__O uint32_t INTCLEAR; /* Offset: 0x00C ( /W) Interrupt Clear Register */
|
||||
};
|
||||
|
||||
} CMSDK_TIMER_TypeDef;
|
||||
|
||||
/* CMSDK_TIMER CTRL Register Definitions */
|
||||
|
@ -396,7 +396,8 @@ typedef struct
|
|||
__IO uint32_t INTTYPECLR; /* Offset: 0x02C (R/W) Interrupt Type Clear Register */
|
||||
__IO uint32_t INTPOLSET; /* Offset: 0x030 (R/W) Interrupt Polarity Set Register */
|
||||
__IO uint32_t INTPOLCLR; /* Offset: 0x034 (R/W) Interrupt Polarity Clear Register */
|
||||
union {
|
||||
union
|
||||
{
|
||||
__I uint32_t INTSTATUS; /* Offset: 0x038 (R/ ) Interrupt Status Register */
|
||||
__O uint32_t INTCLEAR; /* Offset: 0x038 ( /W) Interrupt Clear Register */
|
||||
};
|
||||
|
@ -516,7 +517,6 @@ typedef struct
|
|||
__O uint32_t CHNL_PRIORITY_CLR; /* Offset: 0x03C ( /W) Channel Priority Clear Register */
|
||||
uint32_t RESERVED0[ 3 ];
|
||||
__IO uint32_t ERR_CLR; /* Offset: 0x04C Bus Error Clear Register (R/W) */
|
||||
|
||||
} CMSDK_PL230_TypeDef;
|
||||
|
||||
#define PL230_DMA_CHNL_BITS 0
|
||||
|
@ -594,7 +594,6 @@ typedef struct
|
|||
/*------------------- Watchdog ----------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
|
||||
__IO uint32_t LOAD; /* Offset: 0x000 (R/W) Watchdog Load Register */
|
||||
__I uint32_t VALUE; /* Offset: 0x004 (R/ ) Watchdog Value Register */
|
||||
__IO uint32_t CTRL; /* Offset: 0x008 (R/W) Watchdog Control Register */
|
||||
|
@ -653,8 +652,7 @@ typedef struct
|
|||
#pragma warning restore
|
||||
#else
|
||||
#warning Not supported compiler type
|
||||
#endif
|
||||
|
||||
#endif /* if defined( __CC_ARM ) */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -48,41 +48,41 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
__IO uint32_t LED; // Offset: 0x000 (R/W) LED connections
|
||||
// [31:2] : Reserved
|
||||
// [1:0] : LEDs
|
||||
__IO uint32_t LED; /* Offset: 0x000 (R/W) LED connections */
|
||||
/* [31:2] : Reserved */
|
||||
/* [1:0] : LEDs */
|
||||
uint32_t RESERVED1[ 1 ];
|
||||
__IO uint32_t BUTTON; // Offset: 0x008 (R/W) Buttons
|
||||
// [31:2] : Reserved
|
||||
// [1:0] : Buttons
|
||||
__IO uint32_t BUTTON; /* Offset: 0x008 (R/W) Buttons */
|
||||
/* [31:2] : Reserved */
|
||||
/* [1:0] : Buttons */
|
||||
uint32_t RESERVED2[ 1 ];
|
||||
__IO uint32_t CLK1HZ; // Offset: 0x010 (R/W) 1Hz up counter
|
||||
__IO uint32_t CLK100HZ; // Offset: 0x014 (R/W) 100Hz up counter
|
||||
__IO uint32_t COUNTER; // Offset: 0x018 (R/W) Cycle Up Counter
|
||||
// Increments when 32-bit prescale counter reach zero
|
||||
__IO uint32_t CLK1HZ; /* Offset: 0x010 (R/W) 1Hz up counter */
|
||||
__IO uint32_t CLK100HZ; /* Offset: 0x014 (R/W) 100Hz up counter */
|
||||
__IO uint32_t COUNTER; /* Offset: 0x018 (R/W) Cycle Up Counter */
|
||||
/* Increments when 32-bit prescale counter reach zero */
|
||||
uint32_t RESERVED3[ 1 ];
|
||||
__IO uint32_t PRESCALE; // Offset: 0x020 (R/W) Prescaler
|
||||
// Bit[31:0] : reload value for prescale counter
|
||||
__IO uint32_t PSCNTR; // Offset: 0x024 (R/W) 32-bit Prescale counter
|
||||
// current value of the pre-scaler counter
|
||||
// The Cycle Up Counter increment when the prescale down counter reach 0
|
||||
// The pre-scaler counter is reloaded with PRESCALE after reaching 0.
|
||||
__IO uint32_t PRESCALE; /* Offset: 0x020 (R/W) Prescaler */
|
||||
/* Bit[31:0] : reload value for prescale counter */
|
||||
__IO uint32_t PSCNTR; /* Offset: 0x024 (R/W) 32-bit Prescale counter */
|
||||
/* current value of the pre-scaler counter */
|
||||
/* The Cycle Up Counter increment when the prescale down counter reach 0 */
|
||||
/* The pre-scaler counter is reloaded with PRESCALE after reaching 0. */
|
||||
uint32_t RESERVED4[ 9 ];
|
||||
__IO uint32_t MISC; // Offset: 0x04C (R/W) Misc control */
|
||||
// [31:10] : Reserved
|
||||
// [9] : SHIELD_1_SPI_nCS
|
||||
// [8] : SHIELD_0_SPI_nCS
|
||||
// [7] : ADC_SPI_nCS
|
||||
// [6] : CLCD_BL_CTRL
|
||||
// [5] : CLCD_RD
|
||||
// [4] : CLCD_RS
|
||||
// [3] : CLCD_RESET
|
||||
// [2] : RESERVED
|
||||
// [1] : SPI_nSS
|
||||
// [0] : CLCD_CS
|
||||
__IO uint32_t MISC; /* Offset: 0x04C (R/W) Misc control * / */
|
||||
/* [31:10] : Reserved */
|
||||
/* [9] : SHIELD_1_SPI_nCS */
|
||||
/* [8] : SHIELD_0_SPI_nCS */
|
||||
/* [7] : ADC_SPI_nCS */
|
||||
/* [6] : CLCD_BL_CTRL */
|
||||
/* [5] : CLCD_RD */
|
||||
/* [4] : CLCD_RS */
|
||||
/* [3] : CLCD_RESET */
|
||||
/* [2] : RESERVED */
|
||||
/* [1] : SPI_nSS */
|
||||
/* [0] : CLCD_CS */
|
||||
} MPS2_FPGAIO_TypeDef;
|
||||
|
||||
// MISC register bit definitions
|
||||
/* MISC register bit definitions */
|
||||
|
||||
#define CLCD_CS_Pos 0
|
||||
#define CLCD_CS_Msk ( 1UL << CLCD_CS_Pos )
|
||||
|
@ -107,58 +107,58 @@ typedef struct
|
|||
/* SCC Register declaration */
|
||||
/******************************************************************************/
|
||||
|
||||
typedef struct //
|
||||
typedef struct /* */
|
||||
{
|
||||
__IO uint32_t CFG_REG0; // Offset: 0x000 (R/W) Remaps block RAM to ZBT
|
||||
// [31:1] : Reserved
|
||||
// [0] 1 : REMAP BlockRam to ZBT
|
||||
__IO uint32_t LEDS; // Offset: 0x004 (R/W) Controls the MCC user LEDs
|
||||
// [31:8] : Reserved
|
||||
// [7:0] : MCC LEDs
|
||||
__IO uint32_t CFG_REG0; /* Offset: 0x000 (R/W) Remaps block RAM to ZBT */
|
||||
/* [31:1] : Reserved */
|
||||
/* [0] 1 : REMAP BlockRam to ZBT */
|
||||
__IO uint32_t LEDS; /* Offset: 0x004 (R/W) Controls the MCC user LEDs */
|
||||
/* [31:8] : Reserved */
|
||||
/* [7:0] : MCC LEDs */
|
||||
uint32_t RESERVED0[ 1 ];
|
||||
__I uint32_t SWITCHES; // Offset: 0x00C (R/ ) Denotes the state of the MCC user switches
|
||||
// [31:8] : Reserved
|
||||
// [7:0] : These bits indicate state of the MCC switches
|
||||
__I uint32_t CFG_REG4; // Offset: 0x010 (R/ ) Denotes the board revision
|
||||
// [31:4] : Reserved
|
||||
// [3:0] : Used by the MCC to pass PCB revision. 0 = A 1 = B
|
||||
__I uint32_t SWITCHES; /* Offset: 0x00C (R/ ) Denotes the state of the MCC user switches */
|
||||
/* [31:8] : Reserved */
|
||||
/* [7:0] : These bits indicate state of the MCC switches */
|
||||
__I uint32_t CFG_REG4; /* Offset: 0x010 (R/ ) Denotes the board revision */
|
||||
/* [31:4] : Reserved */
|
||||
/* [3:0] : Used by the MCC to pass PCB revision. 0 = A 1 = B */
|
||||
uint32_t RESERVED1[ 35 ];
|
||||
__IO uint32_t SYS_CFGDATA_RTN; // Offset: 0x0A0 (R/W) User data register
|
||||
// [31:0] : Data
|
||||
__IO uint32_t SYS_CFGDATA_OUT; // Offset: 0x0A4 (R/W) User data register
|
||||
// [31:0] : Data
|
||||
__IO uint32_t SYS_CFGCTRL; // Offset: 0x0A8 (R/W) Control register
|
||||
// [31] : Start (generates interrupt on write to this bit)
|
||||
// [30] : R/W access
|
||||
// [29:26] : Reserved
|
||||
// [25:20] : Function value
|
||||
// [19:12] : Reserved
|
||||
// [11:0] : Device (value of 0/1/2 for supported clocks)
|
||||
__IO uint32_t SYS_CFGSTAT; // Offset: 0x0AC (R/W) Contains status information
|
||||
// [31:2] : Reserved
|
||||
// [1] : Error
|
||||
// [0] : Complete
|
||||
__IO uint32_t SYS_CFGDATA_RTN; /* Offset: 0x0A0 (R/W) User data register */
|
||||
/* [31:0] : Data */
|
||||
__IO uint32_t SYS_CFGDATA_OUT; /* Offset: 0x0A4 (R/W) User data register */
|
||||
/* [31:0] : Data */
|
||||
__IO uint32_t SYS_CFGCTRL; /* Offset: 0x0A8 (R/W) Control register */
|
||||
/* [31] : Start (generates interrupt on write to this bit) */
|
||||
/* [30] : R/W access */
|
||||
/* [29:26] : Reserved */
|
||||
/* [25:20] : Function value */
|
||||
/* [19:12] : Reserved */
|
||||
/* [11:0] : Device (value of 0/1/2 for supported clocks) */
|
||||
__IO uint32_t SYS_CFGSTAT; /* Offset: 0x0AC (R/W) Contains status information */
|
||||
/* [31:2] : Reserved */
|
||||
/* [1] : Error */
|
||||
/* [0] : Complete */
|
||||
__IO uint32_t RESERVED2[ 20 ];
|
||||
__IO uint32_t SCC_DLL; // Offset: 0x100 (R/W) DLL Lock Register
|
||||
// [31:24] : DLL LOCK MASK[7:0] - Indicate if the DLL locked is masked
|
||||
// [23:16] : DLL LOCK MASK[7:0] - Indicate if the DLLs are locked or unlocked
|
||||
// [15:1] : Reserved
|
||||
// [0] : This bit indicates if all enabled DLLs are locked
|
||||
__IO uint32_t SCC_DLL; /* Offset: 0x100 (R/W) DLL Lock Register */
|
||||
/* [31:24] : DLL LOCK MASK[7:0] - Indicate if the DLL locked is masked */
|
||||
/* [23:16] : DLL LOCK MASK[7:0] - Indicate if the DLLs are locked or unlocked */
|
||||
/* [15:1] : Reserved */
|
||||
/* [0] : This bit indicates if all enabled DLLs are locked */
|
||||
uint32_t RESERVED3[ 957 ];
|
||||
__I uint32_t SCC_AID; // Offset: 0xFF8 (R/ ) SCC AID Register
|
||||
// [31:24] : FPGA build number
|
||||
// [23:20] : V2M-MPS2 target board revision (A = 0, B = 1)
|
||||
// [19:11] : Reserved
|
||||
// [10] : if “1” SCC_SW register has been implemented
|
||||
// [9] : if “1” SCC_LED register has been implemented
|
||||
// [8] : if “1” DLL lock register has been implemented
|
||||
// [7:0] : number of SCC configuration register
|
||||
__I uint32_t SCC_ID; // Offset: 0xFFC (R/ ) Contains information about the FPGA image
|
||||
// [31:24] : Implementer ID: 0x41 = ARM
|
||||
// [23:20] : Application note IP variant number
|
||||
// [19:16] : IP Architecture: 0x4 =AHB
|
||||
// [15:4] : Primary part number: 386 = AN386
|
||||
// [3:0] : Application note IP revision number
|
||||
__I uint32_t SCC_AID; /* Offset: 0xFF8 (R/ ) SCC AID Register */
|
||||
/* [31:24] : FPGA build number */
|
||||
/* [23:20] : V2M-MPS2 target board revision (A = 0, B = 1) */
|
||||
/* [19:11] : Reserved */
|
||||
/* [10] : if “1” SCC_SW register has been implemented */
|
||||
/* [9] : if “1” SCC_LED register has been implemented */
|
||||
/* [8] : if “1” DLL lock register has been implemented */
|
||||
/* [7:0] : number of SCC configuration register */
|
||||
__I uint32_t SCC_ID; /* Offset: 0xFFC (R/ ) Contains information about the FPGA image */
|
||||
/* [31:24] : Implementer ID: 0x41 = ARM */
|
||||
/* [23:20] : Application note IP variant number */
|
||||
/* [19:16] : IP Architecture: 0x4 =AHB */
|
||||
/* [15:4] : Primary part number: 386 = AN386 */
|
||||
/* [3:0] : Application note IP revision number */
|
||||
} MPS2_SCC_TypeDef;
|
||||
|
||||
|
||||
|
@ -166,148 +166,148 @@ typedef struct //
|
|||
/* SSP Peripheral declaration */
|
||||
/******************************************************************************/
|
||||
|
||||
typedef struct // Document DDI0194G_ssp_pl022_r1p3_trm.pdf
|
||||
typedef struct /* Document DDI0194G_ssp_pl022_r1p3_trm.pdf */
|
||||
{
|
||||
__IO uint32_t CR0; // Offset: 0x000 (R/W) Control register 0
|
||||
// [31:16] : Reserved
|
||||
// [15:8] : Serial clock rate
|
||||
// [7] : SSPCLKOUT phase, applicable to Motorola SPI frame format only
|
||||
// [6] : SSPCLKOUT polarity, applicable to Motorola SPI frame format only
|
||||
// [5:4] : Frame format
|
||||
// [3:0] : Data Size Select
|
||||
__IO uint32_t CR1; // Offset: 0x004 (R/W) Control register 1
|
||||
// [31:4] : Reserved
|
||||
// [3] : Slave-mode output disable
|
||||
// [2] : Master or slave mode select
|
||||
// [1] : Synchronous serial port enable
|
||||
// [0] : Loop back mode
|
||||
__IO uint32_t DR; // Offset: 0x008 (R/W) Data register
|
||||
// [31:16] : Reserved
|
||||
// [15:0] : Transmit/Receive FIFO
|
||||
__I uint32_t SR; // Offset: 0x00C (R/ ) Status register
|
||||
// [31:5] : Reserved
|
||||
// [4] : PrimeCell SSP busy flag
|
||||
// [3] : Receive FIFO full
|
||||
// [2] : Receive FIFO not empty
|
||||
// [1] : Transmit FIFO not full
|
||||
// [0] : Transmit FIFO empty
|
||||
__IO uint32_t CPSR; // Offset: 0x010 (R/W) Clock prescale register
|
||||
// [31:8] : Reserved
|
||||
// [8:0] : Clock prescale divisor
|
||||
__IO uint32_t IMSC; // Offset: 0x014 (R/W) Interrupt mask set or clear register
|
||||
// [31:4] : Reserved
|
||||
// [3] : Transmit FIFO interrupt mask
|
||||
// [2] : Receive FIFO interrupt mask
|
||||
// [1] : Receive timeout interrupt mask
|
||||
// [0] : Receive overrun interrupt mask
|
||||
__I uint32_t RIS; // Offset: 0x018 (R/ ) Raw interrupt status register
|
||||
// [31:4] : Reserved
|
||||
// [3] : raw interrupt state, prior to masking, of the SSPTXINTR interrupt
|
||||
// [2] : raw interrupt state, prior to masking, of the SSPRXINTR interrupt
|
||||
// [1] : raw interrupt state, prior to masking, of the SSPRTINTR interrupt
|
||||
// [0] : raw interrupt state, prior to masking, of the SSPRORINTR interrupt
|
||||
__I uint32_t MIS; // Offset: 0x01C (R/ ) Masked interrupt status register
|
||||
// [31:4] : Reserved
|
||||
// [3] : transmit FIFO masked interrupt state, after masking, of the SSPTXINTR interrupt
|
||||
// [2] : receive FIFO masked interrupt state, after masking, of the SSPRXINTR interrupt
|
||||
// [1] : receive timeout masked interrupt state, after masking, of the SSPRTINTR interrupt
|
||||
// [0] : receive over run masked interrupt status, after masking, of the SSPRORINTR interrupt
|
||||
__O uint32_t ICR; // Offset: 0x020 ( /W) Interrupt clear register
|
||||
// [31:2] : Reserved
|
||||
// [1] : Clears the SSPRTINTR interrupt
|
||||
// [0] : Clears the SSPRORINTR interrupt
|
||||
__IO uint32_t DMACR; // Offset: 0x024 (R/W) DMA control register
|
||||
// [31:2] : Reserved
|
||||
// [1] : Transmit DMA Enable
|
||||
// [0] : Receive DMA Enable
|
||||
__IO uint32_t CR0; /* Offset: 0x000 (R/W) Control register 0 */
|
||||
/* [31:16] : Reserved */
|
||||
/* [15:8] : Serial clock rate */
|
||||
/* [7] : SSPCLKOUT phase, applicable to Motorola SPI frame format only */
|
||||
/* [6] : SSPCLKOUT polarity, applicable to Motorola SPI frame format only */
|
||||
/* [5:4] : Frame format */
|
||||
/* [3:0] : Data Size Select */
|
||||
__IO uint32_t CR1; /* Offset: 0x004 (R/W) Control register 1 */
|
||||
/* [31:4] : Reserved */
|
||||
/* [3] : Slave-mode output disable */
|
||||
/* [2] : Master or slave mode select */
|
||||
/* [1] : Synchronous serial port enable */
|
||||
/* [0] : Loop back mode */
|
||||
__IO uint32_t DR; /* Offset: 0x008 (R/W) Data register */
|
||||
/* [31:16] : Reserved */
|
||||
/* [15:0] : Transmit/Receive FIFO */
|
||||
__I uint32_t SR; /* Offset: 0x00C (R/ ) Status register */
|
||||
/* [31:5] : Reserved */
|
||||
/* [4] : PrimeCell SSP busy flag */
|
||||
/* [3] : Receive FIFO full */
|
||||
/* [2] : Receive FIFO not empty */
|
||||
/* [1] : Transmit FIFO not full */
|
||||
/* [0] : Transmit FIFO empty */
|
||||
__IO uint32_t CPSR; /* Offset: 0x010 (R/W) Clock prescale register */
|
||||
/* [31:8] : Reserved */
|
||||
/* [8:0] : Clock prescale divisor */
|
||||
__IO uint32_t IMSC; /* Offset: 0x014 (R/W) Interrupt mask set or clear register */
|
||||
/* [31:4] : Reserved */
|
||||
/* [3] : Transmit FIFO interrupt mask */
|
||||
/* [2] : Receive FIFO interrupt mask */
|
||||
/* [1] : Receive timeout interrupt mask */
|
||||
/* [0] : Receive overrun interrupt mask */
|
||||
__I uint32_t RIS; /* Offset: 0x018 (R/ ) Raw interrupt status register */
|
||||
/* [31:4] : Reserved */
|
||||
/* [3] : raw interrupt state, prior to masking, of the SSPTXINTR interrupt */
|
||||
/* [2] : raw interrupt state, prior to masking, of the SSPRXINTR interrupt */
|
||||
/* [1] : raw interrupt state, prior to masking, of the SSPRTINTR interrupt */
|
||||
/* [0] : raw interrupt state, prior to masking, of the SSPRORINTR interrupt */
|
||||
__I uint32_t MIS; /* Offset: 0x01C (R/ ) Masked interrupt status register */
|
||||
/* [31:4] : Reserved */
|
||||
/* [3] : transmit FIFO masked interrupt state, after masking, of the SSPTXINTR interrupt */
|
||||
/* [2] : receive FIFO masked interrupt state, after masking, of the SSPRXINTR interrupt */
|
||||
/* [1] : receive timeout masked interrupt state, after masking, of the SSPRTINTR interrupt */
|
||||
/* [0] : receive over run masked interrupt status, after masking, of the SSPRORINTR interrupt */
|
||||
__O uint32_t ICR; /* Offset: 0x020 ( /W) Interrupt clear register */
|
||||
/* [31:2] : Reserved */
|
||||
/* [1] : Clears the SSPRTINTR interrupt */
|
||||
/* [0] : Clears the SSPRORINTR interrupt */
|
||||
__IO uint32_t DMACR; /* Offset: 0x024 (R/W) DMA control register */
|
||||
/* [31:2] : Reserved */
|
||||
/* [1] : Transmit DMA Enable */
|
||||
/* [0] : Receive DMA Enable */
|
||||
} MPS2_SSP_TypeDef;
|
||||
|
||||
|
||||
// SSP_CR0 Control register 0
|
||||
#define SSP_CR0_DSS_Pos 0 // Data Size Select
|
||||
/* SSP_CR0 Control register 0 */
|
||||
#define SSP_CR0_DSS_Pos 0 /* Data Size Select */
|
||||
#define SSP_CR0_DSS_Msk ( 0xF << SSP_CR0_DSS_Pos )
|
||||
#define SSP_CR0_FRF_Pos 4 // Frame Format Select
|
||||
#define SSP_CR0_FRF_Pos 4 /* Frame Format Select */
|
||||
#define SSP_CR0_FRF_Msk ( 3UL << SSP_CR0_FRM_Pos )
|
||||
#define SSP_CR0_SPO_Pos 6 // SSPCLKOUT polarity
|
||||
#define SSP_CR0_SPO_Pos 6 /* SSPCLKOUT polarity */
|
||||
#define SSP_CR0_SPO_Msk ( 1UL << SSP_CR0_SPO_Pos )
|
||||
#define SSP_CR0_SPH_Pos 7 // SSPCLKOUT phase
|
||||
#define SSP_CR0_SPH_Pos 7 /* SSPCLKOUT phase */
|
||||
#define SSP_CR0_SPH_Msk ( 1UL << SSP_CR0_SPH_Pos )
|
||||
#define SSP_CR0_SCR_Pos 8 // Serial Clock Rate (divide)
|
||||
#define SSP_CR0_SCR_Pos 8 /* Serial Clock Rate (divide) */
|
||||
#define SSP_CR0_SCR_Msk ( 0xFF << SSP_CR0_SCR_Pos )
|
||||
|
||||
#define SSP_CR0_SCR_DFLT 0x0300 // Serial Clock Rate (divide), default set at 3
|
||||
#define SSP_CR0_FRF_MOT 0x0000 // Frame format, Motorola
|
||||
#define SSP_CR0_DSS_8 0x0007 // Data packet size, 8bits
|
||||
#define SSP_CR0_DSS_16 0x000F // Data packet size, 16bits
|
||||
#define SSP_CR0_SCR_DFLT 0x0300 /* Serial Clock Rate (divide), default set at 3 */
|
||||
#define SSP_CR0_FRF_MOT 0x0000 /* Frame format, Motorola */
|
||||
#define SSP_CR0_DSS_8 0x0007 /* Data packet size, 8bits */
|
||||
#define SSP_CR0_DSS_16 0x000F /* Data packet size, 16bits */
|
||||
|
||||
// SSP_CR1 Control register 1
|
||||
#define SSP_CR1_LBM_Pos 0 // Loop Back Mode
|
||||
/* SSP_CR1 Control register 1 */
|
||||
#define SSP_CR1_LBM_Pos 0 /* Loop Back Mode */
|
||||
#define SSP_CR1_LBM_Msk ( 1UL << SSP_CR1_LBM_Pos )
|
||||
#define SSP_CR1_SSE_Pos 1 // Serial port enable
|
||||
#define SSP_CR1_SSE_Pos 1 /* Serial port enable */
|
||||
#define SSP_CR1_SSE_Msk ( 1UL << SSP_CR1_SSE_Pos )
|
||||
#define SSP_CR1_MS_Pos 2 // Master or Slave mode
|
||||
#define SSP_CR1_MS_Pos 2 /* Master or Slave mode */
|
||||
#define SSP_CR1_MS_Msk ( 1UL << SSP_CR1_MS_Pos )
|
||||
#define SSP_CR1_SOD_Pos 3 // Slave Output mode Disable
|
||||
#define SSP_CR1_SOD_Pos 3 /* Slave Output mode Disable */
|
||||
#define SSP_CR1_SOD_Msk ( 1UL << SSP_CR1_SOD_Pos )
|
||||
|
||||
// SSP_SR Status register
|
||||
#define SSP_SR_TFE_Pos 0 // Transmit FIFO empty
|
||||
/* SSP_SR Status register */
|
||||
#define SSP_SR_TFE_Pos 0 /* Transmit FIFO empty */
|
||||
#define SSP_SR_TFE_Msk ( 1UL << SSP_SR_TFE_Pos )
|
||||
#define SSP_SR_TNF_Pos 1 // Transmit FIFO not full
|
||||
#define SSP_SR_TNF_Pos 1 /* Transmit FIFO not full */
|
||||
#define SSP_SR_TNF_Msk ( 1UL << SSP_SR_TNF_Pos )
|
||||
#define SSP_SR_RNE_Pos 2 // Receive FIFO not empty
|
||||
#define SSP_SR_RNE_Pos 2 /* Receive FIFO not empty */
|
||||
#define SSP_SR_RNE_Msk ( 1UL << SSP_SR_RNE_Pos )
|
||||
#define SSP_SR_RFF_Pos 3 // Receive FIFO full
|
||||
#define SSP_SR_RFF_Pos 3 /* Receive FIFO full */
|
||||
#define SSP_SR_RFF_Msk ( 1UL << SSP_SR_RFF_Pos )
|
||||
#define SSP_SR_BSY_Pos 4 // Busy
|
||||
#define SSP_SR_BSY_Pos 4 /* Busy */
|
||||
#define SSP_SR_BSY_Msk ( 1UL << SSP_SR_BSY_Pos )
|
||||
|
||||
// SSP_CPSR Clock prescale register
|
||||
#define SSP_CPSR_CPD_Pos 0 // Clock prescale divisor
|
||||
/* SSP_CPSR Clock prescale register */
|
||||
#define SSP_CPSR_CPD_Pos 0 /* Clock prescale divisor */
|
||||
#define SSP_CPSR_CPD_Msk ( 0xFF << SSP_CPSR_CDP_Pos )
|
||||
|
||||
#define SSP_CPSR_DFLT 0x0008 // Clock prescale (use with SCR), default set at 8
|
||||
#define SSP_CPSR_DFLT 0x0008 /* Clock prescale (use with SCR), default set at 8 */
|
||||
|
||||
// SSPIMSC Interrupt mask set and clear register
|
||||
#define SSP_IMSC_RORIM_Pos 0 // Receive overrun not Masked
|
||||
/* SSPIMSC Interrupt mask set and clear register */
|
||||
#define SSP_IMSC_RORIM_Pos 0 /* Receive overrun not Masked */
|
||||
#define SSP_IMSC_RORIM_Msk ( 1UL << SSP_IMSC_RORIM_Pos )
|
||||
#define SSP_IMSC_RTIM_Pos 1 // Receive timeout not Masked
|
||||
#define SSP_IMSC_RTIM_Pos 1 /* Receive timeout not Masked */
|
||||
#define SSP_IMSC_RTIM_Msk ( 1UL << SSP_IMSC_RTIM_Pos )
|
||||
#define SSP_IMSC_RXIM_Pos 2 // Receive FIFO not Masked
|
||||
#define SSP_IMSC_RXIM_Pos 2 /* Receive FIFO not Masked */
|
||||
#define SSP_IMSC_RXIM_Msk ( 1UL << SSP_IMSC_RXIM_Pos )
|
||||
#define SSP_IMSC_TXIM_Pos 3 // Transmit FIFO not Masked
|
||||
#define SSP_IMSC_TXIM_Pos 3 /* Transmit FIFO not Masked */
|
||||
#define SSP_IMSC_TXIM_Msk ( 1UL << SSP_IMSC_TXIM_Pos )
|
||||
|
||||
// SSPRIS Raw interrupt status register
|
||||
#define SSP_RIS_RORRIS_Pos 0 // Raw Overrun interrupt flag
|
||||
/* SSPRIS Raw interrupt status register */
|
||||
#define SSP_RIS_RORRIS_Pos 0 /* Raw Overrun interrupt flag */
|
||||
#define SSP_RIS_RORRIS_Msk ( 1UL << SSP_RIS_RORRIS_Pos )
|
||||
#define SSP_RIS_RTRIS_Pos 1 // Raw Timemout interrupt flag
|
||||
#define SSP_RIS_RTRIS_Pos 1 /* Raw Timeout interrupt flag */
|
||||
#define SSP_RIS_RTRIS_Msk ( 1UL << SSP_RIS_RTRIS_Pos )
|
||||
#define SSP_RIS_RXRIS_Pos 2 // Raw Receive interrupt flag
|
||||
#define SSP_RIS_RXRIS_Pos 2 /* Raw Receive interrupt flag */
|
||||
#define SSP_RIS_RXRIS_Msk ( 1UL << SSP_RIS_RXRIS_Pos )
|
||||
#define SSP_RIS_TXRIS_Pos 3 // Raw Transmit interrupt flag
|
||||
#define SSP_RIS_TXRIS_Pos 3 /* Raw Transmit interrupt flag */
|
||||
#define SSP_RIS_TXRIS_Msk ( 1UL << SSP_RIS_TXRIS_Pos )
|
||||
|
||||
// SSPMIS Masked interrupt status register
|
||||
#define SSP_MIS_RORMIS_Pos 0 // Masked Overrun interrupt flag
|
||||
/* SSPMIS Masked interrupt status register */
|
||||
#define SSP_MIS_RORMIS_Pos 0 /* Masked Overrun interrupt flag */
|
||||
#define SSP_MIS_RORMIS_Msk ( 1UL << SSP_MIS_RORMIS_Pos )
|
||||
#define SSP_MIS_RTMIS_Pos 1 // Masked Timemout interrupt flag
|
||||
#define SSP_MIS_RTMIS_Pos 1 /* Masked Timeout interrupt flag */
|
||||
#define SSP_MIS_RTMIS_Msk ( 1UL << SSP_MIS_RTMIS_Pos )
|
||||
#define SSP_MIS_RXMIS_Pos 2 // Masked Receive interrupt flag
|
||||
#define SSP_MIS_RXMIS_Pos 2 /* Masked Receive interrupt flag */
|
||||
#define SSP_MIS_RXMIS_Msk ( 1UL << SSP_MIS_RXMIS_Pos )
|
||||
#define SSP_MIS_TXMIS_Pos 3 // Masked Transmit interrupt flag
|
||||
#define SSP_MIS_TXMIS_Pos 3 /* Masked Transmit interrupt flag */
|
||||
#define SSP_MIS_TXMIS_Msk ( 1UL << SSP_MIS_TXMIS_Pos )
|
||||
|
||||
// SSPICR Interrupt clear register
|
||||
#define SSP_ICR_RORIC_Pos 0 // Clears Overrun interrupt flag
|
||||
/* SSPICR Interrupt clear register */
|
||||
#define SSP_ICR_RORIC_Pos 0 /* Clears Overrun interrupt flag */
|
||||
#define SSP_ICR_RORIC_Msk ( 1UL << SSP_ICR_RORIC_Pos )
|
||||
#define SSP_ICR_RTIC_Pos 1 // Clears Timemout interrupt flag
|
||||
#define SSP_ICR_RTIC_Pos 1 /* Clears Timeout interrupt flag */
|
||||
#define SSP_ICR_RTIC_Msk ( 1UL << SSP_ICR_RTIC_Pos )
|
||||
|
||||
// SSPDMACR DMA control register
|
||||
#define SSP_DMACR_RXDMAE_Pos 0 // Enable Receive FIFO DMA
|
||||
/* SSPDMACR DMA control register */
|
||||
#define SSP_DMACR_RXDMAE_Pos 0 /* Enable Receive FIFO DMA */
|
||||
#define SSP_DMACR_RXDMAE_Msk ( 1UL << SSP_DMACR_RXDMAE_Pos )
|
||||
#define SSP_DMACR_TXDMAE_Pos 1 // Enable Transmit FIFO DMA
|
||||
#define SSP_DMACR_TXDMAE_Pos 1 /* Enable Transmit FIFO DMA */
|
||||
#define SSP_DMACR_TXDMAE_Msk ( 1UL << SSP_DMACR_TXDMAE_Pos )
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -316,11 +316,12 @@ typedef struct // Document DDI0194G_ssp_pl022_r1p3_trm.pdf
|
|||
|
||||
typedef struct
|
||||
{
|
||||
union {
|
||||
__O uint32_t CONTROLS; // Offset: 0x000 CONTROL Set Register ( /W)
|
||||
__I uint32_t CONTROL; // Offset: 0x000 CONTROL Status Register (R/ )
|
||||
union
|
||||
{
|
||||
__O uint32_t CONTROLS; /* Offset: 0x000 CONTROL Set Register ( /W) */
|
||||
__I uint32_t CONTROL; /* Offset: 0x000 CONTROL Status Register (R/ ) */
|
||||
};
|
||||
__O uint32_t CONTROLC; // Offset: 0x004 CONTROL Clear Register ( /W)
|
||||
__O uint32_t CONTROLC; /* Offset: 0x004 CONTROL Clear Register ( /W) */
|
||||
} MPS2_I2C_TypeDef;
|
||||
|
||||
#define SDA 1 << 1
|
||||
|
@ -334,104 +335,105 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
/*!< Offset: 0x000 CONTROL Register (R/W) */
|
||||
__IO uint32_t CONTROL; // <h> CONTROL </h>
|
||||
// <o.0> TX Enable
|
||||
// <0=> TX disabled
|
||||
// <1=> TX enabled
|
||||
// <o.1> TX IRQ Enable
|
||||
// <0=> TX IRQ disabled
|
||||
// <1=> TX IRQ enabled
|
||||
// <o.2> RX Enable
|
||||
// <0=> RX disabled
|
||||
// <1=> RX enabled
|
||||
// <o.3> RX IRQ Enable
|
||||
// <0=> RX IRQ disabled
|
||||
// <1=> RX IRQ enabled
|
||||
// <o.10..8> TX Buffer Water Level
|
||||
// <0=> / IRQ triggers when any space available
|
||||
// <1=> / IRQ triggers when more than 1 space available
|
||||
// <2=> / IRQ triggers when more than 2 space available
|
||||
// <3=> / IRQ triggers when more than 3 space available
|
||||
// <4=> Undefined!
|
||||
// <5=> Undefined!
|
||||
// <6=> Undefined!
|
||||
// <7=> Undefined!
|
||||
// <o.14..12> RX Buffer Water Level
|
||||
// <0=> Undefined!
|
||||
// <1=> / IRQ triggers when less than 1 space available
|
||||
// <2=> / IRQ triggers when less than 2 space available
|
||||
// <3=> / IRQ triggers when less than 3 space available
|
||||
// <4=> / IRQ triggers when less than 4 space available
|
||||
// <5=> Undefined!
|
||||
// <6=> Undefined!
|
||||
// <7=> Undefined!
|
||||
// <o.16> FIFO reset
|
||||
// <0=> Normal operation
|
||||
// <1=> FIFO reset
|
||||
// <o.17> Audio Codec reset
|
||||
// <0=> Normal operation
|
||||
// <1=> Assert audio Codec reset
|
||||
__IO uint32_t CONTROL; /* <h> CONTROL </h> */
|
||||
/* <o.0> TX Enable */
|
||||
/* <0=> TX disabled */
|
||||
/* <1=> TX enabled */
|
||||
/* <o.1> TX IRQ Enable */
|
||||
/* <0=> TX IRQ disabled */
|
||||
/* <1=> TX IRQ enabled */
|
||||
/* <o.2> RX Enable */
|
||||
/* <0=> RX disabled */
|
||||
/* <1=> RX enabled */
|
||||
/* <o.3> RX IRQ Enable */
|
||||
/* <0=> RX IRQ disabled */
|
||||
/* <1=> RX IRQ enabled */
|
||||
/* <o.10..8> TX Buffer Water Level */
|
||||
/* <0=> / IRQ triggers when any space available */
|
||||
/* <1=> / IRQ triggers when more than 1 space available */
|
||||
/* <2=> / IRQ triggers when more than 2 space available */
|
||||
/* <3=> / IRQ triggers when more than 3 space available */
|
||||
/* <4=> Undefined! */
|
||||
/* <5=> Undefined! */
|
||||
/* <6=> Undefined! */
|
||||
/* <7=> Undefined! */
|
||||
/* <o.14..12> RX Buffer Water Level */
|
||||
/* <0=> Undefined! */
|
||||
/* <1=> / IRQ triggers when less than 1 space available */
|
||||
/* <2=> / IRQ triggers when less than 2 space available */
|
||||
/* <3=> / IRQ triggers when less than 3 space available */
|
||||
/* <4=> / IRQ triggers when less than 4 space available */
|
||||
/* <5=> Undefined! */
|
||||
/* <6=> Undefined! */
|
||||
/* <7=> Undefined! */
|
||||
/* <o.16> FIFO reset */
|
||||
/* <0=> Normal operation */
|
||||
/* <1=> FIFO reset */
|
||||
/* <o.17> Audio Codec reset */
|
||||
/* <0=> Normal operation */
|
||||
/* <1=> Assert audio Codec reset */
|
||||
/*!< Offset: 0x004 STATUS Register (R/ ) */
|
||||
__I uint32_t STATUS; // <h> STATUS </h>
|
||||
// <o.0> TX Buffer alert
|
||||
// <0=> TX buffer don't need service yet
|
||||
// <1=> TX buffer need service
|
||||
// <o.1> RX Buffer alert
|
||||
// <0=> RX buffer don't need service yet
|
||||
// <1=> RX buffer need service
|
||||
// <o.2> TX Buffer Empty
|
||||
// <0=> TX buffer have data
|
||||
// <1=> TX buffer empty
|
||||
// <o.3> TX Buffer Full
|
||||
// <0=> TX buffer not full
|
||||
// <1=> TX buffer full
|
||||
// <o.4> RX Buffer Empty
|
||||
// <0=> RX buffer have data
|
||||
// <1=> RX buffer empty
|
||||
// <o.5> RX Buffer Full
|
||||
// <0=> RX buffer not full
|
||||
// <1=> RX buffer full
|
||||
union {
|
||||
__I uint32_t STATUS; /* <h> STATUS </h> */
|
||||
/* <o.0> TX Buffer alert */
|
||||
/* <0=> TX buffer don't need service yet */
|
||||
/* <1=> TX buffer need service */
|
||||
/* <o.1> RX Buffer alert */
|
||||
/* <0=> RX buffer don't need service yet */
|
||||
/* <1=> RX buffer need service */
|
||||
/* <o.2> TX Buffer Empty */
|
||||
/* <0=> TX buffer have data */
|
||||
/* <1=> TX buffer empty */
|
||||
/* <o.3> TX Buffer Full */
|
||||
/* <0=> TX buffer not full */
|
||||
/* <1=> TX buffer full */
|
||||
/* <o.4> RX Buffer Empty */
|
||||
/* <0=> RX buffer have data */
|
||||
/* <1=> RX buffer empty */
|
||||
/* <o.5> RX Buffer Full */
|
||||
/* <0=> RX buffer not full */
|
||||
/* <1=> RX buffer full */
|
||||
union
|
||||
{
|
||||
/*!< Offset: 0x008 Error Status Register (R/ ) */
|
||||
__I uint32_t ERROR; // <h> ERROR </h>
|
||||
// <o.0> TX error
|
||||
// <0=> Okay
|
||||
// <1=> TX overrun/underrun
|
||||
// <o.1> RX error
|
||||
// <0=> Okay
|
||||
// <1=> RX overrun/underrun
|
||||
__I uint32_t ERROR; /* <h> ERROR </h> */
|
||||
/* <o.0> TX error */
|
||||
/* <0=> Okay */
|
||||
/* <1=> TX overrun/underrun */
|
||||
/* <o.1> RX error */
|
||||
/* <0=> Okay */
|
||||
/* <1=> RX overrun/underrun */
|
||||
/*!< Offset: 0x008 Error Clear Register ( /W) */
|
||||
__O uint32_t ERRORCLR; // <h> ERRORCLR </h>
|
||||
// <o.0> TX error
|
||||
// <0=> Okay
|
||||
// <1=> Clear TX error
|
||||
// <o.1> RX error
|
||||
// <0=> Okay
|
||||
// <1=> Clear RX error
|
||||
__O uint32_t ERRORCLR; /* <h> ERRORCLR </h> */
|
||||
/* <o.0> TX error */
|
||||
/* <0=> Okay */
|
||||
/* <1=> Clear TX error */
|
||||
/* <o.1> RX error */
|
||||
/* <0=> Okay */
|
||||
/* <1=> Clear RX error */
|
||||
};
|
||||
/*!< Offset: 0x00C Divide ratio Register (R/W) */
|
||||
__IO uint32_t DIVIDE; // <h> Divide ratio for Left/Right clock </h>
|
||||
// <o.9..0> TX error (default 0x80)
|
||||
__IO uint32_t DIVIDE; /* <h> Divide ratio for Left/Right clock </h> */
|
||||
/* <o.9..0> TX error (default 0x80) */
|
||||
/*!< Offset: 0x010 Transmit Buffer ( /W) */
|
||||
__O uint32_t TXBUF; // <h> Transmit buffer </h>
|
||||
// <o.15..0> Right channel
|
||||
// <o.31..16> Left channel
|
||||
__O uint32_t TXBUF; /* <h> Transmit buffer </h> */
|
||||
/* <o.15..0> Right channel */
|
||||
/* <o.31..16> Left channel */
|
||||
/*!< Offset: 0x014 Receive Buffer (R/ ) */
|
||||
__I uint32_t RXBUF; // <h> Receive buffer </h>
|
||||
// <o.15..0> Right channel
|
||||
// <o.31..16> Left channel
|
||||
__I uint32_t RXBUF; /* <h> Receive buffer </h> */
|
||||
/* <o.15..0> Right channel */
|
||||
/* <o.31..16> Left channel */
|
||||
uint32_t RESERVED1[ 186 ];
|
||||
__IO uint32_t ITCR; // <h> Integration Test Control Register </h>
|
||||
// <o.0> ITEN
|
||||
// <0=> Normal operation
|
||||
// <1=> Integration Test mode enable
|
||||
__O uint32_t ITIP1; // <h> Integration Test Input Register 1</h>
|
||||
// <o.0> SDIN
|
||||
__O uint32_t ITOP1; // <h> Integration Test Output Register 1</h>
|
||||
// <o.0> SDOUT
|
||||
// <o.1> SCLK
|
||||
// <o.2> LRCK
|
||||
// <o.3> IRQOUT
|
||||
__IO uint32_t ITCR; /* <h> Integration Test Control Register </h> */
|
||||
/* <o.0> ITEN */
|
||||
/* <0=> Normal operation */
|
||||
/* <1=> Integration Test mode enable */
|
||||
__O uint32_t ITIP1; /* <h> Integration Test Input Register 1</h> */
|
||||
/* <o.0> SDIN */
|
||||
__O uint32_t ITOP1; /* <h> Integration Test Output Register 1</h> */
|
||||
/* <o.0> SDOUT */
|
||||
/* <o.1> SCLK */
|
||||
/* <o.2> LRCK */
|
||||
/* <o.3> IRQOUT */
|
||||
} MPS2_I2S_TypeDef;
|
||||
|
||||
#define I2S_CONTROL_TXEN_Pos 0
|
||||
|
@ -486,48 +488,47 @@ typedef struct
|
|||
/* SMSC9220 Register Definitions */
|
||||
/******************************************************************************/
|
||||
|
||||
typedef struct // SMSC LAN9220
|
||||
typedef struct /* SMSC LAN9220 */
|
||||
{
|
||||
__I uint32_t RX_DATA_PORT; // Receive FIFO Ports (offset 0x0)
|
||||
__I uint32_t RX_DATA_PORT; /* Receive FIFO Ports (offset 0x0) */
|
||||
uint32_t RESERVED1[ 0x7 ];
|
||||
__O uint32_t TX_DATA_PORT; // Transmit FIFO Ports (offset 0x20)
|
||||
__O uint32_t TX_DATA_PORT; /* Transmit FIFO Ports (offset 0x20) */
|
||||
uint32_t RESERVED2[ 0x7 ];
|
||||
|
||||
__I uint32_t RX_STAT_PORT; // Receive FIFO status port (offset 0x40)
|
||||
__I uint32_t RX_STAT_PEEK; // Receive FIFO status peek (offset 0x44)
|
||||
__I uint32_t TX_STAT_PORT; // Transmit FIFO status port (offset 0x48)
|
||||
__I uint32_t TX_STAT_PEEK; // Transmit FIFO status peek (offset 0x4C)
|
||||
|
||||
__I uint32_t ID_REV; // Chip ID and Revision (offset 0x50)
|
||||
__IO uint32_t IRQ_CFG; // Main Interrupt Configuration (offset 0x54)
|
||||
__IO uint32_t INT_STS; // Interrupt Status (offset 0x58)
|
||||
__IO uint32_t INT_EN; // Interrupt Enable Register (offset 0x5C)
|
||||
uint32_t RESERVED3; // Reserved for future use (offset 0x60)
|
||||
__I uint32_t BYTE_TEST; // Read-only byte order testing register 87654321h (offset 0x64)
|
||||
__IO uint32_t FIFO_INT; // FIFO Level Interrupts (offset 0x68)
|
||||
__IO uint32_t RX_CFG; // Receive Configuration (offset 0x6C)
|
||||
__IO uint32_t TX_CFG; // Transmit Configuration (offset 0x70)
|
||||
__IO uint32_t HW_CFG; // Hardware Configuration (offset 0x74)
|
||||
__IO uint32_t RX_DP_CTL; // RX Datapath Control (offset 0x78)
|
||||
__I uint32_t RX_FIFO_INF; // Receive FIFO Information (offset 0x7C)
|
||||
__I uint32_t TX_FIFO_INF; // Transmit FIFO Information (offset 0x80)
|
||||
__IO uint32_t PMT_CTRL; // Power Management Control (offset 0x84)
|
||||
__IO uint32_t GPIO_CFG; // General Purpose IO Configuration (offset 0x88)
|
||||
__IO uint32_t GPT_CFG; // General Purpose Timer Configuration (offset 0x8C)
|
||||
__I uint32_t GPT_CNT; // General Purpose Timer Count (offset 0x90)
|
||||
uint32_t RESERVED4; // Reserved for future use (offset 0x94)
|
||||
__IO uint32_t ENDIAN; // WORD SWAP Register (offset 0x98)
|
||||
__I uint32_t FREE_RUN; // Free Run Counter (offset 0x9C)
|
||||
__I uint32_t RX_DROP; // RX Dropped Frames Counter (offset 0xA0)
|
||||
__IO uint32_t MAC_CSR_CMD; // MAC CSR Synchronizer Command (offset 0xA4)
|
||||
__IO uint32_t MAC_CSR_DATA; // MAC CSR Synchronizer Data (offset 0xA8)
|
||||
__IO uint32_t AFC_CFG; // Automatic Flow Control Configuration (offset 0xAC)
|
||||
__IO uint32_t E2P_CMD; // EEPROM Command (offset 0xB0)
|
||||
__IO uint32_t E2P_DATA; // EEPROM Data (offset 0xB4)
|
||||
__I uint32_t RX_STAT_PORT; /* Receive FIFO status port (offset 0x40) */
|
||||
__I uint32_t RX_STAT_PEEK; /* Receive FIFO status peek (offset 0x44) */
|
||||
__I uint32_t TX_STAT_PORT; /* Transmit FIFO status port (offset 0x48) */
|
||||
__I uint32_t TX_STAT_PEEK; /* Transmit FIFO status peek (offset 0x4C) */
|
||||
|
||||
__I uint32_t ID_REV; /* Chip ID and Revision (offset 0x50) */
|
||||
__IO uint32_t IRQ_CFG; /* Main Interrupt Configuration (offset 0x54) */
|
||||
__IO uint32_t INT_STS; /* Interrupt Status (offset 0x58) */
|
||||
__IO uint32_t INT_EN; /* Interrupt Enable Register (offset 0x5C) */
|
||||
uint32_t RESERVED3; /* Reserved for future use (offset 0x60) */
|
||||
__I uint32_t BYTE_TEST; /* Read-only byte order testing register 87654321h (offset 0x64) */
|
||||
__IO uint32_t FIFO_INT; /* FIFO Level Interrupts (offset 0x68) */
|
||||
__IO uint32_t RX_CFG; /* Receive Configuration (offset 0x6C) */
|
||||
__IO uint32_t TX_CFG; /* Transmit Configuration (offset 0x70) */
|
||||
__IO uint32_t HW_CFG; /* Hardware Configuration (offset 0x74) */
|
||||
__IO uint32_t RX_DP_CTL; /* RX Datapath Control (offset 0x78) */
|
||||
__I uint32_t RX_FIFO_INF; /* Receive FIFO Information (offset 0x7C) */
|
||||
__I uint32_t TX_FIFO_INF; /* Transmit FIFO Information (offset 0x80) */
|
||||
__IO uint32_t PMT_CTRL; /* Power Management Control (offset 0x84) */
|
||||
__IO uint32_t GPIO_CFG; /* General Purpose IO Configuration (offset 0x88) */
|
||||
__IO uint32_t GPT_CFG; /* General Purpose Timer Configuration (offset 0x8C) */
|
||||
__I uint32_t GPT_CNT; /* General Purpose Timer Count (offset 0x90) */
|
||||
uint32_t RESERVED4; /* Reserved for future use (offset 0x94) */
|
||||
__IO uint32_t ENDIAN; /* WORD SWAP Register (offset 0x98) */
|
||||
__I uint32_t FREE_RUN; /* Free Run Counter (offset 0x9C) */
|
||||
__I uint32_t RX_DROP; /* RX Dropped Frames Counter (offset 0xA0) */
|
||||
__IO uint32_t MAC_CSR_CMD; /* MAC CSR Synchronizer Command (offset 0xA4) */
|
||||
__IO uint32_t MAC_CSR_DATA; /* MAC CSR Synchronizer Data (offset 0xA8) */
|
||||
__IO uint32_t AFC_CFG; /* Automatic Flow Control Configuration (offset 0xAC) */
|
||||
__IO uint32_t E2P_CMD; /* EEPROM Command (offset 0xB0) */
|
||||
__IO uint32_t E2P_DATA; /* EEPROM Data (offset 0xB4) */
|
||||
} SMSC9220_TypeDef;
|
||||
|
||||
// SMSC9220 MAC Registers Indices
|
||||
/* SMSC9220 MAC Registers Indices */
|
||||
#define SMSC9220_MAC_CR 0x1
|
||||
#define SMSC9220_MAC_ADDRH 0x2
|
||||
#define SMSC9220_MAC_ADDRL 0x3
|
||||
|
@ -541,7 +542,7 @@ __IO uint32_t E2P_DATA; // EEPROM Data (offset 0xB4)
|
|||
#define SMSC9220_MAC_WUFF 0xB
|
||||
#define SMSC9220_MAC_WUCSR 0xC
|
||||
|
||||
// SMSC9220 PHY Registers Indices
|
||||
/* SMSC9220 PHY Registers Indices */
|
||||
#define SMSC9220_PHY_BCONTROL 0x0
|
||||
#define SMSC9220_PHY_BSTATUS 0x1
|
||||
#define SMSC9220_PHY_ID1 0x2
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* @version V5.1.0
|
||||
* @date 09. October 2018
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
|
||||
*
|
||||
|
@ -98,23 +99,34 @@
|
|||
#define __PACKED_UNION union __attribute__( ( packed ) )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT32 /* deprecated */
|
||||
struct __attribute__((packed)) T_UINT32 { uint32_t v; };
|
||||
struct __attribute__( ( packed ) ) T_UINT32
|
||||
{
|
||||
uint32_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT32( x ) ( ( ( struct T_UINT32 * ) ( x ) )->v )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT16_WRITE
|
||||
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
|
||||
__PACKED_STRUCT T_UINT16_WRITE {
|
||||
uint16_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT16_WRITE( addr, val ) ( void ) ( ( ( ( struct T_UINT16_WRITE * ) ( void * ) ( addr ) )->v ) = ( val ) )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT16_READ
|
||||
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
|
||||
__PACKED_STRUCT T_UINT16_READ {
|
||||
uint16_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT16_READ( addr ) ( ( ( const struct T_UINT16_READ * ) ( const void * ) ( addr ) )->v )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT32_WRITE
|
||||
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
|
||||
__PACKED_STRUCT T_UINT32_WRITE {
|
||||
uint32_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT32_WRITE( addr, val ) ( void ) ( ( ( ( struct T_UINT32_WRITE * ) ( void * ) ( addr ) )->v ) = ( val ) )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT32_READ
|
||||
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
|
||||
__PACKED_STRUCT T_UINT32_READ {
|
||||
uint32_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT32_READ( addr ) ( ( ( const struct T_UINT32_READ * ) ( const void * ) ( addr ) )->v )
|
||||
#endif
|
||||
#ifndef __ALIGNED
|
||||
|
@ -133,6 +145,7 @@
|
|||
* TASKING Compiler
|
||||
*/
|
||||
#elif defined( __TASKING__ )
|
||||
|
||||
/*
|
||||
* 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,
|
||||
|
@ -170,23 +183,34 @@
|
|||
#define __PACKED_UNION union __packed__
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT32 /* deprecated */
|
||||
struct __packed__ T_UINT32 { uint32_t v; };
|
||||
struct __packed__ T_UINT32
|
||||
{
|
||||
uint32_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT32( x ) ( ( ( struct T_UINT32 * ) ( x ) )->v )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT16_WRITE
|
||||
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
|
||||
__PACKED_STRUCT T_UINT16_WRITE {
|
||||
uint16_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT16_WRITE( addr, val ) ( void ) ( ( ( ( struct T_UINT16_WRITE * ) ( void * ) ( addr ) )->v ) = ( val ) )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT16_READ
|
||||
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
|
||||
__PACKED_STRUCT T_UINT16_READ {
|
||||
uint16_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT16_READ( addr ) ( ( ( const struct T_UINT16_READ * ) ( const void * ) ( addr ) )->v )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT32_WRITE
|
||||
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
|
||||
__PACKED_STRUCT T_UINT32_WRITE {
|
||||
uint32_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT32_WRITE( addr, val ) ( void ) ( ( ( ( struct T_UINT32_WRITE * ) ( void * ) ( addr ) )->v ) = ( val ) )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT32_READ
|
||||
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
|
||||
__PACKED_STRUCT T_UINT32_READ {
|
||||
uint32_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT32_READ( addr ) ( ( ( const struct T_UINT32_READ * ) ( const void * ) ( addr ) )->v )
|
||||
#endif
|
||||
#ifndef __ALIGNED
|
||||
|
@ -221,7 +245,7 @@
|
|||
#define __STATIC_FORCEINLINE __STATIC_INLINE
|
||||
#endif
|
||||
#ifndef __NO_RETURN
|
||||
// NO RETURN is automatically detected hence no warning here
|
||||
/* NO RETURN is automatically detected hence no warning here */
|
||||
#define __NO_RETURN
|
||||
#endif
|
||||
#ifndef __USED
|
||||
|
@ -241,23 +265,34 @@
|
|||
#define __PACKED_UNION @packed union
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT32 /* deprecated */
|
||||
@packed struct T_UINT32 { uint32_t v; };
|
||||
@packed struct T_UINT32
|
||||
{
|
||||
uint32_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT32( x ) ( ( ( struct T_UINT32 * ) ( x ) )->v )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT16_WRITE
|
||||
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
|
||||
__PACKED_STRUCT T_UINT16_WRITE {
|
||||
uint16_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT16_WRITE( addr, val ) ( void ) ( ( ( ( struct T_UINT16_WRITE * ) ( void * ) ( addr ) )->v ) = ( val ) )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT16_READ
|
||||
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
|
||||
__PACKED_STRUCT T_UINT16_READ {
|
||||
uint16_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT16_READ( addr ) ( ( ( const struct T_UINT16_READ * ) ( const void * ) ( addr ) )->v )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT32_WRITE
|
||||
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
|
||||
__PACKED_STRUCT T_UINT32_WRITE {
|
||||
uint32_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT32_WRITE( addr, val ) ( void ) ( ( ( ( struct T_UINT32_WRITE * ) ( void * ) ( addr ) )->v ) = ( val ) )
|
||||
#endif
|
||||
#ifndef __UNALIGNED_UINT32_READ
|
||||
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
|
||||
__PACKED_STRUCT T_UINT32_READ {
|
||||
uint32_t v;
|
||||
};
|
||||
#define __UNALIGNED_UINT32_READ( addr ) ( ( ( const struct T_UINT32_READ * ) ( const void * ) ( addr ) )->v )
|
||||
#endif
|
||||
#ifndef __ALIGNED
|
||||
|
@ -274,10 +309,9 @@
|
|||
#endif
|
||||
|
||||
|
||||
#else
|
||||
#else /* if defined( __CC_ARM ) */
|
||||
#error Unknown compiler.
|
||||
#endif
|
||||
#endif /* if defined( __CC_ARM ) */
|
||||
|
||||
|
||||
#endif /* __CMSIS_COMPILER_H */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue