After this commit, this repository contains only POSIX source code.

This commit is contained in:
Yuhui Zheng 2020-02-21 11:37:44 -08:00 committed by Yuhui.Zheng
parent adc286ac4a
commit eb87d247f9
47 changed files with 0 additions and 1187 deletions

View File

@ -1,119 +0,0 @@
/*
* FreeRTOS Kernel V10.0.1
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
#include <stdint.h>
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* http://www.freertos.org/a00110.html
*----------------------------------------------------------*/
#define configUSE_PREEMPTION 1
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 60 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the Win32 thread. */
#define configMAX_TASK_NAME_LEN ( 7 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_CO_ROUTINES 0
#define configUSE_MUTEXES 1
#define configCHECK_FOR_STACK_OVERFLOW 0 /* Not applicable to the Win32 port. */
#define configUSE_RECURSIVE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 0
#define configUSE_APPLICATION_TASK_TAG 1
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_ALTERNATIVE_API 0
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY 2
#define configTIMER_QUEUE_LENGTH 20
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
#define configMAX_PRIORITIES ( 7 )
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Hook functions */
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configUSE_MALLOC_FAILED_HOOK 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTimerGetTimerTaskHandle 0
#define INCLUDE_xTaskGetIdleTaskHandle 0
#define INCLUDE_xQueueGetMutexHolder 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xEventGroupSetBitsFromISR 1
#define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_xTaskAbortDelay 1
/* heap_4.c, */
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2048U * 1024U ) )
/* Allow RTOS objects to be created using RAM provided by the application writer. */
#define configSUPPORT_STATIC_ALLOCATION 1
/* Create RTOS objects using dynamically allocated RAM */
#define configSUPPORT_DYNAMIC_ALLOCATION 1
/* This demo makes use of one or more example stats formatting functions. These
format the raw data provided by the uxTaskGetSystemState() function in to human
readable ASCII form. See the notes in the implementation of vTaskList() within
FreeRTOS/Source/tasks.c for limitations. */
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
/* Run time stats gathering definitions. */
#define configGENERATE_RUN_TIME_STATS 0
/* Assert call defined for debug builds. */
extern void vAssertCalled(const char * pcFile, uint32_t ulLine);
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
#endif /* FREERTOS_CONFIG_H */

View File

@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2050
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOS_POSIX_Demo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.ActiveCfg = Debug|Win32
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.Build.0 = Debug|Win32
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|Win32.ActiveCfg = Release|Win32
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {18112148-F9F0-43E0-B713-B146289BDEF3}
EndGlobalSection
EndGlobal

View File

@ -1,184 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{C686325E-3261-42F7-AEB1-DDE5280E1CEB}</ProjectGuid>
<ProjectName>RTOS_POSIX_Demo</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
<TypeLibraryName>.\Debug/WIN32.tlb</TypeLibraryName>
<HeaderFileName>
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\FreeRTOS\Source\include;..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\FreeRTOS-Plus\Demo\FreeRTOS_Plus_POSIX_with_actor_Windows_Simulator\lib\FreeRTOS-Plus-POSIX\include\portable\pc\windows;..\..\..\FreeRTOS-Plus\Demo\FreeRTOS_Plus_POSIX_with_actor_Windows_Simulator\lib\FreeRTOS-Plus-POSIX\include\portable;..\..\..\FreeRTOS-Plus\Demo\FreeRTOS_Plus_POSIX_with_actor_Windows_Simulator\lib\FreeRTOS-Plus-POSIX\include;..\..\..\FreeRTOS-Plus\Demo\FreeRTOS_Plus_POSIX_with_actor_Windows_Simulator\lib\FreeRTOS-Plus-POSIX\source;..\..\..\FreeRTOS-Plus\Demo\FreeRTOS_Plus_POSIX_with_actor_Windows_Simulator\lib\include\private;..\..\..\FreeRTOS-Plus\Demo\FreeRTOS_Plus_POSIX_with_actor_Windows_Simulator\lib\third_party\win_pcap;..\..\..\FreeRTOS-Plus\Demo\FreeRTOS_Plus_POSIX_with_actor_Windows_Simulator\lib\include;..\..\..\FreeRTOS-Plus\Demo\FreeRTOS_Plus_POSIX_with_actor_Windows_Simulator;..\..\..\FreeRTOS\Demo\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeaderOutputFile>.\Debug/WIN32.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
<ObjectFileName>.\Debug/</ObjectFileName>
<ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0c09</Culture>
</ResourceCompile>
<Link>
<OutputFile>.\Debug/RTOS_POSIX_demo.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\Debug/WIN32.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug/WIN32.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl>
<TypeLibraryName>.\Release/WIN32.tlb</TypeLibraryName>
<HeaderFileName>
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeaderOutputFile>.\Release/WIN32.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>.\Release/</AssemblerListingLocation>
<ObjectFileName>.\Release/</ObjectFileName>
<ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalIncludeDirectories>..\Common\Utils;..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap;..\Common\ethernet\lwip-1.4.0\src\include\ipv4;..\Common\ethernet\lwip-1.4.0\src\include;..\..\Source\include;..\..\Source\portable\MSVC-MingW;..\Common\ethernet\lwip-1.4.0\ports\win32\include;..\Common\Include;.\lwIP_Apps;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0c09</Culture>
</ResourceCompile>
<Link>
<OutputFile>.\Release/RTOSDemo.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<ProgramDatabaseFile>.\Release/WIN32.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap</AdditionalLibraryDirectories>
<AdditionalDependencies>wpcap.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Release/WIN32.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\FreeRTOS\Source\event_groups.c" />
<ClCompile Include="..\..\..\FreeRTOS\Source\list.c" />
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MemMang\heap_4.c" />
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c" />
<ClCompile Include="..\..\..\FreeRTOS\Source\queue.c" />
<ClCompile Include="..\..\..\FreeRTOS\Source\stream_buffer.c" />
<ClCompile Include="..\..\..\FreeRTOS\Source\tasks.c" />
<ClCompile Include="..\..\..\FreeRTOS\Source\timers.c" />
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_clock.c" />
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_mqueue.c" />
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_pthread.c" />
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_pthread_barrier.c" />
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_pthread_mutex.c" />
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_pthread_cond.c" />
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_sched.c" />
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_semaphore.c" />
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_timer.c" />
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_unistd.c" />
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_utils.c" />
<ClCompile Include="main.c">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="posix_demo.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\FreeRTOS\Source\portable\MSVC-MingW\portmacro.h" />
<ClInclude Include=".\lib\FreeRTOS-Plus-POSIX\include\FreeRTOS_POSIX.h" />
<ClInclude Include=".\lib\FreeRTOS-Plus-POSIX\include\FreeRTOS_POSIX_internal.h" />
<ClInclude Include=".\lib\FreeRTOS-Plus-POSIX\include\portable\FreeRTOS_POSIX_portable_default.h" />
<ClInclude Include=".\lib\FreeRTOS-Plus-POSIX\include\portable\pc\windows\FreeRTOS_POSIX_portable.h" />
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\errno.h" />
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\fcntl.h" />
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\mqueue.h" />
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\pthread.h" />
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\sched.h" />
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\semaphore.h" />
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\signal.h" />
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\sys\types.h" />
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\time.h" />
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\unistd.h" />
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\utils.h" />
<ClInclude Include=".\lib\include\private\aws_doubly_linked_list.h" />
<ClInclude Include="FreeRTOSConfig.h" />
<ClInclude Include="posix_demo.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,174 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="application_code">
<UniqueIdentifier>{34567deb-d5ab-4a56-8640-0aaec609521a}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
<Filter Include="lib">
<UniqueIdentifier>{e3396fdf-de1f-4cb9-975c-673cb9315287}</UniqueIdentifier>
</Filter>
<Filter Include="lib\include">
<UniqueIdentifier>{02f5b936-2f92-411d-89d3-985520c10e9d}</UniqueIdentifier>
</Filter>
<Filter Include="lib\include\FreeRTOS_POSIX">
<UniqueIdentifier>{1f6970f5-2901-4d3b-a119-86195fed3601}</UniqueIdentifier>
</Filter>
<Filter Include="lib\include\FreeRTOS_POSIX\sys">
<UniqueIdentifier>{63611657-d97d-479c-af87-69d6817b564d}</UniqueIdentifier>
</Filter>
<Filter Include="lib\FreeRTOS-Plus-POSIX">
<UniqueIdentifier>{7c2a7031-ca15-4d3e-838e-efe7b508f899}</UniqueIdentifier>
</Filter>
<Filter Include="lib\FreeRTOS-Plus-POSIX\include">
<UniqueIdentifier>{dddb94ad-d701-41db-ab34-8fd5b9b4d2db}</UniqueIdentifier>
</Filter>
<Filter Include="lib\FreeRTOS-Plus-POSIX\source">
<UniqueIdentifier>{db0fccd4-1177-4630-8a6d-b1ea48d0b0fa}</UniqueIdentifier>
</Filter>
<Filter Include="lib\FreeRTOS">
<UniqueIdentifier>{af3445a1-4908-4170-89ed-39345d90d30c}</UniqueIdentifier>
</Filter>
<Filter Include="lib\include\private">
<UniqueIdentifier>{26ccdf01-559e-4934-9311-bd1a25bdd658}</UniqueIdentifier>
</Filter>
<Filter Include="configuration_files">
<UniqueIdentifier>{19ff1a34-36de-4c48-9d10-3fb1fa0d1fa4}</UniqueIdentifier>
<Extensions>
</Extensions>
</Filter>
<Filter Include="lib\FreeRTOS\Portable">
<UniqueIdentifier>{88f409e6-d396-4ac5-94bd-7a99c914be46}</UniqueIdentifier>
</Filter>
<Filter Include="lib\FreeRTOS\Portable\MemMang">
<UniqueIdentifier>{a4b373f5-dc97-40ff-9b67-118253049621}</UniqueIdentifier>
</Filter>
<Filter Include="lib\FreeRTOS\Portable\MSVC-W">
<UniqueIdentifier>{0447c18c-e805-43d8-8b36-744f7c7fb88f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.c">
<Filter>application_code</Filter>
</ClCompile>
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_clock.c">
<Filter>lib\FreeRTOS-Plus-POSIX\source</Filter>
</ClCompile>
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_mqueue.c">
<Filter>lib\FreeRTOS-Plus-POSIX\source</Filter>
</ClCompile>
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_pthread.c">
<Filter>lib\FreeRTOS-Plus-POSIX\source</Filter>
</ClCompile>
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_pthread_barrier.c">
<Filter>lib\FreeRTOS-Plus-POSIX\source</Filter>
</ClCompile>
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_pthread_cond.c">
<Filter>lib\FreeRTOS-Plus-POSIX\source</Filter>
</ClCompile>
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_pthread_mutex.c">
<Filter>lib\FreeRTOS-Plus-POSIX\source</Filter>
</ClCompile>
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_sched.c">
<Filter>lib\FreeRTOS-Plus-POSIX\source</Filter>
</ClCompile>
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_semaphore.c">
<Filter>lib\FreeRTOS-Plus-POSIX\source</Filter>
</ClCompile>
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_timer.c">
<Filter>lib\FreeRTOS-Plus-POSIX\source</Filter>
</ClCompile>
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_unistd.c">
<Filter>lib\FreeRTOS-Plus-POSIX\source</Filter>
</ClCompile>
<ClCompile Include=".\lib\FreeRTOS-Plus-POSIX\source\FreeRTOS_POSIX_utils.c">
<Filter>lib\FreeRTOS-Plus-POSIX\source</Filter>
</ClCompile>
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MemMang\heap_4.c">
<Filter>lib\FreeRTOS\Portable\MemMang</Filter>
</ClCompile>
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c">
<Filter>lib\FreeRTOS\Portable\MSVC-W</Filter>
</ClCompile>
<ClCompile Include="..\..\..\FreeRTOS\Source\event_groups.c">
<Filter>lib\FreeRTOS</Filter>
</ClCompile>
<ClCompile Include="..\..\..\FreeRTOS\Source\list.c">
<Filter>lib\FreeRTOS</Filter>
</ClCompile>
<ClCompile Include="..\..\..\FreeRTOS\Source\queue.c">
<Filter>lib\FreeRTOS</Filter>
</ClCompile>
<ClCompile Include="..\..\..\FreeRTOS\Source\stream_buffer.c">
<Filter>lib\FreeRTOS</Filter>
</ClCompile>
<ClCompile Include="..\..\..\FreeRTOS\Source\tasks.c">
<Filter>lib\FreeRTOS</Filter>
</ClCompile>
<ClCompile Include="..\..\..\FreeRTOS\Source\timers.c">
<Filter>lib\FreeRTOS</Filter>
</ClCompile>
<ClCompile Include="posix_demo.c">
<Filter>application_code</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="FreeRTOSConfig.h">
<Filter>configuration_files</Filter>
</ClInclude>
<ClInclude Include=".\lib\FreeRTOS-Plus-POSIX\include\FreeRTOS_POSIX.h">
<Filter>lib\FreeRTOS-Plus-POSIX\include</Filter>
</ClInclude>
<ClInclude Include=".\lib\FreeRTOS-Plus-POSIX\include\FreeRTOS_POSIX_internal.h">
<Filter>lib\FreeRTOS-Plus-POSIX\include</Filter>
</ClInclude>
<ClInclude Include=".\lib\FreeRTOS-Plus-POSIX\include\portable\pc\windows\FreeRTOS_POSIX_portable.h">
<Filter>lib\FreeRTOS-Plus-POSIX\include</Filter>
</ClInclude>
<ClInclude Include=".\lib\FreeRTOS-Plus-POSIX\include\portable\FreeRTOS_POSIX_portable_default.h">
<Filter>lib\FreeRTOS-Plus-POSIX\include</Filter>
</ClInclude>
<ClInclude Include=".\lib\include\private\aws_doubly_linked_list.h">
<Filter>lib\include\private</Filter>
</ClInclude>
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\errno.h">
<Filter>lib\include\FreeRTOS_POSIX</Filter>
</ClInclude>
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\fcntl.h">
<Filter>lib\include\FreeRTOS_POSIX</Filter>
</ClInclude>
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\mqueue.h">
<Filter>lib\include\FreeRTOS_POSIX</Filter>
</ClInclude>
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\pthread.h">
<Filter>lib\include\FreeRTOS_POSIX</Filter>
</ClInclude>
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\sched.h">
<Filter>lib\include\FreeRTOS_POSIX</Filter>
</ClInclude>
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\semaphore.h">
<Filter>lib\include\FreeRTOS_POSIX</Filter>
</ClInclude>
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\signal.h">
<Filter>lib\include\FreeRTOS_POSIX</Filter>
</ClInclude>
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\time.h">
<Filter>lib\include\FreeRTOS_POSIX</Filter>
</ClInclude>
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\unistd.h">
<Filter>lib\include\FreeRTOS_POSIX</Filter>
</ClInclude>
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\utils.h">
<Filter>lib\include\FreeRTOS_POSIX</Filter>
</ClInclude>
<ClInclude Include=".\lib\include\FreeRTOS_POSIX\sys\types.h">
<Filter>lib\include\FreeRTOS_POSIX\sys</Filter>
</ClInclude>
<ClInclude Include="..\..\..\FreeRTOS\Source\portable\MSVC-MingW\portmacro.h">
<Filter>lib\FreeRTOS\Portable\MSVC-W</Filter>
</ClInclude>
<ClInclude Include="posix_demo.h">
<Filter>application_code</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View File

@ -1,197 +0,0 @@
/*
* FreeRTOS POSIX Demo V1.0.0
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
/*
******************************************************************************
* -NOTE- The Win32 port is a simulation (or is that emulation?) only! Do not
* expect to get real time behaviour from the Win32 port or this demo
* application. It is provided as a convenient development and demonstration
* test bed only. This was tested using Windows 10 with Intel Core i7-6700 CPU.
*
* Windows will not be running the FreeRTOS simulator threads continuously, so
* the timing information has no meaningful units. See the documentation page for
* the Windows simulator for an explanation of the slow timing:
* http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html
* - READ THE WEB DOCUMENTATION FOR THIS PORT FOR MORE INFORMATION ON USING IT -
*
* Documentation for this demo can be found on:
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_POSIX/demo/posix_demo.html
******************************************************************************
*
*
* /* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
/* System headers */
#include <stdio.h>
/* demo include */
#include "posix_demo.h"
/* Demo task priority */
#define mainPOSIX_DEMO_PRIORITY ( tskIDLE_PRIORITY + 4 )
/*-----------------------------------------------------------*/
int main( void )
{
configASSERT( ( mainPOSIX_DEMO_PRIORITY < configMAX_PRIORITIES ) );
const uint32_t ulLongTime_ms = pdMS_TO_TICKS( 1000UL );
printf( "FreeRTOS POSIX demo\n" );
/* Start the task to run POSIX demo */
xTaskCreate( vStartPOSIXDemo,
"posix",
configMINIMAL_STACK_SIZE,
NULL,
mainPOSIX_DEMO_PRIORITY,
NULL );
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). */
for( ; ; )
{
Sleep( ulLongTime_ms );
}
return 0;
}
/*-----------------------------------------------------------*/
void vAssertCalled( const char * pcFile,
uint32_t ulLine )
{
const uint32_t ulLongSleep = 1000UL;
volatile uint32_t ulBlockVariable = 0UL;
volatile char * pcFileName = ( volatile char * ) pcFile;
volatile uint32_t ulLineNumber = ulLine;
( void ) pcFileName;
( void ) ulLineNumber;
printf( "vAssertCalled %s, %ld\n", pcFile, ( long ) ulLine );
fflush( stdout );
/* Setting ulBlockVariable to a non-zero value in the debugger will allow
* this function to be exited. */
taskDISABLE_INTERRUPTS();
{
while( ulBlockVariable == 0UL )
{
Sleep( ulLongSleep );
}
}
taskENABLE_INTERRUPTS();
}
/*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
* used by the Idle task. */
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer,
uint32_t * pulIdleTaskStackSize )
{
/* If the buffers to be provided to the Idle task are declared inside this
* function then they must be declared static - otherwise they will be allocated on
* the stack and so not exists after this function exits. */
static StaticTask_t xIdleTaskTCB;
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
/* Pass out a pointer to the StaticTask_t structure in which the Idle
* task's state will be stored. */
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
/* Pass out the array that will be used as the Idle task's stack. */
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
* Note that, as the array is necessarily of type StackType_t,
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
}
/*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
* application must provide an implementation of vApplicationGetTimerTaskMemory()
* to provide the memory that is used by the Timer service task. */
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
StackType_t ** ppxTimerTaskStackBuffer,
uint32_t * pulTimerTaskStackSize )
{
/* If the buffers to be provided to the Timer task are declared inside this
* function then they must be declared static - otherwise they will be allocated on
* the stack and so not exists after this function exits. */
static StaticTask_t xTimerTaskTCB;
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
/* Pass out a pointer to the StaticTask_t structure in which the Timer
* task's state will be stored. */
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
/* Pass out the array that will be used as the Timer task's stack. */
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
* Note that, as the array is necessarily of type StackType_t,
* configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. */
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
}
/*-----------------------------------------------------------*/
/**
* @brief Warn user if pvPortMalloc fails.
*
* Called if a call to pvPortMalloc() fails because there is insufficient
* free memory available in the FreeRTOS heap. pvPortMalloc() is called
* internally by FreeRTOS API functions that create tasks, queues, software
* timers, and semaphores. The size of the FreeRTOS heap is set by the
* configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h.
*
*/
void vApplicationMallocFailedHook()
{
taskDISABLE_INTERRUPTS();
for( ; ; )
{
}
}

View File

@ -1,374 +0,0 @@
/*
* FreeRTOS POSIX Demo V1.0.0
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://aws.amazon.com/freertos
* http://www.FreeRTOS.org
*/
/**
* @brief Demo intro: job distribution with actor model.
*
* This demo simulates job distribution with actor model.
* https://en.wikipedia.org/wiki/Actor_model
*
* In this demo, vStartPOSIXDemo() first creates all mailboxes
* which will be used by actors to send and receive messages.
* Then it spins up two types of actors -- Dispatcher and Workers.
*
* Dispatcher -- Distributing sub-tasks to workers.
* Distribution is done by putting messages into each worker's inbox,
* which is essentially an mqueue. Dispatcher keeps distributing tasks
* until all intended tasks are distributed.
*
* Workers -- Take sub-tasks and perform predefined routine for each type of tasks.
*
* Upon finishing distributing all tasks, Dispatcher will send a "terminate" message to
* each worker. vStartPOSIXDemo() will then join all actor threads and clean up mailboxes.
*
* @note A few assumptions are made in this demo, which a user might have to alter
* if to adopt this model in a new application:
*
* - The upper limit for MQUEUE_NUMBER_OF_WORKERS is set to 10.
* This is not due to physical constraint (e.g. memory), rather to make queue
* names end with a single digit number.
*
* - Message enum is cast to char/uint8_t directly, with the assumption that
* the system is not going to have more than 254 messages, which is often true
* in practice. Could extend bits used in a message to either have more messages
* or include additional arguments for a message. Proper typecasting is needed
* in that case.
*
* - The philosophy is "failure is expected". It is shown in both the way dispatcher
* delivers messages (i.e. messages can be dropped by worker(s)), and also the
* way workers process messages (i.e. workers do not inform dispatcher success or
* failure).
*
* - Following the philosophy, dispatcher shall never use blocking calls to distribute
* tasks. The only exception made here is that dispatcher needs to make sure the
* successful delivery of "terminate" messages. So that, main thread could join
* all actor threads and finish the demo.
*/
/* FreeRTOS includes. */
#include "FreeRTOS_POSIX.h"
/* System headers. */
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
/* Demo includes. */
#include "posix_demo.h"
/* FreeRTOS+POSIX. */
#include "FreeRTOS_POSIX/pthread.h"
#include "FreeRTOS_POSIX/mqueue.h"
#include "FreeRTOS_POSIX/time.h"
#include "FreeRTOS_POSIX/fcntl.h"
#include "FreeRTOS_POSIX/errno.h"
/* Constants. */
#define LINE_BREAK "\r\n"
/**
* @brief Control messages.
*
* uint8_t is sufficient for this enum, that we are going to cast to char directly.
* If ever needed, implement a function to properly typecast.
*/
/**@{ */
typedef enum ControlMessage
{
eMSG_LOWER_INAVLID = 0x00, /**< Guard, let's not use 0x00 for messages. */
eWORKER_CTRL_MSG_CONTINUE = 0x01, /**< Dispatcher to worker, distributing another job. */
eWORKER_CTRL_MSG_EXIT = 0x02, /**< Dispatcher to worker, all jobs are finished and the worker receiving such can exit. */
/* define additional messages here */
eMSG_UPPER_INVALID = 0xFF /**< Guard, additional tasks shall be defined above. */
} eControlMessage;
/**@} */
/**
* @defgroup Configuration constants for the dispatcher-worker demo.
*/
/**@{ */
#define MQUEUE_NUMBER_OF_WORKERS ( 4 ) /**< The number of worker threads, each thread has one queue which is used as income box. */
#if ( MQUEUE_NUMBER_OF_WORKERS > 10 )
#error "Please keep MQUEUE_NUMBER_OF_WORKERS < 10."
#endif
#define MQUEUE_WORKER_QNAME_BASE "/qNode0" /**< Queue name base. */
#define MQUEUE_WORKER_QNAME_BASE_LEN ( 6 ) /** Queue name base length. */
#define MQUEUE_TIMEOUT_SECONDS ( 1 ) /**< Relative timeout for mqueue functions. */
#define MQUEUE_MAX_NUMBER_OF_MESSAGES_WORKER ( 1 ) /**< Maximum number of messages in a queue. */
#define MQUEUE_MSG_WORKER_CTRL_MSG_SIZE sizeof( uint8_t ) /**< Control message size. */
#define DEMO_ERROR ( -1 ) /**< Any non-zero value would work. */
/**@} */
/**
* @brief Structure used by Worker thread.
*/
/**@{ */
typedef struct WorkerThreadResources
{
pthread_t pxID; /**< thread ID. */
mqd_t xInboxID; /**< mqueue inbox ID. */
} WorkerThreadResources_t;
/**@} */
/**
* @brief Structure used by Dispatcher thread.
*/
/**@{ */
typedef struct DispatcherThreadResources
{
pthread_t pxID; /**< thread ID. */
mqd_t * pOutboxID; /**< a list of mqueue outbox ID. */
} DispatcherThreadResources_t;
/**@} */
/*-----------------------------------------------------------*/
static void * prvWorkerThread( void * pvArgs )
{
WorkerThreadResources_t pArgList = *( WorkerThreadResources_t * ) pvArgs;
printf( "Worker thread #[%d] - start %s", ( int ) pArgList.pxID, LINE_BREAK );
struct timespec xReceiveTimeout = { 0 };
ssize_t xMessageSize = 0;
char pcReceiveBuffer[ MQUEUE_MSG_WORKER_CTRL_MSG_SIZE ] = { 0 };
/* This is a worker thread that reacts based on what is sent to its inbox (mqueue). */
while( true )
{
clock_gettime( CLOCK_REALTIME, &xReceiveTimeout );
xReceiveTimeout.tv_sec += MQUEUE_TIMEOUT_SECONDS;
xMessageSize = mq_receive( pArgList.xInboxID,
pcReceiveBuffer,
MQUEUE_MSG_WORKER_CTRL_MSG_SIZE,
0 );
/* Parse messages */
if( xMessageSize == MQUEUE_MSG_WORKER_CTRL_MSG_SIZE )
{
switch( ( int ) pcReceiveBuffer[ 0 ] )
{
case eWORKER_CTRL_MSG_CONTINUE:
/* Task branch, currently only prints message to screen. */
/* Could perform tasks here. Could also notify dispatcher upon completion, if desired. */
printf( "Worker thread #[%d] -- Received eWORKER_CTRL_MSG_CONTINUE %s", ( int ) pArgList.pxID, LINE_BREAK );
break;
case eWORKER_CTRL_MSG_EXIT:
printf( "Worker thread #[%d] -- Finished. Exit now. %s", ( int ) pArgList.pxID, LINE_BREAK );
return NULL;
default:
/* Received a message that we don't care or not defined. */
break;
}
}
else
{
/* Invalid message. Error handling can be done here, if desired. */
}
}
/* You should never hit here. */
/* return NULL; */
}
/*-----------------------------------------------------------*/
static void * prvDispatcherThread( void * pvArgs )
{
DispatcherThreadResources_t pArgList = *( DispatcherThreadResources_t * ) pvArgs;
printf( "Dispatcher thread - start %s", LINE_BREAK );
struct timespec xSendTimeout = { 0 };
ssize_t xMessageSize = 0;
char pcSendBuffer[ MQUEUE_MSG_WORKER_CTRL_MSG_SIZE ] = { 0 };
/* Just for fun, let threads do a total of 100 independent tasks. */
int i = 0;
const int totalNumOfJobsPerThread = 100;
/* Distribute 1000 independent tasks to workers, in round-robin fashion. */
pcSendBuffer[ 0 ] = ( char ) eWORKER_CTRL_MSG_CONTINUE;
for( i = 0; i < totalNumOfJobsPerThread; i++ )
{
clock_gettime( CLOCK_REALTIME, &xSendTimeout );
xSendTimeout.tv_sec += MQUEUE_TIMEOUT_SECONDS;
printf( "Dispatcher iteration #[%d] -- Sending msg to worker thread #[%d]. %s", i, ( int ) pArgList.pOutboxID[ i % MQUEUE_NUMBER_OF_WORKERS ], LINE_BREAK );
xMessageSize = mq_timedsend( pArgList.pOutboxID[ i % MQUEUE_NUMBER_OF_WORKERS ],
pcSendBuffer,
MQUEUE_MSG_WORKER_CTRL_MSG_SIZE,
0,
&xSendTimeout );
if( xMessageSize != 0 )
{
/* This error is acceptable in our setup.
* Since inbox for each thread fits only one message.
* In reality, balance inbox size, message arrival rate, and message drop rate. */
printf( "An acceptable failure -- dispatcher failed to send eWORKER_CTRL_MSG_CONTINUE to outbox ID: %x. errno %d %s",
( int ) pArgList.pOutboxID[ i % MQUEUE_NUMBER_OF_WORKERS ], errno, LINE_BREAK );
}
}
/* Control thread is now done with distributing jobs. Tell workers they are done. */
pcSendBuffer[ 0 ] = ( char ) eWORKER_CTRL_MSG_EXIT;
for( i = 0; i < MQUEUE_NUMBER_OF_WORKERS; i++ )
{
printf( "Dispatcher [%d] -- Sending eWORKER_CTRL_MSG_EXIT to worker thread #[%d]. %s", i, ( int ) pArgList.pOutboxID[ i % MQUEUE_NUMBER_OF_WORKERS ], LINE_BREAK );
/* This is a blocking call, to guarantee worker thread exits. */
xMessageSize = mq_send( pArgList.pOutboxID[ i % MQUEUE_NUMBER_OF_WORKERS ],
pcSendBuffer,
MQUEUE_MSG_WORKER_CTRL_MSG_SIZE,
0 );
}
return NULL;
}
/*-----------------------------------------------------------*/
/**
* @brief Job distribution with actor model.
*
* See the top of this file for detailed description.
*/
void vStartPOSIXDemo( void *pvParameters )
{
int i = 0;
int iStatus = 0;
/* Remove warnings about unused parameters. */
( void ) pvParameters;
/* Handles of the threads and related resources. */
DispatcherThreadResources_t pxDispatcher = { 0 };
WorkerThreadResources_t pxWorkers[ MQUEUE_NUMBER_OF_WORKERS ] = { { 0 } };
mqd_t workerMqueues[ MQUEUE_NUMBER_OF_WORKERS ] = { 0 };
struct mq_attr xQueueAttributesWorker =
{
.mq_flags = 0,
.mq_maxmsg = MQUEUE_MAX_NUMBER_OF_MESSAGES_WORKER,
.mq_msgsize = MQUEUE_MSG_WORKER_CTRL_MSG_SIZE,
.mq_curmsgs = 0
};
pxDispatcher.pOutboxID = workerMqueues;
/* Create message queues for each worker thread. */
for( i = 0; i < MQUEUE_NUMBER_OF_WORKERS; i++ )
{
/* Prepare a unique queue name for each worker. */
char qName[] = MQUEUE_WORKER_QNAME_BASE;
qName[ MQUEUE_WORKER_QNAME_BASE_LEN - 1 ] = qName[ MQUEUE_WORKER_QNAME_BASE_LEN - 1 ] + i;
/* Open a queue with --
* O_CREAT -- create a message queue.
* O_RDWR -- both receiving and sending messages.
*/
pxWorkers[ i ].xInboxID = mq_open( qName,
O_CREAT | O_RDWR,
( mode_t ) 0,
&xQueueAttributesWorker );
if( pxWorkers[ i ].xInboxID == ( mqd_t ) -1 )
{
printf( "Invalid inbox (mqueue) for worker. %s", LINE_BREAK );
iStatus = DEMO_ERROR;
break;
}
/* Outboxes of dispatcher thread is the inboxes of all worker threads. */
pxDispatcher.pOutboxID[ i ] = pxWorkers[ i ].xInboxID;
}
/* Create and start Worker threads. */
if( iStatus == 0 )
{
for( i = 0; i < MQUEUE_NUMBER_OF_WORKERS; i++ )
{
( void ) pthread_create( &( pxWorkers[ i ].pxID ), NULL, prvWorkerThread, &pxWorkers[ i ] );
}
/* Create and start dispatcher thread. */
( void ) pthread_create( &( pxDispatcher.pxID ), NULL, prvDispatcherThread, &pxDispatcher );
/* Actors will do predefined tasks in threads. Current implementation is that
* dispatcher actor notifies worker actors to terminate upon finishing distributing tasks. */
/* Wait for worker threads to join. */
for( i = 0; i < MQUEUE_NUMBER_OF_WORKERS; i++ )
{
( void ) pthread_join( pxWorkers[ i ].pxID, NULL );
}
/* Wait for dispatcher thread to join. */
( void ) pthread_join( pxDispatcher.pxID, NULL );
}
/* Close and unlink worker message queues. */
for( i = 0; i < MQUEUE_NUMBER_OF_WORKERS; i++ )
{
char qName[] = MQUEUE_WORKER_QNAME_BASE;
qName[ MQUEUE_WORKER_QNAME_BASE_LEN - 1 ] = qName[ MQUEUE_WORKER_QNAME_BASE_LEN - 1 ] + i;
if( pxWorkers[ i ].xInboxID != NULL )
{
( void ) mq_close( pxWorkers[ i ].xInboxID );
( void ) mq_unlink( qName );
}
}
/* Have something on console. */
if( iStatus == 0 )
{
printf( "All threads finished. %s", LINE_BREAK );
}
else
{
printf( "Queues did not get initialized properly. Did not run demo. %s", LINE_BREAK );
}
/* This task was created with the native xTaskCreate() API function, so
must not run off the end of its implementing thread. */
vTaskDelete( NULL );
}

View File

@ -1,32 +0,0 @@
/*
* FreeRTOS Kernel V10.0.1
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
#ifndef _POSIX_DEMO_H_
#define _POSIX_DEMO_H_
void vStartPOSIXDemo( void * pvParameters );
#endif /* _POSIX_DEMO_H_ */

View File

@ -1,6 +0,0 @@
Directories:
+ FreeRTOS-Plus\Demo\FreeRTOS_Plus_POSIX_with_actor_Windows_Simulator
contains a FreeRTOS windows simulator demo project for FreeRTOS+POSIX.
See http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_POSIX/ for information about this project.

View File

@ -1,9 +0,0 @@
Directories:
+ The FreeRTOS-Plus/Demo directory contains a demo application for every most of
the FreeRTOS+ components. Lots of the demo applications use the FreeRTOS
Windows simulator for easy evaluation. Be aware that FreeRTOS is much slower
and not deterministic when executed in a simulated environment.
+ See http://www.freertos.org/plus

View File

@ -1,37 +0,0 @@
The FreeRTOS kernel is released under the MIT open source license, the text of
which is provided below.
This license covers the FreeRTOS kernel source files, which are located in the
/FreeRTOS/Source directory of the official FreeRTOS kernel download. It also
covers most of the source files in the demo application projects, which are
located in the /FreeRTOS/Demo directory of the official FreeRTOS download. The
demo projects may also include third party software that is not part of FreeRTOS
and is licensed separately to FreeRTOS. Examples of third party software
includes header files provided by chip or tools vendors, linker scripts,
peripheral drivers, etc. All the software in subdirectories of the /FreeRTOS
directory is either open source or distributed with permission, and is free for
use. For the avoidance of doubt, refer to the comments at the top of each
source file.
License text:
-------------
Copyright (C) 2018 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.

@ -1 +0,0 @@
Subproject commit 210b1ffcc87bcff93871a37fbf0ad2033870ecaf

View File

@ -1,5 +0,0 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
[InternetShortcut]
URL=http://www.freertos.org/a00090.html
IDList=

View File

@ -1,21 +0,0 @@
Directories:
+ The FreeRTOS/Source directory contains the FreeRTOS source code, and contains
its own readme file.
+ The FreeRTOS/Demo directory contains a demo application for every official
FreeRTOS port, and contains its own readme file.
+ See http://www.freertos.org/a00017.html for full details of the directory
structure and information on locating the files you require.
The easiest way to use FreeRTOS is to start with one of the pre-configured demo
application projects (found in the FreeRTOS/Demo directory). That way you will
have the correct FreeRTOS source files included, and the correct include paths
configured. Once a demo application is building and executing you can remove
the demo application file, and start to add in your own application source
files.
See also -
http://www.freertos.org/FreeRTOS-quick-start-guide.html
http://www.freertos.org/FAQHelp.html