blob: c8f9b59a0b3d2df63fbb56216e01abeb5aa0fd49 [file] [log] [blame]
jerrymf1579332013-02-07 01:56:28 +00001/*---------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2008. All Rights Reserved. */
3/* Open Source Software - may be modified and shared by FRC teams. The code */
4/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
5/*---------------------------------------------------------------------------*/
6
7#ifndef UTILITY_H_
8#define UTILITY_H_
9
10#include <taskLib.h>
11
12#define wpi_assert(condition) wpi_assert_impl(condition, #condition, NULL, __FILE__, __LINE__, __FUNCTION__)
13#define wpi_assertWithMessage(condition, message) wpi_assert_impl(condition, #condition, message, __FILE__, __LINE__, __FUNCTION__)
14
15#define wpi_assertEqual(a, b) wpi_assertEqual_impl(a, b, NULL, __FILE__, __LINE__, __FUNCTION__)
16#define wpi_assertEqualWithMessage(a, b, message) wpi_assertEqual_impl(a, b, message, __FILE__, __LINE__, __FUNCTION__)
17
18#define wpi_assertNotEqual(a, b) wpi_assertNotEqual_impl(a, b, NULL, __FILE__, __LINE__, __FUNCTION__)
19#define wpi_assertNotEqualWithMessage(a, b, message) wpi_assertNotEqual_impl(a, b, message, __FILE__, __LINE__, __FUNCTION__)
20
21bool wpi_assert_impl(bool conditionValue, const char *conditionText, const char *message, const char *fileName, UINT32 lineNumber, const char *funcName);
22bool wpi_assertEqual_impl(int valueA, int valueB, const char *message, const char *fileName,UINT32 lineNumber, const char *funcName);
23bool wpi_assertNotEqual_impl(int valueA, int valueB, const char *message, const char *fileName,UINT32 lineNumber, const char *funcName);
24
25char *wpi_getLabel(UINT addr, INT32 *found = NULL);
26void wpi_selfTrace();
27void wpi_suspendOnAssertEnabled(bool enabled);
28void wpi_stackTraceOnAssertEnable(bool enabled);
29
30UINT16 GetFPGAVersion();
31UINT32 GetFPGARevision();
32UINT32 GetFPGATime();
33INT32 GetRIOUserSwitch();
34void SetRIOUserLED(UINT32 state);
35INT32 GetRIOUserLED();
36INT32 ToggleRIOUserLED();
37void SetRIO_FPGA_LED(UINT32 state);
38INT32 GetRIO_FPGA_LED();
39INT32 ToggleRIO_FPGA_LED();
40
41#endif // UTILITY_H_