diff options
author | Tyler Veness | 2015-07-31 21:15:09 -0700 |
---|---|---|
committer | Tyler Veness | 2015-07-31 21:15:09 -0700 |
commit | ba10f2ce133495a20c83b21dcc26b65de4955db4 (patch) | |
tree | 65e087fc5ae7fc523c793c1ebb2837212dc6434a | |
parent | 3c7248eae7bce3d769501e949d23e9c5ae5c32fb (diff) | |
download | aur-ba10f2ce133495a20c83b21dcc26b65de4955db4.tar.gz |
Added another upstream patch to fix compilation errors when CANTalon is used
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | 0001-Fixed-build-failures-introduced-by-43f1651.-Headers-.patch | 445 | ||||
-rw-r--r-- | PKGBUILD | 7 |
3 files changed, 452 insertions, 2 deletions
@@ -15,7 +15,9 @@ pkgbase = arm-frc-linux-gnueabi-wpilib-git options = libtool options = staticlibs source = git+https://usfirst.collab.net/gerrit/allwpilib + source = 0001-Fixed-build-failures-introduced-by-43f1651.-Headers-.patch sha512sums = SKIP + sha512sums = cad43e25abd72403fffde532e0a6766509ecff9165f1ca1f50b5973f2df3bbe3655332a7f458401855cc21835acf54a95719c4f9bb932d224bbb8df747463183 pkgname = arm-frc-linux-gnueabi-wpilib-git diff --git a/0001-Fixed-build-failures-introduced-by-43f1651.-Headers-.patch b/0001-Fixed-build-failures-introduced-by-43f1651.-Headers-.patch new file mode 100644 index 000000000000..2f68dd9b92ad --- /dev/null +++ b/0001-Fixed-build-failures-introduced-by-43f1651.-Headers-.patch @@ -0,0 +1,445 @@ +From a1818850834205d0a2a315ce452d5bd357a6cc86 Mon Sep 17 00:00:00 2001 +From: Tyler Veness <calcmogul@gmail.com> +Date: Fri, 31 Jul 2015 21:06:47 -0700 +Subject: [PATCH] Fixed build failures introduced by 43f1651. Headers are + missing in robot projects which use CANTalon. + +Change-Id: If840154d6a75a391ccd19b63f3f47b17c1cb87e1 +--- + hal/include/HAL/CanTalonSRX.h | 1 - + hal/include/HAL/ctre/CtreCanNode.h | 115 ++++++++++++++++++++++++++++++++++++ + hal/include/HAL/ctre/ctre.h | 50 ++++++++++++++++ + hal/lib/Athena/HAL.cpp | 2 +- + hal/lib/Athena/ctre/CtreCanNode.cpp | 2 +- + hal/lib/Athena/ctre/CtreCanNode.h | 115 ------------------------------------ + hal/lib/Athena/ctre/PCM.h | 3 +- + hal/lib/Athena/ctre/PDP.h | 3 +- + hal/lib/Athena/ctre/ctre.h | 50 ---------------- + 9 files changed, 169 insertions(+), 172 deletions(-) + create mode 100644 hal/include/HAL/ctre/CtreCanNode.h + create mode 100644 hal/include/HAL/ctre/ctre.h + delete mode 100644 hal/lib/Athena/ctre/CtreCanNode.h + delete mode 100644 hal/lib/Athena/ctre/ctre.h + +diff --git a/hal/include/HAL/CanTalonSRX.h b/hal/include/HAL/CanTalonSRX.h +index f04ce3c..f59b02c 100644 +--- a/hal/include/HAL/CanTalonSRX.h ++++ b/hal/include/HAL/CanTalonSRX.h +@@ -71,7 +71,6 @@ + */
+ #ifndef CanTalonSRX_H_
+ #define CanTalonSRX_H_
+-#include "ctre/ctre.h" //BIT Defines + Typedefs
+ #include "ctre/CtreCanNode.h"
+ #include <NetworkCommunication/CANSessionMux.h> //CAN Comm
+ #include <map>
+diff --git a/hal/include/HAL/ctre/CtreCanNode.h b/hal/include/HAL/ctre/CtreCanNode.h +new file mode 100644 +index 0000000..70ce567 +--- /dev/null ++++ b/hal/include/HAL/ctre/CtreCanNode.h +@@ -0,0 +1,115 @@ ++#ifndef CtreCanNode_H_
++#define CtreCanNode_H_
++#include "ctre.h" //BIT Defines + Typedefs
++#include <NetworkCommunication/CANSessionMux.h> //CAN Comm
++#include <map>
++#include <string.h> // memcpy
++#include <sys/time.h>
++class CtreCanNode
++{
++public:
++ CtreCanNode(UINT8 deviceNumber);
++ ~CtreCanNode();
++
++ UINT8 GetDeviceNumber()
++ {
++ return _deviceNumber;
++ }
++protected:
++
++
++ template <typename T> class txTask{
++ public:
++ uint32_t arbId;
++ T * toSend;
++ T * operator -> ()
++ {
++ return toSend;
++ }
++ T & operator*()
++ {
++ return *toSend;
++ }
++ bool IsEmpty()
++ {
++ if(toSend == 0)
++ return true;
++ return false;
++ }
++ };
++ template <typename T> class recMsg{
++ public:
++ uint32_t arbId;
++ uint8_t bytes[8];
++ CTR_Code err;
++ T * operator -> ()
++ {
++ return (T *)bytes;
++ }
++ T & operator*()
++ {
++ return *(T *)bytes;
++ }
++ };
++ UINT8 _deviceNumber;
++ void RegisterRx(uint32_t arbId);
++ void RegisterTx(uint32_t arbId, uint32_t periodMs);
++
++ CTR_Code GetRx(uint32_t arbId,uint8_t * dataBytes,uint32_t timeoutMs);
++ void FlushTx(uint32_t arbId);
++
++ template<typename T> txTask<T> GetTx(uint32_t arbId)
++ {
++ txTask<T> retval = {0, nullptr};
++ txJobs_t::iterator i = _txJobs.find(arbId);
++ if(i != _txJobs.end()){
++ retval.arbId = i->second.arbId;
++ retval.toSend = (T*)i->second.toSend;
++ }
++ return retval;
++ }
++ template<class T> void FlushTx(T & par)
++ {
++ FlushTx(par.arbId);
++ }
++
++ template<class T> recMsg<T> GetRx(uint32_t arbId, uint32_t timeoutMs)
++ {
++ recMsg<T> retval;
++ retval.err = GetRx(arbId,retval.bytes, timeoutMs);
++ return retval;
++ }
++
++private:
++
++ class txJob_t {
++ public:
++ uint32_t arbId;
++ uint8_t toSend[8];
++ uint32_t periodMs;
++ };
++
++ class rxEvent_t{
++ public:
++ uint8_t bytes[8];
++ struct timespec time;
++ rxEvent_t()
++ {
++ bytes[0] = 0;
++ bytes[1] = 0;
++ bytes[2] = 0;
++ bytes[3] = 0;
++ bytes[4] = 0;
++ bytes[5] = 0;
++ bytes[6] = 0;
++ bytes[7] = 0;
++ }
++ };
++
++ typedef std::map<uint32_t,txJob_t> txJobs_t;
++ txJobs_t _txJobs;
++
++ typedef std::map<uint32_t,rxEvent_t> rxRxEvents_t;
++ rxRxEvents_t _rxRxEvents;
++};
++#endif
+diff --git a/hal/include/HAL/ctre/ctre.h b/hal/include/HAL/ctre/ctre.h +new file mode 100644 +index 0000000..c2d3f69 +--- /dev/null ++++ b/hal/include/HAL/ctre/ctre.h +@@ -0,0 +1,50 @@ ++#ifndef GLOBAL_H
++#define GLOBAL_H
++
++//Bit Defines
++#define BIT0 0x01
++#define BIT1 0x02
++#define BIT2 0x04
++#define BIT3 0x08
++#define BIT4 0x10
++#define BIT5 0x20
++#define BIT6 0x40
++#define BIT7 0x80
++#define BIT8 0x0100
++#define BIT9 0x0200
++#define BIT10 0x0400
++#define BIT11 0x0800
++#define BIT12 0x1000
++#define BIT13 0x2000
++#define BIT14 0x4000
++#define BIT15 0x8000
++
++//Signed
++typedef signed char INT8;
++typedef signed short INT16;
++typedef signed int INT32;
++typedef signed long long INT64;
++
++//Unsigned
++typedef unsigned char UINT8;
++typedef unsigned short UINT16;
++typedef unsigned int UINT32;
++typedef unsigned long long UINT64;
++
++//Other
++typedef unsigned char UCHAR;
++typedef unsigned short USHORT;
++typedef unsigned int UINT;
++typedef unsigned long ULONG;
++
++typedef enum {
++ CTR_OKAY, //!< No Error - Function executed as expected
++ CTR_RxTimeout, //!< CAN frame has not been received within specified period of time.
++ CTR_TxTimeout, //!< Not used.
++ CTR_InvalidParamValue, //!< Caller passed an invalid param
++ CTR_UnexpectedArbId, //!< Specified CAN Id is invalid.
++ CTR_TxFailed, //!< Could not transmit the CAN frame.
++ CTR_SigNotUpdated, //!< Have not received an value response for signal.
++}CTR_Code;
++
++#endif
+diff --git a/hal/lib/Athena/HAL.cpp b/hal/lib/Athena/HAL.cpp +index 185f2be..3aac51f 100644 +--- a/hal/lib/Athena/HAL.cpp ++++ b/hal/lib/Athena/HAL.cpp +@@ -2,7 +2,7 @@ + + #include "HAL/Port.h" + #include "HAL/Errors.hpp" +-#include "ctre/ctre.h" ++#include "HAL/ctre/ctre.h" + #include "visa/visa.h" + #include "ChipObject.h" + #include "NetworkCommunication/FRCComm.h" +diff --git a/hal/lib/Athena/ctre/CtreCanNode.cpp b/hal/lib/Athena/ctre/CtreCanNode.cpp +index b2e3620..1c6243e 100644 +--- a/hal/lib/Athena/ctre/CtreCanNode.cpp ++++ b/hal/lib/Athena/ctre/CtreCanNode.cpp +@@ -1,6 +1,6 @@ + #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+
+-#include "CtreCanNode.h"
++#include <HAL/ctre/CtreCanNode.h>
+ #include "NetworkCommunication/CANSessionMux.h"
+ #include <string.h> // memset
+ #include <unistd.h> // usleep
+diff --git a/hal/lib/Athena/ctre/CtreCanNode.h b/hal/lib/Athena/ctre/CtreCanNode.h +deleted file mode 100644 +index 70ce567..0000000 +--- a/hal/lib/Athena/ctre/CtreCanNode.h ++++ /dev/null +@@ -1,115 +0,0 @@ +-#ifndef CtreCanNode_H_
+-#define CtreCanNode_H_
+-#include "ctre.h" //BIT Defines + Typedefs
+-#include <NetworkCommunication/CANSessionMux.h> //CAN Comm
+-#include <map>
+-#include <string.h> // memcpy
+-#include <sys/time.h>
+-class CtreCanNode
+-{
+-public:
+- CtreCanNode(UINT8 deviceNumber);
+- ~CtreCanNode();
+-
+- UINT8 GetDeviceNumber()
+- {
+- return _deviceNumber;
+- }
+-protected:
+-
+-
+- template <typename T> class txTask{
+- public:
+- uint32_t arbId;
+- T * toSend;
+- T * operator -> ()
+- {
+- return toSend;
+- }
+- T & operator*()
+- {
+- return *toSend;
+- }
+- bool IsEmpty()
+- {
+- if(toSend == 0)
+- return true;
+- return false;
+- }
+- };
+- template <typename T> class recMsg{
+- public:
+- uint32_t arbId;
+- uint8_t bytes[8];
+- CTR_Code err;
+- T * operator -> ()
+- {
+- return (T *)bytes;
+- }
+- T & operator*()
+- {
+- return *(T *)bytes;
+- }
+- };
+- UINT8 _deviceNumber;
+- void RegisterRx(uint32_t arbId);
+- void RegisterTx(uint32_t arbId, uint32_t periodMs);
+-
+- CTR_Code GetRx(uint32_t arbId,uint8_t * dataBytes,uint32_t timeoutMs);
+- void FlushTx(uint32_t arbId);
+-
+- template<typename T> txTask<T> GetTx(uint32_t arbId)
+- {
+- txTask<T> retval = {0, nullptr};
+- txJobs_t::iterator i = _txJobs.find(arbId);
+- if(i != _txJobs.end()){
+- retval.arbId = i->second.arbId;
+- retval.toSend = (T*)i->second.toSend;
+- }
+- return retval;
+- }
+- template<class T> void FlushTx(T & par)
+- {
+- FlushTx(par.arbId);
+- }
+-
+- template<class T> recMsg<T> GetRx(uint32_t arbId, uint32_t timeoutMs)
+- {
+- recMsg<T> retval;
+- retval.err = GetRx(arbId,retval.bytes, timeoutMs);
+- return retval;
+- }
+-
+-private:
+-
+- class txJob_t {
+- public:
+- uint32_t arbId;
+- uint8_t toSend[8];
+- uint32_t periodMs;
+- };
+-
+- class rxEvent_t{
+- public:
+- uint8_t bytes[8];
+- struct timespec time;
+- rxEvent_t()
+- {
+- bytes[0] = 0;
+- bytes[1] = 0;
+- bytes[2] = 0;
+- bytes[3] = 0;
+- bytes[4] = 0;
+- bytes[5] = 0;
+- bytes[6] = 0;
+- bytes[7] = 0;
+- }
+- };
+-
+- typedef std::map<uint32_t,txJob_t> txJobs_t;
+- txJobs_t _txJobs;
+-
+- typedef std::map<uint32_t,rxEvent_t> rxRxEvents_t;
+- rxRxEvents_t _rxRxEvents;
+-};
+-#endif
+diff --git a/hal/lib/Athena/ctre/PCM.h b/hal/lib/Athena/ctre/PCM.h +index a3c61ef..975f577 100644 +--- a/hal/lib/Athena/ctre/PCM.h ++++ b/hal/lib/Athena/ctre/PCM.h +@@ -1,8 +1,7 @@ + #ifndef PCM_H_
+ #define PCM_H_
+-#include "ctre.h" //BIT Defines + Typedefs
+ #include <NetworkCommunication/CANSessionMux.h> //CAN Comm
+-#include "CtreCanNode.h"
++#include <HAL/ctre/CtreCanNode.h>
+ class PCM : public CtreCanNode
+ {
+ public:
+diff --git a/hal/lib/Athena/ctre/PDP.h b/hal/lib/Athena/ctre/PDP.h +index 42b62a2..342b6e4 100644 +--- a/hal/lib/Athena/ctre/PDP.h ++++ b/hal/lib/Athena/ctre/PDP.h +@@ -1,8 +1,7 @@ + #ifndef PDP_H_
+ #define PDP_H_
+-#include "ctre.h" //BIT Defines + Typedefs
+ #include <NetworkCommunication/CANSessionMux.h> //CAN Comm
+-#include "CtreCanNode.h"
++#include <HAL/ctre/CtreCanNode.h>
+ class PDP : public CtreCanNode
+ {
+ public:
+diff --git a/hal/lib/Athena/ctre/ctre.h b/hal/lib/Athena/ctre/ctre.h +deleted file mode 100644 +index c2d3f69..0000000 +--- a/hal/lib/Athena/ctre/ctre.h ++++ /dev/null +@@ -1,50 +0,0 @@ +-#ifndef GLOBAL_H
+-#define GLOBAL_H
+-
+-//Bit Defines
+-#define BIT0 0x01
+-#define BIT1 0x02
+-#define BIT2 0x04
+-#define BIT3 0x08
+-#define BIT4 0x10
+-#define BIT5 0x20
+-#define BIT6 0x40
+-#define BIT7 0x80
+-#define BIT8 0x0100
+-#define BIT9 0x0200
+-#define BIT10 0x0400
+-#define BIT11 0x0800
+-#define BIT12 0x1000
+-#define BIT13 0x2000
+-#define BIT14 0x4000
+-#define BIT15 0x8000
+-
+-//Signed
+-typedef signed char INT8;
+-typedef signed short INT16;
+-typedef signed int INT32;
+-typedef signed long long INT64;
+-
+-//Unsigned
+-typedef unsigned char UINT8;
+-typedef unsigned short UINT16;
+-typedef unsigned int UINT32;
+-typedef unsigned long long UINT64;
+-
+-//Other
+-typedef unsigned char UCHAR;
+-typedef unsigned short USHORT;
+-typedef unsigned int UINT;
+-typedef unsigned long ULONG;
+-
+-typedef enum {
+- CTR_OKAY, //!< No Error - Function executed as expected
+- CTR_RxTimeout, //!< CAN frame has not been received within specified period of time.
+- CTR_TxTimeout, //!< Not used.
+- CTR_InvalidParamValue, //!< Caller passed an invalid param
+- CTR_UnexpectedArbId, //!< Specified CAN Id is invalid.
+- CTR_TxFailed, //!< Could not transmit the CAN frame.
+- CTR_SigNotUpdated, //!< Have not received an value response for signal.
+-}CTR_Code;
+-
+-#endif
+-- +2.5.0 + @@ -12,8 +12,10 @@ groups=('frc-2015') depends=('arm-frc-linux-gnueabi-gcc') makedepends=('cmake' 'git') options=('!strip' 'libtool' 'staticlibs') -source=("git+https://usfirst.collab.net/gerrit/allwpilib") -sha512sums=('SKIP') +source=("git+https://usfirst.collab.net/gerrit/allwpilib" + "0001-Fixed-build-failures-introduced-by-43f1651.-Headers-.patch") +sha512sums=('SKIP' + 'cad43e25abd72403fffde532e0a6766509ecff9165f1ca1f50b5973f2df3bbe3655332a7f458401855cc21835acf54a95719c4f9bb932d224bbb8df747463183') pkgver() { cd allwpilib @@ -24,6 +26,7 @@ prepare() { cd "$srcdir/allwpilib" # Apply upstream patches + patch -p1 < ../0001-Fixed-build-failures-introduced-by-43f1651.-Headers-.patch } build() { |