mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
New netcomms .so and headers.
CAN isn't fully working yet, but this change is necessary to compile for the v9 image. Change-Id: Ife99686a7e7a9979c95ec7a395d597011090fa37
This commit is contained in:
@@ -11,7 +11,9 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#define CAN_IS_FRAME_REMOTE 0x80000000
|
||||
#define CAN_MESSAGE_ID_MASK 0x1FFFFFFF
|
||||
#define CAN_IS_FRAME_11BIT 0x40000000
|
||||
#define CAN_29BIT_MESSAGE_ID_MASK 0x1FFFFFFF
|
||||
#define CAN_11BIT_MESSAGE_ID_MASK 0x000007FF
|
||||
|
||||
class CANInterfacePlugin
|
||||
{
|
||||
@@ -56,6 +58,6 @@ public:
|
||||
* @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_JaguarCANDriver_registerInterface(CANInterfacePlugin* interface);
|
||||
void FRC_NetworkCommunication_CANSessionMux_registerInterface(CANInterfacePlugin* interface);
|
||||
|
||||
#endif // __CANInterfacePlugin_h__
|
||||
|
||||
61
hal/lib/Athena/NetworkCommunication/CANSessionMux.h
Normal file
61
hal/lib/Athena/NetworkCommunication/CANSessionMux.h
Normal file
@@ -0,0 +1,61 @@
|
||||
// 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
|
||||
|
||||
struct tCANStreamMessage{
|
||||
uint32_t messageID;
|
||||
uint32_t timeStamp;
|
||||
uint8_t data[8];
|
||||
uint8_t dataSize;
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __CANSessionMux_h__
|
||||
@@ -1,56 +0,0 @@
|
||||
// JaguarCANDriver.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 __JaguarCANDriver_h__
|
||||
#define __JaguarCANDriver_h__
|
||||
|
||||
#if defined(__vxworks)
|
||||
#include <vxWorks.h>
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#ifdef USE_THRIFT
|
||||
#include "NetCommRPCComm.h"
|
||||
#include <vector>
|
||||
#endif
|
||||
namespace nJaguarCANDriver
|
||||
{
|
||||
void sendMessage_wrapper(uint32_t messageID, const uint8_t *data, uint8_t dataSize, int32_t *status);
|
||||
void receiveMessage_wrapper(uint32_t *messageID, uint8_t *data, uint8_t *dataSize, uint32_t timeoutMs, int32_t *status);
|
||||
int32_t receiveMessageStart_wrapper(uint32_t messageID, uint32_t occurRefNum, uint32_t timeoutMs, int32_t *status);
|
||||
#if defined (__vxworks)
|
||||
int32_t receiveMessageStart_sem_wrapper(uint32_t messageID, uint32_t semaphoreID, uint32_t timeoutMs, int32_t *status);
|
||||
#else
|
||||
int32_t receiveMessageStart_mutex_wrapper(uint32_t messageID, pthread_mutex_t *mutex, uint32_t timeoutMs, int32_t *status);
|
||||
#endif
|
||||
void receiveMessageComplete_wrapper(uint32_t *messageID, uint8_t *data, uint8_t *dataSize, int32_t *status);
|
||||
#ifdef USE_THRIFT
|
||||
void checkEvent_CAN(std::vector< CANEvent >& events);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void FRC_NetworkCommunication_JaguarCANDriver_sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize, int32_t *status);
|
||||
void FRC_NetworkCommunication_JaguarCANDriver_receiveMessage(uint32_t *messageID, uint8_t *data, uint8_t *dataSize, uint32_t timeoutMs, int32_t *status);
|
||||
int32_t FRC_NetworkCommunication_JaguarCANDriver_receiveMessageStart(uint32_t messageID, uint32_t occurRefNum, uint32_t timeoutMs, int32_t *status);
|
||||
#if defined (__vxworks)
|
||||
int32_t FRC_NetworkCommunication_JaguarCANDriver_receiveMessageStart_sem(uint32_t messageID, uint32_t semaphoreID, uint32_t timeoutMs, int32_t *status);
|
||||
#else
|
||||
int32_t FRC_NetworkCommunication_JaguarCANDriver_receiveMessageStart_mutex(uint32_t messageID, pthread_mutex_t *mutex, uint32_t timeoutMs, int32_t *status);
|
||||
#endif
|
||||
void FRC_NetworkCommunication_JaguarCANDriver_receiveMessageComplete(uint32_t *messageID, uint8_t *data, uint8_t *dataSize, int32_t *status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __JaguarCANDriver_h__
|
||||
Reference in New Issue
Block a user