Moves HAL cpp headers from root to HAL directory (#174)

Could not include the ctre and NetComm folders, as those would require
changing ctre dependancies. Also removes a duplicated FRCComm header
that was not needed.
This commit is contained in:
Thad House
2016-07-14 00:17:29 -07:00
committed by Peter Johnson
parent 20c6525b1d
commit dffaa0abb9
27 changed files with 124 additions and 235 deletions

View File

@@ -20,7 +20,7 @@ model {
includes = ["**/*.cpp"]
}
exportedHeaders {
srcDirs = ["include", "lib/athena", "lib/athena/FRC_FPGA_ChipObject", "lib/shared"]
srcDirs = ["include", "lib/athena/FRC_FPGA_ChipObject"]
}
}
}

View File

@@ -1,19 +1,19 @@
#ifndef __AICalibration_h__
#define __AICalibration_h__
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
uint32_t FRC_NetworkCommunication_nAICalibration_getLSBWeight(const uint32_t aiSystemIndex, const uint32_t channel, int32_t *status);
int32_t FRC_NetworkCommunication_nAICalibration_getOffset(const uint32_t aiSystemIndex, const uint32_t channel, int32_t *status);
#ifdef __cplusplus
}
#endif
#endif // __AICalibration_h__
#ifndef __AICalibration_h__
#define __AICalibration_h__
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
uint32_t FRC_NetworkCommunication_nAICalibration_getLSBWeight(const uint32_t aiSystemIndex, const uint32_t channel, int32_t *status);
int32_t FRC_NetworkCommunication_nAICalibration_getOffset(const uint32_t aiSystemIndex, const uint32_t channel, int32_t *status);
#ifdef __cplusplus
}
#endif
#endif // __AICalibration_h__

View File

@@ -1,82 +1,82 @@
// CANInterfacePlugin.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 __CANInterfacePlugin_h__
#define __CANInterfacePlugin_h__
#include <stdint.h>
#define CAN_IS_FRAME_REMOTE 0x80000000
#define CAN_IS_FRAME_11BIT 0x40000000
#define CAN_29BIT_MESSAGE_ID_MASK 0x1FFFFFFF
#define CAN_11BIT_MESSAGE_ID_MASK 0x000007FF
class CANInterfacePlugin
{
public:
CANInterfacePlugin() {}
virtual ~CANInterfacePlugin() {}
/**
* This entry-point of the CANInterfacePlugin is passed a message that the driver needs to send to
* a device on the CAN bus.
*
* This function may be called from multiple contexts and must therefore be reentrant.
*
* @param messageID The 29-bit CAN message ID in the lsbs. The msb can indicate a remote frame.
* @param data A pointer to a buffer containing between 0 and 8 bytes to send with the message. May be NULL if dataSize is 0.
* @param dataSize The number of bytes to send with the message.
* @return Return any error code. On success return 0.
*/
virtual int32_t sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize) = 0;
/**
* This entry-point of the CANInterfacePlugin is passed buffers which should be populated with
* any received messages from devices on the CAN bus.
*
* This function is always called by a single task in the Jaguar driver, so it need not be reentrant.
*
* This function is expected to block for some period of time waiting for a message from the CAN bus.
* It may timeout periodically (returning non-zero to indicate no message was populated) to allow for
* shutdown and unloading of the plugin.
*
* @param messageID A reference to be populated with a received 29-bit CAN message ID in the lsbs.
* @param data A pointer to a buffer of 8 bytes to be populated with data received with the message.
* @param dataSize A reference to be populated with the size of the data received (0 - 8 bytes).
* @return This should return 0 if a message was populated, non-0 if no message was not populated.
*/
virtual int32_t receiveMessage(uint32_t &messageID, uint8_t *data, uint8_t &dataSize) = 0;
#if defined(__linux)
/**
* This entry-point of the CANInterfacePlugin returns status of the CAN bus.
*
* This function may be called from multiple contexts and must therefore be reentrant.
*
* This function will return detailed hardware status if available for diagnostics of the CAN interface.
*
* @param busOffCount The number of times that sendMessage failed with a busOff error indicating that messages
* are not successfully transmitted on the bus.
* @param txFullCount The number of times that sendMessage failed with a txFifoFull error indicating that messages
* are not successfully received by any CAN device.
* @param receiveErrorCount The count of receive errors as reported by the CAN driver.
* @param transmitErrorCount The count of transmit errors as reported by the CAN driver.
* @return This should return 0 if all status was retrieved successfully or an error code if not.
*/
virtual int32_t getStatus(uint32_t &busOffCount, uint32_t &txFullCount, uint32_t &receiveErrorCount, uint32_t &transmitErrorCount) {return 0;}
#endif
};
/**
* This function allows you to register a CANInterfacePlugin to provide access a CAN bus.
*
* @param interface A pointer to an object that inherits from CANInterfacePlugin and implements
* the pure virtual interface. If NULL, unregister the current plugin.
*/
void FRC_NetworkCommunication_CANSessionMux_registerInterface(CANInterfacePlugin* interface);
#endif // __CANInterfacePlugin_h__
// CANInterfacePlugin.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 __CANInterfacePlugin_h__
#define __CANInterfacePlugin_h__
#include <stdint.h>
#define CAN_IS_FRAME_REMOTE 0x80000000
#define CAN_IS_FRAME_11BIT 0x40000000
#define CAN_29BIT_MESSAGE_ID_MASK 0x1FFFFFFF
#define CAN_11BIT_MESSAGE_ID_MASK 0x000007FF
class CANInterfacePlugin
{
public:
CANInterfacePlugin() {}
virtual ~CANInterfacePlugin() {}
/**
* This entry-point of the CANInterfacePlugin is passed a message that the driver needs to send to
* a device on the CAN bus.
*
* This function may be called from multiple contexts and must therefore be reentrant.
*
* @param messageID The 29-bit CAN message ID in the lsbs. The msb can indicate a remote frame.
* @param data A pointer to a buffer containing between 0 and 8 bytes to send with the message. May be NULL if dataSize is 0.
* @param dataSize The number of bytes to send with the message.
* @return Return any error code. On success return 0.
*/
virtual int32_t sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize) = 0;
/**
* This entry-point of the CANInterfacePlugin is passed buffers which should be populated with
* any received messages from devices on the CAN bus.
*
* This function is always called by a single task in the Jaguar driver, so it need not be reentrant.
*
* This function is expected to block for some period of time waiting for a message from the CAN bus.
* It may timeout periodically (returning non-zero to indicate no message was populated) to allow for
* shutdown and unloading of the plugin.
*
* @param messageID A reference to be populated with a received 29-bit CAN message ID in the lsbs.
* @param data A pointer to a buffer of 8 bytes to be populated with data received with the message.
* @param dataSize A reference to be populated with the size of the data received (0 - 8 bytes).
* @return This should return 0 if a message was populated, non-0 if no message was not populated.
*/
virtual int32_t receiveMessage(uint32_t &messageID, uint8_t *data, uint8_t &dataSize) = 0;
#if defined(__linux)
/**
* This entry-point of the CANInterfacePlugin returns status of the CAN bus.
*
* This function may be called from multiple contexts and must therefore be reentrant.
*
* This function will return detailed hardware status if available for diagnostics of the CAN interface.
*
* @param busOffCount The number of times that sendMessage failed with a busOff error indicating that messages
* are not successfully transmitted on the bus.
* @param txFullCount The number of times that sendMessage failed with a txFifoFull error indicating that messages
* are not successfully received by any CAN device.
* @param receiveErrorCount The count of receive errors as reported by the CAN driver.
* @param transmitErrorCount The count of transmit errors as reported by the CAN driver.
* @return This should return 0 if all status was retrieved successfully or an error code if not.
*/
virtual int32_t getStatus(uint32_t &busOffCount, uint32_t &txFullCount, uint32_t &receiveErrorCount, uint32_t &transmitErrorCount) {return 0;}
#endif
};
/**
* This function allows you to register a CANInterfacePlugin to provide access a CAN bus.
*
* @param interface A pointer to an object that inherits from CANInterfacePlugin and implements
* the pure virtual interface. If NULL, unregister the current plugin.
*/
void FRC_NetworkCommunication_CANSessionMux_registerInterface(CANInterfacePlugin* interface);
#endif // __CANInterfacePlugin_h__

View File

@@ -1,111 +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.
*
*************************************************************/
//This file must compile on ALL PLATFORMS. Be very careful what you put in here.
#ifndef __FRC_COMM_H__
#define __FRC_COMM_H__
#ifdef _WIN32
#ifdef USE_THRIFT
#define EXPORT_FUNC
#else
#define EXPORT_FUNC __declspec(dllexport) __cdecl
#endif
#else
#include <stdint.h>
#include <pthread.h>
#define EXPORT_FUNC
#endif
#define ERR_FRCSystem_NetCommNotResponding -44049
#define ERR_FRCSystem_NoDSConnection -44018
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 {
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;
};
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
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);
int EXPORT_FUNC setErrorData(const char *errors, int errorsLength, int wait_ms);
#ifdef SIMULATION
void EXPORT_FUNC setNewDataSem(HANDLE);
#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

@@ -9,7 +9,7 @@
#include <string.h>
#include "AnalogInput.h"
#include "FRC_NetworkCommunication/FRCComm.h"
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "MotorSafetyHelper.h"
#include "Timer.h"
#include "Utility.h"

View File

@@ -11,7 +11,7 @@
#include <boost/mem_fn.hpp>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "Timer.h"
#include "Utility.h"
#include "WPIErrors.h"

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_AnalogGyroJNI.h"

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_AnalogJNI.h"

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_can_CANJNI.h"

View File

@@ -7,7 +7,7 @@
#include "HAL/HAL.h"
#include "HALUtil.h"
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_CompressorJNI.h"
extern "C" {

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_ConstantsJNI.h"

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_CounterJNI.h"

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_DIOJNI.h"

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_EncoderJNI.h"

View File

@@ -9,7 +9,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "HAL/HAL.h"
#include "edu_wpi_first_wpilibj_hal_HAL.h"

View File

@@ -16,7 +16,7 @@
#include "FRC_NetworkCommunication/CANSessionMux.h"
#include "HAL/HAL.h"
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_HALUtil.h"
// set the logging level

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_I2CJNI.h"

View File

@@ -11,7 +11,7 @@
#include <condition_variable>
#include <mutex>
#include <thread>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "HAL/Interrupts.h"
#include "HALUtil.h"

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_JNIWrapper.h"

View File

@@ -15,7 +15,7 @@
#include <mutex>
#include <thread>
#include "HALUtil.h"
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "SafeThread.h"
#include "edu_wpi_first_wpilibj_hal_NotifierJNI.h"

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_PWMJNI.h"

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_PortsJNI.h"

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_RelayJNI.h"

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_SPIJNI.h"

View File

@@ -7,7 +7,7 @@
#include <assert.h>
#include <jni.h>
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_SerialPortJNI.h"

View File

@@ -8,7 +8,7 @@
#include <jni.h>
#include "HAL/HAL.h"
#include "HAL/handles/HandlesInternal.h"
#include "Log.h"
#include "HAL/cpp/Log.h"
#include "edu_wpi_first_wpilibj_hal_SolenoidJNI.h"