1
0
mirror of https://github.com/preble/libpinproc synced 2026-02-24 18:25:23 +01:00

More tweaks for MSVC support, and eliminated deprecated conversion warnings from pinprocfw.cpp.

This commit is contained in:
Gerry Stellenberg
2011-01-16 18:06:29 -06:00
parent f198a341f8
commit a7130131f3
5 changed files with 475 additions and 395 deletions

View File

@@ -1,14 +1,17 @@
###
### CMake settings
###
## Due to Mac OSX we need to keep compatibility with CMake 2.6
# see http://www.cmake.org/Wiki/CMake_Policies
cmake_minimum_required(VERSION 2.6)
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0012
if(POLICY CMP0012)
cmake_policy(SET CMP0012 OLD)
endif()
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0015
if(POLICY CMP0015)
cmake_policy(SET CMP0015 NEW)
cmake_policy(SET CMP0015 OLD)
endif()
#
INCLUDE(CMakeDependentOption)
###
@@ -24,33 +27,46 @@ set(PINPROC_VERSION "${PINPROC_VERSION_MAJOR}.${PINPROC_VERSION_MINOR}")
###
### Project options
###
# General stuff
## Project stuff
option(PINPROC_BUILD_TOOLS "Enable testing and firmware tools" ON)
# Compilation options
## Build options
# --> General
# see http://www.cmake.org/cmake/help/cmake2.6docs.html#variable:BUILD_SHARED_LIBS
# http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_library
option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
# --> Apple
option(APPLE_UNIVERSAL_BIN "Apple: Build universal binary" OFF)
# --> Microsoft Visual C++
# see http://msdn.microsoft.com/en-us/library/aa278396(v=VS.60).aspx
# http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=VS.71).aspx
option(MSVC_SHARED_RT "MSVC: Build with shared runtime libs (/MD)" ON)
CMAKE_DEPENDENT_OPTION(MSVC_STHREADED_RT "MSVC: Build with single-threaded static runtime libs (/ML until VS .NET 2003)" OFF
"NOT MSVC_SHARED_RT" OFF)
option(MSVC_STHREADED_RT "MSVC: Build with single-threaded static runtime libs (/ML until VS .NET 2003)" OFF)
###
### Sources, headers, directories and libs
###
# !!! file(GLOB) didn't work on Ubuntu 10.04 with cmake 2.8 !!!
#file(GLOB sources src/[a-z]*.cpp)
#file(GLOB public_headers include/[a-z]*.h)
#file(GLOB private_headers src/[a-z]*.h)
#message(STATUS "sources: ${sources}")
#message(STATUS "public_headers: ${public_headers}")
#message(STATUS "private_headers: ${private_headers}")
set(sources "src/pinproc.cpp;src/PRDevice.cpp;src/PRHardware.cpp")
set(public_headers "include/pinproc.h")
set(private_headers "src/PRCommon.h;src/PRDevice.h;src/PRHardware.h")
file(GLOB sources "src/[a-zA-Z]*.cpp")
file(GLOB public_headers "include/[a-zA-Z]*.h")
file(GLOB private_headers "src/[a-zA-Z]*.h")
if(WIN32)
if(BUILD_SHARED_LIBS)
set(defs
src/pinproc.def
)
endif()
endif()
if(VERBOSE)
message(STATUS "sources: ${sources}")
message(STATUS "public_headers: ${public_headers}")
message(STATUS "private_headers: ${private_headers}")
message(STATUS "defs: ${defs}")
endif()
# use -DEXTRA_INC="<path>;<path>" and -DEXTRA_LINK="<path>;<path>"
include_directories(${PINPROC_SOURCE_DIR}/include ${EXTRA_INC} /usr/local/include)
@@ -70,7 +86,9 @@ else()
endif()
if(APPLE)
# set(CMAKE_OSX_ARCHITECTURES ppc;i386) # Uncomment for universal binary
if(APPLE_UNIVERSAL_BIN)
set(CMAKE_OSX_ARCHITECTURES ppc;i386)
endif()
endif()
if(WIN32)
@@ -78,15 +96,19 @@ if(WIN32)
if(BUILD_SHARED_LIBS)
add_definitions(-D${PROJECT_NAME}_DLL) # use or build Windows DLL
endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "C:/")
endif()
else()
set(lib_ftdi_usb usb ftdi)
endif()
# GCC / MINGW specialities
# GCC specialities
if(CMAKE_COMPILER_IS_GNUCC)
if(WIN32)
set(CMAKE_SHARED_LIBRARY_PREFIX "") # DLLs do not have a "lib" prefix
set(CMAKE_IMPORT_LIBRARY_PREFIX "") # same for DLL import libs
set(CMAKE_LINK_DEF_FILE_FLAG "") # CMake workaround (2.8.3)
endif()
endif()
@@ -104,7 +126,7 @@ if(MSVC)
if(MSVC_STHREADED_RT) # User wants to have old single-threaded static runtime libraries
set(LIB_RT_SUFFIX "ml")
set(LIB_RT_OPTION "/ML")
if(NOT MSVC_VERSION LESS 1400)
if(NOT ${MSVC_VERSION} LESS 1400)
message(FATAL_ERROR "Single-threaded static runtime libraries (/ML) only available until VS .NET 2003 (7.1).")
endif()
else()
@@ -116,7 +138,7 @@ if(MSVC)
foreach(flag_var CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
foreach(config_name "" DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
set(var_name "${flag_var}")
if(config_name)
if(NOT "${config_name}" STREQUAL "")
set(var_name "${var_name}_${config_name}")
endif()
string(REPLACE "/MD" "${LIB_RT_OPTION}" ${var_name} "${${var_name}}")
@@ -168,6 +190,7 @@ add_library(pinproc
${sources}
${public_headers}
${private_headers}
${defs}
)
set_target_properties(pinproc PROPERTIES
@@ -210,7 +233,8 @@ endif()
###
if(PINPROC_BUILD_TOOLS)
# Create a target for the test tool
#TODO: use add_subdirectory() and separate CMakeLists.txt (see yaml-cpp)
#TODO: use add_subdirectory() and separate CMakeLists.txt (like yaml-cpp)
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_subdirectory
add_executable(pinproctest
examples/pinproctest/pinproctest.cpp
examples/pinproctest/drivers.cpp
@@ -225,7 +249,8 @@ target_link_libraries(pinproctest
)
# Create a target for the firmware tool
#TODO: use add_subdirectory() and separate CMakeLists.txt (see yaml-cpp)
#TODO: use add_subdirectory() and separate CMakeLists.txt (like yaml-cpp)
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_subdirectory
add_executable(pinprocfw
utils/pinprocfw/pinprocfw.cpp
utils/pinprocfw/lenval.cpp

View File

@@ -42,32 +42,35 @@
#include <stdint.h>
/** @cond */
#if defined(__WIN32__) || defined(_WIN32)
#undef PR_EXPORT
#if defined(PR_BUILDING_PR)
#define PR_EXPORT __declspec(dllexport) extern
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the pinproc_EXPORTS
// symbol defined on the command line. This symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// PINPROC_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#undef PINPROC_API
#ifdef PINPROC_DLL // Using or Building PinPROC DLL (definition defined manually)
#ifdef pinproc_EXPORTS // Building PinPROC DLL (definition created by CMake or defined manually)
#define PINPROC_API __declspec(dllexport)
#else
// TODO: Decide what to do here:
//#define PR_EXPORT __declspec(dllimport) extern
#define PR_EXPORT
#define PINPROC_API __declspec(dllimport)
#endif
#endif
#if !defined(PR_EXPORT)
#define PR_EXPORT extern
// fallback for non-DLL usage and builds
#ifndef PINPROC_API
#define PINPROC_API
#endif
#if !defined(PR_EXTERN_C_BEGIN)
#if defined(__cplusplus)
#define PR_EXTERN_C_BEGIN extern "C" {
#define PR_EXTERN_C_END }
#else
#define PR_EXTERN_C_BEGIN
#define PR_EXTERN_C_END
#endif
#if defined(__cplusplus)
#define PINPROC_EXTERN_C_BEGIN extern "C" {
#define PINPROC_EXTERN_C_END }
#else
#define PINPROC_EXTERN_C_BEGIN
#define PINPROC_EXTERN_C_END
#endif
PR_EXTERN_C_BEGIN
PINPROC_EXTERN_C_BEGIN
/** @endcond */
// Types
@@ -89,11 +92,11 @@ typedef enum PRLogLevel {
} PRLogLevel;
typedef void (*PRLogCallback)(PRLogLevel level, const char *text); /**< Function pointer type for a custom logging callback. See: PRLogSetCallback(). */
PR_EXPORT void PRLogSetCallback(PRLogCallback callback); /**< Replaces the default logging handler with the given callback function. */
PINPROC_API void PRLogSetCallback(PRLogCallback callback); /**< Replaces the default logging handler with the given callback function. */
PR_EXPORT void PRLogSetLevel(PRLogLevel level);
PINPROC_API void PRLogSetLevel(PRLogLevel level);
PR_EXPORT const char *PRGetLastErrorText();
PINPROC_API const char *PRGetLastErrorText();
/**
* @defgroup device Device Creation & Deletion
@@ -112,8 +115,8 @@ typedef enum PRMachineType {
// PRHandle Creation and Deletion
PR_EXPORT PRHandle PRCreate(PRMachineType machineType); /**< Create a new P-ROC device handle. Only one handle per device may be created. This handle must be destroyed with PRDelete() when it is no longer needed. Returns #kPRHandleInvalid if an error occurred. */
PR_EXPORT void PRDelete(PRHandle handle); /**< Destroys an existing P-ROC device handle. */
PINPROC_API PRHandle PRCreate(PRMachineType machineType); /**< Create a new P-ROC device handle. Only one handle per device may be created. This handle must be destroyed with PRDelete() when it is no longer needed. Returns #kPRHandleInvalid if an error occurred. */
PINPROC_API void PRDelete(PRHandle handle); /**< Destroys an existing P-ROC device handle. */
#define kPRResetFlagDefault (0) /**< Only resets state in memory and does not write changes to the device. */
#define kPRResetFlagUpdateDevice (1) /**< Instructs PRReset() to update the device once it has reset the configuration to its defaults. */
@@ -122,20 +125,20 @@ PR_EXPORT void PRDelete(PRHandle handle); /**< Destroys an existin
* @brief Resets internally maintained driver and switch rule structures.
* @param resetFlags Specify #kPRResetFlagDefault to only reset the configuration in host memory. #kPRResetFlagUpdateDevice will write the default configuration to the device, effectively disabling all drivers and switch rules.
*/
PR_EXPORT PRResult PRReset(PRHandle handle, uint32_t resetFlags);
PINPROC_API PRResult PRReset(PRHandle handle, uint32_t resetFlags);
/** @} */ // End of Device Creation & Deletion
// I/O
/** Flush all pending write data out to the P-ROC. */
PR_EXPORT PRResult PRFlushWriteData(PRHandle handle);
PINPROC_API PRResult PRFlushWriteData(PRHandle handle);
/** Write data out to the P-ROC immediately (does not require a call to PRFlushWriteData). */
PR_EXPORT PRResult PRWriteData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numWriteWords, uint32_t * writeBuffer);
PINPROC_API PRResult PRWriteData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numWriteWords, uint32_t * writeBuffer);
/** Read data from the P-ROC. */
PR_EXPORT PRResult PRReadData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numReadWords, uint32_t * readBuffer);
PINPROC_API PRResult PRReadData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numReadWords, uint32_t * readBuffer);
// Manager
/** @defgroup Manager
@@ -148,7 +151,7 @@ typedef struct PRManagerConfig {
} PRManagerConfig;
/** Update Manager configuration */
PR_EXPORT PRResult PRManagerUpdateConfig(PRHandle handle, PRManagerConfig *managerConfig);
PINPROC_API PRResult PRManagerUpdateConfig(PRHandle handle, PRManagerConfig *managerConfig);
// Drivers
/** @defgroup drivers Driver Manipulation
@@ -214,24 +217,24 @@ typedef struct PRDriverAuxCommand {
} PRDriverAuxCommand;
/** Update registers for the global driver configuration. */
PR_EXPORT PRResult PRDriverUpdateGlobalConfig(PRHandle handle, PRDriverGlobalConfig *driverGlobalConfig);
PINPROC_API PRResult PRDriverUpdateGlobalConfig(PRHandle handle, PRDriverGlobalConfig *driverGlobalConfig);
PR_EXPORT PRResult PRDriverGetGroupConfig(PRHandle handle, uint8_t groupNum, PRDriverGroupConfig *driverGroupConfig);
PINPROC_API PRResult PRDriverGetGroupConfig(PRHandle handle, uint8_t groupNum, PRDriverGroupConfig *driverGroupConfig);
/** Update registers for the given driver group configuration. */
PR_EXPORT PRResult PRDriverUpdateGroupConfig(PRHandle handle, PRDriverGroupConfig *driverGroupConfig);
PINPROC_API PRResult PRDriverUpdateGroupConfig(PRHandle handle, PRDriverGroupConfig *driverGroupConfig);
PR_EXPORT PRResult PRDriverGetState(PRHandle handle, uint8_t driverNum, PRDriverState *driverState);
PINPROC_API PRResult PRDriverGetState(PRHandle handle, uint8_t driverNum, PRDriverState *driverState);
/**
* @brief Sets the state of the given driver (lamp or coil).
*/
PR_EXPORT PRResult PRDriverUpdateState(PRHandle handle, PRDriverState *driverState);
PINPROC_API PRResult PRDriverUpdateState(PRHandle handle, PRDriverState *driverState);
/**
* @brief Loads the driver defaults for the given machine type.
*
* PRReset() calls this function internally; this function is useful for basing custom driver settings off of the defaults for a particular machine.
* @note This function does not update the P-ROC hardware, only the internal data structures. Use PRDriverGetGlobalConfig() and PRDriverGetGroupConfig() to retrieve the settings.
*/
PR_EXPORT PRResult PRDriverLoadMachineTypeDefaults(PRHandle handle, PRMachineType machineType);
PINPROC_API PRResult PRDriverLoadMachineTypeDefaults(PRHandle handle, PRMachineType machineType);
// Driver Group Helper functions:
@@ -239,85 +242,85 @@ PR_EXPORT PRResult PRDriverLoadMachineTypeDefaults(PRHandle handle, PRMachineTyp
* Disables (turns off) the given driver group.
* This function is provided for convenience. See PRDriverGroupDisable() for a full description.
*/
PR_EXPORT PRResult PRDriverGroupDisable(PRHandle handle, uint8_t groupNum);
PINPROC_API PRResult PRDriverGroupDisable(PRHandle handle, uint8_t groupNum);
// Driver Helper functions:
/**
* Disables (turns off) the given driver.
* This function is provided for convenience. See PRDriverStateDisable() for a full description.
*/
PR_EXPORT PRResult PRDriverDisable(PRHandle handle, uint8_t driverNum);
PINPROC_API PRResult PRDriverDisable(PRHandle handle, uint8_t driverNum);
/**
* Pulses the given driver for a number of milliseconds.
* This function is provided for convenience. See PRDriverStatePulse() for a full description.
*/
PR_EXPORT PRResult PRDriverPulse(PRHandle handle, uint8_t driverNum, uint8_t milliseconds);
PINPROC_API PRResult PRDriverPulse(PRHandle handle, uint8_t driverNum, uint8_t milliseconds);
/**
* Assigns a repeating schedule to the given driver.
* This function is provided for convenience. See PRDriverStateSchedule() for a full description.
*/
PR_EXPORT PRResult PRDriverSchedule(PRHandle handle, uint8_t driverNum, uint32_t schedule, uint8_t cycleSeconds, bool_t now);
PINPROC_API PRResult PRDriverSchedule(PRHandle handle, uint8_t driverNum, uint32_t schedule, uint8_t cycleSeconds, bool_t now);
/**
* Assigns a pitter-patter schedule (repeating on/off) to the given driver.
* This function is provided for convenience. See PRDriverStatePatter() for a full description.
*/
PR_EXPORT PRResult PRDriverPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime);
PINPROC_API PRResult PRDriverPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime);
/**
* Assigns a pitter-patter schedule (repeating on/off) to the given driver on for the given duration.
* This function is provided for convenience. See PRDriverStatePulsedPatter() for a full description.
*/
PR_EXPORT PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime);
PINPROC_API PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime);
/**
* Assigns a pitter-patter schedule (repeating on/off) to the given driver for the given duration.
* This function is provided for convenience. See PRDriverStatePatter() for a full description.
*/
PR_EXPORT PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime);
PINPROC_API PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime);
/**
* Prepares an Aux Command to drive the Aux bus.
* This function is provided for convenience.
*/
PR_EXPORT void PRDriverAuxPrepareOutput(PRDriverAuxCommand *auxCommand, uint8_t data, uint8_t extraData, uint8_t enables, bool_t muxEnables, uint16_t delayTime);
PINPROC_API void PRDriverAuxPrepareOutput(PRDriverAuxCommand *auxCommand, uint8_t data, uint8_t extraData, uint8_t enables, bool_t muxEnables, uint16_t delayTime);
/**
* Prepares an Aux Command to delay the Aux logic.
* This function is provided for convenience.
*/
PR_EXPORT void PRDriverAuxPrepareDelay(PRDriverAuxCommand *auxCommand, uint16_t delayTime);
PINPROC_API void PRDriverAuxPrepareDelay(PRDriverAuxCommand *auxCommand, uint16_t delayTime);
/**
* Prepares an Aux Command to have the Aux memory pointer jump to a new address.
* This function is provided for convenience.
*/
PR_EXPORT void PRDriverAuxPrepareJump(PRDriverAuxCommand *auxCommand, uint8_t jumpAddr);
PINPROC_API void PRDriverAuxPrepareJump(PRDriverAuxCommand *auxCommand, uint8_t jumpAddr);
/**
* Prepares a disabled Aux Command.
* This function is provided for convenience.
*/
PR_EXPORT void PRDriverAuxPrepareDisable(PRDriverAuxCommand *auxCommand);
PINPROC_API void PRDriverAuxPrepareDisable(PRDriverAuxCommand *auxCommand);
/** Tickle the watchdog timer. */
PR_EXPORT PRResult PRDriverWatchdogTickle(PRHandle handle);
PINPROC_API PRResult PRDriverWatchdogTickle(PRHandle handle);
/**
* Changes the given #PRDriverGroupConfig to reflect a disabled group.
* @note The driver group config structure must be applied using PRDriverUpdateGroupConfig() to have any effect.
*/
PR_EXPORT void PRDriverGroupStateDisable(PRDriverGroupConfig *driverGroup);
PINPROC_API void PRDriverGroupStateDisable(PRDriverGroupConfig *driverGroup);
/**
* Changes the given #PRDriverState to reflect a disabled state.
* @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect.
*/
PR_EXPORT void PRDriverStateDisable(PRDriverState *driverState);
PINPROC_API void PRDriverStateDisable(PRDriverState *driverState);
/**
* Changes the given #PRDriverState to reflect a pulse state.
* @param milliseconds Number of milliseconds to pulse the driver for.
* @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect.
*/
PR_EXPORT void PRDriverStatePulse(PRDriverState *driverState, uint8_t milliseconds);
PINPROC_API void PRDriverStatePulse(PRDriverState *driverState, uint8_t milliseconds);
/**
* Changes the given #PRDriverState to reflect a scheduled state.
* Assigns a repeating schedule to the given driver.
* @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect.
*/
PR_EXPORT void PRDriverStateSchedule(PRDriverState *driverState, uint32_t schedule, uint8_t cycleSeconds, bool_t now);
PINPROC_API void PRDriverStateSchedule(PRDriverState *driverState, uint32_t schedule, uint8_t cycleSeconds, bool_t now);
/**
* @brief Changes the given #PRDriverState to reflect a pitter-patter schedule state.
* Assigns a pitter-patter schedule (repeating on/off) to the given driver.
@@ -325,27 +328,27 @@ PR_EXPORT void PRDriverStateSchedule(PRDriverState *driverState, uint32_t schedu
*
* Use originalOnTime to pulse the driver for a number of milliseconds before the pitter-patter schedule begins.
*/
PR_EXPORT void PRDriverStatePatter(PRDriverState *driverState, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime);
PINPROC_API void PRDriverStatePatter(PRDriverState *driverState, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime);
/**
* @brief Changes the given #PRDriverState to reflect a pitter-patter schedule state.
* Just like the regular Patter above, but PulsePatter only drives the patter
* scheduled for the given number of milliseconds before disabling the driver.
*/
PR_EXPORT void PRDriverStatePulsedPatter(PRDriverState *driverState, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t patterTime);
PINPROC_API void PRDriverStatePulsedPatter(PRDriverState *driverState, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t patterTime);
/**
* Write Aux Port commands into the Aux Port command memory.
*/
PR_EXPORT PRResult PRDriverAuxSendCommands(PRHandle handle, PRDriverAuxCommand * commands, uint8_t numCommands, uint8_t startingAddr);
PINPROC_API PRResult PRDriverAuxSendCommands(PRHandle handle, PRDriverAuxCommand * commands, uint8_t numCommands, uint8_t startingAddr);
/**
* @brief Converts a coil, lamp, switch, or GI string into a P-ROC driver number.
* The following formats are accepted: Cxx (coil), Lxx (lamp), Sxx (matrix switch), SFx (flipper grounded switch), or SDx (dedicated grounded switch).
* If the string does not match this format it will be converted into an integer using atoi().
*/
PR_EXPORT uint16_t PRDecode(PRMachineType machineType, const char *str);
PINPROC_API uint16_t PRDecode(PRMachineType machineType, const char *str);
/** @} */ // End of Drivers
@@ -376,7 +379,7 @@ typedef struct PREvent {
/** Get all of the available events that have been received.
* \return Number of events returned; -1 if an error occurred.
*/
PR_EXPORT int PRGetEvents(PRHandle handle, PREvent *eventsOut, int maxEvents);
PINPROC_API int PRGetEvents(PRHandle handle, PREvent *eventsOut, int maxEvents);
#define kPRSwitchPhysicalFirst (0) /**< Switch number of the first physical switch. */
@@ -404,7 +407,7 @@ typedef struct PRSwitchRule {
} PRSwitchRule;
/** Update the switch controller configurion registers */
PR_EXPORT PRResult PRSwitchUpdateConfig(PRHandle handle, PRSwitchConfig *switchConfig);
PINPROC_API PRResult PRSwitchUpdateConfig(PRHandle handle, PRSwitchConfig *switchConfig);
/**
* @brief Configures the handling of switch rules within P-ROC.
@@ -458,10 +461,10 @@ PR_EXPORT PRResult PRSwitchUpdateConfig(PRHandle handle, PRSwitchConfig *switchC
* @param linkedDrivers An array of #PRDriverState structures describing the driver state changes to be made when this switch rule is triggered. May be NULL if numDrivers is 0.
* @param numDrivers Number of elements in the linkedDrivers array. May be zero or more.
*/
PR_EXPORT PRResult PRSwitchUpdateRule(PRHandle handle, uint8_t switchNum, PREventType eventType, PRSwitchRule *rule, PRDriverState *linkedDrivers, int numDrivers);
PINPROC_API PRResult PRSwitchUpdateRule(PRHandle handle, uint8_t switchNum, PREventType eventType, PRSwitchRule *rule, PRDriverState *linkedDrivers, int numDrivers);
/** Returns a list of PREventTypes describing the states of the requested number of switches */
PR_EXPORT PRResult PRSwitchGetStates(PRHandle handle, PREventType * switchStates, uint16_t numSwitches);
PINPROC_API PRResult PRSwitchGetStates(PRHandle handle, PREventType * switchStates, uint16_t numSwitches);
/** @} */ // End of Switches & Events
@@ -486,9 +489,9 @@ typedef struct PRDMDConfig {
} PRDMDConfig;
/** Sets the configuration registers for the DMD driver. */
PR_EXPORT int32_t PRDMDUpdateConfig(PRHandle handle, PRDMDConfig *dmdConfig);
PINPROC_API int32_t PRDMDUpdateConfig(PRHandle handle, PRDMDConfig *dmdConfig);
/** Updates the DMD frame buffer with the given data. */
PR_EXPORT PRResult PRDMDDraw(PRHandle handle, uint8_t * dots);
PINPROC_API PRResult PRDMDDraw(PRHandle handle, uint8_t * dots);
/** @} */ // End of DMD
@@ -515,20 +518,20 @@ typedef struct PRJTAGOutputs {
} PRJTAGOutputs;
/** Force JTAG outputs (TCK, TDO, TMS) to specific values. Optionally toggle the clock when driving only TDO and/or TMS.*/
PR_EXPORT PRResult PRJTAGDriveOutputs(PRHandle handle, PRJTAGOutputs * jtagOutputs, bool_t toggleClk);
PINPROC_API PRResult PRJTAGDriveOutputs(PRHandle handle, PRJTAGOutputs * jtagOutputs, bool_t toggleClk);
/** Store data to be shifted out on TDO */
PR_EXPORT PRResult PRJTAGWriteTDOMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdoData);
PINPROC_API PRResult PRJTAGWriteTDOMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdoData);
/** Shift stored TDO data onto the TDO pin, toggling TCK on every bit. */
PR_EXPORT PRResult PRJTAGShiftTDOData(PRHandle handle, uint16_t numBits, bool_t dataBlockComplete);
PINPROC_API PRResult PRJTAGShiftTDOData(PRHandle handle, uint16_t numBits, bool_t dataBlockComplete);
/** Get the contents of the TDI memory. */
PR_EXPORT PRResult PRJTAGReadTDIMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdiData);
PINPROC_API PRResult PRJTAGReadTDIMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdiData);
/** Read the JTAG status register for the command complete bit and JTAG pin states. */
PR_EXPORT PRResult PRJTAGGetStatus(PRHandle handle, PRJTAGStatus * status);
PINPROC_API PRResult PRJTAGGetStatus(PRHandle handle, PRJTAGStatus * status);
/** @} */ // End of DMD
/** @cond */
PR_EXTERN_C_END
PINPROC_EXTERN_C_END
/** @endcond */
/**

View File

@@ -81,7 +81,7 @@ void PRSetLastErrorText(const char *format, ...)
PRLog(kPRLogError, "%s\n", lastErrorText);
}
PR_EXPORT const char *PRGetLastErrorText()
const char *PRGetLastErrorText()
{
return lastErrorText;
}
@@ -89,7 +89,7 @@ PR_EXPORT const char *PRGetLastErrorText()
#define handleAsDevice ((PRDevice*)handle)
/** Create a new P-ROC device handle. Only one handle per device may be created. This handle must be destroyed with PRDelete() when it is no longer needed. */
PR_EXPORT PRHandle PRCreate(PRMachineType machineType)
PRHandle PRCreate(PRMachineType machineType)
{
PRDevice *device = PRDevice::Create(machineType);
if (device == NULL)
@@ -98,14 +98,14 @@ PR_EXPORT PRHandle PRCreate(PRMachineType machineType)
return device;
}
/** Destroys an existing P-ROC device handle. */
PR_EXPORT void PRDelete(PRHandle handle)
void PRDelete(PRHandle handle)
{
if (handle != kPRHandleInvalid)
delete (PRDevice*)handle;
}
/** Resets internally maintained driver and switch rule structures and optionally writes those to the P-ROC device. */
PR_EXPORT PRResult PRReset(PRHandle handle, uint32_t resetFlags)
PRResult PRReset(PRHandle handle, uint32_t resetFlags)
{
return handleAsDevice->Reset(resetFlags);
}
@@ -113,19 +113,19 @@ PR_EXPORT PRResult PRReset(PRHandle handle, uint32_t resetFlags)
// I/O
/** Flush all pending write data out to the P-ROC */
PR_EXPORT PRResult PRFlushWriteData(PRHandle handle)
PRResult PRFlushWriteData(PRHandle handle)
{
return handleAsDevice->FlushWriteData();
}
/** Write data out to the P-ROC immediately (does not require a call to PRFlushWriteData */
PR_EXPORT PRResult PRWriteData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numWriteWords, uint32_t * writeBuffer)
PRResult PRWriteData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numWriteWords, uint32_t * writeBuffer)
{
return handleAsDevice->WriteDataRaw(moduleSelect, startingAddr, numWriteWords, writeBuffer);
}
/** Read data from the P-ROC. */
PR_EXPORT PRResult PRReadData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numReadWords, uint32_t * readBuffer)
PRResult PRReadData(PRHandle handle, uint32_t moduleSelect, uint32_t startingAddr, int32_t numReadWords, uint32_t * readBuffer)
{
return handleAsDevice->ReadDataRaw(moduleSelect, startingAddr, numReadWords, readBuffer);
}
@@ -133,45 +133,45 @@ PR_EXPORT PRResult PRReadData(PRHandle handle, uint32_t moduleSelect, uint32_t s
// Events
/** Get all of the available events that have been received. */
PR_EXPORT int PRGetEvents(PRHandle handle, PREvent *eventsOut, int maxEvents)
int PRGetEvents(PRHandle handle, PREvent *eventsOut, int maxEvents)
{
return handleAsDevice->GetEvents(eventsOut, maxEvents);
}
// Manager
PR_EXPORT PRResult PRManagerUpdateConfig(PRHandle handle, PRManagerConfig *managerConfig)
PRResult PRManagerUpdateConfig(PRHandle handle, PRManagerConfig *managerConfig)
{
return handleAsDevice->ManagerUpdateConfig(managerConfig);
}
// Drivers
PR_EXPORT PRResult PRDriverUpdateGlobalConfig(PRHandle handle, PRDriverGlobalConfig *driverGlobalConfig)
PRResult PRDriverUpdateGlobalConfig(PRHandle handle, PRDriverGlobalConfig *driverGlobalConfig)
{
return handleAsDevice->DriverUpdateGlobalConfig(driverGlobalConfig);
}
PR_EXPORT PRResult PRDriverGetGroupConfig(PRHandle handle, uint8_t groupNum, PRDriverGroupConfig *driverGroupConfig)
PRResult PRDriverGetGroupConfig(PRHandle handle, uint8_t groupNum, PRDriverGroupConfig *driverGroupConfig)
{
return handleAsDevice->DriverGetGroupConfig(groupNum, driverGroupConfig);
}
PR_EXPORT PRResult PRDriverUpdateGroupConfig(PRHandle handle, PRDriverGroupConfig *driverGroupConfig)
PRResult PRDriverUpdateGroupConfig(PRHandle handle, PRDriverGroupConfig *driverGroupConfig)
{
return handleAsDevice->DriverUpdateGroupConfig(driverGroupConfig);
}
PR_EXPORT PRResult PRDriverGetState(PRHandle handle, uint8_t driverNum, PRDriverState *driverState)
PRResult PRDriverGetState(PRHandle handle, uint8_t driverNum, PRDriverState *driverState)
{
return handleAsDevice->DriverGetState(driverNum, driverState);
}
PR_EXPORT PRResult PRDriverUpdateState(PRHandle handle, PRDriverState *driverState)
PRResult PRDriverUpdateState(PRHandle handle, PRDriverState *driverState)
{
return handleAsDevice->DriverUpdateState(driverState);
}
PR_EXPORT PRResult PRDriverLoadMachineTypeDefaults(PRHandle handle, PRMachineType machineType)
PRResult PRDriverLoadMachineTypeDefaults(PRHandle handle, PRMachineType machineType)
{
return handleAsDevice->DriverLoadMachineTypeDefaults(machineType);
}
// Driver Group Helper functions:
PR_EXPORT PRResult PRDriverGroupDisable(PRHandle handle, uint8_t groupNum)
PRResult PRDriverGroupDisable(PRHandle handle, uint8_t groupNum)
{
PRDriverGroupConfig driverGroup;
handleAsDevice->DriverGetGroupConfig(groupNum, &driverGroup);
@@ -179,47 +179,47 @@ PR_EXPORT PRResult PRDriverGroupDisable(PRHandle handle, uint8_t groupNum)
return handleAsDevice->DriverUpdateGroupConfig(&driverGroup);
}
// Driver Helper functions:
PR_EXPORT PRResult PRDriverDisable(PRHandle handle, uint8_t driverNum)
PRResult PRDriverDisable(PRHandle handle, uint8_t driverNum)
{
PRDriverState driver;
handleAsDevice->DriverGetState(driverNum, &driver);
PRDriverStateDisable(&driver);
return handleAsDevice->DriverUpdateState(&driver);
}
PR_EXPORT PRResult PRDriverPulse(PRHandle handle, uint8_t driverNum, uint8_t milliseconds)
PRResult PRDriverPulse(PRHandle handle, uint8_t driverNum, uint8_t milliseconds)
{
PRDriverState driver;
handleAsDevice->DriverGetState(driverNum, &driver);
PRDriverStatePulse(&driver, milliseconds);
return handleAsDevice->DriverUpdateState(&driver);
}
PR_EXPORT PRResult PRDriverSchedule(PRHandle handle, uint8_t driverNum, uint32_t schedule, uint8_t cycleSeconds, bool_t now)
PRResult PRDriverSchedule(PRHandle handle, uint8_t driverNum, uint32_t schedule, uint8_t cycleSeconds, bool_t now)
{
PRDriverState driver;
handleAsDevice->DriverGetState(driverNum, &driver);
PRDriverStateSchedule(&driver, schedule, cycleSeconds, now);
return handleAsDevice->DriverUpdateState(&driver);
}
PR_EXPORT PRResult PRDriverPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime)
PRResult PRDriverPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime)
{
PRDriverState driver;
handleAsDevice->DriverGetState(driverNum, &driver);
PRDriverStatePatter(&driver, millisecondsOn, millisecondsOff, originalOnTime);
return handleAsDevice->DriverUpdateState(&driver);
}
PR_EXPORT PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t duration)
PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t duration)
{
PRDriverState driver;
handleAsDevice->DriverGetState(driverNum, &driver);
PRDriverStatePulsedPatter(&driver, millisecondsOn, millisecondsOff, duration);
return handleAsDevice->DriverUpdateState(&driver);
}
PR_EXPORT PRResult PRDriverAuxSendCommands(PRHandle handle, PRDriverAuxCommand * commands, uint8_t numCommands, uint8_t startingAddr)
PRResult PRDriverAuxSendCommands(PRHandle handle, PRDriverAuxCommand * commands, uint8_t numCommands, uint8_t startingAddr)
{
return handleAsDevice->DriverAuxSendCommands(commands, numCommands, startingAddr);
}
PR_EXPORT void PRDriverAuxPrepareOutput(PRDriverAuxCommand *auxCommand, uint8_t data, uint8_t extraData, uint8_t enables, bool_t muxEnables, uint16_t delayTime)
void PRDriverAuxPrepareOutput(PRDriverAuxCommand *auxCommand, uint8_t data, uint8_t extraData, uint8_t enables, bool_t muxEnables, uint16_t delayTime)
{
auxCommand->active = true;
auxCommand->data = data;
@@ -230,7 +230,7 @@ PR_EXPORT void PRDriverAuxPrepareOutput(PRDriverAuxCommand *auxCommand, uint8_t
auxCommand->delayTime = delayTime;
}
PR_EXPORT void PRDriverAuxPrepareDelay(PRDriverAuxCommand *auxCommand, uint16_t delayTime)
void PRDriverAuxPrepareDelay(PRDriverAuxCommand *auxCommand, uint16_t delayTime)
{
auxCommand->active = true;
auxCommand->delayTime = delayTime;
@@ -241,7 +241,7 @@ PR_EXPORT void PRDriverAuxPrepareDelay(PRDriverAuxCommand *auxCommand, uint16_t
auxCommand->muxEnables = false;
}
PR_EXPORT void PRDriverAuxPrepareJump(PRDriverAuxCommand *auxCommand, uint8_t jumpAddr)
void PRDriverAuxPrepareJump(PRDriverAuxCommand *auxCommand, uint8_t jumpAddr)
{
auxCommand->active = true;
auxCommand->jumpAddr = jumpAddr;
@@ -252,7 +252,7 @@ PR_EXPORT void PRDriverAuxPrepareJump(PRDriverAuxCommand *auxCommand, uint8_t ju
auxCommand->muxEnables = false;
}
PR_EXPORT void PRDriverAuxPrepareDisable(PRDriverAuxCommand *auxCommand)
void PRDriverAuxPrepareDisable(PRDriverAuxCommand *auxCommand)
{
auxCommand->active = false;
auxCommand->data = 0;
@@ -261,16 +261,16 @@ PR_EXPORT void PRDriverAuxPrepareDisable(PRDriverAuxCommand *auxCommand)
auxCommand->muxEnables = false;
}
PR_EXPORT PRResult PRDriverWatchdogTickle(PRHandle handle)
PRResult PRDriverWatchdogTickle(PRHandle handle)
{
return handleAsDevice->DriverWatchdogTickle();
}
PR_EXPORT void PRDriverGroupStateDisable(PRDriverGroupConfig *driverGroup)
void PRDriverGroupStateDisable(PRDriverGroupConfig *driverGroup)
{
driverGroup->active = false;
}
PR_EXPORT void PRDriverStateDisable(PRDriverState *driver)
void PRDriverStateDisable(PRDriverState *driver)
{
driver->state = 0;
driver->timeslots = 0;
@@ -280,7 +280,7 @@ PR_EXPORT void PRDriverStateDisable(PRDriverState *driver)
driver->patterOffTime = 0;
driver->patterEnable = false;
}
PR_EXPORT void PRDriverStatePulse(PRDriverState *driver, uint8_t milliseconds)
void PRDriverStatePulse(PRDriverState *driver, uint8_t milliseconds)
{
driver->state = 1;
driver->timeslots = 0;
@@ -290,7 +290,7 @@ PR_EXPORT void PRDriverStatePulse(PRDriverState *driver, uint8_t milliseconds)
driver->patterOffTime = 0;
driver->patterEnable = false;
}
PR_EXPORT void PRDriverStateSchedule(PRDriverState *driver, uint32_t schedule, uint8_t cycleSeconds, bool_t now)
void PRDriverStateSchedule(PRDriverState *driver, uint32_t schedule, uint8_t cycleSeconds, bool_t now)
{
driver->state = 1;
driver->timeslots = schedule;
@@ -300,7 +300,7 @@ PR_EXPORT void PRDriverStateSchedule(PRDriverState *driver, uint32_t schedule, u
driver->patterOffTime = 0;
driver->patterEnable = false;
}
PR_EXPORT void PRDriverStatePatter(PRDriverState *driver, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime)
void PRDriverStatePatter(PRDriverState *driver, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime)
{
driver->state = true;
driver->timeslots = 0;
@@ -311,7 +311,7 @@ PR_EXPORT void PRDriverStatePatter(PRDriverState *driver, uint8_t millisecondsOn
driver->patterEnable = true;
}
PR_EXPORT void PRDriverStatePulsedPatter(PRDriverState *driver, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t patterTime)
void PRDriverStatePulsedPatter(PRDriverState *driver, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t patterTime)
{
driver->state = false;
driver->timeslots = 0;
@@ -322,7 +322,7 @@ PR_EXPORT void PRDriverStatePulsedPatter(PRDriverState *driver, uint8_t millisec
driver->patterEnable = true;
}
PR_EXPORT uint16_t PRDecode(PRMachineType machineType, const char *str)
uint16_t PRDecode(PRMachineType machineType, const char *str)
{
uint16_t x;
@@ -492,55 +492,55 @@ PR_EXPORT uint16_t PRDecode(PRMachineType machineType, const char *str)
// Switches
PR_EXPORT PRResult PRSwitchUpdateConfig(PRHandle handle, PRSwitchConfig *switchConfig)
PRResult PRSwitchUpdateConfig(PRHandle handle, PRSwitchConfig *switchConfig)
{
return handleAsDevice->SwitchUpdateConfig(switchConfig);
}
PR_EXPORT PRResult PRSwitchUpdateRule(PRHandle handle, uint8_t switchNum, PREventType eventType, PRSwitchRule *rule, PRDriverState *linkedDrivers, int numDrivers)
PRResult PRSwitchUpdateRule(PRHandle handle, uint8_t switchNum, PREventType eventType, PRSwitchRule *rule, PRDriverState *linkedDrivers, int numDrivers)
{
return handleAsDevice->SwitchUpdateRule(switchNum, eventType, rule, linkedDrivers, numDrivers);
}
PR_EXPORT PRResult PRSwitchGetStates(PRHandle handle, PREventType * switchStates, uint16_t numSwitches)
PRResult PRSwitchGetStates(PRHandle handle, PREventType * switchStates, uint16_t numSwitches)
{
return handleAsDevice->SwitchGetStates(switchStates, numSwitches);
}
// DMD
PR_EXPORT int32_t PRDMDUpdateConfig(PRHandle handle, PRDMDConfig *dmdConfig)
int32_t PRDMDUpdateConfig(PRHandle handle, PRDMDConfig *dmdConfig)
{
return handleAsDevice->DMDUpdateConfig(dmdConfig);
}
PR_EXPORT PRResult PRDMDDraw(PRHandle handle, uint8_t * dots)
PRResult PRDMDDraw(PRHandle handle, uint8_t * dots)
{
return handleAsDevice->DMDDraw(dots);
}
// JTAG
PR_EXPORT PRResult PRJTAGDriveOutputs(PRHandle handle, PRJTAGOutputs * jtagOutputs, bool_t toggleClk)
PRResult PRJTAGDriveOutputs(PRHandle handle, PRJTAGOutputs * jtagOutputs, bool_t toggleClk)
{
return handleAsDevice->PRJTAGDriveOutputs(jtagOutputs, toggleClk);
}
PR_EXPORT PRResult PRJTAGWriteTDOMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdoData)
PRResult PRJTAGWriteTDOMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdoData)
{
return handleAsDevice->PRJTAGWriteTDOMemory(tableOffset, numWords, tdoData);
}
PR_EXPORT PRResult PRJTAGShiftTDOData(PRHandle handle, uint16_t numBits, bool_t dataBlockComplete)
PRResult PRJTAGShiftTDOData(PRHandle handle, uint16_t numBits, bool_t dataBlockComplete)
{
return handleAsDevice->PRJTAGShiftTDOData(numBits, dataBlockComplete);
}
PR_EXPORT PRResult PRJTAGReadTDIMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdiData)
PRResult PRJTAGReadTDIMemory(PRHandle handle, uint16_t tableOffset, uint16_t numWords, uint32_t * tdiData)
{
return handleAsDevice->PRJTAGReadTDIMemory(tableOffset, numWords, tdiData);
}
PR_EXPORT PRResult PRJTAGGetStatus(PRHandle handle, PRJTAGStatus * status)
PRResult PRJTAGGetStatus(PRHandle handle, PRJTAGStatus * status)
{
return handleAsDevice->PRJTAGGetStatus(status);
}

52
src/pinproc.def Normal file
View File

@@ -0,0 +1,52 @@
LIBRARY "pinproc.dll"
DESCRIPTION "PinPROC library. See http://www.pinballcontrollers.com/"
EXPORTS
; since API/SO version 0.9
PRCreate @1
PRDMDDraw @2
PRDMDUpdateConfig @3
PRDecode @4
PRDelete @5
PRDriverAuxPrepareDelay @6
PRDriverAuxPrepareDisable @7
PRDriverAuxPrepareJump @8
PRDriverAuxPrepareOutput @9
PRDriverAuxSendCommands @10
PRDriverDisable @11
PRDriverGetGroupConfig @12
PRDriverGetState @13
PRDriverGroupDisable @14
PRDriverGroupStateDisable @15
PRDriverLoadMachineTypeDefaults @16
PRDriverPatter @17
PRDriverPulse @18
PRDriverPulsedPatter @19
PRDriverSchedule @20
PRDriverStateDisable @21
PRDriverStatePatter @22
PRDriverStatePulse @23
PRDriverStatePulsedPatter @24
PRDriverStateSchedule @25
PRDriverUpdateGlobalConfig @26
PRDriverUpdateGroupConfig @27
PRDriverUpdateState @28
PRDriverWatchdogTickle @29
PRFlushWriteData @30
PRGetEvents @31
PRGetLastErrorText @32
PRJTAGDriveOutputs @33
PRJTAGGetStatus @34
PRJTAGReadTDIMemory @35
PRJTAGShiftTDOData @36
PRJTAGWriteTDOMemory @37
PRLogSetCallback @38
PRLogSetLevel @39
PRManagerUpdateConfig @40
PRReadData @41
PRReset @42
PRSwitchGetStates @43
PRSwitchUpdateConfig @44
PRSwitchUpdateRule @45
PRWriteData @46

View File

@@ -308,61 +308,61 @@ TXsvfDoCmdFuncPtr xsvf_pfDoCmd[] =
#ifdef DEBUG_MODE
char* xsvf_pzCommandName[] =
{
"XCOMPLETE",
"XTDOMASK",
"XSIR",
"XSDR",
"XRUNTEST",
"Reserved5",
"Reserved6",
"XREPEAT",
"XSDRSIZE",
"XSDRTDO",
"XSETSDRMASKS",
"XSDRINC",
"XSDRB",
"XSDRC",
"XSDRE",
"XSDRTDOB",
"XSDRTDOC",
"XSDRTDOE",
"XSTATE",
"XENDIR",
"XENDDR",
"XSIR2",
"XCOMMENT",
"XWAIT"
(char *)"XCOMPLETE",
(char *)"XTDOMASK",
(char *)"XSIR",
(char *)"XSDR",
(char *)"XRUNTEST",
(char *)"Reserved5",
(char *)"Reserved6",
(char *)"XREPEAT",
(char *)"XSDRSIZE",
(char *)"XSDRTDO",
(char *)"XSETSDRMASKS",
(char *)"XSDRINC",
(char *)"XSDRB",
(char *)"XSDRC",
(char *)"XSDRE",
(char *)"XSDRTDOB",
(char *)"XSDRTDOC",
(char *)"XSDRTDOE",
(char *)"XSTATE",
(char *)"XENDIR",
(char *)"XENDDR",
(char *)"XSIR2",
(char *)"XCOMMENT",
(char *)"XWAIT"
};
char* xsvf_pzErrorName[] =
{
"No error",
"ERROR: Unknown",
"ERROR: TDO mismatch",
"ERROR: TDO mismatch and exceeded max retries",
"ERROR: Unsupported XSVF command",
"ERROR: Illegal state specification",
"ERROR: Data overflows allocated MAX_LEN buffer size"
(char *)"No error",
(char *)"ERROR: Unknown",
(char *)"ERROR: TDO mismatch",
(char *)"ERROR: TDO mismatch and exceeded max retries",
(char *)"ERROR: Unsupported XSVF command",
(char *)"ERROR: Illegal state specification",
(char *)"ERROR: Data overflows allocated MAX_LEN buffer size"
};
char* xsvf_pzTapState[] =
{
"RESET", /* 0x00 */
"RUNTEST/IDLE", /* 0x01 */
"DRSELECT", /* 0x02 */
"DRCAPTURE", /* 0x03 */
"DRSHIFT", /* 0x04 */
"DREXIT1", /* 0x05 */
"DRPAUSE", /* 0x06 */
"DREXIT2", /* 0x07 */
"DRUPDATE", /* 0x08 */
"IRSELECT", /* 0x09 */
"IRCAPTURE", /* 0x0A */
"IRSHIFT", /* 0x0B */
"IREXIT1", /* 0x0C */
"IRPAUSE", /* 0x0D */
"IREXIT2", /* 0x0E */
"IRUPDATE" /* 0x0F */
(char *)"RESET", /* 0x00 */
(char *)"RUNTEST/IDLE", /* 0x01 */
(char *)"DRSELECT", /* 0x02 */
(char *)"DRCAPTURE", /* 0x03 */
(char *)"DRSHIFT", /* 0x04 */
(char *)"DREXIT1", /* 0x05 */
(char *)"DRPAUSE", /* 0x06 */
(char *)"DREXIT2", /* 0x07 */
(char *)"DRUPDATE", /* 0x08 */
(char *)"IRSELECT", /* 0x09 */
(char *)"IRCAPTURE", /* 0x0A */
(char *)"IRSHIFT", /* 0x0B */
(char *)"IREXIT1", /* 0x0C */
(char *)"IRPAUSE", /* 0x0D */
(char *)"IREXIT2", /* 0x0E */
(char *)"IRUPDATE" /* 0x0F */
};
#endif /* DEBUG_MODE */
@@ -1271,7 +1271,7 @@ int xsvfDoXSIR2( SXsvfInfo* pXsvfInfo )
readVal( &(pXsvfInfo->lvTdi), 2 );
lShiftIrBits = value( &(pXsvfInfo->lvTdi) );
sShiftIrBytes = xsvfGetAsNumBytes( lShiftIrBits );
XSVFDBG_PRINTF1( 3, " XSIR2 length = %d\n", lShiftIrBits);
XSVFDBG_PRINTF1( 3, " XSIR2 length = %ld\n", lShiftIrBits);
if ( sShiftIrBytes > MAX_LEN )
{