Files
allwpilib/hal/lib/Athena/FRC_FPGA_ChipObject/tInterruptManager.h
Thomas Clark 8abbcf53f4 Update to the v13 headers and libraries
Add all of the most recent headers and .SOs

Also make DriverStation work with the new FRC comm protocol, using the new
functions for getting status data

Change-Id: I1c7fc5f90e72c5fbebf87d9923ce0967ed0ef3bc

Initial HAL support for v13 ds

Change-Id: I9a7f37ef8e24241598fa3981cb3df30c07c52e0f

New ds stuff in the HAL

Change-Id: I025910625453baf63f79f49bbc70ba8b2f093f50

New ds stuff in C++

Joysticks are still todo

Driver station IO is pulled out

Change-Id: I1bb59037c097713bd943e7bef00e12f67f13c3ac

New ds works in C++ and Java.  Joysticks still todo

Change-Id: Ic93f8686856761badc592eceaf05964f52355578

Make joysticks work again with the v13 image protocol

Change-Id: Ief7ee95d3398c2262ca07ab7d60499af3c8f60f7
2014-08-07 16:37:02 -04:00

62 lines
1.5 KiB
C++

// Class for handling interrupts.
// Copyright (c) National Instruments 2008. All Rights Reserved.
#ifndef __tInterruptManager_h__
#define __tInterruptManager_h__
#include "tSystem.h"
namespace ni
{
namespace dsc
{
namespace osdep
{
class CriticalSection;
}
}
}
namespace nFPGA
{
typedef void (*tInterruptHandler)(uint32_t interruptAssertedMask, void *param);
class tInterruptManager : public tSystem
{
public:
tInterruptManager(uint32_t interruptMask, bool watcher, tRioStatusCode *status);
~tInterruptManager();
void registerHandler(tInterruptHandler handler, void *param, tRioStatusCode *status);
uint32_t watch(int32_t timeoutInMs, tRioStatusCode *status);
void enable(tRioStatusCode *status);
void disable(tRioStatusCode *status);
bool isEnabled(tRioStatusCode *status);
private:
class tInterruptThread;
friend class tInterruptThread;
void handler();
static int handlerWrapper(tInterruptManager *pInterrupt);
void acknowledge(tRioStatusCode *status);
void reserve(tRioStatusCode *status);
void unreserve(tRioStatusCode *status);
tInterruptHandler _handler;
uint32_t _interruptMask;
tInterruptThread *_thread;
NiFpga_IrqContext _rioContext;
bool _watcher;
bool _enabled;
void *_userParam;
// maintain the interrupts that are already dealt with.
static uint32_t _globalInterruptMask;
static ni::dsc::osdep::CriticalSection *_globalInterruptMaskSemaphore;
};
}
#endif // __tInterruptManager_h__