Files
allwpilib/wpilibc/Athena/include/NetworkCommunication/CANSessionMux.h
Fredric Silberberg 6d854afb0e WPILib Reorganization
This is a major restructuring of the WPILib repository to simply build
procedures and remove the remnants of Maven from everything except the
eclipse plugins. Gradle files have been largely simplified or rewritten,
taking advantage of splitting up parts of the build into separate build
files for ease of reading.

The eclipse plugins are now in a separate project, as is ntcore. All
dependencies are resolved via Maven dependencies, with the
Jenkins-maintained WPILib repo. Project structures have also been
simplified: we no longer have separate subprojects inside wpilibc and
wpilibj. Where possible, these changes hav been done with git renames,
to make sure we still have full history for all repositories. Other
unrelated subprojects have also been broken out: OutlineViewer is now a
separate project.

Change-Id: Ib4e2a6e1a2f66427a14f16612b0e0d69ed661878
2015-11-21 18:26:49 -05:00

82 lines
3.2 KiB
C++

// 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__
#include <stdint.h>
#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;
};
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);
}
#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__