Moves NI headers to their own folder in the repo (#324)

This commit is contained in:
Thad House
2016-11-04 01:22:28 -07:00
committed by Peter Johnson
parent 03d8f9193b
commit 3fe0f49ac0
149 changed files with 32 additions and 453 deletions

View File

@@ -1,5 +1,5 @@
// These add the nilibraries shared library to the linker args
def niLibraryPath = file('ni-libraries').path
def niLibraryPath = file('ni-libraries/lib').path
def niLibrary = niLibraryPath + "/libnilibraries.so"
task downloadArmNetworkTables() {
@@ -268,6 +268,9 @@ subprojects {
}
}
ext.niLibraryHeadersRoot = "${rootDir}/ni-libraries/include"
ext.niLibraryHeadersChipObject = "${rootDir}/ni-libraries/include/FRC_FPGA_ChipObject"
// This task adds the appropriate linker flags for the NI libraries
ext.addNiLibraryLinks = { linker, targetPlatform ->
String architecture = targetPlatform.architecture

View File

@@ -24,11 +24,11 @@ model {
sources {
cpp {
source {
srcDirs = ["lib/athena", "lib/athena/FRC_FPGA_ChipObject", "lib/shared"]
srcDirs = ["lib/athena", niLibraryHeadersChipObject, niLibraryHeadersRoot, "lib/shared"]
includes = ["**/*.cpp"]
}
exportedHeaders {
srcDirs = ["include", "lib/athena/FRC_FPGA_ChipObject", wpiUtilInclude]
srcDirs = ["include", niLibraryHeadersChipObject, niLibraryHeadersRoot, wpiUtilInclude]
}
}
}
@@ -70,7 +70,8 @@ task halZip(type: Zip) {
spec.headerDirs.each {
def normalizedIt = it.toString().replace('/', '\\')
def normalizedWPIUtil = wpiUtilInclude.toString().replace('/', '\\')
if (normalizedIt != normalizedWPIUtil) {
// exclude the wpiUtil library, and any NI libraries (NI libraries grabbed later)
if (normalizedIt != normalizedWPIUtil && !it.toString().contains('ni-libraries') ) {
from(it) {
into 'include'
// We don't want to include any of the .cpp files that are in some of the header directories
@@ -88,8 +89,19 @@ task halZip(type: Zip) {
}
}
// Grab the NI headers excluding the ChipObject folder
from(project.file('../ni-libraries/include')) {
exclude 'FRC_FPGA_ChipObject/'
into 'include'
}
// Grab the ChipObject headers manually and put them in the right spot
from(project.file('../ni-libraries/include/FRC_FPGA_ChipObject')) {
into 'include'
}
// Finally, include all of the shared library objects from the ni directory
from(project.file('../ni-libraries')) {
from(project.file('../ni-libraries/lib')) {
into 'lib'
exclude 'genlinks'
exclude 'libwpi.so'

View File

@@ -1,66 +0,0 @@
// CANSessionMux.h
//
// Defines the API for building a CAN Interface Plugin to support
// PWM-cable-free CAN motor control on FRC robots. This allows you
// to connect any CAN interface to the secure Jaguar CAN driver.
//
#ifndef __CANSessionMux_h__
#define __CANSessionMux_h__
#if defined(__vxworks)
#include <vxWorks.h>
#else
#include <stdint.h>
#endif
#define CAN_SEND_PERIOD_NO_REPEAT 0
#define CAN_SEND_PERIOD_STOP_REPEATING -1
/* Flags in the upper bits of the messageID */
#define CAN_IS_FRAME_REMOTE 0x80000000
#define CAN_IS_FRAME_11BIT 0x40000000
#define ERR_CANSessionMux_InvalidBuffer -44086
#define ERR_CANSessionMux_MessageNotFound -44087
#define WARN_CANSessionMux_NoToken 44087
#define ERR_CANSessionMux_NotAllowed -44088
#define ERR_CANSessionMux_NotInitialized -44089
#define ERR_CANSessionMux_SessionOverrun 44050
struct tCANStreamMessage{
uint32_t messageID;
uint32_t timeStamp;
uint8_t data[8];
uint8_t dataSize;
};
#ifdef __cplusplus
namespace nCANSessionMux
{
void sendMessage_wrapper(uint32_t messageID, const uint8_t *data, uint8_t dataSize, int32_t periodMs, int32_t *status);
void receiveMessage_wrapper(uint32_t *messageID, uint32_t messageIDMask, uint8_t *data, uint8_t *dataSize, uint32_t *timeStamp, int32_t *status);
void openStreamSession(uint32_t *sessionHandle, uint32_t messageID, uint32_t messageIDMask, uint32_t maxMessages, int32_t *status);
void closeStreamSession(uint32_t sessionHandle);
void readStreamSession(uint32_t sessionHandle, struct tCANStreamMessage *messages, uint32_t messagesToRead, uint32_t *messagesRead, int32_t *status);
void getCANStatus(float *percentBusUtilization, uint32_t *busOffCount, uint32_t *txFullCount, uint32_t *receiveErrorCount, uint32_t *transmitErrorCount, int32_t *status);
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
void FRC_NetworkCommunication_CANSessionMux_sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize, int32_t periodMs, int32_t *status);
void FRC_NetworkCommunication_CANSessionMux_receiveMessage(uint32_t *messageID, uint32_t messageIDMask, uint8_t *data, uint8_t *dataSize, uint32_t *timeStamp, int32_t *status);
void FRC_NetworkCommunication_CANSessionMux_openStreamSession(uint32_t *sessionHandle, uint32_t messageID, uint32_t messageIDMask, uint32_t maxMessages, int32_t *status);
void FRC_NetworkCommunication_CANSessionMux_closeStreamSession(uint32_t sessionHandle);
void FRC_NetworkCommunication_CANSessionMux_readStreamSession(uint32_t sessionHandle, struct tCANStreamMessage *messages, uint32_t messagesToRead, uint32_t *messagesRead, int32_t *status);
void FRC_NetworkCommunication_CANSessionMux_getCANStatus(float *percentBusUtilization, uint32_t *busOffCount, uint32_t *txFullCount, uint32_t *receiveErrorCount, uint32_t *transmitErrorCount, int32_t *status);
#ifdef __cplusplus
}
#endif
#endif // __CANSessionMux_h__

View File

@@ -1,163 +0,0 @@
/*************************************************************
* NOTICE
*
* These are the only externally exposed functions to the
* NetworkCommunication library
*
* This is an implementation of FRC Spec for Comm Protocol
* Revision 4.5, June 30, 2008
*
* Copyright (c) National Instruments 2008. All Rights Reserved.
*
*************************************************************/
#ifndef __FRC_COMM_H__
#define __FRC_COMM_H__
#ifdef WIN32
# include <vxWorks_compat.h>
#ifdef USE_THRIFT
# define EXPORT_FUNC
# else
# define EXPORT_FUNC __declspec(dllexport) __cdecl
# endif
#elif defined(__vxworks)
# include <vxWorks.h>
# define EXPORT_FUNC
#elif defined(__linux)
# include <stdint.h>
# include <pthread.h>
# define EXPORT_FUNC
#endif
#define ERR_FRCSystem_NetCommNotResponding -44049
#define ERR_FRCSystem_NoDSConnection -44018
#ifdef WIN32
# define __DEPRECATED__ __declspec(deprecated)
#else
# define __DEPRECATED__ __attribute__((__deprecated__))
#endif
enum AllianceStationID_t {
kAllianceStationID_red1,
kAllianceStationID_red2,
kAllianceStationID_red3,
kAllianceStationID_blue1,
kAllianceStationID_blue2,
kAllianceStationID_blue3,
};
enum MatchType_t {
kMatchType_none,
kMatchType_practice,
kMatchType_qualification,
kMatchType_elimination,
};
struct ControlWord_t {
#ifndef __vxworks
uint32_t enabled : 1;
uint32_t autonomous : 1;
uint32_t test :1;
uint32_t eStop : 1;
uint32_t fmsAttached:1;
uint32_t dsAttached:1;
uint32_t control_reserved : 26;
#else
uint32_t control_reserved : 26;
uint32_t dsAttached:1;
uint32_t fmsAttached:1;
uint32_t eStop : 1;
uint32_t test :1;
uint32_t autonomous : 1;
uint32_t enabled : 1;
#endif
};
struct JoystickAxes_t {
uint16_t count;
int16_t axes[1];
};
struct JoystickPOV_t {
uint16_t count;
int16_t povs[1];
};
#ifdef __cplusplus
extern "C" {
#endif
int EXPORT_FUNC FRC_NetworkCommunication_Reserve(void *instance);
#ifndef SIMULATION
void EXPORT_FUNC getFPGAHardwareVersion(uint16_t *fpgaVersion, uint32_t *fpgaRevision);
#endif
/**
* Safely copy data into the status packet to be sent back to the driver station.
* @deprecated battery is the only parameter to this function that is still used, and only on cRIO / simulation.
*/
__DEPRECATED__ int EXPORT_FUNC setStatusData(float battery, uint8_t dsDigitalOut, uint8_t updateNumber,
const char *userDataHigh, int userDataHighLength,
const char *userDataLow, int userDataLowLength, int wait_ms);
/**
* Send error data to the DS
* @deprecated This old method is hard to parse on the DS side. It will be removed soon. Use FRC_NetworkCommunication_sendError instead.
* @param errorData is a cstr of the error message
* @param errorDataLength is the length of the errorData
* @param wait_ms is ignored (included for binary compatibility)
* @return 0 on success, 1 on no DS connection
*/
__DEPRECATED__ int EXPORT_FUNC setErrorData(const char *errors, int errorsLength, int wait_ms);
/**
* Send a console output line to the Driver Station
* @param line a null-terminated string
* @return 0 on success, other on failure
*/
int EXPORT_FUNC FRC_NetworkCommunication_sendConsoleLine(const char *line);
/**
* Send an error to the Driver Station
* @param isError true if error, false if warning
* @param errorCode value of error condition
* @param isLVCode true if error code is defined in errors.txt, false if not (i.e. made up for C++)
* @param details error description that contains details such as which resource number caused the failure
* @param location Source file, function, and line number that the error was generated - optional
* @param callStack The details about what functions were called through before the error was reported - optional
* @return 0 on success, other on failure
*/
int EXPORT_FUNC FRC_NetworkCommunication_sendError(int isError, int32_t errorCode, int isLVCode,
const char *details, const char *location, const char *callStack);
#ifdef WIN32
void EXPORT_FUNC setNewDataSem(HANDLE);
#elif defined (__vxworks)
void EXPORT_FUNC setNewDataSem(SEM_ID);
#else
void EXPORT_FUNC setNewDataSem(pthread_cond_t *);
#endif
// this uint32_t is really a LVRefNum
int EXPORT_FUNC setNewDataOccurRef(uint32_t refnum);
int EXPORT_FUNC FRC_NetworkCommunication_getControlWord(struct ControlWord_t *controlWord);
int EXPORT_FUNC FRC_NetworkCommunication_getAllianceStation(enum AllianceStationID_t *allianceStation);
int EXPORT_FUNC FRC_NetworkCommunication_getMatchTime(float *matchTime);
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickAxes(uint8_t joystickNum, struct JoystickAxes_t *axes, uint8_t maxAxes);
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickButtons(uint8_t joystickNum, uint32_t *buttons, uint8_t *count);
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickPOVs(uint8_t joystickNum, struct JoystickPOV_t *povs, uint8_t maxPOVs);
int EXPORT_FUNC FRC_NetworkCommunication_setJoystickOutputs(uint8_t joystickNum, uint32_t hidOutputs, uint16_t leftRumble, uint16_t rightRumble);
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickDesc(uint8_t joystickNum, uint8_t *isXBox, uint8_t *type, char *name,
uint8_t *axisCount, uint8_t *axisTypes, uint8_t *buttonCount, uint8_t *povCount);
void EXPORT_FUNC FRC_NetworkCommunication_getVersionString(char *version);
int EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void);
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramDisabled(void);
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramAutonomous(void);
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTeleop(void);
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTest(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,58 +0,0 @@
#ifndef __LoadOut_h__
#define __LoadOut_h__
#ifdef WIN32
#include <vxWorks_compat.h>
#define EXPORT_FUNC __declspec(dllexport) __cdecl
#elif defined (__vxworks)
#include <vxWorks.h>
#define EXPORT_FUNC
#else
#include <stdint.h>
#define EXPORT_FUNC
#endif
#define kMaxModuleNumber 2
namespace nLoadOut
{
#if defined(__vxworks) || defined(SIMULATION)
typedef enum {
kModuleType_Unknown = 0x00,
kModuleType_Analog = 0x01,
kModuleType_Digital = 0x02,
kModuleType_Solenoid = 0x03,
} tModuleType;
bool EXPORT_FUNC getModulePresence(tModuleType moduleType, uint8_t moduleNumber);
#endif
typedef enum {
kTargetClass_Unknown = 0x00,
kTargetClass_FRC1 = 0x10,
kTargetClass_FRC2 = 0x20,
kTargetClass_FRC3 = 0x30,
kTargetClass_RoboRIO = 0x40,
#if defined(__vxworks) || defined(SIMULATION)
kTargetClass_FRC2_Analog = kTargetClass_FRC2 | kModuleType_Analog,
kTargetClass_FRC2_Digital = kTargetClass_FRC2 | kModuleType_Digital,
kTargetClass_FRC2_Solenoid = kTargetClass_FRC2 | kModuleType_Solenoid,
#endif
kTargetClass_FamilyMask = 0xF0,
kTargetClass_ModuleMask = 0x0F,
} tTargetClass;
tTargetClass EXPORT_FUNC getTargetClass();
}
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__vxworks) || defined(SIMULATION)
uint32_t EXPORT_FUNC FRC_NetworkCommunication_nLoadOut_getModulePresence(uint32_t moduleType, uint8_t moduleNumber);
#endif
uint32_t EXPORT_FUNC FRC_NetworkCommunication_nLoadOut_getTargetClass();
#ifdef __cplusplus
}
#endif
#endif // __LoadOut_h__

View File

@@ -1,149 +0,0 @@
#ifndef __UsageReporting_h__
#define __UsageReporting_h__
#ifdef WIN32
#include <vxWorks_compat.h>
#define EXPORT_FUNC __declspec(dllexport) __cdecl
#elif defined (__vxworks)
#include <vxWorks.h>
#define EXPORT_FUNC
#else
#include <stdint.h>
#include <stdlib.h>
#define EXPORT_FUNC
#endif
#define kUsageReporting_version 1
namespace nUsageReporting
{
typedef enum
{
kResourceType_Controller,
kResourceType_Module,
kResourceType_Language,
kResourceType_CANPlugin,
kResourceType_Accelerometer,
kResourceType_ADXL345,
kResourceType_AnalogChannel,
kResourceType_AnalogTrigger,
kResourceType_AnalogTriggerOutput,
kResourceType_CANJaguar,
kResourceType_Compressor,
kResourceType_Counter,
kResourceType_Dashboard,
kResourceType_DigitalInput,
kResourceType_DigitalOutput,
kResourceType_DriverStationCIO,
kResourceType_DriverStationEIO,
kResourceType_DriverStationLCD,
kResourceType_Encoder,
kResourceType_GearTooth,
kResourceType_Gyro,
kResourceType_I2C,
kResourceType_Framework,
kResourceType_Jaguar,
kResourceType_Joystick,
kResourceType_Kinect,
kResourceType_KinectStick,
kResourceType_PIDController,
kResourceType_Preferences,
kResourceType_PWM,
kResourceType_Relay,
kResourceType_RobotDrive,
kResourceType_SerialPort,
kResourceType_Servo,
kResourceType_Solenoid,
kResourceType_SPI,
kResourceType_Task,
kResourceType_Ultrasonic,
kResourceType_Victor,
kResourceType_Button,
kResourceType_Command,
kResourceType_AxisCamera,
kResourceType_PCVideoServer,
kResourceType_SmartDashboard,
kResourceType_Talon,
kResourceType_HiTechnicColorSensor,
kResourceType_HiTechnicAccel,
kResourceType_HiTechnicCompass,
kResourceType_SRF08,
kResourceType_AnalogOutput,
kResourceType_VictorSP,
kResourceType_TalonSRX,
kResourceType_CANTalonSRX,
kResourceType_ADXL362,
kResourceType_ADXRS450,
kResourceType_RevSPARK,
kResourceType_MindsensorsSD540,
kResourceType_DigitalFilter,
} tResourceType;
typedef enum
{
kLanguage_LabVIEW = 1,
kLanguage_CPlusPlus = 2,
kLanguage_Java = 3,
kLanguage_Python = 4,
kCANPlugin_BlackJagBridge = 1,
kCANPlugin_2CAN = 2,
kFramework_Iterative = 1,
kFramework_Simple = 2,
kFramework_CommandControl = 3,
kRobotDrive_ArcadeStandard = 1,
kRobotDrive_ArcadeButtonSpin = 2,
kRobotDrive_ArcadeRatioCurve = 3,
kRobotDrive_Tank = 4,
kRobotDrive_MecanumPolar = 5,
kRobotDrive_MecanumCartesian = 6,
kDriverStationCIO_Analog = 1,
kDriverStationCIO_DigitalIn = 2,
kDriverStationCIO_DigitalOut = 3,
kDriverStationEIO_Acceleration = 1,
kDriverStationEIO_AnalogIn = 2,
kDriverStationEIO_AnalogOut = 3,
kDriverStationEIO_Button = 4,
kDriverStationEIO_LED = 5,
kDriverStationEIO_DigitalIn = 6,
kDriverStationEIO_DigitalOut = 7,
kDriverStationEIO_FixedDigitalOut = 8,
kDriverStationEIO_PWM = 9,
kDriverStationEIO_Encoder = 10,
kDriverStationEIO_TouchSlider = 11,
kADXL345_SPI = 1,
kADXL345_I2C = 2,
kCommand_Scheduler = 1,
kSmartDashboard_Instance = 1,
} tInstances;
/**
* Report the usage of a resource of interest.
*
* @param resource one of the values in the tResourceType above (max value 51).
* @param instanceNumber an index that identifies the resource instance.
* @param context an optional additional context number for some cases (such as module number). Set to 0 to omit.
* @param feature a string to be included describing features in use on a specific resource. Setting the same resource more than once allows you to change the feature string.
*/
uint32_t EXPORT_FUNC report(tResourceType resource, uint8_t instanceNumber, uint8_t context = 0, const char *feature = NULL);
}
#ifdef __cplusplus
extern "C" {
#endif
uint32_t EXPORT_FUNC FRC_NetworkCommunication_nUsageReporting_report(uint8_t resource, uint8_t instanceNumber, uint8_t context, const char *feature);
#ifdef __cplusplus
}
#endif
#endif // __UsageReporting_h__

View File

@@ -13,7 +13,7 @@
#include <cstdio>
#include <memory>
#include "ChipObject.h"
#include "HAL/ChipObject.h"
#include "HAL/HAL.h"
using namespace hal;

View File

@@ -9,8 +9,8 @@
#include <atomic>
#include "ChipObject.h"
#include "HAL/AnalogInput.h"
#include "HAL/ChipObject.h"
#include "HAL/cpp/priority_mutex.h"
#include "PortsInternal.h"

View File

@@ -11,7 +11,7 @@
#include <memory>
#include "ChipObject.h"
#include "HAL/ChipObject.h"
#include "HAL/Ports.h"
#include "HAL/cpp/priority_mutex.h"
#include "HAL/handles/IndexedHandleResource.h"

View File

@@ -11,10 +11,10 @@
#include <mutex>
#include <thread>
#include "ChipObject.h"
#include "ConstantsInternal.h"
#include "FRC_NetworkCommunication/LoadOut.h"
#include "HAL/AnalogTrigger.h"
#include "HAL/ChipObject.h"
#include "HAL/HAL.h"
#include "HAL/Ports.h"
#include "HAL/cpp/priority_mutex.h"

View File

@@ -11,8 +11,8 @@
#include <memory>
#include "ChipObject.h"
#include "HAL/AnalogTrigger.h"
#include "HAL/ChipObject.h"
#include "HAL/Ports.h"
#include "HAL/Types.h"
#include "HAL/handles/DigitalHandleResource.h"

View File

@@ -7,9 +7,9 @@
#include "HAL/Encoder.h"
#include "ChipObject.h"
#include "EncoderInternal.h"
#include "FPGAEncoder.h"
#include "HAL/ChipObject.h"
#include "HAL/Counter.h"
#include "HAL/Errors.h"
#include "HAL/handles/LimitedClassedHandleResource.h"

View File

@@ -17,10 +17,10 @@
#include <mutex>
#include <thread>
#include "ChipObject.h"
#include "FRC_NetworkCommunication/CANSessionMux.h"
#include "FRC_NetworkCommunication/FRCComm.h"
#include "FRC_NetworkCommunication/LoadOut.h"
#include "HAL/ChipObject.h"
#include "HAL/Errors.h"
#include "HAL/cpp/priority_mutex.h"
#include "HAL/handles/HandlesInternal.h"

View File

@@ -9,8 +9,8 @@
#include <memory>
#include "ChipObject.h"
#include "DigitalInternal.h"
#include "HAL/ChipObject.h"
#include "HAL/Errors.h"
#include "HAL/cpp/make_unique.h"
#include "HAL/handles/HandlesInternal.h"

View File

@@ -14,7 +14,7 @@
#include <memory>
#include <mutex>
#include "ChipObject.h"
#include "HAL/ChipObject.h"
#include "HAL/HAL.h"
#include "HAL/cpp/make_unique.h"
#include "HAL/cpp/priority_mutex.h"

View File

@@ -9,7 +9,7 @@
#include <stdint.h>
#include "ChipObject.h"
#include "HAL/ChipObject.h"
namespace hal {
constexpr int32_t kNumAccumulators = tAccumulator::kNumSystems;

View File

@@ -9,7 +9,7 @@
#include <memory>
#include "ChipObject.h"
#include "HAL/ChipObject.h"
using namespace hal;

View File

@@ -7,8 +7,8 @@
#include "HAL/Solenoid.h"
#include "ChipObject.h"
#include "FRC_NetworkCommunication/LoadOut.h"
#include "HAL/ChipObject.h"
#include "HAL/Errors.h"
#include "HAL/Ports.h"
#include "HAL/handles/HandlesInternal.h"

Some files were not shown because too many files have changed in this diff Show More