-.project
-.cproject
-*.ilk
-*.manifest
-*.metagen
-*.pdb
+/.project
+/.cproject
+/*.dll
+/*.exe
+/*.exp
+/*.ilk
+/*.lib
+/*.manifest
+/*.metagen
+/*.pdb
aclocal.m4
autom4te.cache
Makefile.in
missing
-libcec.dll
-libcec.exp
-libcec.ilk
-libcec.lib
-libcec.pdb
-cec-client.exe
-cec-client.ilk
-cec-client.pdb
-CecSharpClient.exe
-CecSharpClient.pdb
-CecSharpClient.vshost.exe
-CecSharpClient.vshost.exe.manifest
-
-LibCecSharp.dll
-LibCecSharp.Net2.dll
-LibCecSharp.ilk
-LibCecSharp.pdb
-
build
include/boost
project/Properties
project/*.suo
project/*.user
+project/x64
src/lib/.deps
src/lib/.libs
+#pragma once
/*
* This file is part of the libCEC(R) library.
*
CEC::ICECAdapter *LoadLibCec(const char *strName, CEC::cec_logical_address iLogicalAddress = CEC::CECDEVICE_PLAYBACKDEVICE1, uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS, const char *strLib = NULL)
{
if (!g_libCEC)
+#if defined(_WIN64)
+ g_libCEC = LoadLibrary(strLib ? strLib : "libcec.x64.dll");
+#else
g_libCEC = LoadLibrary(strLib ? strLib : "libcec.dll");
+#endif
if (!g_libCEC)
return NULL;
CEC::ICECAdapter *LibCecInit(const char *strDeviceName, CEC::cec_device_type_list types, const char *strLib = NULL)
{
if (!g_libCEC)
+#if defined(_WIN64)
+ g_libCEC = LoadLibrary(strLib ? strLib : "libcec.x64.dll");
+#else
g_libCEC = LoadLibrary(strLib ? strLib : "libcec.dll");
+#endif
if (!g_libCEC)
return NULL;
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E54D4581-CD59-4687-BB10-694B8192EABA}.Debug|Win32.ActiveCfg = Debug|Win32
{E54D4581-CD59-4687-BB10-694B8192EABA}.Debug|Win32.Build.0 = Debug|Win32
+ {E54D4581-CD59-4687-BB10-694B8192EABA}.Debug|x64.ActiveCfg = Debug|x64
+ {E54D4581-CD59-4687-BB10-694B8192EABA}.Debug|x64.Build.0 = Debug|x64
{E54D4581-CD59-4687-BB10-694B8192EABA}.Release|Win32.ActiveCfg = Release|Win32
{E54D4581-CD59-4687-BB10-694B8192EABA}.Release|Win32.Build.0 = Release|Win32
+ {E54D4581-CD59-4687-BB10-694B8192EABA}.Release|x64.ActiveCfg = Release|x64
+ {E54D4581-CD59-4687-BB10-694B8192EABA}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
<Platform
Name="Win32"
/>
+ <Platform
+ Name="x64"
+ />
</Platforms>
<ToolFiles>
</ToolFiles>
Name="VCPostBuildEventTool"
/>
</Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(SolutionDir).."
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ ManagedExtensions="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""$(SolutionDir)..\include";"$(SolutionDir)..\src\lib\platform\windows""
+ PreprocessorDefinitions="_DEBUG"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ WarnAsError="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)..\libcec.x64.lib $(NOINHERIT)"
+ OutputFile="$(OutDir)\$(ProjectName).x64.dll"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ AssemblyDebug="1"
+ TargetMachine="17"
+ KeyFile="$(SolutionDir)LibCecSharp.Net2-dev.snk"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir).."
Name="VCPostBuildEventTool"
/>
</Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(SolutionDir).."
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ ManagedExtensions="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(SolutionDir)..\include";"$(SolutionDir)..\src\lib\platform\windows""
+ PreprocessorDefinitions="NDEBUG"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ WarnAsError="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(SolutionDir)..\libcec.x64.lib $(NoInherit)"
+ OutputFile="$(OutDir)\$(ProjectName).x64.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ TargetMachine="17"
+ KeyFile="$(SolutionDir)LibCecSharp.Net2-dev.snk"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
</Configurations>
<References>
<AssemblyReference
RelativePath="..\src\LibCecSharp\LibCecSharp.cpp"
>
</File>
- <File
- RelativePath="..\src\LibCecSharp\Stdafx.cpp"
- >
- </File>
</Filter>
<Filter
Name="Header Files"
RelativePath="..\src\LibCecSharp\resource.h"
>
</File>
- <File
- RelativePath="..\src\LibCecSharp\Stdafx.h"
- >
- </File>
</Filter>
</Files>
<Globals>
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}</ProjectGuid>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CLRSupport>true</CLRSupport>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CLRSupport>true</CLRSupport>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>true</LinkIncremental>
<IncludePath>$(SolutionDir)\..\include;$(IncludePath)</IncludePath>
<TargetName>$(ProjectName)</TargetName>
<OutDir>$(SolutionDir)..\</OutDir>
<LinkKeyFile>$(SolutionDir)LibCecSharp.Net2-dev.snk</LinkKeyFile>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <IncludePath>$(SolutionDir)\..\include;$(IncludePath)</IncludePath>
+ <TargetName>$(ProjectName).x64</TargetName>
+ <OutDir>$(SolutionDir)..\</OutDir>
+ <LinkKeyFile>$(SolutionDir)LibCecSharp.Net2-dev.snk</LinkKeyFile>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
<IncludePath>$(SolutionDir)\..\include;$(IncludePath)</IncludePath>
<LinkKeyFile>$(SolutionDir)LibCecSharp.Net2-dev.snk</LinkKeyFile>
+ <OutDir>$(SolutionDir)..\</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <IncludePath>$(SolutionDir)\..\include;$(IncludePath)</IncludePath>
+ <LinkKeyFile>$(SolutionDir)LibCecSharp.Net2-dev.snk</LinkKeyFile>
+ <TargetName>$(ProjectName).x64</TargetName>
+ <OutDir>$(SolutionDir)..\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>
+ </AdditionalDependencies>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_WIN64;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<Link>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
- <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>
+ </AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PreprocessorDefinitions>_WIN64;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<Link>
)
echo Cleaning libCEC
-%COMPILER10% libcec.sln /clean Release
+%COMPILER10% libcec.sln /clean "Release|Win32"
echo Compiling libCEC
-%COMPILER10% libcec.sln /build Release /project libcec
+%COMPILER10% libcec.sln /build "Release|Win32" /project libcec
echo Compiling cec-client
-%COMPILER10% libcec.sln /build Release /project testclient
+%COMPILER10% libcec.sln /build "Release|Win32" /project testclient
echo Compiling LibCecSharp
-%COMPILER10% libcec.sln /build Release /project LibCecSharp
+%COMPILER10% libcec.sln /build "Release|Win32" /project LibCecSharp
+
+IF EXIST "%ProgramFiles(x86)%" (
+echo Cleaning libCEC x64
+%COMPILER10% libcec.sln /clean "Release|x64"
+echo Compiling libCEC x64
+%COMPILER10% libcec.sln /build "Release|x64" /project libcec
+echo Compiling cec-client x64
+%COMPILER10% libcec.sln /build "Release|x64" /project testclient
+echo Compiling LibCecSharp x64
+%COMPILER10% libcec.sln /build "Release|x64" /project LibCecSharp
+)
IF "%VS90COMNTOOLS%"=="" (
set COMPILER9="%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe"
set COMPILER9="%VS90COMNTOOLS%\..\IDE\devenv.exe"
) ELSE GOTO NOSDK9
+echo Cleaning LibCecSharp.Net2
+%COMPILER9% LibCecSharp.Net2.sln /clean "Release|Win32"
echo Compiling LibCecSharp.Net2
-%COMPILER9% LibCecSharp.Net2.sln /build Release
+%COMPILER9% LibCecSharp.Net2.sln /build "Release|Win32"
+
+IF EXIST "%ProgramFiles(x86)%" (
+echo Cleaning LibCecSharp.Net2 x64
+%COMPILER9% LibCecSharp.Net2.sln /clean "Release|x64"
+echo Compiling LibCecSharp.Net2 x64
+%COMPILER9% LibCecSharp.Net2.sln /build "Release|x64"
+)
:NOSDK9
echo Copying driver installer
:NODDK
echo Windows DDK could not be found on your system
-:EXIT
\ No newline at end of file
+:EXIT
SectionIn 1 #section is in installtype Full
SetOutPath "$INSTDIR"
File "..\AUTHORS"
- File "..\cec-client.exe"
+ File "..\cec*.exe"
File "..\ChangeLog"
File "..\COPYING"
- File "..\*.dll"
- File "..\libcec.lib"
- File "Release\LibCecSharp.dll"
+ File "..\libcec*.dll"
+ File "..\libcec*.lib"
+ File "..\LibCecSharp*.dll"
File "..\README"
; Copy to XBMC\system
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" "$INSTDIR\cec-client.exe" \
"" "$INSTDIR\cec-client.exe" 0 SW_SHOWNORMAL \
"" "Start the CEC Test client."
+ ${If} ${RunningX64}
+ CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk" "$INSTDIR\cec-client.x64.exe" \
+ "" "$INSTDIR\cec-client.x64.exe" 0 SW_SHOWNORMAL \
+ "" "Start the CEC Test client (x64)."
+ ${EndIf}
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk" "$INSTDIR\Uninstall.exe" \
"" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \
"" "Uninstall libCEC."
ExecWait '"$INSTDIR\driver\dpinst-x64.exe" /u "$INSTDIR\driver\OEM001.inf"'
${EndIf}
Delete "$INSTDIR\AUTHORS"
- Delete "$INSTDIR\cec-client.exe"
+ Delete "$INSTDIR\cec*.exe"
Delete "$INSTDIR\ChangeLog"
Delete "$INSTDIR\COPYING"
Delete "$INSTDIR\*.dll"
- Delete "$INSTDIR\libcec.lib"
- Delete "$INSTDIR\libcec.pdb"
+ Delete "$INSTDIR\*.lib"
+ Delete "$INSTDIR\*.pdb"
Delete "$INSTDIR\README"
Delete "$INSTDIR\driver\OEM001.inf"
Delete "$INSTDIR\driver\dpinst-amd64.exe"
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk"
+ ${If} ${RunningX64}
+ Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk"
+ ${EndIf}
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url"
RMDir "$SMPROGRAMS\$StartMenuFolder"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x86 = Debug|x86
- Release|x86 = Release|x86
+ Debug|x64 = Debug|x64
+ Debug|Win32 = Debug|Win32
+ Release|x64 = Release|x64
+ Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}.Debug|x86.ActiveCfg = Debug|Win32
- {C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}.Debug|x86.Build.0 = Debug|Win32
- {C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}.Release|x86.ActiveCfg = Release|Win32
- {C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}.Release|x86.Build.0 = Release|Win32
- {F01222BF-6B3D-43BD-B254-434031CB9887}.Debug|x86.ActiveCfg = Debug|Win32
- {F01222BF-6B3D-43BD-B254-434031CB9887}.Debug|x86.Build.0 = Debug|Win32
- {F01222BF-6B3D-43BD-B254-434031CB9887}.Release|x86.ActiveCfg = Release|Win32
- {F01222BF-6B3D-43BD-B254-434031CB9887}.Release|x86.Build.0 = Release|Win32
- {1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}.Debug|x86.ActiveCfg = Debug|Win32
- {1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}.Debug|x86.Build.0 = Debug|Win32
- {1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}.Release|x86.ActiveCfg = Release|Win32
- {1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}.Release|x86.Build.0 = Release|Win32
+ {C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}.Debug|x64.ActiveCfg = Debug|x64
+ {C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}.Debug|x64.Build.0 = Debug|x64
+ {C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}.Debug|Win32.Build.0 = Debug|Win32
+ {C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}.Release|x64.ActiveCfg = Release|x64
+ {C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}.Release|x64.Build.0 = Release|x64
+ {C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}.Release|Win32.ActiveCfg = Release|Win32
+ {C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}.Release|Win32.Build.0 = Release|Win32
+ {F01222BF-6B3D-43BD-B254-434031CB9887}.Debug|x64.ActiveCfg = Debug|x64
+ {F01222BF-6B3D-43BD-B254-434031CB9887}.Debug|x64.Build.0 = Debug|x64
+ {F01222BF-6B3D-43BD-B254-434031CB9887}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F01222BF-6B3D-43BD-B254-434031CB9887}.Debug|Win32.Build.0 = Debug|Win32
+ {F01222BF-6B3D-43BD-B254-434031CB9887}.Release|x64.ActiveCfg = Release|x64
+ {F01222BF-6B3D-43BD-B254-434031CB9887}.Release|x64.Build.0 = Release|x64
+ {F01222BF-6B3D-43BD-B254-434031CB9887}.Release|Win32.ActiveCfg = Release|Win32
+ {F01222BF-6B3D-43BD-B254-434031CB9887}.Release|Win32.Build.0 = Release|Win32
+ {1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}.Debug|x64.ActiveCfg = Debug|x64
+ {1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}.Debug|x64.Build.0 = Debug|x64
+ {1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}.Debug|Win32.Build.0 = Debug|Win32
+ {1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}.Release|x64.ActiveCfg = Release|x64
+ {1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}.Release|x64.Build.0 = Release|x64
+ {1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}.Release|Win32.ActiveCfg = Release|Win32
+ {1AC27FBD-653A-4F5F-ADBC-2A8FD074EEB7}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\cec.h" />
<ClInclude Include="..\src\lib\implementations\SLCommandHandler.h" />
<ClInclude Include="..\src\lib\implementations\VLCommandHandler.h" />
<ClInclude Include="..\src\lib\LibCEC.h" />
- <ClInclude Include="..\src\lib\platform\baudrate.h" />
- <ClInclude Include="..\src\lib\platform\os-dependent.h" />
- <ClInclude Include="..\src\lib\platform\posix\pthreads.h" />
- <ClInclude Include="..\src\lib\platform\pthread_win32\pthread.h" />
- <ClInclude Include="..\src\lib\platform\pthread_win32\sched.h" />
- <ClInclude Include="..\src\lib\platform\pthread_win32\semaphore.h" />
- <ClInclude Include="..\src\lib\platform\serialport.h" />
- <ClInclude Include="..\src\lib\platform\threads.h" />
+ <ClInclude Include="..\src\lib\platform\buffer.h" />
+ <ClInclude Include="..\src\lib\platform\os.h" />
+ <ClInclude Include="..\src\lib\platform\serialport\baudrate.h" />
+ <ClInclude Include="..\src\lib\platform\serialport\serialport.h" />
+ <ClInclude Include="..\src\lib\platform\StdString.h" />
+ <ClInclude Include="..\src\lib\platform\threads\mutex.h" />
+ <ClInclude Include="..\src\lib\platform\threads\threads.h" />
<ClInclude Include="..\src\lib\platform\timeutils.h" />
- <ClInclude Include="..\src\lib\platform\windows\dlfcn-win32.h" />
- <ClInclude Include="..\src\lib\platform\windows\os_windows.h" />
- <ClInclude Include="..\src\lib\util\buffer.h" />
- <ClInclude Include="..\src\lib\util\StdString.h" />
- <ClInclude Include="resource.h" />
+ <ClInclude Include="..\src\lib\platform\windows\os-threads.h" />
+ <ClInclude Include="..\src\lib\platform\windows\os-types.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\lib\AdapterCommunication.cpp" />
<ClCompile Include="..\src\lib\LibCEC.cpp" />
<ClCompile Include="..\src\lib\LibCECC.cpp" />
<ClCompile Include="..\src\lib\LibCECDll.cpp" />
- <ClCompile Include="..\src\lib\platform\posix\pthreads.cpp" />
- <ClCompile Include="..\src\lib\platform\threads.cpp" />
- <ClCompile Include="..\src\lib\platform\windows\dlfcn-win32.cpp" />
- <ClCompile Include="..\src\lib\platform\windows\os_windows.cpp" />
<ClCompile Include="..\src\lib\platform\windows\serialport.cpp" />
</ItemGroup>
<ItemGroup>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)..\</OutDir>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <OutDir>$(SolutionDir)..\</OutDir>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>libcec</TargetName>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetExt>.dll</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <TargetName>$(ProjectName).x64</TargetName>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ExtensionsToDeleteOnClean>*.cdf;*.cache;*.obj;*.ilk;*.resources;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;*.tlog;*.manifest;*.res;*.pch;*.exp;*.idb;*.rep;*.xdc;*.pdb;*_manifest.rc;*.bsc;*.sbr;*.xml;*.dll</ExtensionsToDeleteOnClean>
+ <IncludePath>$(SolutionDir)..\include;$(IncludePath)</IncludePath>
+ <IgnoreImportLibrary>false</IgnoreImportLibrary>
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\</OutDir>
<TargetName>libcec</TargetName>
<TargetExt>.dll</TargetExt>
<ExtensionsToDeleteOnClean>*.cdf;*.cache;*.obj;*.ilk;*.resources;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;*.tlog;*.manifest;*.res;*.pch;*.exp;*.idb;*.rep;*.xdc;*.pdb;*_manifest.rc;*.bsc;*.sbr;*.xml;*.dll</ExtensionsToDeleteOnClean>
<IncludePath>$(SolutionDir)..\include;$(IncludePath)</IncludePath>
- <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <OutDir>$(SolutionDir)..\</OutDir>
+ <TargetName>$(ProjectName).x64</TargetName>
+ <TargetExt>.dll</TargetExt>
+ <ExtensionsToDeleteOnClean>*.cdf;*.cache;*.obj;*.ilk;*.resources;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;*.tlog;*.manifest;*.res;*.pch;*.exp;*.idb;*.rep;*.xdc;*.pdb;*_manifest.rc;*.bsc;*.sbr;*.xml;*.dll</ExtensionsToDeleteOnClean>
+ <IncludePath>$(SolutionDir)..\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;__WINDOWS__;DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(SolutionDir)..\src\lib\platform\pthread_win32;$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DisableSpecificWarnings>4996;4100;4309;4505</DisableSpecificWarnings>
+ <PreprocessorDefinitions>_USE_32BIT_TIME_T;_DEBUG;_CRT_SECURE_NO_WARNINGS;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>
+ </DisableSpecificWarnings>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <OutputFile>$(SolutionDir)..\libcec.dll</OutputFile>
- <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib;$(SolutionDir)..\src\lib\platform\pthread_win32\pthreadVC2.lib</AdditionalDependencies>
+ <OutputFile>$(SolutionDir)..\$(TargetName)$(TargetExt)</OutputFile>
+ <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib</AdditionalDependencies>
+ <IgnoreSpecificDefaultLibraries>libcmtd</IgnoreSpecificDefaultLibraries>
+ <Version>
+ </Version>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level4</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_WIN64;_DEBUG;_CRT_SECURE_NO_WARNINGS;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>
+ </DisableSpecificWarnings>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OutputFile>$(SolutionDir)..\$(TargetName)$(TargetExt)</OutputFile>
+ <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libcmtd</IgnoreSpecificDefaultLibraries>
<Version>
</Version>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir)..\src\lib\platform\pthread_win32;$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;__WINDOWS__;DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <DisableSpecificWarnings>4100;4309</DisableSpecificWarnings>
+ <PreprocessorDefinitions>_USE_32BIT_TIME_T;_CRT_SECURE_NO_WARNINGS;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <DisableSpecificWarnings>
+ </DisableSpecificWarnings>
<TreatWarningAsError>true</TreatWarningAsError>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<OutputFile>$(SolutionDir)..\libcec.dll</OutputFile>
- <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib;$(SolutionDir)..\src\lib\platform\pthread_win32\pthreadVC2.lib</AdditionalDependencies>
+ <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib</AdditionalDependencies>
+ <IgnoreSpecificDefaultLibraries>libcmt</IgnoreSpecificDefaultLibraries>
+ <Version>
+ </Version>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level4</WarningLevel>
+ <Optimization>Full</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_WIN64;_CRT_SECURE_NO_WARNINGS;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <DisableSpecificWarnings>
+ </DisableSpecificWarnings>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <OutputFile>$(SolutionDir)..\$(TargetName)$(TargetExt)</OutputFile>
+ <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libcmt</IgnoreSpecificDefaultLibraries>
<Version>
</Version>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <Filter Include="util">
- <UniqueIdentifier>{4171e8da-4c9d-40dd-97a3-755ba5535ca6}</UniqueIdentifier>
- </Filter>
<Filter Include="platform">
<UniqueIdentifier>{cc48ddc0-be11-43ec-a805-3a9434f443ed}</UniqueIdentifier>
</Filter>
<Filter Include="devices">
<UniqueIdentifier>{bfc43a58-636d-4c1a-b191-486cb8509c7c}</UniqueIdentifier>
</Filter>
- <Filter Include="platform\pthread_win32">
- <UniqueIdentifier>{61b13ee2-8a5b-4f05-9796-08138ee6ebc1}</UniqueIdentifier>
+ <Filter Include="platform\windows">
+ <UniqueIdentifier>{fa3d5953-d288-45e9-93f4-8419e6b701c7}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="platform\serialport">
+ <UniqueIdentifier>{e3945145-efa2-4393-b201-f50e1e775008}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="platform\threads">
+ <UniqueIdentifier>{38a27e9e-86ad-46f6-a4fb-e1e524267b74}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="..\src\lib\util\buffer.h">
- <Filter>util</Filter>
- </ClInclude>
- <ClInclude Include="..\src\lib\util\StdString.h">
- <Filter>util</Filter>
- </ClInclude>
<ClInclude Include="..\src\lib\AdapterCommunication.h" />
<ClInclude Include="..\src\lib\AdapterDetection.h" />
<ClInclude Include="..\src\lib\CECProcessor.h" />
<ClInclude Include="..\src\lib\LibCEC.h" />
- <ClInclude Include="..\src\lib\platform\baudrate.h">
- <Filter>platform</Filter>
- </ClInclude>
- <ClInclude Include="..\src\lib\platform\os-dependent.h">
- <Filter>platform</Filter>
- </ClInclude>
- <ClInclude Include="..\src\lib\platform\serialport.h">
- <Filter>platform</Filter>
- </ClInclude>
- <ClInclude Include="..\src\lib\platform\threads.h">
- <Filter>platform</Filter>
- </ClInclude>
<ClInclude Include="..\src\lib\platform\timeutils.h">
<Filter>platform</Filter>
</ClInclude>
- <ClInclude Include="..\src\lib\platform\windows\dlfcn-win32.h">
- <Filter>platform</Filter>
- </ClInclude>
- <ClInclude Include="..\src\lib\platform\windows\os_windows.h">
- <Filter>platform</Filter>
- </ClInclude>
<ClInclude Include="..\include\cec.h">
<Filter>exports</Filter>
</ClInclude>
<ClInclude Include="..\src\lib\devices\CECBusDevice.h">
<Filter>devices</Filter>
</ClInclude>
- <ClInclude Include="resource.h" />
<ClInclude Include="..\src\lib\implementations\VLCommandHandler.h">
<Filter>implementations</Filter>
</ClInclude>
<ClInclude Include="..\src\lib\devices\CECTV.h">
<Filter>devices</Filter>
</ClInclude>
- <ClInclude Include="..\src\lib\platform\posix\pthreads.h">
+ <ClInclude Include="..\src\lib\platform\os.h">
<Filter>platform</Filter>
</ClInclude>
- <ClInclude Include="..\src\lib\platform\pthread_win32\pthread.h">
- <Filter>platform\pthread_win32</Filter>
+ <ClInclude Include="..\src\lib\platform\windows\os-threads.h">
+ <Filter>platform\windows</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\lib\platform\windows\os-types.h">
+ <Filter>platform\windows</Filter>
</ClInclude>
- <ClInclude Include="..\src\lib\platform\pthread_win32\sched.h">
- <Filter>platform\pthread_win32</Filter>
+ <ClInclude Include="..\src\lib\platform\serialport\baudrate.h">
+ <Filter>platform\serialport</Filter>
</ClInclude>
- <ClInclude Include="..\src\lib\platform\pthread_win32\semaphore.h">
- <Filter>platform\pthread_win32</Filter>
+ <ClInclude Include="..\src\lib\platform\serialport\serialport.h">
+ <Filter>platform\serialport</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\lib\platform\threads\mutex.h">
+ <Filter>platform\threads</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\lib\platform\threads\threads.h">
+ <Filter>platform\threads</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\lib\platform\buffer.h">
+ <Filter>platform</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\lib\platform\StdString.h">
+ <Filter>platform</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\lib\LibCEC.cpp" />
<ClCompile Include="..\src\lib\LibCECC.cpp" />
<ClCompile Include="..\src\lib\LibCECDll.cpp" />
- <ClCompile Include="..\src\lib\platform\threads.cpp">
- <Filter>platform</Filter>
- </ClCompile>
- <ClCompile Include="..\src\lib\platform\windows\dlfcn-win32.cpp">
- <Filter>platform</Filter>
- </ClCompile>
- <ClCompile Include="..\src\lib\platform\windows\os_windows.cpp">
- <Filter>platform</Filter>
- </ClCompile>
- <ClCompile Include="..\src\lib\platform\windows\serialport.cpp">
- <Filter>platform</Filter>
- </ClCompile>
<ClCompile Include="..\src\lib\implementations\ANCommandHandler.cpp">
<Filter>implementations</Filter>
</ClCompile>
<ClCompile Include="..\src\lib\devices\CECTV.cpp">
<Filter>devices</Filter>
</ClCompile>
- <ClCompile Include="..\src\lib\platform\posix\pthreads.cpp">
- <Filter>platform</Filter>
+ <ClCompile Include="..\src\lib\platform\windows\serialport.cpp">
+ <Filter>platform\serialport</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F01222BF-6B3D-43BD-B254-434031CB9887}</ProjectGuid>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)..\</OutDir>
<TargetName>cec-client</TargetName>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
+ <OutDir>$(SolutionDir)..\</OutDir>
+ <TargetName>cec-client.x64</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\</OutDir>
<TargetName>cec-client</TargetName>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <OutDir>$(SolutionDir)..\</OutDir>
+ <TargetName>cec-client.x64</TargetName>
+ </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;__WINDOWS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_USE_32BIT_TIME_T;_DEBUG;_CRT_SECURE_NO_WARNINGS;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <DisableSpecificWarnings>
+ </DisableSpecificWarnings>
+ <AdditionalIncludeDirectories>$(SolutiontDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(SolutionDir)..\$(TargetName)$(TargetExt)</OutputFile>
+ <Version>
+ </Version>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level4</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_WIN64;_DEBUG;_CRT_SECURE_NO_WARNINGS;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWarningAsError>true</TreatWarningAsError>
- <DisableSpecificWarnings>4100;4309;4505</DisableSpecificWarnings>
+ <DisableSpecificWarnings>
+ </DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(SolutiontDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>$(ProjectDir)..\src\lib\platform\pthread_win32\pthreadVC2.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OutputFile>$(SolutionDir)..\cec-client.exe</OutputFile>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(SolutionDir)..\$(TargetName)$(TargetExt)</OutputFile>
<Version>
</Version>
</Link>
<Optimization>Full</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>_WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;__WINDOWS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_USE_32BIT_TIME_T;_CRT_SECURE_NO_WARNINGS;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <DisableSpecificWarnings>
+ </DisableSpecificWarnings>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <Version>
+ </Version>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level4</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>Full</Optimization>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>_WIN64;_CRT_SECURE_NO_WARNINGS;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWarningAsError>true</TreatWarningAsError>
- <DisableSpecificWarnings>4100;4309</DisableSpecificWarnings>
+ <DisableSpecificWarnings>
+ </DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>$(ProjectDir)..\src\lib\platform\pthread_win32\pthreadVC2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<Version>
</Version>
+ <OutputFile>$(SolutionDir)..\$(TargetName)$(TargetExt)</OutputFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\include\cec.h" />
<ClInclude Include="..\include\cecloader.h" />
- <ClInclude Include="..\src\lib\platform\os-dependent.h" />
- <ClInclude Include="..\src\lib\platform\posix\pthreads.h" />
- <ClInclude Include="..\src\lib\platform\threads.h" />
- <ClInclude Include="..\src\lib\platform\windows\os_windows.h" />
- <ClInclude Include="..\src\lib\util\StdString.h" />
- <ClInclude Include="resource1.h" />
+ <ClInclude Include="..\src\lib\platform\os.h" />
+ <ClInclude Include="..\src\lib\platform\threads\mutex.h" />
+ <ClInclude Include="..\src\lib\platform\threads\threads.h" />
+ <ClInclude Include="..\src\lib\platform\timeutils.h" />
+ <ClInclude Include="..\src\lib\platform\windows\dlfcn-win32.h" />
+ <ClInclude Include="..\src\lib\platform\windows\os-threads.h" />
+ <ClInclude Include="..\src\lib\platform\windows\os-types.h" />
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\src\lib\platform\posix\pthreads.cpp" />
- <ClCompile Include="..\src\lib\platform\threads.cpp" />
- <ClCompile Include="..\src\lib\platform\windows\os_windows.cpp" />
+ <ClCompile Include="..\src\lib\platform\windows\dlfcn-win32.cpp" />
<ClCompile Include="..\src\testclient\main.cpp" />
</ItemGroup>
<ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ <Filter Include="exports">
+ <UniqueIdentifier>{cc0a01c1-e1e7-4af8-9656-fa9463140613}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ <Filter Include="platform">
+ <UniqueIdentifier>{f08c0a80-22d9-4bdd-90de-b9cf5fa88f99}</UniqueIdentifier>
</Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ <Filter Include="platform\threads">
+ <UniqueIdentifier>{fb28e188-b2a5-48d3-9010-b56024b19850}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="platform\windows">
+ <UniqueIdentifier>{a8b22b54-3252-44fb-a499-e42f9bac0e15}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="..\src\lib\util\StdString.h">
- <Filter>Header Files</Filter>
+ <ClInclude Include="..\include\cec.h">
+ <Filter>exports</Filter>
</ClInclude>
- <ClInclude Include="..\src\lib\platform\threads.h">
- <Filter>Header Files</Filter>
+ <ClInclude Include="..\include\cecloader.h">
+ <Filter>exports</Filter>
</ClInclude>
- <ClInclude Include="..\src\lib\platform\os-dependent.h">
- <Filter>Header Files</Filter>
+ <ClInclude Include="..\src\lib\platform\os.h">
+ <Filter>platform</Filter>
</ClInclude>
- <ClInclude Include="..\src\lib\platform\windows\os_windows.h">
- <Filter>Header Files</Filter>
+ <ClInclude Include="..\src\lib\platform\timeutils.h">
+ <Filter>platform</Filter>
</ClInclude>
- <ClInclude Include="..\include\cec.h">
- <Filter>Header Files</Filter>
+ <ClInclude Include="..\src\lib\platform\windows\dlfcn-win32.h">
+ <Filter>platform\windows</Filter>
</ClInclude>
- <ClInclude Include="..\include\cecloader.h">
- <Filter>Header Files</Filter>
+ <ClInclude Include="..\src\lib\platform\windows\os-threads.h">
+ <Filter>platform\windows</Filter>
</ClInclude>
- <ClInclude Include="resource1.h">
- <Filter>Header Files</Filter>
+ <ClInclude Include="..\src\lib\platform\windows\os-types.h">
+ <Filter>platform\windows</Filter>
</ClInclude>
- <ClInclude Include="..\src\lib\platform\posix\pthreads.h">
- <Filter>Header Files</Filter>
+ <ClInclude Include="..\src\lib\platform\threads\mutex.h">
+ <Filter>platform\threads</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\lib\platform\threads\threads.h">
+ <Filter>platform\threads</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\src\testclient\main.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\src\lib\platform\threads.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\src\lib\platform\windows\os_windows.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\src\lib\platform\posix\pthreads.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="..\src\testclient\main.cpp" />
+ <ClCompile Include="..\src\lib\platform\windows\dlfcn-win32.cpp">
+ <Filter>platform\windows</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
- <ResourceCompile Include="testclient.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
+ <ResourceCompile Include="testclient.rc" />
</ItemGroup>
</Project>
\ No newline at end of file
#include "AdapterCommunication.h"
#include "CECProcessor.h"
-#include "platform/os-dependent.h"
-#include "platform/serialport.h"
+#include "platform/serialport/serialport.h"
using namespace std;
using namespace CEC;
+using namespace PLATFORM;
CCECAdapterMessage::CCECAdapterMessage(const cec_command &command)
{
m_processor(processor),
m_iLineTimeout(0)
{
- m_port = new CSerialPort;
+ m_port = new PLATFORM::CSerialPort;
}
CAdapterCommunication::~CAdapterCommunication(void)
uint64_t iNow = GetTimeMs();
uint64_t iTimeout = iNow + iTimeoutMs;
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (!m_port)
{
if (CreateThread())
{
- m_startCondition.Wait(&m_mutex);
+ m_startCondition.Wait(m_mutex);
m_processor->AddLog(CEC_LOG_DEBUG, "communication thread started");
return true;
}
void CAdapterCommunication::Close(void)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
m_startCondition.Broadcast();
m_rcvCondition.Broadcast();
StopThread();
void *CAdapterCommunication::Process(void)
{
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
m_startCondition.Signal();
}
void CAdapterCommunication::AddData(uint8_t *data, uint8_t iLen)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
for (uint8_t iPtr = 0; iPtr < iLen; iPtr++)
m_inBuffer.Push(data[iPtr]);
void CAdapterCommunication::SendMessageToAdapter(CCECAdapterMessage *msg)
{
- CLockObject lock(&msg->mutex);
- if (m_port->Write(msg) != (int32_t) msg->size())
+ CLockObject lock(msg->mutex);
+ if (m_port->Write(msg->packet.data, msg->size()) != (int32_t) msg->size())
{
CStdString strError;
strError.Format("error writing to serial port: %s", m_port->GetError().c_str());
bool CAdapterCommunication::Read(CCECAdapterMessage &msg, uint32_t iTimeout)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
msg.clear();
uint64_t iNow = GetTimeMs();
uint8_t buf = 0;
if (!m_inBuffer.Pop(buf))
{
- if (!m_rcvCondition.Wait(&m_mutex, (uint32_t) (iTarget - iNow)))
+ if (!m_rcvCondition.Wait(m_mutex, (uint32_t) (iTarget - iNow)))
return false;
}
output->push_escaped(MSGCODE_START_BOOTLOADER);
output->push_back(MSGEND);
- CLockObject lock(&output->mutex);
+ CLockObject lock(output->mutex);
if (Write(output))
- output->condition.Wait(&output->mutex);
+ output->condition.Wait(output->mutex);
bReturn = output->state == ADAPTER_MESSAGE_STATE_SENT;
delete output;
output->push_escaped(MSGCODE_PING);
output->push_back(MSGEND);
- CLockObject lock(&output->mutex);
+ CLockObject lock(output->mutex);
if (Write(output))
- output->condition.Wait(&output->mutex);
+ output->condition.Wait(output->mutex);
bReturn = output->state == ADAPTER_MESSAGE_STATE_SENT;
delete output;
return bReturn;
}
-bool CAdapterCommunication::IsOpen(void) const
+bool CAdapterCommunication::IsOpen(void)
{
return !IsStopped() && m_port->IsOpen() && IsRunning();
}
*/
#include <cectypes.h>
-#include "util/buffer.h"
-#include <string>
-#include "util/StdString.h"
+#include "platform/os.h"
+
+namespace PLATFORM
+{
+ class CSerialPort;
+}
namespace CEC
{
cec_datapacket packet;
cec_adapter_message_state state;
int32_t transmit_timeout;
- CMutex mutex;
- CCondition condition;
+ PLATFORM::CMutex mutex;
+ PLATFORM::CCondition condition;
};
- class CSerialPort;
class CCECProcessor;
- class CAdapterCommunication : private CThread
+ class CAdapterCommunication : private PLATFORM::CThread
{
public:
CAdapterCommunication(CCECProcessor *processor);
bool Write(CCECAdapterMessage *data);
bool PingAdapter(void);
void Close(void);
- bool IsOpen(void) const;
+ bool IsOpen(void);
std::string GetError(void) const;
void *Process(void);
void AddData(uint8_t *data, uint8_t iLen);
bool ReadFromDevice(uint32_t iTimeout);
- CSerialPort * m_port;
- CCECProcessor * m_processor;
- CecBuffer<uint8_t> m_inBuffer;
- CecBuffer<CCECAdapterMessage *> m_outBuffer;
- CMutex m_mutex;
- CCondition m_rcvCondition;
- CCondition m_startCondition;
- uint8_t m_iLineTimeout;
+ PLATFORM::CSerialPort * m_port;
+ CCECProcessor * m_processor;
+ PLATFORM::SyncedBuffer<uint8_t> m_inBuffer;
+ PLATFORM::SyncedBuffer<CCECAdapterMessage *> m_outBuffer;
+ PLATFORM::CMutex m_mutex;
+ PLATFORM::CCondition m_rcvCondition;
+ PLATFORM::CCondition m_startCondition;
+ uint8_t m_iLineTimeout;
};
};
*/
#include "AdapterDetection.h"
-#include "platform/os-dependent.h"
-#include "util/StdString.h"
+#include "platform/os.h"
#if defined(__APPLE__)
#include <dirent.h>
#include "devices/CECTV.h"
#include "implementations/CECCommandHandler.h"
#include "LibCEC.h"
-#include "util/StdString.h"
-#include "platform/timeutils.h"
using namespace CEC;
using namespace std;
+using namespace PLATFORM;
CCECProcessor::CCECProcessor(CLibCEC *controller, const char *strDeviceName, cec_logical_address iLogicalAddress /* = CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress /* = CEC_DEFAULT_PHYSICAL_ADDRESS*/) :
m_bStarted(false),
bool bReturn(false);
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
/* check for an already opened connection */
if (!m_communication || m_communication->IsOpen())
}
/* create the processor thread */
- if (!CreateThread() || !m_startCondition.Wait(&m_mutex) || !m_bStarted)
+ if (!CreateThread() || !m_startCondition.Wait(m_mutex) || !m_bStarted)
{
m_controller->AddLog(CEC_LOG_ERROR, "could not create a processor thread");
return bReturn;
strLog.Format("changing device type '%s' into '%s'", ToString(from), ToString(to));
AddLog(CEC_LOG_NOTICE, strLog);
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
CCECBusDevice *previousDevice = GetDeviceByType(from);
m_logicalAddresses.primary = CECDEVICE_UNKNOWN;
CCECAdapterMessage msg;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
m_bStarted = true;
m_controller->AddLog(CEC_LOG_DEBUG, "processor thread started");
m_startCondition.Signal();
msg.clear();
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_commandBuffer.Pop(command))
{
bParseFrame = true;
void CCECProcessor::SetStandardLineTimeout(uint8_t iTimeout)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
m_iStandardLineTimeout = iTimeout;
}
void CCECProcessor::SetRetryLineTimeout(uint8_t iTimeout)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
m_iRetryLineTimeout = iTimeout;
}
bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort, bool bForce /* = false */)
{
bool bReturn(false);
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
m_iBaseDevice = iBaseDevice;
m_iHDMIPort = iPort;
uint16_t iPhysicalAddress(0);
if (iBaseDevice > CECDEVICE_TV)
{
- lock.Leave();
+ lock.Unlock();
iPhysicalAddress = m_busDevices[iBaseDevice]->GetPhysicalAddress();
lock.Lock();
}
m_controller->AddLog(CEC_LOG_ERROR, "failed to set the physical address");
else
{
- lock.Leave();
+ lock.Unlock();
SetPhysicalAddress(iPhysicalAddress);
}
bool CCECProcessor::SetLogicalAddress(cec_logical_address iLogicalAddress)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_logicalAddresses.primary != iLogicalAddress)
{
CStdString strLog;
cec_logical_addresses sendUpdatesTo;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (!m_logicalAddresses.IsEmpty())
{
bool bWasActiveSource(false);
m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str());
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
m_bMonitor = bEnable;
}
bool CCECProcessor::Transmit(CCECAdapterMessage *output)
{
bool bReturn(false);
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
{
m_iLastTransmission = GetTimeMs();
m_communication->SetLineTimeout(m_iStandardLineTimeout);
if (output->tries > 0)
m_communication->SetLineTimeout(m_iRetryLineTimeout);
- CLockObject msgLock(&output->mutex);
+ CLockObject msgLock(output->mutex);
if (!m_communication || !m_communication->Write(output))
return bReturn;
else
{
- output->condition.Wait(&output->mutex);
+ output->condition.Wait(output->mutex);
if (output->state != ADAPTER_MESSAGE_STATE_SENT)
{
m_controller->AddLog(CEC_LOG_ERROR, "command was not sent");
#include <string>
#include <cectypes.h>
#include "AdapterCommunication.h"
-#include "platform/os-dependent.h"
-#include "util/buffer.h"
-#include "util/StdString.h"
+#include "platform/os.h"
class CSerialPort;
class CAdapterCommunication;
class CCECBusDevice;
- class CCECProcessor : public CThread
+ class CCECProcessor : public PLATFORM::CThread
{
public:
CCECProcessor(CLibCEC *controller, const char *strDeviceName, cec_logical_address iLogicalAddress = CECDEVICE_PLAYBACKDEVICE1, uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS);
virtual bool StartBootloader(void);
virtual bool PingAdapter(void);
- CCECBusDevice *m_busDevices[16];
- CMutex m_transmitMutex;
+ CCECBusDevice * m_busDevices[16];
+ PLATFORM::CMutex m_transmitMutex;
private:
void ReplaceHandlers(void);
bool ParseMessage(const CCECAdapterMessage &msg);
void ParseCommand(cec_command &command);
- bool m_bStarted;
- bool m_bInitialised;
- uint8_t m_iHDMIPort;
- cec_logical_address m_iBaseDevice;
- cec_command m_currentframe;
- cec_logical_addresses m_logicalAddresses;
- cec_logical_address m_lastInitiator;
- std::string m_strDeviceName;
- cec_device_type_list m_types;
- CMutex m_mutex;
- CCondition m_startCondition;
- CAdapterCommunication* m_communication;
- CLibCEC* m_controller;
- bool m_bMonitor;
- CecBuffer<cec_command> m_commandBuffer;
- cec_keypress m_previousKey;
- CThread * m_busScan;
- uint8_t m_iLineTimeout;
- uint8_t m_iStandardLineTimeout;
- uint8_t m_iRetryLineTimeout;
- uint64_t m_iLastTransmission;
+ bool m_bStarted;
+ bool m_bInitialised;
+ uint8_t m_iHDMIPort;
+ cec_logical_address m_iBaseDevice;
+ cec_command m_currentframe;
+ cec_logical_addresses m_logicalAddresses;
+ cec_logical_address m_lastInitiator;
+ std::string m_strDeviceName;
+ cec_device_type_list m_types;
+ PLATFORM::CMutex m_mutex;
+ PLATFORM::CCondition m_startCondition;
+ CAdapterCommunication* m_communication;
+ CLibCEC* m_controller;
+ bool m_bMonitor;
+ PLATFORM::SyncedBuffer<cec_command> m_commandBuffer;
+ cec_keypress m_previousKey;
+ PLATFORM::CThread * m_busScan;
+ uint8_t m_iLineTimeout;
+ uint8_t m_iStandardLineTimeout;
+ uint8_t m_iRetryLineTimeout;
+ uint64_t m_iLastTransmission;
};
- class CCECBusScan : public CThread
+ class CCECBusScan : public PLATFORM::CThread
{
public:
CCECBusScan(CCECProcessor *processor) { m_processor = processor; }
#include "AdapterDetection.h"
#include "CECProcessor.h"
#include "devices/CECBusDevice.h"
-#include "util/StdString.h"
#include "platform/timeutils.h"
using namespace std;
using namespace CEC;
+using namespace PLATFORM;
CLibCEC::CLibCEC(const char *strDeviceName, cec_device_type_list types) :
m_iStartTime(GetTimeMs()),
bool CLibCEC::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_cec)
{
m_cbParam = cbParam;
void CLibCEC::AddLog(cec_log_level level, const string &strMessage)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_cec)
{
cec_log_message message;
void CLibCEC::AddKey(cec_keypress &key)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_callbacks)
m_callbacks->CBCecKeyPress(m_cbParam, key);
else
void CLibCEC::AddKey(void)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN)
{
cec_keypress key;
void CLibCEC::AddCommand(const cec_command &command)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_callbacks)
{
m_callbacks->CBCecCommand(m_cbParam, command);
#include <string>
#include <cec.h>
-#include "util/buffer.h"
+#include "platform/os.h"
namespace CEC
{
virtual void SetCurrentButton(cec_user_control_code iButtonCode);
protected:
- int64_t m_iStartTime;
- cec_user_control_code m_iCurrentButton;
- int64_t m_buttontime;
- CCECProcessor *m_cec;
- CecBuffer<cec_log_message> m_logBuffer;
- CecBuffer<cec_keypress> m_keyBuffer;
- CecBuffer<cec_command> m_commandBuffer;
- ICECCallbacks *m_callbacks;
- void *m_cbParam;
- CMutex m_mutex;
+ int64_t m_iStartTime;
+ cec_user_control_code m_iCurrentButton;
+ int64_t m_buttontime;
+ CCECProcessor * m_cec;
+ PLATFORM::SyncedBuffer<cec_log_message> m_logBuffer;
+ PLATFORM::SyncedBuffer<cec_keypress> m_keyBuffer;
+ PLATFORM::SyncedBuffer<cec_command> m_commandBuffer;
+ ICECCallbacks * m_callbacks;
+ void * m_cbParam;
+ PLATFORM::CMutex m_mutex;
};
};
implementations/CECCommandHandler.cpp \
implementations/SLCommandHandler.cpp \
implementations/VLCommandHandler.cpp \
- platform/posix/serialport.cpp \
- platform/posix/pthreads.cpp \
- platform/threads.cpp
+ platform/posix/serialport.cpp
libcec_la_LDFLAGS = @LIBS@ -version-info @VERSION@
libcec_la_CPPFLAGS = -I@abs_top_srcdir@/include
#include "../implementations/CECCommandHandler.h"
using namespace CEC;
+using namespace PLATFORM;
#define ToString(p) m_processor->ToString(p)
bool CCECAudioSystem::SetAudioStatus(uint8_t status)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_audioStatus != status)
{
CStdString strLog;
bool CCECAudioSystem::SetSystemAudioModeStatus(const cec_system_audio_status mode)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_systemAudioStatus != mode)
{
CStdString strLog;
{
uint8_t state;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
CStdString strLog;
strLog.Format("<< %x -> %x: audio status '%2x'", m_iLogicalAddress, dest, m_audioStatus);
AddLog(CEC_LOG_NOTICE, strLog);
{
cec_system_audio_status state;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
CStdString strLog;
strLog.Format("<< %x -> %x: set system audio mode '%2x'", m_iLogicalAddress, dest, m_audioStatus);
AddLog(CEC_LOG_NOTICE, strLog);
{
cec_system_audio_status state;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
CStdString strLog;
strLog.Format("<< %x -> %x: system audio mode '%s'", m_iLogicalAddress, dest, ToString(m_systemAudioStatus));
AddLog(CEC_LOG_NOTICE, strLog);
if (TransmitKeypress(CEC_USER_CONTROL_CODE_VOLUME_UP) && bSendRelease)
TransmitKeyRelease();
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_audioStatus;
}
if (TransmitKeypress(CEC_USER_CONTROL_CODE_VOLUME_DOWN) && bSendRelease)
TransmitKeyRelease();
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_audioStatus;
}
if (TransmitKeypress(CEC_USER_CONTROL_CODE_MUTE) && bSendRelease)
TransmitKeyRelease();
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_audioStatus;
}
#include "../implementations/CECCommandHandler.h"
#include "../implementations/SLCommandHandler.h"
#include "../implementations/VLCommandHandler.h"
-#include "../platform/timeutils.h"
using namespace CEC;
+using namespace PLATFORM;
#define ToString(p) m_processor->ToString(p)
m_iLastActive(0),
m_iLastPowerStateUpdate(0),
m_cecVersion(CEC_VERSION_UNKNOWN),
- m_deviceStatus(CEC_DEVICE_STATUS_UNKNOWN),
- m_handlerMutex(false)
+ m_deviceStatus(CEC_DEVICE_STATUS_UNKNOWN)
{
m_handler = new CCECCommandHandler(this);
/* update "last active" */
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
m_iLastActive = GetTimeMs();
if (m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC)
/* change status to present */
if (bHandled)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC)
{
if (m_deviceStatus != CEC_DEVICE_STATUS_PRESENT)
if (m_handler->TransmitImageViewOn(GetMyLogicalAddress(), m_iLogicalAddress))
{
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
// m_powerStatus = CEC_POWER_STATUS_UNKNOWN;
m_powerStatus = CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON;
}
{
bool bRequestUpdate(false);
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
(bUpdate || m_cecVersion == CEC_VERSION_UNKNOWN));
}
if (bRequestUpdate)
RequestCecVersion();
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_cecVersion;
}
{
bool bRequestUpdate(false);
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
(bUpdate || !strcmp(m_menuLanguage.language, "???")));
}
if (bRequestUpdate)
RequestMenuLanguage();
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_menuLanguage;
}
cec_menu_state CCECBusDevice::GetMenuState(void)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_menuState;
}
{
bool bRequestUpdate(false);
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
(bUpdate || m_strDeviceName.Equals(ToString(m_iLogicalAddress))) &&
m_type != CEC_DEVICE_TYPE_TV);
if (bRequestUpdate)
RequestOSDName();
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_strDeviceName;
}
{
bool bRequestUpdate(false);
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
(m_iPhysicalAddress == 0xFFFF || bUpdate));
}
if (bRequestUpdate && !RequestPhysicalAddress())
AddLog(CEC_LOG_ERROR, "failed to request the physical address (1)");
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_iPhysicalAddress;
}
{
bool bRequestUpdate(false);
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
(bUpdate || m_powerStatus == CEC_POWER_STATUS_UNKNOWN ||
m_powerStatus == CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON ||
if (bRequestUpdate)
RequestPowerStatus();
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_powerStatus;
}
{
bool bRequestUpdate(false);
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
(bUpdate || m_vendor == CEC_VENDOR_UNKNOWN));
}
if (bRequestUpdate)
RequestVendorId();
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_vendor;
}
cec_bus_device_status CCECBusDevice::GetStatus(bool bForcePoll /* = false */)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC &&
(m_deviceStatus == CEC_DEVICE_STATUS_UNKNOWN || bForcePoll))
{
- lock.Leave();
+ lock.Unlock();
bool bPollAcked(false);
if (bForcePoll || NeedsPoll())
bPollAcked = m_processor->PollDevice(m_iLogicalAddress);
void CCECBusDevice::SetMenuLanguage(const cec_menu_language &language)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (language.device == m_iLogicalAddress)
{
CStdString strLog;
void CCECBusDevice::SetOSDName(CStdString strName)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_strDeviceName != strName)
{
CStdString strLog;
void CCECBusDevice::SetMenuState(const cec_menu_state state)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_menuState != state)
{
CStdString strLog;
void CCECBusDevice::SetInactiveSource(void)
{
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
m_bActiveSource = false;
}
void CCECBusDevice::SetActiveSource(void)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (!m_bActiveSource)
{
CStdString strLog;
void CCECBusDevice::SetDeviceStatus(const cec_bus_device_status newStatus)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
switch (newStatus)
{
case CEC_DEVICE_STATUS_UNKNOWN:
void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (iNewAddress > 0 && m_iPhysicalAddress != iNewAddress)
{
CStdString strLog;
void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = 0 */)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (iNewAddress > 0)
{
CStdString strLog;
if (iNewAddress > 0)
{
- lock.Leave();
+ lock.Unlock();
SetPowerStatus(CEC_POWER_STATUS_ON);
}
}
void CCECBusDevice::SetPowerStatus(const cec_power_status powerStatus)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_powerStatus != powerStatus)
{
m_iLastPowerStateUpdate = GetTimeMs();
bool CCECBusDevice::ReplaceHandler(bool bActivateSource /* = true */)
{
- CLockObject lock(&m_mutex);
- CLockObject handlerLock(&m_handlerMutex);
+ CLockObject lock(m_mutex);
+ CLockObject handlerLock(m_handlerMutex);
if (m_vendor != m_handler->GetVendorId())
{
bool bVendorChanged(false);
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
bVendorChanged = (m_vendor != (cec_vendor_id)iVendorId);
m_vendor = (cec_vendor_id)iVendorId;
}
bool bSendActiveSource(false);
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_powerStatus != CEC_POWER_STATUS_ON)
{
CStdString strLog;
{
cec_version version;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
CStdString strLog;
strLog.Format("<< %s (%X) -> %s (%X): cec version %s", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString(m_cecVersion));
AddLog(CEC_LOG_NOTICE, strLog);
{
uint16_t iPhysicalAddress;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
CStdString strLog;
strLog.Format("<< %s (%X) -> broadcast (F): inactive source", GetLogicalAddressName(), m_iLogicalAddress);
AddLog(CEC_LOG_NOTICE, strLog);
{
cec_menu_state menuState;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
CStdString strLog;
strLog.Format("<< %s (%X) -> %s (%X): menu state '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString(m_menuState));
AddLog(CEC_LOG_NOTICE, strLog);
{
CStdString strDeviceName;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
CStdString strLog;
strLog.Format("<< %s (%X) -> %s (%X): OSD name '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, m_strDeviceName.c_str());
AddLog(CEC_LOG_NOTICE, strLog.c_str());
uint16_t iPhysicalAddress;
cec_device_type type;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_iPhysicalAddress == 0xffff)
return false;
bReturn = m_handler->TransmitPoll(m_iLogicalAddress, dest);
AddLog(CEC_LOG_DEBUG, bReturn ? ">> POLL sent" : ">> POLL not sent");
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (bReturn)
{
m_iLastActive = GetTimeMs();
{
cec_power_status state;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
CStdString strLog;
strLog.Format("<< %s (%X) -> %s (%X): %s", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString(m_powerStatus));
AddLog(CEC_LOG_NOTICE, strLog.c_str());
{
uint64_t iVendorId;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
iVendorId = (uint64_t)m_vendor;
}
bool CCECBusDevice::ActivateSource(void)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_handler->ActivateSource();
}
#include <cectypes.h>
#include <set>
-#include "../platform/os-dependent.h"
-#include "../util/StdString.h"
+#include "../platform/os.h"
namespace CEC
{
cec_version m_cecVersion;
cec_bus_device_status m_deviceStatus;
std::set<cec_opcode> m_unsupportedFeatures;
- CMutex m_mutex;
- CMutex m_handlerMutex;
+ PLATFORM::CMutex m_mutex;
+ PLATFORM::CMutex m_handlerMutex;
};
};
#include "../CECProcessor.h"
using namespace CEC;
+using namespace PLATFORM;
#define ToString(p) m_processor->ToString(p)
cec_deck_info CCECPlaybackDevice::GetDeckStatus(void)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_deckStatus;
}
void CCECPlaybackDevice::SetDeckStatus(cec_deck_info deckStatus)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_deckStatus != deckStatus && m_deckStatus != CEC_DECK_INFO_OTHER_STATUS_LG)
{
CStdString strLog;
cec_deck_control_mode CCECPlaybackDevice::GetDeckControlMode(void)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_deckControlMode;
}
void CCECPlaybackDevice::SetDeckControlMode(cec_deck_control_mode mode)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_deckControlMode != mode)
{
CStdString strLog;
{
cec_deck_info state;
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
CStdString strLog;
strLog.Format("<< %s (%X) -> %s (%X): deck status '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString(m_deckStatus));
AddLog(CEC_LOG_NOTICE, strLog);
#include "ANCommandHandler.h"
#include "../devices/CECBusDevice.h"
#include "../CECProcessor.h"
-#include "../util/StdString.h"
using namespace CEC;
using namespace CEC;
using namespace std;
+using namespace PLATFORM;
CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice) :
m_busDevice(busDevice),
CCECCommandHandler::~CCECCommandHandler(void)
{
- CLockObject lock(&m_processor->m_transmitMutex);
- CLockObject receiveLock(&m_receiveMutex);
+ CLockObject lock(m_processor->m_transmitMutex);
+ CLockObject receiveLock(m_receiveMutex);
m_condition.Broadcast();
}
if (bHandled)
{
- CLockObject lock(&m_receiveMutex);
+ CLockObject lock(m_receiveMutex);
if (m_expectedResponse == CEC_OPCODE_NONE ||
m_expectedResponse == command.opcode)
m_condition.Signal();
m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
vector<CCECBusDevice *> devices;
- for (int iDevicePtr = GetMyDevices(devices) - 1; iDevicePtr >=0; iDevicePtr--)
+ for (size_t iDevicePtr = 0; iDevicePtr < GetMyDevices(devices); iDevicePtr++)
devices[iDevicePtr]->TransmitActiveSource();
return true;
{
uint8_t iTries(0), iMaxTries(command.opcode == CEC_OPCODE_NONE ? 1 : m_iTransmitRetries + 1);
- CLockObject writeLock(&m_processor->m_transmitMutex);
- CLockObject receiveLock(&m_receiveMutex);
+ CLockObject writeLock(m_processor->m_transmitMutex);
+ CLockObject receiveLock(m_receiveMutex);
++m_iUseCounter;
while (!bReturn && ++iTries <= iMaxTries)
{
{
m_processor->AddLog(CEC_LOG_DEBUG, "command transmitted");
bReturn = bExpectResponse ?
- m_condition.Wait(&m_receiveMutex, m_iTransmitWait) :
+ m_condition.Wait(m_receiveMutex, m_iTransmitWait) :
true;
}
}
void CCECCommandHandler::MarkBusy(void)
{
- CLockObject receiveLock(&m_receiveMutex);
+ CLockObject receiveLock(m_receiveMutex);
++m_iUseCounter;
}
bool CCECCommandHandler::MarkReady(void)
{
- CLockObject receiveLock(&m_receiveMutex);
+ CLockObject receiveLock(m_receiveMutex);
return m_iUseCounter > 0 ? (--m_iUseCounter == 0) : true;
}
bool CCECCommandHandler::InUse(void)
{
- CLockObject receiveLock(&m_receiveMutex);
+ CLockObject receiveLock(m_receiveMutex);
return m_iUseCounter > 0;
}
#include <cectypes.h>
#include <vector>
-#include "../util/StdString.h"
-#include "../platform/os-dependent.h"
+#include "../platform/os.h"
namespace CEC
{
virtual bool Transmit(cec_command &command, bool bExpectResponse = true, cec_opcode expectedResponse = CEC_OPCODE_NONE);
- CCECBusDevice *m_busDevice;
- CCECProcessor *m_processor;
- int32_t m_iTransmitTimeout;
- int32_t m_iTransmitWait;
- int8_t m_iTransmitRetries;
- bool m_bHandlerInited;
- uint8_t m_iUseCounter;
- cec_opcode m_expectedResponse;
- bool m_bOPTSendDeckStatusUpdateOnActiveSource;
- cec_vendor_id m_vendorId;
- CMutex m_receiveMutex;
- CCondition m_condition;
+ CCECBusDevice * m_busDevice;
+ CCECProcessor * m_processor;
+ int32_t m_iTransmitTimeout;
+ int32_t m_iTransmitWait;
+ int8_t m_iTransmitRetries;
+ bool m_bHandlerInited;
+ uint8_t m_iUseCounter;
+ cec_opcode m_expectedResponse;
+ bool m_bOPTSendDeckStatusUpdateOnActiveSource;
+ cec_vendor_id m_vendorId;
+ PLATFORM::CMutex m_receiveMutex;
+ PLATFORM::CCondition m_condition;
};
};
#include "../devices/CECBusDevice.h"
#include "../devices/CECPlaybackDevice.h"
#include "../CECProcessor.h"
-#include "../platform/timeutils.h"
-#include "../platform/threads.h"
using namespace CEC;
* http://www.pulse-eight.net/
*/
-#include "../platform/os-dependent.h"
+#include "os.h"
#include <queue>
-namespace CEC
+namespace PLATFORM
{
template<typename _BType>
- struct CecBuffer
+ struct SyncedBuffer
{
public:
- CecBuffer(size_t iMaxSize = 100)
+ SyncedBuffer(size_t iMaxSize = 100)
{
m_maxSize = iMaxSize;
}
- virtual ~CecBuffer(void)
+ virtual ~SyncedBuffer(void)
{
+ CLockObject lock(m_mutex, true);
Clear();
}
bool Push(_BType entry)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_buffer.size() == m_maxSize)
return false;
bool Pop(_BType &entry)
{
bool bReturn(false);
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (!m_buffer.empty())
{
entry = m_buffer.front();
+++ /dev/null
-#pragma once
-/*
- * Copyright (C) 2005-2011 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#if defined(_WIN32) || defined(_WIN64)
-#ifndef __WINDOWS__
-#define __WINDOWS__
-#endif
-#endif
-
-#if defined(__WINDOWS__)
-#include "windows/os_windows.h"
-#else
-#include "posix/os_posix.h"
-#endif
-
-#if !defined(TRUE)
-#define TRUE 1
-#endif
-
-#if !defined(FALSE)
-#define FALSE 0
-#endif
-
-#include "timeutils.h"
+#pragma once
/*
* This file is part of the libCEC(R) library.
*
* http://www.pulse-eight.net/
*/
-#include "threads.h"
-#include "timeutils.h"
-#include "os-dependent.h"
-
-using namespace CEC;
-
-CLockObject::CLockObject(IMutex *mutex, bool bTryLock /* = false */) :
- m_mutex(mutex)
-{
- if (m_mutex)
- m_bLocked = bTryLock ? m_mutex->TryLock() : m_mutex->Lock();
-}
-
-CLockObject::~CLockObject(void)
-{
- Leave();
- m_mutex = NULL;
-}
-
-void CLockObject::Leave(void)
-{
- if (m_mutex && m_bLocked)
- {
- m_bLocked = false;
- m_mutex->Unlock();
- }
-}
-
-void CLockObject::Lock(void)
-{
- if (m_mutex)
- m_bLocked = m_mutex->Lock();
-}
+#if defined(_WIN32) || defined(_WIN64)
+#ifndef __WINDOWS__
+#define __WINDOWS__
+#endif
+#include "windows/os-types.h"
+#include "windows/os-threads.h"
+#else
+#include "posix/os-types.h"
+#include "posix/os-threads.h"
+#endif
-void ICondition::Sleep(uint32_t iTimeout)
-{
- CCondition w;
- CMutex m;
- CLockObject lock(&m);
- w.Wait(&m, iTimeout);
-}
-
-IThread::IThread(void) :
- m_bStop(false),
- m_bRunning(false)
-{
- m_threadCondition = new CCondition();
- m_threadMutex = new CMutex();
-}
-
-IThread::~IThread(void)
-{
- StopThread();
- delete m_threadCondition;
- delete m_threadMutex;
-}
-
-bool IThread::StopThread(bool bWaitForExit /* = true */)
-{
- m_bStop = true;
- m_threadCondition->Broadcast();
- bWaitForExit = true;
-
- return false;
-}
-
-bool IThread::Sleep(uint32_t iTimeout)
-{
- CLockObject lock(m_threadMutex);
- return m_bStop ? false : m_threadCondition->Wait(m_threadMutex, iTimeout);
-}
+#include "timeutils.h"
+#include "threads/threads.h"
+#include "buffer.h"
+#include "StdString.h"
--- /dev/null
+#pragma once
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing <license@pulse-eight.com>
+ * http://www.pulse-eight.com/
+ * http://www.pulse-eight.net/
+ */
+
+namespace PLATFORM
+{
+ inline pthread_mutexattr_t *GetRecursiveMutexAttribute(void)
+ {
+ static pthread_mutexattr_t g_mutexAttr;
+ static bool bAttributeInitialised = false;
+ if (!bAttributeInitialised)
+ {
+ pthread_mutexattr_init(&g_mutexAttr);
+ pthread_mutexattr_settype(&g_mutexAttr, PTHREAD_MUTEX_RECURSIVE);
+ bAttributeInitialised = true;
+ }
+ return &g_mutexAttr;
+ }
+
+ inline struct timespec GetAbsTime(uint64_t iIncreaseBy = 0)
+ {
+ struct timespec abstime;
+ struct timeval now;
+ gettimeofday(&now, NULL);
+ iIncreaseBy += now.tv_usec / 1000;
+ abstime.tv_sec = now.tv_sec + (time_t)(iIncreaseBy / 1000);
+ abstime.tv_nsec = (int32_t)((iIncreaseBy % (uint32_t)1000) * (uint32_t)1000000);
+ return abstime;
+ }
+
+ typedef pthread_t thread_t;
+
+ #define ThreadsCreate(thread, func, arg) (pthread_create(&thread, NULL, (void *(*) (void *))func, (void *)arg) == 0)
+ #define ThreadsWait(thread, retval) (pthread_join(thread, retval) == 0)
+
+ typedef pthread_mutex_t mutex_t;
+ #define MutexCreate(mutex) pthread_mutex_init(&mutex, GetRecursiveMutexAttribute());
+ #define MutexDelete(mutex) pthread_mutex_destroy(&mutex);
+ #define MutexLock(mutex) (pthread_mutex_lock(&mutex) == 0)
+ #define MutexTryLock(mutex) (pthread_mutex_trylock(&mutex) == 0)
+ #define MutexUnlock(mutex) pthread_mutex_unlock(&mutex)
+
+ typedef pthread_cond_t condition_t;
+ #define ConditionCreate(cond) pthread_cond_init(&cond, NULL)
+ #define ConditionDelete(cond) pthread_cond_destroy(&cond)
+ #define ConditionSignal(cond) pthread_cond_signal(&cond)
+ #define ConditionBroadcast(cond) pthread_cond_broadcast(&cond)
+ inline bool ConditionWait(condition_t &cond, mutex_t &mutex, uint32_t iTimeout)
+ {
+ sched_yield();
+ if (iTimeout > 0)
+ {
+ struct timespec timeout = GetAbsTime(iTimeout);
+ return (pthread_cond_timedwait(&cond, &mutex, &timeout) == 0);
+ }
+ return (pthread_cond_wait(&cond, &mutex) == 0);
+ }
+}
#include <errno.h>
#include <sys/time.h>
#ifndef __APPLE__
-#include <sys/prctl.h>
+#include <sys/prctl.h>
#endif
#include <pthread.h>
#include <poll.h>
#include <semaphore.h>
+#include <stdint.h>
#define LIBTYPE
#define DECLSPEC
-#include "pthreads.h"
+
+++ /dev/null
-/*
- * This file is part of the libCEC(R) library.
- *
- * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved.
- * libCEC(R) is an original work, containing original code.
- *
- * libCEC(R) is a trademark of Pulse-Eight Limited.
- *
- * This program is dual-licensed; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- *
- * Alternatively, you can license this library under a commercial license,
- * please contact Pulse-Eight Licensing for more information.
- *
- * For more information contact:
- * Pulse-Eight Licensing <license@pulse-eight.com>
- * http://www.pulse-eight.com/
- * http://www.pulse-eight.net/
- */
-
-#include "../threads.h"
-#include "../timeutils.h"
-
-using namespace CEC;
-
-CMutex::CMutex(bool bRecursive /* = true */) :
- IMutex(bRecursive)
-{
- pthread_mutex_init(&m_mutex, bRecursive ? GetMutexAttribute() : NULL);
-}
-
-CMutex::~CMutex(void)
-{
- pthread_mutex_destroy(&m_mutex);
-}
-
-bool CMutex::TryLock(void)
-{
- return (pthread_mutex_trylock(&m_mutex) == 0);
-}
-
-bool CMutex::Lock(void)
-{
- return (pthread_mutex_lock(&m_mutex) == 0);
-}
-
-void CMutex::Unlock(void)
-{
- pthread_mutex_unlock(&m_mutex);
-}
-
-static pthread_mutexattr_t g_mutexAttr;
-pthread_mutexattr_t *CMutex::GetMutexAttribute()
-{
- static bool bAttributeInitialised = false;
- if (!bAttributeInitialised)
- {
- pthread_mutexattr_init(&g_mutexAttr);
- pthread_mutexattr_settype(&g_mutexAttr, PTHREAD_MUTEX_RECURSIVE);
- bAttributeInitialised = true;
- }
- return &g_mutexAttr;
-}
-
-CCondition::CCondition(void)
-{
- pthread_cond_init(&m_cond, NULL);
-}
-
-CCondition::~CCondition(void)
-{
- pthread_cond_broadcast(&m_cond);
- pthread_cond_destroy(&m_cond);
-}
-
-void CCondition::Broadcast(void)
-{
- pthread_cond_broadcast(&m_cond);
-}
-
-void CCondition::Signal(void)
-{
- pthread_cond_signal(&m_cond);
-}
-
-bool CCondition::Wait(IMutex *mutex, uint32_t iTimeout /* = 0 */)
-{
- bool bReturn(false);
- sched_yield();
- CMutex *pmutex = static_cast<CMutex *>(mutex);
- if (pmutex)
- {
- if (iTimeout > 0)
- {
- struct timespec abstime;
- struct timeval now;
- gettimeofday(&now, NULL);
- iTimeout += now.tv_usec / 1000;
- abstime.tv_sec = now.tv_sec + (time_t)(iTimeout / 1000);
- abstime.tv_nsec = (int32_t)((iTimeout % (uint32_t)1000) * (uint32_t)1000000);
- bReturn = (pthread_cond_timedwait(&m_cond, &pmutex->m_mutex, &abstime) == 0);
- }
- else
- {
- bReturn = (pthread_cond_wait(&m_cond, &pmutex->m_mutex) == 0);
- }
- }
- return bReturn;
-}
-
-bool CThread::CreateThread(bool bWait /* = true */)
-{
- bool bReturn(false);
- CLockObject lock(m_threadMutex);
- m_bStop = false;
- if (!m_bRunning && pthread_create(&m_thread, NULL, (void *(*) (void *))&CThread::ThreadHandler, (void *)this) == 0)
- {
- if (bWait)
- m_threadCondition->Wait(m_threadMutex);
- bReturn = true;
- }
- return bReturn;
-}
-
-bool CThread::StopThread(bool bWaitForExit /* = true */)
-{
- bool bReturn = IThread::StopThread(bWaitForExit);
-
- void *retVal;
- if (bWaitForExit && m_bRunning)
- bReturn = (pthread_join(m_thread, &retVal) == 0);
-
- return bReturn;
-}
-
-void *CThread::ThreadHandler(CThread *thread)
-{
- void *retVal = NULL;
-
- if (thread)
- {
- CLockObject lock(thread->m_threadMutex);
- thread->m_bRunning = true;
- lock.Leave();
- thread->m_threadCondition->Broadcast();
-
- retVal = thread->Process();
-
- lock.Lock();
- thread->m_bRunning = false;
- lock.Leave();
- thread->m_threadCondition->Broadcast();
- }
-
- return retVal;
-}
#include <stdio.h>
#include <fcntl.h>
-#include "../serialport.h"
-#include "../baudrate.h"
+#include "../serialport/serialport.h"
+#include "../serialport/baudrate.h"
#include "../timeutils.h"
#if defined(__APPLE__)
#endif
#endif
using namespace std;
-using namespace CEC;
+using namespace PLATFORM;
CSerialPort::CSerialPort()
{
Close();
}
-int8_t CSerialPort::Write(CCECAdapterMessage *data)
+int64_t CSerialPort::Write(uint8_t* data, uint32_t len)
{
fd_set port;
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_fd == -1)
{
m_error = "port closed";
return -1;
}
- int32_t byteswritten = 0;
-
- struct timeval timeout, *tv;
- if (data->transmit_timeout <= 0)
- {
+ int64_t byteswritten = 0;
+ struct timeval *tv;
+//TODO
+// struct timeval timeout, *tv;
+// if (data->transmit_timeout <= 0)
+// {
tv = NULL;
- }
- else
- {
- timeout.tv_sec = (long int)data->transmit_timeout / (long int)1000.;
- timeout.tv_usec = (long int)data->transmit_timeout % (long int)1000.;
- tv = &timeout;
- }
-
- while (byteswritten < (int32_t) data->size())
+// }
+// else
+// {
+// timeout.tv_sec = (long int)data->transmit_timeout / (long int)1000.;
+// timeout.tv_usec = (long int)data->transmit_timeout % (long int)1000.;
+// tv = &timeout;
+// }
+
+ while (byteswritten < len)
{
FD_ZERO(&port);
FD_SET(m_fd, &port);
return -1;
}
- returnv = write(m_fd, data->packet.data + byteswritten, data->size() - byteswritten);
+ returnv = write(m_fd, data + byteswritten, len - byteswritten);
if (returnv == -1)
{
m_error = strerror(errno);
{
printf("%s write:", m_name.c_str());
for (int i = 0; i < byteswritten; i++)
- printf(" %02x", data->at(i));
+ printf(" %02x", data[i]);
printf("\n");
}
int64_t now(0), target(0);
int32_t bytesread = 0;
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_fd == -1)
{
m_error = "port closed";
{
m_name = name;
m_error = strerror(errno);
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (databits < 5 || databits > 8)
{
void CSerialPort::Close()
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_fd != -1)
{
close(m_fd);
bool CSerialPort::IsOpen()
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_fd != -1;
}
+++ /dev/null
-/* This is an implementation of the threads API of POSIX 1003.1-2001.
- *
- * --------------------------------------------------------------------------
- *
- * Pthreads-win32 - POSIX Threads Library for Win32
- * Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
- * The current list of contributors is contained
- * in the file CONTRIBUTORS included with the source
- * code distribution. The list can also be seen at the
- * following World Wide Web location:
- * http://sources.redhat.com/pthreads-win32/contributors.html
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library in the file COPYING.LIB;
- * if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#if !defined( PTHREAD_H )
-#define PTHREAD_H
-
-/*
- * See the README file for an explanation of the pthreads-win32 version
- * numbering scheme and how the DLL is named etc.
- */
-#define PTW32_VERSION 2,8,0,0
-#define PTW32_VERSION_STRING "2, 8, 0, 0\0"
-
-/* There are three implementations of cancel cleanup.
- * Note that pthread.h is included in both application
- * compilation units and also internally for the library.
- * The code here and within the library aims to work
- * for all reasonable combinations of environments.
- *
- * The three implementations are:
- *
- * WIN32 SEH
- * C
- * C++
- *
- * Please note that exiting a push/pop block via
- * "return", "exit", "break", or "continue" will
- * lead to different behaviour amongst applications
- * depending upon whether the library was built
- * using SEH, C++, or C. For example, a library built
- * with SEH will call the cleanup routine, while both
- * C++ and C built versions will not.
- */
-
-/*
- * Define defaults for cleanup code.
- * Note: Unless the build explicitly defines one of the following, then
- * we default to standard C style cleanup. This style uses setjmp/longjmp
- * in the cancelation and thread exit implementations and therefore won't
- * do stack unwinding if linked to applications that have it (e.g.
- * C++ apps). This is currently consistent with most/all commercial Unix
- * POSIX threads implementations.
- */
-#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C )
-# define __CLEANUP_C
-#endif
-
-#if defined( __CLEANUP_SEH ) && ( !defined( _MSC_VER ) && !defined(PTW32_RC_MSC))
-#error ERROR [__FILE__, line __LINE__]: SEH is not supported for this compiler.
-#endif
-
-/*
- * Stop here if we are being included by the resource compiler.
- */
-#ifndef RC_INVOKED
-
-#undef PTW32_LEVEL
-
-#if defined(_POSIX_SOURCE)
-#define PTW32_LEVEL 0
-/* Early POSIX */
-#endif
-
-#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
-#undef PTW32_LEVEL
-#define PTW32_LEVEL 1
-/* Include 1b, 1c and 1d */
-#endif
-
-#if defined(INCLUDE_NP)
-#undef PTW32_LEVEL
-#define PTW32_LEVEL 2
-/* Include Non-Portable extensions */
-#endif
-
-#define PTW32_LEVEL_MAX 3
-
-#if !defined(PTW32_LEVEL)
-#define PTW32_LEVEL PTW32_LEVEL_MAX
-/* Include everything */
-#endif
-
-#ifdef _UWIN
-# define HAVE_STRUCT_TIMESPEC 1
-# define HAVE_SIGNAL_H 1
-# undef HAVE_CONFIG_H
-# pragma comment(lib, "pthread")
-#endif
-
-/*
- * -------------------------------------------------------------
- *
- *
- * Module: pthread.h
- *
- * Purpose:
- * Provides an implementation of PThreads based upon the
- * standard:
- *
- * POSIX 1003.1-2001
- * and
- * The Single Unix Specification version 3
- *
- * (these two are equivalent)
- *
- * in order to enhance code portability between Windows,
- * various commercial Unix implementations, and Linux.
- *
- * See the ANNOUNCE file for a full list of conforming
- * routines and defined constants, and a list of missing
- * routines and constants not defined in this implementation.
- *
- * Authors:
- * There have been many contributors to this library.
- * The initial implementation was contributed by
- * John Bossom, and several others have provided major
- * sections or revisions of parts of the implementation.
- * Often significant effort has been contributed to
- * find and fix important bugs and other problems to
- * improve the reliability of the library, which sometimes
- * is not reflected in the amount of code which changed as
- * result.
- * As much as possible, the contributors are acknowledged
- * in the ChangeLog file in the source code distribution
- * where their changes are noted in detail.
- *
- * Contributors are listed in the CONTRIBUTORS file.
- *
- * As usual, all bouquets go to the contributors, and all
- * brickbats go to the project maintainer.
- *
- * Maintainer:
- * The code base for this project is coordinated and
- * eventually pre-tested, packaged, and made available by
- *
- * Ross Johnson <rpj@callisto.canberra.edu.au>
- *
- * QA Testers:
- * Ultimately, the library is tested in the real world by
- * a host of competent and demanding scientists and
- * engineers who report bugs and/or provide solutions
- * which are then fixed or incorporated into subsequent
- * versions of the library. Each time a bug is fixed, a
- * test case is written to prove the fix and ensure
- * that later changes to the code don't reintroduce the
- * same error. The number of test cases is slowly growing
- * and therefore so is the code reliability.
- *
- * Compliance:
- * See the file ANNOUNCE for the list of implemented
- * and not-implemented routines and defined options.
- * Of course, these are all defined is this file as well.
- *
- * Web site:
- * The source code and other information about this library
- * are available from
- *
- * http://sources.redhat.com/pthreads-win32/
- *
- * -------------------------------------------------------------
- */
-
-/* Try to avoid including windows.h */
-#if defined(__MINGW32__) && defined(__cplusplus)
-#define PTW32_INCLUDE_WINDOWS_H
-#endif
-
-#ifdef PTW32_INCLUDE_WINDOWS_H
-#include <windows.h>
-#endif
-
-#if defined(_MSC_VER) && _MSC_VER < 1300 || defined(__DMC__)
-/*
- * VC++6.0 or early compiler's header has no DWORD_PTR type.
- */
-typedef unsigned long DWORD_PTR;
-#endif
-/*
- * -----------------
- * autoconf switches
- * -----------------
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#ifndef NEED_FTIME
-#include <time.h>
-#else /* NEED_FTIME */
-/* use native WIN32 time API */
-#endif /* NEED_FTIME */
-
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif /* HAVE_SIGNAL_H */
-
-#include <setjmp.h>
-#include <limits.h>
-
-/*
- * Boolean values to make us independent of system includes.
- */
-enum {
- PTW32_FALSE = 0,
- PTW32_TRUE = (! PTW32_FALSE)
-};
-
-/*
- * This is a duplicate of what is in the autoconf config.h,
- * which is only used when building the pthread-win32 libraries.
- */
-
-#ifndef PTW32_CONFIG_H
-# if defined(WINCE)
-# define NEED_ERRNO
-# define NEED_SEM
-# endif
-# if defined(_UWIN) || defined(__MINGW32__)
-# define HAVE_MODE_T
-# endif
-#endif
-
-/*
- *
- */
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-#ifdef NEED_ERRNO
-#include "need_errno.h"
-#else
-#include <errno.h>
-#endif
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-/*
- * Several systems don't define some error numbers.
- */
-#ifndef ENOTSUP
-# define ENOTSUP 48 /* This is the value in Solaris. */
-#endif
-
-#ifndef ETIMEDOUT
-# define ETIMEDOUT 10060 /* This is the value in winsock.h. */
-#endif
-
-#ifndef ENOSYS
-# define ENOSYS 140 /* Semi-arbitrary value */
-#endif
-
-#ifndef EDEADLK
-# ifdef EDEADLOCK
-# define EDEADLK EDEADLOCK
-# else
-# define EDEADLK 36 /* This is the value in MSVC. */
-# endif
-#endif
-
-#include "sched.h"
-
-/*
- * To avoid including windows.h we define only those things that we
- * actually need from it.
- */
-#ifndef PTW32_INCLUDE_WINDOWS_H
-#ifndef HANDLE
-# define PTW32__HANDLE_DEF
-# define HANDLE void *
-#endif
-#ifndef DWORD
-# define PTW32__DWORD_DEF
-# define DWORD unsigned long
-#endif
-#endif
-
-#ifndef HAVE_STRUCT_TIMESPEC
-#define HAVE_STRUCT_TIMESPEC 1
-struct timespec {
- long tv_sec;
- long tv_nsec;
-};
-#endif /* HAVE_STRUCT_TIMESPEC */
-
-#ifndef SIG_BLOCK
-#define SIG_BLOCK 0
-#endif /* SIG_BLOCK */
-
-#ifndef SIG_UNBLOCK
-#define SIG_UNBLOCK 1
-#endif /* SIG_UNBLOCK */
-
-#ifndef SIG_SETMASK
-#define SIG_SETMASK 2
-#endif /* SIG_SETMASK */
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-/*
- * -------------------------------------------------------------
- *
- * POSIX 1003.1-2001 Options
- * =========================
- *
- * Options are normally set in <unistd.h>, which is not provided
- * with pthreads-win32.
- *
- * For conformance with the Single Unix Specification (version 3), all of the
- * options below are defined, and have a value of either -1 (not supported)
- * or 200112L (supported).
- *
- * These options can neither be left undefined nor have a value of 0, because
- * either indicates that sysconf(), which is not implemented, may be used at
- * runtime to check the status of the option.
- *
- * _POSIX_THREADS (== 200112L)
- * If == 200112L, you can use threads
- *
- * _POSIX_THREAD_ATTR_STACKSIZE (== 200112L)
- * If == 200112L, you can control the size of a thread's
- * stack
- * pthread_attr_getstacksize
- * pthread_attr_setstacksize
- *
- * _POSIX_THREAD_ATTR_STACKADDR (== -1)
- * If == 200112L, you can allocate and control a thread's
- * stack. If not supported, the following functions
- * will return ENOSYS, indicating they are not
- * supported:
- * pthread_attr_getstackaddr
- * pthread_attr_setstackaddr
- *
- * _POSIX_THREAD_PRIORITY_SCHEDULING (== -1)
- * If == 200112L, you can use realtime scheduling.
- * This option indicates that the behaviour of some
- * implemented functions conforms to the additional TPS
- * requirements in the standard. E.g. rwlocks favour
- * writers over readers when threads have equal priority.
- *
- * _POSIX_THREAD_PRIO_INHERIT (== -1)
- * If == 200112L, you can create priority inheritance
- * mutexes.
- * pthread_mutexattr_getprotocol +
- * pthread_mutexattr_setprotocol +
- *
- * _POSIX_THREAD_PRIO_PROTECT (== -1)
- * If == 200112L, you can create priority ceiling mutexes
- * Indicates the availability of:
- * pthread_mutex_getprioceiling
- * pthread_mutex_setprioceiling
- * pthread_mutexattr_getprioceiling
- * pthread_mutexattr_getprotocol +
- * pthread_mutexattr_setprioceiling
- * pthread_mutexattr_setprotocol +
- *
- * _POSIX_THREAD_PROCESS_SHARED (== -1)
- * If set, you can create mutexes and condition
- * variables that can be shared with another
- * process.If set, indicates the availability
- * of:
- * pthread_mutexattr_getpshared
- * pthread_mutexattr_setpshared
- * pthread_condattr_getpshared
- * pthread_condattr_setpshared
- *
- * _POSIX_THREAD_SAFE_FUNCTIONS (== 200112L)
- * If == 200112L you can use the special *_r library
- * functions that provide thread-safe behaviour
- *
- * _POSIX_READER_WRITER_LOCKS (== 200112L)
- * If == 200112L, you can use read/write locks
- *
- * _POSIX_SPIN_LOCKS (== 200112L)
- * If == 200112L, you can use spin locks
- *
- * _POSIX_BARRIERS (== 200112L)
- * If == 200112L, you can use barriers
- *
- * + These functions provide both 'inherit' and/or
- * 'protect' protocol, based upon these macro
- * settings.
- *
- * -------------------------------------------------------------
- */
-
-/*
- * POSIX Options
- */
-#undef _POSIX_THREADS
-#define _POSIX_THREADS 200112L
-
-#undef _POSIX_READER_WRITER_LOCKS
-#define _POSIX_READER_WRITER_LOCKS 200112L
-
-#undef _POSIX_SPIN_LOCKS
-#define _POSIX_SPIN_LOCKS 200112L
-
-#undef _POSIX_BARRIERS
-#define _POSIX_BARRIERS 200112L
-
-#undef _POSIX_THREAD_SAFE_FUNCTIONS
-#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
-
-#undef _POSIX_THREAD_ATTR_STACKSIZE
-#define _POSIX_THREAD_ATTR_STACKSIZE 200112L
-
-/*
- * The following options are not supported
- */
-#undef _POSIX_THREAD_ATTR_STACKADDR
-#define _POSIX_THREAD_ATTR_STACKADDR -1
-
-#undef _POSIX_THREAD_PRIO_INHERIT
-#define _POSIX_THREAD_PRIO_INHERIT -1
-
-#undef _POSIX_THREAD_PRIO_PROTECT
-#define _POSIX_THREAD_PRIO_PROTECT -1
-
-/* TPS is not fully supported. */
-#undef _POSIX_THREAD_PRIORITY_SCHEDULING
-#define _POSIX_THREAD_PRIORITY_SCHEDULING -1
-
-#undef _POSIX_THREAD_PROCESS_SHARED
-#define _POSIX_THREAD_PROCESS_SHARED -1
-
-
-/*
- * POSIX 1003.1-2001 Limits
- * ===========================
- *
- * These limits are normally set in <limits.h>, which is not provided with
- * pthreads-win32.
- *
- * PTHREAD_DESTRUCTOR_ITERATIONS
- * Maximum number of attempts to destroy
- * a thread's thread-specific data on
- * termination (must be at least 4)
- *
- * PTHREAD_KEYS_MAX
- * Maximum number of thread-specific data keys
- * available per process (must be at least 128)
- *
- * PTHREAD_STACK_MIN
- * Minimum supported stack size for a thread
- *
- * PTHREAD_THREADS_MAX
- * Maximum number of threads supported per
- * process (must be at least 64).
- *
- * SEM_NSEMS_MAX
- * The maximum number of semaphores a process can have.
- * (must be at least 256)
- *
- * SEM_VALUE_MAX
- * The maximum value a semaphore can have.
- * (must be at least 32767)
- *
- */
-#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
-#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
-
-#undef PTHREAD_DESTRUCTOR_ITERATIONS
-#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
-
-#undef _POSIX_THREAD_KEYS_MAX
-#define _POSIX_THREAD_KEYS_MAX 128
-
-#undef PTHREAD_KEYS_MAX
-#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
-
-#undef PTHREAD_STACK_MIN
-#define PTHREAD_STACK_MIN 0
-
-#undef _POSIX_THREAD_THREADS_MAX
-#define _POSIX_THREAD_THREADS_MAX 64
-
- /* Arbitrary value */
-#undef PTHREAD_THREADS_MAX
-#define PTHREAD_THREADS_MAX 2019
-
-#undef _POSIX_SEM_NSEMS_MAX
-#define _POSIX_SEM_NSEMS_MAX 256
-
- /* Arbitrary value */
-#undef SEM_NSEMS_MAX
-#define SEM_NSEMS_MAX 1024
-
-#undef _POSIX_SEM_VALUE_MAX
-#define _POSIX_SEM_VALUE_MAX 32767
-
-#undef SEM_VALUE_MAX
-#define SEM_VALUE_MAX INT_MAX
-
-
-#if __GNUC__ && ! defined (__declspec)
-# error Please upgrade your GNU compiler to one that supports __declspec.
-#endif
-
-/*
- * When building the DLL code, you should define PTW32_BUILD so that
- * the variables/functions are exported correctly. When using the DLL,
- * do NOT define PTW32_BUILD, and then the variables/functions will
- * be imported correctly.
- */
-#ifndef PTW32_STATIC_LIB
-# ifdef PTW32_BUILD
-# define PTW32_DLLPORT __declspec (dllexport)
-# else
-# define PTW32_DLLPORT __declspec (dllimport)
-# endif
-#else
-# define PTW32_DLLPORT
-#endif
-
-/*
- * The Open Watcom C/C++ compiler uses a non-standard calling convention
- * that passes function args in registers unless __cdecl is explicitly specified
- * in exposed function prototypes.
- *
- * We force all calls to cdecl even though this could slow Watcom code down
- * slightly. If you know that the Watcom compiler will be used to build both
- * the DLL and application, then you can probably define this as a null string.
- * Remember that pthread.h (this file) is used for both the DLL and application builds.
- */
-#define PTW32_CDECL __cdecl
-
-#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX
-# include <sys/types.h>
-#else
-/*
- * Generic handle type - intended to extend uniqueness beyond
- * that available with a simple pointer. It should scale for either
- * IA-32 or IA-64.
- */
-typedef struct {
- void * p; /* Pointer to actual object */
- unsigned int x; /* Extra information - reuse count etc */
-} ptw32_handle_t;
-
-typedef ptw32_handle_t pthread_t;
-typedef struct pthread_attr_t_ * pthread_attr_t;
-typedef struct pthread_once_t_ pthread_once_t;
-typedef struct pthread_key_t_ * pthread_key_t;
-typedef struct pthread_mutex_t_ * pthread_mutex_t;
-typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t;
-typedef struct pthread_cond_t_ * pthread_cond_t;
-typedef struct pthread_condattr_t_ * pthread_condattr_t;
-#endif
-typedef struct pthread_rwlock_t_ * pthread_rwlock_t;
-typedef struct pthread_rwlockattr_t_ * pthread_rwlockattr_t;
-typedef struct pthread_spinlock_t_ * pthread_spinlock_t;
-typedef struct pthread_barrier_t_ * pthread_barrier_t;
-typedef struct pthread_barrierattr_t_ * pthread_barrierattr_t;
-
-/*
- * ====================
- * ====================
- * POSIX Threads
- * ====================
- * ====================
- */
-
-enum {
-/*
- * pthread_attr_{get,set}detachstate
- */
- PTHREAD_CREATE_JOINABLE = 0, /* Default */
- PTHREAD_CREATE_DETACHED = 1,
-
-/*
- * pthread_attr_{get,set}inheritsched
- */
- PTHREAD_INHERIT_SCHED = 0,
- PTHREAD_EXPLICIT_SCHED = 1, /* Default */
-
-/*
- * pthread_{get,set}scope
- */
- PTHREAD_SCOPE_PROCESS = 0,
- PTHREAD_SCOPE_SYSTEM = 1, /* Default */
-
-/*
- * pthread_setcancelstate paramters
- */
- PTHREAD_CANCEL_ENABLE = 0, /* Default */
- PTHREAD_CANCEL_DISABLE = 1,
-
-/*
- * pthread_setcanceltype parameters
- */
- PTHREAD_CANCEL_ASYNCHRONOUS = 0,
- PTHREAD_CANCEL_DEFERRED = 1, /* Default */
-
-/*
- * pthread_mutexattr_{get,set}pshared
- * pthread_condattr_{get,set}pshared
- */
- PTHREAD_PROCESS_PRIVATE = 0,
- PTHREAD_PROCESS_SHARED = 1,
-
-/*
- * pthread_barrier_wait
- */
- PTHREAD_BARRIER_SERIAL_THREAD = -1
-};
-
-/*
- * ====================
- * ====================
- * Cancelation
- * ====================
- * ====================
- */
-#define PTHREAD_CANCELED ((void *) -1)
-
-
-/*
- * ====================
- * ====================
- * Once Key
- * ====================
- * ====================
- */
-#define PTHREAD_ONCE_INIT { PTW32_FALSE, 0, 0, 0}
-
-struct pthread_once_t_
-{
- int done; /* indicates if user function has been executed */
- void * lock;
- int reserved1;
- int reserved2;
-};
-
-
-/*
- * ====================
- * ====================
- * Object initialisers
- * ====================
- * ====================
- */
-#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1)
-#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t) -2)
-#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t) -3)
-
-/*
- * Compatibility with LinuxThreads
- */
-#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER
-#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP PTHREAD_ERRORCHECK_MUTEX_INITIALIZER
-
-#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1)
-
-#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1)
-
-#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t) -1)
-
-
-/*
- * Mutex types.
- */
-enum
-{
- /* Compatibility with LinuxThreads */
- PTHREAD_MUTEX_FAST_NP,
- PTHREAD_MUTEX_RECURSIVE_NP,
- PTHREAD_MUTEX_ERRORCHECK_NP,
- PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP,
- PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP,
- /* For compatibility with POSIX */
- PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP,
- PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
- PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
- PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
-};
-
-
-typedef struct ptw32_cleanup_t ptw32_cleanup_t;
-
-#if defined(_MSC_VER)
-/* Disable MSVC 'anachronism used' warning */
-#pragma warning( disable : 4229 )
-#endif
-
-typedef void (* PTW32_CDECL ptw32_cleanup_callback_t)(void *);
-
-#if defined(_MSC_VER)
-#pragma warning( default : 4229 )
-#endif
-
-struct ptw32_cleanup_t
-{
- ptw32_cleanup_callback_t routine;
- void *arg;
- struct ptw32_cleanup_t *prev;
-};
-
-#ifdef __CLEANUP_SEH
- /*
- * WIN32 SEH version of cancel cleanup.
- */
-
-#define pthread_cleanup_push( _rout, _arg ) \
- { \
- ptw32_cleanup_t _cleanup; \
- \
- _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \
- _cleanup.arg = (_arg); \
- __try \
- { \
-
-#define pthread_cleanup_pop( _execute ) \
- } \
- __finally \
- { \
- if( _execute || AbnormalTermination()) \
- { \
- (*(_cleanup.routine))( _cleanup.arg ); \
- } \
- } \
- }
-
-#else /* __CLEANUP_SEH */
-
-#ifdef __CLEANUP_C
-
- /*
- * C implementation of PThreads cancel cleanup
- */
-
-#define pthread_cleanup_push( _rout, _arg ) \
- { \
- ptw32_cleanup_t _cleanup; \
- \
- ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \
-
-#define pthread_cleanup_pop( _execute ) \
- (void) ptw32_pop_cleanup( _execute ); \
- }
-
-#else /* __CLEANUP_C */
-
-#ifdef __CLEANUP_CXX
-
- /*
- * C++ version of cancel cleanup.
- * - John E. Bossom.
- */
-
- class PThreadCleanup {
- /*
- * PThreadCleanup
- *
- * Purpose
- * This class is a C++ helper class that is
- * used to implement pthread_cleanup_push/
- * pthread_cleanup_pop.
- * The destructor of this class automatically
- * pops the pushed cleanup routine regardless
- * of how the code exits the scope
- * (i.e. such as by an exception)
- */
- ptw32_cleanup_callback_t cleanUpRout;
- void * obj;
- int executeIt;
-
- public:
- PThreadCleanup() :
- cleanUpRout( 0 ),
- obj( 0 ),
- executeIt( 0 )
- /*
- * No cleanup performed
- */
- {
- }
-
- PThreadCleanup(
- ptw32_cleanup_callback_t routine,
- void * arg ) :
- cleanUpRout( routine ),
- obj( arg ),
- executeIt( 1 )
- /*
- * Registers a cleanup routine for 'arg'
- */
- {
- }
-
- ~PThreadCleanup()
- {
- if ( executeIt && ((void *) cleanUpRout != (void *) 0) )
- {
- (void) (*cleanUpRout)( obj );
- }
- }
-
- void execute( int exec )
- {
- executeIt = exec;
- }
- };
-
- /*
- * C++ implementation of PThreads cancel cleanup;
- * This implementation takes advantage of a helper
- * class who's destructor automatically calls the
- * cleanup routine if we exit our scope weirdly
- */
-#define pthread_cleanup_push( _rout, _arg ) \
- { \
- PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \
- (void *) (_arg) );
-
-#define pthread_cleanup_pop( _execute ) \
- cleanup.execute( _execute ); \
- }
-
-#else
-
-#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined.
-
-#endif /* __CLEANUP_CXX */
-
-#endif /* __CLEANUP_C */
-
-#endif /* __CLEANUP_SEH */
-
-/*
- * ===============
- * ===============
- * Methods
- * ===============
- * ===============
- */
-
-/*
- * PThread Attribute Functions
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_init (pthread_attr_t * attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr,
- int *detachstate);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t * attr,
- void **stackaddr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr,
- size_t * stacksize);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr,
- int detachstate);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstackaddr (pthread_attr_t * attr,
- void *stackaddr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstacksize (pthread_attr_t * attr,
- size_t stacksize);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedparam (const pthread_attr_t *attr,
- struct sched_param *param);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr,
- const struct sched_param *param);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *,
- int);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (pthread_attr_t *,
- int *);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr,
- int inheritsched);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(pthread_attr_t * attr,
- int * inheritsched);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_setscope (pthread_attr_t *,
- int);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_attr_getscope (const pthread_attr_t *,
- int *);
-
-/*
- * PThread Functions
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_create (pthread_t * tid,
- const pthread_attr_t * attr,
- void *(*start) (void *),
- void *arg);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_detach (pthread_t tid);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_equal (pthread_t t1,
- pthread_t t2);
-
-PTW32_DLLPORT void PTW32_CDECL pthread_exit (void *value_ptr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_join (pthread_t thread,
- void **value_ptr);
-
-PTW32_DLLPORT pthread_t PTW32_CDECL pthread_self (void);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_cancel (pthread_t thread);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_setcancelstate (int state,
- int *oldstate);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_setcanceltype (int type,
- int *oldtype);
-
-PTW32_DLLPORT void PTW32_CDECL pthread_testcancel (void);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control,
- void (*init_routine) (void));
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute);
-
-PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
- void (*routine) (void *),
- void *arg);
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-/*
- * Thread Specific Data Functions
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_key_create (pthread_key_t * key,
- void (*destructor) (void *));
-
-PTW32_DLLPORT int PTW32_CDECL pthread_key_delete (pthread_key_t key);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_setspecific (pthread_key_t key,
- const void *value);
-
-PTW32_DLLPORT void * PTW32_CDECL pthread_getspecific (pthread_key_t key);
-
-
-/*
- * Mutex Attribute Functions
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_init (pthread_mutexattr_t * attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_destroy (pthread_mutexattr_t * attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getpshared (const pthread_mutexattr_t
- * attr,
- int *pshared);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t * attr,
- int pshared);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
-PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind);
-
-/*
- * Barrier Attribute Functions
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_init (pthread_barrierattr_t * attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_destroy (pthread_barrierattr_t * attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_getpshared (const pthread_barrierattr_t
- * attr,
- int *pshared);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_setpshared (pthread_barrierattr_t * attr,
- int pshared);
-
-/*
- * Mutex Functions
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_mutex_init (pthread_mutex_t * mutex,
- const pthread_mutexattr_t * attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_mutex_destroy (pthread_mutex_t * mutex);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_mutex_lock (pthread_mutex_t * mutex);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t *mutex,
- const struct timespec *abstime);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_mutex_trylock (pthread_mutex_t * mutex);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_mutex_unlock (pthread_mutex_t * mutex);
-
-/*
- * Spinlock Functions
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_spin_init (pthread_spinlock_t * lock, int pshared);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_spin_destroy (pthread_spinlock_t * lock);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_spin_lock (pthread_spinlock_t * lock);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_spin_trylock (pthread_spinlock_t * lock);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_spin_unlock (pthread_spinlock_t * lock);
-
-/*
- * Barrier Functions
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_barrier_init (pthread_barrier_t * barrier,
- const pthread_barrierattr_t * attr,
- unsigned int count);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_barrier_destroy (pthread_barrier_t * barrier);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_barrier_wait (pthread_barrier_t * barrier);
-
-/*
- * Condition Variable Attribute Functions
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_condattr_init (pthread_condattr_t * attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_condattr_destroy (pthread_condattr_t * attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_condattr_getpshared (const pthread_condattr_t * attr,
- int *pshared);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_condattr_setpshared (pthread_condattr_t * attr,
- int pshared);
-
-/*
- * Condition Variable Functions
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_cond_init (pthread_cond_t * cond,
- const pthread_condattr_t * attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_cond_destroy (pthread_cond_t * cond);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_cond_wait (pthread_cond_t * cond,
- pthread_mutex_t * mutex);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_cond_timedwait (pthread_cond_t * cond,
- pthread_mutex_t * mutex,
- const struct timespec *abstime);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_cond_signal (pthread_cond_t * cond);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_cond_broadcast (pthread_cond_t * cond);
-
-/*
- * Scheduling
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_setschedparam (pthread_t thread,
- int policy,
- const struct sched_param *param);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_getschedparam (pthread_t thread,
- int *policy,
- struct sched_param *param);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_setconcurrency (int);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_getconcurrency (void);
-
-/*
- * Read-Write Lock Functions
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_init(pthread_rwlock_t *lock,
- const pthread_rwlockattr_t *attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_destroy(pthread_rwlock_t *lock);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_tryrdlock(pthread_rwlock_t *);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_trywrlock(pthread_rwlock_t *);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_rdlock(pthread_rwlock_t *lock);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedrdlock(pthread_rwlock_t *lock,
- const struct timespec *abstime);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_wrlock(pthread_rwlock_t *lock);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedwrlock(pthread_rwlock_t *lock,
- const struct timespec *abstime);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_unlock(pthread_rwlock_t *lock);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_init (pthread_rwlockattr_t * attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr,
- int *pshared);
-
-PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr,
- int pshared);
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1
-
-/*
- * Signal Functions. Should be defined in <signal.h> but MSVC and MinGW32
- * already have signal.h that don't define these.
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_kill(pthread_t thread, int sig);
-
-/*
- * Non-portable functions
- */
-
-/*
- * Compatibility with Linux.
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr,
- int kind);
-PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr,
- int *kind);
-
-/*
- * Possibly supported by other POSIX threads implementations
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_delay_np (struct timespec * interval);
-PTW32_DLLPORT int PTW32_CDECL pthread_num_processors_np(void);
-
-/*
- * Useful if an application wants to statically link
- * the lib rather than load the DLL at run-time.
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_attach_np(void);
-PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_detach_np(void);
-PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_attach_np(void);
-PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_detach_np(void);
-
-/*
- * Features that are auto-detected at load/run time.
- */
-PTW32_DLLPORT int PTW32_CDECL pthread_win32_test_features_np(int);
-enum ptw32_features {
- PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001, /* System provides it. */
- PTW32_ALERTABLE_ASYNC_CANCEL = 0x0002 /* Can cancel blocked threads. */
-};
-
-/*
- * Register a system time change with the library.
- * Causes the library to perform various functions
- * in response to the change. Should be called whenever
- * the application's top level window receives a
- * WM_TIMECHANGE message. It can be passed directly to
- * pthread_create() as a new thread if desired.
- */
-PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *);
-
-#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-
-/*
- * Returns the Win32 HANDLE for the POSIX thread.
- */
-PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread);
-
-
-/*
- * Protected Methods
- *
- * This function blocks until the given WIN32 handle
- * is signaled or pthread_cancel had been called.
- * This function allows the caller to hook into the
- * PThreads cancel mechanism. It is implemented using
- *
- * WaitForMultipleObjects
- *
- * on 'waitHandle' and a manually reset WIN32 Event
- * used to implement pthread_cancel. The 'timeout'
- * argument to TimedWait is simply passed to
- * WaitForMultipleObjects.
- */
-PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (HANDLE waitHandle);
-PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle,
- DWORD timeout);
-
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-/*
- * Thread-Safe C Runtime Library Mappings.
- */
-#ifndef _UWIN
-# if defined(NEED_ERRNO)
- PTW32_DLLPORT int * PTW32_CDECL _errno( void );
-# else
-# ifndef errno
-# if (defined(_MT) || defined(_DLL))
- __declspec(dllimport) extern int * __cdecl _errno(void);
-# define errno (*_errno())
-# endif
-# endif
-# endif
-#endif
-
-/*
- * WIN32 C runtime library had been made thread-safe
- * without affecting the user interface. Provide
- * mappings from the UNIX thread-safe versions to
- * the standard C runtime library calls.
- * Only provide function mappings for functions that
- * actually exist on WIN32.
- */
-
-#if !defined(__MINGW32__)
-#define strtok_r( _s, _sep, _lasts ) \
- ( *(_lasts) = strtok( (_s), (_sep) ) )
-#endif /* !__MINGW32__ */
-
-#define asctime_r( _tm, _buf ) \
- ( strcpy( (_buf), asctime( (_tm) ) ), \
- (_buf) )
-
-#define ctime_r( _clock, _buf ) \
- ( strcpy( (_buf), ctime( (_clock) ) ), \
- (_buf) )
-
-#define gmtime_r( _clock, _result ) \
- ( *(_result) = *gmtime( (_clock) ), \
- (_result) )
-
-#define localtime_r( _clock, _result ) \
- ( *(_result) = *localtime( (_clock) ), \
- (_result) )
-
-#define rand_r( _seed ) \
- ( _seed == _seed? rand() : rand() )
-
-
-/*
- * Some compiler environments don't define some things.
- */
-#if defined(__BORLANDC__)
-# define _ftime ftime
-# define _timeb timeb
-#endif
-
-#ifdef __cplusplus
-
-/*
- * Internal exceptions
- */
-class ptw32_exception {};
-class ptw32_exception_cancel : public ptw32_exception {};
-class ptw32_exception_exit : public ptw32_exception {};
-
-#endif
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-
-/* FIXME: This is only required if the library was built using SEH */
-/*
- * Get internal SEH tag
- */
-PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void);
-
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-#ifndef PTW32_BUILD
-
-#ifdef __CLEANUP_SEH
-
-/*
- * Redefine the SEH __except keyword to ensure that applications
- * propagate our internal exceptions up to the library's internal handlers.
- */
-#define __except( E ) \
- __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \
- ? EXCEPTION_CONTINUE_SEARCH : ( E ) )
-
-#endif /* __CLEANUP_SEH */
-
-#ifdef __CLEANUP_CXX
-
-/*
- * Redefine the C++ catch keyword to ensure that applications
- * propagate our internal exceptions up to the library's internal handlers.
- */
-#ifdef _MSC_VER
- /*
- * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll'
- * if you want Pthread-Win32 cancelation and pthread_exit to work.
- */
-
-#ifndef PtW32NoCatchWarn
-
-#pragma message("Specify \"/DPtW32NoCatchWarn\" compiler flag to skip this message.")
-#pragma message("------------------------------------------------------------------")
-#pragma message("When compiling applications with MSVC++ and C++ exception handling:")
-#pragma message(" Replace any 'catch( ... )' in routines called from POSIX threads")
-#pragma message(" with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread")
-#pragma message(" cancelation and pthread_exit to work. For example:")
-#pragma message("")
-#pragma message(" #ifdef PtW32CatchAll")
-#pragma message(" PtW32CatchAll")
-#pragma message(" #else")
-#pragma message(" catch(...)")
-#pragma message(" #endif")
-#pragma message(" {")
-#pragma message(" /* Catchall block processing */")
-#pragma message(" }")
-#pragma message("------------------------------------------------------------------")
-
-#endif
-
-#define PtW32CatchAll \
- catch( ptw32_exception & ) { throw; } \
- catch( ... )
-
-#else /* _MSC_VER */
-
-#define catch( E ) \
- catch( ptw32_exception & ) { throw; } \
- catch( E )
-
-#endif /* _MSC_VER */
-
-#endif /* __CLEANUP_CXX */
-
-#endif /* ! PTW32_BUILD */
-
-#ifdef __cplusplus
-} /* End of extern "C" */
-#endif /* __cplusplus */
-
-#ifdef PTW32__HANDLE_DEF
-# undef HANDLE
-#endif
-#ifdef PTW32__DWORD_DEF
-# undef DWORD
-#endif
-
-#undef PTW32_LEVEL
-#undef PTW32_LEVEL_MAX
-
-#endif /* ! RC_INVOKED */
-
-#endif /* PTHREAD_H */
+++ /dev/null
-/*
- * Module: sched.h
- *
- * Purpose:
- * Provides an implementation of POSIX realtime extensions
- * as defined in
- *
- * POSIX 1003.1b-1993 (POSIX.1b)
- *
- * --------------------------------------------------------------------------
- *
- * Pthreads-win32 - POSIX Threads Library for Win32
- * Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
- * The current list of contributors is contained
- * in the file CONTRIBUTORS included with the source
- * code distribution. The list can also be seen at the
- * following World Wide Web location:
- * http://sources.redhat.com/pthreads-win32/contributors.html
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library in the file COPYING.LIB;
- * if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-#ifndef _SCHED_H
-#define _SCHED_H
-
-#undef PTW32_LEVEL
-
-#if defined(_POSIX_SOURCE)
-#define PTW32_LEVEL 0
-/* Early POSIX */
-#endif
-
-#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
-#undef PTW32_LEVEL
-#define PTW32_LEVEL 1
-/* Include 1b, 1c and 1d */
-#endif
-
-#if defined(INCLUDE_NP)
-#undef PTW32_LEVEL
-#define PTW32_LEVEL 2
-/* Include Non-Portable extensions */
-#endif
-
-#define PTW32_LEVEL_MAX 3
-
-#if !defined(PTW32_LEVEL)
-#define PTW32_LEVEL PTW32_LEVEL_MAX
-/* Include everything */
-#endif
-
-
-#if __GNUC__ && ! defined (__declspec)
-# error Please upgrade your GNU compiler to one that supports __declspec.
-#endif
-
-/*
- * When building the DLL code, you should define PTW32_BUILD so that
- * the variables/functions are exported correctly. When using the DLL,
- * do NOT define PTW32_BUILD, and then the variables/functions will
- * be imported correctly.
- */
-#ifndef PTW32_STATIC_LIB
-# ifdef PTW32_BUILD
-# define PTW32_DLLPORT __declspec (dllexport)
-# else
-# define PTW32_DLLPORT __declspec (dllimport)
-# endif
-#else
-# define PTW32_DLLPORT
-#endif
-
-/*
- * This is a duplicate of what is in the autoconf config.h,
- * which is only used when building the pthread-win32 libraries.
- */
-
-#ifndef PTW32_CONFIG_H
-# if defined(WINCE)
-# define NEED_ERRNO
-# define NEED_SEM
-# endif
-# if defined(_UWIN) || defined(__MINGW32__)
-# define HAVE_MODE_T
-# endif
-#endif
-
-/*
- *
- */
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-#ifdef NEED_ERRNO
-#include "need_errno.h"
-#else
-#include <errno.h>
-#endif
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-#if defined(__MINGW32__) || defined(_UWIN)
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-/* For pid_t */
-# include <sys/types.h>
-/* Required by Unix 98 */
-# include <time.h>
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-#else
-typedef int pid_t;
-#endif
-
-/* Thread scheduling policies */
-
-enum {
- SCHED_OTHER = 0,
- SCHED_FIFO,
- SCHED_RR,
- SCHED_MIN = SCHED_OTHER,
- SCHED_MAX = SCHED_RR
-};
-
-struct sched_param {
- int sched_priority;
-};
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-PTW32_DLLPORT int __cdecl sched_yield (void);
-
-PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy);
-
-PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy);
-
-PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
-
-PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid);
-
-/*
- * Note that this macro returns ENOTSUP rather than
- * ENOSYS as might be expected. However, returning ENOSYS
- * should mean that sched_get_priority_{min,max} are
- * not implemented as well as sched_rr_get_interval.
- * This is not the case, since we just don't support
- * round-robin scheduling. Therefore I have chosen to
- * return the same value as sched_setscheduler when
- * SCHED_RR is passed to it.
- */
-#define sched_rr_get_interval(_pid, _interval) \
- ( errno = ENOTSUP, (int) -1 )
-
-
-#ifdef __cplusplus
-} /* End of extern "C" */
-#endif /* __cplusplus */
-
-#undef PTW32_LEVEL
-#undef PTW32_LEVEL_MAX
-
-#endif /* !_SCHED_H */
-
+++ /dev/null
-/*
- * Module: semaphore.h
- *
- * Purpose:
- * Semaphores aren't actually part of the PThreads standard.
- * They are defined by the POSIX Standard:
- *
- * POSIX 1003.1b-1993 (POSIX.1b)
- *
- * --------------------------------------------------------------------------
- *
- * Pthreads-win32 - POSIX Threads Library for Win32
- * Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
- * The current list of contributors is contained
- * in the file CONTRIBUTORS included with the source
- * code distribution. The list can also be seen at the
- * following World Wide Web location:
- * http://sources.redhat.com/pthreads-win32/contributors.html
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library in the file COPYING.LIB;
- * if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-#if !defined( SEMAPHORE_H )
-#define SEMAPHORE_H
-
-#undef PTW32_LEVEL
-
-#if defined(_POSIX_SOURCE)
-#define PTW32_LEVEL 0
-/* Early POSIX */
-#endif
-
-#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
-#undef PTW32_LEVEL
-#define PTW32_LEVEL 1
-/* Include 1b, 1c and 1d */
-#endif
-
-#if defined(INCLUDE_NP)
-#undef PTW32_LEVEL
-#define PTW32_LEVEL 2
-/* Include Non-Portable extensions */
-#endif
-
-#define PTW32_LEVEL_MAX 3
-
-#if !defined(PTW32_LEVEL)
-#define PTW32_LEVEL PTW32_LEVEL_MAX
-/* Include everything */
-#endif
-
-#if __GNUC__ && ! defined (__declspec)
-# error Please upgrade your GNU compiler to one that supports __declspec.
-#endif
-
-/*
- * When building the DLL code, you should define PTW32_BUILD so that
- * the variables/functions are exported correctly. When using the DLL,
- * do NOT define PTW32_BUILD, and then the variables/functions will
- * be imported correctly.
- */
-#ifndef PTW32_STATIC_LIB
-# ifdef PTW32_BUILD
-# define PTW32_DLLPORT __declspec (dllexport)
-# else
-# define PTW32_DLLPORT __declspec (dllimport)
-# endif
-#else
-# define PTW32_DLLPORT
-#endif
-
-/*
- * This is a duplicate of what is in the autoconf config.h,
- * which is only used when building the pthread-win32 libraries.
- */
-
-#ifndef PTW32_CONFIG_H
-# if defined(WINCE)
-# define NEED_ERRNO
-# define NEED_SEM
-# endif
-# if defined(_UWIN) || defined(__MINGW32__)
-# define HAVE_MODE_T
-# endif
-#endif
-
-/*
- *
- */
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-#ifdef NEED_ERRNO
-#include "need_errno.h"
-#else
-#include <errno.h>
-#endif
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-#define _POSIX_SEMAPHORES
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-#ifndef HAVE_MODE_T
-typedef unsigned int mode_t;
-#endif
-
-
-typedef struct sem_t_ * sem_t;
-
-PTW32_DLLPORT int __cdecl sem_init (sem_t * sem,
- int pshared,
- unsigned int value);
-
-PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem);
-
-PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem);
-
-PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem);
-
-PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem,
- const struct timespec * abstime);
-
-PTW32_DLLPORT int __cdecl sem_post (sem_t * sem);
-
-PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem,
- int count);
-
-PTW32_DLLPORT int __cdecl sem_open (const char * name,
- int oflag,
- mode_t mode,
- unsigned int value);
-
-PTW32_DLLPORT int __cdecl sem_close (sem_t * sem);
-
-PTW32_DLLPORT int __cdecl sem_unlink (const char * name);
-
-PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem,
- int * sval);
-
-#ifdef __cplusplus
-} /* End of extern "C" */
-#endif /* __cplusplus */
-
-#undef PTW32_LEVEL
-#undef PTW32_LEVEL_MAX
-
-#endif /* !SEMAPHORE_H */
//every baudrate I could find is in here in an #ifdef block
//so it should compile on everything
-#include "os-dependent.h"
-
#ifndef __WINDOWS__
#include <termios.h>
#endif
-namespace CEC
+namespace PLATFORM
{
static struct sbaudrate
{
int32_t rate;
int32_t symbol;
}
+
baudrates[] =
{
#ifdef B50
{ -1, -1}
};
- static int32_t IntToBaudrate(uint32_t baudrate)
+ inline int32_t IntToBaudrate(uint32_t baudrate)
{
- for (unsigned int i = 0; i < sizeof(baudrates) / sizeof(CEC::sbaudrate) - 1; i++)
+ for (unsigned int i = 0; i < sizeof(baudrates) / sizeof(PLATFORM::sbaudrate) - 1; i++)
{
if (baudrates[i].rate == (int32_t) baudrate)
return baudrates[i].symbol;
* http://www.pulse-eight.net/
*/
-#include "os-dependent.h"
-#include <cectypes.h>
+#include "../os.h"
#include <string>
#include <stdint.h>
-#include "../AdapterCommunication.h"
-#include "../platform/threads.h"
#ifndef __WINDOWS__
#include <termios.h>
-#else
-#include "../util/buffer.h"
#endif
-namespace CEC
+namespace PLATFORM
{
#define PAR_NONE 0
#define PAR_EVEN 1
bool IsOpen();
void Close();
- int8_t Write(CCECAdapterMessage *data);
+ int64_t Write(uint8_t* data, uint32_t len);
int32_t Read(uint8_t* data, uint32_t len, uint64_t iTimeoutMs = 0);
std::string GetError() { return m_error; }
private:
bool SetBaudRate(uint32_t baudrate);
- std::string m_error;
- std::string m_name;
- CMutex m_mutex;
- bool m_tostdout;
+ std::string m_error;
+ std::string m_name;
+ CMutex m_mutex;
+ bool m_tostdout;
#ifdef __WINDOWS__
bool SetTimeouts(bool bBlocking);
- HANDLE m_handle;
- bool m_bIsOpen;
- uint32_t m_iBaudrate;
- uint8_t m_iDatabits;
- uint8_t m_iStopbits;
- uint8_t m_iParity;
- int64_t m_iTimeout;
- CecBuffer<uint8_t> m_buffer;
- HANDLE m_ovHandle;
+ HANDLE m_handle;
+ bool m_bIsOpen;
+ uint32_t m_iBaudrate;
+ uint8_t m_iDatabits;
+ uint8_t m_iStopbits;
+ uint8_t m_iParity;
+ int64_t m_iTimeout;
+ SyncedBuffer<uint8_t> m_buffer;
+ HANDLE m_ovHandle;
#else
struct termios m_options;
int m_fd;
+++ /dev/null
-#pragma once
-/*
- * This file is part of the libCEC(R) library.
- *
- * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved.
- * libCEC(R) is an original work, containing original code.
- *
- * libCEC(R) is a trademark of Pulse-Eight Limited.
- *
- * This program is dual-licensed; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- *
- * Alternatively, you can license this library under a commercial license,
- * please contact Pulse-Eight Licensing for more information.
- *
- * For more information contact:
- * Pulse-Eight Licensing <license@pulse-eight.com>
- * http://www.pulse-eight.com/
- * http://www.pulse-eight.net/
- */
-
-#include <stdint.h>
-
-namespace CEC
-{
- class IMutex
- {
- public:
- IMutex(bool bRecursive = true) { m_bRecursive = bRecursive ; };
- virtual ~IMutex(void) {};
-
- virtual bool TryLock(void) = 0;
- virtual bool Lock(void) = 0;
- virtual void Unlock(void) = 0;
-
- protected:
- bool m_bRecursive;
- };
-
- class ICondition
- {
- public:
- virtual void Broadcast(void) = 0;
- virtual void Signal(void) = 0;
- virtual bool Wait(IMutex *mutex, uint32_t iTimeout = 0) = 0;
-
- static void Sleep(uint32_t iTimeout);
- };
-
- class IThread
- {
- public:
- IThread(void);
- virtual ~IThread(void);
-
- virtual bool IsRunning(void) const { return m_bRunning; };
- virtual bool CreateThread(bool bWait = true) = 0;
- virtual bool IsStopped(void) const { return m_bStop; };
-
- virtual bool StopThread(bool bWaitForExit = true);
- virtual bool Sleep(uint32_t iTimeout);
-
- virtual void *Process(void) = 0;
-
- protected:
- bool m_bStop;
- bool m_bRunning;
- ICondition *m_threadCondition;
- IMutex *m_threadMutex;
- };
-
- class CLockObject
- {
- public:
- CLockObject(IMutex *mutex, bool bTryLock = false);
- ~CLockObject(void);
-
- bool IsLocked(void) const { return m_bLocked; }
- void Leave(void);
- void Lock(void);
-
- private:
- IMutex *m_mutex;
- bool m_bLocked;
- };
-};
--- /dev/null
+#pragma once
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing <license@pulse-eight.com>
+ * http://www.pulse-eight.com/
+ * http://www.pulse-eight.net/
+ */
+
+namespace PLATFORM
+{
+ class PreventCopy
+ {
+ public:
+ inline PreventCopy(void) {}
+ inline ~PreventCopy(void) {}
+
+ private:
+ inline PreventCopy(const PreventCopy &c) { *this = c; }
+ inline PreventCopy &operator=(const PreventCopy &c){ *this = c; return *this; }
+ };
+
+ class CCondition;
+
+ class CMutex : public PreventCopy
+ {
+ friend class CCondition;
+ public:
+ inline CMutex(void) :
+ m_iLockCount(0)
+ {
+ MutexCreate(m_mutex);
+ }
+
+ inline ~CMutex(void)
+ {
+ Clear();
+ MutexDelete(m_mutex);
+ }
+
+ inline bool TryLock(void)
+ {
+ if (MutexTryLock(m_mutex))
+ {
+ ++m_iLockCount;
+ return true;
+ }
+ return false;
+ }
+
+ inline bool Lock(void)
+ {
+ MutexLock(m_mutex);
+ ++m_iLockCount;
+ return true;
+ }
+
+ inline void Unlock(void)
+ {
+ --m_iLockCount;
+ MutexUnlock(m_mutex);
+ }
+
+ inline bool Clear(void)
+ {
+ bool bReturn(false);
+ if (TryLock())
+ {
+ unsigned int iLockCount = m_iLockCount;
+ for (unsigned int iPtr = 0; iPtr < iLockCount; iPtr++)
+ Unlock();
+ bReturn = true;
+ }
+ return bReturn;
+ }
+
+ private:
+ mutex_t m_mutex;
+ unsigned int m_iLockCount;
+ };
+
+ class CLockObject : public PreventCopy
+ {
+ public:
+ inline CLockObject(CMutex &mutex, bool bClearOnExit = false) :
+ m_mutex(mutex),
+ m_bClearOnExit(bClearOnExit)
+ {
+ m_mutex.Lock();
+ }
+
+ inline ~CLockObject(void)
+ {
+ if (m_bClearOnExit)
+ Clear();
+ else
+ Unlock();
+ }
+
+ inline bool TryLock(void)
+ {
+ return m_mutex.TryLock();
+ }
+
+ inline void Unlock(void)
+ {
+ m_mutex.Unlock();
+ }
+
+ inline bool Clear(void)
+ {
+ return m_mutex.Clear();
+ }
+
+ inline bool Lock(void)
+ {
+ return m_mutex.Lock();
+ }
+
+ private:
+ CMutex &m_mutex;
+ bool m_bClearOnExit;
+ };
+
+ class CCondition : public PreventCopy
+ {
+ public:
+ inline CCondition(void)
+ {
+ ConditionCreate(m_condition);
+ }
+
+ inline ~CCondition(void)
+ {
+ Broadcast();
+ ConditionDelete(m_condition);
+ }
+
+ inline void Broadcast(void)
+ {
+ ConditionBroadcast(m_condition);
+ }
+
+ inline void Signal(void)
+ {
+ ConditionSignal(m_condition);
+ }
+
+ inline bool Wait(CMutex &mutex, uint32_t iTimeout = 0)
+ {
+ return ConditionWait(m_condition, mutex.m_mutex, iTimeout);
+ }
+
+ static void Sleep(uint32_t iTimeout)
+ {
+ CCondition w;
+ CMutex m;
+ CLockObject lock(m);
+ w.Wait(m, iTimeout);
+ }
+
+ condition_t m_condition;
+ };
+}
--- /dev/null
+#pragma once
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing <license@pulse-eight.com>
+ * http://www.pulse-eight.com/
+ * http://www.pulse-eight.net/
+ */
+
+#include "mutex.h"
+
+namespace PLATFORM
+{
+ class CThread
+ {
+ public:
+ CThread(void) :
+ m_bStop(false),
+ m_bRunning(false) {}
+
+ virtual ~CThread(void)
+ {
+ StopThread();
+ }
+
+ static void *ThreadHandler(CThread *thread)
+ {
+ void *retVal = NULL;
+
+ if (thread)
+ {
+ CLockObject lock(thread->m_threadMutex);
+ thread->m_bRunning = true;
+ lock.Unlock();
+ thread->m_threadCondition.Broadcast();
+
+ retVal = thread->Process();
+
+ lock.Lock();
+ thread->m_bRunning = false;
+ lock.Unlock();
+ thread->m_threadCondition.Broadcast();
+ }
+
+ return retVal;
+ }
+
+ inline bool IsRunning(void)
+ {
+ CLockObject lock(m_threadMutex);
+ return m_bRunning;
+ }
+
+ inline bool IsStopped(void)
+ {
+ CLockObject lock(m_threadMutex);
+ return m_bStop;
+ }
+
+ inline bool CreateThread(bool bWait = true)
+ {
+ bool bReturn(false);
+ CLockObject lock(m_threadMutex);
+ if (!IsRunning())
+ {
+ if (ThreadsCreate(m_thread, CThread::ThreadHandler, ((void*)static_cast<CThread *>(this))))
+ {
+ if (bWait)
+ m_threadCondition.Wait(m_threadMutex);
+ bReturn = true;
+ }
+ }
+ return bReturn;
+ }
+
+ inline bool StopThread(bool bWaitForExit = true)
+ {
+ bool bReturn(true);
+ bool bRunning(false);
+ {
+ CLockObject lock(m_threadMutex);
+ bRunning = IsRunning();
+ m_bStop = true;
+ m_threadCondition.Broadcast();
+ }
+
+ if (bRunning && bWaitForExit)
+ {
+ void *retVal = NULL;
+ bReturn = ThreadsWait(m_thread, &retVal);
+ }
+ return true;
+ }
+
+ inline bool Sleep(uint32_t iTimeout)
+ {
+ CLockObject lock(m_threadMutex);
+ return m_bStop ? false : m_threadCondition.Wait(m_threadMutex, iTimeout);
+ }
+
+ virtual void *Process(void) = 0;
+
+ protected:
+ void SetRunning(bool bSetTo);
+
+ private:
+ bool m_bStop;
+ bool m_bRunning;
+ CCondition m_threadCondition;
+ CMutex m_threadMutex;
+ thread_t m_thread;
+ };
+};
#include <sys/time.h>
#endif
-#include "os-dependent.h"
+#include "os.h"
-namespace CEC
+namespace PLATFORM
{
+ #if defined(__WINDOWS__)
+ struct timezone
+ {
+ int tz_minuteswest;
+ int tz_dsttime;
+ };
+
+ #define usleep(t) Sleep((DWORD)(t)/1000)
+
+ inline int gettimeofday(struct timeval *pcur_time, struct timezone *tz)
+ {
+ if (pcur_time == NULL)
+ {
+ SetLastError(EFAULT);
+ return -1;
+ }
+ struct _timeb current;
+
+ _ftime(¤t);
+
+ pcur_time->tv_sec = (long) current.time;
+ pcur_time->tv_usec = current.millitm * 1000L;
+ if (tz)
+ {
+ tz->tz_minuteswest = current.timezone; /* minutes west of Greenwich */
+ tz->tz_dsttime = current.dstflag; /* type of dst correction */
+ }
+ return 0;
+ }
+ #endif
+
inline int64_t GetTimeMs()
{
#if defined(__APPLE__)
--- /dev/null
+#pragma once
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing <license@pulse-eight.com>
+ * http://www.pulse-eight.com/
+ * http://www.pulse-eight.net/
+ */
+
+namespace PLATFORM
+{
+ #define thread_t HANDLE
+ #define ThreadsWait(thread, retVal) (::WaitForSingleObject(thread, INFINITE) < 0)
+ #define ThreadsCreate(thread, func, arg) ((thread = ::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, arg, 0, NULL)) == NULL ? false : true)
+
+ typedef CRITICAL_SECTION* mutex_t;
+ #define MutexCreate(mutex) ::InitializeCriticalSection(mutex = new CRITICAL_SECTION)
+ #define MutexDelete(mutex) ::DeleteCriticalSection(mutex); delete mutex
+ #define MutexLock(mutex) ::EnterCriticalSection(mutex)
+ #define MutexTryLock(mutex) (::TryEnterCriticalSection(mutex) != 0)
+ #define MutexUnlock(mutex) ::LeaveCriticalSection(mutex)
+
+ #if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+ typedef CONDITION_VARIABLE* condition_t;
+ #define ConditionCreate(cond) ::InitializeConditionVariable(cond = new CONDITION_VARIABLE)
+ #define ConditionDelete(cond) delete cond
+ #define ConditionSignal(cond) ::WakeConditionVariable(cond)
+ #define ConditionBroadcast(cond) ::WakeAllConditionVariable(cond)
+ #define ConditionWait(cond, mutex, timeout) (::SleepConditionVariableCS(cond, mutex, timeout <= 0 ? INFINITE : timeout) ? true : false)
+ #else
+ typedef HANDLE condition_t;
+ #define ConditionCreate(cond) (cond = ::CreateEvent(NULL, TRUE, FALSE, NULL))
+ #define ConditionDelete(cond) ::CloseHandle(cond)
+ #define ConditionSignal(cond) ::SetEvent(cond)
+ #define ConditionBroadcast(cond) ::SetEvent(cond)
+ #define ConditionWait(cond, mutex, timeout) ::ResetEvent(cond); \
+ MutexUnlock(mutex); \
+ ::WaitForSingleObject(cond, timeout <= 0 ? 1000 : timeout); \
+ MutexLock(mutex)
+ #endif
+}
* http://www.pulse-eight.net/
*/
-#include "../threads.h"
+#pragma warning(disable:4005) // Disable "warning C4005: '_WINSOCKAPI_' : macro redefinition"
+#include <winsock2.h>
+#pragma warning(default:4005)
-namespace CEC
-{
- class CMutex : public IMutex
- {
- public:
- CMutex(bool bRecursive = true);
- virtual ~CMutex(void);
+#include <sys/timeb.h>
+#include <io.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stddef.h>
+#include <process.h>
- virtual bool TryLock(void);
- virtual bool Lock(void);
- virtual void Unlock(void);
+typedef signed __int8 int8_t;
+typedef signed __int16 int16_t;
+typedef signed __int32 int32_t;
+typedef signed __int64 int64_t;
+typedef unsigned __int8 uint8_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int64 uint64_t;
- pthread_mutex_t m_mutex;
+#define snprintf _snprintf
- private:
- static pthread_mutexattr_t *GetMutexAttribute();
- };
+#if defined(_MSC_VER)
+#pragma warning (push)
+#endif
- class CCondition : public ICondition
- {
- public:
- CCondition(void);
- virtual ~CCondition(void);
+#define NOGDI
+#if defined(_MSC_VER) /* prevent inclusion of wingdi.h */
+#pragma warning (pop)
+#endif
- virtual void Broadcast(void);
- virtual void Signal(void);
- virtual bool Wait(IMutex *mutex, uint32_t iTimeout = 0);
-
- private:
- pthread_cond_t m_cond;
- };
-
- class CThread : public IThread
- {
- public:
- CThread(void) { };
- virtual ~CThread(void) { };
-
- virtual bool CreateThread(bool bWait = true);
- virtual bool StopThread(bool bWaitForExit = true);
-
- static void *ThreadHandler(CThread *thread);
-
- private:
- pthread_t m_thread;
- };
-};
+#pragma warning(disable:4189) /* disable 'defined but not used' */
+#pragma warning(disable:4100) /* disable 'unreferenced formal parameter' */
+++ /dev/null
-/*
- * Copyright (C) 2005-2011 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "os_windows.h"
-#include <sys/timeb.h>
-
-int gettimeofday(struct timeval *pcur_time, struct timezone *tz)
-{
- if (pcur_time == NULL)
- {
- SetLastError(EFAULT);
- return -1;
- }
- struct _timeb current;
-
- _ftime(¤t);
-
- pcur_time->tv_sec = (long) current.time;
- pcur_time->tv_usec = current.millitm * 1000L;
- if (tz)
- {
- tz->tz_minuteswest = current.timezone; /* minutes west of Greenwich */
- tz->tz_dsttime = current.dstflag; /* type of dst correction */
- }
- return 0;
-}
+++ /dev/null
-#pragma once
-/*
- * Copyright (C) 2011 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#pragma warning(disable:4005) // Disable "warning C4005: '_WINSOCKAPI_' : macro redefinition"
-#include <winsock2.h>
-#pragma warning(default:4005)
-
-#if defined(_WIN32)
-#include "../pthread_win32/pthread.h"
-#include "../posix/pthreads.h"
-#endif
-
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
-# define __USE_FILE_OFFSET64 1
-#endif
-
-typedef signed __int32 int32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int8 uint8_t;
-typedef unsigned __int16 uint16_t;
-typedef unsigned __int32 uint32_t;
-typedef unsigned __int64 uint64_t;
-
-#if defined __USE_FILE_OFFSET64
-typedef int64_t off_t;
-typedef uint64_t ino_t;
-#endif
-
-#define usleep(t) Sleep((t)/1000)
-#define snprintf _snprintf
-
-#include <stddef.h>
-#include <process.h>
-#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
-#pragma warning (push)
-#endif
-/* prevent inclusion of wingdi.h */
-#define NOGDI
-#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
-#pragma warning (pop)
-#endif
-#include <io.h>
-#include <stdlib.h>
-#include <errno.h>
-
-struct timezone
-{
- int tz_minuteswest; /* minutes west of Greenwich */
- int tz_dsttime; /* type of dst correction */
-};
-
-/*!
- \brief implements similar unix call under windows
- \return 0 on success, -1 on failure (if pcur_time was NULL)
- \param pcur_time points to a timeval structure, should not be NULL
- \param tz points to a timezone structure, may be NULL
- */
-extern int gettimeofday(struct timeval *pcur_time, struct timezone *tz);
* http://www.pulse-eight.net/
*/
-#include "../serialport.h"
-#include "../baudrate.h"
+#include "../serialport/serialport.h"
+#include "../serialport/baudrate.h"
#include "../timeutils.h"
using namespace std;
-using namespace CEC;
+using namespace PLATFORM;
void FormatWindowsError(int iErrorCode, string &strMessage)
{
bool CSerialPort::Open(string name, uint32_t baudrate, uint8_t databits, uint8_t stopbits, uint8_t parity)
{
CStdString strComPath = "\\\\.\\" + name;
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
m_handle = CreateFile(strComPath.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (m_handle == INVALID_HANDLE_VALUE)
{
void CSerialPort::Close(void)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
if (m_bIsOpen)
{
CloseHandle(m_handle);
}
}
-int8_t CSerialPort::Write(CCECAdapterMessage *data)
+int64_t CSerialPort::Write(uint8_t* data, uint32_t len)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
DWORD iBytesWritten = 0;
if (!m_bIsOpen)
return -1;
- if (!WriteFile(m_handle, data->packet.data, data->size(), &iBytesWritten, NULL))
+ if (!WriteFile(m_handle, data, len, &iBytesWritten, NULL))
{
m_error = "Error while writing to COM port";
FormatWindowsError(GetLastError(), m_error);
return -1;
}
- return (int8_t)iBytesWritten;
+ return (int64_t)iBytesWritten;
}
int32_t CSerialPort::Read(uint8_t* data, uint32_t len, uint64_t iTimeoutMs /* = 0 */)
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
int32_t iReturn(-1);
DWORD iBytesRead = 0;
if (m_handle == 0)
bool CSerialPort::IsOpen()
{
- CLockObject lock(&m_mutex);
+ CLockObject lock(m_mutex);
return m_bIsOpen;
}
bin_PROGRAMS = cec-client
-cec_client_SOURCES = main.cpp \
- ../lib/platform/threads.cpp \
- ../lib/platform/posix/pthreads.cpp
+cec_client_SOURCES = main.cpp
cec_client_CPPFLAGS = -I@abs_top_srcdir@/include
cec_client_LDFLAGS = @LIBS_DL@
\ No newline at end of file
#include <fstream>
#include <string>
#include <sstream>
-#include "../lib/platform/threads.h"
-#include "../lib/util/StdString.h"
+#include "../lib/platform/os.h"
#include "../lib/implementations/CECCommandHandler.h"
using namespace CEC;
using namespace std;
+using namespace PLATFORM;
#define CEC_TEST_CLIENT_VERSION 1
inline void PrintToStdOut(const char *strOut)
{
- CLockObject lock(&g_outputMutex);
+ CLockObject lock(g_outputMutex);
cout << strOut << endl;
}
void ShowHelpCommandLine(const char* strExec)
{
- CLockObject lock(&g_outputMutex);
+ CLockObject lock(g_outputMutex);
cout << endl <<
strExec << " {-h|--help|-l|--list-devices|[COM PORT]}" << endl <<
endl <<
void ShowHelpConsole(void)
{
- CLockObject lock(&g_outputMutex);
+ CLockObject lock(g_outputMutex);
cout << endl <<
"================================================================================" << endl <<
"Available commands:" << endl <<