libcec: update imx6 patch to work with p8-platform

also rebased to remove patching warnings
moved to project patches folder
This commit is contained in:
Peter Vicman 2016-04-23 19:07:04 +02:00
parent f1aef79fdb
commit c8aabe7cc1

View File

@ -1,3 +1,8 @@
From 3bd000096d6c0d9fb84cb5476b4dcae7e12f17df Mon Sep 17 00:00:00 2001
From: Peter Vicman <peter.vicman@gmail.com>
Date: Sun, 24 Apr 2016 14:26:55 +0200
Subject: [PATCH] imx support (rebased again)
From a7f3315333c1a79259a763c6542a6cd71855b357 Mon Sep 17 00:00:00 2001
From: Stefan Saraev <stefan@saraev.ca>
Date: Thu, 7 May 2015 11:35:04 +0300
@ -24,7 +29,7 @@ note. I am NOT the author of the patch. just rebased it
create mode 100644 src/libcec/adapter/IMX/IMXCECAdapterDetection.h
diff --git a/include/cectypes.h b/include/cectypes.h
index acff259..0cfee8c 100644
index 0fdd48e..e28c8df 100644
--- a/include/cectypes.h
+++ b/include/cectypes.h
@@ -309,6 +309,17 @@ namespace CEC {
@ -45,7 +50,7 @@ index acff259..0cfee8c 100644
* Mimimum client version
*/
#define CEC_MIN_LIB_VERSION 3
@@ -876,7 +887,8 @@ typedef enum cec_adapter_type
@@ -877,7 +888,8 @@ typedef enum cec_adapter_type
ADAPTERTYPE_P8_DAUGHTERBOARD = 0x2,
ADAPTERTYPE_RPI = 0x100,
ADAPTERTYPE_TDA995x = 0x200,
@ -56,10 +61,10 @@ index acff259..0cfee8c 100644
/** force exporting through swig */
diff --git a/src/libcec/CECTypeUtils.h b/src/libcec/CECTypeUtils.h
index fd8046a..48cb215 100644
index 0d0cf17..f6c818a 100644
--- a/src/libcec/CECTypeUtils.h
+++ b/src/libcec/CECTypeUtils.h
@@ -765,6 +765,8 @@ namespace CEC
@@ -766,6 +766,8 @@ namespace CEC
return "Raspberry Pi";
case ADAPTERTYPE_TDA995x:
return "TDA995x";
@ -128,7 +133,7 @@ index da05725..92e378b 100644
}
diff --git a/src/libcec/adapter/IMX/AdapterMessageQueue.h b/src/libcec/adapter/IMX/AdapterMessageQueue.h
new file mode 100644
index 0000000..af6742c
index 0000000..7749874
--- /dev/null
+++ b/src/libcec/adapter/IMX/AdapterMessageQueue.h
@@ -0,0 +1,134 @@
@ -165,11 +170,11 @@ index 0000000..af6742c
+ * http://www.pulse-eight.net/
+ */
+
+#include "platform/threads/mutex.h"
+#include "p8-platform/threads/mutex.h"
+
+namespace CEC
+{
+ using namespace PLATFORM;
+ using namespace P8PLATFORM;
+
+ class CAdapterMessageQueueEntry
+ {
@ -258,8 +263,8 @@ index 0000000..af6742c
+
+ private:
+ bool m_bWaiting; /**< true while a thread is waiting or when it hasn't started waiting yet */
+ PLATFORM::CCondition<bool> m_condition; /**< the condition to wait on */
+ PLATFORM::CMutex m_mutex; /**< mutex for changes to this class */
+ P8PLATFORM::CCondition<bool> m_condition; /**< the condition to wait on */
+ P8PLATFORM::CMutex m_mutex; /**< mutex for changes to this class */
+ uint32_t m_hash;
+ uint32_t m_retval;
+ bool m_bSucceeded;
@ -268,7 +273,7 @@ index 0000000..af6742c
+};
diff --git a/src/libcec/adapter/IMX/IMXCECAdapterCommunication.cpp b/src/libcec/adapter/IMX/IMXCECAdapterCommunication.cpp
new file mode 100644
index 0000000..2daa8cb
index 0000000..ba88137
--- /dev/null
+++ b/src/libcec/adapter/IMX/IMXCECAdapterCommunication.cpp
@@ -0,0 +1,328 @@
@ -306,9 +311,9 @@ index 0000000..2daa8cb
+
+#include "CECTypeUtils.h"
+#include "LibCEC.h"
+#include "platform/sockets/cdevsocket.h"
+#include "platform/util/StdString.h"
+#include "platform/util/buffer.h"
+#include "p8-platform/sockets/cdevsocket.h"
+#include "p8-platform/util/StdString.h"
+#include "p8-platform/util/buffer.h"
+
+/*
+ * Ioctl definitions from kernel header
@ -336,7 +341,7 @@ index 0000000..2daa8cb
+
+using namespace std;
+using namespace CEC;
+using namespace PLATFORM;
+using namespace P8PLATFORM;
+
+#include "AdapterMessageQueue.h"
+
@ -602,7 +607,7 @@ index 0000000..2daa8cb
+#endif // HAVE_IMX_API
diff --git a/src/libcec/adapter/IMX/IMXCECAdapterCommunication.h b/src/libcec/adapter/IMX/IMXCECAdapterCommunication.h
new file mode 100644
index 0000000..9e899a3
index 0000000..cebe5b6
--- /dev/null
+++ b/src/libcec/adapter/IMX/IMXCECAdapterCommunication.h
@@ -0,0 +1,119 @@
@ -636,9 +641,9 @@ index 0000000..9e899a3
+
+#if defined(HAVE_IMX_API)
+
+#include "platform/threads/mutex.h"
+#include "platform/threads/threads.h"
+#include "platform/sockets/socket.h"
+#include "p8-platform/threads/mutex.h"
+#include "p8-platform/threads/threads.h"
+#include "p8-platform/sockets/socket.h"
+#include "adapter/AdapterCommunication.h"
+#include <map>
+
@ -647,7 +652,7 @@ index 0000000..9e899a3
+
+
+
+namespace PLATFORM
+namespace P8PLATFORM
+{
+ class CCDevSocket;
+};
@ -657,7 +662,7 @@ index 0000000..9e899a3
+{
+ class CAdapterMessageQueueEntry;
+
+ class CIMXCECAdapterCommunication : public IAdapterCommunication, public PLATFORM::CThread
+ class CIMXCECAdapterCommunication : public IAdapterCommunication, public P8PLATFORM::CThread
+ {
+ public:
+ /*!
@ -698,7 +703,7 @@ index 0000000..9e899a3
+ bool RegisterLogicalAddress(const cec_logical_address address);
+ ///}
+
+ /** @name PLATFORM::CThread implementation */
+ /** @name P8PLATFORM::CThread implementation */
+ ///{
+ void *Process(void);
+ ///}
@ -712,12 +717,12 @@ index 0000000..9e899a3
+ //cec_logical_addresses m_logicalAddresses;
+ cec_logical_address m_logicalAddress;
+
+ PLATFORM::CMutex m_mutex;
+ PLATFORM::CCDevSocket *m_dev; /**< the device connection */
+ P8PLATFORM::CMutex m_mutex;
+ P8PLATFORM::CCDevSocket *m_dev; /**< the device connection */
+ bool m_bLogicalAddressRegistered;
+ bool m_bInitialised;
+
+ PLATFORM::CMutex m_messageMutex;
+ P8PLATFORM::CMutex m_messageMutex;
+ uint32_t m_iNextMessage;
+ std::map<uint32_t, CAdapterMessageQueueEntry *> m_messages;
+ };
@ -816,18 +821,18 @@ index 0000000..d54891d
+ };
+}
diff --git a/src/libcec/cmake/CheckPlatformSupport.cmake b/src/libcec/cmake/CheckPlatformSupport.cmake
index 828cdb2..8b47795 100644
index b8a16c8..dc5bc25 100644
--- a/src/libcec/cmake/CheckPlatformSupport.cmake
+++ b/src/libcec/cmake/CheckPlatformSupport.cmake
@@ -8,6 +8,7 @@
@@ -7,6 +7,7 @@
# HAVE_RANDR 1 if xrandr is supported
# HAVE_LIBUDEV 1 if udev is supported
# HAVE_RPI_API 1 if Raspberry Pi is supported
+# HAVE_IMX_API 1 if i.MX is supported
# HAVE_TDA995X_API 1 if TDA995X is supported
# HAVE_EXYNOS_API 1 if Exynos is supported
# HAVE_P8_USB_DETECT 1 if Pulse-Eight devices can be auto-detected
@@ -87,6 +88,15 @@ else()
# HAVE_P8_USB 1 if Pulse-Eight devices are supported
@@ -110,6 +111,15 @@ else()
list(APPEND CEC_SOURCES ${CEC_SOURCES_ADAPTER_RPI})
endif()
@ -844,10 +849,10 @@ index 828cdb2..8b47795 100644
check_include_files("tda998x_ioctl.h;comps/tmdlHdmiCEC/inc/tmdlHdmiCEC_Types.h" HAVE_TDA995X_API)
if (HAVE_TDA995X_API)
diff --git a/src/libcec/cmake/DisplayPlatformSupport.cmake b/src/libcec/cmake/DisplayPlatformSupport.cmake
index feee111..0309c56 100644
index 9dcaacf..4e24def 100644
--- a/src/libcec/cmake/DisplayPlatformSupport.cmake
+++ b/src/libcec/cmake/DisplayPlatformSupport.cmake
@@ -32,6 +32,12 @@ else()
@@ -26,6 +26,12 @@ else()
message(STATUS "Raspberry Pi support: no")
endif()
@ -861,10 +866,10 @@ index feee111..0309c56 100644
message(STATUS "TDA995x support: yes")
else()
diff --git a/src/libcec/env.h.in b/src/libcec/env.h.in
index a1a1f26..f90e729 100644
index 0496aa0..384f1c7 100644
--- a/src/libcec/env.h.in
+++ b/src/libcec/env.h.in
@@ -60,6 +60,9 @@
@@ -66,6 +66,9 @@
/* Define to 1 for Raspberry Pi support */
#cmakedefine HAVE_RPI_API @HAVE_RPI_API@
@ -875,5 +880,5 @@ index a1a1f26..f90e729 100644
#cmakedefine HAVE_TDA995X_API @HAVE_TDA995X_API@
--
2.1.4
2.7.1